xref: /linux/sound/pci/hda/patch_realtek.c (revision 5c1672705a1a2389f5ad78e0fea6f08ed32d6f18)
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/acpi.h>
14 #include <linux/init.h>
15 #include <linux/delay.h>
16 #include <linux/slab.h>
17 #include <linux/pci.h>
18 #include <linux/dmi.h>
19 #include <linux/module.h>
20 #include <linux/input.h>
21 #include <linux/leds.h>
22 #include <linux/ctype.h>
23 #include <sound/core.h>
24 #include <sound/jack.h>
25 #include <sound/hda_codec.h>
26 #include "hda_local.h"
27 #include "hda_auto_parser.h"
28 #include "hda_jack.h"
29 #include "hda_generic.h"
30 #include "hda_component.h"
31 
32 /* keep halting ALC5505 DSP, for power saving */
33 #define HALT_REALTEK_ALC5505
34 
35 /* extra amp-initialization sequence types */
36 enum {
37 	ALC_INIT_UNDEFINED,
38 	ALC_INIT_NONE,
39 	ALC_INIT_DEFAULT,
40 };
41 
42 enum {
43 	ALC_HEADSET_MODE_UNKNOWN,
44 	ALC_HEADSET_MODE_UNPLUGGED,
45 	ALC_HEADSET_MODE_HEADSET,
46 	ALC_HEADSET_MODE_MIC,
47 	ALC_HEADSET_MODE_HEADPHONE,
48 };
49 
50 enum {
51 	ALC_HEADSET_TYPE_UNKNOWN,
52 	ALC_HEADSET_TYPE_CTIA,
53 	ALC_HEADSET_TYPE_OMTP,
54 };
55 
56 enum {
57 	ALC_KEY_MICMUTE_INDEX,
58 };
59 
60 struct alc_customize_define {
61 	unsigned int  sku_cfg;
62 	unsigned char port_connectivity;
63 	unsigned char check_sum;
64 	unsigned char customization;
65 	unsigned char external_amp;
66 	unsigned int  enable_pcbeep:1;
67 	unsigned int  platform_type:1;
68 	unsigned int  swap:1;
69 	unsigned int  override:1;
70 	unsigned int  fixup:1; /* Means that this sku is set by driver, not read from hw */
71 };
72 
73 struct alc_coef_led {
74 	unsigned int idx;
75 	unsigned int mask;
76 	unsigned int on;
77 	unsigned int off;
78 };
79 
80 struct alc_spec {
81 	struct hda_gen_spec gen; /* must be at head */
82 
83 	/* codec parameterization */
84 	struct alc_customize_define cdefine;
85 	unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
86 
87 	/* GPIO bits */
88 	unsigned int gpio_mask;
89 	unsigned int gpio_dir;
90 	unsigned int gpio_data;
91 	bool gpio_write_delay;	/* add a delay before writing gpio_data */
92 
93 	/* mute LED for HP laptops, see vref_mute_led_set() */
94 	int mute_led_polarity;
95 	int micmute_led_polarity;
96 	hda_nid_t mute_led_nid;
97 	hda_nid_t cap_mute_led_nid;
98 
99 	unsigned int gpio_mute_led_mask;
100 	unsigned int gpio_mic_led_mask;
101 	struct alc_coef_led mute_led_coef;
102 	struct alc_coef_led mic_led_coef;
103 	struct mutex coef_mutex;
104 
105 	hda_nid_t headset_mic_pin;
106 	hda_nid_t headphone_mic_pin;
107 	int current_headset_mode;
108 	int current_headset_type;
109 
110 	/* hooks */
111 	void (*init_hook)(struct hda_codec *codec);
112 #ifdef CONFIG_PM
113 	void (*power_hook)(struct hda_codec *codec);
114 #endif
115 	void (*shutup)(struct hda_codec *codec);
116 
117 	int init_amp;
118 	int codec_variant;	/* flag for other variants */
119 	unsigned int has_alc5505_dsp:1;
120 	unsigned int no_depop_delay:1;
121 	unsigned int done_hp_init:1;
122 	unsigned int no_shutup_pins:1;
123 	unsigned int ultra_low_power:1;
124 	unsigned int has_hs_key:1;
125 	unsigned int no_internal_mic_pin:1;
126 	unsigned int en_3kpull_low:1;
127 
128 	/* for PLL fix */
129 	hda_nid_t pll_nid;
130 	unsigned int pll_coef_idx, pll_coef_bit;
131 	unsigned int coef0;
132 	struct input_dev *kb_dev;
133 	u8 alc_mute_keycode_map[1];
134 
135 	/* component binding */
136 	struct hda_component comps[HDA_MAX_COMPONENTS];
137 };
138 
139 /*
140  * COEF access helper functions
141  */
142 
143 static void coef_mutex_lock(struct hda_codec *codec)
144 {
145 	struct alc_spec *spec = codec->spec;
146 
147 	snd_hda_power_up_pm(codec);
148 	mutex_lock(&spec->coef_mutex);
149 }
150 
151 static void coef_mutex_unlock(struct hda_codec *codec)
152 {
153 	struct alc_spec *spec = codec->spec;
154 
155 	mutex_unlock(&spec->coef_mutex);
156 	snd_hda_power_down_pm(codec);
157 }
158 
159 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 				 unsigned int coef_idx)
161 {
162 	unsigned int val;
163 
164 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
165 	val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
166 	return val;
167 }
168 
169 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
170 			       unsigned int coef_idx)
171 {
172 	unsigned int val;
173 
174 	coef_mutex_lock(codec);
175 	val = __alc_read_coefex_idx(codec, nid, coef_idx);
176 	coef_mutex_unlock(codec);
177 	return val;
178 }
179 
180 #define alc_read_coef_idx(codec, coef_idx) \
181 	alc_read_coefex_idx(codec, 0x20, coef_idx)
182 
183 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
184 				   unsigned int coef_idx, unsigned int coef_val)
185 {
186 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
187 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
188 }
189 
190 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
191 				 unsigned int coef_idx, unsigned int coef_val)
192 {
193 	coef_mutex_lock(codec);
194 	__alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
195 	coef_mutex_unlock(codec);
196 }
197 
198 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
199 	alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
200 
201 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
202 				    unsigned int coef_idx, unsigned int mask,
203 				    unsigned int bits_set)
204 {
205 	unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
206 
207 	if (val != -1)
208 		__alc_write_coefex_idx(codec, nid, coef_idx,
209 				       (val & ~mask) | bits_set);
210 }
211 
212 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
213 				  unsigned int coef_idx, unsigned int mask,
214 				  unsigned int bits_set)
215 {
216 	coef_mutex_lock(codec);
217 	__alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
218 	coef_mutex_unlock(codec);
219 }
220 
221 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set)	\
222 	alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
223 
224 /* a special bypass for COEF 0; read the cached value at the second time */
225 static unsigned int alc_get_coef0(struct hda_codec *codec)
226 {
227 	struct alc_spec *spec = codec->spec;
228 
229 	if (!spec->coef0)
230 		spec->coef0 = alc_read_coef_idx(codec, 0);
231 	return spec->coef0;
232 }
233 
234 /* coef writes/updates batch */
235 struct coef_fw {
236 	unsigned char nid;
237 	unsigned char idx;
238 	unsigned short mask;
239 	unsigned short val;
240 };
241 
242 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
243 	{ .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
244 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
245 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
246 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
247 
248 static void alc_process_coef_fw(struct hda_codec *codec,
249 				const struct coef_fw *fw)
250 {
251 	coef_mutex_lock(codec);
252 	for (; fw->nid; fw++) {
253 		if (fw->mask == (unsigned short)-1)
254 			__alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
255 		else
256 			__alc_update_coefex_idx(codec, fw->nid, fw->idx,
257 						fw->mask, fw->val);
258 	}
259 	coef_mutex_unlock(codec);
260 }
261 
262 /*
263  * GPIO setup tables, used in initialization
264  */
265 
266 /* Enable GPIO mask and set output */
267 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
268 {
269 	struct alc_spec *spec = codec->spec;
270 
271 	spec->gpio_mask |= mask;
272 	spec->gpio_dir |= mask;
273 	spec->gpio_data |= mask;
274 }
275 
276 static void alc_write_gpio_data(struct hda_codec *codec)
277 {
278 	struct alc_spec *spec = codec->spec;
279 
280 	snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
281 			    spec->gpio_data);
282 }
283 
284 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
285 				 bool on)
286 {
287 	struct alc_spec *spec = codec->spec;
288 	unsigned int oldval = spec->gpio_data;
289 
290 	if (on)
291 		spec->gpio_data |= mask;
292 	else
293 		spec->gpio_data &= ~mask;
294 	if (oldval != spec->gpio_data)
295 		alc_write_gpio_data(codec);
296 }
297 
298 static void alc_write_gpio(struct hda_codec *codec)
299 {
300 	struct alc_spec *spec = codec->spec;
301 
302 	if (!spec->gpio_mask)
303 		return;
304 
305 	snd_hda_codec_write(codec, codec->core.afg, 0,
306 			    AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
307 	snd_hda_codec_write(codec, codec->core.afg, 0,
308 			    AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
309 	if (spec->gpio_write_delay)
310 		msleep(1);
311 	alc_write_gpio_data(codec);
312 }
313 
314 static void alc_fixup_gpio(struct hda_codec *codec, int action,
315 			   unsigned int mask)
316 {
317 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
318 		alc_setup_gpio(codec, mask);
319 }
320 
321 static void alc_fixup_gpio1(struct hda_codec *codec,
322 			    const struct hda_fixup *fix, int action)
323 {
324 	alc_fixup_gpio(codec, action, 0x01);
325 }
326 
327 static void alc_fixup_gpio2(struct hda_codec *codec,
328 			    const struct hda_fixup *fix, int action)
329 {
330 	alc_fixup_gpio(codec, action, 0x02);
331 }
332 
333 static void alc_fixup_gpio3(struct hda_codec *codec,
334 			    const struct hda_fixup *fix, int action)
335 {
336 	alc_fixup_gpio(codec, action, 0x03);
337 }
338 
339 static void alc_fixup_gpio4(struct hda_codec *codec,
340 			    const struct hda_fixup *fix, int action)
341 {
342 	alc_fixup_gpio(codec, action, 0x04);
343 }
344 
345 static void alc_fixup_micmute_led(struct hda_codec *codec,
346 				  const struct hda_fixup *fix, int action)
347 {
348 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
349 		snd_hda_gen_add_micmute_led_cdev(codec, NULL);
350 }
351 
352 /*
353  * Fix hardware PLL issue
354  * On some codecs, the analog PLL gating control must be off while
355  * the default value is 1.
356  */
357 static void alc_fix_pll(struct hda_codec *codec)
358 {
359 	struct alc_spec *spec = codec->spec;
360 
361 	if (spec->pll_nid)
362 		alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
363 				      1 << spec->pll_coef_bit, 0);
364 }
365 
366 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
367 			     unsigned int coef_idx, unsigned int coef_bit)
368 {
369 	struct alc_spec *spec = codec->spec;
370 	spec->pll_nid = nid;
371 	spec->pll_coef_idx = coef_idx;
372 	spec->pll_coef_bit = coef_bit;
373 	alc_fix_pll(codec);
374 }
375 
376 /* update the master volume per volume-knob's unsol event */
377 static void alc_update_knob_master(struct hda_codec *codec,
378 				   struct hda_jack_callback *jack)
379 {
380 	unsigned int val;
381 	struct snd_kcontrol *kctl;
382 	struct snd_ctl_elem_value *uctl;
383 
384 	kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
385 	if (!kctl)
386 		return;
387 	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
388 	if (!uctl)
389 		return;
390 	val = snd_hda_codec_read(codec, jack->nid, 0,
391 				 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
392 	val &= HDA_AMP_VOLMASK;
393 	uctl->value.integer.value[0] = val;
394 	uctl->value.integer.value[1] = val;
395 	kctl->put(kctl, uctl);
396 	kfree(uctl);
397 }
398 
399 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
400 {
401 	/* For some reason, the res given from ALC880 is broken.
402 	   Here we adjust it properly. */
403 	snd_hda_jack_unsol_event(codec, res >> 2);
404 }
405 
406 /* Change EAPD to verb control */
407 static void alc_fill_eapd_coef(struct hda_codec *codec)
408 {
409 	int coef;
410 
411 	coef = alc_get_coef0(codec);
412 
413 	switch (codec->core.vendor_id) {
414 	case 0x10ec0262:
415 		alc_update_coef_idx(codec, 0x7, 0, 1<<5);
416 		break;
417 	case 0x10ec0267:
418 	case 0x10ec0268:
419 		alc_update_coef_idx(codec, 0x7, 0, 1<<13);
420 		break;
421 	case 0x10ec0269:
422 		if ((coef & 0x00f0) == 0x0010)
423 			alc_update_coef_idx(codec, 0xd, 0, 1<<14);
424 		if ((coef & 0x00f0) == 0x0020)
425 			alc_update_coef_idx(codec, 0x4, 1<<15, 0);
426 		if ((coef & 0x00f0) == 0x0030)
427 			alc_update_coef_idx(codec, 0x10, 1<<9, 0);
428 		break;
429 	case 0x10ec0280:
430 	case 0x10ec0284:
431 	case 0x10ec0290:
432 	case 0x10ec0292:
433 		alc_update_coef_idx(codec, 0x4, 1<<15, 0);
434 		break;
435 	case 0x10ec0225:
436 	case 0x10ec0295:
437 	case 0x10ec0299:
438 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
439 		fallthrough;
440 	case 0x10ec0215:
441 	case 0x10ec0285:
442 	case 0x10ec0289:
443 		alc_update_coef_idx(codec, 0x36, 1<<13, 0);
444 		fallthrough;
445 	case 0x10ec0230:
446 	case 0x10ec0233:
447 	case 0x10ec0235:
448 	case 0x10ec0236:
449 	case 0x10ec0245:
450 	case 0x10ec0255:
451 	case 0x10ec0256:
452 	case 0x19e58326:
453 	case 0x10ec0257:
454 	case 0x10ec0282:
455 	case 0x10ec0283:
456 	case 0x10ec0286:
457 	case 0x10ec0288:
458 	case 0x10ec0298:
459 	case 0x10ec0300:
460 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
461 		break;
462 	case 0x10ec0275:
463 		alc_update_coef_idx(codec, 0xe, 0, 1<<0);
464 		break;
465 	case 0x10ec0287:
466 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
467 		alc_write_coef_idx(codec, 0x8, 0x4ab7);
468 		break;
469 	case 0x10ec0293:
470 		alc_update_coef_idx(codec, 0xa, 1<<13, 0);
471 		break;
472 	case 0x10ec0234:
473 	case 0x10ec0274:
474 	case 0x10ec0294:
475 	case 0x10ec0700:
476 	case 0x10ec0701:
477 	case 0x10ec0703:
478 	case 0x10ec0711:
479 		alc_update_coef_idx(codec, 0x10, 1<<15, 0);
480 		break;
481 	case 0x10ec0662:
482 		if ((coef & 0x00f0) == 0x0030)
483 			alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
484 		break;
485 	case 0x10ec0272:
486 	case 0x10ec0273:
487 	case 0x10ec0663:
488 	case 0x10ec0665:
489 	case 0x10ec0670:
490 	case 0x10ec0671:
491 	case 0x10ec0672:
492 		alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
493 		break;
494 	case 0x10ec0222:
495 	case 0x10ec0623:
496 		alc_update_coef_idx(codec, 0x19, 1<<13, 0);
497 		break;
498 	case 0x10ec0668:
499 		alc_update_coef_idx(codec, 0x7, 3<<13, 0);
500 		break;
501 	case 0x10ec0867:
502 		alc_update_coef_idx(codec, 0x4, 1<<10, 0);
503 		break;
504 	case 0x10ec0888:
505 		if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
506 			alc_update_coef_idx(codec, 0x7, 1<<5, 0);
507 		break;
508 	case 0x10ec0892:
509 	case 0x10ec0897:
510 		alc_update_coef_idx(codec, 0x7, 1<<5, 0);
511 		break;
512 	case 0x10ec0899:
513 	case 0x10ec0900:
514 	case 0x10ec0b00:
515 	case 0x10ec1168:
516 	case 0x10ec1220:
517 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
518 		break;
519 	}
520 }
521 
522 /* additional initialization for ALC888 variants */
523 static void alc888_coef_init(struct hda_codec *codec)
524 {
525 	switch (alc_get_coef0(codec) & 0x00f0) {
526 	/* alc888-VA */
527 	case 0x00:
528 	/* alc888-VB */
529 	case 0x10:
530 		alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
531 		break;
532 	}
533 }
534 
535 /* turn on/off EAPD control (only if available) */
536 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
537 {
538 	if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
539 		return;
540 	if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
541 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
542 				    on ? 2 : 0);
543 }
544 
545 /* turn on/off EAPD controls of the codec */
546 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
547 {
548 	/* We currently only handle front, HP */
549 	static const hda_nid_t pins[] = {
550 		0x0f, 0x10, 0x14, 0x15, 0x17, 0
551 	};
552 	const hda_nid_t *p;
553 	for (p = pins; *p; p++)
554 		set_eapd(codec, *p, on);
555 }
556 
557 static int find_ext_mic_pin(struct hda_codec *codec);
558 
559 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
560 {
561 	const struct hda_pincfg *pin;
562 	int mic_pin = find_ext_mic_pin(codec);
563 	int i;
564 
565 	/* don't shut up pins when unloading the driver; otherwise it breaks
566 	 * the default pin setup at the next load of the driver
567 	 */
568 	if (codec->bus->shutdown)
569 		return;
570 
571 	snd_array_for_each(&codec->init_pins, i, pin) {
572 		/* use read here for syncing after issuing each verb */
573 		if (pin->nid != mic_pin)
574 			snd_hda_codec_read(codec, pin->nid, 0,
575 					AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
576 	}
577 
578 	codec->pins_shutup = 1;
579 }
580 
581 static void alc_shutup_pins(struct hda_codec *codec)
582 {
583 	struct alc_spec *spec = codec->spec;
584 
585 	switch (codec->core.vendor_id) {
586 	case 0x10ec0236:
587 	case 0x10ec0256:
588 	case 0x19e58326:
589 	case 0x10ec0283:
590 	case 0x10ec0286:
591 	case 0x10ec0288:
592 	case 0x10ec0298:
593 		alc_headset_mic_no_shutup(codec);
594 		break;
595 	default:
596 		if (!spec->no_shutup_pins)
597 			snd_hda_shutup_pins(codec);
598 		break;
599 	}
600 }
601 
602 /* generic shutup callback;
603  * just turning off EAPD and a little pause for avoiding pop-noise
604  */
605 static void alc_eapd_shutup(struct hda_codec *codec)
606 {
607 	struct alc_spec *spec = codec->spec;
608 
609 	alc_auto_setup_eapd(codec, false);
610 	if (!spec->no_depop_delay)
611 		msleep(200);
612 	alc_shutup_pins(codec);
613 }
614 
615 /* generic EAPD initialization */
616 static void alc_auto_init_amp(struct hda_codec *codec, int type)
617 {
618 	alc_auto_setup_eapd(codec, true);
619 	alc_write_gpio(codec);
620 	switch (type) {
621 	case ALC_INIT_DEFAULT:
622 		switch (codec->core.vendor_id) {
623 		case 0x10ec0260:
624 			alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
625 			break;
626 		case 0x10ec0880:
627 		case 0x10ec0882:
628 		case 0x10ec0883:
629 		case 0x10ec0885:
630 			alc_update_coef_idx(codec, 7, 0, 0x2030);
631 			break;
632 		case 0x10ec0888:
633 			alc888_coef_init(codec);
634 			break;
635 		}
636 		break;
637 	}
638 }
639 
640 /* get a primary headphone pin if available */
641 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
642 {
643 	if (spec->gen.autocfg.hp_pins[0])
644 		return spec->gen.autocfg.hp_pins[0];
645 	if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
646 		return spec->gen.autocfg.line_out_pins[0];
647 	return 0;
648 }
649 
650 /*
651  * Realtek SSID verification
652  */
653 
654 /* Could be any non-zero and even value. When used as fixup, tells
655  * the driver to ignore any present sku defines.
656  */
657 #define ALC_FIXUP_SKU_IGNORE (2)
658 
659 static void alc_fixup_sku_ignore(struct hda_codec *codec,
660 				 const struct hda_fixup *fix, int action)
661 {
662 	struct alc_spec *spec = codec->spec;
663 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
664 		spec->cdefine.fixup = 1;
665 		spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
666 	}
667 }
668 
669 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
670 				    const struct hda_fixup *fix, int action)
671 {
672 	struct alc_spec *spec = codec->spec;
673 
674 	if (action == HDA_FIXUP_ACT_PROBE) {
675 		spec->no_depop_delay = 1;
676 		codec->depop_delay = 0;
677 	}
678 }
679 
680 static int alc_auto_parse_customize_define(struct hda_codec *codec)
681 {
682 	unsigned int ass, tmp, i;
683 	unsigned nid = 0;
684 	struct alc_spec *spec = codec->spec;
685 
686 	spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
687 
688 	if (spec->cdefine.fixup) {
689 		ass = spec->cdefine.sku_cfg;
690 		if (ass == ALC_FIXUP_SKU_IGNORE)
691 			return -1;
692 		goto do_sku;
693 	}
694 
695 	if (!codec->bus->pci)
696 		return -1;
697 	ass = codec->core.subsystem_id & 0xffff;
698 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
699 		goto do_sku;
700 
701 	nid = 0x1d;
702 	if (codec->core.vendor_id == 0x10ec0260)
703 		nid = 0x17;
704 	ass = snd_hda_codec_get_pincfg(codec, nid);
705 
706 	if (!(ass & 1)) {
707 		codec_info(codec, "%s: SKU not ready 0x%08x\n",
708 			   codec->core.chip_name, ass);
709 		return -1;
710 	}
711 
712 	/* check sum */
713 	tmp = 0;
714 	for (i = 1; i < 16; i++) {
715 		if ((ass >> i) & 1)
716 			tmp++;
717 	}
718 	if (((ass >> 16) & 0xf) != tmp)
719 		return -1;
720 
721 	spec->cdefine.port_connectivity = ass >> 30;
722 	spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
723 	spec->cdefine.check_sum = (ass >> 16) & 0xf;
724 	spec->cdefine.customization = ass >> 8;
725 do_sku:
726 	spec->cdefine.sku_cfg = ass;
727 	spec->cdefine.external_amp = (ass & 0x38) >> 3;
728 	spec->cdefine.platform_type = (ass & 0x4) >> 2;
729 	spec->cdefine.swap = (ass & 0x2) >> 1;
730 	spec->cdefine.override = ass & 0x1;
731 
732 	codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
733 		   nid, spec->cdefine.sku_cfg);
734 	codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
735 		   spec->cdefine.port_connectivity);
736 	codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
737 	codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
738 	codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
739 	codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
740 	codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
741 	codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
742 	codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
743 
744 	return 0;
745 }
746 
747 /* return the position of NID in the list, or -1 if not found */
748 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
749 {
750 	int i;
751 	for (i = 0; i < nums; i++)
752 		if (list[i] == nid)
753 			return i;
754 	return -1;
755 }
756 /* return true if the given NID is found in the list */
757 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
758 {
759 	return find_idx_in_nid_list(nid, list, nums) >= 0;
760 }
761 
762 /* check subsystem ID and set up device-specific initialization;
763  * return 1 if initialized, 0 if invalid SSID
764  */
765 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
766  *	31 ~ 16 :	Manufacture ID
767  *	15 ~ 8	:	SKU ID
768  *	7  ~ 0	:	Assembly ID
769  *	port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
770  */
771 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
772 {
773 	unsigned int ass, tmp, i;
774 	unsigned nid;
775 	struct alc_spec *spec = codec->spec;
776 
777 	if (spec->cdefine.fixup) {
778 		ass = spec->cdefine.sku_cfg;
779 		if (ass == ALC_FIXUP_SKU_IGNORE)
780 			return 0;
781 		goto do_sku;
782 	}
783 
784 	ass = codec->core.subsystem_id & 0xffff;
785 	if (codec->bus->pci &&
786 	    ass != codec->bus->pci->subsystem_device && (ass & 1))
787 		goto do_sku;
788 
789 	/* invalid SSID, check the special NID pin defcfg instead */
790 	/*
791 	 * 31~30	: port connectivity
792 	 * 29~21	: reserve
793 	 * 20		: PCBEEP input
794 	 * 19~16	: Check sum (15:1)
795 	 * 15~1		: Custom
796 	 * 0		: override
797 	*/
798 	nid = 0x1d;
799 	if (codec->core.vendor_id == 0x10ec0260)
800 		nid = 0x17;
801 	ass = snd_hda_codec_get_pincfg(codec, nid);
802 	codec_dbg(codec,
803 		  "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
804 		   ass, nid);
805 	if (!(ass & 1))
806 		return 0;
807 	if ((ass >> 30) != 1)	/* no physical connection */
808 		return 0;
809 
810 	/* check sum */
811 	tmp = 0;
812 	for (i = 1; i < 16; i++) {
813 		if ((ass >> i) & 1)
814 			tmp++;
815 	}
816 	if (((ass >> 16) & 0xf) != tmp)
817 		return 0;
818 do_sku:
819 	codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
820 		   ass & 0xffff, codec->core.vendor_id);
821 	/*
822 	 * 0 : override
823 	 * 1 :	Swap Jack
824 	 * 2 : 0 --> Desktop, 1 --> Laptop
825 	 * 3~5 : External Amplifier control
826 	 * 7~6 : Reserved
827 	*/
828 	tmp = (ass & 0x38) >> 3;	/* external Amp control */
829 	if (spec->init_amp == ALC_INIT_UNDEFINED) {
830 		switch (tmp) {
831 		case 1:
832 			alc_setup_gpio(codec, 0x01);
833 			break;
834 		case 3:
835 			alc_setup_gpio(codec, 0x02);
836 			break;
837 		case 7:
838 			alc_setup_gpio(codec, 0x04);
839 			break;
840 		case 5:
841 		default:
842 			spec->init_amp = ALC_INIT_DEFAULT;
843 			break;
844 		}
845 	}
846 
847 	/* is laptop or Desktop and enable the function "Mute internal speaker
848 	 * when the external headphone out jack is plugged"
849 	 */
850 	if (!(ass & 0x8000))
851 		return 1;
852 	/*
853 	 * 10~8 : Jack location
854 	 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
855 	 * 14~13: Resvered
856 	 * 15   : 1 --> enable the function "Mute internal speaker
857 	 *	        when the external headphone out jack is plugged"
858 	 */
859 	if (!alc_get_hp_pin(spec)) {
860 		hda_nid_t nid;
861 		tmp = (ass >> 11) & 0x3;	/* HP to chassis */
862 		nid = ports[tmp];
863 		if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
864 				      spec->gen.autocfg.line_outs))
865 			return 1;
866 		spec->gen.autocfg.hp_pins[0] = nid;
867 	}
868 	return 1;
869 }
870 
871 /* Check the validity of ALC subsystem-id
872  * ports contains an array of 4 pin NIDs for port-A, E, D and I */
873 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
874 {
875 	if (!alc_subsystem_id(codec, ports)) {
876 		struct alc_spec *spec = codec->spec;
877 		if (spec->init_amp == ALC_INIT_UNDEFINED) {
878 			codec_dbg(codec,
879 				  "realtek: Enable default setup for auto mode as fallback\n");
880 			spec->init_amp = ALC_INIT_DEFAULT;
881 		}
882 	}
883 }
884 
885 /*
886  */
887 
888 static void alc_fixup_inv_dmic(struct hda_codec *codec,
889 			       const struct hda_fixup *fix, int action)
890 {
891 	struct alc_spec *spec = codec->spec;
892 
893 	spec->gen.inv_dmic_split = 1;
894 }
895 
896 
897 static int alc_build_controls(struct hda_codec *codec)
898 {
899 	int err;
900 
901 	err = snd_hda_gen_build_controls(codec);
902 	if (err < 0)
903 		return err;
904 
905 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
906 	return 0;
907 }
908 
909 
910 /*
911  * Common callbacks
912  */
913 
914 static void alc_pre_init(struct hda_codec *codec)
915 {
916 	alc_fill_eapd_coef(codec);
917 }
918 
919 #define is_s3_resume(codec) \
920 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
921 #define is_s4_resume(codec) \
922 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
923 #define is_s4_suspend(codec) \
924 	((codec)->core.dev.power.power_state.event == PM_EVENT_FREEZE)
925 
926 static int alc_init(struct hda_codec *codec)
927 {
928 	struct alc_spec *spec = codec->spec;
929 
930 	/* hibernation resume needs the full chip initialization */
931 	if (is_s4_resume(codec))
932 		alc_pre_init(codec);
933 
934 	if (spec->init_hook)
935 		spec->init_hook(codec);
936 
937 	spec->gen.skip_verbs = 1; /* applied in below */
938 	snd_hda_gen_init(codec);
939 	alc_fix_pll(codec);
940 	alc_auto_init_amp(codec, spec->init_amp);
941 	snd_hda_apply_verbs(codec); /* apply verbs here after own init */
942 
943 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
944 
945 	return 0;
946 }
947 
948 #define alc_free	snd_hda_gen_free
949 
950 #ifdef CONFIG_PM
951 static inline void alc_shutup(struct hda_codec *codec)
952 {
953 	struct alc_spec *spec = codec->spec;
954 
955 	if (!snd_hda_get_bool_hint(codec, "shutup"))
956 		return; /* disabled explicitly by hints */
957 
958 	if (spec && spec->shutup)
959 		spec->shutup(codec);
960 	else
961 		alc_shutup_pins(codec);
962 }
963 
964 static void alc_power_eapd(struct hda_codec *codec)
965 {
966 	alc_auto_setup_eapd(codec, false);
967 }
968 
969 static int alc_suspend(struct hda_codec *codec)
970 {
971 	struct alc_spec *spec = codec->spec;
972 	alc_shutup(codec);
973 	if (spec && spec->power_hook)
974 		spec->power_hook(codec);
975 	return 0;
976 }
977 
978 static int alc_resume(struct hda_codec *codec)
979 {
980 	struct alc_spec *spec = codec->spec;
981 
982 	if (!spec->no_depop_delay)
983 		msleep(150); /* to avoid pop noise */
984 	codec->patch_ops.init(codec);
985 	snd_hda_regmap_sync(codec);
986 	hda_call_check_power_status(codec, 0x01);
987 	return 0;
988 }
989 #endif
990 
991 /*
992  */
993 static const struct hda_codec_ops alc_patch_ops = {
994 	.build_controls = alc_build_controls,
995 	.build_pcms = snd_hda_gen_build_pcms,
996 	.init = alc_init,
997 	.free = alc_free,
998 	.unsol_event = snd_hda_jack_unsol_event,
999 #ifdef CONFIG_PM
1000 	.resume = alc_resume,
1001 	.suspend = alc_suspend,
1002 	.check_power_status = snd_hda_gen_check_power_status,
1003 #endif
1004 };
1005 
1006 
1007 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1008 
1009 /*
1010  * Rename codecs appropriately from COEF value or subvendor id
1011  */
1012 struct alc_codec_rename_table {
1013 	unsigned int vendor_id;
1014 	unsigned short coef_mask;
1015 	unsigned short coef_bits;
1016 	const char *name;
1017 };
1018 
1019 struct alc_codec_rename_pci_table {
1020 	unsigned int codec_vendor_id;
1021 	unsigned short pci_subvendor;
1022 	unsigned short pci_subdevice;
1023 	const char *name;
1024 };
1025 
1026 static const struct alc_codec_rename_table rename_tbl[] = {
1027 	{ 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1028 	{ 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1029 	{ 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1030 	{ 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1031 	{ 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1032 	{ 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1033 	{ 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1034 	{ 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1035 	{ 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1036 	{ 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1037 	{ 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1038 	{ 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1039 	{ 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1040 	{ 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1041 	{ 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1042 	{ 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1043 	{ 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1044 	{ } /* terminator */
1045 };
1046 
1047 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1048 	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
1049 	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
1050 	{ 0x10ec0283, 0x1028, 0, "ALC3223" },
1051 	{ 0x10ec0288, 0x1028, 0, "ALC3263" },
1052 	{ 0x10ec0292, 0x1028, 0, "ALC3226" },
1053 	{ 0x10ec0293, 0x1028, 0, "ALC3235" },
1054 	{ 0x10ec0255, 0x1028, 0, "ALC3234" },
1055 	{ 0x10ec0668, 0x1028, 0, "ALC3661" },
1056 	{ 0x10ec0275, 0x1028, 0, "ALC3260" },
1057 	{ 0x10ec0899, 0x1028, 0, "ALC3861" },
1058 	{ 0x10ec0298, 0x1028, 0, "ALC3266" },
1059 	{ 0x10ec0236, 0x1028, 0, "ALC3204" },
1060 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
1061 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
1062 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
1063 	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
1064 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
1065 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
1066 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
1067 	{ 0x10ec0233, 0x1043, 0, "ALC3236" },
1068 	{ 0x10ec0280, 0x103c, 0, "ALC3228" },
1069 	{ 0x10ec0282, 0x103c, 0, "ALC3227" },
1070 	{ 0x10ec0286, 0x103c, 0, "ALC3242" },
1071 	{ 0x10ec0290, 0x103c, 0, "ALC3241" },
1072 	{ 0x10ec0668, 0x103c, 0, "ALC3662" },
1073 	{ 0x10ec0283, 0x17aa, 0, "ALC3239" },
1074 	{ 0x10ec0292, 0x17aa, 0, "ALC3232" },
1075 	{ } /* terminator */
1076 };
1077 
1078 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1079 {
1080 	const struct alc_codec_rename_table *p;
1081 	const struct alc_codec_rename_pci_table *q;
1082 
1083 	for (p = rename_tbl; p->vendor_id; p++) {
1084 		if (p->vendor_id != codec->core.vendor_id)
1085 			continue;
1086 		if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1087 			return alc_codec_rename(codec, p->name);
1088 	}
1089 
1090 	if (!codec->bus->pci)
1091 		return 0;
1092 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1093 		if (q->codec_vendor_id != codec->core.vendor_id)
1094 			continue;
1095 		if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1096 			continue;
1097 		if (!q->pci_subdevice ||
1098 		    q->pci_subdevice == codec->bus->pci->subsystem_device)
1099 			return alc_codec_rename(codec, q->name);
1100 	}
1101 
1102 	return 0;
1103 }
1104 
1105 
1106 /*
1107  * Digital-beep handlers
1108  */
1109 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1110 
1111 /* additional beep mixers; private_value will be overwritten */
1112 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1113 	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1114 	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1115 };
1116 
1117 /* set up and create beep controls */
1118 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1119 			int idx, int dir)
1120 {
1121 	struct snd_kcontrol_new *knew;
1122 	unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1123 	int i;
1124 
1125 	for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1126 		knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1127 					    &alc_beep_mixer[i]);
1128 		if (!knew)
1129 			return -ENOMEM;
1130 		knew->private_value = beep_amp;
1131 	}
1132 	return 0;
1133 }
1134 
1135 static const struct snd_pci_quirk beep_allow_list[] = {
1136 	SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1137 	SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1138 	SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1139 	SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1140 	SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1141 	SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1142 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1143 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1144 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1145 	/* denylist -- no beep available */
1146 	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1147 	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1148 	{}
1149 };
1150 
1151 static inline int has_cdefine_beep(struct hda_codec *codec)
1152 {
1153 	struct alc_spec *spec = codec->spec;
1154 	const struct snd_pci_quirk *q;
1155 	q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1156 	if (q)
1157 		return q->value;
1158 	return spec->cdefine.enable_pcbeep;
1159 }
1160 #else
1161 #define set_beep_amp(spec, nid, idx, dir)	0
1162 #define has_cdefine_beep(codec)		0
1163 #endif
1164 
1165 /* parse the BIOS configuration and set up the alc_spec */
1166 /* return 1 if successful, 0 if the proper config is not found,
1167  * or a negative error code
1168  */
1169 static int alc_parse_auto_config(struct hda_codec *codec,
1170 				 const hda_nid_t *ignore_nids,
1171 				 const hda_nid_t *ssid_nids)
1172 {
1173 	struct alc_spec *spec = codec->spec;
1174 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1175 	int err;
1176 
1177 	err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1178 				       spec->parse_flags);
1179 	if (err < 0)
1180 		return err;
1181 
1182 	if (ssid_nids)
1183 		alc_ssid_check(codec, ssid_nids);
1184 
1185 	err = snd_hda_gen_parse_auto_config(codec, cfg);
1186 	if (err < 0)
1187 		return err;
1188 
1189 	return 1;
1190 }
1191 
1192 /* common preparation job for alc_spec */
1193 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1194 {
1195 	struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1196 	int err;
1197 
1198 	if (!spec)
1199 		return -ENOMEM;
1200 	codec->spec = spec;
1201 	snd_hda_gen_spec_init(&spec->gen);
1202 	spec->gen.mixer_nid = mixer_nid;
1203 	spec->gen.own_eapd_ctl = 1;
1204 	codec->single_adc_amp = 1;
1205 	/* FIXME: do we need this for all Realtek codec models? */
1206 	codec->spdif_status_reset = 1;
1207 	codec->forced_resume = 1;
1208 	codec->patch_ops = alc_patch_ops;
1209 	mutex_init(&spec->coef_mutex);
1210 
1211 	err = alc_codec_rename_from_preset(codec);
1212 	if (err < 0) {
1213 		kfree(spec);
1214 		return err;
1215 	}
1216 	return 0;
1217 }
1218 
1219 static int alc880_parse_auto_config(struct hda_codec *codec)
1220 {
1221 	static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1222 	static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1223 	return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1224 }
1225 
1226 /*
1227  * ALC880 fix-ups
1228  */
1229 enum {
1230 	ALC880_FIXUP_GPIO1,
1231 	ALC880_FIXUP_GPIO2,
1232 	ALC880_FIXUP_MEDION_RIM,
1233 	ALC880_FIXUP_LG,
1234 	ALC880_FIXUP_LG_LW25,
1235 	ALC880_FIXUP_W810,
1236 	ALC880_FIXUP_EAPD_COEF,
1237 	ALC880_FIXUP_TCL_S700,
1238 	ALC880_FIXUP_VOL_KNOB,
1239 	ALC880_FIXUP_FUJITSU,
1240 	ALC880_FIXUP_F1734,
1241 	ALC880_FIXUP_UNIWILL,
1242 	ALC880_FIXUP_UNIWILL_DIG,
1243 	ALC880_FIXUP_Z71V,
1244 	ALC880_FIXUP_ASUS_W5A,
1245 	ALC880_FIXUP_3ST_BASE,
1246 	ALC880_FIXUP_3ST,
1247 	ALC880_FIXUP_3ST_DIG,
1248 	ALC880_FIXUP_5ST_BASE,
1249 	ALC880_FIXUP_5ST,
1250 	ALC880_FIXUP_5ST_DIG,
1251 	ALC880_FIXUP_6ST_BASE,
1252 	ALC880_FIXUP_6ST,
1253 	ALC880_FIXUP_6ST_DIG,
1254 	ALC880_FIXUP_6ST_AUTOMUTE,
1255 };
1256 
1257 /* enable the volume-knob widget support on NID 0x21 */
1258 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1259 				  const struct hda_fixup *fix, int action)
1260 {
1261 	if (action == HDA_FIXUP_ACT_PROBE)
1262 		snd_hda_jack_detect_enable_callback(codec, 0x21,
1263 						    alc_update_knob_master);
1264 }
1265 
1266 static const struct hda_fixup alc880_fixups[] = {
1267 	[ALC880_FIXUP_GPIO1] = {
1268 		.type = HDA_FIXUP_FUNC,
1269 		.v.func = alc_fixup_gpio1,
1270 	},
1271 	[ALC880_FIXUP_GPIO2] = {
1272 		.type = HDA_FIXUP_FUNC,
1273 		.v.func = alc_fixup_gpio2,
1274 	},
1275 	[ALC880_FIXUP_MEDION_RIM] = {
1276 		.type = HDA_FIXUP_VERBS,
1277 		.v.verbs = (const struct hda_verb[]) {
1278 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1279 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1280 			{ }
1281 		},
1282 		.chained = true,
1283 		.chain_id = ALC880_FIXUP_GPIO2,
1284 	},
1285 	[ALC880_FIXUP_LG] = {
1286 		.type = HDA_FIXUP_PINS,
1287 		.v.pins = (const struct hda_pintbl[]) {
1288 			/* disable bogus unused pins */
1289 			{ 0x16, 0x411111f0 },
1290 			{ 0x18, 0x411111f0 },
1291 			{ 0x1a, 0x411111f0 },
1292 			{ }
1293 		}
1294 	},
1295 	[ALC880_FIXUP_LG_LW25] = {
1296 		.type = HDA_FIXUP_PINS,
1297 		.v.pins = (const struct hda_pintbl[]) {
1298 			{ 0x1a, 0x0181344f }, /* line-in */
1299 			{ 0x1b, 0x0321403f }, /* headphone */
1300 			{ }
1301 		}
1302 	},
1303 	[ALC880_FIXUP_W810] = {
1304 		.type = HDA_FIXUP_PINS,
1305 		.v.pins = (const struct hda_pintbl[]) {
1306 			/* disable bogus unused pins */
1307 			{ 0x17, 0x411111f0 },
1308 			{ }
1309 		},
1310 		.chained = true,
1311 		.chain_id = ALC880_FIXUP_GPIO2,
1312 	},
1313 	[ALC880_FIXUP_EAPD_COEF] = {
1314 		.type = HDA_FIXUP_VERBS,
1315 		.v.verbs = (const struct hda_verb[]) {
1316 			/* change to EAPD mode */
1317 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1318 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1319 			{}
1320 		},
1321 	},
1322 	[ALC880_FIXUP_TCL_S700] = {
1323 		.type = HDA_FIXUP_VERBS,
1324 		.v.verbs = (const struct hda_verb[]) {
1325 			/* change to EAPD mode */
1326 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1327 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3070 },
1328 			{}
1329 		},
1330 		.chained = true,
1331 		.chain_id = ALC880_FIXUP_GPIO2,
1332 	},
1333 	[ALC880_FIXUP_VOL_KNOB] = {
1334 		.type = HDA_FIXUP_FUNC,
1335 		.v.func = alc880_fixup_vol_knob,
1336 	},
1337 	[ALC880_FIXUP_FUJITSU] = {
1338 		/* override all pins as BIOS on old Amilo is broken */
1339 		.type = HDA_FIXUP_PINS,
1340 		.v.pins = (const struct hda_pintbl[]) {
1341 			{ 0x14, 0x0121401f }, /* HP */
1342 			{ 0x15, 0x99030120 }, /* speaker */
1343 			{ 0x16, 0x99030130 }, /* bass speaker */
1344 			{ 0x17, 0x411111f0 }, /* N/A */
1345 			{ 0x18, 0x411111f0 }, /* N/A */
1346 			{ 0x19, 0x01a19950 }, /* mic-in */
1347 			{ 0x1a, 0x411111f0 }, /* N/A */
1348 			{ 0x1b, 0x411111f0 }, /* N/A */
1349 			{ 0x1c, 0x411111f0 }, /* N/A */
1350 			{ 0x1d, 0x411111f0 }, /* N/A */
1351 			{ 0x1e, 0x01454140 }, /* SPDIF out */
1352 			{ }
1353 		},
1354 		.chained = true,
1355 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1356 	},
1357 	[ALC880_FIXUP_F1734] = {
1358 		/* almost compatible with FUJITSU, but no bass and SPDIF */
1359 		.type = HDA_FIXUP_PINS,
1360 		.v.pins = (const struct hda_pintbl[]) {
1361 			{ 0x14, 0x0121401f }, /* HP */
1362 			{ 0x15, 0x99030120 }, /* speaker */
1363 			{ 0x16, 0x411111f0 }, /* N/A */
1364 			{ 0x17, 0x411111f0 }, /* N/A */
1365 			{ 0x18, 0x411111f0 }, /* N/A */
1366 			{ 0x19, 0x01a19950 }, /* mic-in */
1367 			{ 0x1a, 0x411111f0 }, /* N/A */
1368 			{ 0x1b, 0x411111f0 }, /* N/A */
1369 			{ 0x1c, 0x411111f0 }, /* N/A */
1370 			{ 0x1d, 0x411111f0 }, /* N/A */
1371 			{ 0x1e, 0x411111f0 }, /* N/A */
1372 			{ }
1373 		},
1374 		.chained = true,
1375 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1376 	},
1377 	[ALC880_FIXUP_UNIWILL] = {
1378 		/* need to fix HP and speaker pins to be parsed correctly */
1379 		.type = HDA_FIXUP_PINS,
1380 		.v.pins = (const struct hda_pintbl[]) {
1381 			{ 0x14, 0x0121411f }, /* HP */
1382 			{ 0x15, 0x99030120 }, /* speaker */
1383 			{ 0x16, 0x99030130 }, /* bass speaker */
1384 			{ }
1385 		},
1386 	},
1387 	[ALC880_FIXUP_UNIWILL_DIG] = {
1388 		.type = HDA_FIXUP_PINS,
1389 		.v.pins = (const struct hda_pintbl[]) {
1390 			/* disable bogus unused pins */
1391 			{ 0x17, 0x411111f0 },
1392 			{ 0x19, 0x411111f0 },
1393 			{ 0x1b, 0x411111f0 },
1394 			{ 0x1f, 0x411111f0 },
1395 			{ }
1396 		}
1397 	},
1398 	[ALC880_FIXUP_Z71V] = {
1399 		.type = HDA_FIXUP_PINS,
1400 		.v.pins = (const struct hda_pintbl[]) {
1401 			/* set up the whole pins as BIOS is utterly broken */
1402 			{ 0x14, 0x99030120 }, /* speaker */
1403 			{ 0x15, 0x0121411f }, /* HP */
1404 			{ 0x16, 0x411111f0 }, /* N/A */
1405 			{ 0x17, 0x411111f0 }, /* N/A */
1406 			{ 0x18, 0x01a19950 }, /* mic-in */
1407 			{ 0x19, 0x411111f0 }, /* N/A */
1408 			{ 0x1a, 0x01813031 }, /* line-in */
1409 			{ 0x1b, 0x411111f0 }, /* N/A */
1410 			{ 0x1c, 0x411111f0 }, /* N/A */
1411 			{ 0x1d, 0x411111f0 }, /* N/A */
1412 			{ 0x1e, 0x0144111e }, /* SPDIF */
1413 			{ }
1414 		}
1415 	},
1416 	[ALC880_FIXUP_ASUS_W5A] = {
1417 		.type = HDA_FIXUP_PINS,
1418 		.v.pins = (const struct hda_pintbl[]) {
1419 			/* set up the whole pins as BIOS is utterly broken */
1420 			{ 0x14, 0x0121411f }, /* HP */
1421 			{ 0x15, 0x411111f0 }, /* N/A */
1422 			{ 0x16, 0x411111f0 }, /* N/A */
1423 			{ 0x17, 0x411111f0 }, /* N/A */
1424 			{ 0x18, 0x90a60160 }, /* mic */
1425 			{ 0x19, 0x411111f0 }, /* N/A */
1426 			{ 0x1a, 0x411111f0 }, /* N/A */
1427 			{ 0x1b, 0x411111f0 }, /* N/A */
1428 			{ 0x1c, 0x411111f0 }, /* N/A */
1429 			{ 0x1d, 0x411111f0 }, /* N/A */
1430 			{ 0x1e, 0xb743111e }, /* SPDIF out */
1431 			{ }
1432 		},
1433 		.chained = true,
1434 		.chain_id = ALC880_FIXUP_GPIO1,
1435 	},
1436 	[ALC880_FIXUP_3ST_BASE] = {
1437 		.type = HDA_FIXUP_PINS,
1438 		.v.pins = (const struct hda_pintbl[]) {
1439 			{ 0x14, 0x01014010 }, /* line-out */
1440 			{ 0x15, 0x411111f0 }, /* N/A */
1441 			{ 0x16, 0x411111f0 }, /* N/A */
1442 			{ 0x17, 0x411111f0 }, /* N/A */
1443 			{ 0x18, 0x01a19c30 }, /* mic-in */
1444 			{ 0x19, 0x0121411f }, /* HP */
1445 			{ 0x1a, 0x01813031 }, /* line-in */
1446 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1447 			{ 0x1c, 0x411111f0 }, /* N/A */
1448 			{ 0x1d, 0x411111f0 }, /* N/A */
1449 			/* 0x1e is filled in below */
1450 			{ 0x1f, 0x411111f0 }, /* N/A */
1451 			{ }
1452 		}
1453 	},
1454 	[ALC880_FIXUP_3ST] = {
1455 		.type = HDA_FIXUP_PINS,
1456 		.v.pins = (const struct hda_pintbl[]) {
1457 			{ 0x1e, 0x411111f0 }, /* N/A */
1458 			{ }
1459 		},
1460 		.chained = true,
1461 		.chain_id = ALC880_FIXUP_3ST_BASE,
1462 	},
1463 	[ALC880_FIXUP_3ST_DIG] = {
1464 		.type = HDA_FIXUP_PINS,
1465 		.v.pins = (const struct hda_pintbl[]) {
1466 			{ 0x1e, 0x0144111e }, /* SPDIF */
1467 			{ }
1468 		},
1469 		.chained = true,
1470 		.chain_id = ALC880_FIXUP_3ST_BASE,
1471 	},
1472 	[ALC880_FIXUP_5ST_BASE] = {
1473 		.type = HDA_FIXUP_PINS,
1474 		.v.pins = (const struct hda_pintbl[]) {
1475 			{ 0x14, 0x01014010 }, /* front */
1476 			{ 0x15, 0x411111f0 }, /* N/A */
1477 			{ 0x16, 0x01011411 }, /* CLFE */
1478 			{ 0x17, 0x01016412 }, /* surr */
1479 			{ 0x18, 0x01a19c30 }, /* mic-in */
1480 			{ 0x19, 0x0121411f }, /* HP */
1481 			{ 0x1a, 0x01813031 }, /* line-in */
1482 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1483 			{ 0x1c, 0x411111f0 }, /* N/A */
1484 			{ 0x1d, 0x411111f0 }, /* N/A */
1485 			/* 0x1e is filled in below */
1486 			{ 0x1f, 0x411111f0 }, /* N/A */
1487 			{ }
1488 		}
1489 	},
1490 	[ALC880_FIXUP_5ST] = {
1491 		.type = HDA_FIXUP_PINS,
1492 		.v.pins = (const struct hda_pintbl[]) {
1493 			{ 0x1e, 0x411111f0 }, /* N/A */
1494 			{ }
1495 		},
1496 		.chained = true,
1497 		.chain_id = ALC880_FIXUP_5ST_BASE,
1498 	},
1499 	[ALC880_FIXUP_5ST_DIG] = {
1500 		.type = HDA_FIXUP_PINS,
1501 		.v.pins = (const struct hda_pintbl[]) {
1502 			{ 0x1e, 0x0144111e }, /* SPDIF */
1503 			{ }
1504 		},
1505 		.chained = true,
1506 		.chain_id = ALC880_FIXUP_5ST_BASE,
1507 	},
1508 	[ALC880_FIXUP_6ST_BASE] = {
1509 		.type = HDA_FIXUP_PINS,
1510 		.v.pins = (const struct hda_pintbl[]) {
1511 			{ 0x14, 0x01014010 }, /* front */
1512 			{ 0x15, 0x01016412 }, /* surr */
1513 			{ 0x16, 0x01011411 }, /* CLFE */
1514 			{ 0x17, 0x01012414 }, /* side */
1515 			{ 0x18, 0x01a19c30 }, /* mic-in */
1516 			{ 0x19, 0x02a19c40 }, /* front-mic */
1517 			{ 0x1a, 0x01813031 }, /* line-in */
1518 			{ 0x1b, 0x0121411f }, /* HP */
1519 			{ 0x1c, 0x411111f0 }, /* N/A */
1520 			{ 0x1d, 0x411111f0 }, /* N/A */
1521 			/* 0x1e is filled in below */
1522 			{ 0x1f, 0x411111f0 }, /* N/A */
1523 			{ }
1524 		}
1525 	},
1526 	[ALC880_FIXUP_6ST] = {
1527 		.type = HDA_FIXUP_PINS,
1528 		.v.pins = (const struct hda_pintbl[]) {
1529 			{ 0x1e, 0x411111f0 }, /* N/A */
1530 			{ }
1531 		},
1532 		.chained = true,
1533 		.chain_id = ALC880_FIXUP_6ST_BASE,
1534 	},
1535 	[ALC880_FIXUP_6ST_DIG] = {
1536 		.type = HDA_FIXUP_PINS,
1537 		.v.pins = (const struct hda_pintbl[]) {
1538 			{ 0x1e, 0x0144111e }, /* SPDIF */
1539 			{ }
1540 		},
1541 		.chained = true,
1542 		.chain_id = ALC880_FIXUP_6ST_BASE,
1543 	},
1544 	[ALC880_FIXUP_6ST_AUTOMUTE] = {
1545 		.type = HDA_FIXUP_PINS,
1546 		.v.pins = (const struct hda_pintbl[]) {
1547 			{ 0x1b, 0x0121401f }, /* HP with jack detect */
1548 			{ }
1549 		},
1550 		.chained_before = true,
1551 		.chain_id = ALC880_FIXUP_6ST_BASE,
1552 	},
1553 };
1554 
1555 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1556 	SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1557 	SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1558 	SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1559 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1560 	SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1561 	SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1562 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1563 	SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1564 	SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1565 	SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1566 	SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1567 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1568 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1569 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1570 	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1571 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1572 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1573 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1574 	SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1575 	SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1576 	SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1577 	SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1578 	SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1579 
1580 	/* Below is the copied entries from alc880_quirks.c.
1581 	 * It's not quite sure whether BIOS sets the correct pin-config table
1582 	 * on these machines, thus they are kept to be compatible with
1583 	 * the old static quirks.  Once when it's confirmed to work without
1584 	 * these overrides, it'd be better to remove.
1585 	 */
1586 	SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1587 	SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1588 	SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1589 	SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1590 	SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1591 	SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1592 	SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1593 	SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1594 	SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1595 	SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1596 	SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1597 	SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1598 	SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1599 	SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1600 	SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1601 	SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1602 	SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1603 	SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1604 	SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1605 	SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1606 	SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1607 	SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1608 	SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1609 	SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1610 	SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1611 	SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1612 	SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1613 	SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1614 	SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1615 	SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1616 	SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1617 	SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1618 	SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1619 	/* default Intel */
1620 	SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1621 	SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1622 	SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1623 	{}
1624 };
1625 
1626 static const struct hda_model_fixup alc880_fixup_models[] = {
1627 	{.id = ALC880_FIXUP_3ST, .name = "3stack"},
1628 	{.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1629 	{.id = ALC880_FIXUP_5ST, .name = "5stack"},
1630 	{.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1631 	{.id = ALC880_FIXUP_6ST, .name = "6stack"},
1632 	{.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1633 	{.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1634 	{}
1635 };
1636 
1637 
1638 /*
1639  * OK, here we have finally the patch for ALC880
1640  */
1641 static int patch_alc880(struct hda_codec *codec)
1642 {
1643 	struct alc_spec *spec;
1644 	int err;
1645 
1646 	err = alc_alloc_spec(codec, 0x0b);
1647 	if (err < 0)
1648 		return err;
1649 
1650 	spec = codec->spec;
1651 	spec->gen.need_dac_fix = 1;
1652 	spec->gen.beep_nid = 0x01;
1653 
1654 	codec->patch_ops.unsol_event = alc880_unsol_event;
1655 
1656 	alc_pre_init(codec);
1657 
1658 	snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1659 		       alc880_fixups);
1660 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1661 
1662 	/* automatic parse from the BIOS config */
1663 	err = alc880_parse_auto_config(codec);
1664 	if (err < 0)
1665 		goto error;
1666 
1667 	if (!spec->gen.no_analog) {
1668 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1669 		if (err < 0)
1670 			goto error;
1671 	}
1672 
1673 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1674 
1675 	return 0;
1676 
1677  error:
1678 	alc_free(codec);
1679 	return err;
1680 }
1681 
1682 
1683 /*
1684  * ALC260 support
1685  */
1686 static int alc260_parse_auto_config(struct hda_codec *codec)
1687 {
1688 	static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1689 	static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1690 	return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1691 }
1692 
1693 /*
1694  * Pin config fixes
1695  */
1696 enum {
1697 	ALC260_FIXUP_HP_DC5750,
1698 	ALC260_FIXUP_HP_PIN_0F,
1699 	ALC260_FIXUP_COEF,
1700 	ALC260_FIXUP_GPIO1,
1701 	ALC260_FIXUP_GPIO1_TOGGLE,
1702 	ALC260_FIXUP_REPLACER,
1703 	ALC260_FIXUP_HP_B1900,
1704 	ALC260_FIXUP_KN1,
1705 	ALC260_FIXUP_FSC_S7020,
1706 	ALC260_FIXUP_FSC_S7020_JWSE,
1707 	ALC260_FIXUP_VAIO_PINS,
1708 };
1709 
1710 static void alc260_gpio1_automute(struct hda_codec *codec)
1711 {
1712 	struct alc_spec *spec = codec->spec;
1713 
1714 	alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1715 }
1716 
1717 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1718 				      const struct hda_fixup *fix, int action)
1719 {
1720 	struct alc_spec *spec = codec->spec;
1721 	if (action == HDA_FIXUP_ACT_PROBE) {
1722 		/* although the machine has only one output pin, we need to
1723 		 * toggle GPIO1 according to the jack state
1724 		 */
1725 		spec->gen.automute_hook = alc260_gpio1_automute;
1726 		spec->gen.detect_hp = 1;
1727 		spec->gen.automute_speaker = 1;
1728 		spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1729 		snd_hda_jack_detect_enable_callback(codec, 0x0f,
1730 						    snd_hda_gen_hp_automute);
1731 		alc_setup_gpio(codec, 0x01);
1732 	}
1733 }
1734 
1735 static void alc260_fixup_kn1(struct hda_codec *codec,
1736 			     const struct hda_fixup *fix, int action)
1737 {
1738 	struct alc_spec *spec = codec->spec;
1739 	static const struct hda_pintbl pincfgs[] = {
1740 		{ 0x0f, 0x02214000 }, /* HP/speaker */
1741 		{ 0x12, 0x90a60160 }, /* int mic */
1742 		{ 0x13, 0x02a19000 }, /* ext mic */
1743 		{ 0x18, 0x01446000 }, /* SPDIF out */
1744 		/* disable bogus I/O pins */
1745 		{ 0x10, 0x411111f0 },
1746 		{ 0x11, 0x411111f0 },
1747 		{ 0x14, 0x411111f0 },
1748 		{ 0x15, 0x411111f0 },
1749 		{ 0x16, 0x411111f0 },
1750 		{ 0x17, 0x411111f0 },
1751 		{ 0x19, 0x411111f0 },
1752 		{ }
1753 	};
1754 
1755 	switch (action) {
1756 	case HDA_FIXUP_ACT_PRE_PROBE:
1757 		snd_hda_apply_pincfgs(codec, pincfgs);
1758 		spec->init_amp = ALC_INIT_NONE;
1759 		break;
1760 	}
1761 }
1762 
1763 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1764 				   const struct hda_fixup *fix, int action)
1765 {
1766 	struct alc_spec *spec = codec->spec;
1767 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
1768 		spec->init_amp = ALC_INIT_NONE;
1769 }
1770 
1771 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1772 				   const struct hda_fixup *fix, int action)
1773 {
1774 	struct alc_spec *spec = codec->spec;
1775 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1776 		spec->gen.add_jack_modes = 1;
1777 		spec->gen.hp_mic = 1;
1778 	}
1779 }
1780 
1781 static const struct hda_fixup alc260_fixups[] = {
1782 	[ALC260_FIXUP_HP_DC5750] = {
1783 		.type = HDA_FIXUP_PINS,
1784 		.v.pins = (const struct hda_pintbl[]) {
1785 			{ 0x11, 0x90130110 }, /* speaker */
1786 			{ }
1787 		}
1788 	},
1789 	[ALC260_FIXUP_HP_PIN_0F] = {
1790 		.type = HDA_FIXUP_PINS,
1791 		.v.pins = (const struct hda_pintbl[]) {
1792 			{ 0x0f, 0x01214000 }, /* HP */
1793 			{ }
1794 		}
1795 	},
1796 	[ALC260_FIXUP_COEF] = {
1797 		.type = HDA_FIXUP_VERBS,
1798 		.v.verbs = (const struct hda_verb[]) {
1799 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1800 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3040 },
1801 			{ }
1802 		},
1803 	},
1804 	[ALC260_FIXUP_GPIO1] = {
1805 		.type = HDA_FIXUP_FUNC,
1806 		.v.func = alc_fixup_gpio1,
1807 	},
1808 	[ALC260_FIXUP_GPIO1_TOGGLE] = {
1809 		.type = HDA_FIXUP_FUNC,
1810 		.v.func = alc260_fixup_gpio1_toggle,
1811 		.chained = true,
1812 		.chain_id = ALC260_FIXUP_HP_PIN_0F,
1813 	},
1814 	[ALC260_FIXUP_REPLACER] = {
1815 		.type = HDA_FIXUP_VERBS,
1816 		.v.verbs = (const struct hda_verb[]) {
1817 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1818 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3050 },
1819 			{ }
1820 		},
1821 		.chained = true,
1822 		.chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1823 	},
1824 	[ALC260_FIXUP_HP_B1900] = {
1825 		.type = HDA_FIXUP_FUNC,
1826 		.v.func = alc260_fixup_gpio1_toggle,
1827 		.chained = true,
1828 		.chain_id = ALC260_FIXUP_COEF,
1829 	},
1830 	[ALC260_FIXUP_KN1] = {
1831 		.type = HDA_FIXUP_FUNC,
1832 		.v.func = alc260_fixup_kn1,
1833 	},
1834 	[ALC260_FIXUP_FSC_S7020] = {
1835 		.type = HDA_FIXUP_FUNC,
1836 		.v.func = alc260_fixup_fsc_s7020,
1837 	},
1838 	[ALC260_FIXUP_FSC_S7020_JWSE] = {
1839 		.type = HDA_FIXUP_FUNC,
1840 		.v.func = alc260_fixup_fsc_s7020_jwse,
1841 		.chained = true,
1842 		.chain_id = ALC260_FIXUP_FSC_S7020,
1843 	},
1844 	[ALC260_FIXUP_VAIO_PINS] = {
1845 		.type = HDA_FIXUP_PINS,
1846 		.v.pins = (const struct hda_pintbl[]) {
1847 			/* Pin configs are missing completely on some VAIOs */
1848 			{ 0x0f, 0x01211020 },
1849 			{ 0x10, 0x0001003f },
1850 			{ 0x11, 0x411111f0 },
1851 			{ 0x12, 0x01a15930 },
1852 			{ 0x13, 0x411111f0 },
1853 			{ 0x14, 0x411111f0 },
1854 			{ 0x15, 0x411111f0 },
1855 			{ 0x16, 0x411111f0 },
1856 			{ 0x17, 0x411111f0 },
1857 			{ 0x18, 0x411111f0 },
1858 			{ 0x19, 0x411111f0 },
1859 			{ }
1860 		}
1861 	},
1862 };
1863 
1864 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1865 	SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1866 	SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1867 	SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1868 	SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1869 	SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1870 	SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1871 	SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1872 	SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1873 	SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1874 	SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1875 	SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1876 	SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1877 	{}
1878 };
1879 
1880 static const struct hda_model_fixup alc260_fixup_models[] = {
1881 	{.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1882 	{.id = ALC260_FIXUP_COEF, .name = "coef"},
1883 	{.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1884 	{.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1885 	{}
1886 };
1887 
1888 /*
1889  */
1890 static int patch_alc260(struct hda_codec *codec)
1891 {
1892 	struct alc_spec *spec;
1893 	int err;
1894 
1895 	err = alc_alloc_spec(codec, 0x07);
1896 	if (err < 0)
1897 		return err;
1898 
1899 	spec = codec->spec;
1900 	/* as quite a few machines require HP amp for speaker outputs,
1901 	 * it's easier to enable it unconditionally; even if it's unneeded,
1902 	 * it's almost harmless.
1903 	 */
1904 	spec->gen.prefer_hp_amp = 1;
1905 	spec->gen.beep_nid = 0x01;
1906 
1907 	spec->shutup = alc_eapd_shutup;
1908 
1909 	alc_pre_init(codec);
1910 
1911 	snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1912 			   alc260_fixups);
1913 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1914 
1915 	/* automatic parse from the BIOS config */
1916 	err = alc260_parse_auto_config(codec);
1917 	if (err < 0)
1918 		goto error;
1919 
1920 	if (!spec->gen.no_analog) {
1921 		err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1922 		if (err < 0)
1923 			goto error;
1924 	}
1925 
1926 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1927 
1928 	return 0;
1929 
1930  error:
1931 	alc_free(codec);
1932 	return err;
1933 }
1934 
1935 
1936 /*
1937  * ALC882/883/885/888/889 support
1938  *
1939  * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1940  * configuration.  Each pin widget can choose any input DACs and a mixer.
1941  * Each ADC is connected from a mixer of all inputs.  This makes possible
1942  * 6-channel independent captures.
1943  *
1944  * In addition, an independent DAC for the multi-playback (not used in this
1945  * driver yet).
1946  */
1947 
1948 /*
1949  * Pin config fixes
1950  */
1951 enum {
1952 	ALC882_FIXUP_ABIT_AW9D_MAX,
1953 	ALC882_FIXUP_LENOVO_Y530,
1954 	ALC882_FIXUP_PB_M5210,
1955 	ALC882_FIXUP_ACER_ASPIRE_7736,
1956 	ALC882_FIXUP_ASUS_W90V,
1957 	ALC889_FIXUP_CD,
1958 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1959 	ALC889_FIXUP_VAIO_TT,
1960 	ALC888_FIXUP_EEE1601,
1961 	ALC886_FIXUP_EAPD,
1962 	ALC882_FIXUP_EAPD,
1963 	ALC883_FIXUP_EAPD,
1964 	ALC883_FIXUP_ACER_EAPD,
1965 	ALC882_FIXUP_GPIO1,
1966 	ALC882_FIXUP_GPIO2,
1967 	ALC882_FIXUP_GPIO3,
1968 	ALC889_FIXUP_COEF,
1969 	ALC882_FIXUP_ASUS_W2JC,
1970 	ALC882_FIXUP_ACER_ASPIRE_4930G,
1971 	ALC882_FIXUP_ACER_ASPIRE_8930G,
1972 	ALC882_FIXUP_ASPIRE_8930G_VERBS,
1973 	ALC885_FIXUP_MACPRO_GPIO,
1974 	ALC889_FIXUP_DAC_ROUTE,
1975 	ALC889_FIXUP_MBP_VREF,
1976 	ALC889_FIXUP_IMAC91_VREF,
1977 	ALC889_FIXUP_MBA11_VREF,
1978 	ALC889_FIXUP_MBA21_VREF,
1979 	ALC889_FIXUP_MP11_VREF,
1980 	ALC889_FIXUP_MP41_VREF,
1981 	ALC882_FIXUP_INV_DMIC,
1982 	ALC882_FIXUP_NO_PRIMARY_HP,
1983 	ALC887_FIXUP_ASUS_BASS,
1984 	ALC887_FIXUP_BASS_CHMAP,
1985 	ALC1220_FIXUP_GB_DUAL_CODECS,
1986 	ALC1220_FIXUP_GB_X570,
1987 	ALC1220_FIXUP_CLEVO_P950,
1988 	ALC1220_FIXUP_CLEVO_PB51ED,
1989 	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1990 	ALC887_FIXUP_ASUS_AUDIO,
1991 	ALC887_FIXUP_ASUS_HMIC,
1992 	ALCS1200A_FIXUP_MIC_VREF,
1993 	ALC888VD_FIXUP_MIC_100VREF,
1994 };
1995 
1996 static void alc889_fixup_coef(struct hda_codec *codec,
1997 			      const struct hda_fixup *fix, int action)
1998 {
1999 	if (action != HDA_FIXUP_ACT_INIT)
2000 		return;
2001 	alc_update_coef_idx(codec, 7, 0, 0x2030);
2002 }
2003 
2004 /* set up GPIO at initialization */
2005 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2006 				     const struct hda_fixup *fix, int action)
2007 {
2008 	struct alc_spec *spec = codec->spec;
2009 
2010 	spec->gpio_write_delay = true;
2011 	alc_fixup_gpio3(codec, fix, action);
2012 }
2013 
2014 /* Fix the connection of some pins for ALC889:
2015  * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2016  * work correctly (bko#42740)
2017  */
2018 static void alc889_fixup_dac_route(struct hda_codec *codec,
2019 				   const struct hda_fixup *fix, int action)
2020 {
2021 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2022 		/* fake the connections during parsing the tree */
2023 		static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2024 		static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2025 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2026 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2027 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2028 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2029 	} else if (action == HDA_FIXUP_ACT_PROBE) {
2030 		/* restore the connections */
2031 		static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2032 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2033 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2034 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2035 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2036 	}
2037 }
2038 
2039 /* Set VREF on HP pin */
2040 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2041 				  const struct hda_fixup *fix, int action)
2042 {
2043 	static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2044 	struct alc_spec *spec = codec->spec;
2045 	int i;
2046 
2047 	if (action != HDA_FIXUP_ACT_INIT)
2048 		return;
2049 	for (i = 0; i < ARRAY_SIZE(nids); i++) {
2050 		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2051 		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2052 			continue;
2053 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2054 		val |= AC_PINCTL_VREF_80;
2055 		snd_hda_set_pin_ctl(codec, nids[i], val);
2056 		spec->gen.keep_vref_in_automute = 1;
2057 		break;
2058 	}
2059 }
2060 
2061 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2062 				  const hda_nid_t *nids, int num_nids)
2063 {
2064 	struct alc_spec *spec = codec->spec;
2065 	int i;
2066 
2067 	for (i = 0; i < num_nids; i++) {
2068 		unsigned int val;
2069 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2070 		val |= AC_PINCTL_VREF_50;
2071 		snd_hda_set_pin_ctl(codec, nids[i], val);
2072 	}
2073 	spec->gen.keep_vref_in_automute = 1;
2074 }
2075 
2076 /* Set VREF on speaker pins on imac91 */
2077 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2078 				     const struct hda_fixup *fix, int action)
2079 {
2080 	static const hda_nid_t nids[] = { 0x18, 0x1a };
2081 
2082 	if (action == HDA_FIXUP_ACT_INIT)
2083 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2084 }
2085 
2086 /* Set VREF on speaker pins on mba11 */
2087 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2088 				    const struct hda_fixup *fix, int action)
2089 {
2090 	static const hda_nid_t nids[] = { 0x18 };
2091 
2092 	if (action == HDA_FIXUP_ACT_INIT)
2093 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2094 }
2095 
2096 /* Set VREF on speaker pins on mba21 */
2097 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2098 				    const struct hda_fixup *fix, int action)
2099 {
2100 	static const hda_nid_t nids[] = { 0x18, 0x19 };
2101 
2102 	if (action == HDA_FIXUP_ACT_INIT)
2103 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2104 }
2105 
2106 /* Don't take HP output as primary
2107  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2108  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2109  */
2110 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2111 				       const struct hda_fixup *fix, int action)
2112 {
2113 	struct alc_spec *spec = codec->spec;
2114 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2115 		spec->gen.no_primary_hp = 1;
2116 		spec->gen.no_multi_io = 1;
2117 	}
2118 }
2119 
2120 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2121 				 const struct hda_fixup *fix, int action);
2122 
2123 /* For dual-codec configuration, we need to disable some features to avoid
2124  * conflicts of kctls and PCM streams
2125  */
2126 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2127 				  const struct hda_fixup *fix, int action)
2128 {
2129 	struct alc_spec *spec = codec->spec;
2130 
2131 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2132 		return;
2133 	/* disable vmaster */
2134 	spec->gen.suppress_vmaster = 1;
2135 	/* auto-mute and auto-mic switch don't work with multiple codecs */
2136 	spec->gen.suppress_auto_mute = 1;
2137 	spec->gen.suppress_auto_mic = 1;
2138 	/* disable aamix as well */
2139 	spec->gen.mixer_nid = 0;
2140 	/* add location prefix to avoid conflicts */
2141 	codec->force_pin_prefix = 1;
2142 }
2143 
2144 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2145 		       const char *newname)
2146 {
2147 	struct snd_kcontrol *kctl;
2148 
2149 	kctl = snd_hda_find_mixer_ctl(codec, oldname);
2150 	if (kctl)
2151 		snd_ctl_rename(codec->card, kctl, newname);
2152 }
2153 
2154 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2155 					 const struct hda_fixup *fix,
2156 					 int action)
2157 {
2158 	alc_fixup_dual_codecs(codec, fix, action);
2159 	switch (action) {
2160 	case HDA_FIXUP_ACT_PRE_PROBE:
2161 		/* override card longname to provide a unique UCM profile */
2162 		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2163 		break;
2164 	case HDA_FIXUP_ACT_BUILD:
2165 		/* rename Capture controls depending on the codec */
2166 		rename_ctl(codec, "Capture Volume",
2167 			   codec->addr == 0 ?
2168 			   "Rear-Panel Capture Volume" :
2169 			   "Front-Panel Capture Volume");
2170 		rename_ctl(codec, "Capture Switch",
2171 			   codec->addr == 0 ?
2172 			   "Rear-Panel Capture Switch" :
2173 			   "Front-Panel Capture Switch");
2174 		break;
2175 	}
2176 }
2177 
2178 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2179 				     const struct hda_fixup *fix,
2180 				     int action)
2181 {
2182 	static const hda_nid_t conn1[] = { 0x0c };
2183 	static const struct coef_fw gb_x570_coefs[] = {
2184 		WRITE_COEF(0x07, 0x03c0),
2185 		WRITE_COEF(0x1a, 0x01c1),
2186 		WRITE_COEF(0x1b, 0x0202),
2187 		WRITE_COEF(0x43, 0x3005),
2188 		{}
2189 	};
2190 
2191 	switch (action) {
2192 	case HDA_FIXUP_ACT_PRE_PROBE:
2193 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2194 		snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2195 		break;
2196 	case HDA_FIXUP_ACT_INIT:
2197 		alc_process_coef_fw(codec, gb_x570_coefs);
2198 		break;
2199 	}
2200 }
2201 
2202 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2203 				     const struct hda_fixup *fix,
2204 				     int action)
2205 {
2206 	static const hda_nid_t conn1[] = { 0x0c };
2207 
2208 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2209 		return;
2210 
2211 	alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2212 	/* We therefore want to make sure 0x14 (front headphone) and
2213 	 * 0x1b (speakers) use the stereo DAC 0x02
2214 	 */
2215 	snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2216 	snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2217 }
2218 
2219 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2220 				const struct hda_fixup *fix, int action);
2221 
2222 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2223 				     const struct hda_fixup *fix,
2224 				     int action)
2225 {
2226 	alc1220_fixup_clevo_p950(codec, fix, action);
2227 	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2228 }
2229 
2230 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2231 					 struct hda_jack_callback *jack)
2232 {
2233 	struct alc_spec *spec = codec->spec;
2234 	unsigned int vref;
2235 
2236 	snd_hda_gen_hp_automute(codec, jack);
2237 
2238 	if (spec->gen.hp_jack_present)
2239 		vref = AC_PINCTL_VREF_80;
2240 	else
2241 		vref = AC_PINCTL_VREF_HIZ;
2242 	snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2243 }
2244 
2245 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2246 				     const struct hda_fixup *fix, int action)
2247 {
2248 	struct alc_spec *spec = codec->spec;
2249 	if (action != HDA_FIXUP_ACT_PROBE)
2250 		return;
2251 	snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2252 	spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2253 }
2254 
2255 static const struct hda_fixup alc882_fixups[] = {
2256 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
2257 		.type = HDA_FIXUP_PINS,
2258 		.v.pins = (const struct hda_pintbl[]) {
2259 			{ 0x15, 0x01080104 }, /* side */
2260 			{ 0x16, 0x01011012 }, /* rear */
2261 			{ 0x17, 0x01016011 }, /* clfe */
2262 			{ }
2263 		}
2264 	},
2265 	[ALC882_FIXUP_LENOVO_Y530] = {
2266 		.type = HDA_FIXUP_PINS,
2267 		.v.pins = (const struct hda_pintbl[]) {
2268 			{ 0x15, 0x99130112 }, /* rear int speakers */
2269 			{ 0x16, 0x99130111 }, /* subwoofer */
2270 			{ }
2271 		}
2272 	},
2273 	[ALC882_FIXUP_PB_M5210] = {
2274 		.type = HDA_FIXUP_PINCTLS,
2275 		.v.pins = (const struct hda_pintbl[]) {
2276 			{ 0x19, PIN_VREF50 },
2277 			{}
2278 		}
2279 	},
2280 	[ALC882_FIXUP_ACER_ASPIRE_7736] = {
2281 		.type = HDA_FIXUP_FUNC,
2282 		.v.func = alc_fixup_sku_ignore,
2283 	},
2284 	[ALC882_FIXUP_ASUS_W90V] = {
2285 		.type = HDA_FIXUP_PINS,
2286 		.v.pins = (const struct hda_pintbl[]) {
2287 			{ 0x16, 0x99130110 }, /* fix sequence for CLFE */
2288 			{ }
2289 		}
2290 	},
2291 	[ALC889_FIXUP_CD] = {
2292 		.type = HDA_FIXUP_PINS,
2293 		.v.pins = (const struct hda_pintbl[]) {
2294 			{ 0x1c, 0x993301f0 }, /* CD */
2295 			{ }
2296 		}
2297 	},
2298 	[ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2299 		.type = HDA_FIXUP_PINS,
2300 		.v.pins = (const struct hda_pintbl[]) {
2301 			{ 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2302 			{ }
2303 		},
2304 		.chained = true,
2305 		.chain_id = ALC889_FIXUP_CD,
2306 	},
2307 	[ALC889_FIXUP_VAIO_TT] = {
2308 		.type = HDA_FIXUP_PINS,
2309 		.v.pins = (const struct hda_pintbl[]) {
2310 			{ 0x17, 0x90170111 }, /* hidden surround speaker */
2311 			{ }
2312 		}
2313 	},
2314 	[ALC888_FIXUP_EEE1601] = {
2315 		.type = HDA_FIXUP_VERBS,
2316 		.v.verbs = (const struct hda_verb[]) {
2317 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2318 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x0838 },
2319 			{ }
2320 		}
2321 	},
2322 	[ALC886_FIXUP_EAPD] = {
2323 		.type = HDA_FIXUP_VERBS,
2324 		.v.verbs = (const struct hda_verb[]) {
2325 			/* change to EAPD mode */
2326 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2327 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2328 			{ }
2329 		}
2330 	},
2331 	[ALC882_FIXUP_EAPD] = {
2332 		.type = HDA_FIXUP_VERBS,
2333 		.v.verbs = (const struct hda_verb[]) {
2334 			/* change to EAPD mode */
2335 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2336 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2337 			{ }
2338 		}
2339 	},
2340 	[ALC883_FIXUP_EAPD] = {
2341 		.type = HDA_FIXUP_VERBS,
2342 		.v.verbs = (const struct hda_verb[]) {
2343 			/* change to EAPD mode */
2344 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2345 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2346 			{ }
2347 		}
2348 	},
2349 	[ALC883_FIXUP_ACER_EAPD] = {
2350 		.type = HDA_FIXUP_VERBS,
2351 		.v.verbs = (const struct hda_verb[]) {
2352 			/* eanable EAPD on Acer laptops */
2353 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2354 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2355 			{ }
2356 		}
2357 	},
2358 	[ALC882_FIXUP_GPIO1] = {
2359 		.type = HDA_FIXUP_FUNC,
2360 		.v.func = alc_fixup_gpio1,
2361 	},
2362 	[ALC882_FIXUP_GPIO2] = {
2363 		.type = HDA_FIXUP_FUNC,
2364 		.v.func = alc_fixup_gpio2,
2365 	},
2366 	[ALC882_FIXUP_GPIO3] = {
2367 		.type = HDA_FIXUP_FUNC,
2368 		.v.func = alc_fixup_gpio3,
2369 	},
2370 	[ALC882_FIXUP_ASUS_W2JC] = {
2371 		.type = HDA_FIXUP_FUNC,
2372 		.v.func = alc_fixup_gpio1,
2373 		.chained = true,
2374 		.chain_id = ALC882_FIXUP_EAPD,
2375 	},
2376 	[ALC889_FIXUP_COEF] = {
2377 		.type = HDA_FIXUP_FUNC,
2378 		.v.func = alc889_fixup_coef,
2379 	},
2380 	[ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2381 		.type = HDA_FIXUP_PINS,
2382 		.v.pins = (const struct hda_pintbl[]) {
2383 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2384 			{ 0x17, 0x99130112 }, /* surround speaker */
2385 			{ }
2386 		},
2387 		.chained = true,
2388 		.chain_id = ALC882_FIXUP_GPIO1,
2389 	},
2390 	[ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2391 		.type = HDA_FIXUP_PINS,
2392 		.v.pins = (const struct hda_pintbl[]) {
2393 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2394 			{ 0x1b, 0x99130112 }, /* surround speaker */
2395 			{ }
2396 		},
2397 		.chained = true,
2398 		.chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2399 	},
2400 	[ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2401 		/* additional init verbs for Acer Aspire 8930G */
2402 		.type = HDA_FIXUP_VERBS,
2403 		.v.verbs = (const struct hda_verb[]) {
2404 			/* Enable all DACs */
2405 			/* DAC DISABLE/MUTE 1? */
2406 			/*  setting bits 1-5 disables DAC nids 0x02-0x06
2407 			 *  apparently. Init=0x38 */
2408 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2409 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2410 			/* DAC DISABLE/MUTE 2? */
2411 			/*  some bit here disables the other DACs.
2412 			 *  Init=0x4900 */
2413 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2414 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2415 			/* DMIC fix
2416 			 * This laptop has a stereo digital microphone.
2417 			 * The mics are only 1cm apart which makes the stereo
2418 			 * useless. However, either the mic or the ALC889
2419 			 * makes the signal become a difference/sum signal
2420 			 * instead of standard stereo, which is annoying.
2421 			 * So instead we flip this bit which makes the
2422 			 * codec replicate the sum signal to both channels,
2423 			 * turning it into a normal mono mic.
2424 			 */
2425 			/* DMIC_CONTROL? Init value = 0x0001 */
2426 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2427 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2428 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2429 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2430 			{ }
2431 		},
2432 		.chained = true,
2433 		.chain_id = ALC882_FIXUP_GPIO1,
2434 	},
2435 	[ALC885_FIXUP_MACPRO_GPIO] = {
2436 		.type = HDA_FIXUP_FUNC,
2437 		.v.func = alc885_fixup_macpro_gpio,
2438 	},
2439 	[ALC889_FIXUP_DAC_ROUTE] = {
2440 		.type = HDA_FIXUP_FUNC,
2441 		.v.func = alc889_fixup_dac_route,
2442 	},
2443 	[ALC889_FIXUP_MBP_VREF] = {
2444 		.type = HDA_FIXUP_FUNC,
2445 		.v.func = alc889_fixup_mbp_vref,
2446 		.chained = true,
2447 		.chain_id = ALC882_FIXUP_GPIO1,
2448 	},
2449 	[ALC889_FIXUP_IMAC91_VREF] = {
2450 		.type = HDA_FIXUP_FUNC,
2451 		.v.func = alc889_fixup_imac91_vref,
2452 		.chained = true,
2453 		.chain_id = ALC882_FIXUP_GPIO1,
2454 	},
2455 	[ALC889_FIXUP_MBA11_VREF] = {
2456 		.type = HDA_FIXUP_FUNC,
2457 		.v.func = alc889_fixup_mba11_vref,
2458 		.chained = true,
2459 		.chain_id = ALC889_FIXUP_MBP_VREF,
2460 	},
2461 	[ALC889_FIXUP_MBA21_VREF] = {
2462 		.type = HDA_FIXUP_FUNC,
2463 		.v.func = alc889_fixup_mba21_vref,
2464 		.chained = true,
2465 		.chain_id = ALC889_FIXUP_MBP_VREF,
2466 	},
2467 	[ALC889_FIXUP_MP11_VREF] = {
2468 		.type = HDA_FIXUP_FUNC,
2469 		.v.func = alc889_fixup_mba11_vref,
2470 		.chained = true,
2471 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2472 	},
2473 	[ALC889_FIXUP_MP41_VREF] = {
2474 		.type = HDA_FIXUP_FUNC,
2475 		.v.func = alc889_fixup_mbp_vref,
2476 		.chained = true,
2477 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2478 	},
2479 	[ALC882_FIXUP_INV_DMIC] = {
2480 		.type = HDA_FIXUP_FUNC,
2481 		.v.func = alc_fixup_inv_dmic,
2482 	},
2483 	[ALC882_FIXUP_NO_PRIMARY_HP] = {
2484 		.type = HDA_FIXUP_FUNC,
2485 		.v.func = alc882_fixup_no_primary_hp,
2486 	},
2487 	[ALC887_FIXUP_ASUS_BASS] = {
2488 		.type = HDA_FIXUP_PINS,
2489 		.v.pins = (const struct hda_pintbl[]) {
2490 			{0x16, 0x99130130}, /* bass speaker */
2491 			{}
2492 		},
2493 		.chained = true,
2494 		.chain_id = ALC887_FIXUP_BASS_CHMAP,
2495 	},
2496 	[ALC887_FIXUP_BASS_CHMAP] = {
2497 		.type = HDA_FIXUP_FUNC,
2498 		.v.func = alc_fixup_bass_chmap,
2499 	},
2500 	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
2501 		.type = HDA_FIXUP_FUNC,
2502 		.v.func = alc1220_fixup_gb_dual_codecs,
2503 	},
2504 	[ALC1220_FIXUP_GB_X570] = {
2505 		.type = HDA_FIXUP_FUNC,
2506 		.v.func = alc1220_fixup_gb_x570,
2507 	},
2508 	[ALC1220_FIXUP_CLEVO_P950] = {
2509 		.type = HDA_FIXUP_FUNC,
2510 		.v.func = alc1220_fixup_clevo_p950,
2511 	},
2512 	[ALC1220_FIXUP_CLEVO_PB51ED] = {
2513 		.type = HDA_FIXUP_FUNC,
2514 		.v.func = alc1220_fixup_clevo_pb51ed,
2515 	},
2516 	[ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2517 		.type = HDA_FIXUP_PINS,
2518 		.v.pins = (const struct hda_pintbl[]) {
2519 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2520 			{}
2521 		},
2522 		.chained = true,
2523 		.chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2524 	},
2525 	[ALC887_FIXUP_ASUS_AUDIO] = {
2526 		.type = HDA_FIXUP_PINS,
2527 		.v.pins = (const struct hda_pintbl[]) {
2528 			{ 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2529 			{ 0x19, 0x22219420 },
2530 			{}
2531 		},
2532 	},
2533 	[ALC887_FIXUP_ASUS_HMIC] = {
2534 		.type = HDA_FIXUP_FUNC,
2535 		.v.func = alc887_fixup_asus_jack,
2536 		.chained = true,
2537 		.chain_id = ALC887_FIXUP_ASUS_AUDIO,
2538 	},
2539 	[ALCS1200A_FIXUP_MIC_VREF] = {
2540 		.type = HDA_FIXUP_PINCTLS,
2541 		.v.pins = (const struct hda_pintbl[]) {
2542 			{ 0x18, PIN_VREF50 }, /* rear mic */
2543 			{ 0x19, PIN_VREF50 }, /* front mic */
2544 			{}
2545 		}
2546 	},
2547 	[ALC888VD_FIXUP_MIC_100VREF] = {
2548 		.type = HDA_FIXUP_PINCTLS,
2549 		.v.pins = (const struct hda_pintbl[]) {
2550 			{ 0x18, PIN_VREF100 }, /* headset mic */
2551 			{}
2552 		}
2553 	},
2554 };
2555 
2556 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2557 	SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2558 	SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2559 	SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2560 	SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2561 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2562 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2563 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2564 	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2565 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2566 	SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2567 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2568 	SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2569 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2570 	SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2571 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2572 	SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2573 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2574 	SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2575 	SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2576 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2577 	SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2578 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2579 	SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2580 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2581 	SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2582 	SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2583 	SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2584 	SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2585 	SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2586 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2587 	SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2588 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2589 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2590 	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2591 	SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2592 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2593 	SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2594 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2595 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2596 	SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2597 
2598 	/* All Apple entries are in codec SSIDs */
2599 	SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2600 	SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2601 	SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2602 	SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2603 	SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2604 	SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2605 	SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2606 	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2607 	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2608 	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2609 	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2610 	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2611 	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2612 	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2613 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2614 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2615 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2616 	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2617 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2618 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2619 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2620 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2621 
2622 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2623 	SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2624 	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2625 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2626 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2627 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2628 	SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2629 	SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2630 	SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2631 	SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2632 	SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2633 	SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2634 	SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2635 	SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2636 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2637 	SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2638 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2639 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2640 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2641 	SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2642 	SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2643 	SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2644 	SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2645 	SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2646 	SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2647 	SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2648 	SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2649 	SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2650 	SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2651 	SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2652 	SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2653 	SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2654 	SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2655 	SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2656 	SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 	SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 	SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2659 	SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2660 	SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2661 	SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2662 	SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2663 	SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2664 	SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2665 	SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2666 	SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2667 	SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2668 	SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2669 	SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2670 	SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2671 	SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2672 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2673 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2674 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2675 	SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2676 	{}
2677 };
2678 
2679 static const struct hda_model_fixup alc882_fixup_models[] = {
2680 	{.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2681 	{.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2682 	{.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2683 	{.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2684 	{.id = ALC889_FIXUP_CD, .name = "cd"},
2685 	{.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2686 	{.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2687 	{.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2688 	{.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2689 	{.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2690 	{.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2691 	{.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2692 	{.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2693 	{.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2694 	{.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2695 	{.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2696 	{.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2697 	{.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2698 	{.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2699 	{.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2700 	{.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2701 	{.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2702 	{.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2703 	{.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2704 	{.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2705 	{.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2706 	{.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2707 	{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2708 	{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2709 	{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2710 	{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2711 	{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2712 	{}
2713 };
2714 
2715 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2716 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2717 		{0x14, 0x01014010},
2718 		{0x15, 0x01011012},
2719 		{0x16, 0x01016011},
2720 		{0x18, 0x01a19040},
2721 		{0x19, 0x02a19050},
2722 		{0x1a, 0x0181304f},
2723 		{0x1b, 0x0221401f},
2724 		{0x1e, 0x01456130}),
2725 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2726 		{0x14, 0x01015010},
2727 		{0x15, 0x01011012},
2728 		{0x16, 0x01011011},
2729 		{0x18, 0x01a11040},
2730 		{0x19, 0x02a19050},
2731 		{0x1a, 0x0181104f},
2732 		{0x1b, 0x0221401f},
2733 		{0x1e, 0x01451130}),
2734 	{}
2735 };
2736 
2737 /*
2738  * BIOS auto configuration
2739  */
2740 /* almost identical with ALC880 parser... */
2741 static int alc882_parse_auto_config(struct hda_codec *codec)
2742 {
2743 	static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2744 	static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2745 	return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2746 }
2747 
2748 /*
2749  */
2750 static int patch_alc882(struct hda_codec *codec)
2751 {
2752 	struct alc_spec *spec;
2753 	int err;
2754 
2755 	err = alc_alloc_spec(codec, 0x0b);
2756 	if (err < 0)
2757 		return err;
2758 
2759 	spec = codec->spec;
2760 
2761 	switch (codec->core.vendor_id) {
2762 	case 0x10ec0882:
2763 	case 0x10ec0885:
2764 	case 0x10ec0900:
2765 	case 0x10ec0b00:
2766 	case 0x10ec1220:
2767 		break;
2768 	default:
2769 		/* ALC883 and variants */
2770 		alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2771 		break;
2772 	}
2773 
2774 	alc_pre_init(codec);
2775 
2776 	snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2777 		       alc882_fixups);
2778 	snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2779 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2780 
2781 	alc_auto_parse_customize_define(codec);
2782 
2783 	if (has_cdefine_beep(codec))
2784 		spec->gen.beep_nid = 0x01;
2785 
2786 	/* automatic parse from the BIOS config */
2787 	err = alc882_parse_auto_config(codec);
2788 	if (err < 0)
2789 		goto error;
2790 
2791 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2792 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2793 		if (err < 0)
2794 			goto error;
2795 	}
2796 
2797 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2798 
2799 	return 0;
2800 
2801  error:
2802 	alc_free(codec);
2803 	return err;
2804 }
2805 
2806 
2807 /*
2808  * ALC262 support
2809  */
2810 static int alc262_parse_auto_config(struct hda_codec *codec)
2811 {
2812 	static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2813 	static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2814 	return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2815 }
2816 
2817 /*
2818  * Pin config fixes
2819  */
2820 enum {
2821 	ALC262_FIXUP_FSC_H270,
2822 	ALC262_FIXUP_FSC_S7110,
2823 	ALC262_FIXUP_HP_Z200,
2824 	ALC262_FIXUP_TYAN,
2825 	ALC262_FIXUP_LENOVO_3000,
2826 	ALC262_FIXUP_BENQ,
2827 	ALC262_FIXUP_BENQ_T31,
2828 	ALC262_FIXUP_INV_DMIC,
2829 	ALC262_FIXUP_INTEL_BAYLEYBAY,
2830 };
2831 
2832 static const struct hda_fixup alc262_fixups[] = {
2833 	[ALC262_FIXUP_FSC_H270] = {
2834 		.type = HDA_FIXUP_PINS,
2835 		.v.pins = (const struct hda_pintbl[]) {
2836 			{ 0x14, 0x99130110 }, /* speaker */
2837 			{ 0x15, 0x0221142f }, /* front HP */
2838 			{ 0x1b, 0x0121141f }, /* rear HP */
2839 			{ }
2840 		}
2841 	},
2842 	[ALC262_FIXUP_FSC_S7110] = {
2843 		.type = HDA_FIXUP_PINS,
2844 		.v.pins = (const struct hda_pintbl[]) {
2845 			{ 0x15, 0x90170110 }, /* speaker */
2846 			{ }
2847 		},
2848 		.chained = true,
2849 		.chain_id = ALC262_FIXUP_BENQ,
2850 	},
2851 	[ALC262_FIXUP_HP_Z200] = {
2852 		.type = HDA_FIXUP_PINS,
2853 		.v.pins = (const struct hda_pintbl[]) {
2854 			{ 0x16, 0x99130120 }, /* internal speaker */
2855 			{ }
2856 		}
2857 	},
2858 	[ALC262_FIXUP_TYAN] = {
2859 		.type = HDA_FIXUP_PINS,
2860 		.v.pins = (const struct hda_pintbl[]) {
2861 			{ 0x14, 0x1993e1f0 }, /* int AUX */
2862 			{ }
2863 		}
2864 	},
2865 	[ALC262_FIXUP_LENOVO_3000] = {
2866 		.type = HDA_FIXUP_PINCTLS,
2867 		.v.pins = (const struct hda_pintbl[]) {
2868 			{ 0x19, PIN_VREF50 },
2869 			{}
2870 		},
2871 		.chained = true,
2872 		.chain_id = ALC262_FIXUP_BENQ,
2873 	},
2874 	[ALC262_FIXUP_BENQ] = {
2875 		.type = HDA_FIXUP_VERBS,
2876 		.v.verbs = (const struct hda_verb[]) {
2877 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2878 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2879 			{}
2880 		}
2881 	},
2882 	[ALC262_FIXUP_BENQ_T31] = {
2883 		.type = HDA_FIXUP_VERBS,
2884 		.v.verbs = (const struct hda_verb[]) {
2885 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2886 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2887 			{}
2888 		}
2889 	},
2890 	[ALC262_FIXUP_INV_DMIC] = {
2891 		.type = HDA_FIXUP_FUNC,
2892 		.v.func = alc_fixup_inv_dmic,
2893 	},
2894 	[ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2895 		.type = HDA_FIXUP_FUNC,
2896 		.v.func = alc_fixup_no_depop_delay,
2897 	},
2898 };
2899 
2900 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2901 	SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2902 	SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2903 	SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2904 	SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2905 	SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2906 	SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2907 	SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2908 	SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2909 	SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2910 	SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2911 	{}
2912 };
2913 
2914 static const struct hda_model_fixup alc262_fixup_models[] = {
2915 	{.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2916 	{.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2917 	{.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2918 	{.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2919 	{.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2920 	{.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2921 	{.id = ALC262_FIXUP_BENQ, .name = "benq"},
2922 	{.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2923 	{.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2924 	{}
2925 };
2926 
2927 /*
2928  */
2929 static int patch_alc262(struct hda_codec *codec)
2930 {
2931 	struct alc_spec *spec;
2932 	int err;
2933 
2934 	err = alc_alloc_spec(codec, 0x0b);
2935 	if (err < 0)
2936 		return err;
2937 
2938 	spec = codec->spec;
2939 	spec->gen.shared_mic_vref_pin = 0x18;
2940 
2941 	spec->shutup = alc_eapd_shutup;
2942 
2943 #if 0
2944 	/* pshou 07/11/05  set a zero PCM sample to DAC when FIFO is
2945 	 * under-run
2946 	 */
2947 	alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2948 #endif
2949 	alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2950 
2951 	alc_pre_init(codec);
2952 
2953 	snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2954 		       alc262_fixups);
2955 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2956 
2957 	alc_auto_parse_customize_define(codec);
2958 
2959 	if (has_cdefine_beep(codec))
2960 		spec->gen.beep_nid = 0x01;
2961 
2962 	/* automatic parse from the BIOS config */
2963 	err = alc262_parse_auto_config(codec);
2964 	if (err < 0)
2965 		goto error;
2966 
2967 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2968 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2969 		if (err < 0)
2970 			goto error;
2971 	}
2972 
2973 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2974 
2975 	return 0;
2976 
2977  error:
2978 	alc_free(codec);
2979 	return err;
2980 }
2981 
2982 /*
2983  *  ALC268
2984  */
2985 /* bind Beep switches of both NID 0x0f and 0x10 */
2986 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2987 				  struct snd_ctl_elem_value *ucontrol)
2988 {
2989 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2990 	unsigned long pval;
2991 	int err;
2992 
2993 	mutex_lock(&codec->control_mutex);
2994 	pval = kcontrol->private_value;
2995 	kcontrol->private_value = (pval & ~0xff) | 0x0f;
2996 	err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2997 	if (err >= 0) {
2998 		kcontrol->private_value = (pval & ~0xff) | 0x10;
2999 		err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3000 	}
3001 	kcontrol->private_value = pval;
3002 	mutex_unlock(&codec->control_mutex);
3003 	return err;
3004 }
3005 
3006 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3007 	HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3008 	{
3009 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3010 		.name = "Beep Playback Switch",
3011 		.subdevice = HDA_SUBDEV_AMP_FLAG,
3012 		.info = snd_hda_mixer_amp_switch_info,
3013 		.get = snd_hda_mixer_amp_switch_get,
3014 		.put = alc268_beep_switch_put,
3015 		.private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3016 	},
3017 };
3018 
3019 /* set PCBEEP vol = 0, mute connections */
3020 static const struct hda_verb alc268_beep_init_verbs[] = {
3021 	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3022 	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3023 	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3024 	{ }
3025 };
3026 
3027 enum {
3028 	ALC268_FIXUP_INV_DMIC,
3029 	ALC268_FIXUP_HP_EAPD,
3030 	ALC268_FIXUP_SPDIF,
3031 };
3032 
3033 static const struct hda_fixup alc268_fixups[] = {
3034 	[ALC268_FIXUP_INV_DMIC] = {
3035 		.type = HDA_FIXUP_FUNC,
3036 		.v.func = alc_fixup_inv_dmic,
3037 	},
3038 	[ALC268_FIXUP_HP_EAPD] = {
3039 		.type = HDA_FIXUP_VERBS,
3040 		.v.verbs = (const struct hda_verb[]) {
3041 			{0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3042 			{}
3043 		}
3044 	},
3045 	[ALC268_FIXUP_SPDIF] = {
3046 		.type = HDA_FIXUP_PINS,
3047 		.v.pins = (const struct hda_pintbl[]) {
3048 			{ 0x1e, 0x014b1180 }, /* enable SPDIF out */
3049 			{}
3050 		}
3051 	},
3052 };
3053 
3054 static const struct hda_model_fixup alc268_fixup_models[] = {
3055 	{.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3056 	{.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3057 	{.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3058 	{}
3059 };
3060 
3061 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
3062 	SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3063 	SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3064 	/* below is codec SSID since multiple Toshiba laptops have the
3065 	 * same PCI SSID 1179:ff00
3066 	 */
3067 	SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3068 	{}
3069 };
3070 
3071 /*
3072  * BIOS auto configuration
3073  */
3074 static int alc268_parse_auto_config(struct hda_codec *codec)
3075 {
3076 	static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3077 	return alc_parse_auto_config(codec, NULL, alc268_ssids);
3078 }
3079 
3080 /*
3081  */
3082 static int patch_alc268(struct hda_codec *codec)
3083 {
3084 	struct alc_spec *spec;
3085 	int i, err;
3086 
3087 	/* ALC268 has no aa-loopback mixer */
3088 	err = alc_alloc_spec(codec, 0);
3089 	if (err < 0)
3090 		return err;
3091 
3092 	spec = codec->spec;
3093 	if (has_cdefine_beep(codec))
3094 		spec->gen.beep_nid = 0x01;
3095 
3096 	spec->shutup = alc_eapd_shutup;
3097 
3098 	alc_pre_init(codec);
3099 
3100 	snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3101 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3102 
3103 	/* automatic parse from the BIOS config */
3104 	err = alc268_parse_auto_config(codec);
3105 	if (err < 0)
3106 		goto error;
3107 
3108 	if (err > 0 && !spec->gen.no_analog &&
3109 	    spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3110 		for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3111 			if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3112 						  &alc268_beep_mixer[i])) {
3113 				err = -ENOMEM;
3114 				goto error;
3115 			}
3116 		}
3117 		snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3118 		if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3119 			/* override the amp caps for beep generator */
3120 			snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3121 					  (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3122 					  (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3123 					  (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3124 					  (0 << AC_AMPCAP_MUTE_SHIFT));
3125 	}
3126 
3127 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3128 
3129 	return 0;
3130 
3131  error:
3132 	alc_free(codec);
3133 	return err;
3134 }
3135 
3136 /*
3137  * ALC269
3138  */
3139 
3140 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3141 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3142 };
3143 
3144 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3145 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3146 };
3147 
3148 /* different alc269-variants */
3149 enum {
3150 	ALC269_TYPE_ALC269VA,
3151 	ALC269_TYPE_ALC269VB,
3152 	ALC269_TYPE_ALC269VC,
3153 	ALC269_TYPE_ALC269VD,
3154 	ALC269_TYPE_ALC280,
3155 	ALC269_TYPE_ALC282,
3156 	ALC269_TYPE_ALC283,
3157 	ALC269_TYPE_ALC284,
3158 	ALC269_TYPE_ALC293,
3159 	ALC269_TYPE_ALC286,
3160 	ALC269_TYPE_ALC298,
3161 	ALC269_TYPE_ALC255,
3162 	ALC269_TYPE_ALC256,
3163 	ALC269_TYPE_ALC257,
3164 	ALC269_TYPE_ALC215,
3165 	ALC269_TYPE_ALC225,
3166 	ALC269_TYPE_ALC245,
3167 	ALC269_TYPE_ALC287,
3168 	ALC269_TYPE_ALC294,
3169 	ALC269_TYPE_ALC300,
3170 	ALC269_TYPE_ALC623,
3171 	ALC269_TYPE_ALC700,
3172 };
3173 
3174 /*
3175  * BIOS auto configuration
3176  */
3177 static int alc269_parse_auto_config(struct hda_codec *codec)
3178 {
3179 	static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3180 	static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3181 	static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3182 	struct alc_spec *spec = codec->spec;
3183 	const hda_nid_t *ssids;
3184 
3185 	switch (spec->codec_variant) {
3186 	case ALC269_TYPE_ALC269VA:
3187 	case ALC269_TYPE_ALC269VC:
3188 	case ALC269_TYPE_ALC280:
3189 	case ALC269_TYPE_ALC284:
3190 	case ALC269_TYPE_ALC293:
3191 		ssids = alc269va_ssids;
3192 		break;
3193 	case ALC269_TYPE_ALC269VB:
3194 	case ALC269_TYPE_ALC269VD:
3195 	case ALC269_TYPE_ALC282:
3196 	case ALC269_TYPE_ALC283:
3197 	case ALC269_TYPE_ALC286:
3198 	case ALC269_TYPE_ALC298:
3199 	case ALC269_TYPE_ALC255:
3200 	case ALC269_TYPE_ALC256:
3201 	case ALC269_TYPE_ALC257:
3202 	case ALC269_TYPE_ALC215:
3203 	case ALC269_TYPE_ALC225:
3204 	case ALC269_TYPE_ALC245:
3205 	case ALC269_TYPE_ALC287:
3206 	case ALC269_TYPE_ALC294:
3207 	case ALC269_TYPE_ALC300:
3208 	case ALC269_TYPE_ALC623:
3209 	case ALC269_TYPE_ALC700:
3210 		ssids = alc269_ssids;
3211 		break;
3212 	default:
3213 		ssids = alc269_ssids;
3214 		break;
3215 	}
3216 
3217 	return alc_parse_auto_config(codec, alc269_ignore, ssids);
3218 }
3219 
3220 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3221 	{ SND_JACK_BTN_0, KEY_PLAYPAUSE },
3222 	{ SND_JACK_BTN_1, KEY_VOICECOMMAND },
3223 	{ SND_JACK_BTN_2, KEY_VOLUMEUP },
3224 	{ SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3225 	{}
3226 };
3227 
3228 static void alc_headset_btn_callback(struct hda_codec *codec,
3229 				     struct hda_jack_callback *jack)
3230 {
3231 	int report = 0;
3232 
3233 	if (jack->unsol_res & (7 << 13))
3234 		report |= SND_JACK_BTN_0;
3235 
3236 	if (jack->unsol_res  & (1 << 16 | 3 << 8))
3237 		report |= SND_JACK_BTN_1;
3238 
3239 	/* Volume up key */
3240 	if (jack->unsol_res & (7 << 23))
3241 		report |= SND_JACK_BTN_2;
3242 
3243 	/* Volume down key */
3244 	if (jack->unsol_res & (7 << 10))
3245 		report |= SND_JACK_BTN_3;
3246 
3247 	snd_hda_jack_set_button_state(codec, jack->nid, report);
3248 }
3249 
3250 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3251 {
3252 	struct alc_spec *spec = codec->spec;
3253 
3254 	if (!spec->has_hs_key)
3255 		return;
3256 
3257 	switch (codec->core.vendor_id) {
3258 	case 0x10ec0215:
3259 	case 0x10ec0225:
3260 	case 0x10ec0285:
3261 	case 0x10ec0287:
3262 	case 0x10ec0295:
3263 	case 0x10ec0289:
3264 	case 0x10ec0299:
3265 		alc_write_coef_idx(codec, 0x48, 0x0);
3266 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3267 		alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3268 		break;
3269 	case 0x10ec0230:
3270 	case 0x10ec0236:
3271 	case 0x10ec0256:
3272 	case 0x10ec0257:
3273 	case 0x19e58326:
3274 		alc_write_coef_idx(codec, 0x48, 0x0);
3275 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3276 		break;
3277 	}
3278 }
3279 
3280 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3281 {
3282 	struct alc_spec *spec = codec->spec;
3283 
3284 	if (!spec->has_hs_key)
3285 		return;
3286 
3287 	switch (codec->core.vendor_id) {
3288 	case 0x10ec0215:
3289 	case 0x10ec0225:
3290 	case 0x10ec0285:
3291 	case 0x10ec0287:
3292 	case 0x10ec0295:
3293 	case 0x10ec0289:
3294 	case 0x10ec0299:
3295 		alc_write_coef_idx(codec, 0x48, 0xd011);
3296 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3297 		alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3298 		break;
3299 	case 0x10ec0230:
3300 	case 0x10ec0236:
3301 	case 0x10ec0256:
3302 	case 0x10ec0257:
3303 	case 0x19e58326:
3304 		alc_write_coef_idx(codec, 0x48, 0xd011);
3305 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3306 		break;
3307 	}
3308 }
3309 
3310 static void alc_fixup_headset_jack(struct hda_codec *codec,
3311 				    const struct hda_fixup *fix, int action)
3312 {
3313 	struct alc_spec *spec = codec->spec;
3314 	hda_nid_t hp_pin;
3315 
3316 	switch (action) {
3317 	case HDA_FIXUP_ACT_PRE_PROBE:
3318 		spec->has_hs_key = 1;
3319 		snd_hda_jack_detect_enable_callback(codec, 0x55,
3320 						    alc_headset_btn_callback);
3321 		break;
3322 	case HDA_FIXUP_ACT_BUILD:
3323 		hp_pin = alc_get_hp_pin(spec);
3324 		if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3325 							alc_headset_btn_keymap,
3326 							hp_pin))
3327 			snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3328 					      false, SND_JACK_HEADSET,
3329 					      alc_headset_btn_keymap);
3330 
3331 		alc_enable_headset_jack_key(codec);
3332 		break;
3333 	}
3334 }
3335 
3336 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3337 {
3338 	alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3339 }
3340 
3341 static void alc269_shutup(struct hda_codec *codec)
3342 {
3343 	struct alc_spec *spec = codec->spec;
3344 
3345 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3346 		alc269vb_toggle_power_output(codec, 0);
3347 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3348 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3349 		msleep(150);
3350 	}
3351 	alc_shutup_pins(codec);
3352 }
3353 
3354 static const struct coef_fw alc282_coefs[] = {
3355 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3356 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3357 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3358 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3359 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3360 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3361 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3362 	WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3363 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3364 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3365 	WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3366 	UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3367 	WRITE_COEF(0x34, 0xa0c0), /* ANC */
3368 	UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3369 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3370 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3371 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3372 	WRITE_COEF(0x63, 0x2902), /* PLL */
3373 	WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3374 	WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3375 	WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3376 	WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3377 	UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3378 	WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3379 	UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3380 	WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3381 	WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3382 	UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3383 	WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3384 	{}
3385 };
3386 
3387 static void alc282_restore_default_value(struct hda_codec *codec)
3388 {
3389 	alc_process_coef_fw(codec, alc282_coefs);
3390 }
3391 
3392 static void alc282_init(struct hda_codec *codec)
3393 {
3394 	struct alc_spec *spec = codec->spec;
3395 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3396 	bool hp_pin_sense;
3397 	int coef78;
3398 
3399 	alc282_restore_default_value(codec);
3400 
3401 	if (!hp_pin)
3402 		return;
3403 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3404 	coef78 = alc_read_coef_idx(codec, 0x78);
3405 
3406 	/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3407 	/* Headphone capless set to high power mode */
3408 	alc_write_coef_idx(codec, 0x78, 0x9004);
3409 
3410 	if (hp_pin_sense)
3411 		msleep(2);
3412 
3413 	snd_hda_codec_write(codec, hp_pin, 0,
3414 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3415 
3416 	if (hp_pin_sense)
3417 		msleep(85);
3418 
3419 	snd_hda_codec_write(codec, hp_pin, 0,
3420 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3421 
3422 	if (hp_pin_sense)
3423 		msleep(100);
3424 
3425 	/* Headphone capless set to normal mode */
3426 	alc_write_coef_idx(codec, 0x78, coef78);
3427 }
3428 
3429 static void alc282_shutup(struct hda_codec *codec)
3430 {
3431 	struct alc_spec *spec = codec->spec;
3432 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3433 	bool hp_pin_sense;
3434 	int coef78;
3435 
3436 	if (!hp_pin) {
3437 		alc269_shutup(codec);
3438 		return;
3439 	}
3440 
3441 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3442 	coef78 = alc_read_coef_idx(codec, 0x78);
3443 	alc_write_coef_idx(codec, 0x78, 0x9004);
3444 
3445 	if (hp_pin_sense)
3446 		msleep(2);
3447 
3448 	snd_hda_codec_write(codec, hp_pin, 0,
3449 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3450 
3451 	if (hp_pin_sense)
3452 		msleep(85);
3453 
3454 	if (!spec->no_shutup_pins)
3455 		snd_hda_codec_write(codec, hp_pin, 0,
3456 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3457 
3458 	if (hp_pin_sense)
3459 		msleep(100);
3460 
3461 	alc_auto_setup_eapd(codec, false);
3462 	alc_shutup_pins(codec);
3463 	alc_write_coef_idx(codec, 0x78, coef78);
3464 }
3465 
3466 static const struct coef_fw alc283_coefs[] = {
3467 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3468 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3469 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3470 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3471 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3472 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3473 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3474 	WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3475 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3476 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3477 	WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3478 	UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3479 	WRITE_COEF(0x22, 0xa0c0), /* ANC */
3480 	UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3481 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3482 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3483 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3484 	WRITE_COEF(0x2e, 0x2902), /* PLL */
3485 	WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3486 	WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3487 	WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3488 	WRITE_COEF(0x36, 0x0), /* capless control 5 */
3489 	UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3490 	WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3491 	UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3492 	WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3493 	WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3494 	UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3495 	WRITE_COEF(0x49, 0x0), /* test mode */
3496 	UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3497 	UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3498 	WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3499 	UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3500 	{}
3501 };
3502 
3503 static void alc283_restore_default_value(struct hda_codec *codec)
3504 {
3505 	alc_process_coef_fw(codec, alc283_coefs);
3506 }
3507 
3508 static void alc283_init(struct hda_codec *codec)
3509 {
3510 	struct alc_spec *spec = codec->spec;
3511 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3512 	bool hp_pin_sense;
3513 
3514 	alc283_restore_default_value(codec);
3515 
3516 	if (!hp_pin)
3517 		return;
3518 
3519 	msleep(30);
3520 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3521 
3522 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3523 	/* Headphone capless set to high power mode */
3524 	alc_write_coef_idx(codec, 0x43, 0x9004);
3525 
3526 	snd_hda_codec_write(codec, hp_pin, 0,
3527 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3528 
3529 	if (hp_pin_sense)
3530 		msleep(85);
3531 
3532 	snd_hda_codec_write(codec, hp_pin, 0,
3533 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3534 
3535 	if (hp_pin_sense)
3536 		msleep(85);
3537 	/* Index 0x46 Combo jack auto switch control 2 */
3538 	/* 3k pull low control for Headset jack. */
3539 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3540 	/* Headphone capless set to normal mode */
3541 	alc_write_coef_idx(codec, 0x43, 0x9614);
3542 }
3543 
3544 static void alc283_shutup(struct hda_codec *codec)
3545 {
3546 	struct alc_spec *spec = codec->spec;
3547 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3548 	bool hp_pin_sense;
3549 
3550 	if (!hp_pin) {
3551 		alc269_shutup(codec);
3552 		return;
3553 	}
3554 
3555 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3556 
3557 	alc_write_coef_idx(codec, 0x43, 0x9004);
3558 
3559 	/*depop hp during suspend*/
3560 	alc_write_coef_idx(codec, 0x06, 0x2100);
3561 
3562 	snd_hda_codec_write(codec, hp_pin, 0,
3563 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3564 
3565 	if (hp_pin_sense)
3566 		msleep(100);
3567 
3568 	if (!spec->no_shutup_pins)
3569 		snd_hda_codec_write(codec, hp_pin, 0,
3570 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3571 
3572 	alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3573 
3574 	if (hp_pin_sense)
3575 		msleep(100);
3576 	alc_auto_setup_eapd(codec, false);
3577 	alc_shutup_pins(codec);
3578 	alc_write_coef_idx(codec, 0x43, 0x9614);
3579 }
3580 
3581 static void alc256_init(struct hda_codec *codec)
3582 {
3583 	struct alc_spec *spec = codec->spec;
3584 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3585 	bool hp_pin_sense;
3586 
3587 	if (spec->ultra_low_power) {
3588 		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3589 		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3590 		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3591 		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3592 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3593 		msleep(30);
3594 	}
3595 
3596 	if (!hp_pin)
3597 		hp_pin = 0x21;
3598 
3599 	msleep(30);
3600 
3601 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3602 
3603 	if (hp_pin_sense)
3604 		msleep(2);
3605 
3606 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3607 
3608 	snd_hda_codec_write(codec, hp_pin, 0,
3609 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3610 
3611 	if (hp_pin_sense || spec->ultra_low_power)
3612 		msleep(85);
3613 
3614 	snd_hda_codec_write(codec, hp_pin, 0,
3615 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3616 
3617 	if (hp_pin_sense || spec->ultra_low_power)
3618 		msleep(100);
3619 
3620 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3621 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3622 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3623 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3624 	/*
3625 	 * Expose headphone mic (or possibly Line In on some machines) instead
3626 	 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3627 	 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3628 	 * this register.
3629 	 */
3630 	alc_write_coef_idx(codec, 0x36, 0x5757);
3631 }
3632 
3633 static void alc256_shutup(struct hda_codec *codec)
3634 {
3635 	struct alc_spec *spec = codec->spec;
3636 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3637 	bool hp_pin_sense;
3638 
3639 	if (!hp_pin)
3640 		hp_pin = 0x21;
3641 
3642 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3643 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3644 
3645 	if (hp_pin_sense)
3646 		msleep(2);
3647 
3648 	snd_hda_codec_write(codec, hp_pin, 0,
3649 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3650 
3651 	if (hp_pin_sense || spec->ultra_low_power)
3652 		msleep(85);
3653 
3654 	/* 3k pull low control for Headset jack. */
3655 	/* NOTE: call this before clearing the pin, otherwise codec stalls */
3656 	/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3657 	 * when booting with headset plugged. So skip setting it for the codec alc257
3658 	 */
3659 	if (spec->en_3kpull_low)
3660 		alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3661 
3662 	if (!spec->no_shutup_pins)
3663 		snd_hda_codec_write(codec, hp_pin, 0,
3664 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3665 
3666 	if (hp_pin_sense || spec->ultra_low_power)
3667 		msleep(100);
3668 
3669 	alc_auto_setup_eapd(codec, false);
3670 	alc_shutup_pins(codec);
3671 	if (spec->ultra_low_power) {
3672 		msleep(50);
3673 		alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3674 		alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3675 		alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3676 		alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3677 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3678 		msleep(30);
3679 	}
3680 }
3681 
3682 static void alc285_hp_init(struct hda_codec *codec)
3683 {
3684 	struct alc_spec *spec = codec->spec;
3685 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3686 	int i, val;
3687 	int coef38, coef0d, coef36;
3688 
3689 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3690 	alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3691 	coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3692 	coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3693 	coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3694 	alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3695 	alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3696 
3697 	alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3698 
3699 	if (hp_pin)
3700 		snd_hda_codec_write(codec, hp_pin, 0,
3701 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3702 
3703 	msleep(130);
3704 	alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3705 	alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3706 
3707 	if (hp_pin)
3708 		snd_hda_codec_write(codec, hp_pin, 0,
3709 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3710 	msleep(10);
3711 	alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3712 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3713 	alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3714 	alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3715 
3716 	alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3717 	val = alc_read_coefex_idx(codec, 0x58, 0x00);
3718 	for (i = 0; i < 20 && val & 0x8000; i++) {
3719 		msleep(50);
3720 		val = alc_read_coefex_idx(codec, 0x58, 0x00);
3721 	} /* Wait for depop procedure finish  */
3722 
3723 	alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3724 	alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3725 	alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3726 	alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3727 
3728 	msleep(50);
3729 	alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3730 }
3731 
3732 static void alc225_init(struct hda_codec *codec)
3733 {
3734 	struct alc_spec *spec = codec->spec;
3735 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3736 	bool hp1_pin_sense, hp2_pin_sense;
3737 
3738 	if (spec->ultra_low_power) {
3739 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3740 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3741 		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3742 		msleep(30);
3743 	}
3744 
3745 	if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3746 		spec->codec_variant != ALC269_TYPE_ALC245)
3747 		/* required only at boot or S3 and S4 resume time */
3748 		if (!spec->done_hp_init ||
3749 			is_s3_resume(codec) ||
3750 			is_s4_resume(codec)) {
3751 			alc285_hp_init(codec);
3752 			spec->done_hp_init = true;
3753 		}
3754 
3755 	if (!hp_pin)
3756 		hp_pin = 0x21;
3757 	msleep(30);
3758 
3759 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3760 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3761 
3762 	if (hp1_pin_sense || hp2_pin_sense)
3763 		msleep(2);
3764 
3765 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3766 
3767 	if (hp1_pin_sense || spec->ultra_low_power)
3768 		snd_hda_codec_write(codec, hp_pin, 0,
3769 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3770 	if (hp2_pin_sense)
3771 		snd_hda_codec_write(codec, 0x16, 0,
3772 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3773 
3774 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3775 		msleep(85);
3776 
3777 	if (hp1_pin_sense || spec->ultra_low_power)
3778 		snd_hda_codec_write(codec, hp_pin, 0,
3779 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3780 	if (hp2_pin_sense)
3781 		snd_hda_codec_write(codec, 0x16, 0,
3782 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3783 
3784 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3785 		msleep(100);
3786 
3787 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3788 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3789 }
3790 
3791 static void alc225_shutup(struct hda_codec *codec)
3792 {
3793 	struct alc_spec *spec = codec->spec;
3794 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3795 	bool hp1_pin_sense, hp2_pin_sense;
3796 
3797 	if (!hp_pin)
3798 		hp_pin = 0x21;
3799 
3800 	alc_disable_headset_jack_key(codec);
3801 	/* 3k pull low control for Headset jack. */
3802 	alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3803 
3804 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3805 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3806 
3807 	if (hp1_pin_sense || hp2_pin_sense)
3808 		msleep(2);
3809 
3810 	if (hp1_pin_sense || spec->ultra_low_power)
3811 		snd_hda_codec_write(codec, hp_pin, 0,
3812 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3813 	if (hp2_pin_sense)
3814 		snd_hda_codec_write(codec, 0x16, 0,
3815 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3816 
3817 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3818 		msleep(85);
3819 
3820 	if (hp1_pin_sense || spec->ultra_low_power)
3821 		snd_hda_codec_write(codec, hp_pin, 0,
3822 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3823 	if (hp2_pin_sense)
3824 		snd_hda_codec_write(codec, 0x16, 0,
3825 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3826 
3827 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3828 		msleep(100);
3829 
3830 	alc_auto_setup_eapd(codec, false);
3831 	alc_shutup_pins(codec);
3832 	if (spec->ultra_low_power) {
3833 		msleep(50);
3834 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3835 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3836 		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3837 		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3838 		msleep(30);
3839 	}
3840 
3841 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3842 	alc_enable_headset_jack_key(codec);
3843 }
3844 
3845 static void alc_default_init(struct hda_codec *codec)
3846 {
3847 	struct alc_spec *spec = codec->spec;
3848 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3849 	bool hp_pin_sense;
3850 
3851 	if (!hp_pin)
3852 		return;
3853 
3854 	msleep(30);
3855 
3856 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3857 
3858 	if (hp_pin_sense)
3859 		msleep(2);
3860 
3861 	snd_hda_codec_write(codec, hp_pin, 0,
3862 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3863 
3864 	if (hp_pin_sense)
3865 		msleep(85);
3866 
3867 	snd_hda_codec_write(codec, hp_pin, 0,
3868 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3869 
3870 	if (hp_pin_sense)
3871 		msleep(100);
3872 }
3873 
3874 static void alc_default_shutup(struct hda_codec *codec)
3875 {
3876 	struct alc_spec *spec = codec->spec;
3877 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3878 	bool hp_pin_sense;
3879 
3880 	if (!hp_pin) {
3881 		alc269_shutup(codec);
3882 		return;
3883 	}
3884 
3885 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3886 
3887 	if (hp_pin_sense)
3888 		msleep(2);
3889 
3890 	snd_hda_codec_write(codec, hp_pin, 0,
3891 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3892 
3893 	if (hp_pin_sense)
3894 		msleep(85);
3895 
3896 	if (!spec->no_shutup_pins)
3897 		snd_hda_codec_write(codec, hp_pin, 0,
3898 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3899 
3900 	if (hp_pin_sense)
3901 		msleep(100);
3902 
3903 	alc_auto_setup_eapd(codec, false);
3904 	alc_shutup_pins(codec);
3905 }
3906 
3907 static void alc294_hp_init(struct hda_codec *codec)
3908 {
3909 	struct alc_spec *spec = codec->spec;
3910 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3911 	int i, val;
3912 
3913 	if (!hp_pin)
3914 		return;
3915 
3916 	snd_hda_codec_write(codec, hp_pin, 0,
3917 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3918 
3919 	msleep(100);
3920 
3921 	if (!spec->no_shutup_pins)
3922 		snd_hda_codec_write(codec, hp_pin, 0,
3923 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3924 
3925 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3926 	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3927 
3928 	/* Wait for depop procedure finish  */
3929 	val = alc_read_coefex_idx(codec, 0x58, 0x01);
3930 	for (i = 0; i < 20 && val & 0x0080; i++) {
3931 		msleep(50);
3932 		val = alc_read_coefex_idx(codec, 0x58, 0x01);
3933 	}
3934 	/* Set HP depop to auto mode */
3935 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3936 	msleep(50);
3937 }
3938 
3939 static void alc294_init(struct hda_codec *codec)
3940 {
3941 	struct alc_spec *spec = codec->spec;
3942 
3943 	/* required only at boot or S4 resume time */
3944 	if (!spec->done_hp_init ||
3945 	    codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3946 		alc294_hp_init(codec);
3947 		spec->done_hp_init = true;
3948 	}
3949 	alc_default_init(codec);
3950 }
3951 
3952 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3953 			     unsigned int val)
3954 {
3955 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3956 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3957 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3958 }
3959 
3960 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3961 {
3962 	unsigned int val;
3963 
3964 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3965 	val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3966 		& 0xffff;
3967 	val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3968 		<< 16;
3969 	return val;
3970 }
3971 
3972 static void alc5505_dsp_halt(struct hda_codec *codec)
3973 {
3974 	unsigned int val;
3975 
3976 	alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3977 	alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3978 	alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3979 	alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3980 	alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3981 	alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3982 	alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3983 	val = alc5505_coef_get(codec, 0x6220);
3984 	alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3985 }
3986 
3987 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3988 {
3989 	alc5505_coef_set(codec, 0x61b8, 0x04133302);
3990 	alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3991 	alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3992 	alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3993 	alc5505_coef_set(codec, 0x6220, 0x2002010f);
3994 	alc5505_coef_set(codec, 0x880c, 0x00000004);
3995 }
3996 
3997 static void alc5505_dsp_init(struct hda_codec *codec)
3998 {
3999 	unsigned int val;
4000 
4001 	alc5505_dsp_halt(codec);
4002 	alc5505_dsp_back_from_halt(codec);
4003 	alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
4004 	alc5505_coef_set(codec, 0x61b0, 0x5b16);
4005 	alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
4006 	alc5505_coef_set(codec, 0x61b4, 0x04132b02);
4007 	alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
4008 	alc5505_coef_set(codec, 0x61b8, 0x041f3302);
4009 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
4010 	alc5505_coef_set(codec, 0x61b8, 0x041b3302);
4011 	alc5505_coef_set(codec, 0x61b8, 0x04173302);
4012 	alc5505_coef_set(codec, 0x61b8, 0x04163302);
4013 	alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4014 	alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4015 	alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4016 
4017 	val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4018 	if (val <= 3)
4019 		alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4020 	else
4021 		alc5505_coef_set(codec, 0x6220, 0x6002018f);
4022 
4023 	alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4024 	alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4025 	alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4026 	alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4027 	alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4028 	alc5505_coef_set(codec, 0x880c, 0x00000003);
4029 	alc5505_coef_set(codec, 0x880c, 0x00000010);
4030 
4031 #ifdef HALT_REALTEK_ALC5505
4032 	alc5505_dsp_halt(codec);
4033 #endif
4034 }
4035 
4036 #ifdef HALT_REALTEK_ALC5505
4037 #define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
4038 #define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
4039 #else
4040 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
4041 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
4042 #endif
4043 
4044 #ifdef CONFIG_PM
4045 static int alc269_suspend(struct hda_codec *codec)
4046 {
4047 	struct alc_spec *spec = codec->spec;
4048 
4049 	if (spec->has_alc5505_dsp)
4050 		alc5505_dsp_suspend(codec);
4051 
4052 	return alc_suspend(codec);
4053 }
4054 
4055 static int alc269_resume(struct hda_codec *codec)
4056 {
4057 	struct alc_spec *spec = codec->spec;
4058 
4059 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4060 		alc269vb_toggle_power_output(codec, 0);
4061 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4062 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
4063 		msleep(150);
4064 	}
4065 
4066 	codec->patch_ops.init(codec);
4067 
4068 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4069 		alc269vb_toggle_power_output(codec, 1);
4070 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4071 			(alc_get_coef0(codec) & 0x00ff) == 0x017) {
4072 		msleep(200);
4073 	}
4074 
4075 	snd_hda_regmap_sync(codec);
4076 	hda_call_check_power_status(codec, 0x01);
4077 
4078 	/* on some machine, the BIOS will clear the codec gpio data when enter
4079 	 * suspend, and won't restore the data after resume, so we restore it
4080 	 * in the driver.
4081 	 */
4082 	if (spec->gpio_data)
4083 		alc_write_gpio_data(codec);
4084 
4085 	if (spec->has_alc5505_dsp)
4086 		alc5505_dsp_resume(codec);
4087 
4088 	return 0;
4089 }
4090 #endif /* CONFIG_PM */
4091 
4092 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4093 						 const struct hda_fixup *fix, int action)
4094 {
4095 	struct alc_spec *spec = codec->spec;
4096 
4097 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4098 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4099 }
4100 
4101 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4102 						 const struct hda_fixup *fix,
4103 						 int action)
4104 {
4105 	unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4106 	unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4107 
4108 	if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4109 		snd_hda_codec_set_pincfg(codec, 0x19,
4110 			(cfg_headphone & ~AC_DEFCFG_DEVICE) |
4111 			(AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4112 }
4113 
4114 static void alc269_fixup_hweq(struct hda_codec *codec,
4115 			       const struct hda_fixup *fix, int action)
4116 {
4117 	if (action == HDA_FIXUP_ACT_INIT)
4118 		alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4119 }
4120 
4121 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4122 				       const struct hda_fixup *fix, int action)
4123 {
4124 	struct alc_spec *spec = codec->spec;
4125 
4126 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4127 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4128 }
4129 
4130 static void alc271_fixup_dmic(struct hda_codec *codec,
4131 			      const struct hda_fixup *fix, int action)
4132 {
4133 	static const struct hda_verb verbs[] = {
4134 		{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4135 		{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4136 		{}
4137 	};
4138 	unsigned int cfg;
4139 
4140 	if (strcmp(codec->core.chip_name, "ALC271X") &&
4141 	    strcmp(codec->core.chip_name, "ALC269VB"))
4142 		return;
4143 	cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4144 	if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4145 		snd_hda_sequence_write(codec, verbs);
4146 }
4147 
4148 /* Fix the speaker amp after resume, etc */
4149 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4150 					  const struct hda_fixup *fix,
4151 					  int action)
4152 {
4153 	if (action == HDA_FIXUP_ACT_INIT)
4154 		alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4155 }
4156 
4157 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4158 				 const struct hda_fixup *fix, int action)
4159 {
4160 	struct alc_spec *spec = codec->spec;
4161 
4162 	if (action != HDA_FIXUP_ACT_PROBE)
4163 		return;
4164 
4165 	/* Due to a hardware problem on Lenovo Ideadpad, we need to
4166 	 * fix the sample rate of analog I/O to 44.1kHz
4167 	 */
4168 	spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4169 	spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4170 }
4171 
4172 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4173 				     const struct hda_fixup *fix, int action)
4174 {
4175 	/* The digital-mic unit sends PDM (differential signal) instead of
4176 	 * the standard PCM, thus you can't record a valid mono stream as is.
4177 	 * Below is a workaround specific to ALC269 to control the dmic
4178 	 * signal source as mono.
4179 	 */
4180 	if (action == HDA_FIXUP_ACT_INIT)
4181 		alc_update_coef_idx(codec, 0x07, 0, 0x80);
4182 }
4183 
4184 static void alc269_quanta_automute(struct hda_codec *codec)
4185 {
4186 	snd_hda_gen_update_outputs(codec);
4187 
4188 	alc_write_coef_idx(codec, 0x0c, 0x680);
4189 	alc_write_coef_idx(codec, 0x0c, 0x480);
4190 }
4191 
4192 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4193 				     const struct hda_fixup *fix, int action)
4194 {
4195 	struct alc_spec *spec = codec->spec;
4196 	if (action != HDA_FIXUP_ACT_PROBE)
4197 		return;
4198 	spec->gen.automute_hook = alc269_quanta_automute;
4199 }
4200 
4201 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4202 					 struct hda_jack_callback *jack)
4203 {
4204 	struct alc_spec *spec = codec->spec;
4205 	int vref;
4206 	msleep(200);
4207 	snd_hda_gen_hp_automute(codec, jack);
4208 
4209 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4210 	msleep(100);
4211 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4212 			    vref);
4213 	msleep(500);
4214 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4215 			    vref);
4216 }
4217 
4218 /*
4219  * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4220  */
4221 struct hda_alc298_mbxinit {
4222 	unsigned char value_0x23;
4223 	unsigned char value_0x25;
4224 };
4225 
4226 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4227 					 const struct hda_alc298_mbxinit *initval,
4228 					 bool first)
4229 {
4230 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4231 	alc_write_coef_idx(codec, 0x26, 0xb000);
4232 
4233 	if (first)
4234 		snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4235 
4236 	snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4237 	alc_write_coef_idx(codec, 0x26, 0xf000);
4238 	alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4239 
4240 	if (initval->value_0x23 != 0x1e)
4241 		alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4242 
4243 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4244 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4245 }
4246 
4247 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4248 					   const struct hda_fixup *fix,
4249 					   int action)
4250 {
4251 	/* Initialization magic */
4252 	static const struct hda_alc298_mbxinit dac_init[] = {
4253 		{0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4254 		{0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4255 		{0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4256 		{0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4257 		{0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4258 		{0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4259 		{0x2f, 0x00},
4260 		{0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4261 		{0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4262 		{0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4263 		{}
4264 	};
4265 	const struct hda_alc298_mbxinit *seq;
4266 
4267 	if (action != HDA_FIXUP_ACT_INIT)
4268 		return;
4269 
4270 	/* Start */
4271 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4272 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4273 	alc_write_coef_idx(codec, 0x26, 0xf000);
4274 	alc_write_coef_idx(codec, 0x22, 0x31);
4275 	alc_write_coef_idx(codec, 0x23, 0x0b);
4276 	alc_write_coef_idx(codec, 0x25, 0x00);
4277 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4278 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4279 
4280 	for (seq = dac_init; seq->value_0x23; seq++)
4281 		alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4282 }
4283 
4284 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4285 				     const struct hda_fixup *fix, int action)
4286 {
4287 	struct alc_spec *spec = codec->spec;
4288 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4289 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4290 		spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4291 	}
4292 }
4293 
4294 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4295 				bool polarity, bool on)
4296 {
4297 	unsigned int pinval;
4298 
4299 	if (!pin)
4300 		return;
4301 	if (polarity)
4302 		on = !on;
4303 	pinval = snd_hda_codec_get_pin_target(codec, pin);
4304 	pinval &= ~AC_PINCTL_VREFEN;
4305 	pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4306 	/* temporarily power up/down for setting VREF */
4307 	snd_hda_power_up_pm(codec);
4308 	snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4309 	snd_hda_power_down_pm(codec);
4310 }
4311 
4312 /* update mute-LED according to the speaker mute state via mic VREF pin */
4313 static int vref_mute_led_set(struct led_classdev *led_cdev,
4314 			     enum led_brightness brightness)
4315 {
4316 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4317 	struct alc_spec *spec = codec->spec;
4318 
4319 	alc_update_vref_led(codec, spec->mute_led_nid,
4320 			    spec->mute_led_polarity, brightness);
4321 	return 0;
4322 }
4323 
4324 /* Make sure the led works even in runtime suspend */
4325 static unsigned int led_power_filter(struct hda_codec *codec,
4326 						  hda_nid_t nid,
4327 						  unsigned int power_state)
4328 {
4329 	struct alc_spec *spec = codec->spec;
4330 
4331 	if (power_state != AC_PWRST_D3 || nid == 0 ||
4332 	    (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4333 		return power_state;
4334 
4335 	/* Set pin ctl again, it might have just been set to 0 */
4336 	snd_hda_set_pin_ctl(codec, nid,
4337 			    snd_hda_codec_get_pin_target(codec, nid));
4338 
4339 	return snd_hda_gen_path_power_filter(codec, nid, power_state);
4340 }
4341 
4342 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4343 				     const struct hda_fixup *fix, int action)
4344 {
4345 	struct alc_spec *spec = codec->spec;
4346 	const struct dmi_device *dev = NULL;
4347 
4348 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4349 		return;
4350 
4351 	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4352 		int pol, pin;
4353 		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4354 			continue;
4355 		if (pin < 0x0a || pin >= 0x10)
4356 			break;
4357 		spec->mute_led_polarity = pol;
4358 		spec->mute_led_nid = pin - 0x0a + 0x18;
4359 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4360 		codec->power_filter = led_power_filter;
4361 		codec_dbg(codec,
4362 			  "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4363 			   spec->mute_led_polarity);
4364 		break;
4365 	}
4366 }
4367 
4368 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4369 					  const struct hda_fixup *fix,
4370 					  int action, hda_nid_t pin)
4371 {
4372 	struct alc_spec *spec = codec->spec;
4373 
4374 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4375 		spec->mute_led_polarity = 0;
4376 		spec->mute_led_nid = pin;
4377 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4378 		codec->power_filter = led_power_filter;
4379 	}
4380 }
4381 
4382 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4383 				const struct hda_fixup *fix, int action)
4384 {
4385 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4386 }
4387 
4388 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4389 				const struct hda_fixup *fix, int action)
4390 {
4391 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4392 }
4393 
4394 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4395 				const struct hda_fixup *fix, int action)
4396 {
4397 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4398 }
4399 
4400 /* update LED status via GPIO */
4401 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4402 				int polarity, bool enabled)
4403 {
4404 	if (polarity)
4405 		enabled = !enabled;
4406 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4407 }
4408 
4409 /* turn on/off mute LED via GPIO per vmaster hook */
4410 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4411 			     enum led_brightness brightness)
4412 {
4413 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4414 	struct alc_spec *spec = codec->spec;
4415 
4416 	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4417 			    spec->mute_led_polarity, !brightness);
4418 	return 0;
4419 }
4420 
4421 /* turn on/off mic-mute LED via GPIO per capture hook */
4422 static int micmute_led_set(struct led_classdev *led_cdev,
4423 			   enum led_brightness brightness)
4424 {
4425 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4426 	struct alc_spec *spec = codec->spec;
4427 
4428 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4429 			    spec->micmute_led_polarity, !brightness);
4430 	return 0;
4431 }
4432 
4433 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
4434 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4435 				  int action,
4436 				  unsigned int mute_mask,
4437 				  unsigned int micmute_mask)
4438 {
4439 	struct alc_spec *spec = codec->spec;
4440 
4441 	alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4442 
4443 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4444 		return;
4445 	if (mute_mask) {
4446 		spec->gpio_mute_led_mask = mute_mask;
4447 		snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4448 	}
4449 	if (micmute_mask) {
4450 		spec->gpio_mic_led_mask = micmute_mask;
4451 		snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4452 	}
4453 }
4454 
4455 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4456 				const struct hda_fixup *fix, int action)
4457 {
4458 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4459 }
4460 
4461 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4462 				const struct hda_fixup *fix, int action)
4463 {
4464 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4465 }
4466 
4467 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4468 				const struct hda_fixup *fix, int action)
4469 {
4470 	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4471 }
4472 
4473 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4474 				const struct hda_fixup *fix, int action)
4475 {
4476 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4477 }
4478 
4479 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4480 				const struct hda_fixup *fix, int action)
4481 {
4482 	alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4483 }
4484 
4485 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4486 				const struct hda_fixup *fix, int action)
4487 {
4488 	struct alc_spec *spec = codec->spec;
4489 
4490 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4491 		spec->micmute_led_polarity = 1;
4492 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4493 }
4494 
4495 /* turn on/off mic-mute LED per capture hook via VREF change */
4496 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4497 				enum led_brightness brightness)
4498 {
4499 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4500 	struct alc_spec *spec = codec->spec;
4501 
4502 	alc_update_vref_led(codec, spec->cap_mute_led_nid,
4503 			    spec->micmute_led_polarity, brightness);
4504 	return 0;
4505 }
4506 
4507 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4508 				const struct hda_fixup *fix, int action)
4509 {
4510 	struct alc_spec *spec = codec->spec;
4511 
4512 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4513 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4514 		/* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4515 		 * enable headphone amp
4516 		 */
4517 		spec->gpio_mask |= 0x10;
4518 		spec->gpio_dir |= 0x10;
4519 		spec->cap_mute_led_nid = 0x18;
4520 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4521 		codec->power_filter = led_power_filter;
4522 	}
4523 }
4524 
4525 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4526 				   const struct hda_fixup *fix, int action)
4527 {
4528 	struct alc_spec *spec = codec->spec;
4529 
4530 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4531 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4532 		spec->cap_mute_led_nid = 0x18;
4533 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4534 		codec->power_filter = led_power_filter;
4535 	}
4536 }
4537 
4538 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4539  * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4540  */
4541 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4542 				     const struct hda_fixup *fix, int action)
4543 {
4544 	struct alc_spec *spec = codec->spec;
4545 
4546 	switch (action) {
4547 	case HDA_FIXUP_ACT_PRE_PROBE:
4548 		spec->gpio_mask |= 0x01;
4549 		spec->gpio_dir |= 0x01;
4550 		break;
4551 	case HDA_FIXUP_ACT_INIT:
4552 		/* need to toggle GPIO to enable the amp */
4553 		alc_update_gpio_data(codec, 0x01, true);
4554 		msleep(100);
4555 		alc_update_gpio_data(codec, 0x01, false);
4556 		break;
4557 	}
4558 }
4559 
4560 /* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4561 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4562 				    struct hda_codec *codec,
4563 				    struct snd_pcm_substream *substream,
4564 				    int action)
4565 {
4566 	switch (action) {
4567 	case HDA_GEN_PCM_ACT_PREPARE:
4568 		alc_update_gpio_data(codec, 0x04, true);
4569 		break;
4570 	case HDA_GEN_PCM_ACT_CLEANUP:
4571 		alc_update_gpio_data(codec, 0x04, false);
4572 		break;
4573 	}
4574 }
4575 
4576 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4577 				      const struct hda_fixup *fix,
4578 				      int action)
4579 {
4580 	struct alc_spec *spec = codec->spec;
4581 
4582 	if (action == HDA_FIXUP_ACT_PROBE) {
4583 		spec->gpio_mask |= 0x04;
4584 		spec->gpio_dir |= 0x04;
4585 		spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4586 	}
4587 }
4588 
4589 static void alc_update_coef_led(struct hda_codec *codec,
4590 				struct alc_coef_led *led,
4591 				bool polarity, bool on)
4592 {
4593 	if (polarity)
4594 		on = !on;
4595 	/* temporarily power up/down for setting COEF bit */
4596 	alc_update_coef_idx(codec, led->idx, led->mask,
4597 			    on ? led->on : led->off);
4598 }
4599 
4600 /* update mute-LED according to the speaker mute state via COEF bit */
4601 static int coef_mute_led_set(struct led_classdev *led_cdev,
4602 			     enum led_brightness brightness)
4603 {
4604 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4605 	struct alc_spec *spec = codec->spec;
4606 
4607 	alc_update_coef_led(codec, &spec->mute_led_coef,
4608 			    spec->mute_led_polarity, brightness);
4609 	return 0;
4610 }
4611 
4612 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4613 					  const struct hda_fixup *fix,
4614 					  int action)
4615 {
4616 	struct alc_spec *spec = codec->spec;
4617 
4618 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4619 		spec->mute_led_polarity = 0;
4620 		spec->mute_led_coef.idx = 0x0b;
4621 		spec->mute_led_coef.mask = 1 << 3;
4622 		spec->mute_led_coef.on = 1 << 3;
4623 		spec->mute_led_coef.off = 0;
4624 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4625 	}
4626 }
4627 
4628 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4629 					  const struct hda_fixup *fix,
4630 					  int action)
4631 {
4632 	struct alc_spec *spec = codec->spec;
4633 
4634 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4635 		spec->mute_led_polarity = 0;
4636 		spec->mute_led_coef.idx = 0x34;
4637 		spec->mute_led_coef.mask = 1 << 5;
4638 		spec->mute_led_coef.on = 0;
4639 		spec->mute_led_coef.off = 1 << 5;
4640 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4641 	}
4642 }
4643 
4644 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4645 					  const struct hda_fixup *fix, int action)
4646 {
4647 	struct alc_spec *spec = codec->spec;
4648 
4649 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4650 		spec->mute_led_polarity = 0;
4651 		spec->mute_led_coef.idx = 0x07;
4652 		spec->mute_led_coef.mask = 1;
4653 		spec->mute_led_coef.on = 1;
4654 		spec->mute_led_coef.off = 0;
4655 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4656 	}
4657 }
4658 
4659 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4660 					  const struct hda_fixup *fix,
4661 					  int action)
4662 {
4663 	struct alc_spec *spec = codec->spec;
4664 
4665 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4666 		spec->mute_led_polarity = 0;
4667 		spec->mute_led_coef.idx = 0x0b;
4668 		spec->mute_led_coef.mask = 3 << 2;
4669 		spec->mute_led_coef.on = 2 << 2;
4670 		spec->mute_led_coef.off = 1 << 2;
4671 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4672 	}
4673 }
4674 
4675 /* turn on/off mic-mute LED per capture hook by coef bit */
4676 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4677 				enum led_brightness brightness)
4678 {
4679 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4680 	struct alc_spec *spec = codec->spec;
4681 
4682 	alc_update_coef_led(codec, &spec->mic_led_coef,
4683 			    spec->micmute_led_polarity, brightness);
4684 	return 0;
4685 }
4686 
4687 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4688 				const struct hda_fixup *fix, int action)
4689 {
4690 	struct alc_spec *spec = codec->spec;
4691 
4692 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4693 		spec->mic_led_coef.idx = 0x19;
4694 		spec->mic_led_coef.mask = 1 << 13;
4695 		spec->mic_led_coef.on = 1 << 13;
4696 		spec->mic_led_coef.off = 0;
4697 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4698 	}
4699 }
4700 
4701 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4702 				const struct hda_fixup *fix, int action)
4703 {
4704 	struct alc_spec *spec = codec->spec;
4705 
4706 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4707 		spec->micmute_led_polarity = 1;
4708 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4709 }
4710 
4711 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4712 				const struct hda_fixup *fix, int action)
4713 {
4714 	struct alc_spec *spec = codec->spec;
4715 
4716 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4717 		spec->mic_led_coef.idx = 0x35;
4718 		spec->mic_led_coef.mask = 3 << 2;
4719 		spec->mic_led_coef.on = 2 << 2;
4720 		spec->mic_led_coef.off = 1 << 2;
4721 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4722 	}
4723 }
4724 
4725 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4726 				const struct hda_fixup *fix, int action)
4727 {
4728 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4729 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4730 }
4731 
4732 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4733 				const struct hda_fixup *fix, int action)
4734 {
4735 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4736 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4737 }
4738 
4739 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4740 				const struct hda_fixup *fix, int action)
4741 {
4742 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4743 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4744 }
4745 
4746 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4747 				const struct hda_fixup *fix, int action)
4748 {
4749 	struct alc_spec *spec = codec->spec;
4750 
4751 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4752 		spec->cap_mute_led_nid = 0x1a;
4753 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4754 		codec->power_filter = led_power_filter;
4755 	}
4756 }
4757 
4758 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4759 				const struct hda_fixup *fix, int action)
4760 {
4761 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4762 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4763 }
4764 
4765 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4766 						  const unsigned short coefs[2])
4767 {
4768 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4769 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4770 	alc_write_coef_idx(codec, 0x26, 0xb011);
4771 }
4772 
4773 struct alc298_samsung_amp_desc {
4774 	unsigned char nid;
4775 	unsigned short init_seq[2][2];
4776 };
4777 
4778 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4779 				     const struct hda_fixup *fix, int action)
4780 {
4781 	int i, j;
4782 	static const unsigned short init_seq[][2] = {
4783 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4784 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4785 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4786 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4787 	};
4788 	static const struct alc298_samsung_amp_desc amps[] = {
4789 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4790 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4791 	};
4792 
4793 	if (action != HDA_FIXUP_ACT_INIT)
4794 		return;
4795 
4796 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4797 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4798 
4799 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4800 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4801 
4802 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4803 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4804 	}
4805 }
4806 
4807 #if IS_REACHABLE(CONFIG_INPUT)
4808 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4809 				   struct hda_jack_callback *event)
4810 {
4811 	struct alc_spec *spec = codec->spec;
4812 
4813 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4814 	   send both key on and key off event for every interrupt. */
4815 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4816 	input_sync(spec->kb_dev);
4817 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4818 	input_sync(spec->kb_dev);
4819 }
4820 
4821 static int alc_register_micmute_input_device(struct hda_codec *codec)
4822 {
4823 	struct alc_spec *spec = codec->spec;
4824 	int i;
4825 
4826 	spec->kb_dev = input_allocate_device();
4827 	if (!spec->kb_dev) {
4828 		codec_err(codec, "Out of memory (input_allocate_device)\n");
4829 		return -ENOMEM;
4830 	}
4831 
4832 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4833 
4834 	spec->kb_dev->name = "Microphone Mute Button";
4835 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4836 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4837 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4838 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4839 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4840 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4841 
4842 	if (input_register_device(spec->kb_dev)) {
4843 		codec_err(codec, "input_register_device failed\n");
4844 		input_free_device(spec->kb_dev);
4845 		spec->kb_dev = NULL;
4846 		return -ENOMEM;
4847 	}
4848 
4849 	return 0;
4850 }
4851 
4852 /* GPIO1 = set according to SKU external amp
4853  * GPIO2 = mic mute hotkey
4854  * GPIO3 = mute LED
4855  * GPIO4 = mic mute LED
4856  */
4857 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4858 					     const struct hda_fixup *fix, int action)
4859 {
4860 	struct alc_spec *spec = codec->spec;
4861 
4862 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4863 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4864 		spec->init_amp = ALC_INIT_DEFAULT;
4865 		if (alc_register_micmute_input_device(codec) != 0)
4866 			return;
4867 
4868 		spec->gpio_mask |= 0x06;
4869 		spec->gpio_dir |= 0x02;
4870 		spec->gpio_data |= 0x02;
4871 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4872 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4873 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4874 						    gpio2_mic_hotkey_event);
4875 		return;
4876 	}
4877 
4878 	if (!spec->kb_dev)
4879 		return;
4880 
4881 	switch (action) {
4882 	case HDA_FIXUP_ACT_FREE:
4883 		input_unregister_device(spec->kb_dev);
4884 		spec->kb_dev = NULL;
4885 	}
4886 }
4887 
4888 /* Line2 = mic mute hotkey
4889  * GPIO2 = mic mute LED
4890  */
4891 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4892 					     const struct hda_fixup *fix, int action)
4893 {
4894 	struct alc_spec *spec = codec->spec;
4895 
4896 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4897 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4898 		spec->init_amp = ALC_INIT_DEFAULT;
4899 		if (alc_register_micmute_input_device(codec) != 0)
4900 			return;
4901 
4902 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
4903 						    gpio2_mic_hotkey_event);
4904 		return;
4905 	}
4906 
4907 	if (!spec->kb_dev)
4908 		return;
4909 
4910 	switch (action) {
4911 	case HDA_FIXUP_ACT_FREE:
4912 		input_unregister_device(spec->kb_dev);
4913 		spec->kb_dev = NULL;
4914 	}
4915 }
4916 #else /* INPUT */
4917 #define alc280_fixup_hp_gpio2_mic_hotkey	NULL
4918 #define alc233_fixup_lenovo_line2_mic_hotkey	NULL
4919 #endif /* INPUT */
4920 
4921 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4922 				const struct hda_fixup *fix, int action)
4923 {
4924 	struct alc_spec *spec = codec->spec;
4925 
4926 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4927 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4928 		spec->cap_mute_led_nid = 0x18;
4929 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4930 	}
4931 }
4932 
4933 static const struct coef_fw alc225_pre_hsmode[] = {
4934 	UPDATE_COEF(0x4a, 1<<8, 0),
4935 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4936 	UPDATE_COEF(0x63, 3<<14, 3<<14),
4937 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
4938 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
4939 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4940 	UPDATE_COEF(0x4a, 3<<10, 0),
4941 	{}
4942 };
4943 
4944 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4945 {
4946 	struct alc_spec *spec = codec->spec;
4947 	static const struct coef_fw coef0255[] = {
4948 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4949 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4950 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4951 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4952 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4953 		{}
4954 	};
4955 	static const struct coef_fw coef0256[] = {
4956 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4957 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4958 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4959 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4960 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4961 		{}
4962 	};
4963 	static const struct coef_fw coef0233[] = {
4964 		WRITE_COEF(0x1b, 0x0c0b),
4965 		WRITE_COEF(0x45, 0xc429),
4966 		UPDATE_COEF(0x35, 0x4000, 0),
4967 		WRITE_COEF(0x06, 0x2104),
4968 		WRITE_COEF(0x1a, 0x0001),
4969 		WRITE_COEF(0x26, 0x0004),
4970 		WRITE_COEF(0x32, 0x42a3),
4971 		{}
4972 	};
4973 	static const struct coef_fw coef0288[] = {
4974 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4975 		UPDATE_COEF(0x50, 0x2000, 0x2000),
4976 		UPDATE_COEF(0x56, 0x0006, 0x0006),
4977 		UPDATE_COEF(0x66, 0x0008, 0),
4978 		UPDATE_COEF(0x67, 0x2000, 0),
4979 		{}
4980 	};
4981 	static const struct coef_fw coef0298[] = {
4982 		UPDATE_COEF(0x19, 0x1300, 0x0300),
4983 		{}
4984 	};
4985 	static const struct coef_fw coef0292[] = {
4986 		WRITE_COEF(0x76, 0x000e),
4987 		WRITE_COEF(0x6c, 0x2400),
4988 		WRITE_COEF(0x18, 0x7308),
4989 		WRITE_COEF(0x6b, 0xc429),
4990 		{}
4991 	};
4992 	static const struct coef_fw coef0293[] = {
4993 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4994 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4995 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4996 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4997 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4998 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4999 		{}
5000 	};
5001 	static const struct coef_fw coef0668[] = {
5002 		WRITE_COEF(0x15, 0x0d40),
5003 		WRITE_COEF(0xb7, 0x802b),
5004 		{}
5005 	};
5006 	static const struct coef_fw coef0225[] = {
5007 		UPDATE_COEF(0x63, 3<<14, 0),
5008 		{}
5009 	};
5010 	static const struct coef_fw coef0274[] = {
5011 		UPDATE_COEF(0x4a, 0x0100, 0),
5012 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5013 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
5014 		UPDATE_COEF(0x4a, 0x0010, 0),
5015 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5016 		WRITE_COEF(0x45, 0x5289),
5017 		UPDATE_COEF(0x4a, 0x0c00, 0),
5018 		{}
5019 	};
5020 
5021 	if (spec->no_internal_mic_pin) {
5022 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5023 		return;
5024 	}
5025 
5026 	switch (codec->core.vendor_id) {
5027 	case 0x10ec0255:
5028 		alc_process_coef_fw(codec, coef0255);
5029 		break;
5030 	case 0x10ec0230:
5031 	case 0x10ec0236:
5032 	case 0x10ec0256:
5033 	case 0x19e58326:
5034 		alc_process_coef_fw(codec, coef0256);
5035 		break;
5036 	case 0x10ec0234:
5037 	case 0x10ec0274:
5038 	case 0x10ec0294:
5039 		alc_process_coef_fw(codec, coef0274);
5040 		break;
5041 	case 0x10ec0233:
5042 	case 0x10ec0283:
5043 		alc_process_coef_fw(codec, coef0233);
5044 		break;
5045 	case 0x10ec0286:
5046 	case 0x10ec0288:
5047 		alc_process_coef_fw(codec, coef0288);
5048 		break;
5049 	case 0x10ec0298:
5050 		alc_process_coef_fw(codec, coef0298);
5051 		alc_process_coef_fw(codec, coef0288);
5052 		break;
5053 	case 0x10ec0292:
5054 		alc_process_coef_fw(codec, coef0292);
5055 		break;
5056 	case 0x10ec0293:
5057 		alc_process_coef_fw(codec, coef0293);
5058 		break;
5059 	case 0x10ec0668:
5060 		alc_process_coef_fw(codec, coef0668);
5061 		break;
5062 	case 0x10ec0215:
5063 	case 0x10ec0225:
5064 	case 0x10ec0285:
5065 	case 0x10ec0295:
5066 	case 0x10ec0289:
5067 	case 0x10ec0299:
5068 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5069 		alc_process_coef_fw(codec, coef0225);
5070 		break;
5071 	case 0x10ec0867:
5072 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5073 		break;
5074 	}
5075 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5076 }
5077 
5078 
5079 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5080 				    hda_nid_t mic_pin)
5081 {
5082 	static const struct coef_fw coef0255[] = {
5083 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5084 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5085 		{}
5086 	};
5087 	static const struct coef_fw coef0256[] = {
5088 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5089 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5090 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5091 		{}
5092 	};
5093 	static const struct coef_fw coef0233[] = {
5094 		UPDATE_COEF(0x35, 0, 1<<14),
5095 		WRITE_COEF(0x06, 0x2100),
5096 		WRITE_COEF(0x1a, 0x0021),
5097 		WRITE_COEF(0x26, 0x008c),
5098 		{}
5099 	};
5100 	static const struct coef_fw coef0288[] = {
5101 		UPDATE_COEF(0x4f, 0x00c0, 0),
5102 		UPDATE_COEF(0x50, 0x2000, 0),
5103 		UPDATE_COEF(0x56, 0x0006, 0),
5104 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5105 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5106 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5107 		{}
5108 	};
5109 	static const struct coef_fw coef0292[] = {
5110 		WRITE_COEF(0x19, 0xa208),
5111 		WRITE_COEF(0x2e, 0xacf0),
5112 		{}
5113 	};
5114 	static const struct coef_fw coef0293[] = {
5115 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5116 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5117 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5118 		{}
5119 	};
5120 	static const struct coef_fw coef0688[] = {
5121 		WRITE_COEF(0xb7, 0x802b),
5122 		WRITE_COEF(0xb5, 0x1040),
5123 		UPDATE_COEF(0xc3, 0, 1<<12),
5124 		{}
5125 	};
5126 	static const struct coef_fw coef0225[] = {
5127 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5128 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5129 		UPDATE_COEF(0x63, 3<<14, 0),
5130 		{}
5131 	};
5132 	static const struct coef_fw coef0274[] = {
5133 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5134 		UPDATE_COEF(0x4a, 0x0010, 0),
5135 		UPDATE_COEF(0x6b, 0xf000, 0),
5136 		{}
5137 	};
5138 
5139 	switch (codec->core.vendor_id) {
5140 	case 0x10ec0255:
5141 		alc_write_coef_idx(codec, 0x45, 0xc489);
5142 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5143 		alc_process_coef_fw(codec, coef0255);
5144 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5145 		break;
5146 	case 0x10ec0230:
5147 	case 0x10ec0236:
5148 	case 0x10ec0256:
5149 	case 0x19e58326:
5150 		alc_write_coef_idx(codec, 0x45, 0xc489);
5151 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5152 		alc_process_coef_fw(codec, coef0256);
5153 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5154 		break;
5155 	case 0x10ec0234:
5156 	case 0x10ec0274:
5157 	case 0x10ec0294:
5158 		alc_write_coef_idx(codec, 0x45, 0x4689);
5159 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5160 		alc_process_coef_fw(codec, coef0274);
5161 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5162 		break;
5163 	case 0x10ec0233:
5164 	case 0x10ec0283:
5165 		alc_write_coef_idx(codec, 0x45, 0xc429);
5166 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5167 		alc_process_coef_fw(codec, coef0233);
5168 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5169 		break;
5170 	case 0x10ec0286:
5171 	case 0x10ec0288:
5172 	case 0x10ec0298:
5173 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5174 		alc_process_coef_fw(codec, coef0288);
5175 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5176 		break;
5177 	case 0x10ec0292:
5178 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5179 		alc_process_coef_fw(codec, coef0292);
5180 		break;
5181 	case 0x10ec0293:
5182 		/* Set to TRS mode */
5183 		alc_write_coef_idx(codec, 0x45, 0xc429);
5184 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5185 		alc_process_coef_fw(codec, coef0293);
5186 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5187 		break;
5188 	case 0x10ec0867:
5189 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5190 		fallthrough;
5191 	case 0x10ec0221:
5192 	case 0x10ec0662:
5193 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5194 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5195 		break;
5196 	case 0x10ec0668:
5197 		alc_write_coef_idx(codec, 0x11, 0x0001);
5198 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5199 		alc_process_coef_fw(codec, coef0688);
5200 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5201 		break;
5202 	case 0x10ec0215:
5203 	case 0x10ec0225:
5204 	case 0x10ec0285:
5205 	case 0x10ec0295:
5206 	case 0x10ec0289:
5207 	case 0x10ec0299:
5208 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5209 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5210 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5211 		alc_process_coef_fw(codec, coef0225);
5212 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5213 		break;
5214 	}
5215 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5216 }
5217 
5218 static void alc_headset_mode_default(struct hda_codec *codec)
5219 {
5220 	static const struct coef_fw coef0225[] = {
5221 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5222 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5223 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5224 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5225 		UPDATE_COEF(0x63, 3<<14, 0),
5226 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5227 		{}
5228 	};
5229 	static const struct coef_fw coef0255[] = {
5230 		WRITE_COEF(0x45, 0xc089),
5231 		WRITE_COEF(0x45, 0xc489),
5232 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5233 		WRITE_COEF(0x49, 0x0049),
5234 		{}
5235 	};
5236 	static const struct coef_fw coef0256[] = {
5237 		WRITE_COEF(0x45, 0xc489),
5238 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5239 		WRITE_COEF(0x49, 0x0049),
5240 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5241 		WRITE_COEF(0x06, 0x6100),
5242 		{}
5243 	};
5244 	static const struct coef_fw coef0233[] = {
5245 		WRITE_COEF(0x06, 0x2100),
5246 		WRITE_COEF(0x32, 0x4ea3),
5247 		{}
5248 	};
5249 	static const struct coef_fw coef0288[] = {
5250 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5251 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5252 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5253 		UPDATE_COEF(0x66, 0x0008, 0),
5254 		UPDATE_COEF(0x67, 0x2000, 0),
5255 		{}
5256 	};
5257 	static const struct coef_fw coef0292[] = {
5258 		WRITE_COEF(0x76, 0x000e),
5259 		WRITE_COEF(0x6c, 0x2400),
5260 		WRITE_COEF(0x6b, 0xc429),
5261 		WRITE_COEF(0x18, 0x7308),
5262 		{}
5263 	};
5264 	static const struct coef_fw coef0293[] = {
5265 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5266 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5267 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5268 		{}
5269 	};
5270 	static const struct coef_fw coef0688[] = {
5271 		WRITE_COEF(0x11, 0x0041),
5272 		WRITE_COEF(0x15, 0x0d40),
5273 		WRITE_COEF(0xb7, 0x802b),
5274 		{}
5275 	};
5276 	static const struct coef_fw coef0274[] = {
5277 		WRITE_COEF(0x45, 0x4289),
5278 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5279 		UPDATE_COEF(0x6b, 0x0f00, 0),
5280 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5281 		{}
5282 	};
5283 
5284 	switch (codec->core.vendor_id) {
5285 	case 0x10ec0215:
5286 	case 0x10ec0225:
5287 	case 0x10ec0285:
5288 	case 0x10ec0295:
5289 	case 0x10ec0289:
5290 	case 0x10ec0299:
5291 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5292 		alc_process_coef_fw(codec, coef0225);
5293 		break;
5294 	case 0x10ec0255:
5295 		alc_process_coef_fw(codec, coef0255);
5296 		break;
5297 	case 0x10ec0230:
5298 	case 0x10ec0236:
5299 	case 0x10ec0256:
5300 	case 0x19e58326:
5301 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5302 		alc_write_coef_idx(codec, 0x45, 0xc089);
5303 		msleep(50);
5304 		alc_process_coef_fw(codec, coef0256);
5305 		break;
5306 	case 0x10ec0234:
5307 	case 0x10ec0274:
5308 	case 0x10ec0294:
5309 		alc_process_coef_fw(codec, coef0274);
5310 		break;
5311 	case 0x10ec0233:
5312 	case 0x10ec0283:
5313 		alc_process_coef_fw(codec, coef0233);
5314 		break;
5315 	case 0x10ec0286:
5316 	case 0x10ec0288:
5317 	case 0x10ec0298:
5318 		alc_process_coef_fw(codec, coef0288);
5319 		break;
5320 	case 0x10ec0292:
5321 		alc_process_coef_fw(codec, coef0292);
5322 		break;
5323 	case 0x10ec0293:
5324 		alc_process_coef_fw(codec, coef0293);
5325 		break;
5326 	case 0x10ec0668:
5327 		alc_process_coef_fw(codec, coef0688);
5328 		break;
5329 	case 0x10ec0867:
5330 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5331 		break;
5332 	}
5333 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5334 }
5335 
5336 /* Iphone type */
5337 static void alc_headset_mode_ctia(struct hda_codec *codec)
5338 {
5339 	int val;
5340 
5341 	static const struct coef_fw coef0255[] = {
5342 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5343 		WRITE_COEF(0x1b, 0x0c2b),
5344 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5345 		{}
5346 	};
5347 	static const struct coef_fw coef0256[] = {
5348 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5349 		WRITE_COEF(0x1b, 0x0e6b),
5350 		{}
5351 	};
5352 	static const struct coef_fw coef0233[] = {
5353 		WRITE_COEF(0x45, 0xd429),
5354 		WRITE_COEF(0x1b, 0x0c2b),
5355 		WRITE_COEF(0x32, 0x4ea3),
5356 		{}
5357 	};
5358 	static const struct coef_fw coef0288[] = {
5359 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5360 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5361 		UPDATE_COEF(0x66, 0x0008, 0),
5362 		UPDATE_COEF(0x67, 0x2000, 0),
5363 		{}
5364 	};
5365 	static const struct coef_fw coef0292[] = {
5366 		WRITE_COEF(0x6b, 0xd429),
5367 		WRITE_COEF(0x76, 0x0008),
5368 		WRITE_COEF(0x18, 0x7388),
5369 		{}
5370 	};
5371 	static const struct coef_fw coef0293[] = {
5372 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5373 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5374 		{}
5375 	};
5376 	static const struct coef_fw coef0688[] = {
5377 		WRITE_COEF(0x11, 0x0001),
5378 		WRITE_COEF(0x15, 0x0d60),
5379 		WRITE_COEF(0xc3, 0x0000),
5380 		{}
5381 	};
5382 	static const struct coef_fw coef0225_1[] = {
5383 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5384 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5385 		{}
5386 	};
5387 	static const struct coef_fw coef0225_2[] = {
5388 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5389 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5390 		{}
5391 	};
5392 
5393 	switch (codec->core.vendor_id) {
5394 	case 0x10ec0255:
5395 		alc_process_coef_fw(codec, coef0255);
5396 		break;
5397 	case 0x10ec0230:
5398 	case 0x10ec0236:
5399 	case 0x10ec0256:
5400 	case 0x19e58326:
5401 		alc_process_coef_fw(codec, coef0256);
5402 		break;
5403 	case 0x10ec0234:
5404 	case 0x10ec0274:
5405 	case 0x10ec0294:
5406 		alc_write_coef_idx(codec, 0x45, 0xd689);
5407 		break;
5408 	case 0x10ec0233:
5409 	case 0x10ec0283:
5410 		alc_process_coef_fw(codec, coef0233);
5411 		break;
5412 	case 0x10ec0298:
5413 		val = alc_read_coef_idx(codec, 0x50);
5414 		if (val & (1 << 12)) {
5415 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5416 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5417 			msleep(300);
5418 		} else {
5419 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5420 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5421 			msleep(300);
5422 		}
5423 		break;
5424 	case 0x10ec0286:
5425 	case 0x10ec0288:
5426 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5427 		msleep(300);
5428 		alc_process_coef_fw(codec, coef0288);
5429 		break;
5430 	case 0x10ec0292:
5431 		alc_process_coef_fw(codec, coef0292);
5432 		break;
5433 	case 0x10ec0293:
5434 		alc_process_coef_fw(codec, coef0293);
5435 		break;
5436 	case 0x10ec0668:
5437 		alc_process_coef_fw(codec, coef0688);
5438 		break;
5439 	case 0x10ec0215:
5440 	case 0x10ec0225:
5441 	case 0x10ec0285:
5442 	case 0x10ec0295:
5443 	case 0x10ec0289:
5444 	case 0x10ec0299:
5445 		val = alc_read_coef_idx(codec, 0x45);
5446 		if (val & (1 << 9))
5447 			alc_process_coef_fw(codec, coef0225_2);
5448 		else
5449 			alc_process_coef_fw(codec, coef0225_1);
5450 		break;
5451 	case 0x10ec0867:
5452 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5453 		break;
5454 	}
5455 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5456 }
5457 
5458 /* Nokia type */
5459 static void alc_headset_mode_omtp(struct hda_codec *codec)
5460 {
5461 	static const struct coef_fw coef0255[] = {
5462 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5463 		WRITE_COEF(0x1b, 0x0c2b),
5464 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5465 		{}
5466 	};
5467 	static const struct coef_fw coef0256[] = {
5468 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5469 		WRITE_COEF(0x1b, 0x0e6b),
5470 		{}
5471 	};
5472 	static const struct coef_fw coef0233[] = {
5473 		WRITE_COEF(0x45, 0xe429),
5474 		WRITE_COEF(0x1b, 0x0c2b),
5475 		WRITE_COEF(0x32, 0x4ea3),
5476 		{}
5477 	};
5478 	static const struct coef_fw coef0288[] = {
5479 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5480 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5481 		UPDATE_COEF(0x66, 0x0008, 0),
5482 		UPDATE_COEF(0x67, 0x2000, 0),
5483 		{}
5484 	};
5485 	static const struct coef_fw coef0292[] = {
5486 		WRITE_COEF(0x6b, 0xe429),
5487 		WRITE_COEF(0x76, 0x0008),
5488 		WRITE_COEF(0x18, 0x7388),
5489 		{}
5490 	};
5491 	static const struct coef_fw coef0293[] = {
5492 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5493 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5494 		{}
5495 	};
5496 	static const struct coef_fw coef0688[] = {
5497 		WRITE_COEF(0x11, 0x0001),
5498 		WRITE_COEF(0x15, 0x0d50),
5499 		WRITE_COEF(0xc3, 0x0000),
5500 		{}
5501 	};
5502 	static const struct coef_fw coef0225[] = {
5503 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5504 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5505 		{}
5506 	};
5507 
5508 	switch (codec->core.vendor_id) {
5509 	case 0x10ec0255:
5510 		alc_process_coef_fw(codec, coef0255);
5511 		break;
5512 	case 0x10ec0230:
5513 	case 0x10ec0236:
5514 	case 0x10ec0256:
5515 	case 0x19e58326:
5516 		alc_process_coef_fw(codec, coef0256);
5517 		break;
5518 	case 0x10ec0234:
5519 	case 0x10ec0274:
5520 	case 0x10ec0294:
5521 		alc_write_coef_idx(codec, 0x45, 0xe689);
5522 		break;
5523 	case 0x10ec0233:
5524 	case 0x10ec0283:
5525 		alc_process_coef_fw(codec, coef0233);
5526 		break;
5527 	case 0x10ec0298:
5528 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5529 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5530 		msleep(300);
5531 		break;
5532 	case 0x10ec0286:
5533 	case 0x10ec0288:
5534 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5535 		msleep(300);
5536 		alc_process_coef_fw(codec, coef0288);
5537 		break;
5538 	case 0x10ec0292:
5539 		alc_process_coef_fw(codec, coef0292);
5540 		break;
5541 	case 0x10ec0293:
5542 		alc_process_coef_fw(codec, coef0293);
5543 		break;
5544 	case 0x10ec0668:
5545 		alc_process_coef_fw(codec, coef0688);
5546 		break;
5547 	case 0x10ec0215:
5548 	case 0x10ec0225:
5549 	case 0x10ec0285:
5550 	case 0x10ec0295:
5551 	case 0x10ec0289:
5552 	case 0x10ec0299:
5553 		alc_process_coef_fw(codec, coef0225);
5554 		break;
5555 	}
5556 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5557 }
5558 
5559 static void alc_determine_headset_type(struct hda_codec *codec)
5560 {
5561 	int val;
5562 	bool is_ctia = false;
5563 	struct alc_spec *spec = codec->spec;
5564 	static const struct coef_fw coef0255[] = {
5565 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5566 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5567  conteol) */
5568 		{}
5569 	};
5570 	static const struct coef_fw coef0288[] = {
5571 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5572 		{}
5573 	};
5574 	static const struct coef_fw coef0298[] = {
5575 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5576 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5577 		UPDATE_COEF(0x66, 0x0008, 0),
5578 		UPDATE_COEF(0x67, 0x2000, 0),
5579 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5580 		{}
5581 	};
5582 	static const struct coef_fw coef0293[] = {
5583 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5584 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5585 		{}
5586 	};
5587 	static const struct coef_fw coef0688[] = {
5588 		WRITE_COEF(0x11, 0x0001),
5589 		WRITE_COEF(0xb7, 0x802b),
5590 		WRITE_COEF(0x15, 0x0d60),
5591 		WRITE_COEF(0xc3, 0x0c00),
5592 		{}
5593 	};
5594 	static const struct coef_fw coef0274[] = {
5595 		UPDATE_COEF(0x4a, 0x0010, 0),
5596 		UPDATE_COEF(0x4a, 0x8000, 0),
5597 		WRITE_COEF(0x45, 0xd289),
5598 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5599 		{}
5600 	};
5601 
5602 	if (spec->no_internal_mic_pin) {
5603 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5604 		return;
5605 	}
5606 
5607 	switch (codec->core.vendor_id) {
5608 	case 0x10ec0255:
5609 		alc_process_coef_fw(codec, coef0255);
5610 		msleep(300);
5611 		val = alc_read_coef_idx(codec, 0x46);
5612 		is_ctia = (val & 0x0070) == 0x0070;
5613 		break;
5614 	case 0x10ec0230:
5615 	case 0x10ec0236:
5616 	case 0x10ec0256:
5617 	case 0x19e58326:
5618 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5619 		alc_write_coef_idx(codec, 0x06, 0x6104);
5620 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5621 
5622 		snd_hda_codec_write(codec, 0x21, 0,
5623 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5624 		msleep(80);
5625 		snd_hda_codec_write(codec, 0x21, 0,
5626 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5627 
5628 		alc_process_coef_fw(codec, coef0255);
5629 		msleep(300);
5630 		val = alc_read_coef_idx(codec, 0x46);
5631 		is_ctia = (val & 0x0070) == 0x0070;
5632 
5633 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5634 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5635 
5636 		snd_hda_codec_write(codec, 0x21, 0,
5637 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5638 		msleep(80);
5639 		snd_hda_codec_write(codec, 0x21, 0,
5640 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5641 		break;
5642 	case 0x10ec0234:
5643 	case 0x10ec0274:
5644 	case 0x10ec0294:
5645 		alc_process_coef_fw(codec, coef0274);
5646 		msleep(850);
5647 		val = alc_read_coef_idx(codec, 0x46);
5648 		is_ctia = (val & 0x00f0) == 0x00f0;
5649 		break;
5650 	case 0x10ec0233:
5651 	case 0x10ec0283:
5652 		alc_write_coef_idx(codec, 0x45, 0xd029);
5653 		msleep(300);
5654 		val = alc_read_coef_idx(codec, 0x46);
5655 		is_ctia = (val & 0x0070) == 0x0070;
5656 		break;
5657 	case 0x10ec0298:
5658 		snd_hda_codec_write(codec, 0x21, 0,
5659 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5660 		msleep(100);
5661 		snd_hda_codec_write(codec, 0x21, 0,
5662 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5663 		msleep(200);
5664 
5665 		val = alc_read_coef_idx(codec, 0x50);
5666 		if (val & (1 << 12)) {
5667 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5668 			alc_process_coef_fw(codec, coef0288);
5669 			msleep(350);
5670 			val = alc_read_coef_idx(codec, 0x50);
5671 			is_ctia = (val & 0x0070) == 0x0070;
5672 		} else {
5673 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5674 			alc_process_coef_fw(codec, coef0288);
5675 			msleep(350);
5676 			val = alc_read_coef_idx(codec, 0x50);
5677 			is_ctia = (val & 0x0070) == 0x0070;
5678 		}
5679 		alc_process_coef_fw(codec, coef0298);
5680 		snd_hda_codec_write(codec, 0x21, 0,
5681 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5682 		msleep(75);
5683 		snd_hda_codec_write(codec, 0x21, 0,
5684 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5685 		break;
5686 	case 0x10ec0286:
5687 	case 0x10ec0288:
5688 		alc_process_coef_fw(codec, coef0288);
5689 		msleep(350);
5690 		val = alc_read_coef_idx(codec, 0x50);
5691 		is_ctia = (val & 0x0070) == 0x0070;
5692 		break;
5693 	case 0x10ec0292:
5694 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5695 		msleep(300);
5696 		val = alc_read_coef_idx(codec, 0x6c);
5697 		is_ctia = (val & 0x001c) == 0x001c;
5698 		break;
5699 	case 0x10ec0293:
5700 		alc_process_coef_fw(codec, coef0293);
5701 		msleep(300);
5702 		val = alc_read_coef_idx(codec, 0x46);
5703 		is_ctia = (val & 0x0070) == 0x0070;
5704 		break;
5705 	case 0x10ec0668:
5706 		alc_process_coef_fw(codec, coef0688);
5707 		msleep(300);
5708 		val = alc_read_coef_idx(codec, 0xbe);
5709 		is_ctia = (val & 0x1c02) == 0x1c02;
5710 		break;
5711 	case 0x10ec0215:
5712 	case 0x10ec0225:
5713 	case 0x10ec0285:
5714 	case 0x10ec0295:
5715 	case 0x10ec0289:
5716 	case 0x10ec0299:
5717 		snd_hda_codec_write(codec, 0x21, 0,
5718 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5719 		msleep(80);
5720 		snd_hda_codec_write(codec, 0x21, 0,
5721 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5722 
5723 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5724 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5725 		val = alc_read_coef_idx(codec, 0x45);
5726 		if (val & (1 << 9)) {
5727 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5728 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5729 			msleep(800);
5730 			val = alc_read_coef_idx(codec, 0x46);
5731 			is_ctia = (val & 0x00f0) == 0x00f0;
5732 		} else {
5733 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5734 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5735 			msleep(800);
5736 			val = alc_read_coef_idx(codec, 0x46);
5737 			is_ctia = (val & 0x00f0) == 0x00f0;
5738 		}
5739 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5740 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5741 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5742 
5743 		snd_hda_codec_write(codec, 0x21, 0,
5744 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5745 		msleep(80);
5746 		snd_hda_codec_write(codec, 0x21, 0,
5747 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5748 		break;
5749 	case 0x10ec0867:
5750 		is_ctia = true;
5751 		break;
5752 	}
5753 
5754 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5755 		    is_ctia ? "yes" : "no");
5756 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5757 }
5758 
5759 static void alc_update_headset_mode(struct hda_codec *codec)
5760 {
5761 	struct alc_spec *spec = codec->spec;
5762 
5763 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5764 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
5765 
5766 	int new_headset_mode;
5767 
5768 	if (!snd_hda_jack_detect(codec, hp_pin))
5769 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5770 	else if (mux_pin == spec->headset_mic_pin)
5771 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5772 	else if (mux_pin == spec->headphone_mic_pin)
5773 		new_headset_mode = ALC_HEADSET_MODE_MIC;
5774 	else
5775 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5776 
5777 	if (new_headset_mode == spec->current_headset_mode) {
5778 		snd_hda_gen_update_outputs(codec);
5779 		return;
5780 	}
5781 
5782 	switch (new_headset_mode) {
5783 	case ALC_HEADSET_MODE_UNPLUGGED:
5784 		alc_headset_mode_unplugged(codec);
5785 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5786 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5787 		spec->gen.hp_jack_present = false;
5788 		break;
5789 	case ALC_HEADSET_MODE_HEADSET:
5790 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5791 			alc_determine_headset_type(codec);
5792 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5793 			alc_headset_mode_ctia(codec);
5794 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5795 			alc_headset_mode_omtp(codec);
5796 		spec->gen.hp_jack_present = true;
5797 		break;
5798 	case ALC_HEADSET_MODE_MIC:
5799 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5800 		spec->gen.hp_jack_present = false;
5801 		break;
5802 	case ALC_HEADSET_MODE_HEADPHONE:
5803 		alc_headset_mode_default(codec);
5804 		spec->gen.hp_jack_present = true;
5805 		break;
5806 	}
5807 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5808 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
5809 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5810 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5811 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5812 						  PIN_VREFHIZ);
5813 	}
5814 	spec->current_headset_mode = new_headset_mode;
5815 
5816 	snd_hda_gen_update_outputs(codec);
5817 }
5818 
5819 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5820 					 struct snd_kcontrol *kcontrol,
5821 					 struct snd_ctl_elem_value *ucontrol)
5822 {
5823 	alc_update_headset_mode(codec);
5824 }
5825 
5826 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5827 				       struct hda_jack_callback *jack)
5828 {
5829 	snd_hda_gen_hp_automute(codec, jack);
5830 	alc_update_headset_mode(codec);
5831 }
5832 
5833 static void alc_probe_headset_mode(struct hda_codec *codec)
5834 {
5835 	int i;
5836 	struct alc_spec *spec = codec->spec;
5837 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5838 
5839 	/* Find mic pins */
5840 	for (i = 0; i < cfg->num_inputs; i++) {
5841 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5842 			spec->headset_mic_pin = cfg->inputs[i].pin;
5843 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5844 			spec->headphone_mic_pin = cfg->inputs[i].pin;
5845 	}
5846 
5847 	WARN_ON(spec->gen.cap_sync_hook);
5848 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5849 	spec->gen.automute_hook = alc_update_headset_mode;
5850 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5851 }
5852 
5853 static void alc_fixup_headset_mode(struct hda_codec *codec,
5854 				const struct hda_fixup *fix, int action)
5855 {
5856 	struct alc_spec *spec = codec->spec;
5857 
5858 	switch (action) {
5859 	case HDA_FIXUP_ACT_PRE_PROBE:
5860 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5861 		break;
5862 	case HDA_FIXUP_ACT_PROBE:
5863 		alc_probe_headset_mode(codec);
5864 		break;
5865 	case HDA_FIXUP_ACT_INIT:
5866 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
5867 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5868 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5869 		}
5870 		alc_update_headset_mode(codec);
5871 		break;
5872 	}
5873 }
5874 
5875 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5876 				const struct hda_fixup *fix, int action)
5877 {
5878 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5879 		struct alc_spec *spec = codec->spec;
5880 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5881 	}
5882 	else
5883 		alc_fixup_headset_mode(codec, fix, action);
5884 }
5885 
5886 static void alc255_set_default_jack_type(struct hda_codec *codec)
5887 {
5888 	/* Set to iphone type */
5889 	static const struct coef_fw alc255fw[] = {
5890 		WRITE_COEF(0x1b, 0x880b),
5891 		WRITE_COEF(0x45, 0xd089),
5892 		WRITE_COEF(0x1b, 0x080b),
5893 		WRITE_COEF(0x46, 0x0004),
5894 		WRITE_COEF(0x1b, 0x0c0b),
5895 		{}
5896 	};
5897 	static const struct coef_fw alc256fw[] = {
5898 		WRITE_COEF(0x1b, 0x884b),
5899 		WRITE_COEF(0x45, 0xd089),
5900 		WRITE_COEF(0x1b, 0x084b),
5901 		WRITE_COEF(0x46, 0x0004),
5902 		WRITE_COEF(0x1b, 0x0c4b),
5903 		{}
5904 	};
5905 	switch (codec->core.vendor_id) {
5906 	case 0x10ec0255:
5907 		alc_process_coef_fw(codec, alc255fw);
5908 		break;
5909 	case 0x10ec0230:
5910 	case 0x10ec0236:
5911 	case 0x10ec0256:
5912 	case 0x19e58326:
5913 		alc_process_coef_fw(codec, alc256fw);
5914 		break;
5915 	}
5916 	msleep(30);
5917 }
5918 
5919 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5920 				const struct hda_fixup *fix, int action)
5921 {
5922 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5923 		alc255_set_default_jack_type(codec);
5924 	}
5925 	alc_fixup_headset_mode(codec, fix, action);
5926 }
5927 
5928 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5929 				const struct hda_fixup *fix, int action)
5930 {
5931 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5932 		struct alc_spec *spec = codec->spec;
5933 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5934 		alc255_set_default_jack_type(codec);
5935 	}
5936 	else
5937 		alc_fixup_headset_mode(codec, fix, action);
5938 }
5939 
5940 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5941 				       struct hda_jack_callback *jack)
5942 {
5943 	struct alc_spec *spec = codec->spec;
5944 
5945 	alc_update_headset_jack_cb(codec, jack);
5946 	/* Headset Mic enable or disable, only for Dell Dino */
5947 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5948 }
5949 
5950 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5951 				const struct hda_fixup *fix, int action)
5952 {
5953 	alc_fixup_headset_mode(codec, fix, action);
5954 	if (action == HDA_FIXUP_ACT_PROBE) {
5955 		struct alc_spec *spec = codec->spec;
5956 		/* toggled via hp_automute_hook */
5957 		spec->gpio_mask |= 0x40;
5958 		spec->gpio_dir |= 0x40;
5959 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5960 	}
5961 }
5962 
5963 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5964 					const struct hda_fixup *fix, int action)
5965 {
5966 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5967 		struct alc_spec *spec = codec->spec;
5968 		spec->gen.auto_mute_via_amp = 1;
5969 	}
5970 }
5971 
5972 static void alc_fixup_no_shutup(struct hda_codec *codec,
5973 				const struct hda_fixup *fix, int action)
5974 {
5975 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5976 		struct alc_spec *spec = codec->spec;
5977 		spec->no_shutup_pins = 1;
5978 	}
5979 }
5980 
5981 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5982 				    const struct hda_fixup *fix, int action)
5983 {
5984 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5985 		struct alc_spec *spec = codec->spec;
5986 		/* Disable AA-loopback as it causes white noise */
5987 		spec->gen.mixer_nid = 0;
5988 	}
5989 }
5990 
5991 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5992 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5993 				  const struct hda_fixup *fix, int action)
5994 {
5995 	static const struct hda_pintbl pincfgs[] = {
5996 		{ 0x16, 0x21211010 }, /* dock headphone */
5997 		{ 0x19, 0x21a11010 }, /* dock mic */
5998 		{ }
5999 	};
6000 	struct alc_spec *spec = codec->spec;
6001 
6002 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6003 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6004 		codec->power_save_node = 0; /* avoid click noises */
6005 		snd_hda_apply_pincfgs(codec, pincfgs);
6006 	}
6007 }
6008 
6009 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6010 				  const struct hda_fixup *fix, int action)
6011 {
6012 	static const struct hda_pintbl pincfgs[] = {
6013 		{ 0x17, 0x21211010 }, /* dock headphone */
6014 		{ 0x19, 0x21a11010 }, /* dock mic */
6015 		{ }
6016 	};
6017 	struct alc_spec *spec = codec->spec;
6018 
6019 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6020 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6021 		snd_hda_apply_pincfgs(codec, pincfgs);
6022 	} else if (action == HDA_FIXUP_ACT_INIT) {
6023 		/* Enable DOCK device */
6024 		snd_hda_codec_write(codec, 0x17, 0,
6025 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6026 		/* Enable DOCK device */
6027 		snd_hda_codec_write(codec, 0x19, 0,
6028 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6029 	}
6030 }
6031 
6032 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6033 				  const struct hda_fixup *fix, int action)
6034 {
6035 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6036 	 * the speaker output becomes too low by some reason on Thinkpads with
6037 	 * ALC298 codec
6038 	 */
6039 	static const hda_nid_t preferred_pairs[] = {
6040 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6041 		0
6042 	};
6043 	struct alc_spec *spec = codec->spec;
6044 
6045 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6046 		spec->gen.preferred_dacs = preferred_pairs;
6047 }
6048 
6049 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6050 				   const struct hda_fixup *fix, int action)
6051 {
6052 	static const hda_nid_t preferred_pairs[] = {
6053 		0x17, 0x02, 0x21, 0x03, 0
6054 	};
6055 	struct alc_spec *spec = codec->spec;
6056 
6057 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6058 		spec->gen.preferred_dacs = preferred_pairs;
6059 }
6060 
6061 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6062 {
6063 	struct alc_spec *spec = codec->spec;
6064 	int hp_pin = alc_get_hp_pin(spec);
6065 
6066 	/* Prevent pop noises when headphones are plugged in */
6067 	snd_hda_codec_write(codec, hp_pin, 0,
6068 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6069 	msleep(20);
6070 }
6071 
6072 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6073 				const struct hda_fixup *fix, int action)
6074 {
6075 	struct alc_spec *spec = codec->spec;
6076 	struct hda_input_mux *imux = &spec->gen.input_mux;
6077 	int i;
6078 
6079 	switch (action) {
6080 	case HDA_FIXUP_ACT_PRE_PROBE:
6081 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6082 		 * it causes a click noise at start up
6083 		 */
6084 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6085 		spec->shutup = alc_shutup_dell_xps13;
6086 		break;
6087 	case HDA_FIXUP_ACT_PROBE:
6088 		/* Make the internal mic the default input source. */
6089 		for (i = 0; i < imux->num_items; i++) {
6090 			if (spec->gen.imux_pins[i] == 0x12) {
6091 				spec->gen.cur_mux[0] = i;
6092 				break;
6093 			}
6094 		}
6095 		break;
6096 	}
6097 }
6098 
6099 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6100 				const struct hda_fixup *fix, int action)
6101 {
6102 	struct alc_spec *spec = codec->spec;
6103 
6104 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6105 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6106 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6107 
6108 		/* Disable boost for mic-in permanently. (This code is only called
6109 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6110 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6111 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6112 	} else
6113 		alc_fixup_headset_mode(codec, fix, action);
6114 }
6115 
6116 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6117 				const struct hda_fixup *fix, int action)
6118 {
6119 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6120 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6121 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6122 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6123 	}
6124 	alc_fixup_headset_mode(codec, fix, action);
6125 }
6126 
6127 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
6128 static int find_ext_mic_pin(struct hda_codec *codec)
6129 {
6130 	struct alc_spec *spec = codec->spec;
6131 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6132 	hda_nid_t nid;
6133 	unsigned int defcfg;
6134 	int i;
6135 
6136 	for (i = 0; i < cfg->num_inputs; i++) {
6137 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6138 			continue;
6139 		nid = cfg->inputs[i].pin;
6140 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6141 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6142 			continue;
6143 		return nid;
6144 	}
6145 
6146 	return 0;
6147 }
6148 
6149 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6150 				    const struct hda_fixup *fix,
6151 				    int action)
6152 {
6153 	struct alc_spec *spec = codec->spec;
6154 
6155 	if (action == HDA_FIXUP_ACT_PROBE) {
6156 		int mic_pin = find_ext_mic_pin(codec);
6157 		int hp_pin = alc_get_hp_pin(spec);
6158 
6159 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6160 			return;
6161 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6162 	}
6163 }
6164 
6165 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6166 					     const struct hda_fixup *fix,
6167 					     int action)
6168 {
6169 	struct alc_spec *spec = codec->spec;
6170 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6171 	int i;
6172 
6173 	/* The mic boosts on level 2 and 3 are too noisy
6174 	   on the internal mic input.
6175 	   Therefore limit the boost to 0 or 1. */
6176 
6177 	if (action != HDA_FIXUP_ACT_PROBE)
6178 		return;
6179 
6180 	for (i = 0; i < cfg->num_inputs; i++) {
6181 		hda_nid_t nid = cfg->inputs[i].pin;
6182 		unsigned int defcfg;
6183 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6184 			continue;
6185 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6186 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6187 			continue;
6188 
6189 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6190 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6191 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6192 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6193 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6194 	}
6195 }
6196 
6197 static void alc283_hp_automute_hook(struct hda_codec *codec,
6198 				    struct hda_jack_callback *jack)
6199 {
6200 	struct alc_spec *spec = codec->spec;
6201 	int vref;
6202 
6203 	msleep(200);
6204 	snd_hda_gen_hp_automute(codec, jack);
6205 
6206 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6207 
6208 	msleep(600);
6209 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6210 			    vref);
6211 }
6212 
6213 static void alc283_fixup_chromebook(struct hda_codec *codec,
6214 				    const struct hda_fixup *fix, int action)
6215 {
6216 	struct alc_spec *spec = codec->spec;
6217 
6218 	switch (action) {
6219 	case HDA_FIXUP_ACT_PRE_PROBE:
6220 		snd_hda_override_wcaps(codec, 0x03, 0);
6221 		/* Disable AA-loopback as it causes white noise */
6222 		spec->gen.mixer_nid = 0;
6223 		break;
6224 	case HDA_FIXUP_ACT_INIT:
6225 		/* MIC2-VREF control */
6226 		/* Set to manual mode */
6227 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6228 		/* Enable Line1 input control by verb */
6229 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6230 		break;
6231 	}
6232 }
6233 
6234 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6235 				    const struct hda_fixup *fix, int action)
6236 {
6237 	struct alc_spec *spec = codec->spec;
6238 
6239 	switch (action) {
6240 	case HDA_FIXUP_ACT_PRE_PROBE:
6241 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6242 		break;
6243 	case HDA_FIXUP_ACT_INIT:
6244 		/* MIC2-VREF control */
6245 		/* Set to manual mode */
6246 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6247 		break;
6248 	}
6249 }
6250 
6251 /* mute tablet speaker pin (0x14) via dock plugging in addition */
6252 static void asus_tx300_automute(struct hda_codec *codec)
6253 {
6254 	struct alc_spec *spec = codec->spec;
6255 	snd_hda_gen_update_outputs(codec);
6256 	if (snd_hda_jack_detect(codec, 0x1b))
6257 		spec->gen.mute_bits |= (1ULL << 0x14);
6258 }
6259 
6260 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6261 				    const struct hda_fixup *fix, int action)
6262 {
6263 	struct alc_spec *spec = codec->spec;
6264 	static const struct hda_pintbl dock_pins[] = {
6265 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6266 		{}
6267 	};
6268 
6269 	switch (action) {
6270 	case HDA_FIXUP_ACT_PRE_PROBE:
6271 		spec->init_amp = ALC_INIT_DEFAULT;
6272 		/* TX300 needs to set up GPIO2 for the speaker amp */
6273 		alc_setup_gpio(codec, 0x04);
6274 		snd_hda_apply_pincfgs(codec, dock_pins);
6275 		spec->gen.auto_mute_via_amp = 1;
6276 		spec->gen.automute_hook = asus_tx300_automute;
6277 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6278 						    snd_hda_gen_hp_automute);
6279 		break;
6280 	case HDA_FIXUP_ACT_PROBE:
6281 		spec->init_amp = ALC_INIT_DEFAULT;
6282 		break;
6283 	case HDA_FIXUP_ACT_BUILD:
6284 		/* this is a bit tricky; give more sane names for the main
6285 		 * (tablet) speaker and the dock speaker, respectively
6286 		 */
6287 		rename_ctl(codec, "Speaker Playback Switch",
6288 			   "Dock Speaker Playback Switch");
6289 		rename_ctl(codec, "Bass Speaker Playback Switch",
6290 			   "Speaker Playback Switch");
6291 		break;
6292 	}
6293 }
6294 
6295 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6296 				       const struct hda_fixup *fix, int action)
6297 {
6298 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6299 		/* DAC node 0x03 is giving mono output. We therefore want to
6300 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6301 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6302 		static const hda_nid_t conn1[] = { 0x0c };
6303 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6304 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6305 	}
6306 }
6307 
6308 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6309 					const struct hda_fixup *fix, int action)
6310 {
6311 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6312 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6313 		   we can't adjust the speaker's volume since this node does not has
6314 		   Amp-out capability. we change the speaker's route to:
6315 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6316 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6317 		   speaker's volume now. */
6318 
6319 		static const hda_nid_t conn1[] = { 0x0c };
6320 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6321 	}
6322 }
6323 
6324 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6325 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6326 				      const struct hda_fixup *fix, int action)
6327 {
6328 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6329 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6330 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6331 	}
6332 }
6333 
6334 /* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6335 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6336 					  const struct hda_fixup *fix, int action)
6337 {
6338 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6339 		static const hda_nid_t conn[] = { 0x02 };
6340 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6341 	}
6342 }
6343 
6344 /* Hook to update amp GPIO4 for automute */
6345 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6346 					  struct hda_jack_callback *jack)
6347 {
6348 	struct alc_spec *spec = codec->spec;
6349 
6350 	snd_hda_gen_hp_automute(codec, jack);
6351 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6352 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6353 			    !spec->gen.hp_jack_present);
6354 }
6355 
6356 /* Manage GPIOs for HP EliteBook Folio 9480m.
6357  *
6358  * GPIO4 is the headphone amplifier power control
6359  * GPIO3 is the audio output mute indicator LED
6360  */
6361 
6362 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6363 				  const struct hda_fixup *fix,
6364 				  int action)
6365 {
6366 	struct alc_spec *spec = codec->spec;
6367 
6368 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6369 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6370 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6371 		spec->gpio_mask |= 0x10;
6372 		spec->gpio_dir |= 0x10;
6373 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6374 	}
6375 }
6376 
6377 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6378 				   const struct hda_fixup *fix,
6379 				   int action)
6380 {
6381 	struct alc_spec *spec = codec->spec;
6382 
6383 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6384 		spec->gpio_mask |= 0x04;
6385 		spec->gpio_dir |= 0x04;
6386 		/* set data bit low */
6387 	}
6388 }
6389 
6390 /* Quirk for Thinkpad X1 7th and 8th Gen
6391  * The following fixed routing needed
6392  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6393  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6394  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6395  */
6396 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6397 					  const struct hda_fixup *fix, int action)
6398 {
6399 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6400 	static const hda_nid_t preferred_pairs[] = {
6401 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6402 	};
6403 	struct alc_spec *spec = codec->spec;
6404 
6405 	switch (action) {
6406 	case HDA_FIXUP_ACT_PRE_PROBE:
6407 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6408 		spec->gen.preferred_dacs = preferred_pairs;
6409 		break;
6410 	case HDA_FIXUP_ACT_BUILD:
6411 		/* The generic parser creates somewhat unintuitive volume ctls
6412 		 * with the fixed routing above, and the shared DAC2 may be
6413 		 * confusing for PA.
6414 		 * Rename those to unique names so that PA doesn't touch them
6415 		 * and use only Master volume.
6416 		 */
6417 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6418 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6419 		break;
6420 	}
6421 }
6422 
6423 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6424 					 const struct hda_fixup *fix,
6425 					 int action)
6426 {
6427 	alc_fixup_dual_codecs(codec, fix, action);
6428 	switch (action) {
6429 	case HDA_FIXUP_ACT_PRE_PROBE:
6430 		/* override card longname to provide a unique UCM profile */
6431 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6432 		break;
6433 	case HDA_FIXUP_ACT_BUILD:
6434 		/* rename Capture controls depending on the codec */
6435 		rename_ctl(codec, "Capture Volume",
6436 			   codec->addr == 0 ?
6437 			   "Rear-Panel Capture Volume" :
6438 			   "Front-Panel Capture Volume");
6439 		rename_ctl(codec, "Capture Switch",
6440 			   codec->addr == 0 ?
6441 			   "Rear-Panel Capture Switch" :
6442 			   "Front-Panel Capture Switch");
6443 		break;
6444 	}
6445 }
6446 
6447 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6448 				      const struct hda_fixup *fix, int action)
6449 {
6450 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6451 		return;
6452 
6453 	codec->power_save_node = 1;
6454 }
6455 
6456 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6457 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6458 				    const struct hda_fixup *fix, int action)
6459 {
6460 	struct alc_spec *spec = codec->spec;
6461 	static const hda_nid_t preferred_pairs[] = {
6462 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6463 		0
6464 	};
6465 
6466 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6467 		return;
6468 
6469 	spec->gen.preferred_dacs = preferred_pairs;
6470 	spec->gen.auto_mute_via_amp = 1;
6471 	codec->power_save_node = 0;
6472 }
6473 
6474 /* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6475 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6476 				    const struct hda_fixup *fix, int action)
6477 {
6478 	static const hda_nid_t preferred_pairs[] = {
6479 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6480 	};
6481 	struct alc_spec *spec = codec->spec;
6482 
6483 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6484 		spec->gen.preferred_dacs = preferred_pairs;
6485 		spec->gen.obey_preferred_dacs = 1;
6486 	}
6487 }
6488 
6489 /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6490 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6491 			      const struct hda_fixup *fix, int action)
6492 {
6493 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6494 		return;
6495 
6496 	snd_hda_override_wcaps(codec, 0x03, 0);
6497 }
6498 
6499 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6500 {
6501 	switch (codec->core.vendor_id) {
6502 	case 0x10ec0274:
6503 	case 0x10ec0294:
6504 	case 0x10ec0225:
6505 	case 0x10ec0295:
6506 	case 0x10ec0299:
6507 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6508 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6509 		break;
6510 	case 0x10ec0230:
6511 	case 0x10ec0235:
6512 	case 0x10ec0236:
6513 	case 0x10ec0255:
6514 	case 0x10ec0256:
6515 	case 0x10ec0257:
6516 	case 0x19e58326:
6517 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6518 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6519 		break;
6520 	}
6521 }
6522 
6523 static void alc295_fixup_chromebook(struct hda_codec *codec,
6524 				    const struct hda_fixup *fix, int action)
6525 {
6526 	struct alc_spec *spec = codec->spec;
6527 
6528 	switch (action) {
6529 	case HDA_FIXUP_ACT_PRE_PROBE:
6530 		spec->ultra_low_power = true;
6531 		break;
6532 	case HDA_FIXUP_ACT_INIT:
6533 		alc_combo_jack_hp_jd_restart(codec);
6534 		break;
6535 	}
6536 }
6537 
6538 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6539 				  const struct hda_fixup *fix, int action)
6540 {
6541 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6542 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6543 }
6544 
6545 
6546 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6547 					struct hda_jack_callback *cb)
6548 {
6549 	/* The Windows driver sets the codec up in a very different way where
6550 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6551 	 */
6552 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6553 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6554 	else
6555 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6556 }
6557 
6558 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6559 					const struct hda_fixup *fix, int action)
6560 {
6561 	/* Pin 0x21: headphones/headset mic */
6562 	if (!is_jack_detectable(codec, 0x21))
6563 		return;
6564 
6565 	switch (action) {
6566 	case HDA_FIXUP_ACT_PRE_PROBE:
6567 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6568 				alc294_gx502_toggle_output);
6569 		break;
6570 	case HDA_FIXUP_ACT_INIT:
6571 		/* Make sure to start in a correct state, i.e. if
6572 		 * headphones have been plugged in before powering up the system
6573 		 */
6574 		alc294_gx502_toggle_output(codec, NULL);
6575 		break;
6576 	}
6577 }
6578 
6579 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6580 				       struct hda_jack_callback *cb)
6581 {
6582 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6583 	 * responsible from changes between speakers and headphones
6584 	 */
6585 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6586 		alc_write_coef_idx(codec, 0x10, 0x8420);
6587 	else
6588 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6589 }
6590 
6591 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6592 				  const struct hda_fixup *fix, int action)
6593 {
6594 	if (!is_jack_detectable(codec, 0x21))
6595 		return;
6596 
6597 	switch (action) {
6598 	case HDA_FIXUP_ACT_PRE_PROBE:
6599 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6600 				alc294_gu502_toggle_output);
6601 		break;
6602 	case HDA_FIXUP_ACT_INIT:
6603 		alc294_gu502_toggle_output(codec, NULL);
6604 		break;
6605 	}
6606 }
6607 
6608 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6609 			      const struct hda_fixup *fix, int action)
6610 {
6611 	if (action != HDA_FIXUP_ACT_INIT)
6612 		return;
6613 
6614 	msleep(100);
6615 	alc_write_coef_idx(codec, 0x65, 0x0);
6616 }
6617 
6618 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6619 				    const struct hda_fixup *fix, int action)
6620 {
6621 	switch (action) {
6622 	case HDA_FIXUP_ACT_INIT:
6623 		alc_combo_jack_hp_jd_restart(codec);
6624 		break;
6625 	}
6626 }
6627 
6628 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6629 				    const struct hda_fixup *fix, int action)
6630 {
6631 	struct alc_spec *spec = codec->spec;
6632 
6633 	switch (action) {
6634 	case HDA_FIXUP_ACT_PRE_PROBE:
6635 		/* Mic RING SLEEVE swap for combo jack */
6636 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6637 		spec->no_internal_mic_pin = true;
6638 		break;
6639 	case HDA_FIXUP_ACT_INIT:
6640 		alc_combo_jack_hp_jd_restart(codec);
6641 		break;
6642 	}
6643 }
6644 
6645 /* GPIO1 = amplifier on/off
6646  * GPIO3 = mic mute LED
6647  */
6648 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6649 					  const struct hda_fixup *fix, int action)
6650 {
6651 	static const hda_nid_t conn[] = { 0x02 };
6652 
6653 	struct alc_spec *spec = codec->spec;
6654 	static const struct hda_pintbl pincfgs[] = {
6655 		{ 0x14, 0x90170110 },  /* front/high speakers */
6656 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6657 		{ }
6658 	};
6659 
6660 	//enable micmute led
6661 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6662 
6663 	switch (action) {
6664 	case HDA_FIXUP_ACT_PRE_PROBE:
6665 		spec->micmute_led_polarity = 1;
6666 		/* needed for amp of back speakers */
6667 		spec->gpio_mask |= 0x01;
6668 		spec->gpio_dir |= 0x01;
6669 		snd_hda_apply_pincfgs(codec, pincfgs);
6670 		/* share DAC to have unified volume control */
6671 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6672 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6673 		break;
6674 	case HDA_FIXUP_ACT_INIT:
6675 		/* need to toggle GPIO to enable the amp of back speakers */
6676 		alc_update_gpio_data(codec, 0x01, true);
6677 		msleep(100);
6678 		alc_update_gpio_data(codec, 0x01, false);
6679 		break;
6680 	}
6681 }
6682 
6683 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6684 					  const struct hda_fixup *fix, int action)
6685 {
6686 	static const hda_nid_t conn[] = { 0x02 };
6687 	static const struct hda_pintbl pincfgs[] = {
6688 		{ 0x14, 0x90170110 },  /* rear speaker */
6689 		{ }
6690 	};
6691 
6692 	switch (action) {
6693 	case HDA_FIXUP_ACT_PRE_PROBE:
6694 		snd_hda_apply_pincfgs(codec, pincfgs);
6695 		/* force front speaker to DAC1 */
6696 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6697 		break;
6698 	}
6699 }
6700 
6701 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6702 				      const struct hda_fixup *fix,
6703 				      int action)
6704 {
6705 	static const struct coef_fw coefs[] = {
6706 		WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6707 		WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6708 		WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6709 		WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6710 		WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6711 		WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6712 		WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6713 		WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6714 		WRITE_COEF(0x6e, 0x1005), { }
6715 	};
6716 
6717 	static const struct hda_pintbl pincfgs[] = {
6718 		{ 0x12, 0xb7a60130 },  /* Internal microphone*/
6719 		{ 0x14, 0x90170150 },  /* B&O soundbar speakers */
6720 		{ 0x17, 0x90170153 },  /* Side speakers */
6721 		{ 0x19, 0x03a11040 },  /* Headset microphone */
6722 		{ }
6723 	};
6724 
6725 	switch (action) {
6726 	case HDA_FIXUP_ACT_PRE_PROBE:
6727 		snd_hda_apply_pincfgs(codec, pincfgs);
6728 
6729 		/* Fixes volume control problem for side speakers */
6730 		alc295_fixup_disable_dac3(codec, fix, action);
6731 
6732 		/* Fixes no sound from headset speaker */
6733 		snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
6734 
6735 		/* Auto-enable headset mic when plugged */
6736 		snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
6737 
6738 		/* Headset mic volume enhancement */
6739 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
6740 		break;
6741 	case HDA_FIXUP_ACT_INIT:
6742 		alc_process_coef_fw(codec, coefs);
6743 		break;
6744 	case HDA_FIXUP_ACT_BUILD:
6745 		rename_ctl(codec, "Bass Speaker Playback Volume",
6746 			   "B&O-Tuned Playback Volume");
6747 		rename_ctl(codec, "Front Playback Switch",
6748 			   "B&O Soundbar Playback Switch");
6749 		rename_ctl(codec, "Bass Speaker Playback Switch",
6750 			   "Side Speaker Playback Switch");
6751 		break;
6752 	}
6753 }
6754 
6755 /* for hda_fixup_thinkpad_acpi() */
6756 #include "thinkpad_helper.c"
6757 
6758 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6759 				    const struct hda_fixup *fix, int action)
6760 {
6761 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6762 	hda_fixup_thinkpad_acpi(codec, fix, action);
6763 }
6764 
6765 /* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6766 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6767 						  const struct hda_fixup *fix,
6768 						  int action)
6769 {
6770 	struct alc_spec *spec = codec->spec;
6771 
6772 	switch (action) {
6773 	case HDA_FIXUP_ACT_PRE_PROBE:
6774 		spec->gen.suppress_auto_mute = 1;
6775 		break;
6776 	}
6777 }
6778 
6779 static void comp_acpi_device_notify(acpi_handle handle, u32 event, void *data)
6780 {
6781 	struct hda_codec *cdc = data;
6782 	struct alc_spec *spec = cdc->spec;
6783 
6784 	codec_info(cdc, "ACPI Notification %d\n", event);
6785 
6786 	hda_component_acpi_device_notify(spec->comps, ARRAY_SIZE(spec->comps),
6787 					 handle, event, data);
6788 }
6789 
6790 static int comp_bind(struct device *dev)
6791 {
6792 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6793 	struct alc_spec *spec = cdc->spec;
6794 	int ret;
6795 
6796 	ret = hda_component_manager_bind(cdc, spec->comps);
6797 	if (ret)
6798 		return ret;
6799 
6800 	return hda_component_manager_bind_acpi_notifications(cdc,
6801 							     spec->comps, ARRAY_SIZE(spec->comps),
6802 							     comp_acpi_device_notify, cdc);
6803 }
6804 
6805 static void comp_unbind(struct device *dev)
6806 {
6807 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6808 	struct alc_spec *spec = cdc->spec;
6809 
6810 	hda_component_manager_unbind_acpi_notifications(cdc, spec->comps, comp_acpi_device_notify);
6811 	hda_component_manager_unbind(cdc, spec->comps);
6812 }
6813 
6814 static const struct component_master_ops comp_master_ops = {
6815 	.bind = comp_bind,
6816 	.unbind = comp_unbind,
6817 };
6818 
6819 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6820 				       struct snd_pcm_substream *sub, int action)
6821 {
6822 	struct alc_spec *spec = cdc->spec;
6823 
6824 	hda_component_manager_playback_hook(spec->comps, ARRAY_SIZE(spec->comps), action);
6825 }
6826 
6827 static void comp_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6828 			       const char *hid, const char *match_str, int count)
6829 {
6830 	struct alc_spec *spec = cdc->spec;
6831 	int ret;
6832 
6833 	switch (action) {
6834 	case HDA_FIXUP_ACT_PRE_PROBE:
6835 		ret = hda_component_manager_init(cdc, spec->comps, count, bus, hid,
6836 						 match_str, &comp_master_ops);
6837 		if (ret)
6838 			return;
6839 
6840 		spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6841 		break;
6842 	case HDA_FIXUP_ACT_FREE:
6843 		hda_component_manager_free(cdc, &comp_master_ops);
6844 		break;
6845 	}
6846 }
6847 
6848 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6849 {
6850 	comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
6851 }
6852 
6853 static void cs35l41_fixup_i2c_four(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6854 {
6855 	comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
6856 }
6857 
6858 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6859 {
6860 	comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
6861 }
6862 
6863 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6864 {
6865 	comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
6866 }
6867 
6868 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6869 						 int action)
6870 {
6871 	comp_generic_fixup(cdc, action, "i2c", "CLSA0100", "-%s:00-cs35l41-hda.%d", 2);
6872 }
6873 
6874 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6875 						 int action)
6876 {
6877 	comp_generic_fixup(cdc, action, "i2c", "CLSA0101", "-%s:00-cs35l41-hda.%d", 2);
6878 }
6879 
6880 static void cs35l56_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6881 {
6882 	comp_generic_fixup(cdc, action, "i2c", "CSC3556", "-%s:00-cs35l56-hda.%d", 2);
6883 }
6884 
6885 static void cs35l56_fixup_i2c_four(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6886 {
6887 	comp_generic_fixup(cdc, action, "i2c", "CSC3556", "-%s:00-cs35l56-hda.%d", 4);
6888 }
6889 
6890 static void cs35l56_fixup_spi_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6891 {
6892 	comp_generic_fixup(cdc, action, "spi", "CSC3556", "-%s:00-cs35l56-hda.%d", 2);
6893 }
6894 
6895 static void cs35l56_fixup_spi_four(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6896 {
6897 	comp_generic_fixup(cdc, action, "spi", "CSC3556", "-%s:00-cs35l56-hda.%d", 4);
6898 }
6899 
6900 static void alc285_fixup_asus_ga403u(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6901 {
6902 	/*
6903 	 * The same SSID has been re-used in different hardware, they have
6904 	 * different codecs and the newer GA403U has a ALC285.
6905 	 */
6906 	if (cdc->core.vendor_id == 0x10ec0285)
6907 		cs35l56_fixup_i2c_two(cdc, fix, action);
6908 	else
6909 		alc_fixup_inv_dmic(cdc, fix, action);
6910 }
6911 
6912 static void tas2781_fixup_i2c(struct hda_codec *cdc,
6913 	const struct hda_fixup *fix, int action)
6914 {
6915 	comp_generic_fixup(cdc, action, "i2c", "TIAS2781", "-%s:00", 1);
6916 }
6917 
6918 static void yoga7_14arb7_fixup_i2c(struct hda_codec *cdc,
6919 	const struct hda_fixup *fix, int action)
6920 {
6921 	comp_generic_fixup(cdc, action, "i2c", "INT8866", "-%s:00", 1);
6922 }
6923 
6924 static void alc256_fixup_acer_sfg16_micmute_led(struct hda_codec *codec,
6925 	const struct hda_fixup *fix, int action)
6926 {
6927 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
6928 }
6929 
6930 
6931 /* for alc295_fixup_hp_top_speakers */
6932 #include "hp_x360_helper.c"
6933 
6934 /* for alc285_fixup_ideapad_s740_coef() */
6935 #include "ideapad_s740_helper.c"
6936 
6937 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6938 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6939 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6940 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6941 	{}
6942 };
6943 
6944 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6945 					   const struct hda_fixup *fix,
6946 					   int action)
6947 {
6948 	/*
6949 	 * A certain other OS sets these coeffs to different values. On at least
6950 	 * one TongFang barebone these settings might survive even a cold
6951 	 * reboot. So to restore a clean slate the values are explicitly reset
6952 	 * to default here. Without this, the external microphone is always in a
6953 	 * plugged-in state, while the internal microphone is always in an
6954 	 * unplugged state, breaking the ability to use the internal microphone.
6955 	 */
6956 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
6957 }
6958 
6959 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6960 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6961 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6962 	WRITE_COEF(0x49, 0x0149),
6963 	{}
6964 };
6965 
6966 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6967 				       const struct hda_fixup *fix,
6968 				       int action)
6969 {
6970 	/*
6971 	 * The audio jack input and output is not detected on the ASRock NUC Box
6972 	 * 1100 series when cold booting without this fix. Warm rebooting from a
6973 	 * certain other OS makes the audio functional, as COEF settings are
6974 	 * preserved in this case. This fix sets these altered COEF values as
6975 	 * the default.
6976 	 */
6977 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6978 }
6979 
6980 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6981 						    const struct hda_fixup *fix,
6982 						    int action)
6983 {
6984 	/*
6985 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6986 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6987 	 * needs an additional quirk for sound working after suspend and resume.
6988 	 */
6989 	if (codec->core.vendor_id == 0x10ec0256) {
6990 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6991 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6992 	} else {
6993 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6994 	}
6995 }
6996 
6997 static void alc256_decrease_headphone_amp_val(struct hda_codec *codec,
6998 					      const struct hda_fixup *fix, int action)
6999 {
7000 	u32 caps;
7001 	u8 nsteps, offs;
7002 
7003 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7004 		return;
7005 
7006 	caps = query_amp_caps(codec, 0x3, HDA_OUTPUT);
7007 	nsteps = ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) - 10;
7008 	offs = ((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT) - 10;
7009 	caps &= ~AC_AMPCAP_NUM_STEPS & ~AC_AMPCAP_OFFSET;
7010 	caps |= (nsteps << AC_AMPCAP_NUM_STEPS_SHIFT) | (offs << AC_AMPCAP_OFFSET_SHIFT);
7011 
7012 	if (snd_hda_override_amp_caps(codec, 0x3, HDA_OUTPUT, caps))
7013 		codec_warn(codec, "failed to override amp caps for NID 0x3\n");
7014 }
7015 
7016 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7017 						  const struct hda_fixup *fix,
7018 						  int action)
7019 {
7020 	struct alc_spec *spec = codec->spec;
7021 	struct hda_input_mux *imux = &spec->gen.input_mux;
7022 	int i;
7023 
7024 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
7025 
7026 	switch (action) {
7027 	case HDA_FIXUP_ACT_PRE_PROBE:
7028 		/**
7029 		 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7030 		 * to Hi-Z to avoid pop noises at startup and when plugging and
7031 		 * unplugging headphones.
7032 		 */
7033 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7034 		snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7035 		break;
7036 	case HDA_FIXUP_ACT_PROBE:
7037 		/**
7038 		 * Make the internal mic (0x12) the default input source to
7039 		 * prevent pop noises on cold boot.
7040 		 */
7041 		for (i = 0; i < imux->num_items; i++) {
7042 			if (spec->gen.imux_pins[i] == 0x12) {
7043 				spec->gen.cur_mux[0] = i;
7044 				break;
7045 			}
7046 		}
7047 		break;
7048 	}
7049 }
7050 
7051 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7052 					  const struct hda_fixup *fix, int action)
7053 {
7054 	/*
7055 	 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7056 	 * unconnected.
7057 	 */
7058 	static const struct hda_pintbl pincfgs[] = {
7059 		{ 0x17, 0x90170121 },
7060 		{ }
7061 	};
7062 	/*
7063 	 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7064 	 * DAC 0x02 and 0x03 would be fine.
7065 	 */
7066 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7067 	/*
7068 	 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7069 	 * Headphones (0x21) are connected to DAC 0x03.
7070 	 */
7071 	static const hda_nid_t preferred_pairs[] = {
7072 		0x14, 0x02,
7073 		0x17, 0x02,
7074 		0x21, 0x03,
7075 		0
7076 	};
7077 	struct alc_spec *spec = codec->spec;
7078 
7079 	switch (action) {
7080 	case HDA_FIXUP_ACT_PRE_PROBE:
7081 		snd_hda_apply_pincfgs(codec, pincfgs);
7082 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7083 		spec->gen.preferred_dacs = preferred_pairs;
7084 		break;
7085 	}
7086 }
7087 
7088 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7089 					  const struct hda_fixup *fix, int action)
7090 {
7091 	static const struct hda_pintbl pincfgs[] = {
7092 		{ 0x14, 0x90170151 },
7093 		{ 0x17, 0x90170150 },
7094 		{ }
7095 	};
7096 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7097 	static const hda_nid_t preferred_pairs[] = {
7098 		0x14, 0x02,
7099 		0x17, 0x03,
7100 		0x21, 0x02,
7101 		0
7102 	};
7103 	struct alc_spec *spec = codec->spec;
7104 
7105 	alc_fixup_no_shutup(codec, fix, action);
7106 
7107 	switch (action) {
7108 	case HDA_FIXUP_ACT_PRE_PROBE:
7109 		snd_hda_apply_pincfgs(codec, pincfgs);
7110 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7111 		spec->gen.preferred_dacs = preferred_pairs;
7112 		break;
7113 	}
7114 }
7115 
7116 /* Forcibly assign NID 0x03 to HP while NID 0x02 to SPK */
7117 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7118 				    const struct hda_fixup *fix, int action)
7119 {
7120 	struct alc_spec *spec = codec->spec;
7121 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7122 	static const hda_nid_t preferred_pairs[] = {
7123 		0x17, 0x02, 0x21, 0x03, 0
7124 	};
7125 
7126 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7127 		return;
7128 
7129 	snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7130 	spec->gen.preferred_dacs = preferred_pairs;
7131 	spec->gen.auto_mute_via_amp = 1;
7132 	if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7133 		snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7134 					0x0); /* Make sure 0x14 was disable */
7135 	}
7136 }
7137 /* Fix none verb table of Headset Mic pin */
7138 static void alc_fixup_headset_mic(struct hda_codec *codec,
7139 				   const struct hda_fixup *fix, int action)
7140 {
7141 	struct alc_spec *spec = codec->spec;
7142 	static const struct hda_pintbl pincfgs[] = {
7143 		{ 0x19, 0x03a1103c },
7144 		{ }
7145 	};
7146 
7147 	switch (action) {
7148 	case HDA_FIXUP_ACT_PRE_PROBE:
7149 		snd_hda_apply_pincfgs(codec, pincfgs);
7150 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7151 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7152 		break;
7153 	}
7154 }
7155 
7156 static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec,
7157 					  const struct hda_fixup *fix, int action)
7158 {
7159 	/*
7160 	 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
7161 	 * unconnected.
7162 	 * The Pin Complex 0x17 for the bass speakers has the lowest association
7163 	 * and sequence values so shift it up a bit to squeeze 0x14 in.
7164 	 */
7165 	static const struct hda_pintbl pincfgs[] = {
7166 		{ 0x14, 0x90170110 }, // top/treble
7167 		{ 0x17, 0x90170111 }, // bottom/bass
7168 		{ }
7169 	};
7170 
7171 	/*
7172 	 * Force DAC 0x02 for the bass speakers 0x17.
7173 	 */
7174 	static const hda_nid_t conn[] = { 0x02 };
7175 
7176 	switch (action) {
7177 	case HDA_FIXUP_ACT_PRE_PROBE:
7178 		snd_hda_apply_pincfgs(codec, pincfgs);
7179 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7180 		break;
7181 	}
7182 
7183 	cs35l41_fixup_i2c_two(codec, fix, action);
7184 	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7185 	alc245_fixup_hp_gpio_led(codec, fix, action);
7186 }
7187 
7188 /*
7189  * ALC287 PCM hooks
7190  */
7191 static void alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream *hinfo,
7192 				   struct hda_codec *codec,
7193 				   struct snd_pcm_substream *substream,
7194 				   int action)
7195 {
7196 	alc_write_coef_idx(codec, 0x10, 0x8806); /* Change MLK to GPIO3 */
7197 	switch (action) {
7198 	case HDA_GEN_PCM_ACT_OPEN:
7199 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x954f); /* write gpio3 to high */
7200 		break;
7201 	case HDA_GEN_PCM_ACT_CLOSE:
7202 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7203 		break;
7204 	}
7205 }
7206 
7207 static void __maybe_unused alc287_s4_power_gpio3_default(struct hda_codec *codec)
7208 {
7209 	if (is_s4_suspend(codec)) {
7210 		alc_write_coef_idx(codec, 0x10, 0x8806); /* Change MLK to GPIO3 */
7211 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7212 	}
7213 }
7214 
7215 static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec,
7216 			       const struct hda_fixup *fix, int action)
7217 {
7218 	struct alc_spec *spec = codec->spec;
7219 
7220 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7221 		return;
7222 #ifdef CONFIG_PM
7223 	spec->power_hook = alc287_s4_power_gpio3_default;
7224 #endif
7225 	spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook;
7226 }
7227 
7228 
7229 enum {
7230 	ALC269_FIXUP_GPIO2,
7231 	ALC269_FIXUP_SONY_VAIO,
7232 	ALC275_FIXUP_SONY_VAIO_GPIO2,
7233 	ALC269_FIXUP_DELL_M101Z,
7234 	ALC269_FIXUP_SKU_IGNORE,
7235 	ALC269_FIXUP_ASUS_G73JW,
7236 	ALC269_FIXUP_ASUS_N7601ZM_PINS,
7237 	ALC269_FIXUP_ASUS_N7601ZM,
7238 	ALC269_FIXUP_LENOVO_EAPD,
7239 	ALC275_FIXUP_SONY_HWEQ,
7240 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
7241 	ALC271_FIXUP_DMIC,
7242 	ALC269_FIXUP_PCM_44K,
7243 	ALC269_FIXUP_STEREO_DMIC,
7244 	ALC269_FIXUP_HEADSET_MIC,
7245 	ALC269_FIXUP_QUANTA_MUTE,
7246 	ALC269_FIXUP_LIFEBOOK,
7247 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
7248 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
7249 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7250 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7251 	ALC269_FIXUP_AMIC,
7252 	ALC269_FIXUP_DMIC,
7253 	ALC269VB_FIXUP_AMIC,
7254 	ALC269VB_FIXUP_DMIC,
7255 	ALC269_FIXUP_HP_MUTE_LED,
7256 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
7257 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
7258 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
7259 	ALC269_FIXUP_HP_GPIO_LED,
7260 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
7261 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
7262 	ALC269_FIXUP_INV_DMIC,
7263 	ALC269_FIXUP_LENOVO_DOCK,
7264 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7265 	ALC269_FIXUP_NO_SHUTUP,
7266 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7267 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7268 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7269 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7270 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7271 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7272 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7273 	ALC269_FIXUP_HEADSET_MODE,
7274 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7275 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7276 	ALC269_FIXUP_ASUS_X101_FUNC,
7277 	ALC269_FIXUP_ASUS_X101_VERB,
7278 	ALC269_FIXUP_ASUS_X101,
7279 	ALC271_FIXUP_AMIC_MIC2,
7280 	ALC271_FIXUP_HP_GATE_MIC_JACK,
7281 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7282 	ALC269_FIXUP_ACER_AC700,
7283 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7284 	ALC269VB_FIXUP_ASUS_ZENBOOK,
7285 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7286 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7287 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7288 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
7289 	ALC283_FIXUP_CHROME_BOOK,
7290 	ALC283_FIXUP_SENSE_COMBO_JACK,
7291 	ALC282_FIXUP_ASUS_TX300,
7292 	ALC283_FIXUP_INT_MIC,
7293 	ALC290_FIXUP_MONO_SPEAKERS,
7294 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7295 	ALC290_FIXUP_SUBWOOFER,
7296 	ALC290_FIXUP_SUBWOOFER_HSJACK,
7297 	ALC269_FIXUP_THINKPAD_ACPI,
7298 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7299 	ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7300 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7301 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7302 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7303 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7304 	ALC255_FIXUP_HEADSET_MODE,
7305 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7306 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7307 	ALC292_FIXUP_TPT440_DOCK,
7308 	ALC292_FIXUP_TPT440,
7309 	ALC283_FIXUP_HEADSET_MIC,
7310 	ALC255_FIXUP_MIC_MUTE_LED,
7311 	ALC282_FIXUP_ASPIRE_V5_PINS,
7312 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
7313 	ALC280_FIXUP_HP_GPIO4,
7314 	ALC286_FIXUP_HP_GPIO_LED,
7315 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7316 	ALC280_FIXUP_HP_DOCK_PINS,
7317 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7318 	ALC280_FIXUP_HP_9480M,
7319 	ALC245_FIXUP_HP_X360_AMP,
7320 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7321 	ALC285_FIXUP_HP_ENVY_X360,
7322 	ALC288_FIXUP_DELL_HEADSET_MODE,
7323 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7324 	ALC288_FIXUP_DELL_XPS_13,
7325 	ALC288_FIXUP_DISABLE_AAMIX,
7326 	ALC292_FIXUP_DELL_E7X_AAMIX,
7327 	ALC292_FIXUP_DELL_E7X,
7328 	ALC292_FIXUP_DISABLE_AAMIX,
7329 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7330 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7331 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7332 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7333 	ALC275_FIXUP_DELL_XPS,
7334 	ALC293_FIXUP_LENOVO_SPK_NOISE,
7335 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7336 	ALC255_FIXUP_DELL_SPK_NOISE,
7337 	ALC225_FIXUP_DISABLE_MIC_VREF,
7338 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7339 	ALC295_FIXUP_DISABLE_DAC3,
7340 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
7341 	ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7342 	ALC285_FIXUP_ASUS_HEADSET_MIC,
7343 	ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7344 	ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7345 	ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7346 	ALC280_FIXUP_HP_HEADSET_MIC,
7347 	ALC221_FIXUP_HP_FRONT_MIC,
7348 	ALC292_FIXUP_TPT460,
7349 	ALC298_FIXUP_SPK_VOLUME,
7350 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
7351 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7352 	ALC269_FIXUP_ATIV_BOOK_8,
7353 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7354 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7355 	ALC256_FIXUP_ASUS_HEADSET_MODE,
7356 	ALC256_FIXUP_ASUS_MIC,
7357 	ALC256_FIXUP_ASUS_AIO_GPIO2,
7358 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7359 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7360 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
7361 	ALC233_FIXUP_ACER_HEADSET_MIC,
7362 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
7363 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7364 	ALC225_FIXUP_S3_POP_NOISE,
7365 	ALC700_FIXUP_INTEL_REFERENCE,
7366 	ALC274_FIXUP_DELL_BIND_DACS,
7367 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7368 	ALC298_FIXUP_TPT470_DOCK_FIX,
7369 	ALC298_FIXUP_TPT470_DOCK,
7370 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7371 	ALC255_FIXUP_DELL_HEADSET_MIC,
7372 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7373 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
7374 	ALC295_FIXUP_HP_X360,
7375 	ALC221_FIXUP_HP_HEADSET_MIC,
7376 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7377 	ALC295_FIXUP_HP_AUTO_MUTE,
7378 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7379 	ALC294_FIXUP_ASUS_MIC,
7380 	ALC294_FIXUP_ASUS_HEADSET_MIC,
7381 	ALC294_FIXUP_ASUS_SPK,
7382 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7383 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7384 	ALC255_FIXUP_ACER_HEADSET_MIC,
7385 	ALC295_FIXUP_CHROME_BOOK,
7386 	ALC225_FIXUP_HEADSET_JACK,
7387 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7388 	ALC225_FIXUP_WYSE_AUTO_MUTE,
7389 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7390 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7391 	ALC256_FIXUP_ASUS_HEADSET_MIC,
7392 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7393 	ALC299_FIXUP_PREDATOR_SPK,
7394 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7395 	ALC289_FIXUP_DELL_SPK1,
7396 	ALC289_FIXUP_DELL_SPK2,
7397 	ALC289_FIXUP_DUAL_SPK,
7398 	ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7399 	ALC294_FIXUP_SPK2_TO_DAC1,
7400 	ALC294_FIXUP_ASUS_DUAL_SPK,
7401 	ALC285_FIXUP_THINKPAD_X1_GEN7,
7402 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7403 	ALC294_FIXUP_ASUS_ALLY,
7404 	ALC294_FIXUP_ASUS_ALLY_PINS,
7405 	ALC294_FIXUP_ASUS_ALLY_VERBS,
7406 	ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7407 	ALC294_FIXUP_ASUS_HPE,
7408 	ALC294_FIXUP_ASUS_COEF_1B,
7409 	ALC294_FIXUP_ASUS_GX502_HP,
7410 	ALC294_FIXUP_ASUS_GX502_PINS,
7411 	ALC294_FIXUP_ASUS_GX502_VERBS,
7412 	ALC294_FIXUP_ASUS_GU502_HP,
7413 	ALC294_FIXUP_ASUS_GU502_PINS,
7414 	ALC294_FIXUP_ASUS_GU502_VERBS,
7415 	ALC294_FIXUP_ASUS_G513_PINS,
7416 	ALC285_FIXUP_ASUS_G533Z_PINS,
7417 	ALC285_FIXUP_HP_GPIO_LED,
7418 	ALC285_FIXUP_HP_MUTE_LED,
7419 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7420 	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7421 	ALC236_FIXUP_HP_GPIO_LED,
7422 	ALC236_FIXUP_HP_MUTE_LED,
7423 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7424 	ALC298_FIXUP_SAMSUNG_AMP,
7425 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7426 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7427 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7428 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7429 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
7430 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7431 	ALC289_FIXUP_ASUS_GA401,
7432 	ALC289_FIXUP_ASUS_GA502,
7433 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7434 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
7435 	ALC269_FIXUP_CZC_B20,
7436 	ALC269_FIXUP_CZC_TMI,
7437 	ALC269_FIXUP_CZC_L101,
7438 	ALC269_FIXUP_LEMOTE_A1802,
7439 	ALC269_FIXUP_LEMOTE_A190X,
7440 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
7441 	ALC233_FIXUP_INTEL_NUC8_DMIC,
7442 	ALC233_FIXUP_INTEL_NUC8_BOOST,
7443 	ALC256_FIXUP_INTEL_NUC10,
7444 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7445 	ALC274_FIXUP_HP_MIC,
7446 	ALC274_FIXUP_HP_HEADSET_MIC,
7447 	ALC274_FIXUP_HP_ENVY_GPIO,
7448 	ALC256_FIXUP_ASUS_HPE,
7449 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7450 	ALC287_FIXUP_HP_GPIO_LED,
7451 	ALC256_FIXUP_HP_HEADSET_MIC,
7452 	ALC245_FIXUP_HP_GPIO_LED,
7453 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7454 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7455 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7456 	ALC256_FIXUP_ACER_HEADSET_MIC,
7457 	ALC285_FIXUP_IDEAPAD_S740_COEF,
7458 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7459 	ALC295_FIXUP_ASUS_DACS,
7460 	ALC295_FIXUP_HP_OMEN,
7461 	ALC285_FIXUP_HP_SPECTRE_X360,
7462 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7463 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7464 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7465 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7466 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7467 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7468 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7469 	ALC298_FIXUP_LENOVO_C940_DUET7,
7470 	ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
7471 	ALC287_FIXUP_LENOVO_LEGION_7,
7472 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
7473 	ALC256_FIXUP_SET_COEF_DEFAULTS,
7474 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7475 	ALC233_FIXUP_NO_AUDIO_JACK,
7476 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7477 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7478 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7479 	ALC287_FIXUP_LEGION_16ACHG6,
7480 	ALC287_FIXUP_CS35L41_I2C_2,
7481 	ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7482 	ALC287_FIXUP_CS35L41_I2C_4,
7483 	ALC245_FIXUP_CS35L41_SPI_2,
7484 	ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7485 	ALC245_FIXUP_CS35L41_SPI_4,
7486 	ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7487 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7488 	ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7489 	ALC287_FIXUP_LEGION_16ITHG6,
7490 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7491 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7492 	ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7493 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7494 	ALC236_FIXUP_DELL_DUAL_CODECS,
7495 	ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7496 	ALC287_FIXUP_TAS2781_I2C,
7497 	ALC287_FIXUP_YOGA7_14ARB7_I2C,
7498 	ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7499 	ALC245_FIXUP_HP_X360_MUTE_LEDS,
7500 	ALC287_FIXUP_THINKPAD_I2S_SPK,
7501 	ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7502 	ALC2XX_FIXUP_HEADSET_MIC,
7503 	ALC289_FIXUP_DELL_CS35L41_SPI_2,
7504 	ALC294_FIXUP_CS35L41_I2C_2,
7505 	ALC245_FIXUP_CS35L56_SPI_4_HP_GPIO_LED,
7506 	ALC256_FIXUP_ACER_SFG16_MICMUTE_LED,
7507 	ALC256_FIXUP_HEADPHONE_AMP_VOL,
7508 	ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX,
7509 	ALC285_FIXUP_CS35L56_SPI_2,
7510 	ALC285_FIXUP_CS35L56_I2C_2,
7511 	ALC285_FIXUP_CS35L56_I2C_4,
7512 	ALC285_FIXUP_ASUS_GA403U,
7513 	ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC,
7514 	ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1,
7515 	ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
7516 	ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1,
7517 	ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318,
7518 };
7519 
7520 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7521  * both have the very same PCI SSID, and we need to apply different fixups
7522  * depending on the codec ID
7523  */
7524 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7525 					   const struct hda_fixup *fix,
7526 					   int action)
7527 {
7528 	int id;
7529 
7530 	if (codec->core.vendor_id == 0x10ec0298)
7531 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7532 	else
7533 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7534 	__snd_hda_apply_fixup(codec, id, action, 0);
7535 }
7536 
7537 /* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
7538  * 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
7539  * so we need to apply a different fixup in this case. The only DuetITL codec
7540  * SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
7541  * and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
7542  * have matched correctly by their codecs.
7543  */
7544 static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
7545 					      const struct hda_fixup *fix,
7546 					      int action)
7547 {
7548 	int id;
7549 
7550 	if (codec->core.subsystem_id == 0x17aa3802)
7551 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
7552 	else
7553 		id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
7554 	__snd_hda_apply_fixup(codec, id, action, 0);
7555 }
7556 
7557 /* Another hilarious PCI SSID conflict with Lenovo Legion Pro 7 16ARX8H (with
7558  * TAS2781 codec) and Legion 7i 16IAX7 (with CS35L41 codec);
7559  * we apply a corresponding fixup depending on the codec SSID instead
7560  */
7561 static void alc287_fixup_lenovo_legion_7(struct hda_codec *codec,
7562 					 const struct hda_fixup *fix,
7563 					 int action)
7564 {
7565 	int id;
7566 
7567 	if (codec->core.subsystem_id == 0x17aa38a8)
7568 		id = ALC287_FIXUP_TAS2781_I2C; /* Legion Pro 7 16ARX8H */
7569 	else
7570 		id = ALC287_FIXUP_CS35L41_I2C_2; /* Legion 7i 16IAX7 */
7571 	__snd_hda_apply_fixup(codec, id, action, 0);
7572 }
7573 
7574 static const struct hda_fixup alc269_fixups[] = {
7575 	[ALC269_FIXUP_GPIO2] = {
7576 		.type = HDA_FIXUP_FUNC,
7577 		.v.func = alc_fixup_gpio2,
7578 	},
7579 	[ALC269_FIXUP_SONY_VAIO] = {
7580 		.type = HDA_FIXUP_PINCTLS,
7581 		.v.pins = (const struct hda_pintbl[]) {
7582 			{0x19, PIN_VREFGRD},
7583 			{}
7584 		}
7585 	},
7586 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7587 		.type = HDA_FIXUP_FUNC,
7588 		.v.func = alc275_fixup_gpio4_off,
7589 		.chained = true,
7590 		.chain_id = ALC269_FIXUP_SONY_VAIO
7591 	},
7592 	[ALC269_FIXUP_DELL_M101Z] = {
7593 		.type = HDA_FIXUP_VERBS,
7594 		.v.verbs = (const struct hda_verb[]) {
7595 			/* Enables internal speaker */
7596 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
7597 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7598 			{}
7599 		}
7600 	},
7601 	[ALC269_FIXUP_SKU_IGNORE] = {
7602 		.type = HDA_FIXUP_FUNC,
7603 		.v.func = alc_fixup_sku_ignore,
7604 	},
7605 	[ALC269_FIXUP_ASUS_G73JW] = {
7606 		.type = HDA_FIXUP_PINS,
7607 		.v.pins = (const struct hda_pintbl[]) {
7608 			{ 0x17, 0x99130111 }, /* subwoofer */
7609 			{ }
7610 		}
7611 	},
7612 	[ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7613 		.type = HDA_FIXUP_PINS,
7614 		.v.pins = (const struct hda_pintbl[]) {
7615 			{ 0x19, 0x03A11050 },
7616 			{ 0x1a, 0x03A11C30 },
7617 			{ 0x21, 0x03211420 },
7618 			{ }
7619 		}
7620 	},
7621 	[ALC269_FIXUP_ASUS_N7601ZM] = {
7622 		.type = HDA_FIXUP_VERBS,
7623 		.v.verbs = (const struct hda_verb[]) {
7624 			{0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7625 			{0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7626 			{0x20, AC_VERB_SET_COEF_INDEX, 0x10},
7627 			{0x20, AC_VERB_SET_PROC_COEF, 0x8420},
7628 			{0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
7629 			{0x20, AC_VERB_SET_PROC_COEF, 0x7774},
7630 			{ }
7631 		},
7632 		.chained = true,
7633 		.chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
7634 	},
7635 	[ALC269_FIXUP_LENOVO_EAPD] = {
7636 		.type = HDA_FIXUP_VERBS,
7637 		.v.verbs = (const struct hda_verb[]) {
7638 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7639 			{}
7640 		}
7641 	},
7642 	[ALC275_FIXUP_SONY_HWEQ] = {
7643 		.type = HDA_FIXUP_FUNC,
7644 		.v.func = alc269_fixup_hweq,
7645 		.chained = true,
7646 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7647 	},
7648 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7649 		.type = HDA_FIXUP_FUNC,
7650 		.v.func = alc_fixup_disable_aamix,
7651 		.chained = true,
7652 		.chain_id = ALC269_FIXUP_SONY_VAIO
7653 	},
7654 	[ALC271_FIXUP_DMIC] = {
7655 		.type = HDA_FIXUP_FUNC,
7656 		.v.func = alc271_fixup_dmic,
7657 	},
7658 	[ALC269_FIXUP_PCM_44K] = {
7659 		.type = HDA_FIXUP_FUNC,
7660 		.v.func = alc269_fixup_pcm_44k,
7661 		.chained = true,
7662 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7663 	},
7664 	[ALC269_FIXUP_STEREO_DMIC] = {
7665 		.type = HDA_FIXUP_FUNC,
7666 		.v.func = alc269_fixup_stereo_dmic,
7667 	},
7668 	[ALC269_FIXUP_HEADSET_MIC] = {
7669 		.type = HDA_FIXUP_FUNC,
7670 		.v.func = alc269_fixup_headset_mic,
7671 	},
7672 	[ALC269_FIXUP_QUANTA_MUTE] = {
7673 		.type = HDA_FIXUP_FUNC,
7674 		.v.func = alc269_fixup_quanta_mute,
7675 	},
7676 	[ALC269_FIXUP_LIFEBOOK] = {
7677 		.type = HDA_FIXUP_PINS,
7678 		.v.pins = (const struct hda_pintbl[]) {
7679 			{ 0x1a, 0x2101103f }, /* dock line-out */
7680 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
7681 			{ }
7682 		},
7683 		.chained = true,
7684 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7685 	},
7686 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7687 		.type = HDA_FIXUP_PINS,
7688 		.v.pins = (const struct hda_pintbl[]) {
7689 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7690 			{ }
7691 		},
7692 	},
7693 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7694 		.type = HDA_FIXUP_PINS,
7695 		.v.pins = (const struct hda_pintbl[]) {
7696 			{ 0x21, 0x0221102f }, /* HP out */
7697 			{ }
7698 		},
7699 	},
7700 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7701 		.type = HDA_FIXUP_FUNC,
7702 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7703 	},
7704 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7705 		.type = HDA_FIXUP_FUNC,
7706 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7707 	},
7708 	[ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
7709 		.type = HDA_FIXUP_PINS,
7710 		.v.pins = (const struct hda_pintbl[]) {
7711 			{ 0x18, 0x03a19020 }, /* headset mic */
7712 			{ 0x1b, 0x90170150 }, /* speaker */
7713 			{ }
7714 		},
7715 	},
7716 	[ALC269_FIXUP_AMIC] = {
7717 		.type = HDA_FIXUP_PINS,
7718 		.v.pins = (const struct hda_pintbl[]) {
7719 			{ 0x14, 0x99130110 }, /* speaker */
7720 			{ 0x15, 0x0121401f }, /* HP out */
7721 			{ 0x18, 0x01a19c20 }, /* mic */
7722 			{ 0x19, 0x99a3092f }, /* int-mic */
7723 			{ }
7724 		},
7725 	},
7726 	[ALC269_FIXUP_DMIC] = {
7727 		.type = HDA_FIXUP_PINS,
7728 		.v.pins = (const struct hda_pintbl[]) {
7729 			{ 0x12, 0x99a3092f }, /* int-mic */
7730 			{ 0x14, 0x99130110 }, /* speaker */
7731 			{ 0x15, 0x0121401f }, /* HP out */
7732 			{ 0x18, 0x01a19c20 }, /* mic */
7733 			{ }
7734 		},
7735 	},
7736 	[ALC269VB_FIXUP_AMIC] = {
7737 		.type = HDA_FIXUP_PINS,
7738 		.v.pins = (const struct hda_pintbl[]) {
7739 			{ 0x14, 0x99130110 }, /* speaker */
7740 			{ 0x18, 0x01a19c20 }, /* mic */
7741 			{ 0x19, 0x99a3092f }, /* int-mic */
7742 			{ 0x21, 0x0121401f }, /* HP out */
7743 			{ }
7744 		},
7745 	},
7746 	[ALC269VB_FIXUP_DMIC] = {
7747 		.type = HDA_FIXUP_PINS,
7748 		.v.pins = (const struct hda_pintbl[]) {
7749 			{ 0x12, 0x99a3092f }, /* int-mic */
7750 			{ 0x14, 0x99130110 }, /* speaker */
7751 			{ 0x18, 0x01a19c20 }, /* mic */
7752 			{ 0x21, 0x0121401f }, /* HP out */
7753 			{ }
7754 		},
7755 	},
7756 	[ALC269_FIXUP_HP_MUTE_LED] = {
7757 		.type = HDA_FIXUP_FUNC,
7758 		.v.func = alc269_fixup_hp_mute_led,
7759 	},
7760 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7761 		.type = HDA_FIXUP_FUNC,
7762 		.v.func = alc269_fixup_hp_mute_led_mic1,
7763 	},
7764 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7765 		.type = HDA_FIXUP_FUNC,
7766 		.v.func = alc269_fixup_hp_mute_led_mic2,
7767 	},
7768 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7769 		.type = HDA_FIXUP_FUNC,
7770 		.v.func = alc269_fixup_hp_mute_led_mic3,
7771 		.chained = true,
7772 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7773 	},
7774 	[ALC269_FIXUP_HP_GPIO_LED] = {
7775 		.type = HDA_FIXUP_FUNC,
7776 		.v.func = alc269_fixup_hp_gpio_led,
7777 	},
7778 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7779 		.type = HDA_FIXUP_FUNC,
7780 		.v.func = alc269_fixup_hp_gpio_mic1_led,
7781 	},
7782 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7783 		.type = HDA_FIXUP_FUNC,
7784 		.v.func = alc269_fixup_hp_line1_mic1_led,
7785 	},
7786 	[ALC269_FIXUP_INV_DMIC] = {
7787 		.type = HDA_FIXUP_FUNC,
7788 		.v.func = alc_fixup_inv_dmic,
7789 	},
7790 	[ALC269_FIXUP_NO_SHUTUP] = {
7791 		.type = HDA_FIXUP_FUNC,
7792 		.v.func = alc_fixup_no_shutup,
7793 	},
7794 	[ALC269_FIXUP_LENOVO_DOCK] = {
7795 		.type = HDA_FIXUP_PINS,
7796 		.v.pins = (const struct hda_pintbl[]) {
7797 			{ 0x19, 0x23a11040 }, /* dock mic */
7798 			{ 0x1b, 0x2121103f }, /* dock headphone */
7799 			{ }
7800 		},
7801 		.chained = true,
7802 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7803 	},
7804 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7805 		.type = HDA_FIXUP_FUNC,
7806 		.v.func = alc269_fixup_limit_int_mic_boost,
7807 		.chained = true,
7808 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
7809 	},
7810 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7811 		.type = HDA_FIXUP_FUNC,
7812 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7813 		.chained = true,
7814 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7815 	},
7816 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7817 		.type = HDA_FIXUP_PINS,
7818 		.v.pins = (const struct hda_pintbl[]) {
7819 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7820 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7821 			{ }
7822 		},
7823 		.chained = true,
7824 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7825 	},
7826 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7827 		.type = HDA_FIXUP_PINS,
7828 		.v.pins = (const struct hda_pintbl[]) {
7829 			{ 0x16, 0x21014020 }, /* dock line out */
7830 			{ 0x19, 0x21a19030 }, /* dock mic */
7831 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7832 			{ }
7833 		},
7834 		.chained = true,
7835 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7836 	},
7837 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7838 		.type = HDA_FIXUP_PINS,
7839 		.v.pins = (const struct hda_pintbl[]) {
7840 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7841 			{ }
7842 		},
7843 		.chained = true,
7844 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7845 	},
7846 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7847 		.type = HDA_FIXUP_PINS,
7848 		.v.pins = (const struct hda_pintbl[]) {
7849 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7850 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7851 			{ }
7852 		},
7853 		.chained = true,
7854 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7855 	},
7856 	[ALC269_FIXUP_HEADSET_MODE] = {
7857 		.type = HDA_FIXUP_FUNC,
7858 		.v.func = alc_fixup_headset_mode,
7859 		.chained = true,
7860 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7861 	},
7862 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7863 		.type = HDA_FIXUP_FUNC,
7864 		.v.func = alc_fixup_headset_mode_no_hp_mic,
7865 	},
7866 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7867 		.type = HDA_FIXUP_PINS,
7868 		.v.pins = (const struct hda_pintbl[]) {
7869 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7870 			{ }
7871 		},
7872 		.chained = true,
7873 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
7874 	},
7875 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7876 		.type = HDA_FIXUP_PINS,
7877 		.v.pins = (const struct hda_pintbl[]) {
7878 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7879 			{ }
7880 		},
7881 		.chained = true,
7882 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7883 	},
7884 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7885 		.type = HDA_FIXUP_PINS,
7886 		.v.pins = (const struct hda_pintbl[]) {
7887 			{0x12, 0x90a60130},
7888 			{0x13, 0x40000000},
7889 			{0x14, 0x90170110},
7890 			{0x18, 0x411111f0},
7891 			{0x19, 0x04a11040},
7892 			{0x1a, 0x411111f0},
7893 			{0x1b, 0x90170112},
7894 			{0x1d, 0x40759a05},
7895 			{0x1e, 0x411111f0},
7896 			{0x21, 0x04211020},
7897 			{ }
7898 		},
7899 		.chained = true,
7900 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7901 	},
7902 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7903 		.type = HDA_FIXUP_FUNC,
7904 		.v.func = alc298_fixup_huawei_mbx_stereo,
7905 		.chained = true,
7906 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7907 	},
7908 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
7909 		.type = HDA_FIXUP_FUNC,
7910 		.v.func = alc269_fixup_x101_headset_mic,
7911 	},
7912 	[ALC269_FIXUP_ASUS_X101_VERB] = {
7913 		.type = HDA_FIXUP_VERBS,
7914 		.v.verbs = (const struct hda_verb[]) {
7915 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7916 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7917 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
7918 			{ }
7919 		},
7920 		.chained = true,
7921 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7922 	},
7923 	[ALC269_FIXUP_ASUS_X101] = {
7924 		.type = HDA_FIXUP_PINS,
7925 		.v.pins = (const struct hda_pintbl[]) {
7926 			{ 0x18, 0x04a1182c }, /* Headset mic */
7927 			{ }
7928 		},
7929 		.chained = true,
7930 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
7931 	},
7932 	[ALC271_FIXUP_AMIC_MIC2] = {
7933 		.type = HDA_FIXUP_PINS,
7934 		.v.pins = (const struct hda_pintbl[]) {
7935 			{ 0x14, 0x99130110 }, /* speaker */
7936 			{ 0x19, 0x01a19c20 }, /* mic */
7937 			{ 0x1b, 0x99a7012f }, /* int-mic */
7938 			{ 0x21, 0x0121401f }, /* HP out */
7939 			{ }
7940 		},
7941 	},
7942 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7943 		.type = HDA_FIXUP_FUNC,
7944 		.v.func = alc271_hp_gate_mic_jack,
7945 		.chained = true,
7946 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
7947 	},
7948 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7949 		.type = HDA_FIXUP_FUNC,
7950 		.v.func = alc269_fixup_limit_int_mic_boost,
7951 		.chained = true,
7952 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7953 	},
7954 	[ALC269_FIXUP_ACER_AC700] = {
7955 		.type = HDA_FIXUP_PINS,
7956 		.v.pins = (const struct hda_pintbl[]) {
7957 			{ 0x12, 0x99a3092f }, /* int-mic */
7958 			{ 0x14, 0x99130110 }, /* speaker */
7959 			{ 0x18, 0x03a11c20 }, /* mic */
7960 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
7961 			{ 0x21, 0x0321101f }, /* HP out */
7962 			{ }
7963 		},
7964 		.chained = true,
7965 		.chain_id = ALC271_FIXUP_DMIC,
7966 	},
7967 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7968 		.type = HDA_FIXUP_FUNC,
7969 		.v.func = alc269_fixup_limit_int_mic_boost,
7970 		.chained = true,
7971 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7972 	},
7973 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7974 		.type = HDA_FIXUP_FUNC,
7975 		.v.func = alc269_fixup_limit_int_mic_boost,
7976 		.chained = true,
7977 		.chain_id = ALC269VB_FIXUP_DMIC,
7978 	},
7979 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7980 		.type = HDA_FIXUP_VERBS,
7981 		.v.verbs = (const struct hda_verb[]) {
7982 			/* class-D output amp +5dB */
7983 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7984 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7985 			{}
7986 		},
7987 		.chained = true,
7988 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7989 	},
7990 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7991 		.type = HDA_FIXUP_PINS,
7992 		.v.pins = (const struct hda_pintbl[]) {
7993 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
7994 			{ }
7995 		},
7996 		.chained = true,
7997 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7998 	},
7999 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
8000 		.type = HDA_FIXUP_FUNC,
8001 		.v.func = alc269_fixup_limit_int_mic_boost,
8002 		.chained = true,
8003 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
8004 	},
8005 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
8006 		.type = HDA_FIXUP_PINS,
8007 		.v.pins = (const struct hda_pintbl[]) {
8008 			{ 0x12, 0x99a3092f }, /* int-mic */
8009 			{ 0x18, 0x03a11d20 }, /* mic */
8010 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
8011 			{ }
8012 		},
8013 	},
8014 	[ALC283_FIXUP_CHROME_BOOK] = {
8015 		.type = HDA_FIXUP_FUNC,
8016 		.v.func = alc283_fixup_chromebook,
8017 	},
8018 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
8019 		.type = HDA_FIXUP_FUNC,
8020 		.v.func = alc283_fixup_sense_combo_jack,
8021 		.chained = true,
8022 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
8023 	},
8024 	[ALC282_FIXUP_ASUS_TX300] = {
8025 		.type = HDA_FIXUP_FUNC,
8026 		.v.func = alc282_fixup_asus_tx300,
8027 	},
8028 	[ALC283_FIXUP_INT_MIC] = {
8029 		.type = HDA_FIXUP_VERBS,
8030 		.v.verbs = (const struct hda_verb[]) {
8031 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
8032 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
8033 			{ }
8034 		},
8035 		.chained = true,
8036 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8037 	},
8038 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
8039 		.type = HDA_FIXUP_PINS,
8040 		.v.pins = (const struct hda_pintbl[]) {
8041 			{ 0x17, 0x90170112 }, /* subwoofer */
8042 			{ }
8043 		},
8044 		.chained = true,
8045 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
8046 	},
8047 	[ALC290_FIXUP_SUBWOOFER] = {
8048 		.type = HDA_FIXUP_PINS,
8049 		.v.pins = (const struct hda_pintbl[]) {
8050 			{ 0x17, 0x90170112 }, /* subwoofer */
8051 			{ }
8052 		},
8053 		.chained = true,
8054 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
8055 	},
8056 	[ALC290_FIXUP_MONO_SPEAKERS] = {
8057 		.type = HDA_FIXUP_FUNC,
8058 		.v.func = alc290_fixup_mono_speakers,
8059 	},
8060 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8061 		.type = HDA_FIXUP_FUNC,
8062 		.v.func = alc290_fixup_mono_speakers,
8063 		.chained = true,
8064 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8065 	},
8066 	[ALC269_FIXUP_THINKPAD_ACPI] = {
8067 		.type = HDA_FIXUP_FUNC,
8068 		.v.func = alc_fixup_thinkpad_acpi,
8069 		.chained = true,
8070 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
8071 	},
8072 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8073 		.type = HDA_FIXUP_FUNC,
8074 		.v.func = alc_fixup_inv_dmic,
8075 		.chained = true,
8076 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8077 	},
8078 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8079 		.type = HDA_FIXUP_PINS,
8080 		.v.pins = (const struct hda_pintbl[]) {
8081 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8082 			{ }
8083 		},
8084 		.chained = true,
8085 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8086 	},
8087 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8088 		.type = HDA_FIXUP_PINS,
8089 		.v.pins = (const struct hda_pintbl[]) {
8090 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8091 			{ }
8092 		},
8093 		.chained = true,
8094 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8095 	},
8096 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8097 		.type = HDA_FIXUP_PINS,
8098 		.v.pins = (const struct hda_pintbl[]) {
8099 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8100 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8101 			{ }
8102 		},
8103 		.chained = true,
8104 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8105 	},
8106 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8107 		.type = HDA_FIXUP_PINS,
8108 		.v.pins = (const struct hda_pintbl[]) {
8109 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8110 			{ }
8111 		},
8112 		.chained = true,
8113 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8114 	},
8115 	[ALC255_FIXUP_HEADSET_MODE] = {
8116 		.type = HDA_FIXUP_FUNC,
8117 		.v.func = alc_fixup_headset_mode_alc255,
8118 		.chained = true,
8119 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8120 	},
8121 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8122 		.type = HDA_FIXUP_FUNC,
8123 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8124 	},
8125 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8126 		.type = HDA_FIXUP_PINS,
8127 		.v.pins = (const struct hda_pintbl[]) {
8128 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8129 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8130 			{ }
8131 		},
8132 		.chained = true,
8133 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8134 	},
8135 	[ALC292_FIXUP_TPT440_DOCK] = {
8136 		.type = HDA_FIXUP_FUNC,
8137 		.v.func = alc_fixup_tpt440_dock,
8138 		.chained = true,
8139 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8140 	},
8141 	[ALC292_FIXUP_TPT440] = {
8142 		.type = HDA_FIXUP_FUNC,
8143 		.v.func = alc_fixup_disable_aamix,
8144 		.chained = true,
8145 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
8146 	},
8147 	[ALC283_FIXUP_HEADSET_MIC] = {
8148 		.type = HDA_FIXUP_PINS,
8149 		.v.pins = (const struct hda_pintbl[]) {
8150 			{ 0x19, 0x04a110f0 },
8151 			{ },
8152 		},
8153 	},
8154 	[ALC255_FIXUP_MIC_MUTE_LED] = {
8155 		.type = HDA_FIXUP_FUNC,
8156 		.v.func = alc_fixup_micmute_led,
8157 	},
8158 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
8159 		.type = HDA_FIXUP_PINS,
8160 		.v.pins = (const struct hda_pintbl[]) {
8161 			{ 0x12, 0x90a60130 },
8162 			{ 0x14, 0x90170110 },
8163 			{ 0x17, 0x40000008 },
8164 			{ 0x18, 0x411111f0 },
8165 			{ 0x19, 0x01a1913c },
8166 			{ 0x1a, 0x411111f0 },
8167 			{ 0x1b, 0x411111f0 },
8168 			{ 0x1d, 0x40f89b2d },
8169 			{ 0x1e, 0x411111f0 },
8170 			{ 0x21, 0x0321101f },
8171 			{ },
8172 		},
8173 	},
8174 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8175 		.type = HDA_FIXUP_FUNC,
8176 		.v.func = alc269vb_fixup_aspire_e1_coef,
8177 	},
8178 	[ALC280_FIXUP_HP_GPIO4] = {
8179 		.type = HDA_FIXUP_FUNC,
8180 		.v.func = alc280_fixup_hp_gpio4,
8181 	},
8182 	[ALC286_FIXUP_HP_GPIO_LED] = {
8183 		.type = HDA_FIXUP_FUNC,
8184 		.v.func = alc286_fixup_hp_gpio_led,
8185 	},
8186 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8187 		.type = HDA_FIXUP_FUNC,
8188 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8189 	},
8190 	[ALC280_FIXUP_HP_DOCK_PINS] = {
8191 		.type = HDA_FIXUP_PINS,
8192 		.v.pins = (const struct hda_pintbl[]) {
8193 			{ 0x1b, 0x21011020 }, /* line-out */
8194 			{ 0x1a, 0x01a1903c }, /* headset mic */
8195 			{ 0x18, 0x2181103f }, /* line-in */
8196 			{ },
8197 		},
8198 		.chained = true,
8199 		.chain_id = ALC280_FIXUP_HP_GPIO4
8200 	},
8201 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8202 		.type = HDA_FIXUP_PINS,
8203 		.v.pins = (const struct hda_pintbl[]) {
8204 			{ 0x1b, 0x21011020 }, /* line-out */
8205 			{ 0x18, 0x2181103f }, /* line-in */
8206 			{ },
8207 		},
8208 		.chained = true,
8209 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8210 	},
8211 	[ALC280_FIXUP_HP_9480M] = {
8212 		.type = HDA_FIXUP_FUNC,
8213 		.v.func = alc280_fixup_hp_9480m,
8214 	},
8215 	[ALC245_FIXUP_HP_X360_AMP] = {
8216 		.type = HDA_FIXUP_FUNC,
8217 		.v.func = alc245_fixup_hp_x360_amp,
8218 		.chained = true,
8219 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
8220 	},
8221 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
8222 		.type = HDA_FIXUP_FUNC,
8223 		.v.func = alc_fixup_headset_mode_dell_alc288,
8224 		.chained = true,
8225 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8226 	},
8227 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8228 		.type = HDA_FIXUP_PINS,
8229 		.v.pins = (const struct hda_pintbl[]) {
8230 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8231 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8232 			{ }
8233 		},
8234 		.chained = true,
8235 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8236 	},
8237 	[ALC288_FIXUP_DISABLE_AAMIX] = {
8238 		.type = HDA_FIXUP_FUNC,
8239 		.v.func = alc_fixup_disable_aamix,
8240 		.chained = true,
8241 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8242 	},
8243 	[ALC288_FIXUP_DELL_XPS_13] = {
8244 		.type = HDA_FIXUP_FUNC,
8245 		.v.func = alc_fixup_dell_xps13,
8246 		.chained = true,
8247 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
8248 	},
8249 	[ALC292_FIXUP_DISABLE_AAMIX] = {
8250 		.type = HDA_FIXUP_FUNC,
8251 		.v.func = alc_fixup_disable_aamix,
8252 		.chained = true,
8253 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8254 	},
8255 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8256 		.type = HDA_FIXUP_FUNC,
8257 		.v.func = alc_fixup_disable_aamix,
8258 		.chained = true,
8259 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8260 	},
8261 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
8262 		.type = HDA_FIXUP_FUNC,
8263 		.v.func = alc_fixup_dell_xps13,
8264 		.chained = true,
8265 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
8266 	},
8267 	[ALC292_FIXUP_DELL_E7X] = {
8268 		.type = HDA_FIXUP_FUNC,
8269 		.v.func = alc_fixup_micmute_led,
8270 		/* micmute fixup must be applied at last */
8271 		.chained_before = true,
8272 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8273 	},
8274 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8275 		.type = HDA_FIXUP_PINS,
8276 		.v.pins = (const struct hda_pintbl[]) {
8277 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8278 			{ }
8279 		},
8280 		.chained_before = true,
8281 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8282 	},
8283 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8284 		.type = HDA_FIXUP_PINS,
8285 		.v.pins = (const struct hda_pintbl[]) {
8286 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8287 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8288 			{ }
8289 		},
8290 		.chained = true,
8291 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8292 	},
8293 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8294 		.type = HDA_FIXUP_PINS,
8295 		.v.pins = (const struct hda_pintbl[]) {
8296 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8297 			{ }
8298 		},
8299 		.chained = true,
8300 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8301 	},
8302 	[ALC275_FIXUP_DELL_XPS] = {
8303 		.type = HDA_FIXUP_VERBS,
8304 		.v.verbs = (const struct hda_verb[]) {
8305 			/* Enables internal speaker */
8306 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8307 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8308 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8309 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8310 			{}
8311 		}
8312 	},
8313 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8314 		.type = HDA_FIXUP_FUNC,
8315 		.v.func = alc_fixup_disable_aamix,
8316 		.chained = true,
8317 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8318 	},
8319 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8320 		.type = HDA_FIXUP_FUNC,
8321 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8322 	},
8323 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8324 		.type = HDA_FIXUP_FUNC,
8325 		.v.func = alc_fixup_inv_dmic,
8326 		.chained = true,
8327 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8328 	},
8329 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8330 		.type = HDA_FIXUP_FUNC,
8331 		.v.func = alc269_fixup_limit_int_mic_boost
8332 	},
8333 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
8334 		.type = HDA_FIXUP_FUNC,
8335 		.v.func = alc_fixup_disable_aamix,
8336 		.chained = true,
8337 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8338 	},
8339 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
8340 		.type = HDA_FIXUP_FUNC,
8341 		.v.func = alc_fixup_disable_mic_vref,
8342 		.chained = true,
8343 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8344 	},
8345 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8346 		.type = HDA_FIXUP_VERBS,
8347 		.v.verbs = (const struct hda_verb[]) {
8348 			/* Disable pass-through path for FRONT 14h */
8349 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8350 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8351 			{}
8352 		},
8353 		.chained = true,
8354 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8355 	},
8356 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
8357 		.type = HDA_FIXUP_FUNC,
8358 		.v.func = alc_fixup_disable_aamix,
8359 		.chained = true,
8360 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
8361 	},
8362 	[ALC221_FIXUP_HP_FRONT_MIC] = {
8363 		.type = HDA_FIXUP_PINS,
8364 		.v.pins = (const struct hda_pintbl[]) {
8365 			{ 0x19, 0x02a19020 }, /* Front Mic */
8366 			{ }
8367 		},
8368 	},
8369 	[ALC292_FIXUP_TPT460] = {
8370 		.type = HDA_FIXUP_FUNC,
8371 		.v.func = alc_fixup_tpt440_dock,
8372 		.chained = true,
8373 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8374 	},
8375 	[ALC298_FIXUP_SPK_VOLUME] = {
8376 		.type = HDA_FIXUP_FUNC,
8377 		.v.func = alc298_fixup_speaker_volume,
8378 		.chained = true,
8379 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8380 	},
8381 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8382 		.type = HDA_FIXUP_FUNC,
8383 		.v.func = alc298_fixup_speaker_volume,
8384 	},
8385 	[ALC295_FIXUP_DISABLE_DAC3] = {
8386 		.type = HDA_FIXUP_FUNC,
8387 		.v.func = alc295_fixup_disable_dac3,
8388 	},
8389 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8390 		.type = HDA_FIXUP_FUNC,
8391 		.v.func = alc285_fixup_speaker2_to_dac1,
8392 		.chained = true,
8393 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8394 	},
8395 	[ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8396 		.type = HDA_FIXUP_FUNC,
8397 		.v.func = alc285_fixup_speaker2_to_dac1,
8398 		.chained = true,
8399 		.chain_id = ALC245_FIXUP_CS35L41_SPI_2
8400 	},
8401 	[ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8402 		.type = HDA_FIXUP_PINS,
8403 		.v.pins = (const struct hda_pintbl[]) {
8404 			{ 0x19, 0x03a11050 },
8405 			{ 0x1b, 0x03a11c30 },
8406 			{ }
8407 		},
8408 		.chained = true,
8409 		.chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8410 	},
8411 	[ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8412 		.type = HDA_FIXUP_PINS,
8413 		.v.pins = (const struct hda_pintbl[]) {
8414 			{ 0x14, 0x90170120 },
8415 			{ }
8416 		},
8417 		.chained = true,
8418 		.chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8419 	},
8420 	[ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8421 		.type = HDA_FIXUP_FUNC,
8422 		.v.func = alc285_fixup_speaker2_to_dac1,
8423 		.chained = true,
8424 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2
8425 	},
8426 	[ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8427 		.type = HDA_FIXUP_PINS,
8428 		.v.pins = (const struct hda_pintbl[]) {
8429 			{ 0x19, 0x03a11050 },
8430 			{ 0x1b, 0x03a11c30 },
8431 			{ }
8432 		},
8433 		.chained = true,
8434 		.chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8435 	},
8436 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8437 		.type = HDA_FIXUP_PINS,
8438 		.v.pins = (const struct hda_pintbl[]) {
8439 			{ 0x1b, 0x90170151 },
8440 			{ }
8441 		},
8442 		.chained = true,
8443 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8444 	},
8445 	[ALC269_FIXUP_ATIV_BOOK_8] = {
8446 		.type = HDA_FIXUP_FUNC,
8447 		.v.func = alc_fixup_auto_mute_via_amp,
8448 		.chained = true,
8449 		.chain_id = ALC269_FIXUP_NO_SHUTUP
8450 	},
8451 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8452 		.type = HDA_FIXUP_PINS,
8453 		.v.pins = (const struct hda_pintbl[]) {
8454 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8455 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8456 			{ }
8457 		},
8458 		.chained = true,
8459 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8460 	},
8461 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8462 		.type = HDA_FIXUP_PINS,
8463 		.v.pins = (const struct hda_pintbl[]) {
8464 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8465 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8466 			{ }
8467 		},
8468 		.chained = true,
8469 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8470 	},
8471 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8472 		.type = HDA_FIXUP_FUNC,
8473 		.v.func = alc_fixup_headset_mode,
8474 	},
8475 	[ALC256_FIXUP_ASUS_MIC] = {
8476 		.type = HDA_FIXUP_PINS,
8477 		.v.pins = (const struct hda_pintbl[]) {
8478 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8479 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8480 			{ }
8481 		},
8482 		.chained = true,
8483 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8484 	},
8485 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8486 		.type = HDA_FIXUP_FUNC,
8487 		/* Set up GPIO2 for the speaker amp */
8488 		.v.func = alc_fixup_gpio4,
8489 	},
8490 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8491 		.type = HDA_FIXUP_PINS,
8492 		.v.pins = (const struct hda_pintbl[]) {
8493 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8494 			{ }
8495 		},
8496 		.chained = true,
8497 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8498 	},
8499 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8500 		.type = HDA_FIXUP_VERBS,
8501 		.v.verbs = (const struct hda_verb[]) {
8502 			/* Enables internal speaker */
8503 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8504 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8505 			{}
8506 		},
8507 		.chained = true,
8508 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8509 	},
8510 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8511 		.type = HDA_FIXUP_FUNC,
8512 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8513 		.chained = true,
8514 		.chain_id = ALC269_FIXUP_GPIO2
8515 	},
8516 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
8517 		.type = HDA_FIXUP_VERBS,
8518 		.v.verbs = (const struct hda_verb[]) {
8519 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8520 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8521 			{ }
8522 		},
8523 		.chained = true,
8524 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8525 	},
8526 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8527 		.type = HDA_FIXUP_PINS,
8528 		.v.pins = (const struct hda_pintbl[]) {
8529 			/* Change the mic location from front to right, otherwise there are
8530 			   two front mics with the same name, pulseaudio can't handle them.
8531 			   This is just a temporary workaround, after applying this fixup,
8532 			   there will be one "Front Mic" and one "Mic" in this machine.
8533 			 */
8534 			{ 0x1a, 0x04a19040 },
8535 			{ }
8536 		},
8537 	},
8538 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8539 		.type = HDA_FIXUP_PINS,
8540 		.v.pins = (const struct hda_pintbl[]) {
8541 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
8542 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8543 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8544 			{ 0x1b, 0x02011020 },
8545 			{ }
8546 		},
8547 		.chained = true,
8548 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
8549 	},
8550 	[ALC225_FIXUP_S3_POP_NOISE] = {
8551 		.type = HDA_FIXUP_FUNC,
8552 		.v.func = alc225_fixup_s3_pop_noise,
8553 		.chained = true,
8554 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8555 	},
8556 	[ALC700_FIXUP_INTEL_REFERENCE] = {
8557 		.type = HDA_FIXUP_VERBS,
8558 		.v.verbs = (const struct hda_verb[]) {
8559 			/* Enables internal speaker */
8560 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8561 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8562 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8563 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8564 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8565 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8566 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8567 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8568 			{}
8569 		}
8570 	},
8571 	[ALC274_FIXUP_DELL_BIND_DACS] = {
8572 		.type = HDA_FIXUP_FUNC,
8573 		.v.func = alc274_fixup_bind_dacs,
8574 		.chained = true,
8575 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8576 	},
8577 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8578 		.type = HDA_FIXUP_PINS,
8579 		.v.pins = (const struct hda_pintbl[]) {
8580 			{ 0x1b, 0x0401102f },
8581 			{ }
8582 		},
8583 		.chained = true,
8584 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
8585 	},
8586 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
8587 		.type = HDA_FIXUP_FUNC,
8588 		.v.func = alc_fixup_tpt470_dock,
8589 		.chained = true,
8590 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8591 	},
8592 	[ALC298_FIXUP_TPT470_DOCK] = {
8593 		.type = HDA_FIXUP_FUNC,
8594 		.v.func = alc_fixup_tpt470_dacs,
8595 		.chained = true,
8596 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8597 	},
8598 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8599 		.type = HDA_FIXUP_PINS,
8600 		.v.pins = (const struct hda_pintbl[]) {
8601 			{ 0x14, 0x0201101f },
8602 			{ }
8603 		},
8604 		.chained = true,
8605 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8606 	},
8607 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
8608 		.type = HDA_FIXUP_PINS,
8609 		.v.pins = (const struct hda_pintbl[]) {
8610 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8611 			{ }
8612 		},
8613 		.chained = true,
8614 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8615 	},
8616 	[ALC295_FIXUP_HP_X360] = {
8617 		.type = HDA_FIXUP_FUNC,
8618 		.v.func = alc295_fixup_hp_top_speakers,
8619 		.chained = true,
8620 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8621 	},
8622 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
8623 		.type = HDA_FIXUP_PINS,
8624 		.v.pins = (const struct hda_pintbl[]) {
8625 			{ 0x19, 0x0181313f},
8626 			{ }
8627 		},
8628 		.chained = true,
8629 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8630 	},
8631 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8632 		.type = HDA_FIXUP_FUNC,
8633 		.v.func = alc285_fixup_invalidate_dacs,
8634 		.chained = true,
8635 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8636 	},
8637 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
8638 		.type = HDA_FIXUP_FUNC,
8639 		.v.func = alc_fixup_auto_mute_via_amp,
8640 	},
8641 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8642 		.type = HDA_FIXUP_PINS,
8643 		.v.pins = (const struct hda_pintbl[]) {
8644 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8645 			{ }
8646 		},
8647 		.chained = true,
8648 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8649 	},
8650 	[ALC294_FIXUP_ASUS_MIC] = {
8651 		.type = HDA_FIXUP_PINS,
8652 		.v.pins = (const struct hda_pintbl[]) {
8653 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8654 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8655 			{ }
8656 		},
8657 		.chained = true,
8658 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8659 	},
8660 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8661 		.type = HDA_FIXUP_PINS,
8662 		.v.pins = (const struct hda_pintbl[]) {
8663 			{ 0x19, 0x01a1103c }, /* use as headset mic */
8664 			{ }
8665 		},
8666 		.chained = true,
8667 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8668 	},
8669 	[ALC294_FIXUP_ASUS_SPK] = {
8670 		.type = HDA_FIXUP_VERBS,
8671 		.v.verbs = (const struct hda_verb[]) {
8672 			/* Set EAPD high */
8673 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8674 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8675 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8676 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8677 			{ }
8678 		},
8679 		.chained = true,
8680 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8681 	},
8682 	[ALC295_FIXUP_CHROME_BOOK] = {
8683 		.type = HDA_FIXUP_FUNC,
8684 		.v.func = alc295_fixup_chromebook,
8685 		.chained = true,
8686 		.chain_id = ALC225_FIXUP_HEADSET_JACK
8687 	},
8688 	[ALC225_FIXUP_HEADSET_JACK] = {
8689 		.type = HDA_FIXUP_FUNC,
8690 		.v.func = alc_fixup_headset_jack,
8691 	},
8692 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8693 		.type = HDA_FIXUP_PINS,
8694 		.v.pins = (const struct hda_pintbl[]) {
8695 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8696 			{ }
8697 		},
8698 		.chained = true,
8699 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8700 	},
8701 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8702 		.type = HDA_FIXUP_VERBS,
8703 		.v.verbs = (const struct hda_verb[]) {
8704 			/* Disable PCBEEP-IN passthrough */
8705 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8706 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8707 			{ }
8708 		},
8709 		.chained = true,
8710 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8711 	},
8712 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
8713 		.type = HDA_FIXUP_PINS,
8714 		.v.pins = (const struct hda_pintbl[]) {
8715 			{ 0x19, 0x03a11130 },
8716 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
8717 			{ }
8718 		},
8719 		.chained = true,
8720 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8721 	},
8722 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8723 		.type = HDA_FIXUP_PINS,
8724 		.v.pins = (const struct hda_pintbl[]) {
8725 			{ 0x16, 0x01011020 }, /* Rear Line out */
8726 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8727 			{ }
8728 		},
8729 		.chained = true,
8730 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8731 	},
8732 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8733 		.type = HDA_FIXUP_FUNC,
8734 		.v.func = alc_fixup_auto_mute_via_amp,
8735 		.chained = true,
8736 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8737 	},
8738 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8739 		.type = HDA_FIXUP_FUNC,
8740 		.v.func = alc_fixup_disable_mic_vref,
8741 		.chained = true,
8742 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8743 	},
8744 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8745 		.type = HDA_FIXUP_VERBS,
8746 		.v.verbs = (const struct hda_verb[]) {
8747 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8748 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8749 			{ }
8750 		},
8751 		.chained = true,
8752 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8753 	},
8754 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8755 		.type = HDA_FIXUP_PINS,
8756 		.v.pins = (const struct hda_pintbl[]) {
8757 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
8758 			{ }
8759 		},
8760 		.chained = true,
8761 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8762 	},
8763 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8764 		.type = HDA_FIXUP_PINS,
8765 		.v.pins = (const struct hda_pintbl[]) {
8766 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8767 			{ }
8768 		},
8769 		.chained = true,
8770 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8771 	},
8772 	[ALC299_FIXUP_PREDATOR_SPK] = {
8773 		.type = HDA_FIXUP_PINS,
8774 		.v.pins = (const struct hda_pintbl[]) {
8775 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8776 			{ }
8777 		}
8778 	},
8779 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8780 		.type = HDA_FIXUP_PINS,
8781 		.v.pins = (const struct hda_pintbl[]) {
8782 			{ 0x19, 0x04a11040 },
8783 			{ 0x21, 0x04211020 },
8784 			{ }
8785 		},
8786 		.chained = true,
8787 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8788 	},
8789 	[ALC289_FIXUP_DELL_SPK1] = {
8790 		.type = HDA_FIXUP_PINS,
8791 		.v.pins = (const struct hda_pintbl[]) {
8792 			{ 0x14, 0x90170140 },
8793 			{ }
8794 		},
8795 		.chained = true,
8796 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8797 	},
8798 	[ALC289_FIXUP_DELL_SPK2] = {
8799 		.type = HDA_FIXUP_PINS,
8800 		.v.pins = (const struct hda_pintbl[]) {
8801 			{ 0x17, 0x90170130 }, /* bass spk */
8802 			{ }
8803 		},
8804 		.chained = true,
8805 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8806 	},
8807 	[ALC289_FIXUP_DUAL_SPK] = {
8808 		.type = HDA_FIXUP_FUNC,
8809 		.v.func = alc285_fixup_speaker2_to_dac1,
8810 		.chained = true,
8811 		.chain_id = ALC289_FIXUP_DELL_SPK2
8812 	},
8813 	[ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
8814 		.type = HDA_FIXUP_FUNC,
8815 		.v.func = alc285_fixup_speaker2_to_dac1,
8816 		.chained = true,
8817 		.chain_id = ALC289_FIXUP_DELL_SPK1
8818 	},
8819 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
8820 		.type = HDA_FIXUP_FUNC,
8821 		.v.func = alc285_fixup_speaker2_to_dac1,
8822 		.chained = true,
8823 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8824 	},
8825 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
8826 		.type = HDA_FIXUP_FUNC,
8827 		/* The GPIO must be pulled to initialize the AMP */
8828 		.v.func = alc_fixup_gpio4,
8829 		.chained = true,
8830 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8831 	},
8832 	[ALC294_FIXUP_ASUS_ALLY] = {
8833 		.type = HDA_FIXUP_FUNC,
8834 		.v.func = cs35l41_fixup_i2c_two,
8835 		.chained = true,
8836 		.chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
8837 	},
8838 	[ALC294_FIXUP_ASUS_ALLY_PINS] = {
8839 		.type = HDA_FIXUP_PINS,
8840 		.v.pins = (const struct hda_pintbl[]) {
8841 			{ 0x19, 0x03a11050 },
8842 			{ 0x1a, 0x03a11c30 },
8843 			{ 0x21, 0x03211420 },
8844 			{ }
8845 		},
8846 		.chained = true,
8847 		.chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
8848 	},
8849 	[ALC294_FIXUP_ASUS_ALLY_VERBS] = {
8850 		.type = HDA_FIXUP_VERBS,
8851 		.v.verbs = (const struct hda_verb[]) {
8852 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8853 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8854 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
8855 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
8856 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
8857 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
8858 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
8859 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
8860 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
8861 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
8862 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
8863 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
8864 			{ }
8865 		},
8866 		.chained = true,
8867 		.chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
8868 	},
8869 	[ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
8870 		.type = HDA_FIXUP_FUNC,
8871 		.v.func = alc285_fixup_speaker2_to_dac1,
8872 	},
8873 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8874 		.type = HDA_FIXUP_FUNC,
8875 		.v.func = alc285_fixup_thinkpad_x1_gen7,
8876 		.chained = true,
8877 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8878 	},
8879 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8880 		.type = HDA_FIXUP_FUNC,
8881 		.v.func = alc_fixup_headset_jack,
8882 		.chained = true,
8883 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8884 	},
8885 	[ALC294_FIXUP_ASUS_HPE] = {
8886 		.type = HDA_FIXUP_VERBS,
8887 		.v.verbs = (const struct hda_verb[]) {
8888 			/* Set EAPD high */
8889 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8890 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8891 			{ }
8892 		},
8893 		.chained = true,
8894 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8895 	},
8896 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
8897 		.type = HDA_FIXUP_PINS,
8898 		.v.pins = (const struct hda_pintbl[]) {
8899 			{ 0x19, 0x03a11050 }, /* front HP mic */
8900 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8901 			{ 0x21, 0x03211020 }, /* front HP out */
8902 			{ }
8903 		},
8904 		.chained = true,
8905 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8906 	},
8907 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
8908 		.type = HDA_FIXUP_VERBS,
8909 		.v.verbs = (const struct hda_verb[]) {
8910 			/* set 0x15 to HP-OUT ctrl */
8911 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8912 			/* unmute the 0x15 amp */
8913 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8914 			{ }
8915 		},
8916 		.chained = true,
8917 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
8918 	},
8919 	[ALC294_FIXUP_ASUS_GX502_HP] = {
8920 		.type = HDA_FIXUP_FUNC,
8921 		.v.func = alc294_fixup_gx502_hp,
8922 	},
8923 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
8924 		.type = HDA_FIXUP_PINS,
8925 		.v.pins = (const struct hda_pintbl[]) {
8926 			{ 0x19, 0x01a11050 }, /* rear HP mic */
8927 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8928 			{ 0x21, 0x012110f0 }, /* rear HP out */
8929 			{ }
8930 		},
8931 		.chained = true,
8932 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8933 	},
8934 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
8935 		.type = HDA_FIXUP_VERBS,
8936 		.v.verbs = (const struct hda_verb[]) {
8937 			/* set 0x15 to HP-OUT ctrl */
8938 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8939 			/* unmute the 0x15 amp */
8940 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8941 			/* set 0x1b to HP-OUT */
8942 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8943 			{ }
8944 		},
8945 		.chained = true,
8946 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
8947 	},
8948 	[ALC294_FIXUP_ASUS_GU502_HP] = {
8949 		.type = HDA_FIXUP_FUNC,
8950 		.v.func = alc294_fixup_gu502_hp,
8951 	},
8952 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
8953 		.type = HDA_FIXUP_PINS,
8954 		.v.pins = (const struct hda_pintbl[]) {
8955 				{ 0x19, 0x03a11050 }, /* front HP mic */
8956 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
8957 				{ 0x21, 0x03211420 }, /* front HP out */
8958 				{ }
8959 		},
8960 	},
8961 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
8962 		.type = HDA_FIXUP_PINS,
8963 		.v.pins = (const struct hda_pintbl[]) {
8964 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
8965 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
8966 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
8967 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
8968 			{ 0x21, 0x03211420 },
8969 			{ }
8970 		},
8971 	},
8972 	[ALC294_FIXUP_ASUS_COEF_1B] = {
8973 		.type = HDA_FIXUP_VERBS,
8974 		.v.verbs = (const struct hda_verb[]) {
8975 			/* Set bit 10 to correct noisy output after reboot from
8976 			 * Windows 10 (due to pop noise reduction?)
8977 			 */
8978 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8979 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8980 			{ }
8981 		},
8982 		.chained = true,
8983 		.chain_id = ALC289_FIXUP_ASUS_GA401,
8984 	},
8985 	[ALC285_FIXUP_HP_GPIO_LED] = {
8986 		.type = HDA_FIXUP_FUNC,
8987 		.v.func = alc285_fixup_hp_gpio_led,
8988 	},
8989 	[ALC285_FIXUP_HP_MUTE_LED] = {
8990 		.type = HDA_FIXUP_FUNC,
8991 		.v.func = alc285_fixup_hp_mute_led,
8992 	},
8993 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
8994 		.type = HDA_FIXUP_FUNC,
8995 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
8996 	},
8997 	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
8998 	    .type = HDA_FIXUP_FUNC,
8999 	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
9000 	},
9001 	[ALC236_FIXUP_HP_GPIO_LED] = {
9002 		.type = HDA_FIXUP_FUNC,
9003 		.v.func = alc236_fixup_hp_gpio_led,
9004 	},
9005 	[ALC236_FIXUP_HP_MUTE_LED] = {
9006 		.type = HDA_FIXUP_FUNC,
9007 		.v.func = alc236_fixup_hp_mute_led,
9008 	},
9009 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
9010 		.type = HDA_FIXUP_FUNC,
9011 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
9012 	},
9013 	[ALC298_FIXUP_SAMSUNG_AMP] = {
9014 		.type = HDA_FIXUP_FUNC,
9015 		.v.func = alc298_fixup_samsung_amp,
9016 		.chained = true,
9017 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
9018 	},
9019 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9020 		.type = HDA_FIXUP_VERBS,
9021 		.v.verbs = (const struct hda_verb[]) {
9022 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
9023 			{ }
9024 		},
9025 	},
9026 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9027 		.type = HDA_FIXUP_VERBS,
9028 		.v.verbs = (const struct hda_verb[]) {
9029 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
9030 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
9031 			{ }
9032 		},
9033 	},
9034 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9035 		.type = HDA_FIXUP_PINS,
9036 		.v.pins = (const struct hda_pintbl[]) {
9037 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9038 			{ }
9039 		},
9040 		.chained = true,
9041 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9042 	},
9043 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
9044 		.type = HDA_FIXUP_PINS,
9045 		.v.pins = (const struct hda_pintbl[]) {
9046 			{ 0x14, 0x90100120 }, /* use as internal speaker */
9047 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
9048 			{ 0x1a, 0x01011020 }, /* use as line out */
9049 			{ },
9050 		},
9051 		.chained = true,
9052 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9053 	},
9054 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9055 		.type = HDA_FIXUP_PINS,
9056 		.v.pins = (const struct hda_pintbl[]) {
9057 			{ 0x18, 0x02a11030 }, /* use as headset mic */
9058 			{ }
9059 		},
9060 		.chained = true,
9061 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9062 	},
9063 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9064 		.type = HDA_FIXUP_PINS,
9065 		.v.pins = (const struct hda_pintbl[]) {
9066 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9067 			{ }
9068 		},
9069 		.chained = true,
9070 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9071 	},
9072 	[ALC289_FIXUP_ASUS_GA401] = {
9073 		.type = HDA_FIXUP_FUNC,
9074 		.v.func = alc289_fixup_asus_ga401,
9075 		.chained = true,
9076 		.chain_id = ALC289_FIXUP_ASUS_GA502,
9077 	},
9078 	[ALC289_FIXUP_ASUS_GA502] = {
9079 		.type = HDA_FIXUP_PINS,
9080 		.v.pins = (const struct hda_pintbl[]) {
9081 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9082 			{ }
9083 		},
9084 	},
9085 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9086 		.type = HDA_FIXUP_PINS,
9087 		.v.pins = (const struct hda_pintbl[]) {
9088 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9089 			{ }
9090 		},
9091 		.chained = true,
9092 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9093 	},
9094 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9095 		.type = HDA_FIXUP_FUNC,
9096 		.v.func = alc285_fixup_hp_gpio_amp_init,
9097 		.chained = true,
9098 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
9099 	},
9100 	[ALC269_FIXUP_CZC_B20] = {
9101 		.type = HDA_FIXUP_PINS,
9102 		.v.pins = (const struct hda_pintbl[]) {
9103 			{ 0x12, 0x411111f0 },
9104 			{ 0x14, 0x90170110 }, /* speaker */
9105 			{ 0x15, 0x032f1020 }, /* HP out */
9106 			{ 0x17, 0x411111f0 },
9107 			{ 0x18, 0x03ab1040 }, /* mic */
9108 			{ 0x19, 0xb7a7013f },
9109 			{ 0x1a, 0x0181305f },
9110 			{ 0x1b, 0x411111f0 },
9111 			{ 0x1d, 0x411111f0 },
9112 			{ 0x1e, 0x411111f0 },
9113 			{ }
9114 		},
9115 		.chain_id = ALC269_FIXUP_DMIC,
9116 	},
9117 	[ALC269_FIXUP_CZC_TMI] = {
9118 		.type = HDA_FIXUP_PINS,
9119 		.v.pins = (const struct hda_pintbl[]) {
9120 			{ 0x12, 0x4000c000 },
9121 			{ 0x14, 0x90170110 }, /* speaker */
9122 			{ 0x15, 0x0421401f }, /* HP out */
9123 			{ 0x17, 0x411111f0 },
9124 			{ 0x18, 0x04a19020 }, /* mic */
9125 			{ 0x19, 0x411111f0 },
9126 			{ 0x1a, 0x411111f0 },
9127 			{ 0x1b, 0x411111f0 },
9128 			{ 0x1d, 0x40448505 },
9129 			{ 0x1e, 0x411111f0 },
9130 			{ 0x20, 0x8000ffff },
9131 			{ }
9132 		},
9133 		.chain_id = ALC269_FIXUP_DMIC,
9134 	},
9135 	[ALC269_FIXUP_CZC_L101] = {
9136 		.type = HDA_FIXUP_PINS,
9137 		.v.pins = (const struct hda_pintbl[]) {
9138 			{ 0x12, 0x40000000 },
9139 			{ 0x14, 0x01014010 }, /* speaker */
9140 			{ 0x15, 0x411111f0 }, /* HP out */
9141 			{ 0x16, 0x411111f0 },
9142 			{ 0x18, 0x01a19020 }, /* mic */
9143 			{ 0x19, 0x02a19021 },
9144 			{ 0x1a, 0x0181302f },
9145 			{ 0x1b, 0x0221401f },
9146 			{ 0x1c, 0x411111f0 },
9147 			{ 0x1d, 0x4044c601 },
9148 			{ 0x1e, 0x411111f0 },
9149 			{ }
9150 		},
9151 		.chain_id = ALC269_FIXUP_DMIC,
9152 	},
9153 	[ALC269_FIXUP_LEMOTE_A1802] = {
9154 		.type = HDA_FIXUP_PINS,
9155 		.v.pins = (const struct hda_pintbl[]) {
9156 			{ 0x12, 0x40000000 },
9157 			{ 0x14, 0x90170110 }, /* speaker */
9158 			{ 0x17, 0x411111f0 },
9159 			{ 0x18, 0x03a19040 }, /* mic1 */
9160 			{ 0x19, 0x90a70130 }, /* mic2 */
9161 			{ 0x1a, 0x411111f0 },
9162 			{ 0x1b, 0x411111f0 },
9163 			{ 0x1d, 0x40489d2d },
9164 			{ 0x1e, 0x411111f0 },
9165 			{ 0x20, 0x0003ffff },
9166 			{ 0x21, 0x03214020 },
9167 			{ }
9168 		},
9169 		.chain_id = ALC269_FIXUP_DMIC,
9170 	},
9171 	[ALC269_FIXUP_LEMOTE_A190X] = {
9172 		.type = HDA_FIXUP_PINS,
9173 		.v.pins = (const struct hda_pintbl[]) {
9174 			{ 0x14, 0x99130110 }, /* speaker */
9175 			{ 0x15, 0x0121401f }, /* HP out */
9176 			{ 0x18, 0x01a19c20 }, /* rear  mic */
9177 			{ 0x19, 0x99a3092f }, /* front mic */
9178 			{ 0x1b, 0x0201401f }, /* front lineout */
9179 			{ }
9180 		},
9181 		.chain_id = ALC269_FIXUP_DMIC,
9182 	},
9183 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9184 		.type = HDA_FIXUP_PINS,
9185 		.v.pins = (const struct hda_pintbl[]) {
9186 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9187 			{ }
9188 		},
9189 		.chained = true,
9190 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9191 	},
9192 	[ALC256_FIXUP_INTEL_NUC10] = {
9193 		.type = HDA_FIXUP_PINS,
9194 		.v.pins = (const struct hda_pintbl[]) {
9195 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9196 			{ }
9197 		},
9198 		.chained = true,
9199 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9200 	},
9201 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9202 		.type = HDA_FIXUP_VERBS,
9203 		.v.verbs = (const struct hda_verb[]) {
9204 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9205 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9206 			{ }
9207 		},
9208 		.chained = true,
9209 		.chain_id = ALC289_FIXUP_ASUS_GA502
9210 	},
9211 	[ALC274_FIXUP_HP_MIC] = {
9212 		.type = HDA_FIXUP_VERBS,
9213 		.v.verbs = (const struct hda_verb[]) {
9214 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9215 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9216 			{ }
9217 		},
9218 	},
9219 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
9220 		.type = HDA_FIXUP_FUNC,
9221 		.v.func = alc274_fixup_hp_headset_mic,
9222 		.chained = true,
9223 		.chain_id = ALC274_FIXUP_HP_MIC
9224 	},
9225 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
9226 		.type = HDA_FIXUP_FUNC,
9227 		.v.func = alc274_fixup_hp_envy_gpio,
9228 	},
9229 	[ALC256_FIXUP_ASUS_HPE] = {
9230 		.type = HDA_FIXUP_VERBS,
9231 		.v.verbs = (const struct hda_verb[]) {
9232 			/* Set EAPD high */
9233 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9234 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9235 			{ }
9236 		},
9237 		.chained = true,
9238 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9239 	},
9240 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9241 		.type = HDA_FIXUP_FUNC,
9242 		.v.func = alc_fixup_headset_jack,
9243 		.chained = true,
9244 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9245 	},
9246 	[ALC287_FIXUP_HP_GPIO_LED] = {
9247 		.type = HDA_FIXUP_FUNC,
9248 		.v.func = alc287_fixup_hp_gpio_led,
9249 	},
9250 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
9251 		.type = HDA_FIXUP_FUNC,
9252 		.v.func = alc274_fixup_hp_headset_mic,
9253 	},
9254 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9255 		.type = HDA_FIXUP_FUNC,
9256 		.v.func = alc_fixup_no_int_mic,
9257 		.chained = true,
9258 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9259 	},
9260 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9261 		.type = HDA_FIXUP_PINS,
9262 		.v.pins = (const struct hda_pintbl[]) {
9263 			{ 0x1b, 0x411111f0 },
9264 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9265 			{ },
9266 		},
9267 		.chained = true,
9268 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9269 	},
9270 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9271 		.type = HDA_FIXUP_FUNC,
9272 		.v.func = alc269_fixup_limit_int_mic_boost,
9273 		.chained = true,
9274 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9275 	},
9276 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
9277 		.type = HDA_FIXUP_PINS,
9278 		.v.pins = (const struct hda_pintbl[]) {
9279 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9280 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
9281 			{ }
9282 		},
9283 		.chained = true,
9284 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9285 	},
9286 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9287 		.type = HDA_FIXUP_FUNC,
9288 		.v.func = alc285_fixup_ideapad_s740_coef,
9289 		.chained = true,
9290 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9291 	},
9292 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9293 		.type = HDA_FIXUP_FUNC,
9294 		.v.func = alc269_fixup_limit_int_mic_boost,
9295 		.chained = true,
9296 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9297 	},
9298 	[ALC295_FIXUP_ASUS_DACS] = {
9299 		.type = HDA_FIXUP_FUNC,
9300 		.v.func = alc295_fixup_asus_dacs,
9301 	},
9302 	[ALC295_FIXUP_HP_OMEN] = {
9303 		.type = HDA_FIXUP_PINS,
9304 		.v.pins = (const struct hda_pintbl[]) {
9305 			{ 0x12, 0xb7a60130 },
9306 			{ 0x13, 0x40000000 },
9307 			{ 0x14, 0x411111f0 },
9308 			{ 0x16, 0x411111f0 },
9309 			{ 0x17, 0x90170110 },
9310 			{ 0x18, 0x411111f0 },
9311 			{ 0x19, 0x02a11030 },
9312 			{ 0x1a, 0x411111f0 },
9313 			{ 0x1b, 0x04a19030 },
9314 			{ 0x1d, 0x40600001 },
9315 			{ 0x1e, 0x411111f0 },
9316 			{ 0x21, 0x03211020 },
9317 			{}
9318 		},
9319 		.chained = true,
9320 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9321 	},
9322 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
9323 		.type = HDA_FIXUP_FUNC,
9324 		.v.func = alc285_fixup_hp_spectre_x360,
9325 	},
9326 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9327 		.type = HDA_FIXUP_FUNC,
9328 		.v.func = alc285_fixup_hp_spectre_x360_eb1
9329 	},
9330 	[ALC285_FIXUP_HP_ENVY_X360] = {
9331 		.type = HDA_FIXUP_FUNC,
9332 		.v.func = alc285_fixup_hp_envy_x360,
9333 		.chained = true,
9334 		.chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9335 	},
9336 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9337 		.type = HDA_FIXUP_FUNC,
9338 		.v.func = alc285_fixup_ideapad_s740_coef,
9339 		.chained = true,
9340 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9341 	},
9342 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9343 		.type = HDA_FIXUP_FUNC,
9344 		.v.func = alc_fixup_no_shutup,
9345 		.chained = true,
9346 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
9347 	},
9348 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9349 		.type = HDA_FIXUP_PINS,
9350 		.v.pins = (const struct hda_pintbl[]) {
9351 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9352 			{ }
9353 		},
9354 		.chained = true,
9355 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9356 	},
9357 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9358 		.type = HDA_FIXUP_FUNC,
9359 		.v.func = alc269_fixup_limit_int_mic_boost,
9360 		.chained = true,
9361 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9362 	},
9363 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9364 		.type = HDA_FIXUP_FUNC,
9365 		.v.func = alc285_fixup_ideapad_s740_coef,
9366 		.chained = true,
9367 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9368 	},
9369 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9370 		.type = HDA_FIXUP_FUNC,
9371 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9372 		.chained = true,
9373 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9374 	},
9375 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9376 		.type = HDA_FIXUP_VERBS,
9377 		//.v.verbs = legion_15imhg05_coefs,
9378 		.v.verbs = (const struct hda_verb[]) {
9379 			 // set left speaker Legion 7i.
9380 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9381 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9382 
9383 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9384 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9385 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9386 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9387 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9388 
9389 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9390 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9391 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9392 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9393 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9394 
9395 			 // set right speaker Legion 7i.
9396 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9397 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9398 
9399 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9400 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9401 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9402 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9403 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9404 
9405 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9406 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9407 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9408 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9409 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9410 			 {}
9411 		},
9412 		.chained = true,
9413 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9414 	},
9415 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9416 		.type = HDA_FIXUP_FUNC,
9417 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9418 		.chained = true,
9419 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9420 	},
9421 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9422 		.type = HDA_FIXUP_VERBS,
9423 		.v.verbs = (const struct hda_verb[]) {
9424 			 // set left speaker Yoga 7i.
9425 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9426 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9427 
9428 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9429 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9430 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9431 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9432 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9433 
9434 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9435 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9436 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9437 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9438 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9439 
9440 			 // set right speaker Yoga 7i.
9441 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9442 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9443 
9444 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9445 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9446 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9447 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9448 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9449 
9450 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9451 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9452 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9453 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9454 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9455 			 {}
9456 		},
9457 		.chained = true,
9458 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9459 	},
9460 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
9461 		.type = HDA_FIXUP_FUNC,
9462 		.v.func = alc298_fixup_lenovo_c940_duet7,
9463 	},
9464 	[ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
9465 		.type = HDA_FIXUP_FUNC,
9466 		.v.func = alc287_fixup_lenovo_14irp8_duetitl,
9467 	},
9468 	[ALC287_FIXUP_LENOVO_LEGION_7] = {
9469 		.type = HDA_FIXUP_FUNC,
9470 		.v.func = alc287_fixup_lenovo_legion_7,
9471 	},
9472 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9473 		.type = HDA_FIXUP_VERBS,
9474 		.v.verbs = (const struct hda_verb[]) {
9475 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9476 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9477 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9478 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9479 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9480 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9481 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9482 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9483 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9484 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9485 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9486 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9487 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9488 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9489 			{}
9490 		},
9491 		.chained = true,
9492 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9493 	},
9494 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9495 		.type = HDA_FIXUP_FUNC,
9496 		.v.func = alc256_fixup_set_coef_defaults,
9497 	},
9498 	[ALC245_FIXUP_HP_GPIO_LED] = {
9499 		.type = HDA_FIXUP_FUNC,
9500 		.v.func = alc245_fixup_hp_gpio_led,
9501 	},
9502 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9503 		.type = HDA_FIXUP_PINS,
9504 		.v.pins = (const struct hda_pintbl[]) {
9505 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9506 			{ }
9507 		},
9508 		.chained = true,
9509 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9510 	},
9511 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
9512 		.type = HDA_FIXUP_FUNC,
9513 		.v.func = alc233_fixup_no_audio_jack,
9514 	},
9515 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9516 		.type = HDA_FIXUP_FUNC,
9517 		.v.func = alc256_fixup_mic_no_presence_and_resume,
9518 		.chained = true,
9519 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9520 	},
9521 	[ALC287_FIXUP_LEGION_16ACHG6] = {
9522 		.type = HDA_FIXUP_FUNC,
9523 		.v.func = alc287_fixup_legion_16achg6_speakers,
9524 	},
9525 	[ALC287_FIXUP_CS35L41_I2C_2] = {
9526 		.type = HDA_FIXUP_FUNC,
9527 		.v.func = cs35l41_fixup_i2c_two,
9528 	},
9529 	[ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9530 		.type = HDA_FIXUP_FUNC,
9531 		.v.func = cs35l41_fixup_i2c_two,
9532 		.chained = true,
9533 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9534 	},
9535 	[ALC287_FIXUP_CS35L41_I2C_4] = {
9536 		.type = HDA_FIXUP_FUNC,
9537 		.v.func = cs35l41_fixup_i2c_four,
9538 	},
9539 	[ALC245_FIXUP_CS35L41_SPI_2] = {
9540 		.type = HDA_FIXUP_FUNC,
9541 		.v.func = cs35l41_fixup_spi_two,
9542 	},
9543 	[ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9544 		.type = HDA_FIXUP_FUNC,
9545 		.v.func = cs35l41_fixup_spi_two,
9546 		.chained = true,
9547 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9548 	},
9549 	[ALC245_FIXUP_CS35L41_SPI_4] = {
9550 		.type = HDA_FIXUP_FUNC,
9551 		.v.func = cs35l41_fixup_spi_four,
9552 	},
9553 	[ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9554 		.type = HDA_FIXUP_FUNC,
9555 		.v.func = cs35l41_fixup_spi_four,
9556 		.chained = true,
9557 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9558 	},
9559 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9560 		.type = HDA_FIXUP_VERBS,
9561 		.v.verbs = (const struct hda_verb[]) {
9562 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9563 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9564 			 { }
9565 		},
9566 		.chained = true,
9567 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9568 	},
9569 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9570 		.type = HDA_FIXUP_FUNC,
9571 		.v.func = alc_fixup_dell4_mic_no_presence_quiet,
9572 		.chained = true,
9573 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9574 	},
9575 	[ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9576 		.type = HDA_FIXUP_PINS,
9577 		.v.pins = (const struct hda_pintbl[]) {
9578 			{ 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9579 			{ }
9580 		},
9581 		.chained = true,
9582 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9583 	},
9584 	[ALC287_FIXUP_LEGION_16ITHG6] = {
9585 		.type = HDA_FIXUP_FUNC,
9586 		.v.func = alc287_fixup_legion_16ithg6_speakers,
9587 	},
9588 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9589 		.type = HDA_FIXUP_VERBS,
9590 		.v.verbs = (const struct hda_verb[]) {
9591 			// enable left speaker
9592 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9593 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9594 
9595 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9596 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9597 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9598 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9599 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9600 
9601 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9602 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9603 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9604 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9605 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9606 
9607 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9608 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9609 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9610 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9611 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9612 
9613 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9614 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9615 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9616 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9617 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9618 
9619 			// enable right speaker
9620 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9621 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9622 
9623 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9624 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9625 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9626 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9627 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9628 
9629 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9630 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9631 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9632 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9633 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9634 
9635 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9636 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9637 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9638 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9639 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9640 
9641 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9642 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9643 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9644 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9645 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9646 
9647 			{ },
9648 		},
9649 	},
9650 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9651 		.type = HDA_FIXUP_FUNC,
9652 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9653 		.chained = true,
9654 		.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9655 	},
9656 	[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
9657 		.type = HDA_FIXUP_FUNC,
9658 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9659 		.chained = true,
9660 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2,
9661 	},
9662 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
9663 		.type = HDA_FIXUP_FUNC,
9664 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
9665 		.chained = true,
9666 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9667 	},
9668 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
9669 		.type = HDA_FIXUP_PINS,
9670 		.v.func = alc1220_fixup_gb_dual_codecs,
9671 		.chained = true,
9672 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9673 	},
9674 	[ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
9675 		.type = HDA_FIXUP_FUNC,
9676 		.v.func = cs35l41_fixup_i2c_two,
9677 		.chained = true,
9678 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9679 	},
9680 	[ALC287_FIXUP_TAS2781_I2C] = {
9681 		.type = HDA_FIXUP_FUNC,
9682 		.v.func = tas2781_fixup_i2c,
9683 		.chained = true,
9684 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9685 	},
9686 	[ALC287_FIXUP_YOGA7_14ARB7_I2C] = {
9687 		.type = HDA_FIXUP_FUNC,
9688 		.v.func = yoga7_14arb7_fixup_i2c,
9689 		.chained = true,
9690 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9691 	},
9692 	[ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
9693 		.type = HDA_FIXUP_FUNC,
9694 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9695 	},
9696 	[ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
9697 		.type = HDA_FIXUP_FUNC,
9698 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9699 		.chained = true,
9700 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
9701 	},
9702 	[ALC287_FIXUP_THINKPAD_I2S_SPK] = {
9703 		.type = HDA_FIXUP_FUNC,
9704 		.v.func = alc287_fixup_bind_dacs,
9705 		.chained = true,
9706 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9707 	},
9708 	[ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
9709 		.type = HDA_FIXUP_FUNC,
9710 		.v.func = alc287_fixup_bind_dacs,
9711 		.chained = true,
9712 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
9713 	},
9714 	[ALC2XX_FIXUP_HEADSET_MIC] = {
9715 		.type = HDA_FIXUP_FUNC,
9716 		.v.func = alc_fixup_headset_mic,
9717 	},
9718 	[ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
9719 		.type = HDA_FIXUP_FUNC,
9720 		.v.func = cs35l41_fixup_spi_two,
9721 		.chained = true,
9722 		.chain_id = ALC289_FIXUP_DUAL_SPK
9723 	},
9724 	[ALC294_FIXUP_CS35L41_I2C_2] = {
9725 		.type = HDA_FIXUP_FUNC,
9726 		.v.func = cs35l41_fixup_i2c_two,
9727 	},
9728 	[ALC245_FIXUP_CS35L56_SPI_4_HP_GPIO_LED] = {
9729 		.type = HDA_FIXUP_FUNC,
9730 		.v.func = cs35l56_fixup_spi_four,
9731 		.chained = true,
9732 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9733 	},
9734 	[ALC256_FIXUP_ACER_SFG16_MICMUTE_LED] = {
9735 		.type = HDA_FIXUP_FUNC,
9736 		.v.func = alc256_fixup_acer_sfg16_micmute_led,
9737 	},
9738 	[ALC256_FIXUP_HEADPHONE_AMP_VOL] = {
9739 		.type = HDA_FIXUP_FUNC,
9740 		.v.func = alc256_decrease_headphone_amp_val,
9741 	},
9742 	[ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX] = {
9743 		.type = HDA_FIXUP_FUNC,
9744 		.v.func = alc245_fixup_hp_spectre_x360_eu0xxx,
9745 	},
9746 	[ALC285_FIXUP_CS35L56_SPI_2] = {
9747 		.type = HDA_FIXUP_FUNC,
9748 		.v.func = cs35l56_fixup_spi_two,
9749 	},
9750 	[ALC285_FIXUP_CS35L56_I2C_2] = {
9751 		.type = HDA_FIXUP_FUNC,
9752 		.v.func = cs35l56_fixup_i2c_two,
9753 	},
9754 	[ALC285_FIXUP_CS35L56_I2C_4] = {
9755 		.type = HDA_FIXUP_FUNC,
9756 		.v.func = cs35l56_fixup_i2c_four,
9757 	},
9758 	[ALC285_FIXUP_ASUS_GA403U] = {
9759 		.type = HDA_FIXUP_FUNC,
9760 		.v.func = alc285_fixup_asus_ga403u,
9761 	},
9762 	[ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC] = {
9763 		.type = HDA_FIXUP_PINS,
9764 		.v.pins = (const struct hda_pintbl[]) {
9765 			{ 0x19, 0x03a11050 },
9766 			{ 0x1b, 0x03a11c30 },
9767 			{ }
9768 		},
9769 		.chained = true,
9770 		.chain_id = ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1
9771 	},
9772 	[ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1] = {
9773 		.type = HDA_FIXUP_FUNC,
9774 		.v.func = alc285_fixup_speaker2_to_dac1,
9775 		.chained = true,
9776 		.chain_id = ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
9777 	},
9778 	[ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC] = {
9779 		.type = HDA_FIXUP_PINS,
9780 		.v.pins = (const struct hda_pintbl[]) {
9781 			{ 0x19, 0x03a11050 },
9782 			{ 0x1b, 0x03a11c30 },
9783 			{ }
9784 		},
9785 		.chained = true,
9786 		.chain_id = ALC285_FIXUP_CS35L56_SPI_2
9787 	},
9788 	[ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1] = {
9789 		.type = HDA_FIXUP_FUNC,
9790 		.v.func = alc285_fixup_speaker2_to_dac1,
9791 		.chained = true,
9792 		.chain_id = ALC285_FIXUP_ASUS_GA403U,
9793 	},
9794 	[ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318] = {
9795 		.type = HDA_FIXUP_FUNC,
9796 		.v.func = alc287_fixup_lenovo_thinkpad_with_alc1318,
9797 		.chained = true,
9798 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9799 	},
9800 };
9801 
9802 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
9803 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
9804 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9805 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
9806 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
9807 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9808 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9809 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
9810 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9811 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9812 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
9813 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9814 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
9815 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
9816 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
9817 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
9818 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
9819 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9820 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9821 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9822 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9823 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
9824 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
9825 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
9826 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
9827 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9828 	SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9829 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9830 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9831 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9832 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
9833 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9834 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9835 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9836 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
9837 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
9838 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9839 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9840 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9841 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
9842 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9843 	SND_PCI_QUIRK(0x1025, 0x169a, "Acer Swift SFG16", ALC256_FIXUP_ACER_SFG16_MICMUTE_LED),
9844 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
9845 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
9846 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
9847 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
9848 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
9849 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9850 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
9851 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
9852 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9853 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9854 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9855 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9856 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9857 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
9858 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
9859 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
9860 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9861 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9862 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
9863 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9864 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
9865 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9866 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9867 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9868 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9869 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9870 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9871 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9872 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9873 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9874 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
9875 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
9876 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
9877 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
9878 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9879 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
9880 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
9881 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9882 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9883 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9884 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9885 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9886 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
9887 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
9888 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9889 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9890 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9891 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9892 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9893 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9894 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9895 	SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
9896 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
9897 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
9898 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
9899 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9900 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9901 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9902 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
9903 	SND_PCI_QUIRK(0x1028, 0x0b27, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
9904 	SND_PCI_QUIRK(0x1028, 0x0b28, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
9905 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9906 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9907 	SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9908 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9909 	SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9910 	SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9911 	SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9912 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9913 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9914 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9915 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9916 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9917 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9918 	SND_PCI_QUIRK(0x1028, 0x0c28, "Dell Inspiron 16 Plus 7630", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9919 	SND_PCI_QUIRK(0x1028, 0x0c4d, "Dell", ALC287_FIXUP_CS35L41_I2C_4),
9920 	SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9921 	SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9922 	SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9923 	SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9924 	SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9925 	SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9926 	SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9927 	SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9928 	SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9929 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9930 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9931 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9932 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
9933 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
9934 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9935 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9936 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9937 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9938 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9939 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9940 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9941 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9942 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9943 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9944 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9945 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9946 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9947 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9948 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9949 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9950 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9951 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9952 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
9953 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
9954 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9955 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9956 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9957 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9958 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9959 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9960 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9961 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9962 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9963 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9964 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9965 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9966 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9967 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9968 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9969 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9970 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9971 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9972 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9973 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9974 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9975 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9976 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9977 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9978 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9979 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9980 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9981 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9982 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9983 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9984 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9985 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9986 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9987 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9988 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
9989 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9990 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9991 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9992 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9993 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
9994 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9995 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
9996 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9997 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9998 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9999 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10000 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10001 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10002 	SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10003 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
10004 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10005 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
10006 	SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10007 	SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
10008 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10009 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10010 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10011 	SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10012 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
10013 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10014 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10015 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
10016 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10017 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10018 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
10019 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
10020 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
10021 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10022 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10023 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10024 	SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
10025 	SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10026 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
10027 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10028 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
10029 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10030 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
10031 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10032 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10033 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10034 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10035 	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10036 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
10037 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10038 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10039 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10040 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10041 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
10042 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
10043 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10044 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10045 	SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10046 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10047 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10048 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10049 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10050 	SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10051 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10052 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10053 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10054 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10055 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10056 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10057 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10058 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10059 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10060 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10061 	SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10062 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
10063 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
10064 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
10065 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10066 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
10067 	SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
10068 	SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10069 	SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
10070 	SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10071 	SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10072 	SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10073 	SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10074 	SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10075 	SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10076 	SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10077 	SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
10078 	SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
10079 	SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10080 	SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10081 	SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10082 	SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
10083 	SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10084 	SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
10085 	SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
10086 	SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
10087 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
10088 	SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
10089 	SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
10090 	SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10091 	SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10092 	SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10093 	SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10094 	SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10095 	SND_PCI_QUIRK(0x103c, 0x89e7, "HP Elite x2 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10096 	SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
10097 	SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10098 	SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10099 	SND_PCI_QUIRK(0x103c, 0x8a28, "HP Envy 13", ALC287_FIXUP_CS35L41_I2C_2),
10100 	SND_PCI_QUIRK(0x103c, 0x8a29, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10101 	SND_PCI_QUIRK(0x103c, 0x8a2a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10102 	SND_PCI_QUIRK(0x103c, 0x8a2b, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10103 	SND_PCI_QUIRK(0x103c, 0x8a2c, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10104 	SND_PCI_QUIRK(0x103c, 0x8a2d, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10105 	SND_PCI_QUIRK(0x103c, 0x8a2e, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10106 	SND_PCI_QUIRK(0x103c, 0x8a2e, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10107 	SND_PCI_QUIRK(0x103c, 0x8a30, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10108 	SND_PCI_QUIRK(0x103c, 0x8a31, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10109 	SND_PCI_QUIRK(0x103c, 0x8a6e, "HP EDNA 360", ALC287_FIXUP_CS35L41_I2C_4),
10110 	SND_PCI_QUIRK(0x103c, 0x8a74, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10111 	SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10112 	SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
10113 	SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
10114 	SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
10115 	SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
10116 	SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
10117 	SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10118 	SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10119 	SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10120 	SND_PCI_QUIRK(0x103c, 0x8ad8, "HP 800 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10121 	SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10122 	SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10123 	SND_PCI_QUIRK(0x103c, 0x8b3a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10124 	SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
10125 	SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10126 	SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10127 	SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10128 	SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10129 	SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10130 	SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10131 	SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10132 	SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10133 	SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10134 	SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10135 	SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10136 	SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10137 	SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10138 	SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10139 	SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10140 	SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
10141 	SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10142 	SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10143 	SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
10144 	SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10145 	SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
10146 	SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10147 	SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10148 	SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10149 	SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10150 	SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10151 	SND_PCI_QUIRK(0x103c, 0x8bdd, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10152 	SND_PCI_QUIRK(0x103c, 0x8bde, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10153 	SND_PCI_QUIRK(0x103c, 0x8bdf, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10154 	SND_PCI_QUIRK(0x103c, 0x8be0, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10155 	SND_PCI_QUIRK(0x103c, 0x8be1, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10156 	SND_PCI_QUIRK(0x103c, 0x8be2, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10157 	SND_PCI_QUIRK(0x103c, 0x8be3, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10158 	SND_PCI_QUIRK(0x103c, 0x8be5, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10159 	SND_PCI_QUIRK(0x103c, 0x8be6, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10160 	SND_PCI_QUIRK(0x103c, 0x8be7, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10161 	SND_PCI_QUIRK(0x103c, 0x8be8, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10162 	SND_PCI_QUIRK(0x103c, 0x8be9, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10163 	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10164 	SND_PCI_QUIRK(0x103c, 0x8c15, "HP Spectre x360 2-in-1 Laptop 14-eu0xxx", ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX),
10165 	SND_PCI_QUIRK(0x103c, 0x8c16, "HP Spectre 16", ALC287_FIXUP_CS35L41_I2C_2),
10166 	SND_PCI_QUIRK(0x103c, 0x8c17, "HP Spectre 16", ALC287_FIXUP_CS35L41_I2C_2),
10167 	SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10168 	SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10169 	SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10170 	SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10171 	SND_PCI_QUIRK(0x103c, 0x8c4f, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10172 	SND_PCI_QUIRK(0x103c, 0x8c50, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10173 	SND_PCI_QUIRK(0x103c, 0x8c51, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10174 	SND_PCI_QUIRK(0x103c, 0x8c52, "HP EliteBook 1040 G11", ALC245_FIXUP_CS35L56_SPI_4_HP_GPIO_LED),
10175 	SND_PCI_QUIRK(0x103c, 0x8c53, "HP Elite x360 1040 2-in-1 G11", ALC245_FIXUP_CS35L56_SPI_4_HP_GPIO_LED),
10176 	SND_PCI_QUIRK(0x103c, 0x8c66, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10177 	SND_PCI_QUIRK(0x103c, 0x8c67, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10178 	SND_PCI_QUIRK(0x103c, 0x8c68, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10179 	SND_PCI_QUIRK(0x103c, 0x8c6a, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10180 	SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10181 	SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10182 	SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10183 	SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10184 	SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10185 	SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10186 	SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10187 	SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10188 	SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10189 	SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10190 	SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10191 	SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10192 	SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10193 	SND_PCI_QUIRK(0x103c, 0x8cdd, "HP Spectre", ALC287_FIXUP_CS35L41_I2C_2),
10194 	SND_PCI_QUIRK(0x103c, 0x8cde, "HP Spectre", ALC287_FIXUP_CS35L41_I2C_2),
10195 	SND_PCI_QUIRK(0x103c, 0x8cdf, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10196 	SND_PCI_QUIRK(0x103c, 0x8ce0, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10197 	SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10198 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10199 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10200 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10201 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10202 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10203 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10204 	SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10205 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10206 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10207 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10208 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10209 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10210 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10211 	SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10212 	SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10213 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10214 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10215 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10216 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10217 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10218 	SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVV", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10219 	SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X/GA402N", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10220 	SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604VI/VC/VE/VG/VJ/VQ/VU/VV/VY/VZ", ALC285_FIXUP_ASUS_HEADSET_MIC),
10221 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603VQ/VU/VV/VJ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10222 	SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601VV/VU/VJ/VQ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10223 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G614JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10224 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS G513PI/PU/PV", ALC287_FIXUP_CS35L41_I2C_2),
10225 	SND_PCI_QUIRK(0x1043, 0x1503, "ASUS G733PY/PZ/PZV/PYV", ALC287_FIXUP_CS35L41_I2C_2),
10226 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10227 	SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA/XJ/XQ/XU/XV/XI", ALC287_FIXUP_CS35L41_I2C_2),
10228 	SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301VV/VQ/VU/VJ/VA/VC/VE/VVC/VQC/VUC/VJC/VEC/VCC", ALC285_FIXUP_ASUS_HEADSET_MIC),
10229 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10230 	SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZI/ZJ/ZQ/ZU/ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10231 	SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10232 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10233 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10234 	SND_PCI_QUIRK(0x1043, 0x16d3, "ASUS UX5304VA", ALC245_FIXUP_CS35L41_SPI_2),
10235 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10236 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS UX7602VI/BZ", ALC245_FIXUP_CS35L41_SPI_2),
10237 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10238 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10239 	SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally NR2301L/X", ALC294_FIXUP_ASUS_ALLY),
10240 	SND_PCI_QUIRK(0x1043, 0x1863, "ASUS UX6404VI/VV", ALC245_FIXUP_CS35L41_SPI_2),
10241 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10242 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10243 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10244 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10245 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10246 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10247 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10248 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10249 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10250 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10251 	SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
10252 	SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10253 	SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10254 	SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10255 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10256 	SND_PCI_QUIRK(0x1043, 0x1b13, "ASUS U41SV/GA403U", ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC),
10257 	SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10258 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10259 	SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10260 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10261 	SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10262 	SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10263 	SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10264 	SND_PCI_QUIRK(0x1043, 0x1c63, "ASUS GU605M", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10265 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10266 	SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JU/JV/JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10267 	SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JY/JZ/JI/JG", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10268 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10269 	SND_PCI_QUIRK(0x1043, 0x1ccf, "ASUS G814JU/JV/JI", ALC245_FIXUP_CS35L41_SPI_2),
10270 	SND_PCI_QUIRK(0x1043, 0x1cdf, "ASUS G814JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10271 	SND_PCI_QUIRK(0x1043, 0x1cef, "ASUS G834JY/JZ/JI/JG", ALC285_FIXUP_ASUS_HEADSET_MIC),
10272 	SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS G713PI/PU/PV/PVN", ALC287_FIXUP_CS35L41_I2C_2),
10273 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10274 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10275 	SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10276 	SND_PCI_QUIRK(0x1043, 0x1df3, "ASUS UM5606", ALC285_FIXUP_CS35L56_I2C_4),
10277 	SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10278 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10279 	SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10280 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10281 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10282 	SND_PCI_QUIRK(0x1043, 0x1e63, "ASUS H7606W", ALC285_FIXUP_CS35L56_I2C_2),
10283 	SND_PCI_QUIRK(0x1043, 0x1e83, "ASUS GA605W", ALC285_FIXUP_CS35L56_I2C_2),
10284 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10285 	SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10286 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10287 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10288 	SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10289 	SND_PCI_QUIRK(0x1043, 0x1f1f, "ASUS H7604JI/JV/J3D", ALC245_FIXUP_CS35L41_SPI_2),
10290 	SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10291 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10292 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10293 	SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2),
10294 	SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10295 	SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC245_FIXUP_CS35L41_SPI_2),
10296 	SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10297 	SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10298 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10299 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10300 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10301 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10302 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10303 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10304 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10305 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10306 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10307 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10308 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10309 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10310 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10311 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10312 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10313 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10314 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10315 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10316 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10317 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10318 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10319 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10320 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10321 	SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10322 	SND_PCI_QUIRK(0x10ec, 0x12f6, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10323 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10324 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10325 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10326 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10327 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10328 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10329 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10330 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10331 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10332 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10333 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10334 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10335 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10336 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10337 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10338 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10339 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10340 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10341 	SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10342 	SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10343 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10344 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10345 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10346 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10347 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10348 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10349 	SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10350 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10351 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10352 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10353 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10354 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10355 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10356 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10357 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10358 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10359 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10360 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10361 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10362 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10363 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10364 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10365 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10366 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10367 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10368 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10369 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10370 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10371 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10372 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10373 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10374 	SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10375 	SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10376 	SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10377 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10378 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10379 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10380 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10381 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10382 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10383 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10384 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10385 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10386 	SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10387 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10388 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10389 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10390 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10391 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10392 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10393 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10394 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10395 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10396 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10397 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10398 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10399 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10400 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10401 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10402 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
10403 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10404 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10405 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10406 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10407 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10408 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10409 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10410 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10411 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10412 	SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10413 	SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10414 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10415 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10416 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10417 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10418 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10419 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10420 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
10421 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10422 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
10423 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
10424 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
10425 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
10426 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
10427 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
10428 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
10429 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
10430 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
10431 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
10432 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
10433 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
10434 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
10435 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
10436 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
10437 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10438 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10439 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10440 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
10441 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
10442 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10443 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10444 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10445 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
10446 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
10447 	SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
10448 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
10449 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10450 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10451 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
10452 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10453 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10454 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10455 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10456 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10457 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10458 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10459 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10460 	SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10461 	SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10462 	SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10463 	SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10464 	SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10465 	SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10466 	SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10467 	SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10468 	SND_PCI_QUIRK(0x17aa, 0x231e, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
10469 	SND_PCI_QUIRK(0x17aa, 0x231f, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
10470 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10471 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10472 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10473 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10474 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10475 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10476 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10477 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10478 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10479 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10480 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10481 	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
10482 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10483 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
10484 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10485 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
10486 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10487 	SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10488 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10489 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
10490 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10491 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10492 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
10493 	SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
10494 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10495 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10496 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10497 	SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
10498 	SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10499 	SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7/7i", ALC287_FIXUP_LENOVO_LEGION_7),
10500 	SND_PCI_QUIRK(0x17aa, 0x3870, "Lenovo Yoga 7 14ARB7", ALC287_FIXUP_YOGA7_14ARB7_I2C),
10501 	SND_PCI_QUIRK(0x17aa, 0x3877, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
10502 	SND_PCI_QUIRK(0x17aa, 0x3878, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
10503 	SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
10504 	SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
10505 	SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
10506 	SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10507 	SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10508 	SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10509 	SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
10510 	SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
10511 	SND_PCI_QUIRK(0x17aa, 0x38a9, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10512 	SND_PCI_QUIRK(0x17aa, 0x38ab, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10513 	SND_PCI_QUIRK(0x17aa, 0x38b4, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
10514 	SND_PCI_QUIRK(0x17aa, 0x38b5, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
10515 	SND_PCI_QUIRK(0x17aa, 0x38b6, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
10516 	SND_PCI_QUIRK(0x17aa, 0x38b7, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
10517 	SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
10518 	SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
10519 	SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
10520 	SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
10521 	SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
10522 	SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10523 	SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10524 	SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10525 	SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10526 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10527 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
10528 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10529 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
10530 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10531 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
10532 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
10533 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10534 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
10535 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
10536 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
10537 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
10538 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
10539 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
10540 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
10541 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
10542 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10543 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10544 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10545 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10546 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10547 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10548 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10549 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
10550 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10551 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
10552 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
10553 	SND_PCI_QUIRK(0x1854, 0x0440, "LG CQ6", ALC256_FIXUP_HEADPHONE_AMP_VOL),
10554 	SND_PCI_QUIRK(0x1854, 0x0441, "LG CQ6 AIO", ALC256_FIXUP_HEADPHONE_AMP_VOL),
10555 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
10556 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10557 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
10558 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
10559 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
10560 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
10561 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
10562 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
10563 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
10564 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
10565 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
10566 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
10567 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10568 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10569 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10570 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10571 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10572 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
10573 	SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10574 	SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10575 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10576 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
10577 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
10578 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
10579 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10580 	SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
10581 	SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
10582 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
10583 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
10584 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
10585 	SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
10586 	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10587 	SND_PCI_QUIRK(0xf111, 0x0005, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10588 	SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10589 
10590 #if 0
10591 	/* Below is a quirk table taken from the old code.
10592 	 * Basically the device should work as is without the fixup table.
10593 	 * If BIOS doesn't give a proper info, enable the corresponding
10594 	 * fixup entry.
10595 	 */
10596 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
10597 		      ALC269_FIXUP_AMIC),
10598 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
10599 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
10600 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
10601 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
10602 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
10603 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
10604 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
10605 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
10606 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
10607 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
10608 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
10609 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
10610 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
10611 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
10612 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
10613 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
10614 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
10615 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
10616 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
10617 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
10618 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
10619 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
10620 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
10621 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
10622 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
10623 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
10624 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
10625 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
10626 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
10627 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
10628 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
10629 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
10630 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
10631 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
10632 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
10633 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
10634 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
10635 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
10636 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
10637 #endif
10638 	{}
10639 };
10640 
10641 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
10642 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
10643 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
10644 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
10645 	SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
10646 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
10647 	{}
10648 };
10649 
10650 static const struct hda_model_fixup alc269_fixup_models[] = {
10651 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
10652 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
10653 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
10654 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
10655 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
10656 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
10657 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
10658 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
10659 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
10660 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
10661 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10662 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
10663 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10664 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
10665 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
10666 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
10667 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
10668 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
10669 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
10670 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
10671 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
10672 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
10673 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
10674 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10675 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
10676 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
10677 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
10678 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
10679 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
10680 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
10681 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
10682 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
10683 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
10684 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
10685 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
10686 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
10687 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
10688 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
10689 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
10690 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
10691 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
10692 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
10693 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
10694 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
10695 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
10696 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
10697 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
10698 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
10699 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
10700 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
10701 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
10702 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
10703 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
10704 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
10705 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
10706 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
10707 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
10708 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
10709 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
10710 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
10711 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
10712 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
10713 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
10714 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
10715 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
10716 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
10717 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
10718 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
10719 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
10720 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10721 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
10722 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
10723 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
10724 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
10725 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
10726 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
10727 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
10728 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
10729 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
10730 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
10731 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
10732 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
10733 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
10734 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
10735 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
10736 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
10737 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
10738 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
10739 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
10740 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
10741 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
10742 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
10743 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
10744 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
10745 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
10746 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
10747 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
10748 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
10749 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
10750 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
10751 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
10752 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
10753 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
10754 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
10755 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
10756 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
10757 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
10758 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
10759 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
10760 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
10761 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
10762 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
10763 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
10764 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
10765 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
10766 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
10767 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
10768 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
10769 	{.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
10770 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
10771 	{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
10772 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
10773 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
10774 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
10775 	{}
10776 };
10777 #define ALC225_STANDARD_PINS \
10778 	{0x21, 0x04211020}
10779 
10780 #define ALC256_STANDARD_PINS \
10781 	{0x12, 0x90a60140}, \
10782 	{0x14, 0x90170110}, \
10783 	{0x21, 0x02211020}
10784 
10785 #define ALC282_STANDARD_PINS \
10786 	{0x14, 0x90170110}
10787 
10788 #define ALC290_STANDARD_PINS \
10789 	{0x12, 0x99a30130}
10790 
10791 #define ALC292_STANDARD_PINS \
10792 	{0x14, 0x90170110}, \
10793 	{0x15, 0x0221401f}
10794 
10795 #define ALC295_STANDARD_PINS \
10796 	{0x12, 0xb7a60130}, \
10797 	{0x14, 0x90170110}, \
10798 	{0x21, 0x04211020}
10799 
10800 #define ALC298_STANDARD_PINS \
10801 	{0x12, 0x90a60130}, \
10802 	{0x21, 0x03211020}
10803 
10804 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
10805 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
10806 		{0x14, 0x01014020},
10807 		{0x17, 0x90170110},
10808 		{0x18, 0x02a11030},
10809 		{0x19, 0x0181303F},
10810 		{0x21, 0x0221102f}),
10811 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
10812 		{0x12, 0x90a601c0},
10813 		{0x14, 0x90171120},
10814 		{0x21, 0x02211030}),
10815 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10816 		{0x14, 0x90170110},
10817 		{0x1b, 0x90a70130},
10818 		{0x21, 0x03211020}),
10819 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10820 		{0x1a, 0x90a70130},
10821 		{0x1b, 0x90170110},
10822 		{0x21, 0x03211020}),
10823 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10824 		ALC225_STANDARD_PINS,
10825 		{0x12, 0xb7a60130},
10826 		{0x14, 0x901701a0}),
10827 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10828 		ALC225_STANDARD_PINS,
10829 		{0x12, 0xb7a60130},
10830 		{0x14, 0x901701b0}),
10831 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10832 		ALC225_STANDARD_PINS,
10833 		{0x12, 0xb7a60150},
10834 		{0x14, 0x901701a0}),
10835 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10836 		ALC225_STANDARD_PINS,
10837 		{0x12, 0xb7a60150},
10838 		{0x14, 0x901701b0}),
10839 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10840 		ALC225_STANDARD_PINS,
10841 		{0x12, 0xb7a60130},
10842 		{0x1b, 0x90170110}),
10843 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10844 		{0x1b, 0x01111010},
10845 		{0x1e, 0x01451130},
10846 		{0x21, 0x02211020}),
10847 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
10848 		{0x12, 0x90a60140},
10849 		{0x14, 0x90170110},
10850 		{0x19, 0x02a11030},
10851 		{0x21, 0x02211020}),
10852 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10853 		{0x14, 0x90170110},
10854 		{0x19, 0x02a11030},
10855 		{0x1a, 0x02a11040},
10856 		{0x1b, 0x01014020},
10857 		{0x21, 0x0221101f}),
10858 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10859 		{0x14, 0x90170110},
10860 		{0x19, 0x02a11030},
10861 		{0x1a, 0x02a11040},
10862 		{0x1b, 0x01011020},
10863 		{0x21, 0x0221101f}),
10864 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10865 		{0x14, 0x90170110},
10866 		{0x19, 0x02a11020},
10867 		{0x1a, 0x02a11030},
10868 		{0x21, 0x0221101f}),
10869 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
10870 		{0x21, 0x02211010}),
10871 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10872 		{0x14, 0x90170110},
10873 		{0x19, 0x02a11020},
10874 		{0x21, 0x02211030}),
10875 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
10876 		{0x14, 0x90170110},
10877 		{0x21, 0x02211020}),
10878 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10879 		{0x14, 0x90170130},
10880 		{0x21, 0x02211040}),
10881 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10882 		{0x12, 0x90a60140},
10883 		{0x14, 0x90170110},
10884 		{0x21, 0x02211020}),
10885 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10886 		{0x12, 0x90a60160},
10887 		{0x14, 0x90170120},
10888 		{0x21, 0x02211030}),
10889 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10890 		{0x14, 0x90170110},
10891 		{0x1b, 0x02011020},
10892 		{0x21, 0x0221101f}),
10893 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10894 		{0x14, 0x90170110},
10895 		{0x1b, 0x01011020},
10896 		{0x21, 0x0221101f}),
10897 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10898 		{0x14, 0x90170130},
10899 		{0x1b, 0x01014020},
10900 		{0x21, 0x0221103f}),
10901 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10902 		{0x14, 0x90170130},
10903 		{0x1b, 0x01011020},
10904 		{0x21, 0x0221103f}),
10905 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10906 		{0x14, 0x90170130},
10907 		{0x1b, 0x02011020},
10908 		{0x21, 0x0221103f}),
10909 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10910 		{0x14, 0x90170150},
10911 		{0x1b, 0x02011020},
10912 		{0x21, 0x0221105f}),
10913 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10914 		{0x14, 0x90170110},
10915 		{0x1b, 0x01014020},
10916 		{0x21, 0x0221101f}),
10917 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10918 		{0x12, 0x90a60160},
10919 		{0x14, 0x90170120},
10920 		{0x17, 0x90170140},
10921 		{0x21, 0x0321102f}),
10922 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10923 		{0x12, 0x90a60160},
10924 		{0x14, 0x90170130},
10925 		{0x21, 0x02211040}),
10926 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10927 		{0x12, 0x90a60160},
10928 		{0x14, 0x90170140},
10929 		{0x21, 0x02211050}),
10930 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10931 		{0x12, 0x90a60170},
10932 		{0x14, 0x90170120},
10933 		{0x21, 0x02211030}),
10934 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10935 		{0x12, 0x90a60170},
10936 		{0x14, 0x90170130},
10937 		{0x21, 0x02211040}),
10938 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10939 		{0x12, 0x90a60170},
10940 		{0x14, 0x90171130},
10941 		{0x21, 0x02211040}),
10942 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10943 		{0x12, 0x90a60170},
10944 		{0x14, 0x90170140},
10945 		{0x21, 0x02211050}),
10946 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10947 		{0x12, 0x90a60180},
10948 		{0x14, 0x90170130},
10949 		{0x21, 0x02211040}),
10950 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10951 		{0x12, 0x90a60180},
10952 		{0x14, 0x90170120},
10953 		{0x21, 0x02211030}),
10954 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10955 		{0x1b, 0x01011020},
10956 		{0x21, 0x02211010}),
10957 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10958 		{0x14, 0x90170110},
10959 		{0x1b, 0x90a70130},
10960 		{0x21, 0x04211020}),
10961 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10962 		{0x14, 0x90170110},
10963 		{0x1b, 0x90a70130},
10964 		{0x21, 0x03211020}),
10965 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10966 		{0x12, 0x90a60130},
10967 		{0x14, 0x90170110},
10968 		{0x21, 0x03211020}),
10969 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10970 		{0x12, 0x90a60130},
10971 		{0x14, 0x90170110},
10972 		{0x21, 0x04211020}),
10973 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10974 		{0x1a, 0x90a70130},
10975 		{0x1b, 0x90170110},
10976 		{0x21, 0x03211020}),
10977        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10978 		{0x14, 0x90170110},
10979 		{0x19, 0x02a11020},
10980 		{0x21, 0x0221101f}),
10981        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
10982 		{0x17, 0x90170110},
10983 		{0x19, 0x03a11030},
10984 		{0x21, 0x03211020}),
10985 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10986 		{0x12, 0x90a60130},
10987 		{0x14, 0x90170110},
10988 		{0x15, 0x0421101f},
10989 		{0x1a, 0x04a11020}),
10990 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10991 		{0x12, 0x90a60140},
10992 		{0x14, 0x90170110},
10993 		{0x15, 0x0421101f},
10994 		{0x18, 0x02811030},
10995 		{0x1a, 0x04a1103f},
10996 		{0x1b, 0x02011020}),
10997 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10998 		ALC282_STANDARD_PINS,
10999 		{0x12, 0x99a30130},
11000 		{0x19, 0x03a11020},
11001 		{0x21, 0x0321101f}),
11002 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11003 		ALC282_STANDARD_PINS,
11004 		{0x12, 0x99a30130},
11005 		{0x19, 0x03a11020},
11006 		{0x21, 0x03211040}),
11007 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11008 		ALC282_STANDARD_PINS,
11009 		{0x12, 0x99a30130},
11010 		{0x19, 0x03a11030},
11011 		{0x21, 0x03211020}),
11012 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11013 		ALC282_STANDARD_PINS,
11014 		{0x12, 0x99a30130},
11015 		{0x19, 0x04a11020},
11016 		{0x21, 0x0421101f}),
11017 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
11018 		ALC282_STANDARD_PINS,
11019 		{0x12, 0x90a60140},
11020 		{0x19, 0x04a11030},
11021 		{0x21, 0x04211020}),
11022 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11023 		ALC282_STANDARD_PINS,
11024 		{0x12, 0x90a609c0},
11025 		{0x18, 0x03a11830},
11026 		{0x19, 0x04a19831},
11027 		{0x1a, 0x0481303f},
11028 		{0x1b, 0x04211020},
11029 		{0x21, 0x0321101f}),
11030 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11031 		ALC282_STANDARD_PINS,
11032 		{0x12, 0x90a60940},
11033 		{0x18, 0x03a11830},
11034 		{0x19, 0x04a19831},
11035 		{0x1a, 0x0481303f},
11036 		{0x1b, 0x04211020},
11037 		{0x21, 0x0321101f}),
11038 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11039 		ALC282_STANDARD_PINS,
11040 		{0x12, 0x90a60130},
11041 		{0x21, 0x0321101f}),
11042 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11043 		{0x12, 0x90a60160},
11044 		{0x14, 0x90170120},
11045 		{0x21, 0x02211030}),
11046 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11047 		ALC282_STANDARD_PINS,
11048 		{0x12, 0x90a60130},
11049 		{0x19, 0x03a11020},
11050 		{0x21, 0x0321101f}),
11051 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11052 		{0x12, 0x90a60130},
11053 		{0x14, 0x90170110},
11054 		{0x19, 0x04a11040},
11055 		{0x21, 0x04211020}),
11056 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11057 		{0x14, 0x90170110},
11058 		{0x19, 0x04a11040},
11059 		{0x1d, 0x40600001},
11060 		{0x21, 0x04211020}),
11061 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
11062 		{0x14, 0x90170110},
11063 		{0x19, 0x04a11040},
11064 		{0x21, 0x04211020}),
11065 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
11066 		{0x14, 0x90170110},
11067 		{0x17, 0x90170111},
11068 		{0x19, 0x03a11030},
11069 		{0x21, 0x03211020}),
11070 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11071 		{0x17, 0x90170110},
11072 		{0x19, 0x03a11030},
11073 		{0x21, 0x03211020}),
11074 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11075 		{0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
11076 		{0x19, 0x04a11040},
11077 		{0x21, 0x04211020}),
11078 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
11079 		{0x12, 0x90a60130},
11080 		{0x17, 0x90170110},
11081 		{0x21, 0x02211020}),
11082 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
11083 		{0x12, 0x90a60120},
11084 		{0x14, 0x90170110},
11085 		{0x21, 0x0321101f}),
11086 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11087 		ALC290_STANDARD_PINS,
11088 		{0x15, 0x04211040},
11089 		{0x18, 0x90170112},
11090 		{0x1a, 0x04a11020}),
11091 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11092 		ALC290_STANDARD_PINS,
11093 		{0x15, 0x04211040},
11094 		{0x18, 0x90170110},
11095 		{0x1a, 0x04a11020}),
11096 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11097 		ALC290_STANDARD_PINS,
11098 		{0x15, 0x0421101f},
11099 		{0x1a, 0x04a11020}),
11100 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11101 		ALC290_STANDARD_PINS,
11102 		{0x15, 0x04211020},
11103 		{0x1a, 0x04a11040}),
11104 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11105 		ALC290_STANDARD_PINS,
11106 		{0x14, 0x90170110},
11107 		{0x15, 0x04211020},
11108 		{0x1a, 0x04a11040}),
11109 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11110 		ALC290_STANDARD_PINS,
11111 		{0x14, 0x90170110},
11112 		{0x15, 0x04211020},
11113 		{0x1a, 0x04a11020}),
11114 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11115 		ALC290_STANDARD_PINS,
11116 		{0x14, 0x90170110},
11117 		{0x15, 0x0421101f},
11118 		{0x1a, 0x04a11020}),
11119 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11120 		ALC292_STANDARD_PINS,
11121 		{0x12, 0x90a60140},
11122 		{0x16, 0x01014020},
11123 		{0x19, 0x01a19030}),
11124 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11125 		ALC292_STANDARD_PINS,
11126 		{0x12, 0x90a60140},
11127 		{0x16, 0x01014020},
11128 		{0x18, 0x02a19031},
11129 		{0x19, 0x01a1903e}),
11130 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
11131 		ALC292_STANDARD_PINS,
11132 		{0x12, 0x90a60140}),
11133 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11134 		ALC292_STANDARD_PINS,
11135 		{0x13, 0x90a60140},
11136 		{0x16, 0x21014020},
11137 		{0x19, 0x21a19030}),
11138 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11139 		ALC292_STANDARD_PINS,
11140 		{0x13, 0x90a60140}),
11141 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
11142 		{0x17, 0x90170110},
11143 		{0x21, 0x04211020}),
11144 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
11145 		{0x14, 0x90170110},
11146 		{0x1b, 0x90a70130},
11147 		{0x21, 0x04211020}),
11148 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11149 		{0x12, 0x90a60130},
11150 		{0x17, 0x90170110},
11151 		{0x21, 0x03211020}),
11152 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11153 		{0x12, 0x90a60130},
11154 		{0x17, 0x90170110},
11155 		{0x21, 0x04211020}),
11156 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11157 		{0x12, 0x90a60130},
11158 		{0x17, 0x90170110},
11159 		{0x21, 0x03211020}),
11160 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11161 		{0x12, 0x90a60120},
11162 		{0x17, 0x90170110},
11163 		{0x21, 0x04211030}),
11164 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11165 		{0x12, 0x90a60130},
11166 		{0x17, 0x90170110},
11167 		{0x21, 0x03211020}),
11168 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11169 		{0x12, 0x90a60130},
11170 		{0x17, 0x90170110},
11171 		{0x21, 0x03211020}),
11172 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11173 		ALC298_STANDARD_PINS,
11174 		{0x17, 0x90170110}),
11175 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11176 		ALC298_STANDARD_PINS,
11177 		{0x17, 0x90170140}),
11178 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11179 		ALC298_STANDARD_PINS,
11180 		{0x17, 0x90170150}),
11181 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11182 		{0x12, 0xb7a60140},
11183 		{0x13, 0xb7a60150},
11184 		{0x17, 0x90170110},
11185 		{0x1a, 0x03011020},
11186 		{0x21, 0x03211030}),
11187 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11188 		{0x12, 0xb7a60140},
11189 		{0x17, 0x90170110},
11190 		{0x1a, 0x03a11030},
11191 		{0x21, 0x03211020}),
11192 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11193 		ALC225_STANDARD_PINS,
11194 		{0x12, 0xb7a60130},
11195 		{0x17, 0x90170110}),
11196 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11197 		{0x14, 0x01014010},
11198 		{0x17, 0x90170120},
11199 		{0x18, 0x02a11030},
11200 		{0x19, 0x02a1103f},
11201 		{0x21, 0x0221101f}),
11202 	{}
11203 };
11204 
11205 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11206  * more machines, don't need to match all valid pins, just need to match
11207  * all the pins defined in the tbl. Just because of this reason, it is possible
11208  * that a single machine matches multiple tbls, so there is one limitation:
11209  *   at most one tbl is allowed to define for the same vendor and same codec
11210  */
11211 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11212 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11213 		{0x19, 0x40000000}),
11214 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11215 		{0x19, 0x40000000},
11216 		{0x1b, 0x40000000}),
11217 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11218 		{0x19, 0x40000000},
11219 		{0x1b, 0x40000000}),
11220 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11221 		{0x19, 0x40000000},
11222 		{0x1a, 0x40000000}),
11223 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11224 		{0x19, 0x40000000},
11225 		{0x1a, 0x40000000}),
11226 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
11227 		{0x19, 0x40000000},
11228 		{0x1a, 0x40000000}),
11229 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11230 		{0x19, 0x40000000}),
11231 	{}
11232 };
11233 
11234 static void alc269_fill_coef(struct hda_codec *codec)
11235 {
11236 	struct alc_spec *spec = codec->spec;
11237 	int val;
11238 
11239 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11240 		return;
11241 
11242 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11243 		alc_write_coef_idx(codec, 0xf, 0x960b);
11244 		alc_write_coef_idx(codec, 0xe, 0x8817);
11245 	}
11246 
11247 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11248 		alc_write_coef_idx(codec, 0xf, 0x960b);
11249 		alc_write_coef_idx(codec, 0xe, 0x8814);
11250 	}
11251 
11252 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11253 		/* Power up output pin */
11254 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11255 	}
11256 
11257 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11258 		val = alc_read_coef_idx(codec, 0xd);
11259 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11260 			/* Capless ramp up clock control */
11261 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
11262 		}
11263 		val = alc_read_coef_idx(codec, 0x17);
11264 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11265 			/* Class D power on reset */
11266 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
11267 		}
11268 	}
11269 
11270 	/* HP */
11271 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11272 }
11273 
11274 /*
11275  */
11276 static int patch_alc269(struct hda_codec *codec)
11277 {
11278 	struct alc_spec *spec;
11279 	int err;
11280 
11281 	err = alc_alloc_spec(codec, 0x0b);
11282 	if (err < 0)
11283 		return err;
11284 
11285 	spec = codec->spec;
11286 	spec->gen.shared_mic_vref_pin = 0x18;
11287 	codec->power_save_node = 0;
11288 	spec->en_3kpull_low = true;
11289 
11290 #ifdef CONFIG_PM
11291 	codec->patch_ops.suspend = alc269_suspend;
11292 	codec->patch_ops.resume = alc269_resume;
11293 #endif
11294 	spec->shutup = alc_default_shutup;
11295 	spec->init_hook = alc_default_init;
11296 
11297 	switch (codec->core.vendor_id) {
11298 	case 0x10ec0269:
11299 		spec->codec_variant = ALC269_TYPE_ALC269VA;
11300 		switch (alc_get_coef0(codec) & 0x00f0) {
11301 		case 0x0010:
11302 			if (codec->bus->pci &&
11303 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
11304 			    spec->cdefine.platform_type == 1)
11305 				err = alc_codec_rename(codec, "ALC271X");
11306 			spec->codec_variant = ALC269_TYPE_ALC269VB;
11307 			break;
11308 		case 0x0020:
11309 			if (codec->bus->pci &&
11310 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
11311 			    codec->bus->pci->subsystem_device == 0x21f3)
11312 				err = alc_codec_rename(codec, "ALC3202");
11313 			spec->codec_variant = ALC269_TYPE_ALC269VC;
11314 			break;
11315 		case 0x0030:
11316 			spec->codec_variant = ALC269_TYPE_ALC269VD;
11317 			break;
11318 		default:
11319 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
11320 		}
11321 		if (err < 0)
11322 			goto error;
11323 		spec->shutup = alc269_shutup;
11324 		spec->init_hook = alc269_fill_coef;
11325 		alc269_fill_coef(codec);
11326 		break;
11327 
11328 	case 0x10ec0280:
11329 	case 0x10ec0290:
11330 		spec->codec_variant = ALC269_TYPE_ALC280;
11331 		break;
11332 	case 0x10ec0282:
11333 		spec->codec_variant = ALC269_TYPE_ALC282;
11334 		spec->shutup = alc282_shutup;
11335 		spec->init_hook = alc282_init;
11336 		break;
11337 	case 0x10ec0233:
11338 	case 0x10ec0283:
11339 		spec->codec_variant = ALC269_TYPE_ALC283;
11340 		spec->shutup = alc283_shutup;
11341 		spec->init_hook = alc283_init;
11342 		break;
11343 	case 0x10ec0284:
11344 	case 0x10ec0292:
11345 		spec->codec_variant = ALC269_TYPE_ALC284;
11346 		break;
11347 	case 0x10ec0293:
11348 		spec->codec_variant = ALC269_TYPE_ALC293;
11349 		break;
11350 	case 0x10ec0286:
11351 	case 0x10ec0288:
11352 		spec->codec_variant = ALC269_TYPE_ALC286;
11353 		break;
11354 	case 0x10ec0298:
11355 		spec->codec_variant = ALC269_TYPE_ALC298;
11356 		break;
11357 	case 0x10ec0235:
11358 	case 0x10ec0255:
11359 		spec->codec_variant = ALC269_TYPE_ALC255;
11360 		spec->shutup = alc256_shutup;
11361 		spec->init_hook = alc256_init;
11362 		break;
11363 	case 0x10ec0230:
11364 	case 0x10ec0236:
11365 	case 0x10ec0256:
11366 	case 0x19e58326:
11367 		spec->codec_variant = ALC269_TYPE_ALC256;
11368 		spec->shutup = alc256_shutup;
11369 		spec->init_hook = alc256_init;
11370 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
11371 		if (codec->core.vendor_id == 0x10ec0236 &&
11372 		    codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
11373 			spec->en_3kpull_low = false;
11374 		break;
11375 	case 0x10ec0257:
11376 		spec->codec_variant = ALC269_TYPE_ALC257;
11377 		spec->shutup = alc256_shutup;
11378 		spec->init_hook = alc256_init;
11379 		spec->gen.mixer_nid = 0;
11380 		spec->en_3kpull_low = false;
11381 		break;
11382 	case 0x10ec0215:
11383 	case 0x10ec0245:
11384 	case 0x10ec0285:
11385 	case 0x10ec0289:
11386 		if (alc_get_coef0(codec) & 0x0010)
11387 			spec->codec_variant = ALC269_TYPE_ALC245;
11388 		else
11389 			spec->codec_variant = ALC269_TYPE_ALC215;
11390 		spec->shutup = alc225_shutup;
11391 		spec->init_hook = alc225_init;
11392 		spec->gen.mixer_nid = 0;
11393 		break;
11394 	case 0x10ec0225:
11395 	case 0x10ec0295:
11396 	case 0x10ec0299:
11397 		spec->codec_variant = ALC269_TYPE_ALC225;
11398 		spec->shutup = alc225_shutup;
11399 		spec->init_hook = alc225_init;
11400 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
11401 		break;
11402 	case 0x10ec0287:
11403 		spec->codec_variant = ALC269_TYPE_ALC287;
11404 		spec->shutup = alc225_shutup;
11405 		spec->init_hook = alc225_init;
11406 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
11407 		break;
11408 	case 0x10ec0234:
11409 	case 0x10ec0274:
11410 	case 0x10ec0294:
11411 		spec->codec_variant = ALC269_TYPE_ALC294;
11412 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
11413 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
11414 		spec->init_hook = alc294_init;
11415 		break;
11416 	case 0x10ec0300:
11417 		spec->codec_variant = ALC269_TYPE_ALC300;
11418 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
11419 		break;
11420 	case 0x10ec0623:
11421 		spec->codec_variant = ALC269_TYPE_ALC623;
11422 		break;
11423 	case 0x10ec0700:
11424 	case 0x10ec0701:
11425 	case 0x10ec0703:
11426 	case 0x10ec0711:
11427 		spec->codec_variant = ALC269_TYPE_ALC700;
11428 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
11429 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
11430 		spec->init_hook = alc294_init;
11431 		break;
11432 
11433 	}
11434 
11435 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
11436 		spec->has_alc5505_dsp = 1;
11437 		spec->init_hook = alc5505_dsp_init;
11438 	}
11439 
11440 	alc_pre_init(codec);
11441 
11442 	snd_hda_pick_fixup(codec, alc269_fixup_models,
11443 		       alc269_fixup_tbl, alc269_fixups);
11444 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
11445 	 * the quirk breaks the latter (bko#214101).
11446 	 * Clear the wrong entry.
11447 	 */
11448 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
11449 	    codec->core.vendor_id == 0x10ec0294) {
11450 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
11451 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
11452 	}
11453 
11454 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
11455 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
11456 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
11457 			   alc269_fixups);
11458 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11459 
11460 	alc_auto_parse_customize_define(codec);
11461 
11462 	if (has_cdefine_beep(codec))
11463 		spec->gen.beep_nid = 0x01;
11464 
11465 	/* automatic parse from the BIOS config */
11466 	err = alc269_parse_auto_config(codec);
11467 	if (err < 0)
11468 		goto error;
11469 
11470 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
11471 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
11472 		if (err < 0)
11473 			goto error;
11474 	}
11475 
11476 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11477 
11478 	return 0;
11479 
11480  error:
11481 	alc_free(codec);
11482 	return err;
11483 }
11484 
11485 /*
11486  * ALC861
11487  */
11488 
11489 static int alc861_parse_auto_config(struct hda_codec *codec)
11490 {
11491 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11492 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
11493 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
11494 }
11495 
11496 /* Pin config fixes */
11497 enum {
11498 	ALC861_FIXUP_FSC_AMILO_PI1505,
11499 	ALC861_FIXUP_AMP_VREF_0F,
11500 	ALC861_FIXUP_NO_JACK_DETECT,
11501 	ALC861_FIXUP_ASUS_A6RP,
11502 	ALC660_FIXUP_ASUS_W7J,
11503 };
11504 
11505 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
11506 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
11507 			const struct hda_fixup *fix, int action)
11508 {
11509 	struct alc_spec *spec = codec->spec;
11510 	unsigned int val;
11511 
11512 	if (action != HDA_FIXUP_ACT_INIT)
11513 		return;
11514 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
11515 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
11516 		val |= AC_PINCTL_IN_EN;
11517 	val |= AC_PINCTL_VREF_50;
11518 	snd_hda_set_pin_ctl(codec, 0x0f, val);
11519 	spec->gen.keep_vref_in_automute = 1;
11520 }
11521 
11522 /* suppress the jack-detection */
11523 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
11524 				     const struct hda_fixup *fix, int action)
11525 {
11526 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11527 		codec->no_jack_detect = 1;
11528 }
11529 
11530 static const struct hda_fixup alc861_fixups[] = {
11531 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
11532 		.type = HDA_FIXUP_PINS,
11533 		.v.pins = (const struct hda_pintbl[]) {
11534 			{ 0x0b, 0x0221101f }, /* HP */
11535 			{ 0x0f, 0x90170310 }, /* speaker */
11536 			{ }
11537 		}
11538 	},
11539 	[ALC861_FIXUP_AMP_VREF_0F] = {
11540 		.type = HDA_FIXUP_FUNC,
11541 		.v.func = alc861_fixup_asus_amp_vref_0f,
11542 	},
11543 	[ALC861_FIXUP_NO_JACK_DETECT] = {
11544 		.type = HDA_FIXUP_FUNC,
11545 		.v.func = alc_fixup_no_jack_detect,
11546 	},
11547 	[ALC861_FIXUP_ASUS_A6RP] = {
11548 		.type = HDA_FIXUP_FUNC,
11549 		.v.func = alc861_fixup_asus_amp_vref_0f,
11550 		.chained = true,
11551 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
11552 	},
11553 	[ALC660_FIXUP_ASUS_W7J] = {
11554 		.type = HDA_FIXUP_VERBS,
11555 		.v.verbs = (const struct hda_verb[]) {
11556 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
11557 			 * for enabling outputs
11558 			 */
11559 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11560 			{ }
11561 		},
11562 	}
11563 };
11564 
11565 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
11566 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
11567 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
11568 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
11569 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
11570 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
11571 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
11572 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
11573 	{}
11574 };
11575 
11576 /*
11577  */
11578 static int patch_alc861(struct hda_codec *codec)
11579 {
11580 	struct alc_spec *spec;
11581 	int err;
11582 
11583 	err = alc_alloc_spec(codec, 0x15);
11584 	if (err < 0)
11585 		return err;
11586 
11587 	spec = codec->spec;
11588 	if (has_cdefine_beep(codec))
11589 		spec->gen.beep_nid = 0x23;
11590 
11591 #ifdef CONFIG_PM
11592 	spec->power_hook = alc_power_eapd;
11593 #endif
11594 
11595 	alc_pre_init(codec);
11596 
11597 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
11598 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11599 
11600 	/* automatic parse from the BIOS config */
11601 	err = alc861_parse_auto_config(codec);
11602 	if (err < 0)
11603 		goto error;
11604 
11605 	if (!spec->gen.no_analog) {
11606 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
11607 		if (err < 0)
11608 			goto error;
11609 	}
11610 
11611 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11612 
11613 	return 0;
11614 
11615  error:
11616 	alc_free(codec);
11617 	return err;
11618 }
11619 
11620 /*
11621  * ALC861-VD support
11622  *
11623  * Based on ALC882
11624  *
11625  * In addition, an independent DAC
11626  */
11627 static int alc861vd_parse_auto_config(struct hda_codec *codec)
11628 {
11629 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
11630 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11631 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
11632 }
11633 
11634 enum {
11635 	ALC660VD_FIX_ASUS_GPIO1,
11636 	ALC861VD_FIX_DALLAS,
11637 };
11638 
11639 /* exclude VREF80 */
11640 static void alc861vd_fixup_dallas(struct hda_codec *codec,
11641 				  const struct hda_fixup *fix, int action)
11642 {
11643 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11644 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
11645 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
11646 	}
11647 }
11648 
11649 /* reset GPIO1 */
11650 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
11651 				      const struct hda_fixup *fix, int action)
11652 {
11653 	struct alc_spec *spec = codec->spec;
11654 
11655 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11656 		spec->gpio_mask |= 0x02;
11657 	alc_fixup_gpio(codec, action, 0x01);
11658 }
11659 
11660 static const struct hda_fixup alc861vd_fixups[] = {
11661 	[ALC660VD_FIX_ASUS_GPIO1] = {
11662 		.type = HDA_FIXUP_FUNC,
11663 		.v.func = alc660vd_fixup_asus_gpio1,
11664 	},
11665 	[ALC861VD_FIX_DALLAS] = {
11666 		.type = HDA_FIXUP_FUNC,
11667 		.v.func = alc861vd_fixup_dallas,
11668 	},
11669 };
11670 
11671 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
11672 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
11673 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
11674 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
11675 	{}
11676 };
11677 
11678 /*
11679  */
11680 static int patch_alc861vd(struct hda_codec *codec)
11681 {
11682 	struct alc_spec *spec;
11683 	int err;
11684 
11685 	err = alc_alloc_spec(codec, 0x0b);
11686 	if (err < 0)
11687 		return err;
11688 
11689 	spec = codec->spec;
11690 	if (has_cdefine_beep(codec))
11691 		spec->gen.beep_nid = 0x23;
11692 
11693 	spec->shutup = alc_eapd_shutup;
11694 
11695 	alc_pre_init(codec);
11696 
11697 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
11698 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11699 
11700 	/* automatic parse from the BIOS config */
11701 	err = alc861vd_parse_auto_config(codec);
11702 	if (err < 0)
11703 		goto error;
11704 
11705 	if (!spec->gen.no_analog) {
11706 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11707 		if (err < 0)
11708 			goto error;
11709 	}
11710 
11711 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11712 
11713 	return 0;
11714 
11715  error:
11716 	alc_free(codec);
11717 	return err;
11718 }
11719 
11720 /*
11721  * ALC662 support
11722  *
11723  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11724  * configuration.  Each pin widget can choose any input DACs and a mixer.
11725  * Each ADC is connected from a mixer of all inputs.  This makes possible
11726  * 6-channel independent captures.
11727  *
11728  * In addition, an independent DAC for the multi-playback (not used in this
11729  * driver yet).
11730  */
11731 
11732 /*
11733  * BIOS auto configuration
11734  */
11735 
11736 static int alc662_parse_auto_config(struct hda_codec *codec)
11737 {
11738 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11739 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
11740 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11741 	const hda_nid_t *ssids;
11742 
11743 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
11744 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
11745 	    codec->core.vendor_id == 0x10ec0671)
11746 		ssids = alc663_ssids;
11747 	else
11748 		ssids = alc662_ssids;
11749 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
11750 }
11751 
11752 static void alc272_fixup_mario(struct hda_codec *codec,
11753 			       const struct hda_fixup *fix, int action)
11754 {
11755 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
11756 		return;
11757 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
11758 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
11759 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
11760 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11761 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
11762 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
11763 }
11764 
11765 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
11766 	{ .channels = 2,
11767 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
11768 	{ .channels = 4,
11769 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
11770 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
11771 	{ }
11772 };
11773 
11774 /* override the 2.1 chmap */
11775 static void alc_fixup_bass_chmap(struct hda_codec *codec,
11776 				    const struct hda_fixup *fix, int action)
11777 {
11778 	if (action == HDA_FIXUP_ACT_BUILD) {
11779 		struct alc_spec *spec = codec->spec;
11780 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
11781 	}
11782 }
11783 
11784 /* avoid D3 for keeping GPIO up */
11785 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
11786 					  hda_nid_t nid,
11787 					  unsigned int power_state)
11788 {
11789 	struct alc_spec *spec = codec->spec;
11790 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
11791 		return AC_PWRST_D0;
11792 	return power_state;
11793 }
11794 
11795 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
11796 				   const struct hda_fixup *fix, int action)
11797 {
11798 	struct alc_spec *spec = codec->spec;
11799 
11800 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
11801 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11802 		spec->mute_led_polarity = 1;
11803 		codec->power_filter = gpio_led_power_filter;
11804 	}
11805 }
11806 
11807 static void alc662_usi_automute_hook(struct hda_codec *codec,
11808 					 struct hda_jack_callback *jack)
11809 {
11810 	struct alc_spec *spec = codec->spec;
11811 	int vref;
11812 	msleep(200);
11813 	snd_hda_gen_hp_automute(codec, jack);
11814 
11815 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
11816 	msleep(100);
11817 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11818 			    vref);
11819 }
11820 
11821 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
11822 				     const struct hda_fixup *fix, int action)
11823 {
11824 	struct alc_spec *spec = codec->spec;
11825 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11826 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11827 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
11828 	}
11829 }
11830 
11831 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
11832 					struct hda_jack_callback *cb)
11833 {
11834 	/* surround speakers at 0x1b already get muted automatically when
11835 	 * headphones are plugged in, but we have to mute/unmute the remaining
11836 	 * channels manually:
11837 	 * 0x15 - front left/front right
11838 	 * 0x18 - front center/ LFE
11839 	 */
11840 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
11841 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
11842 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
11843 	} else {
11844 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
11845 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
11846 	}
11847 }
11848 
11849 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
11850 					const struct hda_fixup *fix, int action)
11851 {
11852     /* Pin 0x1b: shared headphones jack and surround speakers */
11853 	if (!is_jack_detectable(codec, 0x1b))
11854 		return;
11855 
11856 	switch (action) {
11857 	case HDA_FIXUP_ACT_PRE_PROBE:
11858 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
11859 				alc662_aspire_ethos_mute_speakers);
11860 		/* subwoofer needs an extra GPIO setting to become audible */
11861 		alc_setup_gpio(codec, 0x02);
11862 		break;
11863 	case HDA_FIXUP_ACT_INIT:
11864 		/* Make sure to start in a correct state, i.e. if
11865 		 * headphones have been plugged in before powering up the system
11866 		 */
11867 		alc662_aspire_ethos_mute_speakers(codec, NULL);
11868 		break;
11869 	}
11870 }
11871 
11872 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
11873 					     const struct hda_fixup *fix, int action)
11874 {
11875 	struct alc_spec *spec = codec->spec;
11876 
11877 	static const struct hda_pintbl pincfgs[] = {
11878 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
11879 		{ 0x1b, 0x0181304f },
11880 		{ }
11881 	};
11882 
11883 	switch (action) {
11884 	case HDA_FIXUP_ACT_PRE_PROBE:
11885 		spec->gen.mixer_nid = 0;
11886 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11887 		snd_hda_apply_pincfgs(codec, pincfgs);
11888 		break;
11889 	case HDA_FIXUP_ACT_INIT:
11890 		alc_write_coef_idx(codec, 0x19, 0xa054);
11891 		break;
11892 	}
11893 }
11894 
11895 static void alc897_hp_automute_hook(struct hda_codec *codec,
11896 					 struct hda_jack_callback *jack)
11897 {
11898 	struct alc_spec *spec = codec->spec;
11899 	int vref;
11900 
11901 	snd_hda_gen_hp_automute(codec, jack);
11902 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
11903 	snd_hda_set_pin_ctl(codec, 0x1b, vref);
11904 }
11905 
11906 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
11907 				     const struct hda_fixup *fix, int action)
11908 {
11909 	struct alc_spec *spec = codec->spec;
11910 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11911 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11912 		spec->no_shutup_pins = 1;
11913 	}
11914 	if (action == HDA_FIXUP_ACT_PROBE) {
11915 		snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
11916 	}
11917 }
11918 
11919 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
11920 				     const struct hda_fixup *fix, int action)
11921 {
11922 	struct alc_spec *spec = codec->spec;
11923 
11924 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11925 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11926 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11927 	}
11928 }
11929 
11930 static const struct coef_fw alc668_coefs[] = {
11931 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
11932 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
11933 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
11934 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
11935 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
11936 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
11937 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
11938 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
11939 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
11940 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
11941 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
11942 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
11943 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
11944 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
11945 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
11946 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
11947 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
11948 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
11949 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
11950 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
11951 	{}
11952 };
11953 
11954 static void alc668_restore_default_value(struct hda_codec *codec)
11955 {
11956 	alc_process_coef_fw(codec, alc668_coefs);
11957 }
11958 
11959 enum {
11960 	ALC662_FIXUP_ASPIRE,
11961 	ALC662_FIXUP_LED_GPIO1,
11962 	ALC662_FIXUP_IDEAPAD,
11963 	ALC272_FIXUP_MARIO,
11964 	ALC662_FIXUP_CZC_ET26,
11965 	ALC662_FIXUP_CZC_P10T,
11966 	ALC662_FIXUP_SKU_IGNORE,
11967 	ALC662_FIXUP_HP_RP5800,
11968 	ALC662_FIXUP_ASUS_MODE1,
11969 	ALC662_FIXUP_ASUS_MODE2,
11970 	ALC662_FIXUP_ASUS_MODE3,
11971 	ALC662_FIXUP_ASUS_MODE4,
11972 	ALC662_FIXUP_ASUS_MODE5,
11973 	ALC662_FIXUP_ASUS_MODE6,
11974 	ALC662_FIXUP_ASUS_MODE7,
11975 	ALC662_FIXUP_ASUS_MODE8,
11976 	ALC662_FIXUP_NO_JACK_DETECT,
11977 	ALC662_FIXUP_ZOTAC_Z68,
11978 	ALC662_FIXUP_INV_DMIC,
11979 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11980 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
11981 	ALC662_FIXUP_HEADSET_MODE,
11982 	ALC668_FIXUP_HEADSET_MODE,
11983 	ALC662_FIXUP_BASS_MODE4_CHMAP,
11984 	ALC662_FIXUP_BASS_16,
11985 	ALC662_FIXUP_BASS_1A,
11986 	ALC662_FIXUP_BASS_CHMAP,
11987 	ALC668_FIXUP_AUTO_MUTE,
11988 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
11989 	ALC668_FIXUP_DELL_XPS13,
11990 	ALC662_FIXUP_ASUS_Nx50,
11991 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11992 	ALC668_FIXUP_ASUS_Nx51,
11993 	ALC668_FIXUP_MIC_COEF,
11994 	ALC668_FIXUP_ASUS_G751,
11995 	ALC891_FIXUP_HEADSET_MODE,
11996 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11997 	ALC662_FIXUP_ACER_VERITON,
11998 	ALC892_FIXUP_ASROCK_MOBO,
11999 	ALC662_FIXUP_USI_FUNC,
12000 	ALC662_FIXUP_USI_HEADSET_MODE,
12001 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
12002 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
12003 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
12004 	ALC671_FIXUP_HP_HEADSET_MIC2,
12005 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
12006 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
12007 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
12008 	ALC668_FIXUP_HEADSET_MIC,
12009 	ALC668_FIXUP_MIC_DET_COEF,
12010 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
12011 	ALC897_FIXUP_HEADSET_MIC_PIN,
12012 	ALC897_FIXUP_HP_HSMIC_VERB,
12013 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
12014 	ALC897_FIXUP_HEADSET_MIC_PIN2,
12015 	ALC897_FIXUP_UNIS_H3C_X500S,
12016 };
12017 
12018 static const struct hda_fixup alc662_fixups[] = {
12019 	[ALC662_FIXUP_ASPIRE] = {
12020 		.type = HDA_FIXUP_PINS,
12021 		.v.pins = (const struct hda_pintbl[]) {
12022 			{ 0x15, 0x99130112 }, /* subwoofer */
12023 			{ }
12024 		}
12025 	},
12026 	[ALC662_FIXUP_LED_GPIO1] = {
12027 		.type = HDA_FIXUP_FUNC,
12028 		.v.func = alc662_fixup_led_gpio1,
12029 	},
12030 	[ALC662_FIXUP_IDEAPAD] = {
12031 		.type = HDA_FIXUP_PINS,
12032 		.v.pins = (const struct hda_pintbl[]) {
12033 			{ 0x17, 0x99130112 }, /* subwoofer */
12034 			{ }
12035 		},
12036 		.chained = true,
12037 		.chain_id = ALC662_FIXUP_LED_GPIO1,
12038 	},
12039 	[ALC272_FIXUP_MARIO] = {
12040 		.type = HDA_FIXUP_FUNC,
12041 		.v.func = alc272_fixup_mario,
12042 	},
12043 	[ALC662_FIXUP_CZC_ET26] = {
12044 		.type = HDA_FIXUP_PINS,
12045 		.v.pins = (const struct hda_pintbl[]) {
12046 			{0x12, 0x403cc000},
12047 			{0x14, 0x90170110}, /* speaker */
12048 			{0x15, 0x411111f0},
12049 			{0x16, 0x411111f0},
12050 			{0x18, 0x01a19030}, /* mic */
12051 			{0x19, 0x90a7013f}, /* int-mic */
12052 			{0x1a, 0x01014020},
12053 			{0x1b, 0x0121401f},
12054 			{0x1c, 0x411111f0},
12055 			{0x1d, 0x411111f0},
12056 			{0x1e, 0x40478e35},
12057 			{}
12058 		},
12059 		.chained = true,
12060 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12061 	},
12062 	[ALC662_FIXUP_CZC_P10T] = {
12063 		.type = HDA_FIXUP_VERBS,
12064 		.v.verbs = (const struct hda_verb[]) {
12065 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
12066 			{}
12067 		}
12068 	},
12069 	[ALC662_FIXUP_SKU_IGNORE] = {
12070 		.type = HDA_FIXUP_FUNC,
12071 		.v.func = alc_fixup_sku_ignore,
12072 	},
12073 	[ALC662_FIXUP_HP_RP5800] = {
12074 		.type = HDA_FIXUP_PINS,
12075 		.v.pins = (const struct hda_pintbl[]) {
12076 			{ 0x14, 0x0221201f }, /* HP out */
12077 			{ }
12078 		},
12079 		.chained = true,
12080 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12081 	},
12082 	[ALC662_FIXUP_ASUS_MODE1] = {
12083 		.type = HDA_FIXUP_PINS,
12084 		.v.pins = (const struct hda_pintbl[]) {
12085 			{ 0x14, 0x99130110 }, /* speaker */
12086 			{ 0x18, 0x01a19c20 }, /* mic */
12087 			{ 0x19, 0x99a3092f }, /* int-mic */
12088 			{ 0x21, 0x0121401f }, /* HP out */
12089 			{ }
12090 		},
12091 		.chained = true,
12092 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12093 	},
12094 	[ALC662_FIXUP_ASUS_MODE2] = {
12095 		.type = HDA_FIXUP_PINS,
12096 		.v.pins = (const struct hda_pintbl[]) {
12097 			{ 0x14, 0x99130110 }, /* speaker */
12098 			{ 0x18, 0x01a19820 }, /* mic */
12099 			{ 0x19, 0x99a3092f }, /* int-mic */
12100 			{ 0x1b, 0x0121401f }, /* HP out */
12101 			{ }
12102 		},
12103 		.chained = true,
12104 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12105 	},
12106 	[ALC662_FIXUP_ASUS_MODE3] = {
12107 		.type = HDA_FIXUP_PINS,
12108 		.v.pins = (const struct hda_pintbl[]) {
12109 			{ 0x14, 0x99130110 }, /* speaker */
12110 			{ 0x15, 0x0121441f }, /* HP */
12111 			{ 0x18, 0x01a19840 }, /* mic */
12112 			{ 0x19, 0x99a3094f }, /* int-mic */
12113 			{ 0x21, 0x01211420 }, /* HP2 */
12114 			{ }
12115 		},
12116 		.chained = true,
12117 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12118 	},
12119 	[ALC662_FIXUP_ASUS_MODE4] = {
12120 		.type = HDA_FIXUP_PINS,
12121 		.v.pins = (const struct hda_pintbl[]) {
12122 			{ 0x14, 0x99130110 }, /* speaker */
12123 			{ 0x16, 0x99130111 }, /* speaker */
12124 			{ 0x18, 0x01a19840 }, /* mic */
12125 			{ 0x19, 0x99a3094f }, /* int-mic */
12126 			{ 0x21, 0x0121441f }, /* HP */
12127 			{ }
12128 		},
12129 		.chained = true,
12130 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12131 	},
12132 	[ALC662_FIXUP_ASUS_MODE5] = {
12133 		.type = HDA_FIXUP_PINS,
12134 		.v.pins = (const struct hda_pintbl[]) {
12135 			{ 0x14, 0x99130110 }, /* speaker */
12136 			{ 0x15, 0x0121441f }, /* HP */
12137 			{ 0x16, 0x99130111 }, /* speaker */
12138 			{ 0x18, 0x01a19840 }, /* mic */
12139 			{ 0x19, 0x99a3094f }, /* int-mic */
12140 			{ }
12141 		},
12142 		.chained = true,
12143 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12144 	},
12145 	[ALC662_FIXUP_ASUS_MODE6] = {
12146 		.type = HDA_FIXUP_PINS,
12147 		.v.pins = (const struct hda_pintbl[]) {
12148 			{ 0x14, 0x99130110 }, /* speaker */
12149 			{ 0x15, 0x01211420 }, /* HP2 */
12150 			{ 0x18, 0x01a19840 }, /* mic */
12151 			{ 0x19, 0x99a3094f }, /* int-mic */
12152 			{ 0x1b, 0x0121441f }, /* HP */
12153 			{ }
12154 		},
12155 		.chained = true,
12156 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12157 	},
12158 	[ALC662_FIXUP_ASUS_MODE7] = {
12159 		.type = HDA_FIXUP_PINS,
12160 		.v.pins = (const struct hda_pintbl[]) {
12161 			{ 0x14, 0x99130110 }, /* speaker */
12162 			{ 0x17, 0x99130111 }, /* speaker */
12163 			{ 0x18, 0x01a19840 }, /* mic */
12164 			{ 0x19, 0x99a3094f }, /* int-mic */
12165 			{ 0x1b, 0x01214020 }, /* HP */
12166 			{ 0x21, 0x0121401f }, /* HP */
12167 			{ }
12168 		},
12169 		.chained = true,
12170 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12171 	},
12172 	[ALC662_FIXUP_ASUS_MODE8] = {
12173 		.type = HDA_FIXUP_PINS,
12174 		.v.pins = (const struct hda_pintbl[]) {
12175 			{ 0x14, 0x99130110 }, /* speaker */
12176 			{ 0x12, 0x99a30970 }, /* int-mic */
12177 			{ 0x15, 0x01214020 }, /* HP */
12178 			{ 0x17, 0x99130111 }, /* speaker */
12179 			{ 0x18, 0x01a19840 }, /* mic */
12180 			{ 0x21, 0x0121401f }, /* HP */
12181 			{ }
12182 		},
12183 		.chained = true,
12184 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12185 	},
12186 	[ALC662_FIXUP_NO_JACK_DETECT] = {
12187 		.type = HDA_FIXUP_FUNC,
12188 		.v.func = alc_fixup_no_jack_detect,
12189 	},
12190 	[ALC662_FIXUP_ZOTAC_Z68] = {
12191 		.type = HDA_FIXUP_PINS,
12192 		.v.pins = (const struct hda_pintbl[]) {
12193 			{ 0x1b, 0x02214020 }, /* Front HP */
12194 			{ }
12195 		}
12196 	},
12197 	[ALC662_FIXUP_INV_DMIC] = {
12198 		.type = HDA_FIXUP_FUNC,
12199 		.v.func = alc_fixup_inv_dmic,
12200 	},
12201 	[ALC668_FIXUP_DELL_XPS13] = {
12202 		.type = HDA_FIXUP_FUNC,
12203 		.v.func = alc_fixup_dell_xps13,
12204 		.chained = true,
12205 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12206 	},
12207 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12208 		.type = HDA_FIXUP_FUNC,
12209 		.v.func = alc_fixup_disable_aamix,
12210 		.chained = true,
12211 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12212 	},
12213 	[ALC668_FIXUP_AUTO_MUTE] = {
12214 		.type = HDA_FIXUP_FUNC,
12215 		.v.func = alc_fixup_auto_mute_via_amp,
12216 		.chained = true,
12217 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12218 	},
12219 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12220 		.type = HDA_FIXUP_PINS,
12221 		.v.pins = (const struct hda_pintbl[]) {
12222 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12223 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12224 			{ }
12225 		},
12226 		.chained = true,
12227 		.chain_id = ALC662_FIXUP_HEADSET_MODE
12228 	},
12229 	[ALC662_FIXUP_HEADSET_MODE] = {
12230 		.type = HDA_FIXUP_FUNC,
12231 		.v.func = alc_fixup_headset_mode_alc662,
12232 	},
12233 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12234 		.type = HDA_FIXUP_PINS,
12235 		.v.pins = (const struct hda_pintbl[]) {
12236 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12237 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12238 			{ }
12239 		},
12240 		.chained = true,
12241 		.chain_id = ALC668_FIXUP_HEADSET_MODE
12242 	},
12243 	[ALC668_FIXUP_HEADSET_MODE] = {
12244 		.type = HDA_FIXUP_FUNC,
12245 		.v.func = alc_fixup_headset_mode_alc668,
12246 	},
12247 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12248 		.type = HDA_FIXUP_FUNC,
12249 		.v.func = alc_fixup_bass_chmap,
12250 		.chained = true,
12251 		.chain_id = ALC662_FIXUP_ASUS_MODE4
12252 	},
12253 	[ALC662_FIXUP_BASS_16] = {
12254 		.type = HDA_FIXUP_PINS,
12255 		.v.pins = (const struct hda_pintbl[]) {
12256 			{0x16, 0x80106111}, /* bass speaker */
12257 			{}
12258 		},
12259 		.chained = true,
12260 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12261 	},
12262 	[ALC662_FIXUP_BASS_1A] = {
12263 		.type = HDA_FIXUP_PINS,
12264 		.v.pins = (const struct hda_pintbl[]) {
12265 			{0x1a, 0x80106111}, /* bass speaker */
12266 			{}
12267 		},
12268 		.chained = true,
12269 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12270 	},
12271 	[ALC662_FIXUP_BASS_CHMAP] = {
12272 		.type = HDA_FIXUP_FUNC,
12273 		.v.func = alc_fixup_bass_chmap,
12274 	},
12275 	[ALC662_FIXUP_ASUS_Nx50] = {
12276 		.type = HDA_FIXUP_FUNC,
12277 		.v.func = alc_fixup_auto_mute_via_amp,
12278 		.chained = true,
12279 		.chain_id = ALC662_FIXUP_BASS_1A
12280 	},
12281 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12282 		.type = HDA_FIXUP_FUNC,
12283 		.v.func = alc_fixup_headset_mode_alc668,
12284 		.chain_id = ALC662_FIXUP_BASS_CHMAP
12285 	},
12286 	[ALC668_FIXUP_ASUS_Nx51] = {
12287 		.type = HDA_FIXUP_PINS,
12288 		.v.pins = (const struct hda_pintbl[]) {
12289 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12290 			{ 0x1a, 0x90170151 }, /* bass speaker */
12291 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12292 			{}
12293 		},
12294 		.chained = true,
12295 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12296 	},
12297 	[ALC668_FIXUP_MIC_COEF] = {
12298 		.type = HDA_FIXUP_VERBS,
12299 		.v.verbs = (const struct hda_verb[]) {
12300 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12301 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12302 			{}
12303 		},
12304 	},
12305 	[ALC668_FIXUP_ASUS_G751] = {
12306 		.type = HDA_FIXUP_PINS,
12307 		.v.pins = (const struct hda_pintbl[]) {
12308 			{ 0x16, 0x0421101f }, /* HP */
12309 			{}
12310 		},
12311 		.chained = true,
12312 		.chain_id = ALC668_FIXUP_MIC_COEF
12313 	},
12314 	[ALC891_FIXUP_HEADSET_MODE] = {
12315 		.type = HDA_FIXUP_FUNC,
12316 		.v.func = alc_fixup_headset_mode,
12317 	},
12318 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
12319 		.type = HDA_FIXUP_PINS,
12320 		.v.pins = (const struct hda_pintbl[]) {
12321 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12322 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12323 			{ }
12324 		},
12325 		.chained = true,
12326 		.chain_id = ALC891_FIXUP_HEADSET_MODE
12327 	},
12328 	[ALC662_FIXUP_ACER_VERITON] = {
12329 		.type = HDA_FIXUP_PINS,
12330 		.v.pins = (const struct hda_pintbl[]) {
12331 			{ 0x15, 0x50170120 }, /* no internal speaker */
12332 			{ }
12333 		}
12334 	},
12335 	[ALC892_FIXUP_ASROCK_MOBO] = {
12336 		.type = HDA_FIXUP_PINS,
12337 		.v.pins = (const struct hda_pintbl[]) {
12338 			{ 0x15, 0x40f000f0 }, /* disabled */
12339 			{ 0x16, 0x40f000f0 }, /* disabled */
12340 			{ }
12341 		}
12342 	},
12343 	[ALC662_FIXUP_USI_FUNC] = {
12344 		.type = HDA_FIXUP_FUNC,
12345 		.v.func = alc662_fixup_usi_headset_mic,
12346 	},
12347 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
12348 		.type = HDA_FIXUP_PINS,
12349 		.v.pins = (const struct hda_pintbl[]) {
12350 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
12351 			{ 0x18, 0x01a1903d },
12352 			{ }
12353 		},
12354 		.chained = true,
12355 		.chain_id = ALC662_FIXUP_USI_FUNC
12356 	},
12357 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
12358 		.type = HDA_FIXUP_FUNC,
12359 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
12360 	},
12361 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
12362 		.type = HDA_FIXUP_FUNC,
12363 		.v.func = alc662_fixup_aspire_ethos_hp,
12364 	},
12365 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
12366 		.type = HDA_FIXUP_PINS,
12367 		.v.pins = (const struct hda_pintbl[]) {
12368 			{ 0x15, 0x92130110 }, /* front speakers */
12369 			{ 0x18, 0x99130111 }, /* center/subwoofer */
12370 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
12371 			{ }
12372 		},
12373 		.chained = true,
12374 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
12375 	},
12376 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
12377 		.type = HDA_FIXUP_FUNC,
12378 		.v.func = alc671_fixup_hp_headset_mic2,
12379 	},
12380 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
12381 		.type = HDA_FIXUP_PINS,
12382 		.v.pins = (const struct hda_pintbl[]) {
12383 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
12384 			{ }
12385 		},
12386 		.chained = true,
12387 		.chain_id = ALC662_FIXUP_USI_FUNC
12388 	},
12389 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
12390 		.type = HDA_FIXUP_PINS,
12391 		.v.pins = (const struct hda_pintbl[]) {
12392 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12393 			{ 0x1b, 0x0221144f },
12394 			{ }
12395 		},
12396 		.chained = true,
12397 		.chain_id = ALC662_FIXUP_USI_FUNC
12398 	},
12399 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
12400 		.type = HDA_FIXUP_PINS,
12401 		.v.pins = (const struct hda_pintbl[]) {
12402 			{ 0x1b, 0x04a1112c },
12403 			{ }
12404 		},
12405 		.chained = true,
12406 		.chain_id = ALC668_FIXUP_HEADSET_MIC
12407 	},
12408 	[ALC668_FIXUP_HEADSET_MIC] = {
12409 		.type = HDA_FIXUP_FUNC,
12410 		.v.func = alc269_fixup_headset_mic,
12411 		.chained = true,
12412 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
12413 	},
12414 	[ALC668_FIXUP_MIC_DET_COEF] = {
12415 		.type = HDA_FIXUP_VERBS,
12416 		.v.verbs = (const struct hda_verb[]) {
12417 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
12418 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
12419 			{}
12420 		},
12421 	},
12422 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
12423 		.type = HDA_FIXUP_FUNC,
12424 		.v.func = alc897_fixup_lenovo_headset_mic,
12425 	},
12426 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
12427 		.type = HDA_FIXUP_PINS,
12428 		.v.pins = (const struct hda_pintbl[]) {
12429 			{ 0x1a, 0x03a11050 },
12430 			{ }
12431 		},
12432 		.chained = true,
12433 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
12434 	},
12435 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
12436 		.type = HDA_FIXUP_PINS,
12437 		.v.pins = (const struct hda_pintbl[]) {
12438 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
12439 			{ }
12440 		},
12441 	},
12442 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
12443 		.type = HDA_FIXUP_FUNC,
12444 		.v.func = alc897_fixup_lenovo_headset_mode,
12445 	},
12446 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
12447 		.type = HDA_FIXUP_PINS,
12448 		.v.pins = (const struct hda_pintbl[]) {
12449 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12450 			{ }
12451 		},
12452 		.chained = true,
12453 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
12454 	},
12455 	[ALC897_FIXUP_UNIS_H3C_X500S] = {
12456 		.type = HDA_FIXUP_VERBS,
12457 		.v.verbs = (const struct hda_verb[]) {
12458 			{ 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
12459 			{}
12460 		},
12461 	},
12462 };
12463 
12464 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
12465 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
12466 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
12467 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
12468 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
12469 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
12470 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
12471 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
12472 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
12473 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
12474 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
12475 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
12476 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12477 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12478 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
12479 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
12480 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
12481 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12482 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12483 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12484 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12485 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12486 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
12487 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12488 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12489 	SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12490 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
12491 	SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
12492 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
12493 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
12494 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
12495 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
12496 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
12497 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
12498 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
12499 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12500 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
12501 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
12502 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
12503 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
12504 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
12505 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
12506 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12507 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
12508 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
12509 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
12510 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
12511 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
12512 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
12513 	SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
12514 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
12515 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
12516 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
12517 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
12518 	SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12519 	SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12520 	SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
12521 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
12522 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
12523 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
12524 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
12525 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
12526 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
12527 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
12528 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
12529 	SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
12530 
12531 #if 0
12532 	/* Below is a quirk table taken from the old code.
12533 	 * Basically the device should work as is without the fixup table.
12534 	 * If BIOS doesn't give a proper info, enable the corresponding
12535 	 * fixup entry.
12536 	 */
12537 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
12538 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
12539 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
12540 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
12541 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12542 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12543 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12544 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
12545 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
12546 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12547 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
12548 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
12549 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
12550 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
12551 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
12552 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12553 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
12554 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
12555 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12556 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12557 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12558 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12559 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
12560 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
12561 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
12562 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12563 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
12564 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12565 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12566 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
12567 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12568 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12569 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
12570 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
12571 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
12572 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
12573 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
12574 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
12575 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
12576 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12577 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
12578 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
12579 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12580 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
12581 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
12582 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
12583 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
12584 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
12585 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12586 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
12587 #endif
12588 	{}
12589 };
12590 
12591 static const struct hda_model_fixup alc662_fixup_models[] = {
12592 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
12593 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
12594 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
12595 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
12596 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
12597 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
12598 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
12599 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
12600 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
12601 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
12602 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
12603 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
12604 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
12605 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
12606 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
12607 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
12608 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
12609 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
12610 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
12611 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
12612 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
12613 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
12614 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
12615 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
12616 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
12617 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
12618 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
12619 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
12620 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
12621 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
12622 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
12623 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
12624 	{.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
12625 	{}
12626 };
12627 
12628 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
12629 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12630 		{0x17, 0x02211010},
12631 		{0x18, 0x01a19030},
12632 		{0x1a, 0x01813040},
12633 		{0x21, 0x01014020}),
12634 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12635 		{0x16, 0x01813030},
12636 		{0x17, 0x02211010},
12637 		{0x18, 0x01a19040},
12638 		{0x21, 0x01014020}),
12639 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12640 		{0x14, 0x01014010},
12641 		{0x18, 0x01a19020},
12642 		{0x1a, 0x0181302f},
12643 		{0x1b, 0x0221401f}),
12644 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12645 		{0x12, 0x99a30130},
12646 		{0x14, 0x90170110},
12647 		{0x15, 0x0321101f},
12648 		{0x16, 0x03011020}),
12649 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12650 		{0x12, 0x99a30140},
12651 		{0x14, 0x90170110},
12652 		{0x15, 0x0321101f},
12653 		{0x16, 0x03011020}),
12654 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12655 		{0x12, 0x99a30150},
12656 		{0x14, 0x90170110},
12657 		{0x15, 0x0321101f},
12658 		{0x16, 0x03011020}),
12659 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12660 		{0x14, 0x90170110},
12661 		{0x15, 0x0321101f},
12662 		{0x16, 0x03011020}),
12663 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
12664 		{0x12, 0x90a60130},
12665 		{0x14, 0x90170110},
12666 		{0x15, 0x0321101f}),
12667 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12668 		{0x14, 0x01014010},
12669 		{0x17, 0x90170150},
12670 		{0x19, 0x02a11060},
12671 		{0x1b, 0x01813030},
12672 		{0x21, 0x02211020}),
12673 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12674 		{0x14, 0x01014010},
12675 		{0x18, 0x01a19040},
12676 		{0x1b, 0x01813030},
12677 		{0x21, 0x02211020}),
12678 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12679 		{0x14, 0x01014020},
12680 		{0x17, 0x90170110},
12681 		{0x18, 0x01a19050},
12682 		{0x1b, 0x01813040},
12683 		{0x21, 0x02211030}),
12684 	{}
12685 };
12686 
12687 /*
12688  */
12689 static int patch_alc662(struct hda_codec *codec)
12690 {
12691 	struct alc_spec *spec;
12692 	int err;
12693 
12694 	err = alc_alloc_spec(codec, 0x0b);
12695 	if (err < 0)
12696 		return err;
12697 
12698 	spec = codec->spec;
12699 
12700 	spec->shutup = alc_eapd_shutup;
12701 
12702 	/* handle multiple HPs as is */
12703 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
12704 
12705 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
12706 
12707 	switch (codec->core.vendor_id) {
12708 	case 0x10ec0668:
12709 		spec->init_hook = alc668_restore_default_value;
12710 		break;
12711 	}
12712 
12713 	alc_pre_init(codec);
12714 
12715 	snd_hda_pick_fixup(codec, alc662_fixup_models,
12716 		       alc662_fixup_tbl, alc662_fixups);
12717 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
12718 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12719 
12720 	alc_auto_parse_customize_define(codec);
12721 
12722 	if (has_cdefine_beep(codec))
12723 		spec->gen.beep_nid = 0x01;
12724 
12725 	if ((alc_get_coef0(codec) & (1 << 14)) &&
12726 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
12727 	    spec->cdefine.platform_type == 1) {
12728 		err = alc_codec_rename(codec, "ALC272X");
12729 		if (err < 0)
12730 			goto error;
12731 	}
12732 
12733 	/* automatic parse from the BIOS config */
12734 	err = alc662_parse_auto_config(codec);
12735 	if (err < 0)
12736 		goto error;
12737 
12738 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
12739 		switch (codec->core.vendor_id) {
12740 		case 0x10ec0662:
12741 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12742 			break;
12743 		case 0x10ec0272:
12744 		case 0x10ec0663:
12745 		case 0x10ec0665:
12746 		case 0x10ec0668:
12747 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12748 			break;
12749 		case 0x10ec0273:
12750 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
12751 			break;
12752 		}
12753 		if (err < 0)
12754 			goto error;
12755 	}
12756 
12757 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12758 
12759 	return 0;
12760 
12761  error:
12762 	alc_free(codec);
12763 	return err;
12764 }
12765 
12766 /*
12767  * ALC680 support
12768  */
12769 
12770 static int alc680_parse_auto_config(struct hda_codec *codec)
12771 {
12772 	return alc_parse_auto_config(codec, NULL, NULL);
12773 }
12774 
12775 /*
12776  */
12777 static int patch_alc680(struct hda_codec *codec)
12778 {
12779 	int err;
12780 
12781 	/* ALC680 has no aa-loopback mixer */
12782 	err = alc_alloc_spec(codec, 0);
12783 	if (err < 0)
12784 		return err;
12785 
12786 	/* automatic parse from the BIOS config */
12787 	err = alc680_parse_auto_config(codec);
12788 	if (err < 0) {
12789 		alc_free(codec);
12790 		return err;
12791 	}
12792 
12793 	return 0;
12794 }
12795 
12796 /*
12797  * patch entries
12798  */
12799 static const struct hda_device_id snd_hda_id_realtek[] = {
12800 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
12801 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
12802 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
12803 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
12804 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
12805 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
12806 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
12807 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
12808 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
12809 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
12810 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
12811 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
12812 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
12813 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
12814 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
12815 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
12816 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
12817 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
12818 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
12819 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
12820 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
12821 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
12822 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
12823 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
12824 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
12825 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
12826 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
12827 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
12828 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
12829 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
12830 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
12831 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
12832 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
12833 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
12834 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
12835 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
12836 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
12837 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
12838 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
12839 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
12840 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
12841 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
12842 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
12843 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
12844 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
12845 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
12846 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
12847 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
12848 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
12849 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
12850 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
12851 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
12852 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
12853 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
12854 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
12855 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
12856 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
12857 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
12858 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
12859 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
12860 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
12861 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
12862 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
12863 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
12864 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
12865 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
12866 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
12867 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
12868 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
12869 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
12870 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
12871 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
12872 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
12873 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
12874 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
12875 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
12876 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
12877 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
12878 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
12879 	{} /* terminator */
12880 };
12881 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
12882 
12883 MODULE_LICENSE("GPL");
12884 MODULE_DESCRIPTION("Realtek HD-audio codec");
12885 MODULE_IMPORT_NS(SND_HDA_SCODEC_COMPONENT);
12886 
12887 static struct hda_codec_driver realtek_driver = {
12888 	.id = snd_hda_id_realtek,
12889 };
12890 
12891 module_hda_codec_driver(realtek_driver);
12892