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