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