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