xref: /openbmc/linux/sound/pci/hda/patch_realtek.c (revision cd1e565a5b7fa60c349ca8a16db1e61715fe8230)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Universal Interface for Intel High Definition Audio Codec
4  *
5  * HD audio interface patch for Realtek ALC codecs
6  *
7  * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8  *                    PeiSen Hou <pshou@realtek.com.tw>
9  *                    Takashi Iwai <tiwai@suse.de>
10  *                    Jonathan Woithe <jwoithe@just42.net>
11  */
12 
13 #include <linux/init.h>
14 #include <linux/delay.h>
15 #include <linux/slab.h>
16 #include <linux/pci.h>
17 #include <linux/dmi.h>
18 #include <linux/module.h>
19 #include <linux/input.h>
20 #include <linux/leds.h>
21 #include <linux/ctype.h>
22 #include <sound/core.h>
23 #include <sound/jack.h>
24 #include <sound/hda_codec.h>
25 #include "hda_local.h"
26 #include "hda_auto_parser.h"
27 #include "hda_jack.h"
28 #include "hda_generic.h"
29 #include "hda_component.h"
30 
31 /* keep halting ALC5505 DSP, for power saving */
32 #define HALT_REALTEK_ALC5505
33 
34 /* extra amp-initialization sequence types */
35 enum {
36 	ALC_INIT_UNDEFINED,
37 	ALC_INIT_NONE,
38 	ALC_INIT_DEFAULT,
39 };
40 
41 enum {
42 	ALC_HEADSET_MODE_UNKNOWN,
43 	ALC_HEADSET_MODE_UNPLUGGED,
44 	ALC_HEADSET_MODE_HEADSET,
45 	ALC_HEADSET_MODE_MIC,
46 	ALC_HEADSET_MODE_HEADPHONE,
47 };
48 
49 enum {
50 	ALC_HEADSET_TYPE_UNKNOWN,
51 	ALC_HEADSET_TYPE_CTIA,
52 	ALC_HEADSET_TYPE_OMTP,
53 };
54 
55 enum {
56 	ALC_KEY_MICMUTE_INDEX,
57 };
58 
59 struct alc_customize_define {
60 	unsigned int  sku_cfg;
61 	unsigned char port_connectivity;
62 	unsigned char check_sum;
63 	unsigned char customization;
64 	unsigned char external_amp;
65 	unsigned int  enable_pcbeep:1;
66 	unsigned int  platform_type:1;
67 	unsigned int  swap:1;
68 	unsigned int  override:1;
69 	unsigned int  fixup:1; /* Means that this sku is set by driver, not read from hw */
70 };
71 
72 struct alc_coef_led {
73 	unsigned int idx;
74 	unsigned int mask;
75 	unsigned int on;
76 	unsigned int off;
77 };
78 
79 struct alc_spec {
80 	struct hda_gen_spec gen; /* must be at head */
81 
82 	/* codec parameterization */
83 	struct alc_customize_define cdefine;
84 	unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
85 
86 	/* GPIO bits */
87 	unsigned int gpio_mask;
88 	unsigned int gpio_dir;
89 	unsigned int gpio_data;
90 	bool gpio_write_delay;	/* add a delay before writing gpio_data */
91 
92 	/* mute LED for HP laptops, see vref_mute_led_set() */
93 	int mute_led_polarity;
94 	int micmute_led_polarity;
95 	hda_nid_t mute_led_nid;
96 	hda_nid_t cap_mute_led_nid;
97 
98 	unsigned int gpio_mute_led_mask;
99 	unsigned int gpio_mic_led_mask;
100 	struct alc_coef_led mute_led_coef;
101 	struct alc_coef_led mic_led_coef;
102 	struct mutex coef_mutex;
103 
104 	hda_nid_t headset_mic_pin;
105 	hda_nid_t headphone_mic_pin;
106 	int current_headset_mode;
107 	int current_headset_type;
108 
109 	/* hooks */
110 	void (*init_hook)(struct hda_codec *codec);
111 #ifdef CONFIG_PM
112 	void (*power_hook)(struct hda_codec *codec);
113 #endif
114 	void (*shutup)(struct hda_codec *codec);
115 
116 	int init_amp;
117 	int codec_variant;	/* flag for other variants */
118 	unsigned int has_alc5505_dsp:1;
119 	unsigned int no_depop_delay:1;
120 	unsigned int done_hp_init:1;
121 	unsigned int no_shutup_pins:1;
122 	unsigned int ultra_low_power:1;
123 	unsigned int has_hs_key:1;
124 	unsigned int no_internal_mic_pin:1;
125 	unsigned int en_3kpull_low:1;
126 
127 	/* for PLL fix */
128 	hda_nid_t pll_nid;
129 	unsigned int pll_coef_idx, pll_coef_bit;
130 	unsigned int coef0;
131 	struct input_dev *kb_dev;
132 	u8 alc_mute_keycode_map[1];
133 
134 	/* component binding */
135 	struct component_match *match;
136 	struct hda_component comps[HDA_MAX_COMPONENTS];
137 };
138 
139 /*
140  * COEF access helper functions
141  */
142 
143 static void coef_mutex_lock(struct hda_codec *codec)
144 {
145 	struct alc_spec *spec = codec->spec;
146 
147 	snd_hda_power_up_pm(codec);
148 	mutex_lock(&spec->coef_mutex);
149 }
150 
151 static void coef_mutex_unlock(struct hda_codec *codec)
152 {
153 	struct alc_spec *spec = codec->spec;
154 
155 	mutex_unlock(&spec->coef_mutex);
156 	snd_hda_power_down_pm(codec);
157 }
158 
159 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 				 unsigned int coef_idx)
161 {
162 	unsigned int val;
163 
164 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
165 	val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
166 	return val;
167 }
168 
169 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
170 			       unsigned int coef_idx)
171 {
172 	unsigned int val;
173 
174 	coef_mutex_lock(codec);
175 	val = __alc_read_coefex_idx(codec, nid, coef_idx);
176 	coef_mutex_unlock(codec);
177 	return val;
178 }
179 
180 #define alc_read_coef_idx(codec, coef_idx) \
181 	alc_read_coefex_idx(codec, 0x20, coef_idx)
182 
183 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
184 				   unsigned int coef_idx, unsigned int coef_val)
185 {
186 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
187 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
188 }
189 
190 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
191 				 unsigned int coef_idx, unsigned int coef_val)
192 {
193 	coef_mutex_lock(codec);
194 	__alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
195 	coef_mutex_unlock(codec);
196 }
197 
198 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
199 	alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
200 
201 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
202 				    unsigned int coef_idx, unsigned int mask,
203 				    unsigned int bits_set)
204 {
205 	unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
206 
207 	if (val != -1)
208 		__alc_write_coefex_idx(codec, nid, coef_idx,
209 				       (val & ~mask) | bits_set);
210 }
211 
212 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
213 				  unsigned int coef_idx, unsigned int mask,
214 				  unsigned int bits_set)
215 {
216 	coef_mutex_lock(codec);
217 	__alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
218 	coef_mutex_unlock(codec);
219 }
220 
221 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set)	\
222 	alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
223 
224 /* a special bypass for COEF 0; read the cached value at the second time */
225 static unsigned int alc_get_coef0(struct hda_codec *codec)
226 {
227 	struct alc_spec *spec = codec->spec;
228 
229 	if (!spec->coef0)
230 		spec->coef0 = alc_read_coef_idx(codec, 0);
231 	return spec->coef0;
232 }
233 
234 /* coef writes/updates batch */
235 struct coef_fw {
236 	unsigned char nid;
237 	unsigned char idx;
238 	unsigned short mask;
239 	unsigned short val;
240 };
241 
242 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
243 	{ .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
244 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
245 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
246 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
247 
248 static void alc_process_coef_fw(struct hda_codec *codec,
249 				const struct coef_fw *fw)
250 {
251 	coef_mutex_lock(codec);
252 	for (; fw->nid; fw++) {
253 		if (fw->mask == (unsigned short)-1)
254 			__alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
255 		else
256 			__alc_update_coefex_idx(codec, fw->nid, fw->idx,
257 						fw->mask, fw->val);
258 	}
259 	coef_mutex_unlock(codec);
260 }
261 
262 /*
263  * GPIO setup tables, used in initialization
264  */
265 
266 /* Enable GPIO mask and set output */
267 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
268 {
269 	struct alc_spec *spec = codec->spec;
270 
271 	spec->gpio_mask |= mask;
272 	spec->gpio_dir |= mask;
273 	spec->gpio_data |= mask;
274 }
275 
276 static void alc_write_gpio_data(struct hda_codec *codec)
277 {
278 	struct alc_spec *spec = codec->spec;
279 
280 	snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
281 			    spec->gpio_data);
282 }
283 
284 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
285 				 bool on)
286 {
287 	struct alc_spec *spec = codec->spec;
288 	unsigned int oldval = spec->gpio_data;
289 
290 	if (on)
291 		spec->gpio_data |= mask;
292 	else
293 		spec->gpio_data &= ~mask;
294 	if (oldval != spec->gpio_data)
295 		alc_write_gpio_data(codec);
296 }
297 
298 static void alc_write_gpio(struct hda_codec *codec)
299 {
300 	struct alc_spec *spec = codec->spec;
301 
302 	if (!spec->gpio_mask)
303 		return;
304 
305 	snd_hda_codec_write(codec, codec->core.afg, 0,
306 			    AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
307 	snd_hda_codec_write(codec, codec->core.afg, 0,
308 			    AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
309 	if (spec->gpio_write_delay)
310 		msleep(1);
311 	alc_write_gpio_data(codec);
312 }
313 
314 static void alc_fixup_gpio(struct hda_codec *codec, int action,
315 			   unsigned int mask)
316 {
317 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
318 		alc_setup_gpio(codec, mask);
319 }
320 
321 static void alc_fixup_gpio1(struct hda_codec *codec,
322 			    const struct hda_fixup *fix, int action)
323 {
324 	alc_fixup_gpio(codec, action, 0x01);
325 }
326 
327 static void alc_fixup_gpio2(struct hda_codec *codec,
328 			    const struct hda_fixup *fix, int action)
329 {
330 	alc_fixup_gpio(codec, action, 0x02);
331 }
332 
333 static void alc_fixup_gpio3(struct hda_codec *codec,
334 			    const struct hda_fixup *fix, int action)
335 {
336 	alc_fixup_gpio(codec, action, 0x03);
337 }
338 
339 static void alc_fixup_gpio4(struct hda_codec *codec,
340 			    const struct hda_fixup *fix, int action)
341 {
342 	alc_fixup_gpio(codec, action, 0x04);
343 }
344 
345 static void alc_fixup_micmute_led(struct hda_codec *codec,
346 				  const struct hda_fixup *fix, int action)
347 {
348 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
349 		snd_hda_gen_add_micmute_led_cdev(codec, NULL);
350 }
351 
352 /*
353  * Fix hardware PLL issue
354  * On some codecs, the analog PLL gating control must be off while
355  * the default value is 1.
356  */
357 static void alc_fix_pll(struct hda_codec *codec)
358 {
359 	struct alc_spec *spec = codec->spec;
360 
361 	if (spec->pll_nid)
362 		alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
363 				      1 << spec->pll_coef_bit, 0);
364 }
365 
366 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
367 			     unsigned int coef_idx, unsigned int coef_bit)
368 {
369 	struct alc_spec *spec = codec->spec;
370 	spec->pll_nid = nid;
371 	spec->pll_coef_idx = coef_idx;
372 	spec->pll_coef_bit = coef_bit;
373 	alc_fix_pll(codec);
374 }
375 
376 /* update the master volume per volume-knob's unsol event */
377 static void alc_update_knob_master(struct hda_codec *codec,
378 				   struct hda_jack_callback *jack)
379 {
380 	unsigned int val;
381 	struct snd_kcontrol *kctl;
382 	struct snd_ctl_elem_value *uctl;
383 
384 	kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
385 	if (!kctl)
386 		return;
387 	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
388 	if (!uctl)
389 		return;
390 	val = snd_hda_codec_read(codec, jack->nid, 0,
391 				 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
392 	val &= HDA_AMP_VOLMASK;
393 	uctl->value.integer.value[0] = val;
394 	uctl->value.integer.value[1] = val;
395 	kctl->put(kctl, uctl);
396 	kfree(uctl);
397 }
398 
399 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
400 {
401 	/* For some reason, the res given from ALC880 is broken.
402 	   Here we adjust it properly. */
403 	snd_hda_jack_unsol_event(codec, res >> 2);
404 }
405 
406 /* Change EAPD to verb control */
407 static void alc_fill_eapd_coef(struct hda_codec *codec)
408 {
409 	int coef;
410 
411 	coef = alc_get_coef0(codec);
412 
413 	switch (codec->core.vendor_id) {
414 	case 0x10ec0262:
415 		alc_update_coef_idx(codec, 0x7, 0, 1<<5);
416 		break;
417 	case 0x10ec0267:
418 	case 0x10ec0268:
419 		alc_update_coef_idx(codec, 0x7, 0, 1<<13);
420 		break;
421 	case 0x10ec0269:
422 		if ((coef & 0x00f0) == 0x0010)
423 			alc_update_coef_idx(codec, 0xd, 0, 1<<14);
424 		if ((coef & 0x00f0) == 0x0020)
425 			alc_update_coef_idx(codec, 0x4, 1<<15, 0);
426 		if ((coef & 0x00f0) == 0x0030)
427 			alc_update_coef_idx(codec, 0x10, 1<<9, 0);
428 		break;
429 	case 0x10ec0280:
430 	case 0x10ec0284:
431 	case 0x10ec0290:
432 	case 0x10ec0292:
433 		alc_update_coef_idx(codec, 0x4, 1<<15, 0);
434 		break;
435 	case 0x10ec0225:
436 	case 0x10ec0295:
437 	case 0x10ec0299:
438 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
439 		fallthrough;
440 	case 0x10ec0215:
441 	case 0x10ec0285:
442 	case 0x10ec0289:
443 		alc_update_coef_idx(codec, 0x36, 1<<13, 0);
444 		fallthrough;
445 	case 0x10ec0230:
446 	case 0x10ec0233:
447 	case 0x10ec0235:
448 	case 0x10ec0236:
449 	case 0x10ec0245:
450 	case 0x10ec0255:
451 	case 0x10ec0256:
452 	case 0x19e58326:
453 	case 0x10ec0257:
454 	case 0x10ec0282:
455 	case 0x10ec0283:
456 	case 0x10ec0286:
457 	case 0x10ec0288:
458 	case 0x10ec0298:
459 	case 0x10ec0300:
460 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
461 		break;
462 	case 0x10ec0275:
463 		alc_update_coef_idx(codec, 0xe, 0, 1<<0);
464 		break;
465 	case 0x10ec0287:
466 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
467 		alc_write_coef_idx(codec, 0x8, 0x4ab7);
468 		break;
469 	case 0x10ec0293:
470 		alc_update_coef_idx(codec, 0xa, 1<<13, 0);
471 		break;
472 	case 0x10ec0234:
473 	case 0x10ec0274:
474 	case 0x10ec0294:
475 	case 0x10ec0700:
476 	case 0x10ec0701:
477 	case 0x10ec0703:
478 	case 0x10ec0711:
479 		alc_update_coef_idx(codec, 0x10, 1<<15, 0);
480 		break;
481 	case 0x10ec0662:
482 		if ((coef & 0x00f0) == 0x0030)
483 			alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
484 		break;
485 	case 0x10ec0272:
486 	case 0x10ec0273:
487 	case 0x10ec0663:
488 	case 0x10ec0665:
489 	case 0x10ec0670:
490 	case 0x10ec0671:
491 	case 0x10ec0672:
492 		alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
493 		break;
494 	case 0x10ec0222:
495 	case 0x10ec0623:
496 		alc_update_coef_idx(codec, 0x19, 1<<13, 0);
497 		break;
498 	case 0x10ec0668:
499 		alc_update_coef_idx(codec, 0x7, 3<<13, 0);
500 		break;
501 	case 0x10ec0867:
502 		alc_update_coef_idx(codec, 0x4, 1<<10, 0);
503 		break;
504 	case 0x10ec0888:
505 		if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
506 			alc_update_coef_idx(codec, 0x7, 1<<5, 0);
507 		break;
508 	case 0x10ec0892:
509 	case 0x10ec0897:
510 		alc_update_coef_idx(codec, 0x7, 1<<5, 0);
511 		break;
512 	case 0x10ec0899:
513 	case 0x10ec0900:
514 	case 0x10ec0b00:
515 	case 0x10ec1168:
516 	case 0x10ec1220:
517 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
518 		break;
519 	}
520 }
521 
522 /* additional initialization for ALC888 variants */
523 static void alc888_coef_init(struct hda_codec *codec)
524 {
525 	switch (alc_get_coef0(codec) & 0x00f0) {
526 	/* alc888-VA */
527 	case 0x00:
528 	/* alc888-VB */
529 	case 0x10:
530 		alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
531 		break;
532 	}
533 }
534 
535 /* turn on/off EAPD control (only if available) */
536 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
537 {
538 	if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
539 		return;
540 	if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
541 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
542 				    on ? 2 : 0);
543 }
544 
545 /* turn on/off EAPD controls of the codec */
546 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
547 {
548 	/* We currently only handle front, HP */
549 	static const hda_nid_t pins[] = {
550 		0x0f, 0x10, 0x14, 0x15, 0x17, 0
551 	};
552 	const hda_nid_t *p;
553 	for (p = pins; *p; p++)
554 		set_eapd(codec, *p, on);
555 }
556 
557 static int find_ext_mic_pin(struct hda_codec *codec);
558 
559 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
560 {
561 	const struct hda_pincfg *pin;
562 	int mic_pin = find_ext_mic_pin(codec);
563 	int i;
564 
565 	/* don't shut up pins when unloading the driver; otherwise it breaks
566 	 * the default pin setup at the next load of the driver
567 	 */
568 	if (codec->bus->shutdown)
569 		return;
570 
571 	snd_array_for_each(&codec->init_pins, i, pin) {
572 		/* use read here for syncing after issuing each verb */
573 		if (pin->nid != mic_pin)
574 			snd_hda_codec_read(codec, pin->nid, 0,
575 					AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
576 	}
577 
578 	codec->pins_shutup = 1;
579 }
580 
581 static void alc_shutup_pins(struct hda_codec *codec)
582 {
583 	struct alc_spec *spec = codec->spec;
584 
585 	switch (codec->core.vendor_id) {
586 	case 0x10ec0236:
587 	case 0x10ec0256:
588 	case 0x10ec0257:
589 	case 0x19e58326:
590 	case 0x10ec0283:
591 	case 0x10ec0285:
592 	case 0x10ec0286:
593 	case 0x10ec0287:
594 	case 0x10ec0288:
595 	case 0x10ec0295:
596 	case 0x10ec0298:
597 		alc_headset_mic_no_shutup(codec);
598 		break;
599 	default:
600 		if (!spec->no_shutup_pins)
601 			snd_hda_shutup_pins(codec);
602 		break;
603 	}
604 }
605 
606 /* generic shutup callback;
607  * just turning off EAPD and a little pause for avoiding pop-noise
608  */
609 static void alc_eapd_shutup(struct hda_codec *codec)
610 {
611 	struct alc_spec *spec = codec->spec;
612 
613 	alc_auto_setup_eapd(codec, false);
614 	if (!spec->no_depop_delay)
615 		msleep(200);
616 	alc_shutup_pins(codec);
617 }
618 
619 /* generic EAPD initialization */
620 static void alc_auto_init_amp(struct hda_codec *codec, int type)
621 {
622 	alc_auto_setup_eapd(codec, true);
623 	alc_write_gpio(codec);
624 	switch (type) {
625 	case ALC_INIT_DEFAULT:
626 		switch (codec->core.vendor_id) {
627 		case 0x10ec0260:
628 			alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
629 			break;
630 		case 0x10ec0880:
631 		case 0x10ec0882:
632 		case 0x10ec0883:
633 		case 0x10ec0885:
634 			alc_update_coef_idx(codec, 7, 0, 0x2030);
635 			break;
636 		case 0x10ec0888:
637 			alc888_coef_init(codec);
638 			break;
639 		}
640 		break;
641 	}
642 }
643 
644 /* get a primary headphone pin if available */
645 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
646 {
647 	if (spec->gen.autocfg.hp_pins[0])
648 		return spec->gen.autocfg.hp_pins[0];
649 	if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
650 		return spec->gen.autocfg.line_out_pins[0];
651 	return 0;
652 }
653 
654 /*
655  * Realtek SSID verification
656  */
657 
658 /* Could be any non-zero and even value. When used as fixup, tells
659  * the driver to ignore any present sku defines.
660  */
661 #define ALC_FIXUP_SKU_IGNORE (2)
662 
663 static void alc_fixup_sku_ignore(struct hda_codec *codec,
664 				 const struct hda_fixup *fix, int action)
665 {
666 	struct alc_spec *spec = codec->spec;
667 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
668 		spec->cdefine.fixup = 1;
669 		spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
670 	}
671 }
672 
673 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
674 				    const struct hda_fixup *fix, int action)
675 {
676 	struct alc_spec *spec = codec->spec;
677 
678 	if (action == HDA_FIXUP_ACT_PROBE) {
679 		spec->no_depop_delay = 1;
680 		codec->depop_delay = 0;
681 	}
682 }
683 
684 static int alc_auto_parse_customize_define(struct hda_codec *codec)
685 {
686 	unsigned int ass, tmp, i;
687 	unsigned nid = 0;
688 	struct alc_spec *spec = codec->spec;
689 
690 	spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
691 
692 	if (spec->cdefine.fixup) {
693 		ass = spec->cdefine.sku_cfg;
694 		if (ass == ALC_FIXUP_SKU_IGNORE)
695 			return -1;
696 		goto do_sku;
697 	}
698 
699 	if (!codec->bus->pci)
700 		return -1;
701 	ass = codec->core.subsystem_id & 0xffff;
702 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
703 		goto do_sku;
704 
705 	nid = 0x1d;
706 	if (codec->core.vendor_id == 0x10ec0260)
707 		nid = 0x17;
708 	ass = snd_hda_codec_get_pincfg(codec, nid);
709 
710 	if (!(ass & 1)) {
711 		codec_info(codec, "%s: SKU not ready 0x%08x\n",
712 			   codec->core.chip_name, ass);
713 		return -1;
714 	}
715 
716 	/* check sum */
717 	tmp = 0;
718 	for (i = 1; i < 16; i++) {
719 		if ((ass >> i) & 1)
720 			tmp++;
721 	}
722 	if (((ass >> 16) & 0xf) != tmp)
723 		return -1;
724 
725 	spec->cdefine.port_connectivity = ass >> 30;
726 	spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
727 	spec->cdefine.check_sum = (ass >> 16) & 0xf;
728 	spec->cdefine.customization = ass >> 8;
729 do_sku:
730 	spec->cdefine.sku_cfg = ass;
731 	spec->cdefine.external_amp = (ass & 0x38) >> 3;
732 	spec->cdefine.platform_type = (ass & 0x4) >> 2;
733 	spec->cdefine.swap = (ass & 0x2) >> 1;
734 	spec->cdefine.override = ass & 0x1;
735 
736 	codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
737 		   nid, spec->cdefine.sku_cfg);
738 	codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
739 		   spec->cdefine.port_connectivity);
740 	codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
741 	codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
742 	codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
743 	codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
744 	codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
745 	codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
746 	codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
747 
748 	return 0;
749 }
750 
751 /* return the position of NID in the list, or -1 if not found */
752 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
753 {
754 	int i;
755 	for (i = 0; i < nums; i++)
756 		if (list[i] == nid)
757 			return i;
758 	return -1;
759 }
760 /* return true if the given NID is found in the list */
761 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
762 {
763 	return find_idx_in_nid_list(nid, list, nums) >= 0;
764 }
765 
766 /* check subsystem ID and set up device-specific initialization;
767  * return 1 if initialized, 0 if invalid SSID
768  */
769 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
770  *	31 ~ 16 :	Manufacture ID
771  *	15 ~ 8	:	SKU ID
772  *	7  ~ 0	:	Assembly ID
773  *	port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
774  */
775 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
776 {
777 	unsigned int ass, tmp, i;
778 	unsigned nid;
779 	struct alc_spec *spec = codec->spec;
780 
781 	if (spec->cdefine.fixup) {
782 		ass = spec->cdefine.sku_cfg;
783 		if (ass == ALC_FIXUP_SKU_IGNORE)
784 			return 0;
785 		goto do_sku;
786 	}
787 
788 	ass = codec->core.subsystem_id & 0xffff;
789 	if (codec->bus->pci &&
790 	    ass != codec->bus->pci->subsystem_device && (ass & 1))
791 		goto do_sku;
792 
793 	/* invalid SSID, check the special NID pin defcfg instead */
794 	/*
795 	 * 31~30	: port connectivity
796 	 * 29~21	: reserve
797 	 * 20		: PCBEEP input
798 	 * 19~16	: Check sum (15:1)
799 	 * 15~1		: Custom
800 	 * 0		: override
801 	*/
802 	nid = 0x1d;
803 	if (codec->core.vendor_id == 0x10ec0260)
804 		nid = 0x17;
805 	ass = snd_hda_codec_get_pincfg(codec, nid);
806 	codec_dbg(codec,
807 		  "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
808 		   ass, nid);
809 	if (!(ass & 1))
810 		return 0;
811 	if ((ass >> 30) != 1)	/* no physical connection */
812 		return 0;
813 
814 	/* check sum */
815 	tmp = 0;
816 	for (i = 1; i < 16; i++) {
817 		if ((ass >> i) & 1)
818 			tmp++;
819 	}
820 	if (((ass >> 16) & 0xf) != tmp)
821 		return 0;
822 do_sku:
823 	codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
824 		   ass & 0xffff, codec->core.vendor_id);
825 	/*
826 	 * 0 : override
827 	 * 1 :	Swap Jack
828 	 * 2 : 0 --> Desktop, 1 --> Laptop
829 	 * 3~5 : External Amplifier control
830 	 * 7~6 : Reserved
831 	*/
832 	tmp = (ass & 0x38) >> 3;	/* external Amp control */
833 	if (spec->init_amp == ALC_INIT_UNDEFINED) {
834 		switch (tmp) {
835 		case 1:
836 			alc_setup_gpio(codec, 0x01);
837 			break;
838 		case 3:
839 			alc_setup_gpio(codec, 0x02);
840 			break;
841 		case 7:
842 			alc_setup_gpio(codec, 0x04);
843 			break;
844 		case 5:
845 		default:
846 			spec->init_amp = ALC_INIT_DEFAULT;
847 			break;
848 		}
849 	}
850 
851 	/* is laptop or Desktop and enable the function "Mute internal speaker
852 	 * when the external headphone out jack is plugged"
853 	 */
854 	if (!(ass & 0x8000))
855 		return 1;
856 	/*
857 	 * 10~8 : Jack location
858 	 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
859 	 * 14~13: Resvered
860 	 * 15   : 1 --> enable the function "Mute internal speaker
861 	 *	        when the external headphone out jack is plugged"
862 	 */
863 	if (!alc_get_hp_pin(spec)) {
864 		hda_nid_t nid;
865 		tmp = (ass >> 11) & 0x3;	/* HP to chassis */
866 		nid = ports[tmp];
867 		if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
868 				      spec->gen.autocfg.line_outs))
869 			return 1;
870 		spec->gen.autocfg.hp_pins[0] = nid;
871 	}
872 	return 1;
873 }
874 
875 /* Check the validity of ALC subsystem-id
876  * ports contains an array of 4 pin NIDs for port-A, E, D and I */
877 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
878 {
879 	if (!alc_subsystem_id(codec, ports)) {
880 		struct alc_spec *spec = codec->spec;
881 		if (spec->init_amp == ALC_INIT_UNDEFINED) {
882 			codec_dbg(codec,
883 				  "realtek: Enable default setup for auto mode as fallback\n");
884 			spec->init_amp = ALC_INIT_DEFAULT;
885 		}
886 	}
887 }
888 
889 /*
890  */
891 
892 static void alc_fixup_inv_dmic(struct hda_codec *codec,
893 			       const struct hda_fixup *fix, int action)
894 {
895 	struct alc_spec *spec = codec->spec;
896 
897 	spec->gen.inv_dmic_split = 1;
898 }
899 
900 
901 static int alc_build_controls(struct hda_codec *codec)
902 {
903 	int err;
904 
905 	err = snd_hda_gen_build_controls(codec);
906 	if (err < 0)
907 		return err;
908 
909 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
910 	return 0;
911 }
912 
913 
914 /*
915  * Common callbacks
916  */
917 
918 static void alc_pre_init(struct hda_codec *codec)
919 {
920 	alc_fill_eapd_coef(codec);
921 }
922 
923 #define is_s3_resume(codec) \
924 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
925 #define is_s4_resume(codec) \
926 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
927 
928 static int alc_init(struct hda_codec *codec)
929 {
930 	struct alc_spec *spec = codec->spec;
931 
932 	/* hibernation resume needs the full chip initialization */
933 	if (is_s4_resume(codec))
934 		alc_pre_init(codec);
935 
936 	if (spec->init_hook)
937 		spec->init_hook(codec);
938 
939 	spec->gen.skip_verbs = 1; /* applied in below */
940 	snd_hda_gen_init(codec);
941 	alc_fix_pll(codec);
942 	alc_auto_init_amp(codec, spec->init_amp);
943 	snd_hda_apply_verbs(codec); /* apply verbs here after own init */
944 
945 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
946 
947 	return 0;
948 }
949 
950 #define alc_free	snd_hda_gen_free
951 
952 #ifdef CONFIG_PM
953 static inline void alc_shutup(struct hda_codec *codec)
954 {
955 	struct alc_spec *spec = codec->spec;
956 
957 	if (!snd_hda_get_bool_hint(codec, "shutup"))
958 		return; /* disabled explicitly by hints */
959 
960 	if (spec && spec->shutup)
961 		spec->shutup(codec);
962 	else
963 		alc_shutup_pins(codec);
964 }
965 
966 static void alc_power_eapd(struct hda_codec *codec)
967 {
968 	alc_auto_setup_eapd(codec, false);
969 }
970 
971 static int alc_suspend(struct hda_codec *codec)
972 {
973 	struct alc_spec *spec = codec->spec;
974 	alc_shutup(codec);
975 	if (spec && spec->power_hook)
976 		spec->power_hook(codec);
977 	return 0;
978 }
979 
980 static int alc_resume(struct hda_codec *codec)
981 {
982 	struct alc_spec *spec = codec->spec;
983 
984 	if (!spec->no_depop_delay)
985 		msleep(150); /* to avoid pop noise */
986 	codec->patch_ops.init(codec);
987 	snd_hda_regmap_sync(codec);
988 	hda_call_check_power_status(codec, 0x01);
989 	return 0;
990 }
991 #endif
992 
993 /*
994  */
995 static const struct hda_codec_ops alc_patch_ops = {
996 	.build_controls = alc_build_controls,
997 	.build_pcms = snd_hda_gen_build_pcms,
998 	.init = alc_init,
999 	.free = alc_free,
1000 	.unsol_event = snd_hda_jack_unsol_event,
1001 #ifdef CONFIG_PM
1002 	.resume = alc_resume,
1003 	.suspend = alc_suspend,
1004 	.check_power_status = snd_hda_gen_check_power_status,
1005 #endif
1006 };
1007 
1008 
1009 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1010 
1011 /*
1012  * Rename codecs appropriately from COEF value or subvendor id
1013  */
1014 struct alc_codec_rename_table {
1015 	unsigned int vendor_id;
1016 	unsigned short coef_mask;
1017 	unsigned short coef_bits;
1018 	const char *name;
1019 };
1020 
1021 struct alc_codec_rename_pci_table {
1022 	unsigned int codec_vendor_id;
1023 	unsigned short pci_subvendor;
1024 	unsigned short pci_subdevice;
1025 	const char *name;
1026 };
1027 
1028 static const struct alc_codec_rename_table rename_tbl[] = {
1029 	{ 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1030 	{ 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1031 	{ 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1032 	{ 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1033 	{ 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1034 	{ 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1035 	{ 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1036 	{ 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1037 	{ 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1038 	{ 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1039 	{ 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1040 	{ 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1041 	{ 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1042 	{ 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1043 	{ 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1044 	{ 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1045 	{ 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1046 	{ } /* terminator */
1047 };
1048 
1049 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1050 	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
1051 	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
1052 	{ 0x10ec0283, 0x1028, 0, "ALC3223" },
1053 	{ 0x10ec0288, 0x1028, 0, "ALC3263" },
1054 	{ 0x10ec0292, 0x1028, 0, "ALC3226" },
1055 	{ 0x10ec0293, 0x1028, 0, "ALC3235" },
1056 	{ 0x10ec0255, 0x1028, 0, "ALC3234" },
1057 	{ 0x10ec0668, 0x1028, 0, "ALC3661" },
1058 	{ 0x10ec0275, 0x1028, 0, "ALC3260" },
1059 	{ 0x10ec0899, 0x1028, 0, "ALC3861" },
1060 	{ 0x10ec0298, 0x1028, 0, "ALC3266" },
1061 	{ 0x10ec0236, 0x1028, 0, "ALC3204" },
1062 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
1063 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
1064 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
1065 	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
1066 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
1067 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
1068 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
1069 	{ 0x10ec0233, 0x1043, 0, "ALC3236" },
1070 	{ 0x10ec0280, 0x103c, 0, "ALC3228" },
1071 	{ 0x10ec0282, 0x103c, 0, "ALC3227" },
1072 	{ 0x10ec0286, 0x103c, 0, "ALC3242" },
1073 	{ 0x10ec0290, 0x103c, 0, "ALC3241" },
1074 	{ 0x10ec0668, 0x103c, 0, "ALC3662" },
1075 	{ 0x10ec0283, 0x17aa, 0, "ALC3239" },
1076 	{ 0x10ec0292, 0x17aa, 0, "ALC3232" },
1077 	{ } /* terminator */
1078 };
1079 
1080 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1081 {
1082 	const struct alc_codec_rename_table *p;
1083 	const struct alc_codec_rename_pci_table *q;
1084 
1085 	for (p = rename_tbl; p->vendor_id; p++) {
1086 		if (p->vendor_id != codec->core.vendor_id)
1087 			continue;
1088 		if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1089 			return alc_codec_rename(codec, p->name);
1090 	}
1091 
1092 	if (!codec->bus->pci)
1093 		return 0;
1094 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1095 		if (q->codec_vendor_id != codec->core.vendor_id)
1096 			continue;
1097 		if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1098 			continue;
1099 		if (!q->pci_subdevice ||
1100 		    q->pci_subdevice == codec->bus->pci->subsystem_device)
1101 			return alc_codec_rename(codec, q->name);
1102 	}
1103 
1104 	return 0;
1105 }
1106 
1107 
1108 /*
1109  * Digital-beep handlers
1110  */
1111 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1112 
1113 /* additional beep mixers; private_value will be overwritten */
1114 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1115 	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1116 	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1117 };
1118 
1119 /* set up and create beep controls */
1120 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1121 			int idx, int dir)
1122 {
1123 	struct snd_kcontrol_new *knew;
1124 	unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1125 	int i;
1126 
1127 	for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1128 		knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1129 					    &alc_beep_mixer[i]);
1130 		if (!knew)
1131 			return -ENOMEM;
1132 		knew->private_value = beep_amp;
1133 	}
1134 	return 0;
1135 }
1136 
1137 static const struct snd_pci_quirk beep_allow_list[] = {
1138 	SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1139 	SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1140 	SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1141 	SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1142 	SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1143 	SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1144 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1145 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1146 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1147 	/* denylist -- no beep available */
1148 	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1149 	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1150 	{}
1151 };
1152 
1153 static inline int has_cdefine_beep(struct hda_codec *codec)
1154 {
1155 	struct alc_spec *spec = codec->spec;
1156 	const struct snd_pci_quirk *q;
1157 	q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1158 	if (q)
1159 		return q->value;
1160 	return spec->cdefine.enable_pcbeep;
1161 }
1162 #else
1163 #define set_beep_amp(spec, nid, idx, dir)	0
1164 #define has_cdefine_beep(codec)		0
1165 #endif
1166 
1167 /* parse the BIOS configuration and set up the alc_spec */
1168 /* return 1 if successful, 0 if the proper config is not found,
1169  * or a negative error code
1170  */
1171 static int alc_parse_auto_config(struct hda_codec *codec,
1172 				 const hda_nid_t *ignore_nids,
1173 				 const hda_nid_t *ssid_nids)
1174 {
1175 	struct alc_spec *spec = codec->spec;
1176 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1177 	int err;
1178 
1179 	err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1180 				       spec->parse_flags);
1181 	if (err < 0)
1182 		return err;
1183 
1184 	if (ssid_nids)
1185 		alc_ssid_check(codec, ssid_nids);
1186 
1187 	err = snd_hda_gen_parse_auto_config(codec, cfg);
1188 	if (err < 0)
1189 		return err;
1190 
1191 	return 1;
1192 }
1193 
1194 /* common preparation job for alc_spec */
1195 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1196 {
1197 	struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1198 	int err;
1199 
1200 	if (!spec)
1201 		return -ENOMEM;
1202 	codec->spec = spec;
1203 	snd_hda_gen_spec_init(&spec->gen);
1204 	spec->gen.mixer_nid = mixer_nid;
1205 	spec->gen.own_eapd_ctl = 1;
1206 	codec->single_adc_amp = 1;
1207 	/* FIXME: do we need this for all Realtek codec models? */
1208 	codec->spdif_status_reset = 1;
1209 	codec->forced_resume = 1;
1210 	codec->patch_ops = alc_patch_ops;
1211 	mutex_init(&spec->coef_mutex);
1212 
1213 	err = alc_codec_rename_from_preset(codec);
1214 	if (err < 0) {
1215 		kfree(spec);
1216 		return err;
1217 	}
1218 	return 0;
1219 }
1220 
1221 static int alc880_parse_auto_config(struct hda_codec *codec)
1222 {
1223 	static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1224 	static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1225 	return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1226 }
1227 
1228 /*
1229  * ALC880 fix-ups
1230  */
1231 enum {
1232 	ALC880_FIXUP_GPIO1,
1233 	ALC880_FIXUP_GPIO2,
1234 	ALC880_FIXUP_MEDION_RIM,
1235 	ALC880_FIXUP_LG,
1236 	ALC880_FIXUP_LG_LW25,
1237 	ALC880_FIXUP_W810,
1238 	ALC880_FIXUP_EAPD_COEF,
1239 	ALC880_FIXUP_TCL_S700,
1240 	ALC880_FIXUP_VOL_KNOB,
1241 	ALC880_FIXUP_FUJITSU,
1242 	ALC880_FIXUP_F1734,
1243 	ALC880_FIXUP_UNIWILL,
1244 	ALC880_FIXUP_UNIWILL_DIG,
1245 	ALC880_FIXUP_Z71V,
1246 	ALC880_FIXUP_ASUS_W5A,
1247 	ALC880_FIXUP_3ST_BASE,
1248 	ALC880_FIXUP_3ST,
1249 	ALC880_FIXUP_3ST_DIG,
1250 	ALC880_FIXUP_5ST_BASE,
1251 	ALC880_FIXUP_5ST,
1252 	ALC880_FIXUP_5ST_DIG,
1253 	ALC880_FIXUP_6ST_BASE,
1254 	ALC880_FIXUP_6ST,
1255 	ALC880_FIXUP_6ST_DIG,
1256 	ALC880_FIXUP_6ST_AUTOMUTE,
1257 };
1258 
1259 /* enable the volume-knob widget support on NID 0x21 */
1260 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1261 				  const struct hda_fixup *fix, int action)
1262 {
1263 	if (action == HDA_FIXUP_ACT_PROBE)
1264 		snd_hda_jack_detect_enable_callback(codec, 0x21,
1265 						    alc_update_knob_master);
1266 }
1267 
1268 static const struct hda_fixup alc880_fixups[] = {
1269 	[ALC880_FIXUP_GPIO1] = {
1270 		.type = HDA_FIXUP_FUNC,
1271 		.v.func = alc_fixup_gpio1,
1272 	},
1273 	[ALC880_FIXUP_GPIO2] = {
1274 		.type = HDA_FIXUP_FUNC,
1275 		.v.func = alc_fixup_gpio2,
1276 	},
1277 	[ALC880_FIXUP_MEDION_RIM] = {
1278 		.type = HDA_FIXUP_VERBS,
1279 		.v.verbs = (const struct hda_verb[]) {
1280 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1281 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1282 			{ }
1283 		},
1284 		.chained = true,
1285 		.chain_id = ALC880_FIXUP_GPIO2,
1286 	},
1287 	[ALC880_FIXUP_LG] = {
1288 		.type = HDA_FIXUP_PINS,
1289 		.v.pins = (const struct hda_pintbl[]) {
1290 			/* disable bogus unused pins */
1291 			{ 0x16, 0x411111f0 },
1292 			{ 0x18, 0x411111f0 },
1293 			{ 0x1a, 0x411111f0 },
1294 			{ }
1295 		}
1296 	},
1297 	[ALC880_FIXUP_LG_LW25] = {
1298 		.type = HDA_FIXUP_PINS,
1299 		.v.pins = (const struct hda_pintbl[]) {
1300 			{ 0x1a, 0x0181344f }, /* line-in */
1301 			{ 0x1b, 0x0321403f }, /* headphone */
1302 			{ }
1303 		}
1304 	},
1305 	[ALC880_FIXUP_W810] = {
1306 		.type = HDA_FIXUP_PINS,
1307 		.v.pins = (const struct hda_pintbl[]) {
1308 			/* disable bogus unused pins */
1309 			{ 0x17, 0x411111f0 },
1310 			{ }
1311 		},
1312 		.chained = true,
1313 		.chain_id = ALC880_FIXUP_GPIO2,
1314 	},
1315 	[ALC880_FIXUP_EAPD_COEF] = {
1316 		.type = HDA_FIXUP_VERBS,
1317 		.v.verbs = (const struct hda_verb[]) {
1318 			/* change to EAPD mode */
1319 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1320 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1321 			{}
1322 		},
1323 	},
1324 	[ALC880_FIXUP_TCL_S700] = {
1325 		.type = HDA_FIXUP_VERBS,
1326 		.v.verbs = (const struct hda_verb[]) {
1327 			/* change to EAPD mode */
1328 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1329 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3070 },
1330 			{}
1331 		},
1332 		.chained = true,
1333 		.chain_id = ALC880_FIXUP_GPIO2,
1334 	},
1335 	[ALC880_FIXUP_VOL_KNOB] = {
1336 		.type = HDA_FIXUP_FUNC,
1337 		.v.func = alc880_fixup_vol_knob,
1338 	},
1339 	[ALC880_FIXUP_FUJITSU] = {
1340 		/* override all pins as BIOS on old Amilo is broken */
1341 		.type = HDA_FIXUP_PINS,
1342 		.v.pins = (const struct hda_pintbl[]) {
1343 			{ 0x14, 0x0121401f }, /* HP */
1344 			{ 0x15, 0x99030120 }, /* speaker */
1345 			{ 0x16, 0x99030130 }, /* bass speaker */
1346 			{ 0x17, 0x411111f0 }, /* N/A */
1347 			{ 0x18, 0x411111f0 }, /* N/A */
1348 			{ 0x19, 0x01a19950 }, /* mic-in */
1349 			{ 0x1a, 0x411111f0 }, /* N/A */
1350 			{ 0x1b, 0x411111f0 }, /* N/A */
1351 			{ 0x1c, 0x411111f0 }, /* N/A */
1352 			{ 0x1d, 0x411111f0 }, /* N/A */
1353 			{ 0x1e, 0x01454140 }, /* SPDIF out */
1354 			{ }
1355 		},
1356 		.chained = true,
1357 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1358 	},
1359 	[ALC880_FIXUP_F1734] = {
1360 		/* almost compatible with FUJITSU, but no bass and SPDIF */
1361 		.type = HDA_FIXUP_PINS,
1362 		.v.pins = (const struct hda_pintbl[]) {
1363 			{ 0x14, 0x0121401f }, /* HP */
1364 			{ 0x15, 0x99030120 }, /* speaker */
1365 			{ 0x16, 0x411111f0 }, /* N/A */
1366 			{ 0x17, 0x411111f0 }, /* N/A */
1367 			{ 0x18, 0x411111f0 }, /* N/A */
1368 			{ 0x19, 0x01a19950 }, /* mic-in */
1369 			{ 0x1a, 0x411111f0 }, /* N/A */
1370 			{ 0x1b, 0x411111f0 }, /* N/A */
1371 			{ 0x1c, 0x411111f0 }, /* N/A */
1372 			{ 0x1d, 0x411111f0 }, /* N/A */
1373 			{ 0x1e, 0x411111f0 }, /* N/A */
1374 			{ }
1375 		},
1376 		.chained = true,
1377 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1378 	},
1379 	[ALC880_FIXUP_UNIWILL] = {
1380 		/* need to fix HP and speaker pins to be parsed correctly */
1381 		.type = HDA_FIXUP_PINS,
1382 		.v.pins = (const struct hda_pintbl[]) {
1383 			{ 0x14, 0x0121411f }, /* HP */
1384 			{ 0x15, 0x99030120 }, /* speaker */
1385 			{ 0x16, 0x99030130 }, /* bass speaker */
1386 			{ }
1387 		},
1388 	},
1389 	[ALC880_FIXUP_UNIWILL_DIG] = {
1390 		.type = HDA_FIXUP_PINS,
1391 		.v.pins = (const struct hda_pintbl[]) {
1392 			/* disable bogus unused pins */
1393 			{ 0x17, 0x411111f0 },
1394 			{ 0x19, 0x411111f0 },
1395 			{ 0x1b, 0x411111f0 },
1396 			{ 0x1f, 0x411111f0 },
1397 			{ }
1398 		}
1399 	},
1400 	[ALC880_FIXUP_Z71V] = {
1401 		.type = HDA_FIXUP_PINS,
1402 		.v.pins = (const struct hda_pintbl[]) {
1403 			/* set up the whole pins as BIOS is utterly broken */
1404 			{ 0x14, 0x99030120 }, /* speaker */
1405 			{ 0x15, 0x0121411f }, /* HP */
1406 			{ 0x16, 0x411111f0 }, /* N/A */
1407 			{ 0x17, 0x411111f0 }, /* N/A */
1408 			{ 0x18, 0x01a19950 }, /* mic-in */
1409 			{ 0x19, 0x411111f0 }, /* N/A */
1410 			{ 0x1a, 0x01813031 }, /* line-in */
1411 			{ 0x1b, 0x411111f0 }, /* N/A */
1412 			{ 0x1c, 0x411111f0 }, /* N/A */
1413 			{ 0x1d, 0x411111f0 }, /* N/A */
1414 			{ 0x1e, 0x0144111e }, /* SPDIF */
1415 			{ }
1416 		}
1417 	},
1418 	[ALC880_FIXUP_ASUS_W5A] = {
1419 		.type = HDA_FIXUP_PINS,
1420 		.v.pins = (const struct hda_pintbl[]) {
1421 			/* set up the whole pins as BIOS is utterly broken */
1422 			{ 0x14, 0x0121411f }, /* HP */
1423 			{ 0x15, 0x411111f0 }, /* N/A */
1424 			{ 0x16, 0x411111f0 }, /* N/A */
1425 			{ 0x17, 0x411111f0 }, /* N/A */
1426 			{ 0x18, 0x90a60160 }, /* mic */
1427 			{ 0x19, 0x411111f0 }, /* N/A */
1428 			{ 0x1a, 0x411111f0 }, /* N/A */
1429 			{ 0x1b, 0x411111f0 }, /* N/A */
1430 			{ 0x1c, 0x411111f0 }, /* N/A */
1431 			{ 0x1d, 0x411111f0 }, /* N/A */
1432 			{ 0x1e, 0xb743111e }, /* SPDIF out */
1433 			{ }
1434 		},
1435 		.chained = true,
1436 		.chain_id = ALC880_FIXUP_GPIO1,
1437 	},
1438 	[ALC880_FIXUP_3ST_BASE] = {
1439 		.type = HDA_FIXUP_PINS,
1440 		.v.pins = (const struct hda_pintbl[]) {
1441 			{ 0x14, 0x01014010 }, /* line-out */
1442 			{ 0x15, 0x411111f0 }, /* N/A */
1443 			{ 0x16, 0x411111f0 }, /* N/A */
1444 			{ 0x17, 0x411111f0 }, /* N/A */
1445 			{ 0x18, 0x01a19c30 }, /* mic-in */
1446 			{ 0x19, 0x0121411f }, /* HP */
1447 			{ 0x1a, 0x01813031 }, /* line-in */
1448 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1449 			{ 0x1c, 0x411111f0 }, /* N/A */
1450 			{ 0x1d, 0x411111f0 }, /* N/A */
1451 			/* 0x1e is filled in below */
1452 			{ 0x1f, 0x411111f0 }, /* N/A */
1453 			{ }
1454 		}
1455 	},
1456 	[ALC880_FIXUP_3ST] = {
1457 		.type = HDA_FIXUP_PINS,
1458 		.v.pins = (const struct hda_pintbl[]) {
1459 			{ 0x1e, 0x411111f0 }, /* N/A */
1460 			{ }
1461 		},
1462 		.chained = true,
1463 		.chain_id = ALC880_FIXUP_3ST_BASE,
1464 	},
1465 	[ALC880_FIXUP_3ST_DIG] = {
1466 		.type = HDA_FIXUP_PINS,
1467 		.v.pins = (const struct hda_pintbl[]) {
1468 			{ 0x1e, 0x0144111e }, /* SPDIF */
1469 			{ }
1470 		},
1471 		.chained = true,
1472 		.chain_id = ALC880_FIXUP_3ST_BASE,
1473 	},
1474 	[ALC880_FIXUP_5ST_BASE] = {
1475 		.type = HDA_FIXUP_PINS,
1476 		.v.pins = (const struct hda_pintbl[]) {
1477 			{ 0x14, 0x01014010 }, /* front */
1478 			{ 0x15, 0x411111f0 }, /* N/A */
1479 			{ 0x16, 0x01011411 }, /* CLFE */
1480 			{ 0x17, 0x01016412 }, /* surr */
1481 			{ 0x18, 0x01a19c30 }, /* mic-in */
1482 			{ 0x19, 0x0121411f }, /* HP */
1483 			{ 0x1a, 0x01813031 }, /* line-in */
1484 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1485 			{ 0x1c, 0x411111f0 }, /* N/A */
1486 			{ 0x1d, 0x411111f0 }, /* N/A */
1487 			/* 0x1e is filled in below */
1488 			{ 0x1f, 0x411111f0 }, /* N/A */
1489 			{ }
1490 		}
1491 	},
1492 	[ALC880_FIXUP_5ST] = {
1493 		.type = HDA_FIXUP_PINS,
1494 		.v.pins = (const struct hda_pintbl[]) {
1495 			{ 0x1e, 0x411111f0 }, /* N/A */
1496 			{ }
1497 		},
1498 		.chained = true,
1499 		.chain_id = ALC880_FIXUP_5ST_BASE,
1500 	},
1501 	[ALC880_FIXUP_5ST_DIG] = {
1502 		.type = HDA_FIXUP_PINS,
1503 		.v.pins = (const struct hda_pintbl[]) {
1504 			{ 0x1e, 0x0144111e }, /* SPDIF */
1505 			{ }
1506 		},
1507 		.chained = true,
1508 		.chain_id = ALC880_FIXUP_5ST_BASE,
1509 	},
1510 	[ALC880_FIXUP_6ST_BASE] = {
1511 		.type = HDA_FIXUP_PINS,
1512 		.v.pins = (const struct hda_pintbl[]) {
1513 			{ 0x14, 0x01014010 }, /* front */
1514 			{ 0x15, 0x01016412 }, /* surr */
1515 			{ 0x16, 0x01011411 }, /* CLFE */
1516 			{ 0x17, 0x01012414 }, /* side */
1517 			{ 0x18, 0x01a19c30 }, /* mic-in */
1518 			{ 0x19, 0x02a19c40 }, /* front-mic */
1519 			{ 0x1a, 0x01813031 }, /* line-in */
1520 			{ 0x1b, 0x0121411f }, /* HP */
1521 			{ 0x1c, 0x411111f0 }, /* N/A */
1522 			{ 0x1d, 0x411111f0 }, /* N/A */
1523 			/* 0x1e is filled in below */
1524 			{ 0x1f, 0x411111f0 }, /* N/A */
1525 			{ }
1526 		}
1527 	},
1528 	[ALC880_FIXUP_6ST] = {
1529 		.type = HDA_FIXUP_PINS,
1530 		.v.pins = (const struct hda_pintbl[]) {
1531 			{ 0x1e, 0x411111f0 }, /* N/A */
1532 			{ }
1533 		},
1534 		.chained = true,
1535 		.chain_id = ALC880_FIXUP_6ST_BASE,
1536 	},
1537 	[ALC880_FIXUP_6ST_DIG] = {
1538 		.type = HDA_FIXUP_PINS,
1539 		.v.pins = (const struct hda_pintbl[]) {
1540 			{ 0x1e, 0x0144111e }, /* SPDIF */
1541 			{ }
1542 		},
1543 		.chained = true,
1544 		.chain_id = ALC880_FIXUP_6ST_BASE,
1545 	},
1546 	[ALC880_FIXUP_6ST_AUTOMUTE] = {
1547 		.type = HDA_FIXUP_PINS,
1548 		.v.pins = (const struct hda_pintbl[]) {
1549 			{ 0x1b, 0x0121401f }, /* HP with jack detect */
1550 			{ }
1551 		},
1552 		.chained_before = true,
1553 		.chain_id = ALC880_FIXUP_6ST_BASE,
1554 	},
1555 };
1556 
1557 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1558 	SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1559 	SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1560 	SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1561 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1562 	SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1563 	SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1564 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1565 	SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1566 	SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1567 	SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1568 	SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1569 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1570 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1571 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1572 	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1573 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1574 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1575 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1576 	SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1577 	SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1578 	SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1579 	SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1580 	SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1581 
1582 	/* Below is the copied entries from alc880_quirks.c.
1583 	 * It's not quite sure whether BIOS sets the correct pin-config table
1584 	 * on these machines, thus they are kept to be compatible with
1585 	 * the old static quirks.  Once when it's confirmed to work without
1586 	 * these overrides, it'd be better to remove.
1587 	 */
1588 	SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1589 	SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1590 	SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1591 	SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1592 	SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1593 	SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1594 	SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1595 	SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1596 	SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1597 	SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1598 	SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1599 	SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1600 	SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1601 	SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1602 	SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1603 	SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1604 	SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1605 	SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1606 	SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1607 	SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1608 	SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1609 	SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1610 	SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1611 	SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1612 	SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1613 	SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1614 	SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1615 	SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1616 	SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1617 	SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1618 	SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1619 	SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1620 	SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1621 	/* default Intel */
1622 	SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1623 	SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1624 	SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1625 	{}
1626 };
1627 
1628 static const struct hda_model_fixup alc880_fixup_models[] = {
1629 	{.id = ALC880_FIXUP_3ST, .name = "3stack"},
1630 	{.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1631 	{.id = ALC880_FIXUP_5ST, .name = "5stack"},
1632 	{.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1633 	{.id = ALC880_FIXUP_6ST, .name = "6stack"},
1634 	{.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1635 	{.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1636 	{}
1637 };
1638 
1639 
1640 /*
1641  * OK, here we have finally the patch for ALC880
1642  */
1643 static int patch_alc880(struct hda_codec *codec)
1644 {
1645 	struct alc_spec *spec;
1646 	int err;
1647 
1648 	err = alc_alloc_spec(codec, 0x0b);
1649 	if (err < 0)
1650 		return err;
1651 
1652 	spec = codec->spec;
1653 	spec->gen.need_dac_fix = 1;
1654 	spec->gen.beep_nid = 0x01;
1655 
1656 	codec->patch_ops.unsol_event = alc880_unsol_event;
1657 
1658 	alc_pre_init(codec);
1659 
1660 	snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1661 		       alc880_fixups);
1662 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1663 
1664 	/* automatic parse from the BIOS config */
1665 	err = alc880_parse_auto_config(codec);
1666 	if (err < 0)
1667 		goto error;
1668 
1669 	if (!spec->gen.no_analog) {
1670 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1671 		if (err < 0)
1672 			goto error;
1673 	}
1674 
1675 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1676 
1677 	return 0;
1678 
1679  error:
1680 	alc_free(codec);
1681 	return err;
1682 }
1683 
1684 
1685 /*
1686  * ALC260 support
1687  */
1688 static int alc260_parse_auto_config(struct hda_codec *codec)
1689 {
1690 	static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1691 	static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1692 	return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1693 }
1694 
1695 /*
1696  * Pin config fixes
1697  */
1698 enum {
1699 	ALC260_FIXUP_HP_DC5750,
1700 	ALC260_FIXUP_HP_PIN_0F,
1701 	ALC260_FIXUP_COEF,
1702 	ALC260_FIXUP_GPIO1,
1703 	ALC260_FIXUP_GPIO1_TOGGLE,
1704 	ALC260_FIXUP_REPLACER,
1705 	ALC260_FIXUP_HP_B1900,
1706 	ALC260_FIXUP_KN1,
1707 	ALC260_FIXUP_FSC_S7020,
1708 	ALC260_FIXUP_FSC_S7020_JWSE,
1709 	ALC260_FIXUP_VAIO_PINS,
1710 };
1711 
1712 static void alc260_gpio1_automute(struct hda_codec *codec)
1713 {
1714 	struct alc_spec *spec = codec->spec;
1715 
1716 	alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1717 }
1718 
1719 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1720 				      const struct hda_fixup *fix, int action)
1721 {
1722 	struct alc_spec *spec = codec->spec;
1723 	if (action == HDA_FIXUP_ACT_PROBE) {
1724 		/* although the machine has only one output pin, we need to
1725 		 * toggle GPIO1 according to the jack state
1726 		 */
1727 		spec->gen.automute_hook = alc260_gpio1_automute;
1728 		spec->gen.detect_hp = 1;
1729 		spec->gen.automute_speaker = 1;
1730 		spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1731 		snd_hda_jack_detect_enable_callback(codec, 0x0f,
1732 						    snd_hda_gen_hp_automute);
1733 		alc_setup_gpio(codec, 0x01);
1734 	}
1735 }
1736 
1737 static void alc260_fixup_kn1(struct hda_codec *codec,
1738 			     const struct hda_fixup *fix, int action)
1739 {
1740 	struct alc_spec *spec = codec->spec;
1741 	static const struct hda_pintbl pincfgs[] = {
1742 		{ 0x0f, 0x02214000 }, /* HP/speaker */
1743 		{ 0x12, 0x90a60160 }, /* int mic */
1744 		{ 0x13, 0x02a19000 }, /* ext mic */
1745 		{ 0x18, 0x01446000 }, /* SPDIF out */
1746 		/* disable bogus I/O pins */
1747 		{ 0x10, 0x411111f0 },
1748 		{ 0x11, 0x411111f0 },
1749 		{ 0x14, 0x411111f0 },
1750 		{ 0x15, 0x411111f0 },
1751 		{ 0x16, 0x411111f0 },
1752 		{ 0x17, 0x411111f0 },
1753 		{ 0x19, 0x411111f0 },
1754 		{ }
1755 	};
1756 
1757 	switch (action) {
1758 	case HDA_FIXUP_ACT_PRE_PROBE:
1759 		snd_hda_apply_pincfgs(codec, pincfgs);
1760 		spec->init_amp = ALC_INIT_NONE;
1761 		break;
1762 	}
1763 }
1764 
1765 static void alc260_fixup_fsc_s7020(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->init_amp = ALC_INIT_NONE;
1771 }
1772 
1773 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1774 				   const struct hda_fixup *fix, int action)
1775 {
1776 	struct alc_spec *spec = codec->spec;
1777 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1778 		spec->gen.add_jack_modes = 1;
1779 		spec->gen.hp_mic = 1;
1780 	}
1781 }
1782 
1783 static const struct hda_fixup alc260_fixups[] = {
1784 	[ALC260_FIXUP_HP_DC5750] = {
1785 		.type = HDA_FIXUP_PINS,
1786 		.v.pins = (const struct hda_pintbl[]) {
1787 			{ 0x11, 0x90130110 }, /* speaker */
1788 			{ }
1789 		}
1790 	},
1791 	[ALC260_FIXUP_HP_PIN_0F] = {
1792 		.type = HDA_FIXUP_PINS,
1793 		.v.pins = (const struct hda_pintbl[]) {
1794 			{ 0x0f, 0x01214000 }, /* HP */
1795 			{ }
1796 		}
1797 	},
1798 	[ALC260_FIXUP_COEF] = {
1799 		.type = HDA_FIXUP_VERBS,
1800 		.v.verbs = (const struct hda_verb[]) {
1801 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1802 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3040 },
1803 			{ }
1804 		},
1805 	},
1806 	[ALC260_FIXUP_GPIO1] = {
1807 		.type = HDA_FIXUP_FUNC,
1808 		.v.func = alc_fixup_gpio1,
1809 	},
1810 	[ALC260_FIXUP_GPIO1_TOGGLE] = {
1811 		.type = HDA_FIXUP_FUNC,
1812 		.v.func = alc260_fixup_gpio1_toggle,
1813 		.chained = true,
1814 		.chain_id = ALC260_FIXUP_HP_PIN_0F,
1815 	},
1816 	[ALC260_FIXUP_REPLACER] = {
1817 		.type = HDA_FIXUP_VERBS,
1818 		.v.verbs = (const struct hda_verb[]) {
1819 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1820 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3050 },
1821 			{ }
1822 		},
1823 		.chained = true,
1824 		.chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1825 	},
1826 	[ALC260_FIXUP_HP_B1900] = {
1827 		.type = HDA_FIXUP_FUNC,
1828 		.v.func = alc260_fixup_gpio1_toggle,
1829 		.chained = true,
1830 		.chain_id = ALC260_FIXUP_COEF,
1831 	},
1832 	[ALC260_FIXUP_KN1] = {
1833 		.type = HDA_FIXUP_FUNC,
1834 		.v.func = alc260_fixup_kn1,
1835 	},
1836 	[ALC260_FIXUP_FSC_S7020] = {
1837 		.type = HDA_FIXUP_FUNC,
1838 		.v.func = alc260_fixup_fsc_s7020,
1839 	},
1840 	[ALC260_FIXUP_FSC_S7020_JWSE] = {
1841 		.type = HDA_FIXUP_FUNC,
1842 		.v.func = alc260_fixup_fsc_s7020_jwse,
1843 		.chained = true,
1844 		.chain_id = ALC260_FIXUP_FSC_S7020,
1845 	},
1846 	[ALC260_FIXUP_VAIO_PINS] = {
1847 		.type = HDA_FIXUP_PINS,
1848 		.v.pins = (const struct hda_pintbl[]) {
1849 			/* Pin configs are missing completely on some VAIOs */
1850 			{ 0x0f, 0x01211020 },
1851 			{ 0x10, 0x0001003f },
1852 			{ 0x11, 0x411111f0 },
1853 			{ 0x12, 0x01a15930 },
1854 			{ 0x13, 0x411111f0 },
1855 			{ 0x14, 0x411111f0 },
1856 			{ 0x15, 0x411111f0 },
1857 			{ 0x16, 0x411111f0 },
1858 			{ 0x17, 0x411111f0 },
1859 			{ 0x18, 0x411111f0 },
1860 			{ 0x19, 0x411111f0 },
1861 			{ }
1862 		}
1863 	},
1864 };
1865 
1866 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1867 	SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1868 	SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1869 	SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1870 	SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1871 	SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1872 	SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1873 	SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1874 	SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1875 	SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1876 	SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1877 	SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1878 	SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1879 	{}
1880 };
1881 
1882 static const struct hda_model_fixup alc260_fixup_models[] = {
1883 	{.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1884 	{.id = ALC260_FIXUP_COEF, .name = "coef"},
1885 	{.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1886 	{.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1887 	{}
1888 };
1889 
1890 /*
1891  */
1892 static int patch_alc260(struct hda_codec *codec)
1893 {
1894 	struct alc_spec *spec;
1895 	int err;
1896 
1897 	err = alc_alloc_spec(codec, 0x07);
1898 	if (err < 0)
1899 		return err;
1900 
1901 	spec = codec->spec;
1902 	/* as quite a few machines require HP amp for speaker outputs,
1903 	 * it's easier to enable it unconditionally; even if it's unneeded,
1904 	 * it's almost harmless.
1905 	 */
1906 	spec->gen.prefer_hp_amp = 1;
1907 	spec->gen.beep_nid = 0x01;
1908 
1909 	spec->shutup = alc_eapd_shutup;
1910 
1911 	alc_pre_init(codec);
1912 
1913 	snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1914 			   alc260_fixups);
1915 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1916 
1917 	/* automatic parse from the BIOS config */
1918 	err = alc260_parse_auto_config(codec);
1919 	if (err < 0)
1920 		goto error;
1921 
1922 	if (!spec->gen.no_analog) {
1923 		err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1924 		if (err < 0)
1925 			goto error;
1926 	}
1927 
1928 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1929 
1930 	return 0;
1931 
1932  error:
1933 	alc_free(codec);
1934 	return err;
1935 }
1936 
1937 
1938 /*
1939  * ALC882/883/885/888/889 support
1940  *
1941  * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1942  * configuration.  Each pin widget can choose any input DACs and a mixer.
1943  * Each ADC is connected from a mixer of all inputs.  This makes possible
1944  * 6-channel independent captures.
1945  *
1946  * In addition, an independent DAC for the multi-playback (not used in this
1947  * driver yet).
1948  */
1949 
1950 /*
1951  * Pin config fixes
1952  */
1953 enum {
1954 	ALC882_FIXUP_ABIT_AW9D_MAX,
1955 	ALC882_FIXUP_LENOVO_Y530,
1956 	ALC882_FIXUP_PB_M5210,
1957 	ALC882_FIXUP_ACER_ASPIRE_7736,
1958 	ALC882_FIXUP_ASUS_W90V,
1959 	ALC889_FIXUP_CD,
1960 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1961 	ALC889_FIXUP_VAIO_TT,
1962 	ALC888_FIXUP_EEE1601,
1963 	ALC886_FIXUP_EAPD,
1964 	ALC882_FIXUP_EAPD,
1965 	ALC883_FIXUP_EAPD,
1966 	ALC883_FIXUP_ACER_EAPD,
1967 	ALC882_FIXUP_GPIO1,
1968 	ALC882_FIXUP_GPIO2,
1969 	ALC882_FIXUP_GPIO3,
1970 	ALC889_FIXUP_COEF,
1971 	ALC882_FIXUP_ASUS_W2JC,
1972 	ALC882_FIXUP_ACER_ASPIRE_4930G,
1973 	ALC882_FIXUP_ACER_ASPIRE_8930G,
1974 	ALC882_FIXUP_ASPIRE_8930G_VERBS,
1975 	ALC885_FIXUP_MACPRO_GPIO,
1976 	ALC889_FIXUP_DAC_ROUTE,
1977 	ALC889_FIXUP_MBP_VREF,
1978 	ALC889_FIXUP_IMAC91_VREF,
1979 	ALC889_FIXUP_MBA11_VREF,
1980 	ALC889_FIXUP_MBA21_VREF,
1981 	ALC889_FIXUP_MP11_VREF,
1982 	ALC889_FIXUP_MP41_VREF,
1983 	ALC882_FIXUP_INV_DMIC,
1984 	ALC882_FIXUP_NO_PRIMARY_HP,
1985 	ALC887_FIXUP_ASUS_BASS,
1986 	ALC887_FIXUP_BASS_CHMAP,
1987 	ALC1220_FIXUP_GB_DUAL_CODECS,
1988 	ALC1220_FIXUP_GB_X570,
1989 	ALC1220_FIXUP_CLEVO_P950,
1990 	ALC1220_FIXUP_CLEVO_PB51ED,
1991 	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1992 	ALC887_FIXUP_ASUS_AUDIO,
1993 	ALC887_FIXUP_ASUS_HMIC,
1994 	ALCS1200A_FIXUP_MIC_VREF,
1995 	ALC888VD_FIXUP_MIC_100VREF,
1996 };
1997 
1998 static void alc889_fixup_coef(struct hda_codec *codec,
1999 			      const struct hda_fixup *fix, int action)
2000 {
2001 	if (action != HDA_FIXUP_ACT_INIT)
2002 		return;
2003 	alc_update_coef_idx(codec, 7, 0, 0x2030);
2004 }
2005 
2006 /* set up GPIO at initialization */
2007 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2008 				     const struct hda_fixup *fix, int action)
2009 {
2010 	struct alc_spec *spec = codec->spec;
2011 
2012 	spec->gpio_write_delay = true;
2013 	alc_fixup_gpio3(codec, fix, action);
2014 }
2015 
2016 /* Fix the connection of some pins for ALC889:
2017  * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2018  * work correctly (bko#42740)
2019  */
2020 static void alc889_fixup_dac_route(struct hda_codec *codec,
2021 				   const struct hda_fixup *fix, int action)
2022 {
2023 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2024 		/* fake the connections during parsing the tree */
2025 		static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2026 		static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2027 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2028 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2029 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2030 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2031 	} else if (action == HDA_FIXUP_ACT_PROBE) {
2032 		/* restore the connections */
2033 		static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2034 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2035 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2036 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2037 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2038 	}
2039 }
2040 
2041 /* Set VREF on HP pin */
2042 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2043 				  const struct hda_fixup *fix, int action)
2044 {
2045 	static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2046 	struct alc_spec *spec = codec->spec;
2047 	int i;
2048 
2049 	if (action != HDA_FIXUP_ACT_INIT)
2050 		return;
2051 	for (i = 0; i < ARRAY_SIZE(nids); i++) {
2052 		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2053 		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2054 			continue;
2055 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2056 		val |= AC_PINCTL_VREF_80;
2057 		snd_hda_set_pin_ctl(codec, nids[i], val);
2058 		spec->gen.keep_vref_in_automute = 1;
2059 		break;
2060 	}
2061 }
2062 
2063 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2064 				  const hda_nid_t *nids, int num_nids)
2065 {
2066 	struct alc_spec *spec = codec->spec;
2067 	int i;
2068 
2069 	for (i = 0; i < num_nids; i++) {
2070 		unsigned int val;
2071 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2072 		val |= AC_PINCTL_VREF_50;
2073 		snd_hda_set_pin_ctl(codec, nids[i], val);
2074 	}
2075 	spec->gen.keep_vref_in_automute = 1;
2076 }
2077 
2078 /* Set VREF on speaker pins on imac91 */
2079 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2080 				     const struct hda_fixup *fix, int action)
2081 {
2082 	static const hda_nid_t nids[] = { 0x18, 0x1a };
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 mba11 */
2089 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2090 				    const struct hda_fixup *fix, int action)
2091 {
2092 	static const hda_nid_t nids[] = { 0x18 };
2093 
2094 	if (action == HDA_FIXUP_ACT_INIT)
2095 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2096 }
2097 
2098 /* Set VREF on speaker pins on mba21 */
2099 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2100 				    const struct hda_fixup *fix, int action)
2101 {
2102 	static const hda_nid_t nids[] = { 0x18, 0x19 };
2103 
2104 	if (action == HDA_FIXUP_ACT_INIT)
2105 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2106 }
2107 
2108 /* Don't take HP output as primary
2109  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2110  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2111  */
2112 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2113 				       const struct hda_fixup *fix, int action)
2114 {
2115 	struct alc_spec *spec = codec->spec;
2116 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2117 		spec->gen.no_primary_hp = 1;
2118 		spec->gen.no_multi_io = 1;
2119 	}
2120 }
2121 
2122 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2123 				 const struct hda_fixup *fix, int action);
2124 
2125 /* For dual-codec configuration, we need to disable some features to avoid
2126  * conflicts of kctls and PCM streams
2127  */
2128 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2129 				  const struct hda_fixup *fix, int action)
2130 {
2131 	struct alc_spec *spec = codec->spec;
2132 
2133 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2134 		return;
2135 	/* disable vmaster */
2136 	spec->gen.suppress_vmaster = 1;
2137 	/* auto-mute and auto-mic switch don't work with multiple codecs */
2138 	spec->gen.suppress_auto_mute = 1;
2139 	spec->gen.suppress_auto_mic = 1;
2140 	/* disable aamix as well */
2141 	spec->gen.mixer_nid = 0;
2142 	/* add location prefix to avoid conflicts */
2143 	codec->force_pin_prefix = 1;
2144 }
2145 
2146 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2147 		       const char *newname)
2148 {
2149 	struct snd_kcontrol *kctl;
2150 
2151 	kctl = snd_hda_find_mixer_ctl(codec, oldname);
2152 	if (kctl)
2153 		snd_ctl_rename(codec->card, kctl, newname);
2154 }
2155 
2156 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2157 					 const struct hda_fixup *fix,
2158 					 int action)
2159 {
2160 	alc_fixup_dual_codecs(codec, fix, action);
2161 	switch (action) {
2162 	case HDA_FIXUP_ACT_PRE_PROBE:
2163 		/* override card longname to provide a unique UCM profile */
2164 		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2165 		break;
2166 	case HDA_FIXUP_ACT_BUILD:
2167 		/* rename Capture controls depending on the codec */
2168 		rename_ctl(codec, "Capture Volume",
2169 			   codec->addr == 0 ?
2170 			   "Rear-Panel Capture Volume" :
2171 			   "Front-Panel Capture Volume");
2172 		rename_ctl(codec, "Capture Switch",
2173 			   codec->addr == 0 ?
2174 			   "Rear-Panel Capture Switch" :
2175 			   "Front-Panel Capture Switch");
2176 		break;
2177 	}
2178 }
2179 
2180 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2181 				     const struct hda_fixup *fix,
2182 				     int action)
2183 {
2184 	static const hda_nid_t conn1[] = { 0x0c };
2185 	static const struct coef_fw gb_x570_coefs[] = {
2186 		WRITE_COEF(0x07, 0x03c0),
2187 		WRITE_COEF(0x1a, 0x01c1),
2188 		WRITE_COEF(0x1b, 0x0202),
2189 		WRITE_COEF(0x43, 0x3005),
2190 		{}
2191 	};
2192 
2193 	switch (action) {
2194 	case HDA_FIXUP_ACT_PRE_PROBE:
2195 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2196 		snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2197 		break;
2198 	case HDA_FIXUP_ACT_INIT:
2199 		alc_process_coef_fw(codec, gb_x570_coefs);
2200 		break;
2201 	}
2202 }
2203 
2204 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2205 				     const struct hda_fixup *fix,
2206 				     int action)
2207 {
2208 	static const hda_nid_t conn1[] = { 0x0c };
2209 
2210 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2211 		return;
2212 
2213 	alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2214 	/* We therefore want to make sure 0x14 (front headphone) and
2215 	 * 0x1b (speakers) use the stereo DAC 0x02
2216 	 */
2217 	snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2218 	snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2219 }
2220 
2221 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2222 				const struct hda_fixup *fix, int action);
2223 
2224 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2225 				     const struct hda_fixup *fix,
2226 				     int action)
2227 {
2228 	alc1220_fixup_clevo_p950(codec, fix, action);
2229 	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2230 }
2231 
2232 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2233 					 struct hda_jack_callback *jack)
2234 {
2235 	struct alc_spec *spec = codec->spec;
2236 	unsigned int vref;
2237 
2238 	snd_hda_gen_hp_automute(codec, jack);
2239 
2240 	if (spec->gen.hp_jack_present)
2241 		vref = AC_PINCTL_VREF_80;
2242 	else
2243 		vref = AC_PINCTL_VREF_HIZ;
2244 	snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2245 }
2246 
2247 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2248 				     const struct hda_fixup *fix, int action)
2249 {
2250 	struct alc_spec *spec = codec->spec;
2251 	if (action != HDA_FIXUP_ACT_PROBE)
2252 		return;
2253 	snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2254 	spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2255 }
2256 
2257 static const struct hda_fixup alc882_fixups[] = {
2258 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
2259 		.type = HDA_FIXUP_PINS,
2260 		.v.pins = (const struct hda_pintbl[]) {
2261 			{ 0x15, 0x01080104 }, /* side */
2262 			{ 0x16, 0x01011012 }, /* rear */
2263 			{ 0x17, 0x01016011 }, /* clfe */
2264 			{ }
2265 		}
2266 	},
2267 	[ALC882_FIXUP_LENOVO_Y530] = {
2268 		.type = HDA_FIXUP_PINS,
2269 		.v.pins = (const struct hda_pintbl[]) {
2270 			{ 0x15, 0x99130112 }, /* rear int speakers */
2271 			{ 0x16, 0x99130111 }, /* subwoofer */
2272 			{ }
2273 		}
2274 	},
2275 	[ALC882_FIXUP_PB_M5210] = {
2276 		.type = HDA_FIXUP_PINCTLS,
2277 		.v.pins = (const struct hda_pintbl[]) {
2278 			{ 0x19, PIN_VREF50 },
2279 			{}
2280 		}
2281 	},
2282 	[ALC882_FIXUP_ACER_ASPIRE_7736] = {
2283 		.type = HDA_FIXUP_FUNC,
2284 		.v.func = alc_fixup_sku_ignore,
2285 	},
2286 	[ALC882_FIXUP_ASUS_W90V] = {
2287 		.type = HDA_FIXUP_PINS,
2288 		.v.pins = (const struct hda_pintbl[]) {
2289 			{ 0x16, 0x99130110 }, /* fix sequence for CLFE */
2290 			{ }
2291 		}
2292 	},
2293 	[ALC889_FIXUP_CD] = {
2294 		.type = HDA_FIXUP_PINS,
2295 		.v.pins = (const struct hda_pintbl[]) {
2296 			{ 0x1c, 0x993301f0 }, /* CD */
2297 			{ }
2298 		}
2299 	},
2300 	[ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2301 		.type = HDA_FIXUP_PINS,
2302 		.v.pins = (const struct hda_pintbl[]) {
2303 			{ 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2304 			{ }
2305 		},
2306 		.chained = true,
2307 		.chain_id = ALC889_FIXUP_CD,
2308 	},
2309 	[ALC889_FIXUP_VAIO_TT] = {
2310 		.type = HDA_FIXUP_PINS,
2311 		.v.pins = (const struct hda_pintbl[]) {
2312 			{ 0x17, 0x90170111 }, /* hidden surround speaker */
2313 			{ }
2314 		}
2315 	},
2316 	[ALC888_FIXUP_EEE1601] = {
2317 		.type = HDA_FIXUP_VERBS,
2318 		.v.verbs = (const struct hda_verb[]) {
2319 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2320 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x0838 },
2321 			{ }
2322 		}
2323 	},
2324 	[ALC886_FIXUP_EAPD] = {
2325 		.type = HDA_FIXUP_VERBS,
2326 		.v.verbs = (const struct hda_verb[]) {
2327 			/* change to EAPD mode */
2328 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2329 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2330 			{ }
2331 		}
2332 	},
2333 	[ALC882_FIXUP_EAPD] = {
2334 		.type = HDA_FIXUP_VERBS,
2335 		.v.verbs = (const struct hda_verb[]) {
2336 			/* change to EAPD mode */
2337 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2338 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2339 			{ }
2340 		}
2341 	},
2342 	[ALC883_FIXUP_EAPD] = {
2343 		.type = HDA_FIXUP_VERBS,
2344 		.v.verbs = (const struct hda_verb[]) {
2345 			/* change to EAPD mode */
2346 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2347 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2348 			{ }
2349 		}
2350 	},
2351 	[ALC883_FIXUP_ACER_EAPD] = {
2352 		.type = HDA_FIXUP_VERBS,
2353 		.v.verbs = (const struct hda_verb[]) {
2354 			/* eanable EAPD on Acer laptops */
2355 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2356 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2357 			{ }
2358 		}
2359 	},
2360 	[ALC882_FIXUP_GPIO1] = {
2361 		.type = HDA_FIXUP_FUNC,
2362 		.v.func = alc_fixup_gpio1,
2363 	},
2364 	[ALC882_FIXUP_GPIO2] = {
2365 		.type = HDA_FIXUP_FUNC,
2366 		.v.func = alc_fixup_gpio2,
2367 	},
2368 	[ALC882_FIXUP_GPIO3] = {
2369 		.type = HDA_FIXUP_FUNC,
2370 		.v.func = alc_fixup_gpio3,
2371 	},
2372 	[ALC882_FIXUP_ASUS_W2JC] = {
2373 		.type = HDA_FIXUP_FUNC,
2374 		.v.func = alc_fixup_gpio1,
2375 		.chained = true,
2376 		.chain_id = ALC882_FIXUP_EAPD,
2377 	},
2378 	[ALC889_FIXUP_COEF] = {
2379 		.type = HDA_FIXUP_FUNC,
2380 		.v.func = alc889_fixup_coef,
2381 	},
2382 	[ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2383 		.type = HDA_FIXUP_PINS,
2384 		.v.pins = (const struct hda_pintbl[]) {
2385 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2386 			{ 0x17, 0x99130112 }, /* surround speaker */
2387 			{ }
2388 		},
2389 		.chained = true,
2390 		.chain_id = ALC882_FIXUP_GPIO1,
2391 	},
2392 	[ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2393 		.type = HDA_FIXUP_PINS,
2394 		.v.pins = (const struct hda_pintbl[]) {
2395 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2396 			{ 0x1b, 0x99130112 }, /* surround speaker */
2397 			{ }
2398 		},
2399 		.chained = true,
2400 		.chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2401 	},
2402 	[ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2403 		/* additional init verbs for Acer Aspire 8930G */
2404 		.type = HDA_FIXUP_VERBS,
2405 		.v.verbs = (const struct hda_verb[]) {
2406 			/* Enable all DACs */
2407 			/* DAC DISABLE/MUTE 1? */
2408 			/*  setting bits 1-5 disables DAC nids 0x02-0x06
2409 			 *  apparently. Init=0x38 */
2410 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2411 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2412 			/* DAC DISABLE/MUTE 2? */
2413 			/*  some bit here disables the other DACs.
2414 			 *  Init=0x4900 */
2415 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2416 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2417 			/* DMIC fix
2418 			 * This laptop has a stereo digital microphone.
2419 			 * The mics are only 1cm apart which makes the stereo
2420 			 * useless. However, either the mic or the ALC889
2421 			 * makes the signal become a difference/sum signal
2422 			 * instead of standard stereo, which is annoying.
2423 			 * So instead we flip this bit which makes the
2424 			 * codec replicate the sum signal to both channels,
2425 			 * turning it into a normal mono mic.
2426 			 */
2427 			/* DMIC_CONTROL? Init value = 0x0001 */
2428 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2429 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2430 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2431 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2432 			{ }
2433 		},
2434 		.chained = true,
2435 		.chain_id = ALC882_FIXUP_GPIO1,
2436 	},
2437 	[ALC885_FIXUP_MACPRO_GPIO] = {
2438 		.type = HDA_FIXUP_FUNC,
2439 		.v.func = alc885_fixup_macpro_gpio,
2440 	},
2441 	[ALC889_FIXUP_DAC_ROUTE] = {
2442 		.type = HDA_FIXUP_FUNC,
2443 		.v.func = alc889_fixup_dac_route,
2444 	},
2445 	[ALC889_FIXUP_MBP_VREF] = {
2446 		.type = HDA_FIXUP_FUNC,
2447 		.v.func = alc889_fixup_mbp_vref,
2448 		.chained = true,
2449 		.chain_id = ALC882_FIXUP_GPIO1,
2450 	},
2451 	[ALC889_FIXUP_IMAC91_VREF] = {
2452 		.type = HDA_FIXUP_FUNC,
2453 		.v.func = alc889_fixup_imac91_vref,
2454 		.chained = true,
2455 		.chain_id = ALC882_FIXUP_GPIO1,
2456 	},
2457 	[ALC889_FIXUP_MBA11_VREF] = {
2458 		.type = HDA_FIXUP_FUNC,
2459 		.v.func = alc889_fixup_mba11_vref,
2460 		.chained = true,
2461 		.chain_id = ALC889_FIXUP_MBP_VREF,
2462 	},
2463 	[ALC889_FIXUP_MBA21_VREF] = {
2464 		.type = HDA_FIXUP_FUNC,
2465 		.v.func = alc889_fixup_mba21_vref,
2466 		.chained = true,
2467 		.chain_id = ALC889_FIXUP_MBP_VREF,
2468 	},
2469 	[ALC889_FIXUP_MP11_VREF] = {
2470 		.type = HDA_FIXUP_FUNC,
2471 		.v.func = alc889_fixup_mba11_vref,
2472 		.chained = true,
2473 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2474 	},
2475 	[ALC889_FIXUP_MP41_VREF] = {
2476 		.type = HDA_FIXUP_FUNC,
2477 		.v.func = alc889_fixup_mbp_vref,
2478 		.chained = true,
2479 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2480 	},
2481 	[ALC882_FIXUP_INV_DMIC] = {
2482 		.type = HDA_FIXUP_FUNC,
2483 		.v.func = alc_fixup_inv_dmic,
2484 	},
2485 	[ALC882_FIXUP_NO_PRIMARY_HP] = {
2486 		.type = HDA_FIXUP_FUNC,
2487 		.v.func = alc882_fixup_no_primary_hp,
2488 	},
2489 	[ALC887_FIXUP_ASUS_BASS] = {
2490 		.type = HDA_FIXUP_PINS,
2491 		.v.pins = (const struct hda_pintbl[]) {
2492 			{0x16, 0x99130130}, /* bass speaker */
2493 			{}
2494 		},
2495 		.chained = true,
2496 		.chain_id = ALC887_FIXUP_BASS_CHMAP,
2497 	},
2498 	[ALC887_FIXUP_BASS_CHMAP] = {
2499 		.type = HDA_FIXUP_FUNC,
2500 		.v.func = alc_fixup_bass_chmap,
2501 	},
2502 	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
2503 		.type = HDA_FIXUP_FUNC,
2504 		.v.func = alc1220_fixup_gb_dual_codecs,
2505 	},
2506 	[ALC1220_FIXUP_GB_X570] = {
2507 		.type = HDA_FIXUP_FUNC,
2508 		.v.func = alc1220_fixup_gb_x570,
2509 	},
2510 	[ALC1220_FIXUP_CLEVO_P950] = {
2511 		.type = HDA_FIXUP_FUNC,
2512 		.v.func = alc1220_fixup_clevo_p950,
2513 	},
2514 	[ALC1220_FIXUP_CLEVO_PB51ED] = {
2515 		.type = HDA_FIXUP_FUNC,
2516 		.v.func = alc1220_fixup_clevo_pb51ed,
2517 	},
2518 	[ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2519 		.type = HDA_FIXUP_PINS,
2520 		.v.pins = (const struct hda_pintbl[]) {
2521 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2522 			{}
2523 		},
2524 		.chained = true,
2525 		.chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2526 	},
2527 	[ALC887_FIXUP_ASUS_AUDIO] = {
2528 		.type = HDA_FIXUP_PINS,
2529 		.v.pins = (const struct hda_pintbl[]) {
2530 			{ 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2531 			{ 0x19, 0x22219420 },
2532 			{}
2533 		},
2534 	},
2535 	[ALC887_FIXUP_ASUS_HMIC] = {
2536 		.type = HDA_FIXUP_FUNC,
2537 		.v.func = alc887_fixup_asus_jack,
2538 		.chained = true,
2539 		.chain_id = ALC887_FIXUP_ASUS_AUDIO,
2540 	},
2541 	[ALCS1200A_FIXUP_MIC_VREF] = {
2542 		.type = HDA_FIXUP_PINCTLS,
2543 		.v.pins = (const struct hda_pintbl[]) {
2544 			{ 0x18, PIN_VREF50 }, /* rear mic */
2545 			{ 0x19, PIN_VREF50 }, /* front mic */
2546 			{}
2547 		}
2548 	},
2549 	[ALC888VD_FIXUP_MIC_100VREF] = {
2550 		.type = HDA_FIXUP_PINCTLS,
2551 		.v.pins = (const struct hda_pintbl[]) {
2552 			{ 0x18, PIN_VREF100 }, /* headset mic */
2553 			{}
2554 		}
2555 	},
2556 };
2557 
2558 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2559 	SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2560 	SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2561 	SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2562 	SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2563 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2564 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2565 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2566 	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2567 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2568 	SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2569 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2570 	SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2571 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2572 	SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2573 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2574 	SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2575 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2576 	SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2577 	SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2578 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2579 	SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2580 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2581 	SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2582 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2583 	SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2584 	SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2585 	SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2586 	SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2587 	SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2588 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2589 	SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2590 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2591 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2592 	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2593 	SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2594 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2595 	SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2596 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2597 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2598 	SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2599 
2600 	/* All Apple entries are in codec SSIDs */
2601 	SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2602 	SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2603 	SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2604 	SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2605 	SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2606 	SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2607 	SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2608 	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2609 	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2610 	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2611 	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2612 	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2613 	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2614 	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2615 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2616 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2617 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2618 	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2619 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2620 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2621 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2622 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2623 
2624 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2625 	SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2626 	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2627 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2628 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2629 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2630 	SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2631 	SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2632 	SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2633 	SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2634 	SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2635 	SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2636 	SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2637 	SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2638 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2639 	SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2640 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2641 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2642 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2643 	SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2644 	SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2645 	SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2646 	SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2647 	SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2648 	SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2649 	SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2650 	SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2651 	SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2652 	SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2653 	SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2654 	SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2655 	SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2656 	SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 	SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 	SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 	SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 	SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2661 	SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2662 	SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2663 	SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2664 	SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2665 	SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2666 	SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2667 	SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2668 	SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2669 	SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2670 	SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2671 	SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2672 	SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2673 	SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2674 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2675 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2676 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2677 	SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2678 	{}
2679 };
2680 
2681 static const struct hda_model_fixup alc882_fixup_models[] = {
2682 	{.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2683 	{.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2684 	{.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2685 	{.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2686 	{.id = ALC889_FIXUP_CD, .name = "cd"},
2687 	{.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2688 	{.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2689 	{.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2690 	{.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2691 	{.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2692 	{.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2693 	{.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2694 	{.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2695 	{.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2696 	{.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2697 	{.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2698 	{.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2699 	{.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2700 	{.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2701 	{.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2702 	{.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2703 	{.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2704 	{.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2705 	{.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2706 	{.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2707 	{.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2708 	{.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2709 	{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2710 	{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2711 	{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2712 	{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2713 	{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2714 	{}
2715 };
2716 
2717 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2718 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2719 		{0x14, 0x01014010},
2720 		{0x15, 0x01011012},
2721 		{0x16, 0x01016011},
2722 		{0x18, 0x01a19040},
2723 		{0x19, 0x02a19050},
2724 		{0x1a, 0x0181304f},
2725 		{0x1b, 0x0221401f},
2726 		{0x1e, 0x01456130}),
2727 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2728 		{0x14, 0x01015010},
2729 		{0x15, 0x01011012},
2730 		{0x16, 0x01011011},
2731 		{0x18, 0x01a11040},
2732 		{0x19, 0x02a19050},
2733 		{0x1a, 0x0181104f},
2734 		{0x1b, 0x0221401f},
2735 		{0x1e, 0x01451130}),
2736 	{}
2737 };
2738 
2739 /*
2740  * BIOS auto configuration
2741  */
2742 /* almost identical with ALC880 parser... */
2743 static int alc882_parse_auto_config(struct hda_codec *codec)
2744 {
2745 	static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2746 	static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2747 	return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2748 }
2749 
2750 /*
2751  */
2752 static int patch_alc882(struct hda_codec *codec)
2753 {
2754 	struct alc_spec *spec;
2755 	int err;
2756 
2757 	err = alc_alloc_spec(codec, 0x0b);
2758 	if (err < 0)
2759 		return err;
2760 
2761 	spec = codec->spec;
2762 
2763 	switch (codec->core.vendor_id) {
2764 	case 0x10ec0882:
2765 	case 0x10ec0885:
2766 	case 0x10ec0900:
2767 	case 0x10ec0b00:
2768 	case 0x10ec1220:
2769 		break;
2770 	default:
2771 		/* ALC883 and variants */
2772 		alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2773 		break;
2774 	}
2775 
2776 	alc_pre_init(codec);
2777 
2778 	snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2779 		       alc882_fixups);
2780 	snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2781 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2782 
2783 	alc_auto_parse_customize_define(codec);
2784 
2785 	if (has_cdefine_beep(codec))
2786 		spec->gen.beep_nid = 0x01;
2787 
2788 	/* automatic parse from the BIOS config */
2789 	err = alc882_parse_auto_config(codec);
2790 	if (err < 0)
2791 		goto error;
2792 
2793 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2794 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2795 		if (err < 0)
2796 			goto error;
2797 	}
2798 
2799 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2800 
2801 	return 0;
2802 
2803  error:
2804 	alc_free(codec);
2805 	return err;
2806 }
2807 
2808 
2809 /*
2810  * ALC262 support
2811  */
2812 static int alc262_parse_auto_config(struct hda_codec *codec)
2813 {
2814 	static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2815 	static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2816 	return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2817 }
2818 
2819 /*
2820  * Pin config fixes
2821  */
2822 enum {
2823 	ALC262_FIXUP_FSC_H270,
2824 	ALC262_FIXUP_FSC_S7110,
2825 	ALC262_FIXUP_HP_Z200,
2826 	ALC262_FIXUP_TYAN,
2827 	ALC262_FIXUP_LENOVO_3000,
2828 	ALC262_FIXUP_BENQ,
2829 	ALC262_FIXUP_BENQ_T31,
2830 	ALC262_FIXUP_INV_DMIC,
2831 	ALC262_FIXUP_INTEL_BAYLEYBAY,
2832 };
2833 
2834 static const struct hda_fixup alc262_fixups[] = {
2835 	[ALC262_FIXUP_FSC_H270] = {
2836 		.type = HDA_FIXUP_PINS,
2837 		.v.pins = (const struct hda_pintbl[]) {
2838 			{ 0x14, 0x99130110 }, /* speaker */
2839 			{ 0x15, 0x0221142f }, /* front HP */
2840 			{ 0x1b, 0x0121141f }, /* rear HP */
2841 			{ }
2842 		}
2843 	},
2844 	[ALC262_FIXUP_FSC_S7110] = {
2845 		.type = HDA_FIXUP_PINS,
2846 		.v.pins = (const struct hda_pintbl[]) {
2847 			{ 0x15, 0x90170110 }, /* speaker */
2848 			{ }
2849 		},
2850 		.chained = true,
2851 		.chain_id = ALC262_FIXUP_BENQ,
2852 	},
2853 	[ALC262_FIXUP_HP_Z200] = {
2854 		.type = HDA_FIXUP_PINS,
2855 		.v.pins = (const struct hda_pintbl[]) {
2856 			{ 0x16, 0x99130120 }, /* internal speaker */
2857 			{ }
2858 		}
2859 	},
2860 	[ALC262_FIXUP_TYAN] = {
2861 		.type = HDA_FIXUP_PINS,
2862 		.v.pins = (const struct hda_pintbl[]) {
2863 			{ 0x14, 0x1993e1f0 }, /* int AUX */
2864 			{ }
2865 		}
2866 	},
2867 	[ALC262_FIXUP_LENOVO_3000] = {
2868 		.type = HDA_FIXUP_PINCTLS,
2869 		.v.pins = (const struct hda_pintbl[]) {
2870 			{ 0x19, PIN_VREF50 },
2871 			{}
2872 		},
2873 		.chained = true,
2874 		.chain_id = ALC262_FIXUP_BENQ,
2875 	},
2876 	[ALC262_FIXUP_BENQ] = {
2877 		.type = HDA_FIXUP_VERBS,
2878 		.v.verbs = (const struct hda_verb[]) {
2879 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2880 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2881 			{}
2882 		}
2883 	},
2884 	[ALC262_FIXUP_BENQ_T31] = {
2885 		.type = HDA_FIXUP_VERBS,
2886 		.v.verbs = (const struct hda_verb[]) {
2887 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2888 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2889 			{}
2890 		}
2891 	},
2892 	[ALC262_FIXUP_INV_DMIC] = {
2893 		.type = HDA_FIXUP_FUNC,
2894 		.v.func = alc_fixup_inv_dmic,
2895 	},
2896 	[ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2897 		.type = HDA_FIXUP_FUNC,
2898 		.v.func = alc_fixup_no_depop_delay,
2899 	},
2900 };
2901 
2902 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2903 	SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2904 	SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2905 	SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2906 	SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2907 	SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2908 	SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2909 	SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2910 	SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2911 	SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2912 	SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2913 	{}
2914 };
2915 
2916 static const struct hda_model_fixup alc262_fixup_models[] = {
2917 	{.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2918 	{.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2919 	{.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2920 	{.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2921 	{.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2922 	{.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2923 	{.id = ALC262_FIXUP_BENQ, .name = "benq"},
2924 	{.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2925 	{.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2926 	{}
2927 };
2928 
2929 /*
2930  */
2931 static int patch_alc262(struct hda_codec *codec)
2932 {
2933 	struct alc_spec *spec;
2934 	int err;
2935 
2936 	err = alc_alloc_spec(codec, 0x0b);
2937 	if (err < 0)
2938 		return err;
2939 
2940 	spec = codec->spec;
2941 	spec->gen.shared_mic_vref_pin = 0x18;
2942 
2943 	spec->shutup = alc_eapd_shutup;
2944 
2945 #if 0
2946 	/* pshou 07/11/05  set a zero PCM sample to DAC when FIFO is
2947 	 * under-run
2948 	 */
2949 	alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2950 #endif
2951 	alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2952 
2953 	alc_pre_init(codec);
2954 
2955 	snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2956 		       alc262_fixups);
2957 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2958 
2959 	alc_auto_parse_customize_define(codec);
2960 
2961 	if (has_cdefine_beep(codec))
2962 		spec->gen.beep_nid = 0x01;
2963 
2964 	/* automatic parse from the BIOS config */
2965 	err = alc262_parse_auto_config(codec);
2966 	if (err < 0)
2967 		goto error;
2968 
2969 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2970 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2971 		if (err < 0)
2972 			goto error;
2973 	}
2974 
2975 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2976 
2977 	return 0;
2978 
2979  error:
2980 	alc_free(codec);
2981 	return err;
2982 }
2983 
2984 /*
2985  *  ALC268
2986  */
2987 /* bind Beep switches of both NID 0x0f and 0x10 */
2988 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2989 				  struct snd_ctl_elem_value *ucontrol)
2990 {
2991 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2992 	unsigned long pval;
2993 	int err;
2994 
2995 	mutex_lock(&codec->control_mutex);
2996 	pval = kcontrol->private_value;
2997 	kcontrol->private_value = (pval & ~0xff) | 0x0f;
2998 	err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2999 	if (err >= 0) {
3000 		kcontrol->private_value = (pval & ~0xff) | 0x10;
3001 		err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3002 	}
3003 	kcontrol->private_value = pval;
3004 	mutex_unlock(&codec->control_mutex);
3005 	return err;
3006 }
3007 
3008 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3009 	HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3010 	{
3011 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3012 		.name = "Beep Playback Switch",
3013 		.subdevice = HDA_SUBDEV_AMP_FLAG,
3014 		.info = snd_hda_mixer_amp_switch_info,
3015 		.get = snd_hda_mixer_amp_switch_get,
3016 		.put = alc268_beep_switch_put,
3017 		.private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3018 	},
3019 };
3020 
3021 /* set PCBEEP vol = 0, mute connections */
3022 static const struct hda_verb alc268_beep_init_verbs[] = {
3023 	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3024 	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3025 	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3026 	{ }
3027 };
3028 
3029 enum {
3030 	ALC268_FIXUP_INV_DMIC,
3031 	ALC268_FIXUP_HP_EAPD,
3032 	ALC268_FIXUP_SPDIF,
3033 };
3034 
3035 static const struct hda_fixup alc268_fixups[] = {
3036 	[ALC268_FIXUP_INV_DMIC] = {
3037 		.type = HDA_FIXUP_FUNC,
3038 		.v.func = alc_fixup_inv_dmic,
3039 	},
3040 	[ALC268_FIXUP_HP_EAPD] = {
3041 		.type = HDA_FIXUP_VERBS,
3042 		.v.verbs = (const struct hda_verb[]) {
3043 			{0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3044 			{}
3045 		}
3046 	},
3047 	[ALC268_FIXUP_SPDIF] = {
3048 		.type = HDA_FIXUP_PINS,
3049 		.v.pins = (const struct hda_pintbl[]) {
3050 			{ 0x1e, 0x014b1180 }, /* enable SPDIF out */
3051 			{}
3052 		}
3053 	},
3054 };
3055 
3056 static const struct hda_model_fixup alc268_fixup_models[] = {
3057 	{.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3058 	{.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3059 	{.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3060 	{}
3061 };
3062 
3063 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
3064 	SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3065 	SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3066 	/* below is codec SSID since multiple Toshiba laptops have the
3067 	 * same PCI SSID 1179:ff00
3068 	 */
3069 	SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3070 	{}
3071 };
3072 
3073 /*
3074  * BIOS auto configuration
3075  */
3076 static int alc268_parse_auto_config(struct hda_codec *codec)
3077 {
3078 	static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3079 	return alc_parse_auto_config(codec, NULL, alc268_ssids);
3080 }
3081 
3082 /*
3083  */
3084 static int patch_alc268(struct hda_codec *codec)
3085 {
3086 	struct alc_spec *spec;
3087 	int i, err;
3088 
3089 	/* ALC268 has no aa-loopback mixer */
3090 	err = alc_alloc_spec(codec, 0);
3091 	if (err < 0)
3092 		return err;
3093 
3094 	spec = codec->spec;
3095 	if (has_cdefine_beep(codec))
3096 		spec->gen.beep_nid = 0x01;
3097 
3098 	spec->shutup = alc_eapd_shutup;
3099 
3100 	alc_pre_init(codec);
3101 
3102 	snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3103 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3104 
3105 	/* automatic parse from the BIOS config */
3106 	err = alc268_parse_auto_config(codec);
3107 	if (err < 0)
3108 		goto error;
3109 
3110 	if (err > 0 && !spec->gen.no_analog &&
3111 	    spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3112 		for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3113 			if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3114 						  &alc268_beep_mixer[i])) {
3115 				err = -ENOMEM;
3116 				goto error;
3117 			}
3118 		}
3119 		snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3120 		if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3121 			/* override the amp caps for beep generator */
3122 			snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3123 					  (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3124 					  (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3125 					  (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3126 					  (0 << AC_AMPCAP_MUTE_SHIFT));
3127 	}
3128 
3129 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3130 
3131 	return 0;
3132 
3133  error:
3134 	alc_free(codec);
3135 	return err;
3136 }
3137 
3138 /*
3139  * ALC269
3140  */
3141 
3142 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3143 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3144 };
3145 
3146 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3147 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3148 };
3149 
3150 /* different alc269-variants */
3151 enum {
3152 	ALC269_TYPE_ALC269VA,
3153 	ALC269_TYPE_ALC269VB,
3154 	ALC269_TYPE_ALC269VC,
3155 	ALC269_TYPE_ALC269VD,
3156 	ALC269_TYPE_ALC280,
3157 	ALC269_TYPE_ALC282,
3158 	ALC269_TYPE_ALC283,
3159 	ALC269_TYPE_ALC284,
3160 	ALC269_TYPE_ALC293,
3161 	ALC269_TYPE_ALC286,
3162 	ALC269_TYPE_ALC298,
3163 	ALC269_TYPE_ALC255,
3164 	ALC269_TYPE_ALC256,
3165 	ALC269_TYPE_ALC257,
3166 	ALC269_TYPE_ALC215,
3167 	ALC269_TYPE_ALC225,
3168 	ALC269_TYPE_ALC245,
3169 	ALC269_TYPE_ALC287,
3170 	ALC269_TYPE_ALC294,
3171 	ALC269_TYPE_ALC300,
3172 	ALC269_TYPE_ALC623,
3173 	ALC269_TYPE_ALC700,
3174 };
3175 
3176 /*
3177  * BIOS auto configuration
3178  */
3179 static int alc269_parse_auto_config(struct hda_codec *codec)
3180 {
3181 	static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3182 	static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3183 	static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3184 	struct alc_spec *spec = codec->spec;
3185 	const hda_nid_t *ssids;
3186 
3187 	switch (spec->codec_variant) {
3188 	case ALC269_TYPE_ALC269VA:
3189 	case ALC269_TYPE_ALC269VC:
3190 	case ALC269_TYPE_ALC280:
3191 	case ALC269_TYPE_ALC284:
3192 	case ALC269_TYPE_ALC293:
3193 		ssids = alc269va_ssids;
3194 		break;
3195 	case ALC269_TYPE_ALC269VB:
3196 	case ALC269_TYPE_ALC269VD:
3197 	case ALC269_TYPE_ALC282:
3198 	case ALC269_TYPE_ALC283:
3199 	case ALC269_TYPE_ALC286:
3200 	case ALC269_TYPE_ALC298:
3201 	case ALC269_TYPE_ALC255:
3202 	case ALC269_TYPE_ALC256:
3203 	case ALC269_TYPE_ALC257:
3204 	case ALC269_TYPE_ALC215:
3205 	case ALC269_TYPE_ALC225:
3206 	case ALC269_TYPE_ALC245:
3207 	case ALC269_TYPE_ALC287:
3208 	case ALC269_TYPE_ALC294:
3209 	case ALC269_TYPE_ALC300:
3210 	case ALC269_TYPE_ALC623:
3211 	case ALC269_TYPE_ALC700:
3212 		ssids = alc269_ssids;
3213 		break;
3214 	default:
3215 		ssids = alc269_ssids;
3216 		break;
3217 	}
3218 
3219 	return alc_parse_auto_config(codec, alc269_ignore, ssids);
3220 }
3221 
3222 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3223 	{ SND_JACK_BTN_0, KEY_PLAYPAUSE },
3224 	{ SND_JACK_BTN_1, KEY_VOICECOMMAND },
3225 	{ SND_JACK_BTN_2, KEY_VOLUMEUP },
3226 	{ SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3227 	{}
3228 };
3229 
3230 static void alc_headset_btn_callback(struct hda_codec *codec,
3231 				     struct hda_jack_callback *jack)
3232 {
3233 	int report = 0;
3234 
3235 	if (jack->unsol_res & (7 << 13))
3236 		report |= SND_JACK_BTN_0;
3237 
3238 	if (jack->unsol_res  & (1 << 16 | 3 << 8))
3239 		report |= SND_JACK_BTN_1;
3240 
3241 	/* Volume up key */
3242 	if (jack->unsol_res & (7 << 23))
3243 		report |= SND_JACK_BTN_2;
3244 
3245 	/* Volume down key */
3246 	if (jack->unsol_res & (7 << 10))
3247 		report |= SND_JACK_BTN_3;
3248 
3249 	snd_hda_jack_set_button_state(codec, jack->nid, report);
3250 }
3251 
3252 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3253 {
3254 	struct alc_spec *spec = codec->spec;
3255 
3256 	if (!spec->has_hs_key)
3257 		return;
3258 
3259 	switch (codec->core.vendor_id) {
3260 	case 0x10ec0215:
3261 	case 0x10ec0225:
3262 	case 0x10ec0285:
3263 	case 0x10ec0287:
3264 	case 0x10ec0295:
3265 	case 0x10ec0289:
3266 	case 0x10ec0299:
3267 		alc_write_coef_idx(codec, 0x48, 0x0);
3268 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3269 		alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3270 		break;
3271 	case 0x10ec0230:
3272 	case 0x10ec0236:
3273 	case 0x10ec0256:
3274 	case 0x10ec0257:
3275 	case 0x19e58326:
3276 		alc_write_coef_idx(codec, 0x48, 0x0);
3277 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3278 		break;
3279 	}
3280 }
3281 
3282 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3283 {
3284 	struct alc_spec *spec = codec->spec;
3285 
3286 	if (!spec->has_hs_key)
3287 		return;
3288 
3289 	switch (codec->core.vendor_id) {
3290 	case 0x10ec0215:
3291 	case 0x10ec0225:
3292 	case 0x10ec0285:
3293 	case 0x10ec0287:
3294 	case 0x10ec0295:
3295 	case 0x10ec0289:
3296 	case 0x10ec0299:
3297 		alc_write_coef_idx(codec, 0x48, 0xd011);
3298 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3299 		alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3300 		break;
3301 	case 0x10ec0230:
3302 	case 0x10ec0236:
3303 	case 0x10ec0256:
3304 	case 0x10ec0257:
3305 	case 0x19e58326:
3306 		alc_write_coef_idx(codec, 0x48, 0xd011);
3307 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3308 		break;
3309 	}
3310 }
3311 
3312 static void alc_fixup_headset_jack(struct hda_codec *codec,
3313 				    const struct hda_fixup *fix, int action)
3314 {
3315 	struct alc_spec *spec = codec->spec;
3316 	hda_nid_t hp_pin;
3317 
3318 	switch (action) {
3319 	case HDA_FIXUP_ACT_PRE_PROBE:
3320 		spec->has_hs_key = 1;
3321 		snd_hda_jack_detect_enable_callback(codec, 0x55,
3322 						    alc_headset_btn_callback);
3323 		break;
3324 	case HDA_FIXUP_ACT_BUILD:
3325 		hp_pin = alc_get_hp_pin(spec);
3326 		if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3327 							alc_headset_btn_keymap,
3328 							hp_pin))
3329 			snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3330 					      false, SND_JACK_HEADSET,
3331 					      alc_headset_btn_keymap);
3332 
3333 		alc_enable_headset_jack_key(codec);
3334 		break;
3335 	}
3336 }
3337 
3338 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3339 {
3340 	alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3341 }
3342 
3343 static void alc269_shutup(struct hda_codec *codec)
3344 {
3345 	struct alc_spec *spec = codec->spec;
3346 
3347 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3348 		alc269vb_toggle_power_output(codec, 0);
3349 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3350 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3351 		msleep(150);
3352 	}
3353 	alc_shutup_pins(codec);
3354 }
3355 
3356 static const struct coef_fw alc282_coefs[] = {
3357 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3358 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3359 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3360 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3361 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3362 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3363 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3364 	WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3365 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3366 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3367 	WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3368 	UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3369 	WRITE_COEF(0x34, 0xa0c0), /* ANC */
3370 	UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3371 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3372 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3373 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3374 	WRITE_COEF(0x63, 0x2902), /* PLL */
3375 	WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3376 	WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3377 	WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3378 	WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3379 	UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3380 	WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3381 	UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3382 	WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3383 	WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3384 	UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3385 	WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3386 	{}
3387 };
3388 
3389 static void alc282_restore_default_value(struct hda_codec *codec)
3390 {
3391 	alc_process_coef_fw(codec, alc282_coefs);
3392 }
3393 
3394 static void alc282_init(struct hda_codec *codec)
3395 {
3396 	struct alc_spec *spec = codec->spec;
3397 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3398 	bool hp_pin_sense;
3399 	int coef78;
3400 
3401 	alc282_restore_default_value(codec);
3402 
3403 	if (!hp_pin)
3404 		return;
3405 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3406 	coef78 = alc_read_coef_idx(codec, 0x78);
3407 
3408 	/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3409 	/* Headphone capless set to high power mode */
3410 	alc_write_coef_idx(codec, 0x78, 0x9004);
3411 
3412 	if (hp_pin_sense)
3413 		msleep(2);
3414 
3415 	snd_hda_codec_write(codec, hp_pin, 0,
3416 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3417 
3418 	if (hp_pin_sense)
3419 		msleep(85);
3420 
3421 	snd_hda_codec_write(codec, hp_pin, 0,
3422 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3423 
3424 	if (hp_pin_sense)
3425 		msleep(100);
3426 
3427 	/* Headphone capless set to normal mode */
3428 	alc_write_coef_idx(codec, 0x78, coef78);
3429 }
3430 
3431 static void alc282_shutup(struct hda_codec *codec)
3432 {
3433 	struct alc_spec *spec = codec->spec;
3434 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3435 	bool hp_pin_sense;
3436 	int coef78;
3437 
3438 	if (!hp_pin) {
3439 		alc269_shutup(codec);
3440 		return;
3441 	}
3442 
3443 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3444 	coef78 = alc_read_coef_idx(codec, 0x78);
3445 	alc_write_coef_idx(codec, 0x78, 0x9004);
3446 
3447 	if (hp_pin_sense)
3448 		msleep(2);
3449 
3450 	snd_hda_codec_write(codec, hp_pin, 0,
3451 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3452 
3453 	if (hp_pin_sense)
3454 		msleep(85);
3455 
3456 	if (!spec->no_shutup_pins)
3457 		snd_hda_codec_write(codec, hp_pin, 0,
3458 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3459 
3460 	if (hp_pin_sense)
3461 		msleep(100);
3462 
3463 	alc_auto_setup_eapd(codec, false);
3464 	alc_shutup_pins(codec);
3465 	alc_write_coef_idx(codec, 0x78, coef78);
3466 }
3467 
3468 static const struct coef_fw alc283_coefs[] = {
3469 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3470 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3471 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3472 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3473 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3474 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3475 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3476 	WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3477 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3478 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3479 	WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3480 	UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3481 	WRITE_COEF(0x22, 0xa0c0), /* ANC */
3482 	UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3483 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3484 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3485 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3486 	WRITE_COEF(0x2e, 0x2902), /* PLL */
3487 	WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3488 	WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3489 	WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3490 	WRITE_COEF(0x36, 0x0), /* capless control 5 */
3491 	UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3492 	WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3493 	UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3494 	WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3495 	WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3496 	UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3497 	WRITE_COEF(0x49, 0x0), /* test mode */
3498 	UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3499 	UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3500 	WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3501 	UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3502 	{}
3503 };
3504 
3505 static void alc283_restore_default_value(struct hda_codec *codec)
3506 {
3507 	alc_process_coef_fw(codec, alc283_coefs);
3508 }
3509 
3510 static void alc283_init(struct hda_codec *codec)
3511 {
3512 	struct alc_spec *spec = codec->spec;
3513 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3514 	bool hp_pin_sense;
3515 
3516 	alc283_restore_default_value(codec);
3517 
3518 	if (!hp_pin)
3519 		return;
3520 
3521 	msleep(30);
3522 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3523 
3524 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3525 	/* Headphone capless set to high power mode */
3526 	alc_write_coef_idx(codec, 0x43, 0x9004);
3527 
3528 	snd_hda_codec_write(codec, hp_pin, 0,
3529 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3530 
3531 	if (hp_pin_sense)
3532 		msleep(85);
3533 
3534 	snd_hda_codec_write(codec, hp_pin, 0,
3535 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3536 
3537 	if (hp_pin_sense)
3538 		msleep(85);
3539 	/* Index 0x46 Combo jack auto switch control 2 */
3540 	/* 3k pull low control for Headset jack. */
3541 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3542 	/* Headphone capless set to normal mode */
3543 	alc_write_coef_idx(codec, 0x43, 0x9614);
3544 }
3545 
3546 static void alc283_shutup(struct hda_codec *codec)
3547 {
3548 	struct alc_spec *spec = codec->spec;
3549 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3550 	bool hp_pin_sense;
3551 
3552 	if (!hp_pin) {
3553 		alc269_shutup(codec);
3554 		return;
3555 	}
3556 
3557 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3558 
3559 	alc_write_coef_idx(codec, 0x43, 0x9004);
3560 
3561 	/*depop hp during suspend*/
3562 	alc_write_coef_idx(codec, 0x06, 0x2100);
3563 
3564 	snd_hda_codec_write(codec, hp_pin, 0,
3565 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3566 
3567 	if (hp_pin_sense)
3568 		msleep(100);
3569 
3570 	if (!spec->no_shutup_pins)
3571 		snd_hda_codec_write(codec, hp_pin, 0,
3572 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3573 
3574 	alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3575 
3576 	if (hp_pin_sense)
3577 		msleep(100);
3578 	alc_auto_setup_eapd(codec, false);
3579 	alc_shutup_pins(codec);
3580 	alc_write_coef_idx(codec, 0x43, 0x9614);
3581 }
3582 
3583 static void alc256_init(struct hda_codec *codec)
3584 {
3585 	struct alc_spec *spec = codec->spec;
3586 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3587 	bool hp_pin_sense;
3588 
3589 	if (spec->ultra_low_power) {
3590 		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3591 		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3592 		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3593 		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3594 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3595 		msleep(30);
3596 	}
3597 
3598 	if (!hp_pin)
3599 		hp_pin = 0x21;
3600 
3601 	msleep(30);
3602 
3603 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3604 
3605 	if (hp_pin_sense) {
3606 		msleep(2);
3607 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3608 
3609 		snd_hda_codec_write(codec, hp_pin, 0,
3610 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3611 
3612 		msleep(75);
3613 
3614 		snd_hda_codec_write(codec, hp_pin, 0,
3615 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3616 
3617 		msleep(75);
3618 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3619 	}
3620 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3621 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3622 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3623 	/*
3624 	 * Expose headphone mic (or possibly Line In on some machines) instead
3625 	 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3626 	 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3627 	 * this register.
3628 	 */
3629 	alc_write_coef_idx(codec, 0x36, 0x5757);
3630 }
3631 
3632 static void alc256_shutup(struct hda_codec *codec)
3633 {
3634 	struct alc_spec *spec = codec->spec;
3635 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3636 	bool hp_pin_sense;
3637 
3638 	if (!hp_pin)
3639 		hp_pin = 0x21;
3640 
3641 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3642 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3643 
3644 	if (hp_pin_sense) {
3645 		msleep(2);
3646 
3647 		snd_hda_codec_write(codec, hp_pin, 0,
3648 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3649 
3650 		msleep(75);
3651 
3652 	/* 3k pull low control for Headset jack. */
3653 	/* NOTE: call this before clearing the pin, otherwise codec stalls */
3654 	/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3655 	 * when booting with headset plugged. So skip setting it for the codec alc257
3656 	 */
3657 		if (spec->en_3kpull_low)
3658 			alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3659 
3660 		if (!spec->no_shutup_pins)
3661 			snd_hda_codec_write(codec, hp_pin, 0,
3662 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3663 
3664 		msleep(75);
3665 	}
3666 
3667 	alc_auto_setup_eapd(codec, false);
3668 	alc_shutup_pins(codec);
3669 	if (spec->ultra_low_power) {
3670 		msleep(50);
3671 		alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3672 		alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3673 		alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3674 		alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3675 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3676 		msleep(30);
3677 	}
3678 }
3679 
3680 static void alc285_hp_init(struct hda_codec *codec)
3681 {
3682 	struct alc_spec *spec = codec->spec;
3683 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3684 	int i, val;
3685 	int coef38, coef0d, coef36;
3686 
3687 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3688 	alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3689 	coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3690 	coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3691 	coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3692 	alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3693 	alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3694 
3695 	alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3696 
3697 	if (hp_pin)
3698 		snd_hda_codec_write(codec, hp_pin, 0,
3699 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3700 
3701 	msleep(130);
3702 	alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3703 	alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3704 
3705 	if (hp_pin)
3706 		snd_hda_codec_write(codec, hp_pin, 0,
3707 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3708 	msleep(10);
3709 	alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3710 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3711 	alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3712 	alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3713 
3714 	alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3715 	val = alc_read_coefex_idx(codec, 0x58, 0x00);
3716 	for (i = 0; i < 20 && val & 0x8000; i++) {
3717 		msleep(50);
3718 		val = alc_read_coefex_idx(codec, 0x58, 0x00);
3719 	} /* Wait for depop procedure finish  */
3720 
3721 	alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3722 	alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3723 	alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3724 	alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3725 
3726 	msleep(50);
3727 	alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3728 }
3729 
3730 static void alc225_init(struct hda_codec *codec)
3731 {
3732 	struct alc_spec *spec = codec->spec;
3733 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3734 	bool hp1_pin_sense, hp2_pin_sense;
3735 
3736 	if (spec->ultra_low_power) {
3737 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3738 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3739 		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3740 		msleep(30);
3741 	}
3742 
3743 	if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3744 		spec->codec_variant != ALC269_TYPE_ALC245)
3745 		/* required only at boot or S3 and S4 resume time */
3746 		if (!spec->done_hp_init ||
3747 			is_s3_resume(codec) ||
3748 			is_s4_resume(codec)) {
3749 			alc285_hp_init(codec);
3750 			spec->done_hp_init = true;
3751 		}
3752 
3753 	if (!hp_pin)
3754 		hp_pin = 0x21;
3755 	msleep(30);
3756 
3757 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3758 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3759 
3760 	if (hp1_pin_sense || hp2_pin_sense)
3761 		msleep(2);
3762 
3763 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3764 
3765 	if (hp1_pin_sense || spec->ultra_low_power)
3766 		snd_hda_codec_write(codec, hp_pin, 0,
3767 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3768 	if (hp2_pin_sense)
3769 		snd_hda_codec_write(codec, 0x16, 0,
3770 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3771 
3772 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3773 		msleep(85);
3774 
3775 	if (hp1_pin_sense || spec->ultra_low_power)
3776 		snd_hda_codec_write(codec, hp_pin, 0,
3777 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3778 	if (hp2_pin_sense)
3779 		snd_hda_codec_write(codec, 0x16, 0,
3780 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3781 
3782 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3783 		msleep(100);
3784 
3785 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3786 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3787 }
3788 
3789 static void alc225_shutup(struct hda_codec *codec)
3790 {
3791 	struct alc_spec *spec = codec->spec;
3792 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3793 	bool hp1_pin_sense, hp2_pin_sense;
3794 
3795 	if (!hp_pin)
3796 		hp_pin = 0x21;
3797 
3798 	alc_disable_headset_jack_key(codec);
3799 	/* 3k pull low control for Headset jack. */
3800 	alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3801 
3802 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3803 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3804 
3805 	if (hp1_pin_sense || hp2_pin_sense)
3806 		msleep(2);
3807 
3808 	if (hp1_pin_sense || spec->ultra_low_power)
3809 		snd_hda_codec_write(codec, hp_pin, 0,
3810 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3811 	if (hp2_pin_sense)
3812 		snd_hda_codec_write(codec, 0x16, 0,
3813 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3814 
3815 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3816 		msleep(85);
3817 
3818 	if (hp1_pin_sense || spec->ultra_low_power)
3819 		snd_hda_codec_write(codec, hp_pin, 0,
3820 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3821 	if (hp2_pin_sense)
3822 		snd_hda_codec_write(codec, 0x16, 0,
3823 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3824 
3825 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3826 		msleep(100);
3827 
3828 	alc_auto_setup_eapd(codec, false);
3829 	alc_shutup_pins(codec);
3830 	if (spec->ultra_low_power) {
3831 		msleep(50);
3832 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3833 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3834 		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3835 		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3836 		msleep(30);
3837 	}
3838 
3839 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3840 	alc_enable_headset_jack_key(codec);
3841 }
3842 
3843 static void alc_default_init(struct hda_codec *codec)
3844 {
3845 	struct alc_spec *spec = codec->spec;
3846 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3847 	bool hp_pin_sense;
3848 
3849 	if (!hp_pin)
3850 		return;
3851 
3852 	msleep(30);
3853 
3854 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3855 
3856 	if (hp_pin_sense) {
3857 		msleep(2);
3858 
3859 		snd_hda_codec_write(codec, hp_pin, 0,
3860 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3861 
3862 		msleep(75);
3863 
3864 		snd_hda_codec_write(codec, hp_pin, 0,
3865 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3866 		msleep(75);
3867 	}
3868 }
3869 
3870 static void alc_default_shutup(struct hda_codec *codec)
3871 {
3872 	struct alc_spec *spec = codec->spec;
3873 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3874 	bool hp_pin_sense;
3875 
3876 	if (!hp_pin) {
3877 		alc269_shutup(codec);
3878 		return;
3879 	}
3880 
3881 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3882 
3883 	if (hp_pin_sense) {
3884 		msleep(2);
3885 
3886 		snd_hda_codec_write(codec, hp_pin, 0,
3887 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3888 
3889 		msleep(75);
3890 
3891 		if (!spec->no_shutup_pins)
3892 			snd_hda_codec_write(codec, hp_pin, 0,
3893 					    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3894 
3895 		msleep(75);
3896 	}
3897 	alc_auto_setup_eapd(codec, false);
3898 	alc_shutup_pins(codec);
3899 }
3900 
3901 static void alc294_hp_init(struct hda_codec *codec)
3902 {
3903 	struct alc_spec *spec = codec->spec;
3904 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3905 	int i, val;
3906 
3907 	if (!hp_pin)
3908 		return;
3909 
3910 	snd_hda_codec_write(codec, hp_pin, 0,
3911 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3912 
3913 	msleep(100);
3914 
3915 	if (!spec->no_shutup_pins)
3916 		snd_hda_codec_write(codec, hp_pin, 0,
3917 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3918 
3919 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3920 	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3921 
3922 	/* Wait for depop procedure finish  */
3923 	val = alc_read_coefex_idx(codec, 0x58, 0x01);
3924 	for (i = 0; i < 20 && val & 0x0080; i++) {
3925 		msleep(50);
3926 		val = alc_read_coefex_idx(codec, 0x58, 0x01);
3927 	}
3928 	/* Set HP depop to auto mode */
3929 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3930 	msleep(50);
3931 }
3932 
3933 static void alc294_init(struct hda_codec *codec)
3934 {
3935 	struct alc_spec *spec = codec->spec;
3936 
3937 	/* required only at boot or S4 resume time */
3938 	if (!spec->done_hp_init ||
3939 	    codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3940 		alc294_hp_init(codec);
3941 		spec->done_hp_init = true;
3942 	}
3943 	alc_default_init(codec);
3944 }
3945 
3946 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3947 			     unsigned int val)
3948 {
3949 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3950 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3951 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3952 }
3953 
3954 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3955 {
3956 	unsigned int val;
3957 
3958 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3959 	val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3960 		& 0xffff;
3961 	val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3962 		<< 16;
3963 	return val;
3964 }
3965 
3966 static void alc5505_dsp_halt(struct hda_codec *codec)
3967 {
3968 	unsigned int val;
3969 
3970 	alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3971 	alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3972 	alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3973 	alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3974 	alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3975 	alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3976 	alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3977 	val = alc5505_coef_get(codec, 0x6220);
3978 	alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3979 }
3980 
3981 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3982 {
3983 	alc5505_coef_set(codec, 0x61b8, 0x04133302);
3984 	alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3985 	alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3986 	alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3987 	alc5505_coef_set(codec, 0x6220, 0x2002010f);
3988 	alc5505_coef_set(codec, 0x880c, 0x00000004);
3989 }
3990 
3991 static void alc5505_dsp_init(struct hda_codec *codec)
3992 {
3993 	unsigned int val;
3994 
3995 	alc5505_dsp_halt(codec);
3996 	alc5505_dsp_back_from_halt(codec);
3997 	alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3998 	alc5505_coef_set(codec, 0x61b0, 0x5b16);
3999 	alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
4000 	alc5505_coef_set(codec, 0x61b4, 0x04132b02);
4001 	alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
4002 	alc5505_coef_set(codec, 0x61b8, 0x041f3302);
4003 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
4004 	alc5505_coef_set(codec, 0x61b8, 0x041b3302);
4005 	alc5505_coef_set(codec, 0x61b8, 0x04173302);
4006 	alc5505_coef_set(codec, 0x61b8, 0x04163302);
4007 	alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4008 	alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4009 	alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4010 
4011 	val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4012 	if (val <= 3)
4013 		alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4014 	else
4015 		alc5505_coef_set(codec, 0x6220, 0x6002018f);
4016 
4017 	alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4018 	alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4019 	alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4020 	alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4021 	alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4022 	alc5505_coef_set(codec, 0x880c, 0x00000003);
4023 	alc5505_coef_set(codec, 0x880c, 0x00000010);
4024 
4025 #ifdef HALT_REALTEK_ALC5505
4026 	alc5505_dsp_halt(codec);
4027 #endif
4028 }
4029 
4030 #ifdef HALT_REALTEK_ALC5505
4031 #define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
4032 #define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
4033 #else
4034 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
4035 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
4036 #endif
4037 
4038 #ifdef CONFIG_PM
4039 static int alc269_suspend(struct hda_codec *codec)
4040 {
4041 	struct alc_spec *spec = codec->spec;
4042 
4043 	if (spec->has_alc5505_dsp)
4044 		alc5505_dsp_suspend(codec);
4045 
4046 	return alc_suspend(codec);
4047 }
4048 
4049 static int alc269_resume(struct hda_codec *codec)
4050 {
4051 	struct alc_spec *spec = codec->spec;
4052 
4053 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4054 		alc269vb_toggle_power_output(codec, 0);
4055 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4056 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
4057 		msleep(150);
4058 	}
4059 
4060 	codec->patch_ops.init(codec);
4061 
4062 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4063 		alc269vb_toggle_power_output(codec, 1);
4064 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4065 			(alc_get_coef0(codec) & 0x00ff) == 0x017) {
4066 		msleep(200);
4067 	}
4068 
4069 	snd_hda_regmap_sync(codec);
4070 	hda_call_check_power_status(codec, 0x01);
4071 
4072 	/* on some machine, the BIOS will clear the codec gpio data when enter
4073 	 * suspend, and won't restore the data after resume, so we restore it
4074 	 * in the driver.
4075 	 */
4076 	if (spec->gpio_data)
4077 		alc_write_gpio_data(codec);
4078 
4079 	if (spec->has_alc5505_dsp)
4080 		alc5505_dsp_resume(codec);
4081 
4082 	return 0;
4083 }
4084 #endif /* CONFIG_PM */
4085 
4086 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4087 						 const struct hda_fixup *fix, int action)
4088 {
4089 	struct alc_spec *spec = codec->spec;
4090 
4091 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4092 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4093 }
4094 
4095 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4096 						 const struct hda_fixup *fix,
4097 						 int action)
4098 {
4099 	unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4100 	unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4101 
4102 	if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4103 		snd_hda_codec_set_pincfg(codec, 0x19,
4104 			(cfg_headphone & ~AC_DEFCFG_DEVICE) |
4105 			(AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4106 }
4107 
4108 static void alc269_fixup_hweq(struct hda_codec *codec,
4109 			       const struct hda_fixup *fix, int action)
4110 {
4111 	if (action == HDA_FIXUP_ACT_INIT)
4112 		alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4113 }
4114 
4115 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4116 				       const struct hda_fixup *fix, int action)
4117 {
4118 	struct alc_spec *spec = codec->spec;
4119 
4120 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4121 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4122 }
4123 
4124 static void alc271_fixup_dmic(struct hda_codec *codec,
4125 			      const struct hda_fixup *fix, int action)
4126 {
4127 	static const struct hda_verb verbs[] = {
4128 		{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4129 		{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4130 		{}
4131 	};
4132 	unsigned int cfg;
4133 
4134 	if (strcmp(codec->core.chip_name, "ALC271X") &&
4135 	    strcmp(codec->core.chip_name, "ALC269VB"))
4136 		return;
4137 	cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4138 	if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4139 		snd_hda_sequence_write(codec, verbs);
4140 }
4141 
4142 /* Fix the speaker amp after resume, etc */
4143 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4144 					  const struct hda_fixup *fix,
4145 					  int action)
4146 {
4147 	if (action == HDA_FIXUP_ACT_INIT)
4148 		alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4149 }
4150 
4151 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4152 				 const struct hda_fixup *fix, int action)
4153 {
4154 	struct alc_spec *spec = codec->spec;
4155 
4156 	if (action != HDA_FIXUP_ACT_PROBE)
4157 		return;
4158 
4159 	/* Due to a hardware problem on Lenovo Ideadpad, we need to
4160 	 * fix the sample rate of analog I/O to 44.1kHz
4161 	 */
4162 	spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4163 	spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4164 }
4165 
4166 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4167 				     const struct hda_fixup *fix, int action)
4168 {
4169 	/* The digital-mic unit sends PDM (differential signal) instead of
4170 	 * the standard PCM, thus you can't record a valid mono stream as is.
4171 	 * Below is a workaround specific to ALC269 to control the dmic
4172 	 * signal source as mono.
4173 	 */
4174 	if (action == HDA_FIXUP_ACT_INIT)
4175 		alc_update_coef_idx(codec, 0x07, 0, 0x80);
4176 }
4177 
4178 static void alc269_quanta_automute(struct hda_codec *codec)
4179 {
4180 	snd_hda_gen_update_outputs(codec);
4181 
4182 	alc_write_coef_idx(codec, 0x0c, 0x680);
4183 	alc_write_coef_idx(codec, 0x0c, 0x480);
4184 }
4185 
4186 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4187 				     const struct hda_fixup *fix, int action)
4188 {
4189 	struct alc_spec *spec = codec->spec;
4190 	if (action != HDA_FIXUP_ACT_PROBE)
4191 		return;
4192 	spec->gen.automute_hook = alc269_quanta_automute;
4193 }
4194 
4195 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4196 					 struct hda_jack_callback *jack)
4197 {
4198 	struct alc_spec *spec = codec->spec;
4199 	int vref;
4200 	msleep(200);
4201 	snd_hda_gen_hp_automute(codec, jack);
4202 
4203 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4204 	msleep(100);
4205 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4206 			    vref);
4207 	msleep(500);
4208 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4209 			    vref);
4210 }
4211 
4212 /*
4213  * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4214  */
4215 struct hda_alc298_mbxinit {
4216 	unsigned char value_0x23;
4217 	unsigned char value_0x25;
4218 };
4219 
4220 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4221 					 const struct hda_alc298_mbxinit *initval,
4222 					 bool first)
4223 {
4224 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4225 	alc_write_coef_idx(codec, 0x26, 0xb000);
4226 
4227 	if (first)
4228 		snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4229 
4230 	snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4231 	alc_write_coef_idx(codec, 0x26, 0xf000);
4232 	alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4233 
4234 	if (initval->value_0x23 != 0x1e)
4235 		alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4236 
4237 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4238 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4239 }
4240 
4241 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4242 					   const struct hda_fixup *fix,
4243 					   int action)
4244 {
4245 	/* Initialization magic */
4246 	static const struct hda_alc298_mbxinit dac_init[] = {
4247 		{0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4248 		{0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4249 		{0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4250 		{0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4251 		{0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4252 		{0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4253 		{0x2f, 0x00},
4254 		{0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4255 		{0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4256 		{0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4257 		{}
4258 	};
4259 	const struct hda_alc298_mbxinit *seq;
4260 
4261 	if (action != HDA_FIXUP_ACT_INIT)
4262 		return;
4263 
4264 	/* Start */
4265 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4266 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4267 	alc_write_coef_idx(codec, 0x26, 0xf000);
4268 	alc_write_coef_idx(codec, 0x22, 0x31);
4269 	alc_write_coef_idx(codec, 0x23, 0x0b);
4270 	alc_write_coef_idx(codec, 0x25, 0x00);
4271 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4272 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4273 
4274 	for (seq = dac_init; seq->value_0x23; seq++)
4275 		alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4276 }
4277 
4278 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4279 				     const struct hda_fixup *fix, int action)
4280 {
4281 	struct alc_spec *spec = codec->spec;
4282 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4283 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4284 		spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4285 	}
4286 }
4287 
4288 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4289 				bool polarity, bool on)
4290 {
4291 	unsigned int pinval;
4292 
4293 	if (!pin)
4294 		return;
4295 	if (polarity)
4296 		on = !on;
4297 	pinval = snd_hda_codec_get_pin_target(codec, pin);
4298 	pinval &= ~AC_PINCTL_VREFEN;
4299 	pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4300 	/* temporarily power up/down for setting VREF */
4301 	snd_hda_power_up_pm(codec);
4302 	snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4303 	snd_hda_power_down_pm(codec);
4304 }
4305 
4306 /* update mute-LED according to the speaker mute state via mic VREF pin */
4307 static int vref_mute_led_set(struct led_classdev *led_cdev,
4308 			     enum led_brightness brightness)
4309 {
4310 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4311 	struct alc_spec *spec = codec->spec;
4312 
4313 	alc_update_vref_led(codec, spec->mute_led_nid,
4314 			    spec->mute_led_polarity, brightness);
4315 	return 0;
4316 }
4317 
4318 /* Make sure the led works even in runtime suspend */
4319 static unsigned int led_power_filter(struct hda_codec *codec,
4320 						  hda_nid_t nid,
4321 						  unsigned int power_state)
4322 {
4323 	struct alc_spec *spec = codec->spec;
4324 
4325 	if (power_state != AC_PWRST_D3 || nid == 0 ||
4326 	    (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4327 		return power_state;
4328 
4329 	/* Set pin ctl again, it might have just been set to 0 */
4330 	snd_hda_set_pin_ctl(codec, nid,
4331 			    snd_hda_codec_get_pin_target(codec, nid));
4332 
4333 	return snd_hda_gen_path_power_filter(codec, nid, power_state);
4334 }
4335 
4336 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4337 				     const struct hda_fixup *fix, int action)
4338 {
4339 	struct alc_spec *spec = codec->spec;
4340 	const struct dmi_device *dev = NULL;
4341 
4342 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4343 		return;
4344 
4345 	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4346 		int pol, pin;
4347 		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4348 			continue;
4349 		if (pin < 0x0a || pin >= 0x10)
4350 			break;
4351 		spec->mute_led_polarity = pol;
4352 		spec->mute_led_nid = pin - 0x0a + 0x18;
4353 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4354 		codec->power_filter = led_power_filter;
4355 		codec_dbg(codec,
4356 			  "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4357 			   spec->mute_led_polarity);
4358 		break;
4359 	}
4360 }
4361 
4362 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4363 					  const struct hda_fixup *fix,
4364 					  int action, hda_nid_t pin)
4365 {
4366 	struct alc_spec *spec = codec->spec;
4367 
4368 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4369 		spec->mute_led_polarity = 0;
4370 		spec->mute_led_nid = pin;
4371 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4372 		codec->power_filter = led_power_filter;
4373 	}
4374 }
4375 
4376 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4377 				const struct hda_fixup *fix, int action)
4378 {
4379 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4380 }
4381 
4382 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4383 				const struct hda_fixup *fix, int action)
4384 {
4385 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4386 }
4387 
4388 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4389 				const struct hda_fixup *fix, int action)
4390 {
4391 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4392 }
4393 
4394 /* update LED status via GPIO */
4395 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4396 				int polarity, bool enabled)
4397 {
4398 	if (polarity)
4399 		enabled = !enabled;
4400 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4401 }
4402 
4403 /* turn on/off mute LED via GPIO per vmaster hook */
4404 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4405 			     enum led_brightness brightness)
4406 {
4407 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4408 	struct alc_spec *spec = codec->spec;
4409 
4410 	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4411 			    spec->mute_led_polarity, !brightness);
4412 	return 0;
4413 }
4414 
4415 /* turn on/off mic-mute LED via GPIO per capture hook */
4416 static int micmute_led_set(struct led_classdev *led_cdev,
4417 			   enum led_brightness brightness)
4418 {
4419 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4420 	struct alc_spec *spec = codec->spec;
4421 
4422 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4423 			    spec->micmute_led_polarity, !brightness);
4424 	return 0;
4425 }
4426 
4427 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
4428 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4429 				  int action,
4430 				  unsigned int mute_mask,
4431 				  unsigned int micmute_mask)
4432 {
4433 	struct alc_spec *spec = codec->spec;
4434 
4435 	alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4436 
4437 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4438 		return;
4439 	if (mute_mask) {
4440 		spec->gpio_mute_led_mask = mute_mask;
4441 		snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4442 	}
4443 	if (micmute_mask) {
4444 		spec->gpio_mic_led_mask = micmute_mask;
4445 		snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4446 	}
4447 }
4448 
4449 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4450 				const struct hda_fixup *fix, int action)
4451 {
4452 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4453 }
4454 
4455 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4456 				const struct hda_fixup *fix, int action)
4457 {
4458 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4459 }
4460 
4461 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4462 				const struct hda_fixup *fix, int action)
4463 {
4464 	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4465 }
4466 
4467 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4468 				const struct hda_fixup *fix, int action)
4469 {
4470 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4471 }
4472 
4473 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4474 				const struct hda_fixup *fix, int action)
4475 {
4476 	alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4477 }
4478 
4479 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4480 				const struct hda_fixup *fix, int action)
4481 {
4482 	struct alc_spec *spec = codec->spec;
4483 
4484 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4485 		spec->micmute_led_polarity = 1;
4486 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4487 }
4488 
4489 /* turn on/off mic-mute LED per capture hook via VREF change */
4490 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4491 				enum led_brightness brightness)
4492 {
4493 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4494 	struct alc_spec *spec = codec->spec;
4495 
4496 	alc_update_vref_led(codec, spec->cap_mute_led_nid,
4497 			    spec->micmute_led_polarity, brightness);
4498 	return 0;
4499 }
4500 
4501 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4502 				const struct hda_fixup *fix, int action)
4503 {
4504 	struct alc_spec *spec = codec->spec;
4505 
4506 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4507 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4508 		/* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4509 		 * enable headphone amp
4510 		 */
4511 		spec->gpio_mask |= 0x10;
4512 		spec->gpio_dir |= 0x10;
4513 		spec->cap_mute_led_nid = 0x18;
4514 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4515 		codec->power_filter = led_power_filter;
4516 	}
4517 }
4518 
4519 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4520 				   const struct hda_fixup *fix, int action)
4521 {
4522 	struct alc_spec *spec = codec->spec;
4523 
4524 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4525 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4526 		spec->cap_mute_led_nid = 0x18;
4527 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4528 		codec->power_filter = led_power_filter;
4529 	}
4530 }
4531 
4532 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4533  * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4534  */
4535 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4536 				     const struct hda_fixup *fix, int action)
4537 {
4538 	struct alc_spec *spec = codec->spec;
4539 
4540 	switch (action) {
4541 	case HDA_FIXUP_ACT_PRE_PROBE:
4542 		spec->gpio_mask |= 0x01;
4543 		spec->gpio_dir |= 0x01;
4544 		break;
4545 	case HDA_FIXUP_ACT_INIT:
4546 		/* need to toggle GPIO to enable the amp */
4547 		alc_update_gpio_data(codec, 0x01, true);
4548 		msleep(100);
4549 		alc_update_gpio_data(codec, 0x01, false);
4550 		break;
4551 	}
4552 }
4553 
4554 /* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4555 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4556 				    struct hda_codec *codec,
4557 				    struct snd_pcm_substream *substream,
4558 				    int action)
4559 {
4560 	switch (action) {
4561 	case HDA_GEN_PCM_ACT_PREPARE:
4562 		alc_update_gpio_data(codec, 0x04, true);
4563 		break;
4564 	case HDA_GEN_PCM_ACT_CLEANUP:
4565 		alc_update_gpio_data(codec, 0x04, false);
4566 		break;
4567 	}
4568 }
4569 
4570 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4571 				      const struct hda_fixup *fix,
4572 				      int action)
4573 {
4574 	struct alc_spec *spec = codec->spec;
4575 
4576 	if (action == HDA_FIXUP_ACT_PROBE) {
4577 		spec->gpio_mask |= 0x04;
4578 		spec->gpio_dir |= 0x04;
4579 		spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4580 	}
4581 }
4582 
4583 static void alc_update_coef_led(struct hda_codec *codec,
4584 				struct alc_coef_led *led,
4585 				bool polarity, bool on)
4586 {
4587 	if (polarity)
4588 		on = !on;
4589 	/* temporarily power up/down for setting COEF bit */
4590 	alc_update_coef_idx(codec, led->idx, led->mask,
4591 			    on ? led->on : led->off);
4592 }
4593 
4594 /* update mute-LED according to the speaker mute state via COEF bit */
4595 static int coef_mute_led_set(struct led_classdev *led_cdev,
4596 			     enum led_brightness brightness)
4597 {
4598 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4599 	struct alc_spec *spec = codec->spec;
4600 
4601 	alc_update_coef_led(codec, &spec->mute_led_coef,
4602 			    spec->mute_led_polarity, brightness);
4603 	return 0;
4604 }
4605 
4606 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4607 					  const struct hda_fixup *fix,
4608 					  int action)
4609 {
4610 	struct alc_spec *spec = codec->spec;
4611 
4612 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4613 		spec->mute_led_polarity = 0;
4614 		spec->mute_led_coef.idx = 0x0b;
4615 		spec->mute_led_coef.mask = 1 << 3;
4616 		spec->mute_led_coef.on = 1 << 3;
4617 		spec->mute_led_coef.off = 0;
4618 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4619 	}
4620 }
4621 
4622 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4623 					  const struct hda_fixup *fix,
4624 					  int action)
4625 {
4626 	struct alc_spec *spec = codec->spec;
4627 
4628 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4629 		spec->mute_led_polarity = 0;
4630 		spec->mute_led_coef.idx = 0x34;
4631 		spec->mute_led_coef.mask = 1 << 5;
4632 		spec->mute_led_coef.on = 0;
4633 		spec->mute_led_coef.off = 1 << 5;
4634 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4635 	}
4636 }
4637 
4638 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4639 					  const struct hda_fixup *fix, int action)
4640 {
4641 	struct alc_spec *spec = codec->spec;
4642 
4643 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4644 		spec->mute_led_polarity = 0;
4645 		spec->mute_led_coef.idx = 0x07;
4646 		spec->mute_led_coef.mask = 1;
4647 		spec->mute_led_coef.on = 1;
4648 		spec->mute_led_coef.off = 0;
4649 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4650 	}
4651 }
4652 
4653 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4654 					  const struct hda_fixup *fix,
4655 					  int action)
4656 {
4657 	struct alc_spec *spec = codec->spec;
4658 
4659 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4660 		spec->mute_led_polarity = 0;
4661 		spec->mute_led_coef.idx = 0x0b;
4662 		spec->mute_led_coef.mask = 3 << 2;
4663 		spec->mute_led_coef.on = 2 << 2;
4664 		spec->mute_led_coef.off = 1 << 2;
4665 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4666 	}
4667 }
4668 
4669 /* turn on/off mic-mute LED per capture hook by coef bit */
4670 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4671 				enum led_brightness brightness)
4672 {
4673 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4674 	struct alc_spec *spec = codec->spec;
4675 
4676 	alc_update_coef_led(codec, &spec->mic_led_coef,
4677 			    spec->micmute_led_polarity, brightness);
4678 	return 0;
4679 }
4680 
4681 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4682 				const struct hda_fixup *fix, int action)
4683 {
4684 	struct alc_spec *spec = codec->spec;
4685 
4686 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4687 		spec->mic_led_coef.idx = 0x19;
4688 		spec->mic_led_coef.mask = 1 << 13;
4689 		spec->mic_led_coef.on = 1 << 13;
4690 		spec->mic_led_coef.off = 0;
4691 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4692 	}
4693 }
4694 
4695 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4696 				const struct hda_fixup *fix, int action)
4697 {
4698 	struct alc_spec *spec = codec->spec;
4699 
4700 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4701 		spec->micmute_led_polarity = 1;
4702 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4703 }
4704 
4705 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4706 				const struct hda_fixup *fix, int action)
4707 {
4708 	struct alc_spec *spec = codec->spec;
4709 
4710 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4711 		spec->mic_led_coef.idx = 0x35;
4712 		spec->mic_led_coef.mask = 3 << 2;
4713 		spec->mic_led_coef.on = 2 << 2;
4714 		spec->mic_led_coef.off = 1 << 2;
4715 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4716 	}
4717 }
4718 
4719 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4720 				const struct hda_fixup *fix, int action)
4721 {
4722 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4723 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4724 }
4725 
4726 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4727 				const struct hda_fixup *fix, int action)
4728 {
4729 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4730 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4731 }
4732 
4733 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4734 				const struct hda_fixup *fix, int action)
4735 {
4736 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4737 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4738 }
4739 
4740 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4741 				const struct hda_fixup *fix, int action)
4742 {
4743 	struct alc_spec *spec = codec->spec;
4744 
4745 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4746 		spec->cap_mute_led_nid = 0x1a;
4747 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4748 		codec->power_filter = led_power_filter;
4749 	}
4750 }
4751 
4752 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4753 				const struct hda_fixup *fix, int action)
4754 {
4755 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4756 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4757 }
4758 
4759 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4760 						  const unsigned short coefs[2])
4761 {
4762 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4763 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4764 	alc_write_coef_idx(codec, 0x26, 0xb011);
4765 }
4766 
4767 struct alc298_samsung_amp_desc {
4768 	unsigned char nid;
4769 	unsigned short init_seq[2][2];
4770 };
4771 
4772 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4773 				     const struct hda_fixup *fix, int action)
4774 {
4775 	int i, j;
4776 	static const unsigned short init_seq[][2] = {
4777 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4778 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4779 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4780 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4781 	};
4782 	static const struct alc298_samsung_amp_desc amps[] = {
4783 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4784 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4785 	};
4786 
4787 	if (action != HDA_FIXUP_ACT_INIT)
4788 		return;
4789 
4790 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4791 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4792 
4793 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4794 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4795 
4796 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4797 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4798 	}
4799 }
4800 
4801 #if IS_REACHABLE(CONFIG_INPUT)
4802 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4803 				   struct hda_jack_callback *event)
4804 {
4805 	struct alc_spec *spec = codec->spec;
4806 
4807 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4808 	   send both key on and key off event for every interrupt. */
4809 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4810 	input_sync(spec->kb_dev);
4811 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4812 	input_sync(spec->kb_dev);
4813 }
4814 
4815 static int alc_register_micmute_input_device(struct hda_codec *codec)
4816 {
4817 	struct alc_spec *spec = codec->spec;
4818 	int i;
4819 
4820 	spec->kb_dev = input_allocate_device();
4821 	if (!spec->kb_dev) {
4822 		codec_err(codec, "Out of memory (input_allocate_device)\n");
4823 		return -ENOMEM;
4824 	}
4825 
4826 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4827 
4828 	spec->kb_dev->name = "Microphone Mute Button";
4829 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4830 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4831 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4832 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4833 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4834 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4835 
4836 	if (input_register_device(spec->kb_dev)) {
4837 		codec_err(codec, "input_register_device failed\n");
4838 		input_free_device(spec->kb_dev);
4839 		spec->kb_dev = NULL;
4840 		return -ENOMEM;
4841 	}
4842 
4843 	return 0;
4844 }
4845 
4846 /* GPIO1 = set according to SKU external amp
4847  * GPIO2 = mic mute hotkey
4848  * GPIO3 = mute LED
4849  * GPIO4 = mic mute LED
4850  */
4851 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4852 					     const struct hda_fixup *fix, int action)
4853 {
4854 	struct alc_spec *spec = codec->spec;
4855 
4856 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4857 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4858 		spec->init_amp = ALC_INIT_DEFAULT;
4859 		if (alc_register_micmute_input_device(codec) != 0)
4860 			return;
4861 
4862 		spec->gpio_mask |= 0x06;
4863 		spec->gpio_dir |= 0x02;
4864 		spec->gpio_data |= 0x02;
4865 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4866 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4867 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4868 						    gpio2_mic_hotkey_event);
4869 		return;
4870 	}
4871 
4872 	if (!spec->kb_dev)
4873 		return;
4874 
4875 	switch (action) {
4876 	case HDA_FIXUP_ACT_FREE:
4877 		input_unregister_device(spec->kb_dev);
4878 		spec->kb_dev = NULL;
4879 	}
4880 }
4881 
4882 /* Line2 = mic mute hotkey
4883  * GPIO2 = mic mute LED
4884  */
4885 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4886 					     const struct hda_fixup *fix, int action)
4887 {
4888 	struct alc_spec *spec = codec->spec;
4889 
4890 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4891 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4892 		spec->init_amp = ALC_INIT_DEFAULT;
4893 		if (alc_register_micmute_input_device(codec) != 0)
4894 			return;
4895 
4896 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
4897 						    gpio2_mic_hotkey_event);
4898 		return;
4899 	}
4900 
4901 	if (!spec->kb_dev)
4902 		return;
4903 
4904 	switch (action) {
4905 	case HDA_FIXUP_ACT_FREE:
4906 		input_unregister_device(spec->kb_dev);
4907 		spec->kb_dev = NULL;
4908 	}
4909 }
4910 #else /* INPUT */
4911 #define alc280_fixup_hp_gpio2_mic_hotkey	NULL
4912 #define alc233_fixup_lenovo_line2_mic_hotkey	NULL
4913 #endif /* INPUT */
4914 
4915 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4916 				const struct hda_fixup *fix, int action)
4917 {
4918 	struct alc_spec *spec = codec->spec;
4919 
4920 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4921 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4922 		spec->cap_mute_led_nid = 0x18;
4923 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4924 	}
4925 }
4926 
4927 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
4928 {
4929 	if (delay <= 0)
4930 		delay = 75;
4931 	snd_hda_codec_write(codec, 0x21, 0,
4932 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4933 	msleep(delay);
4934 	snd_hda_codec_write(codec, 0x21, 0,
4935 		    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4936 	msleep(delay);
4937 }
4938 
4939 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
4940 {
4941 	if (delay <= 0)
4942 		delay = 75;
4943 	snd_hda_codec_write(codec, 0x21, 0,
4944 		    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4945 	msleep(delay);
4946 	snd_hda_codec_write(codec, 0x21, 0,
4947 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4948 	msleep(delay);
4949 }
4950 
4951 static const struct coef_fw alc225_pre_hsmode[] = {
4952 	UPDATE_COEF(0x4a, 1<<8, 0),
4953 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4954 	UPDATE_COEF(0x63, 3<<14, 3<<14),
4955 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
4956 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
4957 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4958 	UPDATE_COEF(0x4a, 3<<10, 0),
4959 	{}
4960 };
4961 
4962 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4963 {
4964 	struct alc_spec *spec = codec->spec;
4965 	static const struct coef_fw coef0255[] = {
4966 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4967 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4968 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4969 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4970 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4971 		{}
4972 	};
4973 	static const struct coef_fw coef0256[] = {
4974 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4975 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4976 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4977 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4978 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4979 		{}
4980 	};
4981 	static const struct coef_fw coef0233[] = {
4982 		WRITE_COEF(0x1b, 0x0c0b),
4983 		WRITE_COEF(0x45, 0xc429),
4984 		UPDATE_COEF(0x35, 0x4000, 0),
4985 		WRITE_COEF(0x06, 0x2104),
4986 		WRITE_COEF(0x1a, 0x0001),
4987 		WRITE_COEF(0x26, 0x0004),
4988 		WRITE_COEF(0x32, 0x42a3),
4989 		{}
4990 	};
4991 	static const struct coef_fw coef0288[] = {
4992 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4993 		UPDATE_COEF(0x50, 0x2000, 0x2000),
4994 		UPDATE_COEF(0x56, 0x0006, 0x0006),
4995 		UPDATE_COEF(0x66, 0x0008, 0),
4996 		UPDATE_COEF(0x67, 0x2000, 0),
4997 		{}
4998 	};
4999 	static const struct coef_fw coef0298[] = {
5000 		UPDATE_COEF(0x19, 0x1300, 0x0300),
5001 		{}
5002 	};
5003 	static const struct coef_fw coef0292[] = {
5004 		WRITE_COEF(0x76, 0x000e),
5005 		WRITE_COEF(0x6c, 0x2400),
5006 		WRITE_COEF(0x18, 0x7308),
5007 		WRITE_COEF(0x6b, 0xc429),
5008 		{}
5009 	};
5010 	static const struct coef_fw coef0293[] = {
5011 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5012 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5013 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5014 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5015 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5016 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5017 		{}
5018 	};
5019 	static const struct coef_fw coef0668[] = {
5020 		WRITE_COEF(0x15, 0x0d40),
5021 		WRITE_COEF(0xb7, 0x802b),
5022 		{}
5023 	};
5024 	static const struct coef_fw coef0225[] = {
5025 		UPDATE_COEF(0x63, 3<<14, 0),
5026 		{}
5027 	};
5028 	static const struct coef_fw coef0274[] = {
5029 		UPDATE_COEF(0x4a, 0x0100, 0),
5030 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5031 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
5032 		UPDATE_COEF(0x4a, 0x0010, 0),
5033 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5034 		WRITE_COEF(0x45, 0x5289),
5035 		UPDATE_COEF(0x4a, 0x0c00, 0),
5036 		{}
5037 	};
5038 
5039 	if (spec->no_internal_mic_pin) {
5040 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5041 		return;
5042 	}
5043 
5044 	switch (codec->core.vendor_id) {
5045 	case 0x10ec0255:
5046 		alc_process_coef_fw(codec, coef0255);
5047 		break;
5048 	case 0x10ec0230:
5049 	case 0x10ec0236:
5050 	case 0x10ec0256:
5051 	case 0x19e58326:
5052 		alc_hp_mute_disable(codec, 75);
5053 		alc_process_coef_fw(codec, coef0256);
5054 		break;
5055 	case 0x10ec0234:
5056 	case 0x10ec0274:
5057 	case 0x10ec0294:
5058 		alc_process_coef_fw(codec, coef0274);
5059 		break;
5060 	case 0x10ec0233:
5061 	case 0x10ec0283:
5062 		alc_process_coef_fw(codec, coef0233);
5063 		break;
5064 	case 0x10ec0286:
5065 	case 0x10ec0288:
5066 		alc_process_coef_fw(codec, coef0288);
5067 		break;
5068 	case 0x10ec0298:
5069 		alc_process_coef_fw(codec, coef0298);
5070 		alc_process_coef_fw(codec, coef0288);
5071 		break;
5072 	case 0x10ec0292:
5073 		alc_process_coef_fw(codec, coef0292);
5074 		break;
5075 	case 0x10ec0293:
5076 		alc_process_coef_fw(codec, coef0293);
5077 		break;
5078 	case 0x10ec0668:
5079 		alc_process_coef_fw(codec, coef0668);
5080 		break;
5081 	case 0x10ec0215:
5082 	case 0x10ec0225:
5083 	case 0x10ec0285:
5084 	case 0x10ec0295:
5085 	case 0x10ec0289:
5086 	case 0x10ec0299:
5087 		alc_hp_mute_disable(codec, 75);
5088 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5089 		alc_process_coef_fw(codec, coef0225);
5090 		break;
5091 	case 0x10ec0867:
5092 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5093 		break;
5094 	}
5095 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5096 }
5097 
5098 
5099 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5100 				    hda_nid_t mic_pin)
5101 {
5102 	static const struct coef_fw coef0255[] = {
5103 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5104 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5105 		{}
5106 	};
5107 	static const struct coef_fw coef0256[] = {
5108 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5109 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5110 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5111 		{}
5112 	};
5113 	static const struct coef_fw coef0233[] = {
5114 		UPDATE_COEF(0x35, 0, 1<<14),
5115 		WRITE_COEF(0x06, 0x2100),
5116 		WRITE_COEF(0x1a, 0x0021),
5117 		WRITE_COEF(0x26, 0x008c),
5118 		{}
5119 	};
5120 	static const struct coef_fw coef0288[] = {
5121 		UPDATE_COEF(0x4f, 0x00c0, 0),
5122 		UPDATE_COEF(0x50, 0x2000, 0),
5123 		UPDATE_COEF(0x56, 0x0006, 0),
5124 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5125 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5126 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5127 		{}
5128 	};
5129 	static const struct coef_fw coef0292[] = {
5130 		WRITE_COEF(0x19, 0xa208),
5131 		WRITE_COEF(0x2e, 0xacf0),
5132 		{}
5133 	};
5134 	static const struct coef_fw coef0293[] = {
5135 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5136 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5137 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5138 		{}
5139 	};
5140 	static const struct coef_fw coef0688[] = {
5141 		WRITE_COEF(0xb7, 0x802b),
5142 		WRITE_COEF(0xb5, 0x1040),
5143 		UPDATE_COEF(0xc3, 0, 1<<12),
5144 		{}
5145 	};
5146 	static const struct coef_fw coef0225[] = {
5147 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5148 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5149 		UPDATE_COEF(0x63, 3<<14, 0),
5150 		{}
5151 	};
5152 	static const struct coef_fw coef0274[] = {
5153 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5154 		UPDATE_COEF(0x4a, 0x0010, 0),
5155 		UPDATE_COEF(0x6b, 0xf000, 0),
5156 		{}
5157 	};
5158 
5159 	switch (codec->core.vendor_id) {
5160 	case 0x10ec0255:
5161 		alc_write_coef_idx(codec, 0x45, 0xc489);
5162 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5163 		alc_process_coef_fw(codec, coef0255);
5164 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5165 		break;
5166 	case 0x10ec0230:
5167 	case 0x10ec0236:
5168 	case 0x10ec0256:
5169 	case 0x19e58326:
5170 		alc_write_coef_idx(codec, 0x45, 0xc489);
5171 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5172 		alc_process_coef_fw(codec, coef0256);
5173 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5174 		break;
5175 	case 0x10ec0234:
5176 	case 0x10ec0274:
5177 	case 0x10ec0294:
5178 		alc_write_coef_idx(codec, 0x45, 0x4689);
5179 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5180 		alc_process_coef_fw(codec, coef0274);
5181 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5182 		break;
5183 	case 0x10ec0233:
5184 	case 0x10ec0283:
5185 		alc_write_coef_idx(codec, 0x45, 0xc429);
5186 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5187 		alc_process_coef_fw(codec, coef0233);
5188 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5189 		break;
5190 	case 0x10ec0286:
5191 	case 0x10ec0288:
5192 	case 0x10ec0298:
5193 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5194 		alc_process_coef_fw(codec, coef0288);
5195 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5196 		break;
5197 	case 0x10ec0292:
5198 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5199 		alc_process_coef_fw(codec, coef0292);
5200 		break;
5201 	case 0x10ec0293:
5202 		/* Set to TRS mode */
5203 		alc_write_coef_idx(codec, 0x45, 0xc429);
5204 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5205 		alc_process_coef_fw(codec, coef0293);
5206 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5207 		break;
5208 	case 0x10ec0867:
5209 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5210 		fallthrough;
5211 	case 0x10ec0221:
5212 	case 0x10ec0662:
5213 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5214 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5215 		break;
5216 	case 0x10ec0668:
5217 		alc_write_coef_idx(codec, 0x11, 0x0001);
5218 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5219 		alc_process_coef_fw(codec, coef0688);
5220 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5221 		break;
5222 	case 0x10ec0215:
5223 	case 0x10ec0225:
5224 	case 0x10ec0285:
5225 	case 0x10ec0295:
5226 	case 0x10ec0289:
5227 	case 0x10ec0299:
5228 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5229 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5230 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5231 		alc_process_coef_fw(codec, coef0225);
5232 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5233 		break;
5234 	}
5235 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5236 }
5237 
5238 static void alc_headset_mode_default(struct hda_codec *codec)
5239 {
5240 	static const struct coef_fw coef0225[] = {
5241 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5242 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5243 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5244 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5245 		UPDATE_COEF(0x63, 3<<14, 0),
5246 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5247 		{}
5248 	};
5249 	static const struct coef_fw coef0255[] = {
5250 		WRITE_COEF(0x45, 0xc089),
5251 		WRITE_COEF(0x45, 0xc489),
5252 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5253 		WRITE_COEF(0x49, 0x0049),
5254 		{}
5255 	};
5256 	static const struct coef_fw coef0256[] = {
5257 		WRITE_COEF(0x45, 0xc489),
5258 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5259 		WRITE_COEF(0x49, 0x0049),
5260 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5261 		WRITE_COEF(0x06, 0x6100),
5262 		{}
5263 	};
5264 	static const struct coef_fw coef0233[] = {
5265 		WRITE_COEF(0x06, 0x2100),
5266 		WRITE_COEF(0x32, 0x4ea3),
5267 		{}
5268 	};
5269 	static const struct coef_fw coef0288[] = {
5270 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5271 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5272 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5273 		UPDATE_COEF(0x66, 0x0008, 0),
5274 		UPDATE_COEF(0x67, 0x2000, 0),
5275 		{}
5276 	};
5277 	static const struct coef_fw coef0292[] = {
5278 		WRITE_COEF(0x76, 0x000e),
5279 		WRITE_COEF(0x6c, 0x2400),
5280 		WRITE_COEF(0x6b, 0xc429),
5281 		WRITE_COEF(0x18, 0x7308),
5282 		{}
5283 	};
5284 	static const struct coef_fw coef0293[] = {
5285 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5286 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5287 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5288 		{}
5289 	};
5290 	static const struct coef_fw coef0688[] = {
5291 		WRITE_COEF(0x11, 0x0041),
5292 		WRITE_COEF(0x15, 0x0d40),
5293 		WRITE_COEF(0xb7, 0x802b),
5294 		{}
5295 	};
5296 	static const struct coef_fw coef0274[] = {
5297 		WRITE_COEF(0x45, 0x4289),
5298 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5299 		UPDATE_COEF(0x6b, 0x0f00, 0),
5300 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5301 		{}
5302 	};
5303 
5304 	switch (codec->core.vendor_id) {
5305 	case 0x10ec0215:
5306 	case 0x10ec0225:
5307 	case 0x10ec0285:
5308 	case 0x10ec0295:
5309 	case 0x10ec0289:
5310 	case 0x10ec0299:
5311 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5312 		alc_process_coef_fw(codec, coef0225);
5313 		alc_hp_enable_unmute(codec, 75);
5314 		break;
5315 	case 0x10ec0255:
5316 		alc_process_coef_fw(codec, coef0255);
5317 		break;
5318 	case 0x10ec0230:
5319 	case 0x10ec0236:
5320 	case 0x10ec0256:
5321 	case 0x19e58326:
5322 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5323 		alc_write_coef_idx(codec, 0x45, 0xc089);
5324 		msleep(50);
5325 		alc_process_coef_fw(codec, coef0256);
5326 		alc_hp_enable_unmute(codec, 75);
5327 		break;
5328 	case 0x10ec0234:
5329 	case 0x10ec0274:
5330 	case 0x10ec0294:
5331 		alc_process_coef_fw(codec, coef0274);
5332 		break;
5333 	case 0x10ec0233:
5334 	case 0x10ec0283:
5335 		alc_process_coef_fw(codec, coef0233);
5336 		break;
5337 	case 0x10ec0286:
5338 	case 0x10ec0288:
5339 	case 0x10ec0298:
5340 		alc_process_coef_fw(codec, coef0288);
5341 		break;
5342 	case 0x10ec0292:
5343 		alc_process_coef_fw(codec, coef0292);
5344 		break;
5345 	case 0x10ec0293:
5346 		alc_process_coef_fw(codec, coef0293);
5347 		break;
5348 	case 0x10ec0668:
5349 		alc_process_coef_fw(codec, coef0688);
5350 		break;
5351 	case 0x10ec0867:
5352 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5353 		break;
5354 	}
5355 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5356 }
5357 
5358 /* Iphone type */
5359 static void alc_headset_mode_ctia(struct hda_codec *codec)
5360 {
5361 	int val;
5362 
5363 	static const struct coef_fw coef0255[] = {
5364 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5365 		WRITE_COEF(0x1b, 0x0c2b),
5366 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5367 		{}
5368 	};
5369 	static const struct coef_fw coef0256[] = {
5370 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5371 		WRITE_COEF(0x1b, 0x0e6b),
5372 		{}
5373 	};
5374 	static const struct coef_fw coef0233[] = {
5375 		WRITE_COEF(0x45, 0xd429),
5376 		WRITE_COEF(0x1b, 0x0c2b),
5377 		WRITE_COEF(0x32, 0x4ea3),
5378 		{}
5379 	};
5380 	static const struct coef_fw coef0288[] = {
5381 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5382 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5383 		UPDATE_COEF(0x66, 0x0008, 0),
5384 		UPDATE_COEF(0x67, 0x2000, 0),
5385 		{}
5386 	};
5387 	static const struct coef_fw coef0292[] = {
5388 		WRITE_COEF(0x6b, 0xd429),
5389 		WRITE_COEF(0x76, 0x0008),
5390 		WRITE_COEF(0x18, 0x7388),
5391 		{}
5392 	};
5393 	static const struct coef_fw coef0293[] = {
5394 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5395 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5396 		{}
5397 	};
5398 	static const struct coef_fw coef0688[] = {
5399 		WRITE_COEF(0x11, 0x0001),
5400 		WRITE_COEF(0x15, 0x0d60),
5401 		WRITE_COEF(0xc3, 0x0000),
5402 		{}
5403 	};
5404 	static const struct coef_fw coef0225_1[] = {
5405 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5406 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5407 		{}
5408 	};
5409 	static const struct coef_fw coef0225_2[] = {
5410 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5411 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5412 		{}
5413 	};
5414 
5415 	switch (codec->core.vendor_id) {
5416 	case 0x10ec0255:
5417 		alc_process_coef_fw(codec, coef0255);
5418 		break;
5419 	case 0x10ec0230:
5420 	case 0x10ec0236:
5421 	case 0x10ec0256:
5422 	case 0x19e58326:
5423 		alc_process_coef_fw(codec, coef0256);
5424 		alc_hp_enable_unmute(codec, 75);
5425 		break;
5426 	case 0x10ec0234:
5427 	case 0x10ec0274:
5428 	case 0x10ec0294:
5429 		alc_write_coef_idx(codec, 0x45, 0xd689);
5430 		break;
5431 	case 0x10ec0233:
5432 	case 0x10ec0283:
5433 		alc_process_coef_fw(codec, coef0233);
5434 		break;
5435 	case 0x10ec0298:
5436 		val = alc_read_coef_idx(codec, 0x50);
5437 		if (val & (1 << 12)) {
5438 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5439 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5440 			msleep(300);
5441 		} else {
5442 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5443 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5444 			msleep(300);
5445 		}
5446 		break;
5447 	case 0x10ec0286:
5448 	case 0x10ec0288:
5449 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5450 		msleep(300);
5451 		alc_process_coef_fw(codec, coef0288);
5452 		break;
5453 	case 0x10ec0292:
5454 		alc_process_coef_fw(codec, coef0292);
5455 		break;
5456 	case 0x10ec0293:
5457 		alc_process_coef_fw(codec, coef0293);
5458 		break;
5459 	case 0x10ec0668:
5460 		alc_process_coef_fw(codec, coef0688);
5461 		break;
5462 	case 0x10ec0215:
5463 	case 0x10ec0225:
5464 	case 0x10ec0285:
5465 	case 0x10ec0295:
5466 	case 0x10ec0289:
5467 	case 0x10ec0299:
5468 		val = alc_read_coef_idx(codec, 0x45);
5469 		if (val & (1 << 9))
5470 			alc_process_coef_fw(codec, coef0225_2);
5471 		else
5472 			alc_process_coef_fw(codec, coef0225_1);
5473 		alc_hp_enable_unmute(codec, 75);
5474 		break;
5475 	case 0x10ec0867:
5476 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5477 		break;
5478 	}
5479 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5480 }
5481 
5482 /* Nokia type */
5483 static void alc_headset_mode_omtp(struct hda_codec *codec)
5484 {
5485 	static const struct coef_fw coef0255[] = {
5486 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5487 		WRITE_COEF(0x1b, 0x0c2b),
5488 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5489 		{}
5490 	};
5491 	static const struct coef_fw coef0256[] = {
5492 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5493 		WRITE_COEF(0x1b, 0x0e6b),
5494 		{}
5495 	};
5496 	static const struct coef_fw coef0233[] = {
5497 		WRITE_COEF(0x45, 0xe429),
5498 		WRITE_COEF(0x1b, 0x0c2b),
5499 		WRITE_COEF(0x32, 0x4ea3),
5500 		{}
5501 	};
5502 	static const struct coef_fw coef0288[] = {
5503 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5504 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5505 		UPDATE_COEF(0x66, 0x0008, 0),
5506 		UPDATE_COEF(0x67, 0x2000, 0),
5507 		{}
5508 	};
5509 	static const struct coef_fw coef0292[] = {
5510 		WRITE_COEF(0x6b, 0xe429),
5511 		WRITE_COEF(0x76, 0x0008),
5512 		WRITE_COEF(0x18, 0x7388),
5513 		{}
5514 	};
5515 	static const struct coef_fw coef0293[] = {
5516 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5517 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5518 		{}
5519 	};
5520 	static const struct coef_fw coef0688[] = {
5521 		WRITE_COEF(0x11, 0x0001),
5522 		WRITE_COEF(0x15, 0x0d50),
5523 		WRITE_COEF(0xc3, 0x0000),
5524 		{}
5525 	};
5526 	static const struct coef_fw coef0225[] = {
5527 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5528 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5529 		{}
5530 	};
5531 
5532 	switch (codec->core.vendor_id) {
5533 	case 0x10ec0255:
5534 		alc_process_coef_fw(codec, coef0255);
5535 		break;
5536 	case 0x10ec0230:
5537 	case 0x10ec0236:
5538 	case 0x10ec0256:
5539 	case 0x19e58326:
5540 		alc_process_coef_fw(codec, coef0256);
5541 		alc_hp_enable_unmute(codec, 75);
5542 		break;
5543 	case 0x10ec0234:
5544 	case 0x10ec0274:
5545 	case 0x10ec0294:
5546 		alc_write_coef_idx(codec, 0x45, 0xe689);
5547 		break;
5548 	case 0x10ec0233:
5549 	case 0x10ec0283:
5550 		alc_process_coef_fw(codec, coef0233);
5551 		break;
5552 	case 0x10ec0298:
5553 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5554 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5555 		msleep(300);
5556 		break;
5557 	case 0x10ec0286:
5558 	case 0x10ec0288:
5559 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5560 		msleep(300);
5561 		alc_process_coef_fw(codec, coef0288);
5562 		break;
5563 	case 0x10ec0292:
5564 		alc_process_coef_fw(codec, coef0292);
5565 		break;
5566 	case 0x10ec0293:
5567 		alc_process_coef_fw(codec, coef0293);
5568 		break;
5569 	case 0x10ec0668:
5570 		alc_process_coef_fw(codec, coef0688);
5571 		break;
5572 	case 0x10ec0215:
5573 	case 0x10ec0225:
5574 	case 0x10ec0285:
5575 	case 0x10ec0295:
5576 	case 0x10ec0289:
5577 	case 0x10ec0299:
5578 		alc_process_coef_fw(codec, coef0225);
5579 		alc_hp_enable_unmute(codec, 75);
5580 		break;
5581 	}
5582 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5583 }
5584 
5585 static void alc_determine_headset_type(struct hda_codec *codec)
5586 {
5587 	int val;
5588 	bool is_ctia = false;
5589 	struct alc_spec *spec = codec->spec;
5590 	static const struct coef_fw coef0255[] = {
5591 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5592 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5593  conteol) */
5594 		{}
5595 	};
5596 	static const struct coef_fw coef0288[] = {
5597 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5598 		{}
5599 	};
5600 	static const struct coef_fw coef0298[] = {
5601 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5602 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5603 		UPDATE_COEF(0x66, 0x0008, 0),
5604 		UPDATE_COEF(0x67, 0x2000, 0),
5605 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5606 		{}
5607 	};
5608 	static const struct coef_fw coef0293[] = {
5609 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5610 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5611 		{}
5612 	};
5613 	static const struct coef_fw coef0688[] = {
5614 		WRITE_COEF(0x11, 0x0001),
5615 		WRITE_COEF(0xb7, 0x802b),
5616 		WRITE_COEF(0x15, 0x0d60),
5617 		WRITE_COEF(0xc3, 0x0c00),
5618 		{}
5619 	};
5620 	static const struct coef_fw coef0274[] = {
5621 		UPDATE_COEF(0x4a, 0x0010, 0),
5622 		UPDATE_COEF(0x4a, 0x8000, 0),
5623 		WRITE_COEF(0x45, 0xd289),
5624 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5625 		{}
5626 	};
5627 
5628 	if (spec->no_internal_mic_pin) {
5629 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5630 		return;
5631 	}
5632 
5633 	switch (codec->core.vendor_id) {
5634 	case 0x10ec0255:
5635 		alc_process_coef_fw(codec, coef0255);
5636 		msleep(300);
5637 		val = alc_read_coef_idx(codec, 0x46);
5638 		is_ctia = (val & 0x0070) == 0x0070;
5639 		break;
5640 	case 0x10ec0230:
5641 	case 0x10ec0236:
5642 	case 0x10ec0256:
5643 	case 0x19e58326:
5644 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5645 		alc_write_coef_idx(codec, 0x06, 0x6104);
5646 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5647 
5648 		alc_process_coef_fw(codec, coef0255);
5649 		msleep(300);
5650 		val = alc_read_coef_idx(codec, 0x46);
5651 		is_ctia = (val & 0x0070) == 0x0070;
5652 		if (!is_ctia) {
5653 			alc_write_coef_idx(codec, 0x45, 0xe089);
5654 			msleep(100);
5655 			val = alc_read_coef_idx(codec, 0x46);
5656 			if ((val & 0x0070) == 0x0070)
5657 				is_ctia = false;
5658 			else
5659 				is_ctia = true;
5660 		}
5661 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5662 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5663 		break;
5664 	case 0x10ec0234:
5665 	case 0x10ec0274:
5666 	case 0x10ec0294:
5667 		alc_process_coef_fw(codec, coef0274);
5668 		msleep(850);
5669 		val = alc_read_coef_idx(codec, 0x46);
5670 		is_ctia = (val & 0x00f0) == 0x00f0;
5671 		break;
5672 	case 0x10ec0233:
5673 	case 0x10ec0283:
5674 		alc_write_coef_idx(codec, 0x45, 0xd029);
5675 		msleep(300);
5676 		val = alc_read_coef_idx(codec, 0x46);
5677 		is_ctia = (val & 0x0070) == 0x0070;
5678 		break;
5679 	case 0x10ec0298:
5680 		snd_hda_codec_write(codec, 0x21, 0,
5681 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5682 		msleep(100);
5683 		snd_hda_codec_write(codec, 0x21, 0,
5684 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5685 		msleep(200);
5686 
5687 		val = alc_read_coef_idx(codec, 0x50);
5688 		if (val & (1 << 12)) {
5689 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5690 			alc_process_coef_fw(codec, coef0288);
5691 			msleep(350);
5692 			val = alc_read_coef_idx(codec, 0x50);
5693 			is_ctia = (val & 0x0070) == 0x0070;
5694 		} else {
5695 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5696 			alc_process_coef_fw(codec, coef0288);
5697 			msleep(350);
5698 			val = alc_read_coef_idx(codec, 0x50);
5699 			is_ctia = (val & 0x0070) == 0x0070;
5700 		}
5701 		alc_process_coef_fw(codec, coef0298);
5702 		snd_hda_codec_write(codec, 0x21, 0,
5703 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5704 		msleep(75);
5705 		snd_hda_codec_write(codec, 0x21, 0,
5706 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5707 		break;
5708 	case 0x10ec0286:
5709 	case 0x10ec0288:
5710 		alc_process_coef_fw(codec, coef0288);
5711 		msleep(350);
5712 		val = alc_read_coef_idx(codec, 0x50);
5713 		is_ctia = (val & 0x0070) == 0x0070;
5714 		break;
5715 	case 0x10ec0292:
5716 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5717 		msleep(300);
5718 		val = alc_read_coef_idx(codec, 0x6c);
5719 		is_ctia = (val & 0x001c) == 0x001c;
5720 		break;
5721 	case 0x10ec0293:
5722 		alc_process_coef_fw(codec, coef0293);
5723 		msleep(300);
5724 		val = alc_read_coef_idx(codec, 0x46);
5725 		is_ctia = (val & 0x0070) == 0x0070;
5726 		break;
5727 	case 0x10ec0668:
5728 		alc_process_coef_fw(codec, coef0688);
5729 		msleep(300);
5730 		val = alc_read_coef_idx(codec, 0xbe);
5731 		is_ctia = (val & 0x1c02) == 0x1c02;
5732 		break;
5733 	case 0x10ec0215:
5734 	case 0x10ec0225:
5735 	case 0x10ec0285:
5736 	case 0x10ec0295:
5737 	case 0x10ec0289:
5738 	case 0x10ec0299:
5739 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5740 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5741 		val = alc_read_coef_idx(codec, 0x45);
5742 		if (val & (1 << 9)) {
5743 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5744 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5745 			msleep(800);
5746 			val = alc_read_coef_idx(codec, 0x46);
5747 			is_ctia = (val & 0x00f0) == 0x00f0;
5748 		} else {
5749 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5750 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5751 			msleep(800);
5752 			val = alc_read_coef_idx(codec, 0x46);
5753 			is_ctia = (val & 0x00f0) == 0x00f0;
5754 		}
5755 		if (!is_ctia) {
5756 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5757 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5758 			msleep(100);
5759 			val = alc_read_coef_idx(codec, 0x46);
5760 			if ((val & 0x00f0) == 0x00f0)
5761 				is_ctia = false;
5762 			else
5763 				is_ctia = true;
5764 		}
5765 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5766 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5767 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5768 		break;
5769 	case 0x10ec0867:
5770 		is_ctia = true;
5771 		break;
5772 	}
5773 
5774 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5775 		    is_ctia ? "yes" : "no");
5776 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5777 }
5778 
5779 static void alc_update_headset_mode(struct hda_codec *codec)
5780 {
5781 	struct alc_spec *spec = codec->spec;
5782 
5783 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5784 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
5785 
5786 	int new_headset_mode;
5787 
5788 	if (!snd_hda_jack_detect(codec, hp_pin))
5789 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5790 	else if (mux_pin == spec->headset_mic_pin)
5791 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5792 	else if (mux_pin == spec->headphone_mic_pin)
5793 		new_headset_mode = ALC_HEADSET_MODE_MIC;
5794 	else
5795 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5796 
5797 	if (new_headset_mode == spec->current_headset_mode) {
5798 		snd_hda_gen_update_outputs(codec);
5799 		return;
5800 	}
5801 
5802 	switch (new_headset_mode) {
5803 	case ALC_HEADSET_MODE_UNPLUGGED:
5804 		alc_headset_mode_unplugged(codec);
5805 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5806 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5807 		spec->gen.hp_jack_present = false;
5808 		break;
5809 	case ALC_HEADSET_MODE_HEADSET:
5810 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5811 			alc_determine_headset_type(codec);
5812 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5813 			alc_headset_mode_ctia(codec);
5814 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5815 			alc_headset_mode_omtp(codec);
5816 		spec->gen.hp_jack_present = true;
5817 		break;
5818 	case ALC_HEADSET_MODE_MIC:
5819 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5820 		spec->gen.hp_jack_present = false;
5821 		break;
5822 	case ALC_HEADSET_MODE_HEADPHONE:
5823 		alc_headset_mode_default(codec);
5824 		spec->gen.hp_jack_present = true;
5825 		break;
5826 	}
5827 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5828 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
5829 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5830 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5831 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5832 						  PIN_VREFHIZ);
5833 	}
5834 	spec->current_headset_mode = new_headset_mode;
5835 
5836 	snd_hda_gen_update_outputs(codec);
5837 }
5838 
5839 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5840 					 struct snd_kcontrol *kcontrol,
5841 					 struct snd_ctl_elem_value *ucontrol)
5842 {
5843 	alc_update_headset_mode(codec);
5844 }
5845 
5846 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5847 				       struct hda_jack_callback *jack)
5848 {
5849 	snd_hda_gen_hp_automute(codec, jack);
5850 	alc_update_headset_mode(codec);
5851 }
5852 
5853 static void alc_probe_headset_mode(struct hda_codec *codec)
5854 {
5855 	int i;
5856 	struct alc_spec *spec = codec->spec;
5857 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5858 
5859 	/* Find mic pins */
5860 	for (i = 0; i < cfg->num_inputs; i++) {
5861 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5862 			spec->headset_mic_pin = cfg->inputs[i].pin;
5863 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5864 			spec->headphone_mic_pin = cfg->inputs[i].pin;
5865 	}
5866 
5867 	WARN_ON(spec->gen.cap_sync_hook);
5868 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5869 	spec->gen.automute_hook = alc_update_headset_mode;
5870 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5871 }
5872 
5873 static void alc_fixup_headset_mode(struct hda_codec *codec,
5874 				const struct hda_fixup *fix, int action)
5875 {
5876 	struct alc_spec *spec = codec->spec;
5877 
5878 	switch (action) {
5879 	case HDA_FIXUP_ACT_PRE_PROBE:
5880 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5881 		break;
5882 	case HDA_FIXUP_ACT_PROBE:
5883 		alc_probe_headset_mode(codec);
5884 		break;
5885 	case HDA_FIXUP_ACT_INIT:
5886 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
5887 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5888 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5889 		}
5890 		alc_update_headset_mode(codec);
5891 		break;
5892 	}
5893 }
5894 
5895 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5896 				const struct hda_fixup *fix, int action)
5897 {
5898 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5899 		struct alc_spec *spec = codec->spec;
5900 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5901 	}
5902 	else
5903 		alc_fixup_headset_mode(codec, fix, action);
5904 }
5905 
5906 static void alc255_set_default_jack_type(struct hda_codec *codec)
5907 {
5908 	/* Set to iphone type */
5909 	static const struct coef_fw alc255fw[] = {
5910 		WRITE_COEF(0x1b, 0x880b),
5911 		WRITE_COEF(0x45, 0xd089),
5912 		WRITE_COEF(0x1b, 0x080b),
5913 		WRITE_COEF(0x46, 0x0004),
5914 		WRITE_COEF(0x1b, 0x0c0b),
5915 		{}
5916 	};
5917 	static const struct coef_fw alc256fw[] = {
5918 		WRITE_COEF(0x1b, 0x884b),
5919 		WRITE_COEF(0x45, 0xd089),
5920 		WRITE_COEF(0x1b, 0x084b),
5921 		WRITE_COEF(0x46, 0x0004),
5922 		WRITE_COEF(0x1b, 0x0c4b),
5923 		{}
5924 	};
5925 	switch (codec->core.vendor_id) {
5926 	case 0x10ec0255:
5927 		alc_process_coef_fw(codec, alc255fw);
5928 		break;
5929 	case 0x10ec0230:
5930 	case 0x10ec0236:
5931 	case 0x10ec0256:
5932 	case 0x19e58326:
5933 		alc_process_coef_fw(codec, alc256fw);
5934 		break;
5935 	}
5936 	msleep(30);
5937 }
5938 
5939 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5940 				const struct hda_fixup *fix, int action)
5941 {
5942 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5943 		alc255_set_default_jack_type(codec);
5944 	}
5945 	alc_fixup_headset_mode(codec, fix, action);
5946 }
5947 
5948 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5949 				const struct hda_fixup *fix, int action)
5950 {
5951 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5952 		struct alc_spec *spec = codec->spec;
5953 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5954 		alc255_set_default_jack_type(codec);
5955 	}
5956 	else
5957 		alc_fixup_headset_mode(codec, fix, action);
5958 }
5959 
5960 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5961 				       struct hda_jack_callback *jack)
5962 {
5963 	struct alc_spec *spec = codec->spec;
5964 
5965 	alc_update_headset_jack_cb(codec, jack);
5966 	/* Headset Mic enable or disable, only for Dell Dino */
5967 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5968 }
5969 
5970 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5971 				const struct hda_fixup *fix, int action)
5972 {
5973 	alc_fixup_headset_mode(codec, fix, action);
5974 	if (action == HDA_FIXUP_ACT_PROBE) {
5975 		struct alc_spec *spec = codec->spec;
5976 		/* toggled via hp_automute_hook */
5977 		spec->gpio_mask |= 0x40;
5978 		spec->gpio_dir |= 0x40;
5979 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5980 	}
5981 }
5982 
5983 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5984 					const struct hda_fixup *fix, int action)
5985 {
5986 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5987 		struct alc_spec *spec = codec->spec;
5988 		spec->gen.auto_mute_via_amp = 1;
5989 	}
5990 }
5991 
5992 static void alc_fixup_no_shutup(struct hda_codec *codec,
5993 				const struct hda_fixup *fix, int action)
5994 {
5995 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5996 		struct alc_spec *spec = codec->spec;
5997 		spec->no_shutup_pins = 1;
5998 	}
5999 }
6000 
6001 static void alc_fixup_disable_aamix(struct hda_codec *codec,
6002 				    const struct hda_fixup *fix, int action)
6003 {
6004 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6005 		struct alc_spec *spec = codec->spec;
6006 		/* Disable AA-loopback as it causes white noise */
6007 		spec->gen.mixer_nid = 0;
6008 	}
6009 }
6010 
6011 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
6012 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6013 				  const struct hda_fixup *fix, int action)
6014 {
6015 	static const struct hda_pintbl pincfgs[] = {
6016 		{ 0x16, 0x21211010 }, /* dock headphone */
6017 		{ 0x19, 0x21a11010 }, /* dock mic */
6018 		{ }
6019 	};
6020 	struct alc_spec *spec = codec->spec;
6021 
6022 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6023 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6024 		codec->power_save_node = 0; /* avoid click noises */
6025 		snd_hda_apply_pincfgs(codec, pincfgs);
6026 	}
6027 }
6028 
6029 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6030 				  const struct hda_fixup *fix, int action)
6031 {
6032 	static const struct hda_pintbl pincfgs[] = {
6033 		{ 0x17, 0x21211010 }, /* dock headphone */
6034 		{ 0x19, 0x21a11010 }, /* dock mic */
6035 		{ }
6036 	};
6037 	struct alc_spec *spec = codec->spec;
6038 
6039 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6040 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6041 		snd_hda_apply_pincfgs(codec, pincfgs);
6042 	} else if (action == HDA_FIXUP_ACT_INIT) {
6043 		/* Enable DOCK device */
6044 		snd_hda_codec_write(codec, 0x17, 0,
6045 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6046 		/* Enable DOCK device */
6047 		snd_hda_codec_write(codec, 0x19, 0,
6048 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6049 	}
6050 }
6051 
6052 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6053 				  const struct hda_fixup *fix, int action)
6054 {
6055 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6056 	 * the speaker output becomes too low by some reason on Thinkpads with
6057 	 * ALC298 codec
6058 	 */
6059 	static const hda_nid_t preferred_pairs[] = {
6060 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6061 		0
6062 	};
6063 	struct alc_spec *spec = codec->spec;
6064 
6065 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6066 		spec->gen.preferred_dacs = preferred_pairs;
6067 }
6068 
6069 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6070 				   const struct hda_fixup *fix, int action)
6071 {
6072 	static const hda_nid_t preferred_pairs[] = {
6073 		0x17, 0x02, 0x21, 0x03, 0
6074 	};
6075 	struct alc_spec *spec = codec->spec;
6076 
6077 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6078 		spec->gen.preferred_dacs = preferred_pairs;
6079 }
6080 
6081 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6082 {
6083 	struct alc_spec *spec = codec->spec;
6084 	int hp_pin = alc_get_hp_pin(spec);
6085 
6086 	/* Prevent pop noises when headphones are plugged in */
6087 	snd_hda_codec_write(codec, hp_pin, 0,
6088 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6089 	msleep(20);
6090 }
6091 
6092 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6093 				const struct hda_fixup *fix, int action)
6094 {
6095 	struct alc_spec *spec = codec->spec;
6096 	struct hda_input_mux *imux = &spec->gen.input_mux;
6097 	int i;
6098 
6099 	switch (action) {
6100 	case HDA_FIXUP_ACT_PRE_PROBE:
6101 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6102 		 * it causes a click noise at start up
6103 		 */
6104 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6105 		spec->shutup = alc_shutup_dell_xps13;
6106 		break;
6107 	case HDA_FIXUP_ACT_PROBE:
6108 		/* Make the internal mic the default input source. */
6109 		for (i = 0; i < imux->num_items; i++) {
6110 			if (spec->gen.imux_pins[i] == 0x12) {
6111 				spec->gen.cur_mux[0] = i;
6112 				break;
6113 			}
6114 		}
6115 		break;
6116 	}
6117 }
6118 
6119 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6120 				const struct hda_fixup *fix, int action)
6121 {
6122 	struct alc_spec *spec = codec->spec;
6123 
6124 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6125 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6126 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6127 
6128 		/* Disable boost for mic-in permanently. (This code is only called
6129 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6130 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6131 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6132 	} else
6133 		alc_fixup_headset_mode(codec, fix, action);
6134 }
6135 
6136 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6137 				const struct hda_fixup *fix, int action)
6138 {
6139 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6140 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6141 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6142 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6143 	}
6144 	alc_fixup_headset_mode(codec, fix, action);
6145 }
6146 
6147 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
6148 static int find_ext_mic_pin(struct hda_codec *codec)
6149 {
6150 	struct alc_spec *spec = codec->spec;
6151 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6152 	hda_nid_t nid;
6153 	unsigned int defcfg;
6154 	int i;
6155 
6156 	for (i = 0; i < cfg->num_inputs; i++) {
6157 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6158 			continue;
6159 		nid = cfg->inputs[i].pin;
6160 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6161 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6162 			continue;
6163 		return nid;
6164 	}
6165 
6166 	return 0;
6167 }
6168 
6169 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6170 				    const struct hda_fixup *fix,
6171 				    int action)
6172 {
6173 	struct alc_spec *spec = codec->spec;
6174 
6175 	if (action == HDA_FIXUP_ACT_PROBE) {
6176 		int mic_pin = find_ext_mic_pin(codec);
6177 		int hp_pin = alc_get_hp_pin(spec);
6178 
6179 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6180 			return;
6181 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6182 	}
6183 }
6184 
6185 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6186 					     const struct hda_fixup *fix,
6187 					     int action)
6188 {
6189 	struct alc_spec *spec = codec->spec;
6190 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6191 	int i;
6192 
6193 	/* The mic boosts on level 2 and 3 are too noisy
6194 	   on the internal mic input.
6195 	   Therefore limit the boost to 0 or 1. */
6196 
6197 	if (action != HDA_FIXUP_ACT_PROBE)
6198 		return;
6199 
6200 	for (i = 0; i < cfg->num_inputs; i++) {
6201 		hda_nid_t nid = cfg->inputs[i].pin;
6202 		unsigned int defcfg;
6203 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6204 			continue;
6205 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6206 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6207 			continue;
6208 
6209 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6210 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6211 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6212 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6213 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6214 	}
6215 }
6216 
6217 static void alc283_hp_automute_hook(struct hda_codec *codec,
6218 				    struct hda_jack_callback *jack)
6219 {
6220 	struct alc_spec *spec = codec->spec;
6221 	int vref;
6222 
6223 	msleep(200);
6224 	snd_hda_gen_hp_automute(codec, jack);
6225 
6226 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6227 
6228 	msleep(600);
6229 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6230 			    vref);
6231 }
6232 
6233 static void alc283_fixup_chromebook(struct hda_codec *codec,
6234 				    const struct hda_fixup *fix, int action)
6235 {
6236 	struct alc_spec *spec = codec->spec;
6237 
6238 	switch (action) {
6239 	case HDA_FIXUP_ACT_PRE_PROBE:
6240 		snd_hda_override_wcaps(codec, 0x03, 0);
6241 		/* Disable AA-loopback as it causes white noise */
6242 		spec->gen.mixer_nid = 0;
6243 		break;
6244 	case HDA_FIXUP_ACT_INIT:
6245 		/* MIC2-VREF control */
6246 		/* Set to manual mode */
6247 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6248 		/* Enable Line1 input control by verb */
6249 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6250 		break;
6251 	}
6252 }
6253 
6254 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6255 				    const struct hda_fixup *fix, int action)
6256 {
6257 	struct alc_spec *spec = codec->spec;
6258 
6259 	switch (action) {
6260 	case HDA_FIXUP_ACT_PRE_PROBE:
6261 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6262 		break;
6263 	case HDA_FIXUP_ACT_INIT:
6264 		/* MIC2-VREF control */
6265 		/* Set to manual mode */
6266 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6267 		break;
6268 	}
6269 }
6270 
6271 /* mute tablet speaker pin (0x14) via dock plugging in addition */
6272 static void asus_tx300_automute(struct hda_codec *codec)
6273 {
6274 	struct alc_spec *spec = codec->spec;
6275 	snd_hda_gen_update_outputs(codec);
6276 	if (snd_hda_jack_detect(codec, 0x1b))
6277 		spec->gen.mute_bits |= (1ULL << 0x14);
6278 }
6279 
6280 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6281 				    const struct hda_fixup *fix, int action)
6282 {
6283 	struct alc_spec *spec = codec->spec;
6284 	static const struct hda_pintbl dock_pins[] = {
6285 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6286 		{}
6287 	};
6288 
6289 	switch (action) {
6290 	case HDA_FIXUP_ACT_PRE_PROBE:
6291 		spec->init_amp = ALC_INIT_DEFAULT;
6292 		/* TX300 needs to set up GPIO2 for the speaker amp */
6293 		alc_setup_gpio(codec, 0x04);
6294 		snd_hda_apply_pincfgs(codec, dock_pins);
6295 		spec->gen.auto_mute_via_amp = 1;
6296 		spec->gen.automute_hook = asus_tx300_automute;
6297 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6298 						    snd_hda_gen_hp_automute);
6299 		break;
6300 	case HDA_FIXUP_ACT_PROBE:
6301 		spec->init_amp = ALC_INIT_DEFAULT;
6302 		break;
6303 	case HDA_FIXUP_ACT_BUILD:
6304 		/* this is a bit tricky; give more sane names for the main
6305 		 * (tablet) speaker and the dock speaker, respectively
6306 		 */
6307 		rename_ctl(codec, "Speaker Playback Switch",
6308 			   "Dock Speaker Playback Switch");
6309 		rename_ctl(codec, "Bass Speaker Playback Switch",
6310 			   "Speaker Playback Switch");
6311 		break;
6312 	}
6313 }
6314 
6315 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6316 				       const struct hda_fixup *fix, int action)
6317 {
6318 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6319 		/* DAC node 0x03 is giving mono output. We therefore want to
6320 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6321 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6322 		static const hda_nid_t conn1[] = { 0x0c };
6323 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6324 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6325 	}
6326 }
6327 
6328 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6329 					const struct hda_fixup *fix, int action)
6330 {
6331 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6332 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6333 		   we can't adjust the speaker's volume since this node does not has
6334 		   Amp-out capability. we change the speaker's route to:
6335 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6336 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6337 		   speaker's volume now. */
6338 
6339 		static const hda_nid_t conn1[] = { 0x0c };
6340 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6341 	}
6342 }
6343 
6344 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6345 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6346 				      const struct hda_fixup *fix, int action)
6347 {
6348 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6349 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6350 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6351 	}
6352 }
6353 
6354 /* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6355 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6356 					  const struct hda_fixup *fix, int action)
6357 {
6358 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6359 		static const hda_nid_t conn[] = { 0x02 };
6360 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6361 	}
6362 }
6363 
6364 /* Hook to update amp GPIO4 for automute */
6365 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6366 					  struct hda_jack_callback *jack)
6367 {
6368 	struct alc_spec *spec = codec->spec;
6369 
6370 	snd_hda_gen_hp_automute(codec, jack);
6371 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6372 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6373 			    !spec->gen.hp_jack_present);
6374 }
6375 
6376 /* Manage GPIOs for HP EliteBook Folio 9480m.
6377  *
6378  * GPIO4 is the headphone amplifier power control
6379  * GPIO3 is the audio output mute indicator LED
6380  */
6381 
6382 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6383 				  const struct hda_fixup *fix,
6384 				  int action)
6385 {
6386 	struct alc_spec *spec = codec->spec;
6387 
6388 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6389 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6390 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6391 		spec->gpio_mask |= 0x10;
6392 		spec->gpio_dir |= 0x10;
6393 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6394 	}
6395 }
6396 
6397 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6398 				   const struct hda_fixup *fix,
6399 				   int action)
6400 {
6401 	struct alc_spec *spec = codec->spec;
6402 
6403 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6404 		spec->gpio_mask |= 0x04;
6405 		spec->gpio_dir |= 0x04;
6406 		/* set data bit low */
6407 	}
6408 }
6409 
6410 /* Quirk for Thinkpad X1 7th and 8th Gen
6411  * The following fixed routing needed
6412  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6413  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6414  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6415  */
6416 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6417 					  const struct hda_fixup *fix, int action)
6418 {
6419 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6420 	static const hda_nid_t preferred_pairs[] = {
6421 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6422 	};
6423 	struct alc_spec *spec = codec->spec;
6424 
6425 	switch (action) {
6426 	case HDA_FIXUP_ACT_PRE_PROBE:
6427 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6428 		spec->gen.preferred_dacs = preferred_pairs;
6429 		break;
6430 	case HDA_FIXUP_ACT_BUILD:
6431 		/* The generic parser creates somewhat unintuitive volume ctls
6432 		 * with the fixed routing above, and the shared DAC2 may be
6433 		 * confusing for PA.
6434 		 * Rename those to unique names so that PA doesn't touch them
6435 		 * and use only Master volume.
6436 		 */
6437 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6438 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6439 		break;
6440 	}
6441 }
6442 
6443 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6444 					 const struct hda_fixup *fix,
6445 					 int action)
6446 {
6447 	alc_fixup_dual_codecs(codec, fix, action);
6448 	switch (action) {
6449 	case HDA_FIXUP_ACT_PRE_PROBE:
6450 		/* override card longname to provide a unique UCM profile */
6451 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6452 		break;
6453 	case HDA_FIXUP_ACT_BUILD:
6454 		/* rename Capture controls depending on the codec */
6455 		rename_ctl(codec, "Capture Volume",
6456 			   codec->addr == 0 ?
6457 			   "Rear-Panel Capture Volume" :
6458 			   "Front-Panel Capture Volume");
6459 		rename_ctl(codec, "Capture Switch",
6460 			   codec->addr == 0 ?
6461 			   "Rear-Panel Capture Switch" :
6462 			   "Front-Panel Capture Switch");
6463 		break;
6464 	}
6465 }
6466 
6467 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6468 				      const struct hda_fixup *fix, int action)
6469 {
6470 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6471 		return;
6472 
6473 	codec->power_save_node = 1;
6474 }
6475 
6476 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6477 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6478 				    const struct hda_fixup *fix, int action)
6479 {
6480 	struct alc_spec *spec = codec->spec;
6481 	static const hda_nid_t preferred_pairs[] = {
6482 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6483 		0
6484 	};
6485 
6486 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6487 		return;
6488 
6489 	spec->gen.preferred_dacs = preferred_pairs;
6490 	spec->gen.auto_mute_via_amp = 1;
6491 	codec->power_save_node = 0;
6492 }
6493 
6494 /* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6495 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6496 				    const struct hda_fixup *fix, int action)
6497 {
6498 	static const hda_nid_t preferred_pairs[] = {
6499 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6500 	};
6501 	struct alc_spec *spec = codec->spec;
6502 
6503 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6504 		spec->gen.preferred_dacs = preferred_pairs;
6505 		spec->gen.obey_preferred_dacs = 1;
6506 	}
6507 }
6508 
6509 /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6510 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6511 			      const struct hda_fixup *fix, int action)
6512 {
6513 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6514 		return;
6515 
6516 	snd_hda_override_wcaps(codec, 0x03, 0);
6517 }
6518 
6519 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6520 {
6521 	switch (codec->core.vendor_id) {
6522 	case 0x10ec0274:
6523 	case 0x10ec0294:
6524 	case 0x10ec0225:
6525 	case 0x10ec0295:
6526 	case 0x10ec0299:
6527 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6528 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6529 		break;
6530 	case 0x10ec0230:
6531 	case 0x10ec0235:
6532 	case 0x10ec0236:
6533 	case 0x10ec0255:
6534 	case 0x10ec0256:
6535 	case 0x10ec0257:
6536 	case 0x19e58326:
6537 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6538 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6539 		break;
6540 	}
6541 }
6542 
6543 static void alc295_fixup_chromebook(struct hda_codec *codec,
6544 				    const struct hda_fixup *fix, int action)
6545 {
6546 	struct alc_spec *spec = codec->spec;
6547 
6548 	switch (action) {
6549 	case HDA_FIXUP_ACT_PRE_PROBE:
6550 		spec->ultra_low_power = true;
6551 		break;
6552 	case HDA_FIXUP_ACT_INIT:
6553 		alc_combo_jack_hp_jd_restart(codec);
6554 		break;
6555 	}
6556 }
6557 
6558 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6559 				  const struct hda_fixup *fix, int action)
6560 {
6561 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6562 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6563 }
6564 
6565 
6566 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6567 					struct hda_jack_callback *cb)
6568 {
6569 	/* The Windows driver sets the codec up in a very different way where
6570 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6571 	 */
6572 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6573 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6574 	else
6575 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6576 }
6577 
6578 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6579 					const struct hda_fixup *fix, int action)
6580 {
6581 	/* Pin 0x21: headphones/headset mic */
6582 	if (!is_jack_detectable(codec, 0x21))
6583 		return;
6584 
6585 	switch (action) {
6586 	case HDA_FIXUP_ACT_PRE_PROBE:
6587 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6588 				alc294_gx502_toggle_output);
6589 		break;
6590 	case HDA_FIXUP_ACT_INIT:
6591 		/* Make sure to start in a correct state, i.e. if
6592 		 * headphones have been plugged in before powering up the system
6593 		 */
6594 		alc294_gx502_toggle_output(codec, NULL);
6595 		break;
6596 	}
6597 }
6598 
6599 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6600 				       struct hda_jack_callback *cb)
6601 {
6602 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6603 	 * responsible from changes between speakers and headphones
6604 	 */
6605 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6606 		alc_write_coef_idx(codec, 0x10, 0x8420);
6607 	else
6608 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6609 }
6610 
6611 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6612 				  const struct hda_fixup *fix, int action)
6613 {
6614 	if (!is_jack_detectable(codec, 0x21))
6615 		return;
6616 
6617 	switch (action) {
6618 	case HDA_FIXUP_ACT_PRE_PROBE:
6619 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6620 				alc294_gu502_toggle_output);
6621 		break;
6622 	case HDA_FIXUP_ACT_INIT:
6623 		alc294_gu502_toggle_output(codec, NULL);
6624 		break;
6625 	}
6626 }
6627 
6628 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6629 			      const struct hda_fixup *fix, int action)
6630 {
6631 	if (action != HDA_FIXUP_ACT_INIT)
6632 		return;
6633 
6634 	msleep(100);
6635 	alc_write_coef_idx(codec, 0x65, 0x0);
6636 }
6637 
6638 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6639 				    const struct hda_fixup *fix, int action)
6640 {
6641 	switch (action) {
6642 	case HDA_FIXUP_ACT_INIT:
6643 		alc_combo_jack_hp_jd_restart(codec);
6644 		break;
6645 	}
6646 }
6647 
6648 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6649 				    const struct hda_fixup *fix, int action)
6650 {
6651 	struct alc_spec *spec = codec->spec;
6652 
6653 	switch (action) {
6654 	case HDA_FIXUP_ACT_PRE_PROBE:
6655 		/* Mic RING SLEEVE swap for combo jack */
6656 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6657 		spec->no_internal_mic_pin = true;
6658 		break;
6659 	case HDA_FIXUP_ACT_INIT:
6660 		alc_combo_jack_hp_jd_restart(codec);
6661 		break;
6662 	}
6663 }
6664 
6665 /* GPIO1 = amplifier on/off
6666  * GPIO3 = mic mute LED
6667  */
6668 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6669 					  const struct hda_fixup *fix, int action)
6670 {
6671 	static const hda_nid_t conn[] = { 0x02 };
6672 
6673 	struct alc_spec *spec = codec->spec;
6674 	static const struct hda_pintbl pincfgs[] = {
6675 		{ 0x14, 0x90170110 },  /* front/high speakers */
6676 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6677 		{ }
6678 	};
6679 
6680 	//enable micmute led
6681 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6682 
6683 	switch (action) {
6684 	case HDA_FIXUP_ACT_PRE_PROBE:
6685 		spec->micmute_led_polarity = 1;
6686 		/* needed for amp of back speakers */
6687 		spec->gpio_mask |= 0x01;
6688 		spec->gpio_dir |= 0x01;
6689 		snd_hda_apply_pincfgs(codec, pincfgs);
6690 		/* share DAC to have unified volume control */
6691 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6692 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6693 		break;
6694 	case HDA_FIXUP_ACT_INIT:
6695 		/* need to toggle GPIO to enable the amp of back speakers */
6696 		alc_update_gpio_data(codec, 0x01, true);
6697 		msleep(100);
6698 		alc_update_gpio_data(codec, 0x01, false);
6699 		break;
6700 	}
6701 }
6702 
6703 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6704 					  const struct hda_fixup *fix, int action)
6705 {
6706 	static const hda_nid_t conn[] = { 0x02 };
6707 	static const struct hda_pintbl pincfgs[] = {
6708 		{ 0x14, 0x90170110 },  /* rear speaker */
6709 		{ }
6710 	};
6711 
6712 	switch (action) {
6713 	case HDA_FIXUP_ACT_PRE_PROBE:
6714 		snd_hda_apply_pincfgs(codec, pincfgs);
6715 		/* force front speaker to DAC1 */
6716 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6717 		break;
6718 	}
6719 }
6720 
6721 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6722 				      const struct hda_fixup *fix,
6723 				      int action)
6724 {
6725 	static const struct coef_fw coefs[] = {
6726 		WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6727 		WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6728 		WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6729 		WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6730 		WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6731 		WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6732 		WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6733 		WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6734 		WRITE_COEF(0x6e, 0x1005), { }
6735 	};
6736 
6737 	static const struct hda_pintbl pincfgs[] = {
6738 		{ 0x12, 0xb7a60130 },  /* Internal microphone*/
6739 		{ 0x14, 0x90170150 },  /* B&O soundbar speakers */
6740 		{ 0x17, 0x90170153 },  /* Side speakers */
6741 		{ 0x19, 0x03a11040 },  /* Headset microphone */
6742 		{ }
6743 	};
6744 
6745 	switch (action) {
6746 	case HDA_FIXUP_ACT_PRE_PROBE:
6747 		snd_hda_apply_pincfgs(codec, pincfgs);
6748 
6749 		/* Fixes volume control problem for side speakers */
6750 		alc295_fixup_disable_dac3(codec, fix, action);
6751 
6752 		/* Fixes no sound from headset speaker */
6753 		snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
6754 
6755 		/* Auto-enable headset mic when plugged */
6756 		snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
6757 
6758 		/* Headset mic volume enhancement */
6759 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
6760 		break;
6761 	case HDA_FIXUP_ACT_INIT:
6762 		alc_process_coef_fw(codec, coefs);
6763 		break;
6764 	case HDA_FIXUP_ACT_BUILD:
6765 		rename_ctl(codec, "Bass Speaker Playback Volume",
6766 			   "B&O-Tuned Playback Volume");
6767 		rename_ctl(codec, "Front Playback Switch",
6768 			   "B&O Soundbar Playback Switch");
6769 		rename_ctl(codec, "Bass Speaker Playback Switch",
6770 			   "Side Speaker Playback Switch");
6771 		break;
6772 	}
6773 }
6774 
6775 /* for hda_fixup_thinkpad_acpi() */
6776 #include "thinkpad_helper.c"
6777 
6778 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6779 				    const struct hda_fixup *fix, int action)
6780 {
6781 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6782 	hda_fixup_thinkpad_acpi(codec, fix, action);
6783 }
6784 
6785 /* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6786 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6787 						  const struct hda_fixup *fix,
6788 						  int action)
6789 {
6790 	struct alc_spec *spec = codec->spec;
6791 
6792 	switch (action) {
6793 	case HDA_FIXUP_ACT_PRE_PROBE:
6794 		spec->gen.suppress_auto_mute = 1;
6795 		break;
6796 	}
6797 }
6798 
6799 static int comp_bind(struct device *dev)
6800 {
6801 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6802 	struct alc_spec *spec = cdc->spec;
6803 
6804 	return component_bind_all(dev, spec->comps);
6805 }
6806 
6807 static void comp_unbind(struct device *dev)
6808 {
6809 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6810 	struct alc_spec *spec = cdc->spec;
6811 
6812 	component_unbind_all(dev, spec->comps);
6813 }
6814 
6815 static const struct component_master_ops comp_master_ops = {
6816 	.bind = comp_bind,
6817 	.unbind = comp_unbind,
6818 };
6819 
6820 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6821 				       struct snd_pcm_substream *sub, int action)
6822 {
6823 	struct alc_spec *spec = cdc->spec;
6824 	int i;
6825 
6826 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6827 		if (spec->comps[i].dev && spec->comps[i].pre_playback_hook)
6828 			spec->comps[i].pre_playback_hook(spec->comps[i].dev, action);
6829 	}
6830 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6831 		if (spec->comps[i].dev && spec->comps[i].playback_hook)
6832 			spec->comps[i].playback_hook(spec->comps[i].dev, action);
6833 	}
6834 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6835 		if (spec->comps[i].dev && spec->comps[i].post_playback_hook)
6836 			spec->comps[i].post_playback_hook(spec->comps[i].dev, action);
6837 	}
6838 }
6839 
6840 struct scodec_dev_name {
6841 	const char *bus;
6842 	const char *hid;
6843 	int index;
6844 };
6845 
6846 /* match the device name in a slightly relaxed manner */
6847 static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
6848 {
6849 	struct scodec_dev_name *p = data;
6850 	const char *d = dev_name(dev);
6851 	int n = strlen(p->bus);
6852 	char tmp[32];
6853 
6854 	/* check the bus name */
6855 	if (strncmp(d, p->bus, n))
6856 		return 0;
6857 	/* skip the bus number */
6858 	if (isdigit(d[n]))
6859 		n++;
6860 	/* the rest must be exact matching */
6861 	snprintf(tmp, sizeof(tmp), "-%s:00-cs35l41-hda.%d", p->hid, p->index);
6862 	return !strcmp(d + n, tmp);
6863 }
6864 
6865 static int comp_match_tas2781_dev_name(struct device *dev,
6866 	void *data)
6867 {
6868 	struct scodec_dev_name *p = data;
6869 	const char *d = dev_name(dev);
6870 	int n = strlen(p->bus);
6871 	char tmp[32];
6872 
6873 	/* check the bus name */
6874 	if (strncmp(d, p->bus, n))
6875 		return 0;
6876 	/* skip the bus number */
6877 	if (isdigit(d[n]))
6878 		n++;
6879 	/* the rest must be exact matching */
6880 	snprintf(tmp, sizeof(tmp), "-%s:00", p->hid);
6881 
6882 	return !strcmp(d + n, tmp);
6883 }
6884 
6885 static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6886 				  const char *hid, int count)
6887 {
6888 	struct device *dev = hda_codec_dev(cdc);
6889 	struct alc_spec *spec = cdc->spec;
6890 	struct scodec_dev_name *rec;
6891 	int ret, i;
6892 
6893 	switch (action) {
6894 	case HDA_FIXUP_ACT_PRE_PROBE:
6895 		for (i = 0; i < count; i++) {
6896 			rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6897 			if (!rec)
6898 				return;
6899 			rec->bus = bus;
6900 			rec->hid = hid;
6901 			rec->index = i;
6902 			spec->comps[i].codec = cdc;
6903 			component_match_add(dev, &spec->match,
6904 					    comp_match_cs35l41_dev_name, rec);
6905 		}
6906 		ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6907 		if (ret)
6908 			codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6909 		else
6910 			spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6911 		break;
6912 	case HDA_FIXUP_ACT_FREE:
6913 		component_master_del(dev, &comp_master_ops);
6914 		break;
6915 	}
6916 }
6917 
6918 static void tas2781_generic_fixup(struct hda_codec *cdc, int action,
6919 	const char *bus, const char *hid)
6920 {
6921 	struct device *dev = hda_codec_dev(cdc);
6922 	struct alc_spec *spec = cdc->spec;
6923 	struct scodec_dev_name *rec;
6924 	int ret;
6925 
6926 	switch (action) {
6927 	case HDA_FIXUP_ACT_PRE_PROBE:
6928 		rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6929 		if (!rec)
6930 			return;
6931 		rec->bus = bus;
6932 		rec->hid = hid;
6933 		rec->index = 0;
6934 		spec->comps[0].codec = cdc;
6935 		component_match_add(dev, &spec->match,
6936 			comp_match_tas2781_dev_name, rec);
6937 		ret = component_master_add_with_match(dev, &comp_master_ops,
6938 			spec->match);
6939 		if (ret)
6940 			codec_err(cdc,
6941 				"Fail to register component aggregator %d\n",
6942 				ret);
6943 		else
6944 			spec->gen.pcm_playback_hook =
6945 				comp_generic_playback_hook;
6946 		break;
6947 	case HDA_FIXUP_ACT_FREE:
6948 		component_master_del(dev, &comp_master_ops);
6949 		break;
6950 	}
6951 }
6952 
6953 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6954 {
6955 	cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6956 }
6957 
6958 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6959 {
6960 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2);
6961 }
6962 
6963 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6964 {
6965 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4);
6966 }
6967 
6968 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6969 						 int action)
6970 {
6971 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
6972 }
6973 
6974 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6975 						 int action)
6976 {
6977 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0101", 2);
6978 }
6979 
6980 static void tas2781_fixup_i2c(struct hda_codec *cdc,
6981 	const struct hda_fixup *fix, int action)
6982 {
6983 	 tas2781_generic_fixup(cdc, action, "i2c", "TIAS2781");
6984 }
6985 
6986 /* for alc295_fixup_hp_top_speakers */
6987 #include "hp_x360_helper.c"
6988 
6989 /* for alc285_fixup_ideapad_s740_coef() */
6990 #include "ideapad_s740_helper.c"
6991 
6992 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6993 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6994 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6995 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6996 	{}
6997 };
6998 
6999 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
7000 					   const struct hda_fixup *fix,
7001 					   int action)
7002 {
7003 	/*
7004 	 * A certain other OS sets these coeffs to different values. On at least
7005 	 * one TongFang barebone these settings might survive even a cold
7006 	 * reboot. So to restore a clean slate the values are explicitly reset
7007 	 * to default here. Without this, the external microphone is always in a
7008 	 * plugged-in state, while the internal microphone is always in an
7009 	 * unplugged state, breaking the ability to use the internal microphone.
7010 	 */
7011 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7012 }
7013 
7014 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7015 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7016 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7017 	WRITE_COEF(0x49, 0x0149),
7018 	{}
7019 };
7020 
7021 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7022 				       const struct hda_fixup *fix,
7023 				       int action)
7024 {
7025 	/*
7026 	 * The audio jack input and output is not detected on the ASRock NUC Box
7027 	 * 1100 series when cold booting without this fix. Warm rebooting from a
7028 	 * certain other OS makes the audio functional, as COEF settings are
7029 	 * preserved in this case. This fix sets these altered COEF values as
7030 	 * the default.
7031 	 */
7032 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7033 }
7034 
7035 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7036 						    const struct hda_fixup *fix,
7037 						    int action)
7038 {
7039 	/*
7040 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7041 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7042 	 * needs an additional quirk for sound working after suspend and resume.
7043 	 */
7044 	if (codec->core.vendor_id == 0x10ec0256) {
7045 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7046 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7047 	} else {
7048 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7049 	}
7050 }
7051 
7052 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7053 						  const struct hda_fixup *fix,
7054 						  int action)
7055 {
7056 	struct alc_spec *spec = codec->spec;
7057 	struct hda_input_mux *imux = &spec->gen.input_mux;
7058 	int i;
7059 
7060 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
7061 
7062 	switch (action) {
7063 	case HDA_FIXUP_ACT_PRE_PROBE:
7064 		/**
7065 		 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7066 		 * to Hi-Z to avoid pop noises at startup and when plugging and
7067 		 * unplugging headphones.
7068 		 */
7069 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7070 		snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7071 		break;
7072 	case HDA_FIXUP_ACT_PROBE:
7073 		/**
7074 		 * Make the internal mic (0x12) the default input source to
7075 		 * prevent pop noises on cold boot.
7076 		 */
7077 		for (i = 0; i < imux->num_items; i++) {
7078 			if (spec->gen.imux_pins[i] == 0x12) {
7079 				spec->gen.cur_mux[0] = i;
7080 				break;
7081 			}
7082 		}
7083 		break;
7084 	}
7085 }
7086 
7087 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7088 					  const struct hda_fixup *fix, int action)
7089 {
7090 	/*
7091 	 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7092 	 * unconnected.
7093 	 */
7094 	static const struct hda_pintbl pincfgs[] = {
7095 		{ 0x17, 0x90170121 },
7096 		{ }
7097 	};
7098 	/*
7099 	 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7100 	 * DAC 0x02 and 0x03 would be fine.
7101 	 */
7102 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7103 	/*
7104 	 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7105 	 * Headphones (0x21) are connected to DAC 0x03.
7106 	 */
7107 	static const hda_nid_t preferred_pairs[] = {
7108 		0x14, 0x02,
7109 		0x17, 0x02,
7110 		0x21, 0x03,
7111 		0
7112 	};
7113 	struct alc_spec *spec = codec->spec;
7114 
7115 	switch (action) {
7116 	case HDA_FIXUP_ACT_PRE_PROBE:
7117 		snd_hda_apply_pincfgs(codec, pincfgs);
7118 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7119 		spec->gen.preferred_dacs = preferred_pairs;
7120 		break;
7121 	}
7122 }
7123 
7124 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7125 					  const struct hda_fixup *fix, int action)
7126 {
7127 	static const struct hda_pintbl pincfgs[] = {
7128 		{ 0x14, 0x90170151 },
7129 		{ 0x17, 0x90170150 },
7130 		{ }
7131 	};
7132 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7133 	static const hda_nid_t preferred_pairs[] = {
7134 		0x14, 0x02,
7135 		0x17, 0x03,
7136 		0x21, 0x02,
7137 		0
7138 	};
7139 	struct alc_spec *spec = codec->spec;
7140 
7141 	alc_fixup_no_shutup(codec, fix, action);
7142 
7143 	switch (action) {
7144 	case HDA_FIXUP_ACT_PRE_PROBE:
7145 		snd_hda_apply_pincfgs(codec, pincfgs);
7146 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7147 		spec->gen.preferred_dacs = preferred_pairs;
7148 		break;
7149 	}
7150 }
7151 
7152 /* Forcibly assign NID 0x03 to HP while NID 0x02 to SPK */
7153 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7154 				    const struct hda_fixup *fix, int action)
7155 {
7156 	struct alc_spec *spec = codec->spec;
7157 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7158 	static const hda_nid_t preferred_pairs[] = {
7159 		0x17, 0x02, 0x21, 0x03, 0
7160 	};
7161 
7162 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7163 		return;
7164 
7165 	snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7166 	spec->gen.preferred_dacs = preferred_pairs;
7167 	spec->gen.auto_mute_via_amp = 1;
7168 	if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7169 		snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7170 					0x0); /* Make sure 0x14 was disable */
7171 	}
7172 }
7173 /* Fix none verb table of Headset Mic pin */
7174 static void alc_fixup_headset_mic(struct hda_codec *codec,
7175 				   const struct hda_fixup *fix, int action)
7176 {
7177 	struct alc_spec *spec = codec->spec;
7178 	static const struct hda_pintbl pincfgs[] = {
7179 		{ 0x19, 0x03a1103c },
7180 		{ }
7181 	};
7182 
7183 	switch (action) {
7184 	case HDA_FIXUP_ACT_PRE_PROBE:
7185 		snd_hda_apply_pincfgs(codec, pincfgs);
7186 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7187 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7188 		break;
7189 	}
7190 }
7191 
7192 
7193 enum {
7194 	ALC269_FIXUP_GPIO2,
7195 	ALC269_FIXUP_SONY_VAIO,
7196 	ALC275_FIXUP_SONY_VAIO_GPIO2,
7197 	ALC269_FIXUP_DELL_M101Z,
7198 	ALC269_FIXUP_SKU_IGNORE,
7199 	ALC269_FIXUP_ASUS_G73JW,
7200 	ALC269_FIXUP_ASUS_N7601ZM_PINS,
7201 	ALC269_FIXUP_ASUS_N7601ZM,
7202 	ALC269_FIXUP_LENOVO_EAPD,
7203 	ALC275_FIXUP_SONY_HWEQ,
7204 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
7205 	ALC271_FIXUP_DMIC,
7206 	ALC269_FIXUP_PCM_44K,
7207 	ALC269_FIXUP_STEREO_DMIC,
7208 	ALC269_FIXUP_HEADSET_MIC,
7209 	ALC269_FIXUP_QUANTA_MUTE,
7210 	ALC269_FIXUP_LIFEBOOK,
7211 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
7212 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
7213 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7214 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7215 	ALC269_FIXUP_AMIC,
7216 	ALC269_FIXUP_DMIC,
7217 	ALC269VB_FIXUP_AMIC,
7218 	ALC269VB_FIXUP_DMIC,
7219 	ALC269_FIXUP_HP_MUTE_LED,
7220 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
7221 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
7222 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
7223 	ALC269_FIXUP_HP_GPIO_LED,
7224 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
7225 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
7226 	ALC269_FIXUP_INV_DMIC,
7227 	ALC269_FIXUP_LENOVO_DOCK,
7228 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7229 	ALC269_FIXUP_NO_SHUTUP,
7230 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7231 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7232 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7233 	ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7234 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7235 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7236 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7237 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7238 	ALC269_FIXUP_HEADSET_MODE,
7239 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7240 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7241 	ALC269_FIXUP_ASUS_X101_FUNC,
7242 	ALC269_FIXUP_ASUS_X101_VERB,
7243 	ALC269_FIXUP_ASUS_X101,
7244 	ALC271_FIXUP_AMIC_MIC2,
7245 	ALC271_FIXUP_HP_GATE_MIC_JACK,
7246 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7247 	ALC269_FIXUP_ACER_AC700,
7248 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7249 	ALC269VB_FIXUP_ASUS_ZENBOOK,
7250 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7251 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7252 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7253 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
7254 	ALC283_FIXUP_CHROME_BOOK,
7255 	ALC283_FIXUP_SENSE_COMBO_JACK,
7256 	ALC282_FIXUP_ASUS_TX300,
7257 	ALC283_FIXUP_INT_MIC,
7258 	ALC290_FIXUP_MONO_SPEAKERS,
7259 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7260 	ALC290_FIXUP_SUBWOOFER,
7261 	ALC290_FIXUP_SUBWOOFER_HSJACK,
7262 	ALC269_FIXUP_THINKPAD_ACPI,
7263 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7264 	ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
7265 	ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7266 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7267 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7268 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7269 	ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7270 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7271 	ALC255_FIXUP_HEADSET_MODE,
7272 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7273 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7274 	ALC292_FIXUP_TPT440_DOCK,
7275 	ALC292_FIXUP_TPT440,
7276 	ALC283_FIXUP_HEADSET_MIC,
7277 	ALC255_FIXUP_MIC_MUTE_LED,
7278 	ALC282_FIXUP_ASPIRE_V5_PINS,
7279 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
7280 	ALC280_FIXUP_HP_GPIO4,
7281 	ALC286_FIXUP_HP_GPIO_LED,
7282 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7283 	ALC280_FIXUP_HP_DOCK_PINS,
7284 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7285 	ALC280_FIXUP_HP_9480M,
7286 	ALC245_FIXUP_HP_X360_AMP,
7287 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7288 	ALC285_FIXUP_HP_ENVY_X360,
7289 	ALC288_FIXUP_DELL_HEADSET_MODE,
7290 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7291 	ALC288_FIXUP_DELL_XPS_13,
7292 	ALC288_FIXUP_DISABLE_AAMIX,
7293 	ALC292_FIXUP_DELL_E7X_AAMIX,
7294 	ALC292_FIXUP_DELL_E7X,
7295 	ALC292_FIXUP_DISABLE_AAMIX,
7296 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7297 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7298 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7299 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7300 	ALC275_FIXUP_DELL_XPS,
7301 	ALC293_FIXUP_LENOVO_SPK_NOISE,
7302 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7303 	ALC255_FIXUP_DELL_SPK_NOISE,
7304 	ALC225_FIXUP_DISABLE_MIC_VREF,
7305 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7306 	ALC295_FIXUP_DISABLE_DAC3,
7307 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
7308 	ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7309 	ALC285_FIXUP_ASUS_HEADSET_MIC,
7310 	ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7311 	ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7312 	ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7313 	ALC280_FIXUP_HP_HEADSET_MIC,
7314 	ALC221_FIXUP_HP_FRONT_MIC,
7315 	ALC292_FIXUP_TPT460,
7316 	ALC298_FIXUP_SPK_VOLUME,
7317 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
7318 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7319 	ALC269_FIXUP_ATIV_BOOK_8,
7320 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7321 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7322 	ALC256_FIXUP_ASUS_HEADSET_MODE,
7323 	ALC256_FIXUP_ASUS_MIC,
7324 	ALC256_FIXUP_ASUS_AIO_GPIO2,
7325 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7326 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7327 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
7328 	ALC233_FIXUP_ACER_HEADSET_MIC,
7329 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
7330 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7331 	ALC225_FIXUP_S3_POP_NOISE,
7332 	ALC700_FIXUP_INTEL_REFERENCE,
7333 	ALC274_FIXUP_DELL_BIND_DACS,
7334 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7335 	ALC298_FIXUP_TPT470_DOCK_FIX,
7336 	ALC298_FIXUP_TPT470_DOCK,
7337 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7338 	ALC255_FIXUP_DELL_HEADSET_MIC,
7339 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7340 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
7341 	ALC295_FIXUP_HP_X360,
7342 	ALC221_FIXUP_HP_HEADSET_MIC,
7343 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7344 	ALC295_FIXUP_HP_AUTO_MUTE,
7345 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7346 	ALC294_FIXUP_ASUS_MIC,
7347 	ALC294_FIXUP_ASUS_HEADSET_MIC,
7348 	ALC294_FIXUP_ASUS_SPK,
7349 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7350 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7351 	ALC255_FIXUP_ACER_HEADSET_MIC,
7352 	ALC295_FIXUP_CHROME_BOOK,
7353 	ALC225_FIXUP_HEADSET_JACK,
7354 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7355 	ALC225_FIXUP_WYSE_AUTO_MUTE,
7356 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7357 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7358 	ALC256_FIXUP_ASUS_HEADSET_MIC,
7359 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7360 	ALC255_FIXUP_PREDATOR_SUBWOOFER,
7361 	ALC299_FIXUP_PREDATOR_SPK,
7362 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7363 	ALC289_FIXUP_DELL_SPK1,
7364 	ALC289_FIXUP_DELL_SPK2,
7365 	ALC289_FIXUP_DUAL_SPK,
7366 	ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7367 	ALC294_FIXUP_SPK2_TO_DAC1,
7368 	ALC294_FIXUP_ASUS_DUAL_SPK,
7369 	ALC285_FIXUP_THINKPAD_X1_GEN7,
7370 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7371 	ALC294_FIXUP_ASUS_ALLY,
7372 	ALC294_FIXUP_ASUS_ALLY_PINS,
7373 	ALC294_FIXUP_ASUS_ALLY_VERBS,
7374 	ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7375 	ALC294_FIXUP_ASUS_HPE,
7376 	ALC294_FIXUP_ASUS_COEF_1B,
7377 	ALC294_FIXUP_ASUS_GX502_HP,
7378 	ALC294_FIXUP_ASUS_GX502_PINS,
7379 	ALC294_FIXUP_ASUS_GX502_VERBS,
7380 	ALC294_FIXUP_ASUS_GU502_HP,
7381 	ALC294_FIXUP_ASUS_GU502_PINS,
7382 	ALC294_FIXUP_ASUS_GU502_VERBS,
7383 	ALC294_FIXUP_ASUS_G513_PINS,
7384 	ALC285_FIXUP_ASUS_G533Z_PINS,
7385 	ALC285_FIXUP_HP_GPIO_LED,
7386 	ALC285_FIXUP_HP_MUTE_LED,
7387 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7388 	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7389 	ALC236_FIXUP_HP_GPIO_LED,
7390 	ALC236_FIXUP_HP_MUTE_LED,
7391 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7392 	ALC236_FIXUP_LENOVO_INV_DMIC,
7393 	ALC298_FIXUP_SAMSUNG_AMP,
7394 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7395 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7396 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7397 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7398 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
7399 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7400 	ALC289_FIXUP_ASUS_GA401,
7401 	ALC289_FIXUP_ASUS_GA502,
7402 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7403 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
7404 	ALC269_FIXUP_CZC_B20,
7405 	ALC269_FIXUP_CZC_TMI,
7406 	ALC269_FIXUP_CZC_L101,
7407 	ALC269_FIXUP_LEMOTE_A1802,
7408 	ALC269_FIXUP_LEMOTE_A190X,
7409 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
7410 	ALC233_FIXUP_INTEL_NUC8_DMIC,
7411 	ALC233_FIXUP_INTEL_NUC8_BOOST,
7412 	ALC256_FIXUP_INTEL_NUC10,
7413 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7414 	ALC274_FIXUP_HP_MIC,
7415 	ALC274_FIXUP_HP_HEADSET_MIC,
7416 	ALC274_FIXUP_HP_ENVY_GPIO,
7417 	ALC256_FIXUP_ASUS_HPE,
7418 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7419 	ALC287_FIXUP_HP_GPIO_LED,
7420 	ALC256_FIXUP_HP_HEADSET_MIC,
7421 	ALC245_FIXUP_HP_GPIO_LED,
7422 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7423 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7424 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7425 	ALC256_FIXUP_ACER_HEADSET_MIC,
7426 	ALC285_FIXUP_IDEAPAD_S740_COEF,
7427 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7428 	ALC295_FIXUP_ASUS_DACS,
7429 	ALC295_FIXUP_HP_OMEN,
7430 	ALC285_FIXUP_HP_SPECTRE_X360,
7431 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7432 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7433 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7434 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7435 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7436 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7437 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7438 	ALC298_FIXUP_LENOVO_C940_DUET7,
7439 	ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
7440 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
7441 	ALC256_FIXUP_SET_COEF_DEFAULTS,
7442 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7443 	ALC233_FIXUP_NO_AUDIO_JACK,
7444 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7445 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7446 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7447 	ALC287_FIXUP_LEGION_16ACHG6,
7448 	ALC287_FIXUP_CS35L41_I2C_2,
7449 	ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7450 	ALC245_FIXUP_CS35L41_SPI_2,
7451 	ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7452 	ALC245_FIXUP_CS35L41_SPI_4,
7453 	ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7454 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7455 	ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7456 	ALC287_FIXUP_LEGION_16ITHG6,
7457 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7458 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7459 	ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7460 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7461 	ALC236_FIXUP_DELL_DUAL_CODECS,
7462 	ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7463 	ALC287_FIXUP_TAS2781_I2C,
7464 	ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7465 	ALC245_FIXUP_HP_X360_MUTE_LEDS,
7466 	ALC287_FIXUP_THINKPAD_I2S_SPK,
7467 	ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7468 	ALC2XX_FIXUP_HEADSET_MIC,
7469 	ALC289_FIXUP_DELL_CS35L41_SPI_2,
7470 	ALC294_FIXUP_CS35L41_I2C_2,
7471 };
7472 
7473 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7474  * both have the very same PCI SSID, and we need to apply different fixups
7475  * depending on the codec ID
7476  */
7477 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7478 					   const struct hda_fixup *fix,
7479 					   int action)
7480 {
7481 	int id;
7482 
7483 	if (codec->core.vendor_id == 0x10ec0298)
7484 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7485 	else
7486 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7487 	__snd_hda_apply_fixup(codec, id, action, 0);
7488 }
7489 
7490 /* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
7491  * 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
7492  * so we need to apply a different fixup in this case. The only DuetITL codec
7493  * SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
7494  * and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
7495  * have matched correctly by their codecs.
7496  */
7497 static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
7498 					      const struct hda_fixup *fix,
7499 					      int action)
7500 {
7501 	int id;
7502 
7503 	if (codec->core.subsystem_id == 0x17aa3802)
7504 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
7505 	else
7506 		id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
7507 	__snd_hda_apply_fixup(codec, id, action, 0);
7508 }
7509 
7510 static const struct hda_fixup alc269_fixups[] = {
7511 	[ALC269_FIXUP_GPIO2] = {
7512 		.type = HDA_FIXUP_FUNC,
7513 		.v.func = alc_fixup_gpio2,
7514 	},
7515 	[ALC269_FIXUP_SONY_VAIO] = {
7516 		.type = HDA_FIXUP_PINCTLS,
7517 		.v.pins = (const struct hda_pintbl[]) {
7518 			{0x19, PIN_VREFGRD},
7519 			{}
7520 		}
7521 	},
7522 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7523 		.type = HDA_FIXUP_FUNC,
7524 		.v.func = alc275_fixup_gpio4_off,
7525 		.chained = true,
7526 		.chain_id = ALC269_FIXUP_SONY_VAIO
7527 	},
7528 	[ALC269_FIXUP_DELL_M101Z] = {
7529 		.type = HDA_FIXUP_VERBS,
7530 		.v.verbs = (const struct hda_verb[]) {
7531 			/* Enables internal speaker */
7532 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
7533 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7534 			{}
7535 		}
7536 	},
7537 	[ALC269_FIXUP_SKU_IGNORE] = {
7538 		.type = HDA_FIXUP_FUNC,
7539 		.v.func = alc_fixup_sku_ignore,
7540 	},
7541 	[ALC269_FIXUP_ASUS_G73JW] = {
7542 		.type = HDA_FIXUP_PINS,
7543 		.v.pins = (const struct hda_pintbl[]) {
7544 			{ 0x17, 0x99130111 }, /* subwoofer */
7545 			{ }
7546 		}
7547 	},
7548 	[ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7549 		.type = HDA_FIXUP_PINS,
7550 		.v.pins = (const struct hda_pintbl[]) {
7551 			{ 0x19, 0x03A11050 },
7552 			{ 0x1a, 0x03A11C30 },
7553 			{ 0x21, 0x03211420 },
7554 			{ }
7555 		}
7556 	},
7557 	[ALC269_FIXUP_ASUS_N7601ZM] = {
7558 		.type = HDA_FIXUP_VERBS,
7559 		.v.verbs = (const struct hda_verb[]) {
7560 			{0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7561 			{0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7562 			{0x20, AC_VERB_SET_COEF_INDEX, 0x10},
7563 			{0x20, AC_VERB_SET_PROC_COEF, 0x8420},
7564 			{0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
7565 			{0x20, AC_VERB_SET_PROC_COEF, 0x7774},
7566 			{ }
7567 		},
7568 		.chained = true,
7569 		.chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
7570 	},
7571 	[ALC269_FIXUP_LENOVO_EAPD] = {
7572 		.type = HDA_FIXUP_VERBS,
7573 		.v.verbs = (const struct hda_verb[]) {
7574 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7575 			{}
7576 		}
7577 	},
7578 	[ALC275_FIXUP_SONY_HWEQ] = {
7579 		.type = HDA_FIXUP_FUNC,
7580 		.v.func = alc269_fixup_hweq,
7581 		.chained = true,
7582 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7583 	},
7584 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7585 		.type = HDA_FIXUP_FUNC,
7586 		.v.func = alc_fixup_disable_aamix,
7587 		.chained = true,
7588 		.chain_id = ALC269_FIXUP_SONY_VAIO
7589 	},
7590 	[ALC271_FIXUP_DMIC] = {
7591 		.type = HDA_FIXUP_FUNC,
7592 		.v.func = alc271_fixup_dmic,
7593 	},
7594 	[ALC269_FIXUP_PCM_44K] = {
7595 		.type = HDA_FIXUP_FUNC,
7596 		.v.func = alc269_fixup_pcm_44k,
7597 		.chained = true,
7598 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7599 	},
7600 	[ALC269_FIXUP_STEREO_DMIC] = {
7601 		.type = HDA_FIXUP_FUNC,
7602 		.v.func = alc269_fixup_stereo_dmic,
7603 	},
7604 	[ALC269_FIXUP_HEADSET_MIC] = {
7605 		.type = HDA_FIXUP_FUNC,
7606 		.v.func = alc269_fixup_headset_mic,
7607 	},
7608 	[ALC269_FIXUP_QUANTA_MUTE] = {
7609 		.type = HDA_FIXUP_FUNC,
7610 		.v.func = alc269_fixup_quanta_mute,
7611 	},
7612 	[ALC269_FIXUP_LIFEBOOK] = {
7613 		.type = HDA_FIXUP_PINS,
7614 		.v.pins = (const struct hda_pintbl[]) {
7615 			{ 0x1a, 0x2101103f }, /* dock line-out */
7616 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
7617 			{ }
7618 		},
7619 		.chained = true,
7620 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7621 	},
7622 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7623 		.type = HDA_FIXUP_PINS,
7624 		.v.pins = (const struct hda_pintbl[]) {
7625 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7626 			{ }
7627 		},
7628 	},
7629 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7630 		.type = HDA_FIXUP_PINS,
7631 		.v.pins = (const struct hda_pintbl[]) {
7632 			{ 0x21, 0x0221102f }, /* HP out */
7633 			{ }
7634 		},
7635 	},
7636 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7637 		.type = HDA_FIXUP_FUNC,
7638 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7639 	},
7640 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7641 		.type = HDA_FIXUP_FUNC,
7642 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7643 	},
7644 	[ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13] = {
7645 		.type = HDA_FIXUP_PINS,
7646 		.v.pins = (const struct hda_pintbl[]) {
7647 			{ 0x14, 0x90170151 }, /* use as internal speaker (LFE) */
7648 			{ 0x1b, 0x90170152 }, /* use as internal speaker (back) */
7649 			{ }
7650 		},
7651 		.chained = true,
7652 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7653 	},
7654 	[ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
7655 		.type = HDA_FIXUP_PINS,
7656 		.v.pins = (const struct hda_pintbl[]) {
7657 			{ 0x18, 0x03a19020 }, /* headset mic */
7658 			{ 0x1b, 0x90170150 }, /* speaker */
7659 			{ }
7660 		},
7661 	},
7662 	[ALC269_FIXUP_AMIC] = {
7663 		.type = HDA_FIXUP_PINS,
7664 		.v.pins = (const struct hda_pintbl[]) {
7665 			{ 0x14, 0x99130110 }, /* speaker */
7666 			{ 0x15, 0x0121401f }, /* HP out */
7667 			{ 0x18, 0x01a19c20 }, /* mic */
7668 			{ 0x19, 0x99a3092f }, /* int-mic */
7669 			{ }
7670 		},
7671 	},
7672 	[ALC269_FIXUP_DMIC] = {
7673 		.type = HDA_FIXUP_PINS,
7674 		.v.pins = (const struct hda_pintbl[]) {
7675 			{ 0x12, 0x99a3092f }, /* int-mic */
7676 			{ 0x14, 0x99130110 }, /* speaker */
7677 			{ 0x15, 0x0121401f }, /* HP out */
7678 			{ 0x18, 0x01a19c20 }, /* mic */
7679 			{ }
7680 		},
7681 	},
7682 	[ALC269VB_FIXUP_AMIC] = {
7683 		.type = HDA_FIXUP_PINS,
7684 		.v.pins = (const struct hda_pintbl[]) {
7685 			{ 0x14, 0x99130110 }, /* speaker */
7686 			{ 0x18, 0x01a19c20 }, /* mic */
7687 			{ 0x19, 0x99a3092f }, /* int-mic */
7688 			{ 0x21, 0x0121401f }, /* HP out */
7689 			{ }
7690 		},
7691 	},
7692 	[ALC269VB_FIXUP_DMIC] = {
7693 		.type = HDA_FIXUP_PINS,
7694 		.v.pins = (const struct hda_pintbl[]) {
7695 			{ 0x12, 0x99a3092f }, /* int-mic */
7696 			{ 0x14, 0x99130110 }, /* speaker */
7697 			{ 0x18, 0x01a19c20 }, /* mic */
7698 			{ 0x21, 0x0121401f }, /* HP out */
7699 			{ }
7700 		},
7701 	},
7702 	[ALC269_FIXUP_HP_MUTE_LED] = {
7703 		.type = HDA_FIXUP_FUNC,
7704 		.v.func = alc269_fixup_hp_mute_led,
7705 	},
7706 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7707 		.type = HDA_FIXUP_FUNC,
7708 		.v.func = alc269_fixup_hp_mute_led_mic1,
7709 	},
7710 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7711 		.type = HDA_FIXUP_FUNC,
7712 		.v.func = alc269_fixup_hp_mute_led_mic2,
7713 	},
7714 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7715 		.type = HDA_FIXUP_FUNC,
7716 		.v.func = alc269_fixup_hp_mute_led_mic3,
7717 		.chained = true,
7718 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7719 	},
7720 	[ALC269_FIXUP_HP_GPIO_LED] = {
7721 		.type = HDA_FIXUP_FUNC,
7722 		.v.func = alc269_fixup_hp_gpio_led,
7723 	},
7724 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7725 		.type = HDA_FIXUP_FUNC,
7726 		.v.func = alc269_fixup_hp_gpio_mic1_led,
7727 	},
7728 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7729 		.type = HDA_FIXUP_FUNC,
7730 		.v.func = alc269_fixup_hp_line1_mic1_led,
7731 	},
7732 	[ALC269_FIXUP_INV_DMIC] = {
7733 		.type = HDA_FIXUP_FUNC,
7734 		.v.func = alc_fixup_inv_dmic,
7735 	},
7736 	[ALC269_FIXUP_NO_SHUTUP] = {
7737 		.type = HDA_FIXUP_FUNC,
7738 		.v.func = alc_fixup_no_shutup,
7739 	},
7740 	[ALC269_FIXUP_LENOVO_DOCK] = {
7741 		.type = HDA_FIXUP_PINS,
7742 		.v.pins = (const struct hda_pintbl[]) {
7743 			{ 0x19, 0x23a11040 }, /* dock mic */
7744 			{ 0x1b, 0x2121103f }, /* dock headphone */
7745 			{ }
7746 		},
7747 		.chained = true,
7748 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7749 	},
7750 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7751 		.type = HDA_FIXUP_FUNC,
7752 		.v.func = alc269_fixup_limit_int_mic_boost,
7753 		.chained = true,
7754 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
7755 	},
7756 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7757 		.type = HDA_FIXUP_FUNC,
7758 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7759 		.chained = true,
7760 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7761 	},
7762 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7763 		.type = HDA_FIXUP_PINS,
7764 		.v.pins = (const struct hda_pintbl[]) {
7765 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7766 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7767 			{ }
7768 		},
7769 		.chained = true,
7770 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7771 	},
7772 	[ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
7773 		.type = HDA_FIXUP_FUNC,
7774 		.v.func = alc269_fixup_limit_int_mic_boost,
7775 		.chained = true,
7776 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7777 	},
7778 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7779 		.type = HDA_FIXUP_PINS,
7780 		.v.pins = (const struct hda_pintbl[]) {
7781 			{ 0x16, 0x21014020 }, /* dock line out */
7782 			{ 0x19, 0x21a19030 }, /* dock mic */
7783 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7784 			{ }
7785 		},
7786 		.chained = true,
7787 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7788 	},
7789 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7790 		.type = HDA_FIXUP_PINS,
7791 		.v.pins = (const struct hda_pintbl[]) {
7792 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7793 			{ }
7794 		},
7795 		.chained = true,
7796 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7797 	},
7798 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7799 		.type = HDA_FIXUP_PINS,
7800 		.v.pins = (const struct hda_pintbl[]) {
7801 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7802 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7803 			{ }
7804 		},
7805 		.chained = true,
7806 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7807 	},
7808 	[ALC269_FIXUP_HEADSET_MODE] = {
7809 		.type = HDA_FIXUP_FUNC,
7810 		.v.func = alc_fixup_headset_mode,
7811 		.chained = true,
7812 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7813 	},
7814 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7815 		.type = HDA_FIXUP_FUNC,
7816 		.v.func = alc_fixup_headset_mode_no_hp_mic,
7817 	},
7818 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7819 		.type = HDA_FIXUP_PINS,
7820 		.v.pins = (const struct hda_pintbl[]) {
7821 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7822 			{ }
7823 		},
7824 		.chained = true,
7825 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
7826 	},
7827 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7828 		.type = HDA_FIXUP_PINS,
7829 		.v.pins = (const struct hda_pintbl[]) {
7830 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7831 			{ }
7832 		},
7833 		.chained = true,
7834 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7835 	},
7836 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7837 		.type = HDA_FIXUP_PINS,
7838 		.v.pins = (const struct hda_pintbl[]) {
7839 			{0x12, 0x90a60130},
7840 			{0x13, 0x40000000},
7841 			{0x14, 0x90170110},
7842 			{0x18, 0x411111f0},
7843 			{0x19, 0x04a11040},
7844 			{0x1a, 0x411111f0},
7845 			{0x1b, 0x90170112},
7846 			{0x1d, 0x40759a05},
7847 			{0x1e, 0x411111f0},
7848 			{0x21, 0x04211020},
7849 			{ }
7850 		},
7851 		.chained = true,
7852 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7853 	},
7854 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7855 		.type = HDA_FIXUP_FUNC,
7856 		.v.func = alc298_fixup_huawei_mbx_stereo,
7857 		.chained = true,
7858 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7859 	},
7860 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
7861 		.type = HDA_FIXUP_FUNC,
7862 		.v.func = alc269_fixup_x101_headset_mic,
7863 	},
7864 	[ALC269_FIXUP_ASUS_X101_VERB] = {
7865 		.type = HDA_FIXUP_VERBS,
7866 		.v.verbs = (const struct hda_verb[]) {
7867 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7868 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7869 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
7870 			{ }
7871 		},
7872 		.chained = true,
7873 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7874 	},
7875 	[ALC269_FIXUP_ASUS_X101] = {
7876 		.type = HDA_FIXUP_PINS,
7877 		.v.pins = (const struct hda_pintbl[]) {
7878 			{ 0x18, 0x04a1182c }, /* Headset mic */
7879 			{ }
7880 		},
7881 		.chained = true,
7882 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
7883 	},
7884 	[ALC271_FIXUP_AMIC_MIC2] = {
7885 		.type = HDA_FIXUP_PINS,
7886 		.v.pins = (const struct hda_pintbl[]) {
7887 			{ 0x14, 0x99130110 }, /* speaker */
7888 			{ 0x19, 0x01a19c20 }, /* mic */
7889 			{ 0x1b, 0x99a7012f }, /* int-mic */
7890 			{ 0x21, 0x0121401f }, /* HP out */
7891 			{ }
7892 		},
7893 	},
7894 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7895 		.type = HDA_FIXUP_FUNC,
7896 		.v.func = alc271_hp_gate_mic_jack,
7897 		.chained = true,
7898 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
7899 	},
7900 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7901 		.type = HDA_FIXUP_FUNC,
7902 		.v.func = alc269_fixup_limit_int_mic_boost,
7903 		.chained = true,
7904 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7905 	},
7906 	[ALC269_FIXUP_ACER_AC700] = {
7907 		.type = HDA_FIXUP_PINS,
7908 		.v.pins = (const struct hda_pintbl[]) {
7909 			{ 0x12, 0x99a3092f }, /* int-mic */
7910 			{ 0x14, 0x99130110 }, /* speaker */
7911 			{ 0x18, 0x03a11c20 }, /* mic */
7912 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
7913 			{ 0x21, 0x0321101f }, /* HP out */
7914 			{ }
7915 		},
7916 		.chained = true,
7917 		.chain_id = ALC271_FIXUP_DMIC,
7918 	},
7919 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7920 		.type = HDA_FIXUP_FUNC,
7921 		.v.func = alc269_fixup_limit_int_mic_boost,
7922 		.chained = true,
7923 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7924 	},
7925 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7926 		.type = HDA_FIXUP_FUNC,
7927 		.v.func = alc269_fixup_limit_int_mic_boost,
7928 		.chained = true,
7929 		.chain_id = ALC269VB_FIXUP_DMIC,
7930 	},
7931 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7932 		.type = HDA_FIXUP_VERBS,
7933 		.v.verbs = (const struct hda_verb[]) {
7934 			/* class-D output amp +5dB */
7935 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7936 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7937 			{}
7938 		},
7939 		.chained = true,
7940 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7941 	},
7942 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7943 		.type = HDA_FIXUP_PINS,
7944 		.v.pins = (const struct hda_pintbl[]) {
7945 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
7946 			{ }
7947 		},
7948 		.chained = true,
7949 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7950 	},
7951 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7952 		.type = HDA_FIXUP_FUNC,
7953 		.v.func = alc269_fixup_limit_int_mic_boost,
7954 		.chained = true,
7955 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7956 	},
7957 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7958 		.type = HDA_FIXUP_PINS,
7959 		.v.pins = (const struct hda_pintbl[]) {
7960 			{ 0x12, 0x99a3092f }, /* int-mic */
7961 			{ 0x18, 0x03a11d20 }, /* mic */
7962 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
7963 			{ }
7964 		},
7965 	},
7966 	[ALC283_FIXUP_CHROME_BOOK] = {
7967 		.type = HDA_FIXUP_FUNC,
7968 		.v.func = alc283_fixup_chromebook,
7969 	},
7970 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
7971 		.type = HDA_FIXUP_FUNC,
7972 		.v.func = alc283_fixup_sense_combo_jack,
7973 		.chained = true,
7974 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
7975 	},
7976 	[ALC282_FIXUP_ASUS_TX300] = {
7977 		.type = HDA_FIXUP_FUNC,
7978 		.v.func = alc282_fixup_asus_tx300,
7979 	},
7980 	[ALC283_FIXUP_INT_MIC] = {
7981 		.type = HDA_FIXUP_VERBS,
7982 		.v.verbs = (const struct hda_verb[]) {
7983 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7984 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7985 			{ }
7986 		},
7987 		.chained = true,
7988 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7989 	},
7990 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7991 		.type = HDA_FIXUP_PINS,
7992 		.v.pins = (const struct hda_pintbl[]) {
7993 			{ 0x17, 0x90170112 }, /* subwoofer */
7994 			{ }
7995 		},
7996 		.chained = true,
7997 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7998 	},
7999 	[ALC290_FIXUP_SUBWOOFER] = {
8000 		.type = HDA_FIXUP_PINS,
8001 		.v.pins = (const struct hda_pintbl[]) {
8002 			{ 0x17, 0x90170112 }, /* subwoofer */
8003 			{ }
8004 		},
8005 		.chained = true,
8006 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
8007 	},
8008 	[ALC290_FIXUP_MONO_SPEAKERS] = {
8009 		.type = HDA_FIXUP_FUNC,
8010 		.v.func = alc290_fixup_mono_speakers,
8011 	},
8012 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8013 		.type = HDA_FIXUP_FUNC,
8014 		.v.func = alc290_fixup_mono_speakers,
8015 		.chained = true,
8016 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8017 	},
8018 	[ALC269_FIXUP_THINKPAD_ACPI] = {
8019 		.type = HDA_FIXUP_FUNC,
8020 		.v.func = alc_fixup_thinkpad_acpi,
8021 		.chained = true,
8022 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
8023 	},
8024 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8025 		.type = HDA_FIXUP_FUNC,
8026 		.v.func = alc_fixup_inv_dmic,
8027 		.chained = true,
8028 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8029 	},
8030 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8031 		.type = HDA_FIXUP_PINS,
8032 		.v.pins = (const struct hda_pintbl[]) {
8033 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8034 			{ }
8035 		},
8036 		.chained = true,
8037 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8038 	},
8039 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8040 		.type = HDA_FIXUP_PINS,
8041 		.v.pins = (const struct hda_pintbl[]) {
8042 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8043 			{ }
8044 		},
8045 		.chained = true,
8046 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8047 	},
8048 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8049 		.type = HDA_FIXUP_PINS,
8050 		.v.pins = (const struct hda_pintbl[]) {
8051 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8052 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8053 			{ }
8054 		},
8055 		.chained = true,
8056 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8057 	},
8058 	[ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8059 		.type = HDA_FIXUP_FUNC,
8060 		.v.func = alc269_fixup_limit_int_mic_boost,
8061 		.chained = true,
8062 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8063 	},
8064 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8065 		.type = HDA_FIXUP_PINS,
8066 		.v.pins = (const struct hda_pintbl[]) {
8067 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8068 			{ }
8069 		},
8070 		.chained = true,
8071 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8072 	},
8073 	[ALC255_FIXUP_HEADSET_MODE] = {
8074 		.type = HDA_FIXUP_FUNC,
8075 		.v.func = alc_fixup_headset_mode_alc255,
8076 		.chained = true,
8077 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8078 	},
8079 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8080 		.type = HDA_FIXUP_FUNC,
8081 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8082 	},
8083 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8084 		.type = HDA_FIXUP_PINS,
8085 		.v.pins = (const struct hda_pintbl[]) {
8086 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8087 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8088 			{ }
8089 		},
8090 		.chained = true,
8091 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8092 	},
8093 	[ALC292_FIXUP_TPT440_DOCK] = {
8094 		.type = HDA_FIXUP_FUNC,
8095 		.v.func = alc_fixup_tpt440_dock,
8096 		.chained = true,
8097 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8098 	},
8099 	[ALC292_FIXUP_TPT440] = {
8100 		.type = HDA_FIXUP_FUNC,
8101 		.v.func = alc_fixup_disable_aamix,
8102 		.chained = true,
8103 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
8104 	},
8105 	[ALC283_FIXUP_HEADSET_MIC] = {
8106 		.type = HDA_FIXUP_PINS,
8107 		.v.pins = (const struct hda_pintbl[]) {
8108 			{ 0x19, 0x04a110f0 },
8109 			{ },
8110 		},
8111 	},
8112 	[ALC255_FIXUP_MIC_MUTE_LED] = {
8113 		.type = HDA_FIXUP_FUNC,
8114 		.v.func = alc_fixup_micmute_led,
8115 	},
8116 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
8117 		.type = HDA_FIXUP_PINS,
8118 		.v.pins = (const struct hda_pintbl[]) {
8119 			{ 0x12, 0x90a60130 },
8120 			{ 0x14, 0x90170110 },
8121 			{ 0x17, 0x40000008 },
8122 			{ 0x18, 0x411111f0 },
8123 			{ 0x19, 0x01a1913c },
8124 			{ 0x1a, 0x411111f0 },
8125 			{ 0x1b, 0x411111f0 },
8126 			{ 0x1d, 0x40f89b2d },
8127 			{ 0x1e, 0x411111f0 },
8128 			{ 0x21, 0x0321101f },
8129 			{ },
8130 		},
8131 	},
8132 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8133 		.type = HDA_FIXUP_FUNC,
8134 		.v.func = alc269vb_fixup_aspire_e1_coef,
8135 	},
8136 	[ALC280_FIXUP_HP_GPIO4] = {
8137 		.type = HDA_FIXUP_FUNC,
8138 		.v.func = alc280_fixup_hp_gpio4,
8139 	},
8140 	[ALC286_FIXUP_HP_GPIO_LED] = {
8141 		.type = HDA_FIXUP_FUNC,
8142 		.v.func = alc286_fixup_hp_gpio_led,
8143 	},
8144 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8145 		.type = HDA_FIXUP_FUNC,
8146 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8147 	},
8148 	[ALC280_FIXUP_HP_DOCK_PINS] = {
8149 		.type = HDA_FIXUP_PINS,
8150 		.v.pins = (const struct hda_pintbl[]) {
8151 			{ 0x1b, 0x21011020 }, /* line-out */
8152 			{ 0x1a, 0x01a1903c }, /* headset mic */
8153 			{ 0x18, 0x2181103f }, /* line-in */
8154 			{ },
8155 		},
8156 		.chained = true,
8157 		.chain_id = ALC280_FIXUP_HP_GPIO4
8158 	},
8159 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8160 		.type = HDA_FIXUP_PINS,
8161 		.v.pins = (const struct hda_pintbl[]) {
8162 			{ 0x1b, 0x21011020 }, /* line-out */
8163 			{ 0x18, 0x2181103f }, /* line-in */
8164 			{ },
8165 		},
8166 		.chained = true,
8167 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8168 	},
8169 	[ALC280_FIXUP_HP_9480M] = {
8170 		.type = HDA_FIXUP_FUNC,
8171 		.v.func = alc280_fixup_hp_9480m,
8172 	},
8173 	[ALC245_FIXUP_HP_X360_AMP] = {
8174 		.type = HDA_FIXUP_FUNC,
8175 		.v.func = alc245_fixup_hp_x360_amp,
8176 		.chained = true,
8177 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
8178 	},
8179 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
8180 		.type = HDA_FIXUP_FUNC,
8181 		.v.func = alc_fixup_headset_mode_dell_alc288,
8182 		.chained = true,
8183 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8184 	},
8185 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8186 		.type = HDA_FIXUP_PINS,
8187 		.v.pins = (const struct hda_pintbl[]) {
8188 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8189 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8190 			{ }
8191 		},
8192 		.chained = true,
8193 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8194 	},
8195 	[ALC288_FIXUP_DISABLE_AAMIX] = {
8196 		.type = HDA_FIXUP_FUNC,
8197 		.v.func = alc_fixup_disable_aamix,
8198 		.chained = true,
8199 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8200 	},
8201 	[ALC288_FIXUP_DELL_XPS_13] = {
8202 		.type = HDA_FIXUP_FUNC,
8203 		.v.func = alc_fixup_dell_xps13,
8204 		.chained = true,
8205 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
8206 	},
8207 	[ALC292_FIXUP_DISABLE_AAMIX] = {
8208 		.type = HDA_FIXUP_FUNC,
8209 		.v.func = alc_fixup_disable_aamix,
8210 		.chained = true,
8211 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8212 	},
8213 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8214 		.type = HDA_FIXUP_FUNC,
8215 		.v.func = alc_fixup_disable_aamix,
8216 		.chained = true,
8217 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8218 	},
8219 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
8220 		.type = HDA_FIXUP_FUNC,
8221 		.v.func = alc_fixup_dell_xps13,
8222 		.chained = true,
8223 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
8224 	},
8225 	[ALC292_FIXUP_DELL_E7X] = {
8226 		.type = HDA_FIXUP_FUNC,
8227 		.v.func = alc_fixup_micmute_led,
8228 		/* micmute fixup must be applied at last */
8229 		.chained_before = true,
8230 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8231 	},
8232 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8233 		.type = HDA_FIXUP_PINS,
8234 		.v.pins = (const struct hda_pintbl[]) {
8235 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8236 			{ }
8237 		},
8238 		.chained_before = true,
8239 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8240 	},
8241 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8242 		.type = HDA_FIXUP_PINS,
8243 		.v.pins = (const struct hda_pintbl[]) {
8244 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8245 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8246 			{ }
8247 		},
8248 		.chained = true,
8249 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8250 	},
8251 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8252 		.type = HDA_FIXUP_PINS,
8253 		.v.pins = (const struct hda_pintbl[]) {
8254 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8255 			{ }
8256 		},
8257 		.chained = true,
8258 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8259 	},
8260 	[ALC275_FIXUP_DELL_XPS] = {
8261 		.type = HDA_FIXUP_VERBS,
8262 		.v.verbs = (const struct hda_verb[]) {
8263 			/* Enables internal speaker */
8264 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8265 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8266 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8267 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8268 			{}
8269 		}
8270 	},
8271 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8272 		.type = HDA_FIXUP_FUNC,
8273 		.v.func = alc_fixup_disable_aamix,
8274 		.chained = true,
8275 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8276 	},
8277 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8278 		.type = HDA_FIXUP_FUNC,
8279 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8280 	},
8281 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8282 		.type = HDA_FIXUP_FUNC,
8283 		.v.func = alc_fixup_inv_dmic,
8284 		.chained = true,
8285 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8286 	},
8287 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8288 		.type = HDA_FIXUP_FUNC,
8289 		.v.func = alc269_fixup_limit_int_mic_boost
8290 	},
8291 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
8292 		.type = HDA_FIXUP_FUNC,
8293 		.v.func = alc_fixup_disable_aamix,
8294 		.chained = true,
8295 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8296 	},
8297 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
8298 		.type = HDA_FIXUP_FUNC,
8299 		.v.func = alc_fixup_disable_mic_vref,
8300 		.chained = true,
8301 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8302 	},
8303 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8304 		.type = HDA_FIXUP_VERBS,
8305 		.v.verbs = (const struct hda_verb[]) {
8306 			/* Disable pass-through path for FRONT 14h */
8307 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8308 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8309 			{}
8310 		},
8311 		.chained = true,
8312 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8313 	},
8314 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
8315 		.type = HDA_FIXUP_FUNC,
8316 		.v.func = alc_fixup_disable_aamix,
8317 		.chained = true,
8318 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
8319 	},
8320 	[ALC221_FIXUP_HP_FRONT_MIC] = {
8321 		.type = HDA_FIXUP_PINS,
8322 		.v.pins = (const struct hda_pintbl[]) {
8323 			{ 0x19, 0x02a19020 }, /* Front Mic */
8324 			{ }
8325 		},
8326 	},
8327 	[ALC292_FIXUP_TPT460] = {
8328 		.type = HDA_FIXUP_FUNC,
8329 		.v.func = alc_fixup_tpt440_dock,
8330 		.chained = true,
8331 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8332 	},
8333 	[ALC298_FIXUP_SPK_VOLUME] = {
8334 		.type = HDA_FIXUP_FUNC,
8335 		.v.func = alc298_fixup_speaker_volume,
8336 		.chained = true,
8337 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8338 	},
8339 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8340 		.type = HDA_FIXUP_FUNC,
8341 		.v.func = alc298_fixup_speaker_volume,
8342 	},
8343 	[ALC295_FIXUP_DISABLE_DAC3] = {
8344 		.type = HDA_FIXUP_FUNC,
8345 		.v.func = alc295_fixup_disable_dac3,
8346 	},
8347 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8348 		.type = HDA_FIXUP_FUNC,
8349 		.v.func = alc285_fixup_speaker2_to_dac1,
8350 		.chained = true,
8351 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8352 	},
8353 	[ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8354 		.type = HDA_FIXUP_FUNC,
8355 		.v.func = alc285_fixup_speaker2_to_dac1,
8356 		.chained = true,
8357 		.chain_id = ALC245_FIXUP_CS35L41_SPI_2
8358 	},
8359 	[ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8360 		.type = HDA_FIXUP_PINS,
8361 		.v.pins = (const struct hda_pintbl[]) {
8362 			{ 0x19, 0x03a11050 },
8363 			{ 0x1b, 0x03a11c30 },
8364 			{ }
8365 		},
8366 		.chained = true,
8367 		.chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8368 	},
8369 	[ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8370 		.type = HDA_FIXUP_PINS,
8371 		.v.pins = (const struct hda_pintbl[]) {
8372 			{ 0x14, 0x90170120 },
8373 			{ }
8374 		},
8375 		.chained = true,
8376 		.chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8377 	},
8378 	[ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8379 		.type = HDA_FIXUP_FUNC,
8380 		.v.func = alc285_fixup_speaker2_to_dac1,
8381 		.chained = true,
8382 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2
8383 	},
8384 	[ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8385 		.type = HDA_FIXUP_PINS,
8386 		.v.pins = (const struct hda_pintbl[]) {
8387 			{ 0x19, 0x03a11050 },
8388 			{ 0x1b, 0x03a11c30 },
8389 			{ }
8390 		},
8391 		.chained = true,
8392 		.chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8393 	},
8394 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8395 		.type = HDA_FIXUP_PINS,
8396 		.v.pins = (const struct hda_pintbl[]) {
8397 			{ 0x1b, 0x90170151 },
8398 			{ }
8399 		},
8400 		.chained = true,
8401 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8402 	},
8403 	[ALC269_FIXUP_ATIV_BOOK_8] = {
8404 		.type = HDA_FIXUP_FUNC,
8405 		.v.func = alc_fixup_auto_mute_via_amp,
8406 		.chained = true,
8407 		.chain_id = ALC269_FIXUP_NO_SHUTUP
8408 	},
8409 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8410 		.type = HDA_FIXUP_PINS,
8411 		.v.pins = (const struct hda_pintbl[]) {
8412 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8413 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8414 			{ }
8415 		},
8416 		.chained = true,
8417 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8418 	},
8419 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8420 		.type = HDA_FIXUP_PINS,
8421 		.v.pins = (const struct hda_pintbl[]) {
8422 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8423 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8424 			{ }
8425 		},
8426 		.chained = true,
8427 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8428 	},
8429 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8430 		.type = HDA_FIXUP_FUNC,
8431 		.v.func = alc_fixup_headset_mode,
8432 	},
8433 	[ALC256_FIXUP_ASUS_MIC] = {
8434 		.type = HDA_FIXUP_PINS,
8435 		.v.pins = (const struct hda_pintbl[]) {
8436 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8437 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8438 			{ }
8439 		},
8440 		.chained = true,
8441 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8442 	},
8443 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8444 		.type = HDA_FIXUP_FUNC,
8445 		/* Set up GPIO2 for the speaker amp */
8446 		.v.func = alc_fixup_gpio4,
8447 	},
8448 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8449 		.type = HDA_FIXUP_PINS,
8450 		.v.pins = (const struct hda_pintbl[]) {
8451 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8452 			{ }
8453 		},
8454 		.chained = true,
8455 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8456 	},
8457 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8458 		.type = HDA_FIXUP_VERBS,
8459 		.v.verbs = (const struct hda_verb[]) {
8460 			/* Enables internal speaker */
8461 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8462 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8463 			{}
8464 		},
8465 		.chained = true,
8466 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8467 	},
8468 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8469 		.type = HDA_FIXUP_FUNC,
8470 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8471 		.chained = true,
8472 		.chain_id = ALC269_FIXUP_GPIO2
8473 	},
8474 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
8475 		.type = HDA_FIXUP_VERBS,
8476 		.v.verbs = (const struct hda_verb[]) {
8477 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8478 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8479 			{ }
8480 		},
8481 		.chained = true,
8482 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8483 	},
8484 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8485 		.type = HDA_FIXUP_PINS,
8486 		.v.pins = (const struct hda_pintbl[]) {
8487 			/* Change the mic location from front to right, otherwise there are
8488 			   two front mics with the same name, pulseaudio can't handle them.
8489 			   This is just a temporary workaround, after applying this fixup,
8490 			   there will be one "Front Mic" and one "Mic" in this machine.
8491 			 */
8492 			{ 0x1a, 0x04a19040 },
8493 			{ }
8494 		},
8495 	},
8496 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8497 		.type = HDA_FIXUP_PINS,
8498 		.v.pins = (const struct hda_pintbl[]) {
8499 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
8500 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8501 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8502 			{ 0x1b, 0x02011020 },
8503 			{ }
8504 		},
8505 		.chained = true,
8506 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
8507 	},
8508 	[ALC225_FIXUP_S3_POP_NOISE] = {
8509 		.type = HDA_FIXUP_FUNC,
8510 		.v.func = alc225_fixup_s3_pop_noise,
8511 		.chained = true,
8512 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8513 	},
8514 	[ALC700_FIXUP_INTEL_REFERENCE] = {
8515 		.type = HDA_FIXUP_VERBS,
8516 		.v.verbs = (const struct hda_verb[]) {
8517 			/* Enables internal speaker */
8518 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8519 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8520 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8521 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8522 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8523 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8524 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8525 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8526 			{}
8527 		}
8528 	},
8529 	[ALC274_FIXUP_DELL_BIND_DACS] = {
8530 		.type = HDA_FIXUP_FUNC,
8531 		.v.func = alc274_fixup_bind_dacs,
8532 		.chained = true,
8533 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8534 	},
8535 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8536 		.type = HDA_FIXUP_PINS,
8537 		.v.pins = (const struct hda_pintbl[]) {
8538 			{ 0x1b, 0x0401102f },
8539 			{ }
8540 		},
8541 		.chained = true,
8542 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
8543 	},
8544 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
8545 		.type = HDA_FIXUP_FUNC,
8546 		.v.func = alc_fixup_tpt470_dock,
8547 		.chained = true,
8548 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8549 	},
8550 	[ALC298_FIXUP_TPT470_DOCK] = {
8551 		.type = HDA_FIXUP_FUNC,
8552 		.v.func = alc_fixup_tpt470_dacs,
8553 		.chained = true,
8554 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8555 	},
8556 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8557 		.type = HDA_FIXUP_PINS,
8558 		.v.pins = (const struct hda_pintbl[]) {
8559 			{ 0x14, 0x0201101f },
8560 			{ }
8561 		},
8562 		.chained = true,
8563 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8564 	},
8565 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
8566 		.type = HDA_FIXUP_PINS,
8567 		.v.pins = (const struct hda_pintbl[]) {
8568 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8569 			{ }
8570 		},
8571 		.chained = true,
8572 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8573 	},
8574 	[ALC295_FIXUP_HP_X360] = {
8575 		.type = HDA_FIXUP_FUNC,
8576 		.v.func = alc295_fixup_hp_top_speakers,
8577 		.chained = true,
8578 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8579 	},
8580 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
8581 		.type = HDA_FIXUP_PINS,
8582 		.v.pins = (const struct hda_pintbl[]) {
8583 			{ 0x19, 0x0181313f},
8584 			{ }
8585 		},
8586 		.chained = true,
8587 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8588 	},
8589 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8590 		.type = HDA_FIXUP_FUNC,
8591 		.v.func = alc285_fixup_invalidate_dacs,
8592 		.chained = true,
8593 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8594 	},
8595 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
8596 		.type = HDA_FIXUP_FUNC,
8597 		.v.func = alc_fixup_auto_mute_via_amp,
8598 	},
8599 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8600 		.type = HDA_FIXUP_PINS,
8601 		.v.pins = (const struct hda_pintbl[]) {
8602 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8603 			{ }
8604 		},
8605 		.chained = true,
8606 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8607 	},
8608 	[ALC294_FIXUP_ASUS_MIC] = {
8609 		.type = HDA_FIXUP_PINS,
8610 		.v.pins = (const struct hda_pintbl[]) {
8611 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8612 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8613 			{ }
8614 		},
8615 		.chained = true,
8616 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8617 	},
8618 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8619 		.type = HDA_FIXUP_PINS,
8620 		.v.pins = (const struct hda_pintbl[]) {
8621 			{ 0x19, 0x01a1103c }, /* use as headset mic */
8622 			{ }
8623 		},
8624 		.chained = true,
8625 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8626 	},
8627 	[ALC294_FIXUP_ASUS_SPK] = {
8628 		.type = HDA_FIXUP_VERBS,
8629 		.v.verbs = (const struct hda_verb[]) {
8630 			/* Set EAPD high */
8631 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8632 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8633 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8634 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8635 			{ }
8636 		},
8637 		.chained = true,
8638 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8639 	},
8640 	[ALC295_FIXUP_CHROME_BOOK] = {
8641 		.type = HDA_FIXUP_FUNC,
8642 		.v.func = alc295_fixup_chromebook,
8643 		.chained = true,
8644 		.chain_id = ALC225_FIXUP_HEADSET_JACK
8645 	},
8646 	[ALC225_FIXUP_HEADSET_JACK] = {
8647 		.type = HDA_FIXUP_FUNC,
8648 		.v.func = alc_fixup_headset_jack,
8649 	},
8650 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8651 		.type = HDA_FIXUP_PINS,
8652 		.v.pins = (const struct hda_pintbl[]) {
8653 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8654 			{ }
8655 		},
8656 		.chained = true,
8657 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8658 	},
8659 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8660 		.type = HDA_FIXUP_VERBS,
8661 		.v.verbs = (const struct hda_verb[]) {
8662 			/* Disable PCBEEP-IN passthrough */
8663 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8664 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8665 			{ }
8666 		},
8667 		.chained = true,
8668 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8669 	},
8670 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
8671 		.type = HDA_FIXUP_PINS,
8672 		.v.pins = (const struct hda_pintbl[]) {
8673 			{ 0x19, 0x03a11130 },
8674 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
8675 			{ }
8676 		},
8677 		.chained = true,
8678 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8679 	},
8680 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8681 		.type = HDA_FIXUP_PINS,
8682 		.v.pins = (const struct hda_pintbl[]) {
8683 			{ 0x16, 0x01011020 }, /* Rear Line out */
8684 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8685 			{ }
8686 		},
8687 		.chained = true,
8688 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8689 	},
8690 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8691 		.type = HDA_FIXUP_FUNC,
8692 		.v.func = alc_fixup_auto_mute_via_amp,
8693 		.chained = true,
8694 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8695 	},
8696 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8697 		.type = HDA_FIXUP_FUNC,
8698 		.v.func = alc_fixup_disable_mic_vref,
8699 		.chained = true,
8700 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8701 	},
8702 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8703 		.type = HDA_FIXUP_VERBS,
8704 		.v.verbs = (const struct hda_verb[]) {
8705 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8706 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8707 			{ }
8708 		},
8709 		.chained = true,
8710 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8711 	},
8712 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8713 		.type = HDA_FIXUP_PINS,
8714 		.v.pins = (const struct hda_pintbl[]) {
8715 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
8716 			{ }
8717 		},
8718 		.chained = true,
8719 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8720 	},
8721 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8722 		.type = HDA_FIXUP_PINS,
8723 		.v.pins = (const struct hda_pintbl[]) {
8724 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8725 			{ }
8726 		},
8727 		.chained = true,
8728 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8729 	},
8730 	[ALC255_FIXUP_PREDATOR_SUBWOOFER] = {
8731 		.type = HDA_FIXUP_PINS,
8732 		.v.pins = (const struct hda_pintbl[]) {
8733 			{ 0x17, 0x90170151 }, /* use as internal speaker (LFE) */
8734 			{ 0x1b, 0x90170152 } /* use as internal speaker (back) */
8735 		}
8736 	},
8737 	[ALC299_FIXUP_PREDATOR_SPK] = {
8738 		.type = HDA_FIXUP_PINS,
8739 		.v.pins = (const struct hda_pintbl[]) {
8740 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8741 			{ }
8742 		}
8743 	},
8744 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8745 		.type = HDA_FIXUP_PINS,
8746 		.v.pins = (const struct hda_pintbl[]) {
8747 			{ 0x19, 0x04a11040 },
8748 			{ 0x21, 0x04211020 },
8749 			{ }
8750 		},
8751 		.chained = true,
8752 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8753 	},
8754 	[ALC289_FIXUP_DELL_SPK1] = {
8755 		.type = HDA_FIXUP_PINS,
8756 		.v.pins = (const struct hda_pintbl[]) {
8757 			{ 0x14, 0x90170140 },
8758 			{ }
8759 		},
8760 		.chained = true,
8761 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8762 	},
8763 	[ALC289_FIXUP_DELL_SPK2] = {
8764 		.type = HDA_FIXUP_PINS,
8765 		.v.pins = (const struct hda_pintbl[]) {
8766 			{ 0x17, 0x90170130 }, /* bass spk */
8767 			{ }
8768 		},
8769 		.chained = true,
8770 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8771 	},
8772 	[ALC289_FIXUP_DUAL_SPK] = {
8773 		.type = HDA_FIXUP_FUNC,
8774 		.v.func = alc285_fixup_speaker2_to_dac1,
8775 		.chained = true,
8776 		.chain_id = ALC289_FIXUP_DELL_SPK2
8777 	},
8778 	[ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
8779 		.type = HDA_FIXUP_FUNC,
8780 		.v.func = alc285_fixup_speaker2_to_dac1,
8781 		.chained = true,
8782 		.chain_id = ALC289_FIXUP_DELL_SPK1
8783 	},
8784 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
8785 		.type = HDA_FIXUP_FUNC,
8786 		.v.func = alc285_fixup_speaker2_to_dac1,
8787 		.chained = true,
8788 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8789 	},
8790 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
8791 		.type = HDA_FIXUP_FUNC,
8792 		/* The GPIO must be pulled to initialize the AMP */
8793 		.v.func = alc_fixup_gpio4,
8794 		.chained = true,
8795 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8796 	},
8797 	[ALC294_FIXUP_ASUS_ALLY] = {
8798 		.type = HDA_FIXUP_FUNC,
8799 		.v.func = cs35l41_fixup_i2c_two,
8800 		.chained = true,
8801 		.chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
8802 	},
8803 	[ALC294_FIXUP_ASUS_ALLY_PINS] = {
8804 		.type = HDA_FIXUP_PINS,
8805 		.v.pins = (const struct hda_pintbl[]) {
8806 			{ 0x19, 0x03a11050 },
8807 			{ 0x1a, 0x03a11c30 },
8808 			{ 0x21, 0x03211420 },
8809 			{ }
8810 		},
8811 		.chained = true,
8812 		.chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
8813 	},
8814 	[ALC294_FIXUP_ASUS_ALLY_VERBS] = {
8815 		.type = HDA_FIXUP_VERBS,
8816 		.v.verbs = (const struct hda_verb[]) {
8817 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8818 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8819 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
8820 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
8821 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
8822 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
8823 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
8824 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
8825 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
8826 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
8827 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
8828 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
8829 			{ }
8830 		},
8831 		.chained = true,
8832 		.chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
8833 	},
8834 	[ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
8835 		.type = HDA_FIXUP_FUNC,
8836 		.v.func = alc285_fixup_speaker2_to_dac1,
8837 	},
8838 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8839 		.type = HDA_FIXUP_FUNC,
8840 		.v.func = alc285_fixup_thinkpad_x1_gen7,
8841 		.chained = true,
8842 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8843 	},
8844 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8845 		.type = HDA_FIXUP_FUNC,
8846 		.v.func = alc_fixup_headset_jack,
8847 		.chained = true,
8848 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8849 	},
8850 	[ALC294_FIXUP_ASUS_HPE] = {
8851 		.type = HDA_FIXUP_VERBS,
8852 		.v.verbs = (const struct hda_verb[]) {
8853 			/* Set EAPD high */
8854 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8855 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8856 			{ }
8857 		},
8858 		.chained = true,
8859 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8860 	},
8861 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
8862 		.type = HDA_FIXUP_PINS,
8863 		.v.pins = (const struct hda_pintbl[]) {
8864 			{ 0x19, 0x03a11050 }, /* front HP mic */
8865 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8866 			{ 0x21, 0x03211020 }, /* front HP out */
8867 			{ }
8868 		},
8869 		.chained = true,
8870 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8871 	},
8872 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
8873 		.type = HDA_FIXUP_VERBS,
8874 		.v.verbs = (const struct hda_verb[]) {
8875 			/* set 0x15 to HP-OUT ctrl */
8876 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8877 			/* unmute the 0x15 amp */
8878 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8879 			{ }
8880 		},
8881 		.chained = true,
8882 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
8883 	},
8884 	[ALC294_FIXUP_ASUS_GX502_HP] = {
8885 		.type = HDA_FIXUP_FUNC,
8886 		.v.func = alc294_fixup_gx502_hp,
8887 	},
8888 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
8889 		.type = HDA_FIXUP_PINS,
8890 		.v.pins = (const struct hda_pintbl[]) {
8891 			{ 0x19, 0x01a11050 }, /* rear HP mic */
8892 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8893 			{ 0x21, 0x012110f0 }, /* rear HP out */
8894 			{ }
8895 		},
8896 		.chained = true,
8897 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8898 	},
8899 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
8900 		.type = HDA_FIXUP_VERBS,
8901 		.v.verbs = (const struct hda_verb[]) {
8902 			/* set 0x15 to HP-OUT ctrl */
8903 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8904 			/* unmute the 0x15 amp */
8905 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8906 			/* set 0x1b to HP-OUT */
8907 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8908 			{ }
8909 		},
8910 		.chained = true,
8911 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
8912 	},
8913 	[ALC294_FIXUP_ASUS_GU502_HP] = {
8914 		.type = HDA_FIXUP_FUNC,
8915 		.v.func = alc294_fixup_gu502_hp,
8916 	},
8917 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
8918 		.type = HDA_FIXUP_PINS,
8919 		.v.pins = (const struct hda_pintbl[]) {
8920 				{ 0x19, 0x03a11050 }, /* front HP mic */
8921 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
8922 				{ 0x21, 0x03211420 }, /* front HP out */
8923 				{ }
8924 		},
8925 	},
8926 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
8927 		.type = HDA_FIXUP_PINS,
8928 		.v.pins = (const struct hda_pintbl[]) {
8929 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
8930 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
8931 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
8932 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
8933 			{ 0x21, 0x03211420 },
8934 			{ }
8935 		},
8936 	},
8937 	[ALC294_FIXUP_ASUS_COEF_1B] = {
8938 		.type = HDA_FIXUP_VERBS,
8939 		.v.verbs = (const struct hda_verb[]) {
8940 			/* Set bit 10 to correct noisy output after reboot from
8941 			 * Windows 10 (due to pop noise reduction?)
8942 			 */
8943 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8944 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8945 			{ }
8946 		},
8947 		.chained = true,
8948 		.chain_id = ALC289_FIXUP_ASUS_GA401,
8949 	},
8950 	[ALC285_FIXUP_HP_GPIO_LED] = {
8951 		.type = HDA_FIXUP_FUNC,
8952 		.v.func = alc285_fixup_hp_gpio_led,
8953 	},
8954 	[ALC285_FIXUP_HP_MUTE_LED] = {
8955 		.type = HDA_FIXUP_FUNC,
8956 		.v.func = alc285_fixup_hp_mute_led,
8957 	},
8958 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
8959 		.type = HDA_FIXUP_FUNC,
8960 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
8961 	},
8962 	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
8963 	    .type = HDA_FIXUP_FUNC,
8964 	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
8965 	},
8966 	[ALC236_FIXUP_HP_GPIO_LED] = {
8967 		.type = HDA_FIXUP_FUNC,
8968 		.v.func = alc236_fixup_hp_gpio_led,
8969 	},
8970 	[ALC236_FIXUP_HP_MUTE_LED] = {
8971 		.type = HDA_FIXUP_FUNC,
8972 		.v.func = alc236_fixup_hp_mute_led,
8973 	},
8974 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8975 		.type = HDA_FIXUP_FUNC,
8976 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
8977 	},
8978 	[ALC236_FIXUP_LENOVO_INV_DMIC] = {
8979 		.type = HDA_FIXUP_FUNC,
8980 		.v.func = alc_fixup_inv_dmic,
8981 		.chained = true,
8982 		.chain_id = ALC283_FIXUP_INT_MIC,
8983 	},
8984 	[ALC298_FIXUP_SAMSUNG_AMP] = {
8985 		.type = HDA_FIXUP_FUNC,
8986 		.v.func = alc298_fixup_samsung_amp,
8987 		.chained = true,
8988 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
8989 	},
8990 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8991 		.type = HDA_FIXUP_VERBS,
8992 		.v.verbs = (const struct hda_verb[]) {
8993 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8994 			{ }
8995 		},
8996 	},
8997 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8998 		.type = HDA_FIXUP_VERBS,
8999 		.v.verbs = (const struct hda_verb[]) {
9000 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
9001 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
9002 			{ }
9003 		},
9004 	},
9005 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9006 		.type = HDA_FIXUP_PINS,
9007 		.v.pins = (const struct hda_pintbl[]) {
9008 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9009 			{ }
9010 		},
9011 		.chained = true,
9012 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9013 	},
9014 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
9015 		.type = HDA_FIXUP_PINS,
9016 		.v.pins = (const struct hda_pintbl[]) {
9017 			{ 0x14, 0x90100120 }, /* use as internal speaker */
9018 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
9019 			{ 0x1a, 0x01011020 }, /* use as line out */
9020 			{ },
9021 		},
9022 		.chained = true,
9023 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9024 	},
9025 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9026 		.type = HDA_FIXUP_PINS,
9027 		.v.pins = (const struct hda_pintbl[]) {
9028 			{ 0x18, 0x02a11030 }, /* use as headset mic */
9029 			{ }
9030 		},
9031 		.chained = true,
9032 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9033 	},
9034 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9035 		.type = HDA_FIXUP_PINS,
9036 		.v.pins = (const struct hda_pintbl[]) {
9037 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9038 			{ }
9039 		},
9040 		.chained = true,
9041 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9042 	},
9043 	[ALC289_FIXUP_ASUS_GA401] = {
9044 		.type = HDA_FIXUP_FUNC,
9045 		.v.func = alc289_fixup_asus_ga401,
9046 		.chained = true,
9047 		.chain_id = ALC289_FIXUP_ASUS_GA502,
9048 	},
9049 	[ALC289_FIXUP_ASUS_GA502] = {
9050 		.type = HDA_FIXUP_PINS,
9051 		.v.pins = (const struct hda_pintbl[]) {
9052 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9053 			{ }
9054 		},
9055 	},
9056 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9057 		.type = HDA_FIXUP_PINS,
9058 		.v.pins = (const struct hda_pintbl[]) {
9059 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9060 			{ }
9061 		},
9062 		.chained = true,
9063 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9064 	},
9065 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9066 		.type = HDA_FIXUP_FUNC,
9067 		.v.func = alc285_fixup_hp_gpio_amp_init,
9068 		.chained = true,
9069 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
9070 	},
9071 	[ALC269_FIXUP_CZC_B20] = {
9072 		.type = HDA_FIXUP_PINS,
9073 		.v.pins = (const struct hda_pintbl[]) {
9074 			{ 0x12, 0x411111f0 },
9075 			{ 0x14, 0x90170110 }, /* speaker */
9076 			{ 0x15, 0x032f1020 }, /* HP out */
9077 			{ 0x17, 0x411111f0 },
9078 			{ 0x18, 0x03ab1040 }, /* mic */
9079 			{ 0x19, 0xb7a7013f },
9080 			{ 0x1a, 0x0181305f },
9081 			{ 0x1b, 0x411111f0 },
9082 			{ 0x1d, 0x411111f0 },
9083 			{ 0x1e, 0x411111f0 },
9084 			{ }
9085 		},
9086 		.chain_id = ALC269_FIXUP_DMIC,
9087 	},
9088 	[ALC269_FIXUP_CZC_TMI] = {
9089 		.type = HDA_FIXUP_PINS,
9090 		.v.pins = (const struct hda_pintbl[]) {
9091 			{ 0x12, 0x4000c000 },
9092 			{ 0x14, 0x90170110 }, /* speaker */
9093 			{ 0x15, 0x0421401f }, /* HP out */
9094 			{ 0x17, 0x411111f0 },
9095 			{ 0x18, 0x04a19020 }, /* mic */
9096 			{ 0x19, 0x411111f0 },
9097 			{ 0x1a, 0x411111f0 },
9098 			{ 0x1b, 0x411111f0 },
9099 			{ 0x1d, 0x40448505 },
9100 			{ 0x1e, 0x411111f0 },
9101 			{ 0x20, 0x8000ffff },
9102 			{ }
9103 		},
9104 		.chain_id = ALC269_FIXUP_DMIC,
9105 	},
9106 	[ALC269_FIXUP_CZC_L101] = {
9107 		.type = HDA_FIXUP_PINS,
9108 		.v.pins = (const struct hda_pintbl[]) {
9109 			{ 0x12, 0x40000000 },
9110 			{ 0x14, 0x01014010 }, /* speaker */
9111 			{ 0x15, 0x411111f0 }, /* HP out */
9112 			{ 0x16, 0x411111f0 },
9113 			{ 0x18, 0x01a19020 }, /* mic */
9114 			{ 0x19, 0x02a19021 },
9115 			{ 0x1a, 0x0181302f },
9116 			{ 0x1b, 0x0221401f },
9117 			{ 0x1c, 0x411111f0 },
9118 			{ 0x1d, 0x4044c601 },
9119 			{ 0x1e, 0x411111f0 },
9120 			{ }
9121 		},
9122 		.chain_id = ALC269_FIXUP_DMIC,
9123 	},
9124 	[ALC269_FIXUP_LEMOTE_A1802] = {
9125 		.type = HDA_FIXUP_PINS,
9126 		.v.pins = (const struct hda_pintbl[]) {
9127 			{ 0x12, 0x40000000 },
9128 			{ 0x14, 0x90170110 }, /* speaker */
9129 			{ 0x17, 0x411111f0 },
9130 			{ 0x18, 0x03a19040 }, /* mic1 */
9131 			{ 0x19, 0x90a70130 }, /* mic2 */
9132 			{ 0x1a, 0x411111f0 },
9133 			{ 0x1b, 0x411111f0 },
9134 			{ 0x1d, 0x40489d2d },
9135 			{ 0x1e, 0x411111f0 },
9136 			{ 0x20, 0x0003ffff },
9137 			{ 0x21, 0x03214020 },
9138 			{ }
9139 		},
9140 		.chain_id = ALC269_FIXUP_DMIC,
9141 	},
9142 	[ALC269_FIXUP_LEMOTE_A190X] = {
9143 		.type = HDA_FIXUP_PINS,
9144 		.v.pins = (const struct hda_pintbl[]) {
9145 			{ 0x14, 0x99130110 }, /* speaker */
9146 			{ 0x15, 0x0121401f }, /* HP out */
9147 			{ 0x18, 0x01a19c20 }, /* rear  mic */
9148 			{ 0x19, 0x99a3092f }, /* front mic */
9149 			{ 0x1b, 0x0201401f }, /* front lineout */
9150 			{ }
9151 		},
9152 		.chain_id = ALC269_FIXUP_DMIC,
9153 	},
9154 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9155 		.type = HDA_FIXUP_PINS,
9156 		.v.pins = (const struct hda_pintbl[]) {
9157 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9158 			{ }
9159 		},
9160 		.chained = true,
9161 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9162 	},
9163 	[ALC256_FIXUP_INTEL_NUC10] = {
9164 		.type = HDA_FIXUP_PINS,
9165 		.v.pins = (const struct hda_pintbl[]) {
9166 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9167 			{ }
9168 		},
9169 		.chained = true,
9170 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9171 	},
9172 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9173 		.type = HDA_FIXUP_VERBS,
9174 		.v.verbs = (const struct hda_verb[]) {
9175 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9176 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9177 			{ }
9178 		},
9179 		.chained = true,
9180 		.chain_id = ALC289_FIXUP_ASUS_GA502
9181 	},
9182 	[ALC274_FIXUP_HP_MIC] = {
9183 		.type = HDA_FIXUP_VERBS,
9184 		.v.verbs = (const struct hda_verb[]) {
9185 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9186 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9187 			{ }
9188 		},
9189 	},
9190 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
9191 		.type = HDA_FIXUP_FUNC,
9192 		.v.func = alc274_fixup_hp_headset_mic,
9193 		.chained = true,
9194 		.chain_id = ALC274_FIXUP_HP_MIC
9195 	},
9196 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
9197 		.type = HDA_FIXUP_FUNC,
9198 		.v.func = alc274_fixup_hp_envy_gpio,
9199 	},
9200 	[ALC256_FIXUP_ASUS_HPE] = {
9201 		.type = HDA_FIXUP_VERBS,
9202 		.v.verbs = (const struct hda_verb[]) {
9203 			/* Set EAPD high */
9204 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9205 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9206 			{ }
9207 		},
9208 		.chained = true,
9209 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9210 	},
9211 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9212 		.type = HDA_FIXUP_FUNC,
9213 		.v.func = alc_fixup_headset_jack,
9214 		.chained = true,
9215 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9216 	},
9217 	[ALC287_FIXUP_HP_GPIO_LED] = {
9218 		.type = HDA_FIXUP_FUNC,
9219 		.v.func = alc287_fixup_hp_gpio_led,
9220 	},
9221 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
9222 		.type = HDA_FIXUP_FUNC,
9223 		.v.func = alc274_fixup_hp_headset_mic,
9224 	},
9225 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9226 		.type = HDA_FIXUP_FUNC,
9227 		.v.func = alc_fixup_no_int_mic,
9228 		.chained = true,
9229 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9230 	},
9231 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9232 		.type = HDA_FIXUP_PINS,
9233 		.v.pins = (const struct hda_pintbl[]) {
9234 			{ 0x1b, 0x411111f0 },
9235 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9236 			{ },
9237 		},
9238 		.chained = true,
9239 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9240 	},
9241 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9242 		.type = HDA_FIXUP_FUNC,
9243 		.v.func = alc269_fixup_limit_int_mic_boost,
9244 		.chained = true,
9245 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9246 	},
9247 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
9248 		.type = HDA_FIXUP_PINS,
9249 		.v.pins = (const struct hda_pintbl[]) {
9250 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9251 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
9252 			{ }
9253 		},
9254 		.chained = true,
9255 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9256 	},
9257 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9258 		.type = HDA_FIXUP_FUNC,
9259 		.v.func = alc285_fixup_ideapad_s740_coef,
9260 		.chained = true,
9261 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9262 	},
9263 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9264 		.type = HDA_FIXUP_FUNC,
9265 		.v.func = alc269_fixup_limit_int_mic_boost,
9266 		.chained = true,
9267 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9268 	},
9269 	[ALC295_FIXUP_ASUS_DACS] = {
9270 		.type = HDA_FIXUP_FUNC,
9271 		.v.func = alc295_fixup_asus_dacs,
9272 	},
9273 	[ALC295_FIXUP_HP_OMEN] = {
9274 		.type = HDA_FIXUP_PINS,
9275 		.v.pins = (const struct hda_pintbl[]) {
9276 			{ 0x12, 0xb7a60130 },
9277 			{ 0x13, 0x40000000 },
9278 			{ 0x14, 0x411111f0 },
9279 			{ 0x16, 0x411111f0 },
9280 			{ 0x17, 0x90170110 },
9281 			{ 0x18, 0x411111f0 },
9282 			{ 0x19, 0x02a11030 },
9283 			{ 0x1a, 0x411111f0 },
9284 			{ 0x1b, 0x04a19030 },
9285 			{ 0x1d, 0x40600001 },
9286 			{ 0x1e, 0x411111f0 },
9287 			{ 0x21, 0x03211020 },
9288 			{}
9289 		},
9290 		.chained = true,
9291 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9292 	},
9293 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
9294 		.type = HDA_FIXUP_FUNC,
9295 		.v.func = alc285_fixup_hp_spectre_x360,
9296 	},
9297 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9298 		.type = HDA_FIXUP_FUNC,
9299 		.v.func = alc285_fixup_hp_spectre_x360_eb1
9300 	},
9301 	[ALC285_FIXUP_HP_ENVY_X360] = {
9302 		.type = HDA_FIXUP_FUNC,
9303 		.v.func = alc285_fixup_hp_envy_x360,
9304 		.chained = true,
9305 		.chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9306 	},
9307 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9308 		.type = HDA_FIXUP_FUNC,
9309 		.v.func = alc285_fixup_ideapad_s740_coef,
9310 		.chained = true,
9311 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9312 	},
9313 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9314 		.type = HDA_FIXUP_FUNC,
9315 		.v.func = alc_fixup_no_shutup,
9316 		.chained = true,
9317 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
9318 	},
9319 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9320 		.type = HDA_FIXUP_PINS,
9321 		.v.pins = (const struct hda_pintbl[]) {
9322 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9323 			{ }
9324 		},
9325 		.chained = true,
9326 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9327 	},
9328 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9329 		.type = HDA_FIXUP_FUNC,
9330 		.v.func = alc269_fixup_limit_int_mic_boost,
9331 		.chained = true,
9332 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9333 	},
9334 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9335 		.type = HDA_FIXUP_FUNC,
9336 		.v.func = alc285_fixup_ideapad_s740_coef,
9337 		.chained = true,
9338 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9339 	},
9340 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9341 		.type = HDA_FIXUP_FUNC,
9342 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9343 		.chained = true,
9344 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9345 	},
9346 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9347 		.type = HDA_FIXUP_VERBS,
9348 		//.v.verbs = legion_15imhg05_coefs,
9349 		.v.verbs = (const struct hda_verb[]) {
9350 			 // set left speaker Legion 7i.
9351 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9352 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9353 
9354 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9355 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9356 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9357 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9358 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9359 
9360 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9361 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9362 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9363 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9364 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9365 
9366 			 // set right speaker Legion 7i.
9367 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9368 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9369 
9370 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9371 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9372 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9373 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9374 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9375 
9376 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9377 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9378 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9379 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9380 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9381 			 {}
9382 		},
9383 		.chained = true,
9384 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9385 	},
9386 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9387 		.type = HDA_FIXUP_FUNC,
9388 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9389 		.chained = true,
9390 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9391 	},
9392 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9393 		.type = HDA_FIXUP_VERBS,
9394 		.v.verbs = (const struct hda_verb[]) {
9395 			 // set left speaker Yoga 7i.
9396 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9397 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9398 
9399 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9400 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9401 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9402 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9403 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9404 
9405 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9406 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9407 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9408 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9409 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9410 
9411 			 // set right speaker Yoga 7i.
9412 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9413 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9414 
9415 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9416 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9417 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9418 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9419 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9420 
9421 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9422 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9423 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9424 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9425 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9426 			 {}
9427 		},
9428 		.chained = true,
9429 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9430 	},
9431 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
9432 		.type = HDA_FIXUP_FUNC,
9433 		.v.func = alc298_fixup_lenovo_c940_duet7,
9434 	},
9435 	[ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
9436 		.type = HDA_FIXUP_FUNC,
9437 		.v.func = alc287_fixup_lenovo_14irp8_duetitl,
9438 	},
9439 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9440 		.type = HDA_FIXUP_VERBS,
9441 		.v.verbs = (const struct hda_verb[]) {
9442 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9443 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9444 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9445 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9446 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9447 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9448 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9449 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9450 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9451 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9452 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9453 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9454 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9455 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9456 			{}
9457 		},
9458 		.chained = true,
9459 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9460 	},
9461 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9462 		.type = HDA_FIXUP_FUNC,
9463 		.v.func = alc256_fixup_set_coef_defaults,
9464 	},
9465 	[ALC245_FIXUP_HP_GPIO_LED] = {
9466 		.type = HDA_FIXUP_FUNC,
9467 		.v.func = alc245_fixup_hp_gpio_led,
9468 	},
9469 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9470 		.type = HDA_FIXUP_PINS,
9471 		.v.pins = (const struct hda_pintbl[]) {
9472 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9473 			{ }
9474 		},
9475 		.chained = true,
9476 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9477 	},
9478 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
9479 		.type = HDA_FIXUP_FUNC,
9480 		.v.func = alc233_fixup_no_audio_jack,
9481 	},
9482 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9483 		.type = HDA_FIXUP_FUNC,
9484 		.v.func = alc256_fixup_mic_no_presence_and_resume,
9485 		.chained = true,
9486 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9487 	},
9488 	[ALC287_FIXUP_LEGION_16ACHG6] = {
9489 		.type = HDA_FIXUP_FUNC,
9490 		.v.func = alc287_fixup_legion_16achg6_speakers,
9491 	},
9492 	[ALC287_FIXUP_CS35L41_I2C_2] = {
9493 		.type = HDA_FIXUP_FUNC,
9494 		.v.func = cs35l41_fixup_i2c_two,
9495 	},
9496 	[ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9497 		.type = HDA_FIXUP_FUNC,
9498 		.v.func = cs35l41_fixup_i2c_two,
9499 		.chained = true,
9500 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9501 	},
9502 	[ALC245_FIXUP_CS35L41_SPI_2] = {
9503 		.type = HDA_FIXUP_FUNC,
9504 		.v.func = cs35l41_fixup_spi_two,
9505 	},
9506 	[ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9507 		.type = HDA_FIXUP_FUNC,
9508 		.v.func = cs35l41_fixup_spi_two,
9509 		.chained = true,
9510 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9511 	},
9512 	[ALC245_FIXUP_CS35L41_SPI_4] = {
9513 		.type = HDA_FIXUP_FUNC,
9514 		.v.func = cs35l41_fixup_spi_four,
9515 	},
9516 	[ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9517 		.type = HDA_FIXUP_FUNC,
9518 		.v.func = cs35l41_fixup_spi_four,
9519 		.chained = true,
9520 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9521 	},
9522 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9523 		.type = HDA_FIXUP_VERBS,
9524 		.v.verbs = (const struct hda_verb[]) {
9525 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9526 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9527 			 { }
9528 		},
9529 		.chained = true,
9530 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9531 	},
9532 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9533 		.type = HDA_FIXUP_FUNC,
9534 		.v.func = alc_fixup_dell4_mic_no_presence_quiet,
9535 		.chained = true,
9536 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9537 	},
9538 	[ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9539 		.type = HDA_FIXUP_PINS,
9540 		.v.pins = (const struct hda_pintbl[]) {
9541 			{ 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9542 			{ }
9543 		},
9544 		.chained = true,
9545 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9546 	},
9547 	[ALC287_FIXUP_LEGION_16ITHG6] = {
9548 		.type = HDA_FIXUP_FUNC,
9549 		.v.func = alc287_fixup_legion_16ithg6_speakers,
9550 	},
9551 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9552 		.type = HDA_FIXUP_VERBS,
9553 		.v.verbs = (const struct hda_verb[]) {
9554 			// enable left speaker
9555 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9556 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9557 
9558 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9559 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9560 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9561 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9562 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9563 
9564 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9565 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9566 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9567 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9568 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9569 
9570 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9571 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9572 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9573 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9574 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9575 
9576 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9577 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9578 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9579 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9580 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9581 
9582 			// enable right speaker
9583 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9584 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9585 
9586 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9587 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9588 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9589 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9590 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9591 
9592 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9593 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9594 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9595 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9596 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9597 
9598 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9599 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9600 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9601 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9602 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9603 
9604 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9605 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9606 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9607 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9608 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9609 
9610 			{ },
9611 		},
9612 	},
9613 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9614 		.type = HDA_FIXUP_FUNC,
9615 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9616 		.chained = true,
9617 		.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9618 	},
9619 	[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
9620 		.type = HDA_FIXUP_FUNC,
9621 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9622 		.chained = true,
9623 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2,
9624 	},
9625 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
9626 		.type = HDA_FIXUP_FUNC,
9627 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
9628 		.chained = true,
9629 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9630 	},
9631 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
9632 		.type = HDA_FIXUP_PINS,
9633 		.v.func = alc1220_fixup_gb_dual_codecs,
9634 		.chained = true,
9635 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9636 	},
9637 	[ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
9638 		.type = HDA_FIXUP_FUNC,
9639 		.v.func = cs35l41_fixup_i2c_two,
9640 		.chained = true,
9641 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9642 	},
9643 	[ALC287_FIXUP_TAS2781_I2C] = {
9644 		.type = HDA_FIXUP_FUNC,
9645 		.v.func = tas2781_fixup_i2c,
9646 		.chained = true,
9647 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9648 	},
9649 	[ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
9650 		.type = HDA_FIXUP_FUNC,
9651 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9652 	},
9653 	[ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
9654 		.type = HDA_FIXUP_FUNC,
9655 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9656 		.chained = true,
9657 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
9658 	},
9659 	[ALC287_FIXUP_THINKPAD_I2S_SPK] = {
9660 		.type = HDA_FIXUP_FUNC,
9661 		.v.func = alc287_fixup_bind_dacs,
9662 		.chained = true,
9663 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9664 	},
9665 	[ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
9666 		.type = HDA_FIXUP_FUNC,
9667 		.v.func = alc287_fixup_bind_dacs,
9668 		.chained = true,
9669 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
9670 	},
9671 	[ALC2XX_FIXUP_HEADSET_MIC] = {
9672 		.type = HDA_FIXUP_FUNC,
9673 		.v.func = alc_fixup_headset_mic,
9674 	},
9675 	[ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
9676 		.type = HDA_FIXUP_FUNC,
9677 		.v.func = cs35l41_fixup_spi_two,
9678 		.chained = true,
9679 		.chain_id = ALC289_FIXUP_DUAL_SPK
9680 	},
9681 	[ALC294_FIXUP_CS35L41_I2C_2] = {
9682 		.type = HDA_FIXUP_FUNC,
9683 		.v.func = cs35l41_fixup_i2c_two,
9684 	},
9685 };
9686 
9687 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
9688 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
9689 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9690 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
9691 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
9692 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9693 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9694 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
9695 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9696 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9697 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
9698 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9699 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
9700 	SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9701 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
9702 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
9703 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
9704 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
9705 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9706 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9707 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9708 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9709 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
9710 	SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9711 	SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9712 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
9713 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
9714 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
9715 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9716 	SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9717 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9718 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9719 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9720 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
9721 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9722 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9723 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9724 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
9725 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
9726 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9727 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9728 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9729 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
9730 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9731 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
9732 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
9733 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
9734 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
9735 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
9736 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9737 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
9738 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
9739 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9740 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9741 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9742 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9743 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9744 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
9745 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
9746 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
9747 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9748 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9749 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
9750 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9751 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
9752 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9753 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9754 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9755 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9756 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9757 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9758 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9759 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9760 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9761 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
9762 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
9763 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
9764 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
9765 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9766 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
9767 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
9768 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9769 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9770 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9771 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9772 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9773 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
9774 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
9775 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9776 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9777 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9778 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9779 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9780 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9781 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9782 	SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
9783 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
9784 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
9785 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
9786 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9787 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9788 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9789 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
9790 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9791 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9792 	SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9793 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9794 	SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9795 	SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9796 	SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9797 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9798 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9799 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9800 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9801 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9802 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9803 	SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9804 	SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9805 	SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9806 	SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9807 	SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9808 	SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9809 	SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9810 	SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9811 	SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9812 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9813 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9814 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9815 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
9816 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
9817 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9818 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9819 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9820 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9821 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9822 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9823 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9824 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9825 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9826 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9827 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9828 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9829 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9830 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9831 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9832 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9833 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9834 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9835 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
9836 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
9837 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9838 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9839 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9840 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9841 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9842 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9843 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9844 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9845 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9846 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9847 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9848 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9849 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9850 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9851 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9852 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9853 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9854 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9855 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9856 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9857 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9858 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9859 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9860 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9861 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9862 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9863 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9864 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9865 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9866 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9867 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9868 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9869 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9870 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9871 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
9872 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9873 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9874 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9875 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9876 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
9877 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9878 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
9879 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9880 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9881 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9882 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9883 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9884 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9885 	SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9886 	SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9887 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
9888 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9889 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
9890 	SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9891 	SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
9892 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9893 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9894 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9895 	SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9896 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
9897 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9898 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9899 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
9900 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9901 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9902 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
9903 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
9904 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
9905 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9906 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9907 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9908 	SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
9909 	SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9910 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
9911 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9912 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
9913 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
9914 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
9915 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
9916 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9917 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9918 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9919 	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9920 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
9921 	SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9922 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9923 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9924 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9925 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9926 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
9927 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
9928 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9929 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9930 	SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9931 	SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9932 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9933 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9934 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9935 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9936 	SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9937 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9938 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9939 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9940 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9941 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9942 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9943 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9944 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9945 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9946 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9947 	SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9948 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
9949 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
9950 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
9951 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9952 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
9953 	SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
9954 	SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
9955 	SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9956 	SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
9957 	SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9958 	SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9959 	SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9960 	SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9961 	SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9962 	SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9963 	SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9964 	SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
9965 	SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
9966 	SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9967 	SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9968 	SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9969 	SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
9970 	SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9971 	SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
9972 	SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
9973 	SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
9974 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
9975 	SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
9976 	SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
9977 	SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9978 	SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9979 	SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9980 	SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9981 	SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9982 	SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
9983 	SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9984 	SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
9985 	SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9986 	SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
9987 	SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
9988 	SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
9989 	SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
9990 	SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
9991 	SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9992 	SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9993 	SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9994 	SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9995 	SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9996 	SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
9997 	SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9998 	SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9999 	SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10000 	SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10001 	SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10002 	SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10003 	SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10004 	SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10005 	SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10006 	SND_PCI_QUIRK(0x103c, 0x8b5f, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10007 	SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10008 	SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10009 	SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10010 	SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10011 	SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10012 	SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10013 	SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
10014 	SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10015 	SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10016 	SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
10017 	SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10018 	SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
10019 	SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10020 	SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10021 	SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10022 	SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10023 	SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10024 	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10025 	SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10026 	SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10027 	SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10028 	SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10029 	SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10030 	SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10031 	SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10032 	SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10033 	SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10034 	SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10035 	SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10036 	SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10037 	SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10038 	SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10039 	SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10040 	SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10041 	SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10042 	SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10043 	SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10044 	SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10045 	SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10046 	SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10047 	SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10048 	SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10049 	SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10050 	SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10051 	SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10052 	SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10053 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10054 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10055 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10056 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10057 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10058 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10059 	SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10060 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10061 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10062 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10063 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10064 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10065 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10066 	SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10067 	SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10068 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10069 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10070 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10071 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10072 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10073 	SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650P", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10074 	SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10075 	SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10076 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10077 	SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10078 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10079 	SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA", ALC287_FIXUP_CS35L41_I2C_2),
10080 	SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10081 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10082 	SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10083 	SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10084 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10085 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10086 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10087 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10088 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10089 	SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally RC71L_RC71L", ALC294_FIXUP_ASUS_ALLY),
10090 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10091 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10092 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10093 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10094 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10095 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10096 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10097 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10098 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10099 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10100 	SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
10101 	SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10102 	SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10103 	SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10104 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10105 	SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
10106 	SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10107 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10108 	SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10109 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10110 	SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10111 	SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10112 	SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10113 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10114 	SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10115 	SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10116 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10117 	SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS ROG Strix G17 2023 (G713PV)", ALC287_FIXUP_CS35L41_I2C_2),
10118 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10119 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10120 	SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10121 	SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10122 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10123 	SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10124 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10125 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10126 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10127 	SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10128 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10129 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10130 	SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10131 	SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10132 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10133 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10134 	SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2),
10135 	SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10136 	SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10137 	SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10138 	SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10139 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10140 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10141 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10142 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10143 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10144 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10145 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10146 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10147 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10148 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10149 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10150 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10151 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10152 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10153 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10154 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10155 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10156 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10157 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10158 	SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10159 	SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10160 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10161 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10162 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10163 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10164 	SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10165 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10166 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10167 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10168 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10169 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10170 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10171 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10172 	SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10173 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10174 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10175 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10176 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10177 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10178 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10179 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10180 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10181 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10182 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10183 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10184 	SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10185 	SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10186 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10187 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10188 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10189 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10190 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10191 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10192 	SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10193 	SND_PCI_QUIRK(0x1558, 0x28c1, "Clevo V370VND", ALC2XX_FIXUP_HEADSET_MIC),
10194 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10195 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10196 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10197 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10198 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10199 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10200 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10201 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10202 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10203 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10204 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10205 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10206 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10207 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10208 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10209 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10210 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10211 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10212 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10213 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10214 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10215 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10216 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10217 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10218 	SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10219 	SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10220 	SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10221 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10222 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10223 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10224 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10225 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10226 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10227 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10228 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10229 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10230 	SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10231 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10232 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10233 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10234 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10235 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10236 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10237 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10238 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10239 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10240 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10241 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10242 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10243 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10244 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10245 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10246 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
10247 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10248 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10249 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10250 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10251 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10252 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10253 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10254 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10255 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10256 	SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10257 	SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10258 	SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10259 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10260 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10261 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10262 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10263 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10264 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10265 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
10266 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10267 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
10268 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
10269 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
10270 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
10271 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
10272 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
10273 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
10274 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
10275 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
10276 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
10277 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
10278 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
10279 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
10280 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
10281 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
10282 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10283 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10284 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10285 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
10286 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
10287 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10288 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10289 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10290 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
10291 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
10292 	SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
10293 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
10294 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10295 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10296 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
10297 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10298 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10299 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10300 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10301 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10302 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10303 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10304 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10305 	SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10306 	SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10307 	SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10308 	SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10309 	SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10310 	SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10311 	SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10312 	SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10313 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10314 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10315 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10316 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10317 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10318 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10319 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10320 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10321 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10322 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10323 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10324 	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
10325 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10326 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
10327 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10328 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
10329 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10330 	SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10331 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10332 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
10333 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10334 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10335 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
10336 	SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
10337 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10338 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10339 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10340 	SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
10341 	SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10342 	SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10343 	SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10344 	SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
10345 	SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
10346 	SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
10347 	SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10348 	SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10349 	SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10350 	SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10351 	SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
10352 	SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
10353 	SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
10354 	SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
10355 	SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
10356 	SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
10357 	SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
10358 	SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10359 	SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10360 	SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10361 	SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10362 	SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10363 	SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10364 	SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10365 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10366 	SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
10367 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
10368 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10369 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
10370 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10371 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
10372 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
10373 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10374 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
10375 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
10376 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
10377 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
10378 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
10379 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
10380 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
10381 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
10382 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10383 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10384 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10385 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10386 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10387 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10388 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10389 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
10390 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10391 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
10392 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
10393 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
10394 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10395 	SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
10396 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
10397 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
10398 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
10399 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
10400 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
10401 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
10402 	SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10403 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
10404 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
10405 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
10406 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
10407 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10408 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10409 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10410 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10411 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10412 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
10413 	SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10414 	SND_PCI_QUIRK(0x1d05, 0x1409, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10415 	SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10416 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10417 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
10418 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
10419 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
10420 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10421 	SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10422 	SND_PCI_QUIRK(0x2782, 0x0228, "Infinix ZERO BOOK 13", ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13),
10423 	SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
10424 	SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
10425 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
10426 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
10427 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
10428 	SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
10429 	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10430 	SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10431 	SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10432 
10433 #if 0
10434 	/* Below is a quirk table taken from the old code.
10435 	 * Basically the device should work as is without the fixup table.
10436 	 * If BIOS doesn't give a proper info, enable the corresponding
10437 	 * fixup entry.
10438 	 */
10439 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
10440 		      ALC269_FIXUP_AMIC),
10441 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
10442 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
10443 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
10444 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
10445 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
10446 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
10447 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
10448 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
10449 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
10450 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
10451 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
10452 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
10453 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
10454 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
10455 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
10456 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
10457 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
10458 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
10459 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
10460 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
10461 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
10462 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
10463 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
10464 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
10465 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
10466 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
10467 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
10468 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
10469 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
10470 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
10471 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
10472 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
10473 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
10474 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
10475 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
10476 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
10477 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
10478 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
10479 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
10480 #endif
10481 	{}
10482 };
10483 
10484 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
10485 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
10486 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
10487 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
10488 	SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
10489 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
10490 	{}
10491 };
10492 
10493 static const struct hda_model_fixup alc269_fixup_models[] = {
10494 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
10495 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
10496 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
10497 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
10498 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
10499 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
10500 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
10501 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
10502 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
10503 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
10504 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10505 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
10506 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10507 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
10508 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
10509 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
10510 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
10511 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
10512 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
10513 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
10514 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
10515 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
10516 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
10517 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
10518 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10519 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
10520 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
10521 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
10522 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
10523 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
10524 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
10525 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
10526 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
10527 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
10528 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
10529 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
10530 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
10531 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
10532 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
10533 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
10534 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
10535 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
10536 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
10537 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
10538 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
10539 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
10540 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
10541 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
10542 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
10543 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
10544 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
10545 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
10546 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
10547 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
10548 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
10549 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
10550 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
10551 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
10552 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
10553 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
10554 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
10555 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
10556 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
10557 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
10558 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
10559 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
10560 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
10561 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
10562 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
10563 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
10564 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10565 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
10566 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
10567 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
10568 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
10569 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
10570 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
10571 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
10572 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
10573 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
10574 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
10575 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
10576 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
10577 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
10578 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
10579 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
10580 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
10581 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
10582 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
10583 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
10584 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
10585 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
10586 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
10587 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
10588 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
10589 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
10590 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
10591 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
10592 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
10593 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
10594 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
10595 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
10596 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
10597 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
10598 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
10599 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
10600 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
10601 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
10602 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
10603 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
10604 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
10605 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
10606 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
10607 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
10608 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
10609 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
10610 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
10611 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
10612 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
10613 	{.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
10614 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
10615 	{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
10616 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
10617 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
10618 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
10619 	{.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
10620 	{}
10621 };
10622 #define ALC225_STANDARD_PINS \
10623 	{0x21, 0x04211020}
10624 
10625 #define ALC256_STANDARD_PINS \
10626 	{0x12, 0x90a60140}, \
10627 	{0x14, 0x90170110}, \
10628 	{0x21, 0x02211020}
10629 
10630 #define ALC282_STANDARD_PINS \
10631 	{0x14, 0x90170110}
10632 
10633 #define ALC290_STANDARD_PINS \
10634 	{0x12, 0x99a30130}
10635 
10636 #define ALC292_STANDARD_PINS \
10637 	{0x14, 0x90170110}, \
10638 	{0x15, 0x0221401f}
10639 
10640 #define ALC295_STANDARD_PINS \
10641 	{0x12, 0xb7a60130}, \
10642 	{0x14, 0x90170110}, \
10643 	{0x21, 0x04211020}
10644 
10645 #define ALC298_STANDARD_PINS \
10646 	{0x12, 0x90a60130}, \
10647 	{0x21, 0x03211020}
10648 
10649 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
10650 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
10651 		{0x14, 0x01014020},
10652 		{0x17, 0x90170110},
10653 		{0x18, 0x02a11030},
10654 		{0x19, 0x0181303F},
10655 		{0x21, 0x0221102f}),
10656 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
10657 		{0x12, 0x90a601c0},
10658 		{0x14, 0x90171120},
10659 		{0x21, 0x02211030}),
10660 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10661 		{0x14, 0x90170110},
10662 		{0x1b, 0x90a70130},
10663 		{0x21, 0x03211020}),
10664 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10665 		{0x1a, 0x90a70130},
10666 		{0x1b, 0x90170110},
10667 		{0x21, 0x03211020}),
10668 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10669 		ALC225_STANDARD_PINS,
10670 		{0x12, 0xb7a60130},
10671 		{0x14, 0x901701a0}),
10672 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10673 		ALC225_STANDARD_PINS,
10674 		{0x12, 0xb7a60130},
10675 		{0x14, 0x901701b0}),
10676 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10677 		ALC225_STANDARD_PINS,
10678 		{0x12, 0xb7a60150},
10679 		{0x14, 0x901701a0}),
10680 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10681 		ALC225_STANDARD_PINS,
10682 		{0x12, 0xb7a60150},
10683 		{0x14, 0x901701b0}),
10684 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10685 		ALC225_STANDARD_PINS,
10686 		{0x12, 0xb7a60130},
10687 		{0x1b, 0x90170110}),
10688 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10689 		{0x1b, 0x01111010},
10690 		{0x1e, 0x01451130},
10691 		{0x21, 0x02211020}),
10692 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
10693 		{0x12, 0x90a60140},
10694 		{0x14, 0x90170110},
10695 		{0x19, 0x02a11030},
10696 		{0x21, 0x02211020}),
10697 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10698 		{0x14, 0x90170110},
10699 		{0x19, 0x02a11030},
10700 		{0x1a, 0x02a11040},
10701 		{0x1b, 0x01014020},
10702 		{0x21, 0x0221101f}),
10703 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10704 		{0x14, 0x90170110},
10705 		{0x19, 0x02a11030},
10706 		{0x1a, 0x02a11040},
10707 		{0x1b, 0x01011020},
10708 		{0x21, 0x0221101f}),
10709 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10710 		{0x14, 0x90170110},
10711 		{0x19, 0x02a11020},
10712 		{0x1a, 0x02a11030},
10713 		{0x21, 0x0221101f}),
10714 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
10715 		{0x21, 0x02211010}),
10716 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10717 		{0x14, 0x90170110},
10718 		{0x19, 0x02a11020},
10719 		{0x21, 0x02211030}),
10720 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
10721 		{0x14, 0x90170110},
10722 		{0x21, 0x02211020}),
10723 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10724 		{0x14, 0x90170130},
10725 		{0x21, 0x02211040}),
10726 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10727 		{0x12, 0x90a60140},
10728 		{0x14, 0x90170110},
10729 		{0x21, 0x02211020}),
10730 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10731 		{0x12, 0x90a60160},
10732 		{0x14, 0x90170120},
10733 		{0x21, 0x02211030}),
10734 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10735 		{0x14, 0x90170110},
10736 		{0x1b, 0x02011020},
10737 		{0x21, 0x0221101f}),
10738 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10739 		{0x14, 0x90170110},
10740 		{0x1b, 0x01011020},
10741 		{0x21, 0x0221101f}),
10742 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10743 		{0x14, 0x90170130},
10744 		{0x1b, 0x01014020},
10745 		{0x21, 0x0221103f}),
10746 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10747 		{0x14, 0x90170130},
10748 		{0x1b, 0x01011020},
10749 		{0x21, 0x0221103f}),
10750 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10751 		{0x14, 0x90170130},
10752 		{0x1b, 0x02011020},
10753 		{0x21, 0x0221103f}),
10754 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10755 		{0x14, 0x90170150},
10756 		{0x1b, 0x02011020},
10757 		{0x21, 0x0221105f}),
10758 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10759 		{0x14, 0x90170110},
10760 		{0x1b, 0x01014020},
10761 		{0x21, 0x0221101f}),
10762 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10763 		{0x12, 0x90a60160},
10764 		{0x14, 0x90170120},
10765 		{0x17, 0x90170140},
10766 		{0x21, 0x0321102f}),
10767 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10768 		{0x12, 0x90a60160},
10769 		{0x14, 0x90170130},
10770 		{0x21, 0x02211040}),
10771 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10772 		{0x12, 0x90a60160},
10773 		{0x14, 0x90170140},
10774 		{0x21, 0x02211050}),
10775 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10776 		{0x12, 0x90a60170},
10777 		{0x14, 0x90170120},
10778 		{0x21, 0x02211030}),
10779 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10780 		{0x12, 0x90a60170},
10781 		{0x14, 0x90170130},
10782 		{0x21, 0x02211040}),
10783 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10784 		{0x12, 0x90a60170},
10785 		{0x14, 0x90171130},
10786 		{0x21, 0x02211040}),
10787 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10788 		{0x12, 0x90a60170},
10789 		{0x14, 0x90170140},
10790 		{0x21, 0x02211050}),
10791 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10792 		{0x12, 0x90a60180},
10793 		{0x14, 0x90170130},
10794 		{0x21, 0x02211040}),
10795 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10796 		{0x12, 0x90a60180},
10797 		{0x14, 0x90170120},
10798 		{0x21, 0x02211030}),
10799 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10800 		{0x1b, 0x01011020},
10801 		{0x21, 0x02211010}),
10802 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10803 		{0x14, 0x90170110},
10804 		{0x1b, 0x90a70130},
10805 		{0x21, 0x04211020}),
10806 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10807 		{0x14, 0x90170110},
10808 		{0x1b, 0x90a70130},
10809 		{0x21, 0x03211020}),
10810 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10811 		{0x12, 0x90a60130},
10812 		{0x14, 0x90170110},
10813 		{0x21, 0x03211020}),
10814 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10815 		{0x12, 0x90a60130},
10816 		{0x14, 0x90170110},
10817 		{0x21, 0x04211020}),
10818 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10819 		{0x1a, 0x90a70130},
10820 		{0x1b, 0x90170110},
10821 		{0x21, 0x03211020}),
10822        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10823 		{0x14, 0x90170110},
10824 		{0x19, 0x02a11020},
10825 		{0x21, 0x0221101f}),
10826        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
10827 		{0x17, 0x90170110},
10828 		{0x19, 0x03a11030},
10829 		{0x21, 0x03211020}),
10830 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10831 		{0x12, 0x90a60130},
10832 		{0x14, 0x90170110},
10833 		{0x15, 0x0421101f},
10834 		{0x1a, 0x04a11020}),
10835 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10836 		{0x12, 0x90a60140},
10837 		{0x14, 0x90170110},
10838 		{0x15, 0x0421101f},
10839 		{0x18, 0x02811030},
10840 		{0x1a, 0x04a1103f},
10841 		{0x1b, 0x02011020}),
10842 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10843 		ALC282_STANDARD_PINS,
10844 		{0x12, 0x99a30130},
10845 		{0x19, 0x03a11020},
10846 		{0x21, 0x0321101f}),
10847 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10848 		ALC282_STANDARD_PINS,
10849 		{0x12, 0x99a30130},
10850 		{0x19, 0x03a11020},
10851 		{0x21, 0x03211040}),
10852 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10853 		ALC282_STANDARD_PINS,
10854 		{0x12, 0x99a30130},
10855 		{0x19, 0x03a11030},
10856 		{0x21, 0x03211020}),
10857 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10858 		ALC282_STANDARD_PINS,
10859 		{0x12, 0x99a30130},
10860 		{0x19, 0x04a11020},
10861 		{0x21, 0x0421101f}),
10862 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
10863 		ALC282_STANDARD_PINS,
10864 		{0x12, 0x90a60140},
10865 		{0x19, 0x04a11030},
10866 		{0x21, 0x04211020}),
10867 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10868 		ALC282_STANDARD_PINS,
10869 		{0x12, 0x90a609c0},
10870 		{0x18, 0x03a11830},
10871 		{0x19, 0x04a19831},
10872 		{0x1a, 0x0481303f},
10873 		{0x1b, 0x04211020},
10874 		{0x21, 0x0321101f}),
10875 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10876 		ALC282_STANDARD_PINS,
10877 		{0x12, 0x90a60940},
10878 		{0x18, 0x03a11830},
10879 		{0x19, 0x04a19831},
10880 		{0x1a, 0x0481303f},
10881 		{0x1b, 0x04211020},
10882 		{0x21, 0x0321101f}),
10883 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10884 		ALC282_STANDARD_PINS,
10885 		{0x12, 0x90a60130},
10886 		{0x21, 0x0321101f}),
10887 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10888 		{0x12, 0x90a60160},
10889 		{0x14, 0x90170120},
10890 		{0x21, 0x02211030}),
10891 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10892 		ALC282_STANDARD_PINS,
10893 		{0x12, 0x90a60130},
10894 		{0x19, 0x03a11020},
10895 		{0x21, 0x0321101f}),
10896 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10897 		{0x12, 0x90a60130},
10898 		{0x14, 0x90170110},
10899 		{0x19, 0x04a11040},
10900 		{0x21, 0x04211020}),
10901 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10902 		{0x14, 0x90170110},
10903 		{0x19, 0x04a11040},
10904 		{0x1d, 0x40600001},
10905 		{0x21, 0x04211020}),
10906 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10907 		{0x14, 0x90170110},
10908 		{0x19, 0x04a11040},
10909 		{0x21, 0x04211020}),
10910 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10911 		{0x14, 0x90170110},
10912 		{0x17, 0x90170111},
10913 		{0x19, 0x03a11030},
10914 		{0x21, 0x03211020}),
10915 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10916 		{0x17, 0x90170110},
10917 		{0x19, 0x03a11030},
10918 		{0x21, 0x03211020}),
10919 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10920 		{0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
10921 		{0x19, 0x04a11040},
10922 		{0x21, 0x04211020}),
10923 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
10924 		{0x12, 0x90a60130},
10925 		{0x17, 0x90170110},
10926 		{0x21, 0x02211020}),
10927 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
10928 		{0x12, 0x90a60120},
10929 		{0x14, 0x90170110},
10930 		{0x21, 0x0321101f}),
10931 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10932 		ALC290_STANDARD_PINS,
10933 		{0x15, 0x04211040},
10934 		{0x18, 0x90170112},
10935 		{0x1a, 0x04a11020}),
10936 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10937 		ALC290_STANDARD_PINS,
10938 		{0x15, 0x04211040},
10939 		{0x18, 0x90170110},
10940 		{0x1a, 0x04a11020}),
10941 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10942 		ALC290_STANDARD_PINS,
10943 		{0x15, 0x0421101f},
10944 		{0x1a, 0x04a11020}),
10945 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10946 		ALC290_STANDARD_PINS,
10947 		{0x15, 0x04211020},
10948 		{0x1a, 0x04a11040}),
10949 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10950 		ALC290_STANDARD_PINS,
10951 		{0x14, 0x90170110},
10952 		{0x15, 0x04211020},
10953 		{0x1a, 0x04a11040}),
10954 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10955 		ALC290_STANDARD_PINS,
10956 		{0x14, 0x90170110},
10957 		{0x15, 0x04211020},
10958 		{0x1a, 0x04a11020}),
10959 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10960 		ALC290_STANDARD_PINS,
10961 		{0x14, 0x90170110},
10962 		{0x15, 0x0421101f},
10963 		{0x1a, 0x04a11020}),
10964 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10965 		ALC292_STANDARD_PINS,
10966 		{0x12, 0x90a60140},
10967 		{0x16, 0x01014020},
10968 		{0x19, 0x01a19030}),
10969 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10970 		ALC292_STANDARD_PINS,
10971 		{0x12, 0x90a60140},
10972 		{0x16, 0x01014020},
10973 		{0x18, 0x02a19031},
10974 		{0x19, 0x01a1903e}),
10975 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
10976 		ALC292_STANDARD_PINS,
10977 		{0x12, 0x90a60140}),
10978 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10979 		ALC292_STANDARD_PINS,
10980 		{0x13, 0x90a60140},
10981 		{0x16, 0x21014020},
10982 		{0x19, 0x21a19030}),
10983 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10984 		ALC292_STANDARD_PINS,
10985 		{0x13, 0x90a60140}),
10986 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
10987 		{0x17, 0x90170110},
10988 		{0x21, 0x04211020}),
10989 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
10990 		{0x14, 0x90170110},
10991 		{0x1b, 0x90a70130},
10992 		{0x21, 0x04211020}),
10993 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10994 		{0x12, 0x90a60130},
10995 		{0x17, 0x90170110},
10996 		{0x21, 0x03211020}),
10997 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10998 		{0x12, 0x90a60130},
10999 		{0x17, 0x90170110},
11000 		{0x21, 0x04211020}),
11001 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11002 		{0x12, 0x90a60130},
11003 		{0x17, 0x90170110},
11004 		{0x21, 0x03211020}),
11005 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11006 		{0x12, 0x90a60120},
11007 		{0x17, 0x90170110},
11008 		{0x21, 0x04211030}),
11009 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11010 		{0x12, 0x90a60130},
11011 		{0x17, 0x90170110},
11012 		{0x21, 0x03211020}),
11013 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11014 		{0x12, 0x90a60130},
11015 		{0x17, 0x90170110},
11016 		{0x21, 0x03211020}),
11017 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11018 		ALC298_STANDARD_PINS,
11019 		{0x17, 0x90170110}),
11020 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11021 		ALC298_STANDARD_PINS,
11022 		{0x17, 0x90170140}),
11023 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11024 		ALC298_STANDARD_PINS,
11025 		{0x17, 0x90170150}),
11026 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11027 		{0x12, 0xb7a60140},
11028 		{0x13, 0xb7a60150},
11029 		{0x17, 0x90170110},
11030 		{0x1a, 0x03011020},
11031 		{0x21, 0x03211030}),
11032 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11033 		{0x12, 0xb7a60140},
11034 		{0x17, 0x90170110},
11035 		{0x1a, 0x03a11030},
11036 		{0x21, 0x03211020}),
11037 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11038 		ALC225_STANDARD_PINS,
11039 		{0x12, 0xb7a60130},
11040 		{0x17, 0x90170110}),
11041 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11042 		{0x14, 0x01014010},
11043 		{0x17, 0x90170120},
11044 		{0x18, 0x02a11030},
11045 		{0x19, 0x02a1103f},
11046 		{0x21, 0x0221101f}),
11047 	{}
11048 };
11049 
11050 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11051  * more machines, don't need to match all valid pins, just need to match
11052  * all the pins defined in the tbl. Just because of this reason, it is possible
11053  * that a single machine matches multiple tbls, so there is one limitation:
11054  *   at most one tbl is allowed to define for the same vendor and same codec
11055  */
11056 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11057 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11058 		{0x19, 0x40000000}),
11059 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11060 		{0x19, 0x40000000},
11061 		{0x1b, 0x40000000}),
11062 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
11063 		{0x19, 0x40000000},
11064 		{0x1b, 0x40000000}),
11065 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11066 		{0x19, 0x40000000},
11067 		{0x1a, 0x40000000}),
11068 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11069 		{0x19, 0x40000000},
11070 		{0x1a, 0x40000000}),
11071 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11072 		{0x19, 0x40000000},
11073 		{0x1a, 0x40000000}),
11074 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11075 		{0x19, 0x40000000}),
11076 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1558, "Clevo", ALC2XX_FIXUP_HEADSET_MIC,
11077 		{0x19, 0x40000000}),
11078 	{}
11079 };
11080 
11081 static void alc269_fill_coef(struct hda_codec *codec)
11082 {
11083 	struct alc_spec *spec = codec->spec;
11084 	int val;
11085 
11086 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11087 		return;
11088 
11089 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11090 		alc_write_coef_idx(codec, 0xf, 0x960b);
11091 		alc_write_coef_idx(codec, 0xe, 0x8817);
11092 	}
11093 
11094 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11095 		alc_write_coef_idx(codec, 0xf, 0x960b);
11096 		alc_write_coef_idx(codec, 0xe, 0x8814);
11097 	}
11098 
11099 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11100 		/* Power up output pin */
11101 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11102 	}
11103 
11104 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11105 		val = alc_read_coef_idx(codec, 0xd);
11106 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11107 			/* Capless ramp up clock control */
11108 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
11109 		}
11110 		val = alc_read_coef_idx(codec, 0x17);
11111 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11112 			/* Class D power on reset */
11113 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
11114 		}
11115 	}
11116 
11117 	/* HP */
11118 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11119 }
11120 
11121 /*
11122  */
11123 static int patch_alc269(struct hda_codec *codec)
11124 {
11125 	struct alc_spec *spec;
11126 	int err;
11127 
11128 	err = alc_alloc_spec(codec, 0x0b);
11129 	if (err < 0)
11130 		return err;
11131 
11132 	spec = codec->spec;
11133 	spec->gen.shared_mic_vref_pin = 0x18;
11134 	codec->power_save_node = 0;
11135 	spec->en_3kpull_low = true;
11136 
11137 #ifdef CONFIG_PM
11138 	codec->patch_ops.suspend = alc269_suspend;
11139 	codec->patch_ops.resume = alc269_resume;
11140 #endif
11141 	spec->shutup = alc_default_shutup;
11142 	spec->init_hook = alc_default_init;
11143 
11144 	switch (codec->core.vendor_id) {
11145 	case 0x10ec0269:
11146 		spec->codec_variant = ALC269_TYPE_ALC269VA;
11147 		switch (alc_get_coef0(codec) & 0x00f0) {
11148 		case 0x0010:
11149 			if (codec->bus->pci &&
11150 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
11151 			    spec->cdefine.platform_type == 1)
11152 				err = alc_codec_rename(codec, "ALC271X");
11153 			spec->codec_variant = ALC269_TYPE_ALC269VB;
11154 			break;
11155 		case 0x0020:
11156 			if (codec->bus->pci &&
11157 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
11158 			    codec->bus->pci->subsystem_device == 0x21f3)
11159 				err = alc_codec_rename(codec, "ALC3202");
11160 			spec->codec_variant = ALC269_TYPE_ALC269VC;
11161 			break;
11162 		case 0x0030:
11163 			spec->codec_variant = ALC269_TYPE_ALC269VD;
11164 			break;
11165 		default:
11166 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
11167 		}
11168 		if (err < 0)
11169 			goto error;
11170 		spec->shutup = alc269_shutup;
11171 		spec->init_hook = alc269_fill_coef;
11172 		alc269_fill_coef(codec);
11173 		break;
11174 
11175 	case 0x10ec0280:
11176 	case 0x10ec0290:
11177 		spec->codec_variant = ALC269_TYPE_ALC280;
11178 		break;
11179 	case 0x10ec0282:
11180 		spec->codec_variant = ALC269_TYPE_ALC282;
11181 		spec->shutup = alc282_shutup;
11182 		spec->init_hook = alc282_init;
11183 		break;
11184 	case 0x10ec0233:
11185 	case 0x10ec0283:
11186 		spec->codec_variant = ALC269_TYPE_ALC283;
11187 		spec->shutup = alc283_shutup;
11188 		spec->init_hook = alc283_init;
11189 		break;
11190 	case 0x10ec0284:
11191 	case 0x10ec0292:
11192 		spec->codec_variant = ALC269_TYPE_ALC284;
11193 		break;
11194 	case 0x10ec0293:
11195 		spec->codec_variant = ALC269_TYPE_ALC293;
11196 		break;
11197 	case 0x10ec0286:
11198 	case 0x10ec0288:
11199 		spec->codec_variant = ALC269_TYPE_ALC286;
11200 		break;
11201 	case 0x10ec0298:
11202 		spec->codec_variant = ALC269_TYPE_ALC298;
11203 		break;
11204 	case 0x10ec0235:
11205 	case 0x10ec0255:
11206 		spec->codec_variant = ALC269_TYPE_ALC255;
11207 		spec->shutup = alc256_shutup;
11208 		spec->init_hook = alc256_init;
11209 		break;
11210 	case 0x10ec0230:
11211 	case 0x10ec0236:
11212 	case 0x10ec0256:
11213 	case 0x19e58326:
11214 		spec->codec_variant = ALC269_TYPE_ALC256;
11215 		spec->shutup = alc256_shutup;
11216 		spec->init_hook = alc256_init;
11217 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
11218 		if (codec->core.vendor_id == 0x10ec0236 &&
11219 		    codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
11220 			spec->en_3kpull_low = false;
11221 		break;
11222 	case 0x10ec0257:
11223 		spec->codec_variant = ALC269_TYPE_ALC257;
11224 		spec->shutup = alc256_shutup;
11225 		spec->init_hook = alc256_init;
11226 		spec->gen.mixer_nid = 0;
11227 		spec->en_3kpull_low = false;
11228 		break;
11229 	case 0x10ec0215:
11230 	case 0x10ec0245:
11231 	case 0x10ec0285:
11232 	case 0x10ec0289:
11233 		if (alc_get_coef0(codec) & 0x0010)
11234 			spec->codec_variant = ALC269_TYPE_ALC245;
11235 		else
11236 			spec->codec_variant = ALC269_TYPE_ALC215;
11237 		spec->shutup = alc225_shutup;
11238 		spec->init_hook = alc225_init;
11239 		spec->gen.mixer_nid = 0;
11240 		break;
11241 	case 0x10ec0225:
11242 	case 0x10ec0295:
11243 	case 0x10ec0299:
11244 		spec->codec_variant = ALC269_TYPE_ALC225;
11245 		spec->shutup = alc225_shutup;
11246 		spec->init_hook = alc225_init;
11247 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
11248 		break;
11249 	case 0x10ec0287:
11250 		spec->codec_variant = ALC269_TYPE_ALC287;
11251 		spec->shutup = alc225_shutup;
11252 		spec->init_hook = alc225_init;
11253 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
11254 		break;
11255 	case 0x10ec0234:
11256 	case 0x10ec0274:
11257 	case 0x10ec0294:
11258 		spec->codec_variant = ALC269_TYPE_ALC294;
11259 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
11260 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
11261 		spec->init_hook = alc294_init;
11262 		break;
11263 	case 0x10ec0300:
11264 		spec->codec_variant = ALC269_TYPE_ALC300;
11265 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
11266 		break;
11267 	case 0x10ec0623:
11268 		spec->codec_variant = ALC269_TYPE_ALC623;
11269 		break;
11270 	case 0x10ec0700:
11271 	case 0x10ec0701:
11272 	case 0x10ec0703:
11273 	case 0x10ec0711:
11274 		spec->codec_variant = ALC269_TYPE_ALC700;
11275 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
11276 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
11277 		spec->init_hook = alc294_init;
11278 		break;
11279 
11280 	}
11281 
11282 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
11283 		spec->has_alc5505_dsp = 1;
11284 		spec->init_hook = alc5505_dsp_init;
11285 	}
11286 
11287 	alc_pre_init(codec);
11288 
11289 	snd_hda_pick_fixup(codec, alc269_fixup_models,
11290 		       alc269_fixup_tbl, alc269_fixups);
11291 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
11292 	 * the quirk breaks the latter (bko#214101).
11293 	 * Clear the wrong entry.
11294 	 */
11295 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
11296 	    codec->core.vendor_id == 0x10ec0294) {
11297 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
11298 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
11299 	}
11300 
11301 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
11302 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
11303 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
11304 			   alc269_fixups);
11305 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11306 
11307 	alc_auto_parse_customize_define(codec);
11308 
11309 	if (has_cdefine_beep(codec))
11310 		spec->gen.beep_nid = 0x01;
11311 
11312 	/* automatic parse from the BIOS config */
11313 	err = alc269_parse_auto_config(codec);
11314 	if (err < 0)
11315 		goto error;
11316 
11317 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
11318 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
11319 		if (err < 0)
11320 			goto error;
11321 	}
11322 
11323 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11324 
11325 	return 0;
11326 
11327  error:
11328 	alc_free(codec);
11329 	return err;
11330 }
11331 
11332 /*
11333  * ALC861
11334  */
11335 
11336 static int alc861_parse_auto_config(struct hda_codec *codec)
11337 {
11338 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11339 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
11340 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
11341 }
11342 
11343 /* Pin config fixes */
11344 enum {
11345 	ALC861_FIXUP_FSC_AMILO_PI1505,
11346 	ALC861_FIXUP_AMP_VREF_0F,
11347 	ALC861_FIXUP_NO_JACK_DETECT,
11348 	ALC861_FIXUP_ASUS_A6RP,
11349 	ALC660_FIXUP_ASUS_W7J,
11350 };
11351 
11352 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
11353 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
11354 			const struct hda_fixup *fix, int action)
11355 {
11356 	struct alc_spec *spec = codec->spec;
11357 	unsigned int val;
11358 
11359 	if (action != HDA_FIXUP_ACT_INIT)
11360 		return;
11361 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
11362 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
11363 		val |= AC_PINCTL_IN_EN;
11364 	val |= AC_PINCTL_VREF_50;
11365 	snd_hda_set_pin_ctl(codec, 0x0f, val);
11366 	spec->gen.keep_vref_in_automute = 1;
11367 }
11368 
11369 /* suppress the jack-detection */
11370 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
11371 				     const struct hda_fixup *fix, int action)
11372 {
11373 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11374 		codec->no_jack_detect = 1;
11375 }
11376 
11377 static const struct hda_fixup alc861_fixups[] = {
11378 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
11379 		.type = HDA_FIXUP_PINS,
11380 		.v.pins = (const struct hda_pintbl[]) {
11381 			{ 0x0b, 0x0221101f }, /* HP */
11382 			{ 0x0f, 0x90170310 }, /* speaker */
11383 			{ }
11384 		}
11385 	},
11386 	[ALC861_FIXUP_AMP_VREF_0F] = {
11387 		.type = HDA_FIXUP_FUNC,
11388 		.v.func = alc861_fixup_asus_amp_vref_0f,
11389 	},
11390 	[ALC861_FIXUP_NO_JACK_DETECT] = {
11391 		.type = HDA_FIXUP_FUNC,
11392 		.v.func = alc_fixup_no_jack_detect,
11393 	},
11394 	[ALC861_FIXUP_ASUS_A6RP] = {
11395 		.type = HDA_FIXUP_FUNC,
11396 		.v.func = alc861_fixup_asus_amp_vref_0f,
11397 		.chained = true,
11398 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
11399 	},
11400 	[ALC660_FIXUP_ASUS_W7J] = {
11401 		.type = HDA_FIXUP_VERBS,
11402 		.v.verbs = (const struct hda_verb[]) {
11403 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
11404 			 * for enabling outputs
11405 			 */
11406 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11407 			{ }
11408 		},
11409 	}
11410 };
11411 
11412 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
11413 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
11414 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
11415 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
11416 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
11417 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
11418 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
11419 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
11420 	{}
11421 };
11422 
11423 /*
11424  */
11425 static int patch_alc861(struct hda_codec *codec)
11426 {
11427 	struct alc_spec *spec;
11428 	int err;
11429 
11430 	err = alc_alloc_spec(codec, 0x15);
11431 	if (err < 0)
11432 		return err;
11433 
11434 	spec = codec->spec;
11435 	if (has_cdefine_beep(codec))
11436 		spec->gen.beep_nid = 0x23;
11437 
11438 #ifdef CONFIG_PM
11439 	spec->power_hook = alc_power_eapd;
11440 #endif
11441 
11442 	alc_pre_init(codec);
11443 
11444 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
11445 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11446 
11447 	/* automatic parse from the BIOS config */
11448 	err = alc861_parse_auto_config(codec);
11449 	if (err < 0)
11450 		goto error;
11451 
11452 	if (!spec->gen.no_analog) {
11453 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
11454 		if (err < 0)
11455 			goto error;
11456 	}
11457 
11458 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11459 
11460 	return 0;
11461 
11462  error:
11463 	alc_free(codec);
11464 	return err;
11465 }
11466 
11467 /*
11468  * ALC861-VD support
11469  *
11470  * Based on ALC882
11471  *
11472  * In addition, an independent DAC
11473  */
11474 static int alc861vd_parse_auto_config(struct hda_codec *codec)
11475 {
11476 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
11477 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11478 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
11479 }
11480 
11481 enum {
11482 	ALC660VD_FIX_ASUS_GPIO1,
11483 	ALC861VD_FIX_DALLAS,
11484 };
11485 
11486 /* exclude VREF80 */
11487 static void alc861vd_fixup_dallas(struct hda_codec *codec,
11488 				  const struct hda_fixup *fix, int action)
11489 {
11490 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11491 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
11492 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
11493 	}
11494 }
11495 
11496 /* reset GPIO1 */
11497 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
11498 				      const struct hda_fixup *fix, int action)
11499 {
11500 	struct alc_spec *spec = codec->spec;
11501 
11502 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11503 		spec->gpio_mask |= 0x02;
11504 	alc_fixup_gpio(codec, action, 0x01);
11505 }
11506 
11507 static const struct hda_fixup alc861vd_fixups[] = {
11508 	[ALC660VD_FIX_ASUS_GPIO1] = {
11509 		.type = HDA_FIXUP_FUNC,
11510 		.v.func = alc660vd_fixup_asus_gpio1,
11511 	},
11512 	[ALC861VD_FIX_DALLAS] = {
11513 		.type = HDA_FIXUP_FUNC,
11514 		.v.func = alc861vd_fixup_dallas,
11515 	},
11516 };
11517 
11518 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
11519 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
11520 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
11521 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
11522 	{}
11523 };
11524 
11525 /*
11526  */
11527 static int patch_alc861vd(struct hda_codec *codec)
11528 {
11529 	struct alc_spec *spec;
11530 	int err;
11531 
11532 	err = alc_alloc_spec(codec, 0x0b);
11533 	if (err < 0)
11534 		return err;
11535 
11536 	spec = codec->spec;
11537 	if (has_cdefine_beep(codec))
11538 		spec->gen.beep_nid = 0x23;
11539 
11540 	spec->shutup = alc_eapd_shutup;
11541 
11542 	alc_pre_init(codec);
11543 
11544 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
11545 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11546 
11547 	/* automatic parse from the BIOS config */
11548 	err = alc861vd_parse_auto_config(codec);
11549 	if (err < 0)
11550 		goto error;
11551 
11552 	if (!spec->gen.no_analog) {
11553 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11554 		if (err < 0)
11555 			goto error;
11556 	}
11557 
11558 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11559 
11560 	return 0;
11561 
11562  error:
11563 	alc_free(codec);
11564 	return err;
11565 }
11566 
11567 /*
11568  * ALC662 support
11569  *
11570  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11571  * configuration.  Each pin widget can choose any input DACs and a mixer.
11572  * Each ADC is connected from a mixer of all inputs.  This makes possible
11573  * 6-channel independent captures.
11574  *
11575  * In addition, an independent DAC for the multi-playback (not used in this
11576  * driver yet).
11577  */
11578 
11579 /*
11580  * BIOS auto configuration
11581  */
11582 
11583 static int alc662_parse_auto_config(struct hda_codec *codec)
11584 {
11585 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11586 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
11587 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11588 	const hda_nid_t *ssids;
11589 
11590 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
11591 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
11592 	    codec->core.vendor_id == 0x10ec0671)
11593 		ssids = alc663_ssids;
11594 	else
11595 		ssids = alc662_ssids;
11596 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
11597 }
11598 
11599 static void alc272_fixup_mario(struct hda_codec *codec,
11600 			       const struct hda_fixup *fix, int action)
11601 {
11602 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
11603 		return;
11604 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
11605 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
11606 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
11607 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11608 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
11609 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
11610 }
11611 
11612 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
11613 	{ .channels = 2,
11614 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
11615 	{ .channels = 4,
11616 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
11617 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
11618 	{ }
11619 };
11620 
11621 /* override the 2.1 chmap */
11622 static void alc_fixup_bass_chmap(struct hda_codec *codec,
11623 				    const struct hda_fixup *fix, int action)
11624 {
11625 	if (action == HDA_FIXUP_ACT_BUILD) {
11626 		struct alc_spec *spec = codec->spec;
11627 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
11628 	}
11629 }
11630 
11631 /* avoid D3 for keeping GPIO up */
11632 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
11633 					  hda_nid_t nid,
11634 					  unsigned int power_state)
11635 {
11636 	struct alc_spec *spec = codec->spec;
11637 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
11638 		return AC_PWRST_D0;
11639 	return power_state;
11640 }
11641 
11642 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
11643 				   const struct hda_fixup *fix, int action)
11644 {
11645 	struct alc_spec *spec = codec->spec;
11646 
11647 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
11648 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11649 		spec->mute_led_polarity = 1;
11650 		codec->power_filter = gpio_led_power_filter;
11651 	}
11652 }
11653 
11654 static void alc662_usi_automute_hook(struct hda_codec *codec,
11655 					 struct hda_jack_callback *jack)
11656 {
11657 	struct alc_spec *spec = codec->spec;
11658 	int vref;
11659 	msleep(200);
11660 	snd_hda_gen_hp_automute(codec, jack);
11661 
11662 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
11663 	msleep(100);
11664 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11665 			    vref);
11666 }
11667 
11668 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
11669 				     const struct hda_fixup *fix, int action)
11670 {
11671 	struct alc_spec *spec = codec->spec;
11672 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11673 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11674 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
11675 	}
11676 }
11677 
11678 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
11679 					struct hda_jack_callback *cb)
11680 {
11681 	/* surround speakers at 0x1b already get muted automatically when
11682 	 * headphones are plugged in, but we have to mute/unmute the remaining
11683 	 * channels manually:
11684 	 * 0x15 - front left/front right
11685 	 * 0x18 - front center/ LFE
11686 	 */
11687 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
11688 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
11689 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
11690 	} else {
11691 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
11692 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
11693 	}
11694 }
11695 
11696 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
11697 					const struct hda_fixup *fix, int action)
11698 {
11699     /* Pin 0x1b: shared headphones jack and surround speakers */
11700 	if (!is_jack_detectable(codec, 0x1b))
11701 		return;
11702 
11703 	switch (action) {
11704 	case HDA_FIXUP_ACT_PRE_PROBE:
11705 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
11706 				alc662_aspire_ethos_mute_speakers);
11707 		/* subwoofer needs an extra GPIO setting to become audible */
11708 		alc_setup_gpio(codec, 0x02);
11709 		break;
11710 	case HDA_FIXUP_ACT_INIT:
11711 		/* Make sure to start in a correct state, i.e. if
11712 		 * headphones have been plugged in before powering up the system
11713 		 */
11714 		alc662_aspire_ethos_mute_speakers(codec, NULL);
11715 		break;
11716 	}
11717 }
11718 
11719 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
11720 					     const struct hda_fixup *fix, int action)
11721 {
11722 	struct alc_spec *spec = codec->spec;
11723 
11724 	static const struct hda_pintbl pincfgs[] = {
11725 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
11726 		{ 0x1b, 0x0181304f },
11727 		{ }
11728 	};
11729 
11730 	switch (action) {
11731 	case HDA_FIXUP_ACT_PRE_PROBE:
11732 		spec->gen.mixer_nid = 0;
11733 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11734 		snd_hda_apply_pincfgs(codec, pincfgs);
11735 		break;
11736 	case HDA_FIXUP_ACT_INIT:
11737 		alc_write_coef_idx(codec, 0x19, 0xa054);
11738 		break;
11739 	}
11740 }
11741 
11742 static void alc897_hp_automute_hook(struct hda_codec *codec,
11743 					 struct hda_jack_callback *jack)
11744 {
11745 	struct alc_spec *spec = codec->spec;
11746 	int vref;
11747 
11748 	snd_hda_gen_hp_automute(codec, jack);
11749 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
11750 	snd_hda_set_pin_ctl(codec, 0x1b, vref);
11751 }
11752 
11753 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
11754 				     const struct hda_fixup *fix, int action)
11755 {
11756 	struct alc_spec *spec = codec->spec;
11757 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11758 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11759 		spec->no_shutup_pins = 1;
11760 	}
11761 	if (action == HDA_FIXUP_ACT_PROBE) {
11762 		snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
11763 	}
11764 }
11765 
11766 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
11767 				     const struct hda_fixup *fix, int action)
11768 {
11769 	struct alc_spec *spec = codec->spec;
11770 
11771 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11772 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11773 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11774 	}
11775 }
11776 
11777 static const struct coef_fw alc668_coefs[] = {
11778 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
11779 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
11780 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
11781 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
11782 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
11783 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
11784 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
11785 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
11786 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
11787 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
11788 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
11789 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
11790 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
11791 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
11792 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
11793 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
11794 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
11795 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
11796 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
11797 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
11798 	{}
11799 };
11800 
11801 static void alc668_restore_default_value(struct hda_codec *codec)
11802 {
11803 	alc_process_coef_fw(codec, alc668_coefs);
11804 }
11805 
11806 enum {
11807 	ALC662_FIXUP_ASPIRE,
11808 	ALC662_FIXUP_LED_GPIO1,
11809 	ALC662_FIXUP_IDEAPAD,
11810 	ALC272_FIXUP_MARIO,
11811 	ALC662_FIXUP_CZC_ET26,
11812 	ALC662_FIXUP_CZC_P10T,
11813 	ALC662_FIXUP_SKU_IGNORE,
11814 	ALC662_FIXUP_HP_RP5800,
11815 	ALC662_FIXUP_ASUS_MODE1,
11816 	ALC662_FIXUP_ASUS_MODE2,
11817 	ALC662_FIXUP_ASUS_MODE3,
11818 	ALC662_FIXUP_ASUS_MODE4,
11819 	ALC662_FIXUP_ASUS_MODE5,
11820 	ALC662_FIXUP_ASUS_MODE6,
11821 	ALC662_FIXUP_ASUS_MODE7,
11822 	ALC662_FIXUP_ASUS_MODE8,
11823 	ALC662_FIXUP_NO_JACK_DETECT,
11824 	ALC662_FIXUP_ZOTAC_Z68,
11825 	ALC662_FIXUP_INV_DMIC,
11826 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11827 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
11828 	ALC662_FIXUP_HEADSET_MODE,
11829 	ALC668_FIXUP_HEADSET_MODE,
11830 	ALC662_FIXUP_BASS_MODE4_CHMAP,
11831 	ALC662_FIXUP_BASS_16,
11832 	ALC662_FIXUP_BASS_1A,
11833 	ALC662_FIXUP_BASS_CHMAP,
11834 	ALC668_FIXUP_AUTO_MUTE,
11835 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
11836 	ALC668_FIXUP_DELL_XPS13,
11837 	ALC662_FIXUP_ASUS_Nx50,
11838 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11839 	ALC668_FIXUP_ASUS_Nx51,
11840 	ALC668_FIXUP_MIC_COEF,
11841 	ALC668_FIXUP_ASUS_G751,
11842 	ALC891_FIXUP_HEADSET_MODE,
11843 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11844 	ALC662_FIXUP_ACER_VERITON,
11845 	ALC892_FIXUP_ASROCK_MOBO,
11846 	ALC662_FIXUP_USI_FUNC,
11847 	ALC662_FIXUP_USI_HEADSET_MODE,
11848 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
11849 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
11850 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
11851 	ALC671_FIXUP_HP_HEADSET_MIC2,
11852 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
11853 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
11854 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
11855 	ALC668_FIXUP_HEADSET_MIC,
11856 	ALC668_FIXUP_MIC_DET_COEF,
11857 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
11858 	ALC897_FIXUP_HEADSET_MIC_PIN,
11859 	ALC897_FIXUP_HP_HSMIC_VERB,
11860 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
11861 	ALC897_FIXUP_HEADSET_MIC_PIN2,
11862 	ALC897_FIXUP_UNIS_H3C_X500S,
11863 	ALC897_FIXUP_HEADSET_MIC_PIN3,
11864 };
11865 
11866 static const struct hda_fixup alc662_fixups[] = {
11867 	[ALC662_FIXUP_ASPIRE] = {
11868 		.type = HDA_FIXUP_PINS,
11869 		.v.pins = (const struct hda_pintbl[]) {
11870 			{ 0x15, 0x99130112 }, /* subwoofer */
11871 			{ }
11872 		}
11873 	},
11874 	[ALC662_FIXUP_LED_GPIO1] = {
11875 		.type = HDA_FIXUP_FUNC,
11876 		.v.func = alc662_fixup_led_gpio1,
11877 	},
11878 	[ALC662_FIXUP_IDEAPAD] = {
11879 		.type = HDA_FIXUP_PINS,
11880 		.v.pins = (const struct hda_pintbl[]) {
11881 			{ 0x17, 0x99130112 }, /* subwoofer */
11882 			{ }
11883 		},
11884 		.chained = true,
11885 		.chain_id = ALC662_FIXUP_LED_GPIO1,
11886 	},
11887 	[ALC272_FIXUP_MARIO] = {
11888 		.type = HDA_FIXUP_FUNC,
11889 		.v.func = alc272_fixup_mario,
11890 	},
11891 	[ALC662_FIXUP_CZC_ET26] = {
11892 		.type = HDA_FIXUP_PINS,
11893 		.v.pins = (const struct hda_pintbl[]) {
11894 			{0x12, 0x403cc000},
11895 			{0x14, 0x90170110}, /* speaker */
11896 			{0x15, 0x411111f0},
11897 			{0x16, 0x411111f0},
11898 			{0x18, 0x01a19030}, /* mic */
11899 			{0x19, 0x90a7013f}, /* int-mic */
11900 			{0x1a, 0x01014020},
11901 			{0x1b, 0x0121401f},
11902 			{0x1c, 0x411111f0},
11903 			{0x1d, 0x411111f0},
11904 			{0x1e, 0x40478e35},
11905 			{}
11906 		},
11907 		.chained = true,
11908 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11909 	},
11910 	[ALC662_FIXUP_CZC_P10T] = {
11911 		.type = HDA_FIXUP_VERBS,
11912 		.v.verbs = (const struct hda_verb[]) {
11913 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
11914 			{}
11915 		}
11916 	},
11917 	[ALC662_FIXUP_SKU_IGNORE] = {
11918 		.type = HDA_FIXUP_FUNC,
11919 		.v.func = alc_fixup_sku_ignore,
11920 	},
11921 	[ALC662_FIXUP_HP_RP5800] = {
11922 		.type = HDA_FIXUP_PINS,
11923 		.v.pins = (const struct hda_pintbl[]) {
11924 			{ 0x14, 0x0221201f }, /* HP out */
11925 			{ }
11926 		},
11927 		.chained = true,
11928 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11929 	},
11930 	[ALC662_FIXUP_ASUS_MODE1] = {
11931 		.type = HDA_FIXUP_PINS,
11932 		.v.pins = (const struct hda_pintbl[]) {
11933 			{ 0x14, 0x99130110 }, /* speaker */
11934 			{ 0x18, 0x01a19c20 }, /* mic */
11935 			{ 0x19, 0x99a3092f }, /* int-mic */
11936 			{ 0x21, 0x0121401f }, /* HP out */
11937 			{ }
11938 		},
11939 		.chained = true,
11940 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11941 	},
11942 	[ALC662_FIXUP_ASUS_MODE2] = {
11943 		.type = HDA_FIXUP_PINS,
11944 		.v.pins = (const struct hda_pintbl[]) {
11945 			{ 0x14, 0x99130110 }, /* speaker */
11946 			{ 0x18, 0x01a19820 }, /* mic */
11947 			{ 0x19, 0x99a3092f }, /* int-mic */
11948 			{ 0x1b, 0x0121401f }, /* HP out */
11949 			{ }
11950 		},
11951 		.chained = true,
11952 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11953 	},
11954 	[ALC662_FIXUP_ASUS_MODE3] = {
11955 		.type = HDA_FIXUP_PINS,
11956 		.v.pins = (const struct hda_pintbl[]) {
11957 			{ 0x14, 0x99130110 }, /* speaker */
11958 			{ 0x15, 0x0121441f }, /* HP */
11959 			{ 0x18, 0x01a19840 }, /* mic */
11960 			{ 0x19, 0x99a3094f }, /* int-mic */
11961 			{ 0x21, 0x01211420 }, /* HP2 */
11962 			{ }
11963 		},
11964 		.chained = true,
11965 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11966 	},
11967 	[ALC662_FIXUP_ASUS_MODE4] = {
11968 		.type = HDA_FIXUP_PINS,
11969 		.v.pins = (const struct hda_pintbl[]) {
11970 			{ 0x14, 0x99130110 }, /* speaker */
11971 			{ 0x16, 0x99130111 }, /* speaker */
11972 			{ 0x18, 0x01a19840 }, /* mic */
11973 			{ 0x19, 0x99a3094f }, /* int-mic */
11974 			{ 0x21, 0x0121441f }, /* HP */
11975 			{ }
11976 		},
11977 		.chained = true,
11978 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11979 	},
11980 	[ALC662_FIXUP_ASUS_MODE5] = {
11981 		.type = HDA_FIXUP_PINS,
11982 		.v.pins = (const struct hda_pintbl[]) {
11983 			{ 0x14, 0x99130110 }, /* speaker */
11984 			{ 0x15, 0x0121441f }, /* HP */
11985 			{ 0x16, 0x99130111 }, /* speaker */
11986 			{ 0x18, 0x01a19840 }, /* mic */
11987 			{ 0x19, 0x99a3094f }, /* int-mic */
11988 			{ }
11989 		},
11990 		.chained = true,
11991 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11992 	},
11993 	[ALC662_FIXUP_ASUS_MODE6] = {
11994 		.type = HDA_FIXUP_PINS,
11995 		.v.pins = (const struct hda_pintbl[]) {
11996 			{ 0x14, 0x99130110 }, /* speaker */
11997 			{ 0x15, 0x01211420 }, /* HP2 */
11998 			{ 0x18, 0x01a19840 }, /* mic */
11999 			{ 0x19, 0x99a3094f }, /* int-mic */
12000 			{ 0x1b, 0x0121441f }, /* HP */
12001 			{ }
12002 		},
12003 		.chained = true,
12004 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12005 	},
12006 	[ALC662_FIXUP_ASUS_MODE7] = {
12007 		.type = HDA_FIXUP_PINS,
12008 		.v.pins = (const struct hda_pintbl[]) {
12009 			{ 0x14, 0x99130110 }, /* speaker */
12010 			{ 0x17, 0x99130111 }, /* speaker */
12011 			{ 0x18, 0x01a19840 }, /* mic */
12012 			{ 0x19, 0x99a3094f }, /* int-mic */
12013 			{ 0x1b, 0x01214020 }, /* HP */
12014 			{ 0x21, 0x0121401f }, /* HP */
12015 			{ }
12016 		},
12017 		.chained = true,
12018 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12019 	},
12020 	[ALC662_FIXUP_ASUS_MODE8] = {
12021 		.type = HDA_FIXUP_PINS,
12022 		.v.pins = (const struct hda_pintbl[]) {
12023 			{ 0x14, 0x99130110 }, /* speaker */
12024 			{ 0x12, 0x99a30970 }, /* int-mic */
12025 			{ 0x15, 0x01214020 }, /* HP */
12026 			{ 0x17, 0x99130111 }, /* speaker */
12027 			{ 0x18, 0x01a19840 }, /* mic */
12028 			{ 0x21, 0x0121401f }, /* HP */
12029 			{ }
12030 		},
12031 		.chained = true,
12032 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12033 	},
12034 	[ALC662_FIXUP_NO_JACK_DETECT] = {
12035 		.type = HDA_FIXUP_FUNC,
12036 		.v.func = alc_fixup_no_jack_detect,
12037 	},
12038 	[ALC662_FIXUP_ZOTAC_Z68] = {
12039 		.type = HDA_FIXUP_PINS,
12040 		.v.pins = (const struct hda_pintbl[]) {
12041 			{ 0x1b, 0x02214020 }, /* Front HP */
12042 			{ }
12043 		}
12044 	},
12045 	[ALC662_FIXUP_INV_DMIC] = {
12046 		.type = HDA_FIXUP_FUNC,
12047 		.v.func = alc_fixup_inv_dmic,
12048 	},
12049 	[ALC668_FIXUP_DELL_XPS13] = {
12050 		.type = HDA_FIXUP_FUNC,
12051 		.v.func = alc_fixup_dell_xps13,
12052 		.chained = true,
12053 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12054 	},
12055 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12056 		.type = HDA_FIXUP_FUNC,
12057 		.v.func = alc_fixup_disable_aamix,
12058 		.chained = true,
12059 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12060 	},
12061 	[ALC668_FIXUP_AUTO_MUTE] = {
12062 		.type = HDA_FIXUP_FUNC,
12063 		.v.func = alc_fixup_auto_mute_via_amp,
12064 		.chained = true,
12065 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12066 	},
12067 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12068 		.type = HDA_FIXUP_PINS,
12069 		.v.pins = (const struct hda_pintbl[]) {
12070 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12071 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12072 			{ }
12073 		},
12074 		.chained = true,
12075 		.chain_id = ALC662_FIXUP_HEADSET_MODE
12076 	},
12077 	[ALC662_FIXUP_HEADSET_MODE] = {
12078 		.type = HDA_FIXUP_FUNC,
12079 		.v.func = alc_fixup_headset_mode_alc662,
12080 	},
12081 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12082 		.type = HDA_FIXUP_PINS,
12083 		.v.pins = (const struct hda_pintbl[]) {
12084 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12085 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12086 			{ }
12087 		},
12088 		.chained = true,
12089 		.chain_id = ALC668_FIXUP_HEADSET_MODE
12090 	},
12091 	[ALC668_FIXUP_HEADSET_MODE] = {
12092 		.type = HDA_FIXUP_FUNC,
12093 		.v.func = alc_fixup_headset_mode_alc668,
12094 	},
12095 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12096 		.type = HDA_FIXUP_FUNC,
12097 		.v.func = alc_fixup_bass_chmap,
12098 		.chained = true,
12099 		.chain_id = ALC662_FIXUP_ASUS_MODE4
12100 	},
12101 	[ALC662_FIXUP_BASS_16] = {
12102 		.type = HDA_FIXUP_PINS,
12103 		.v.pins = (const struct hda_pintbl[]) {
12104 			{0x16, 0x80106111}, /* bass speaker */
12105 			{}
12106 		},
12107 		.chained = true,
12108 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12109 	},
12110 	[ALC662_FIXUP_BASS_1A] = {
12111 		.type = HDA_FIXUP_PINS,
12112 		.v.pins = (const struct hda_pintbl[]) {
12113 			{0x1a, 0x80106111}, /* bass speaker */
12114 			{}
12115 		},
12116 		.chained = true,
12117 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12118 	},
12119 	[ALC662_FIXUP_BASS_CHMAP] = {
12120 		.type = HDA_FIXUP_FUNC,
12121 		.v.func = alc_fixup_bass_chmap,
12122 	},
12123 	[ALC662_FIXUP_ASUS_Nx50] = {
12124 		.type = HDA_FIXUP_FUNC,
12125 		.v.func = alc_fixup_auto_mute_via_amp,
12126 		.chained = true,
12127 		.chain_id = ALC662_FIXUP_BASS_1A
12128 	},
12129 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12130 		.type = HDA_FIXUP_FUNC,
12131 		.v.func = alc_fixup_headset_mode_alc668,
12132 		.chain_id = ALC662_FIXUP_BASS_CHMAP
12133 	},
12134 	[ALC668_FIXUP_ASUS_Nx51] = {
12135 		.type = HDA_FIXUP_PINS,
12136 		.v.pins = (const struct hda_pintbl[]) {
12137 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12138 			{ 0x1a, 0x90170151 }, /* bass speaker */
12139 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12140 			{}
12141 		},
12142 		.chained = true,
12143 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12144 	},
12145 	[ALC668_FIXUP_MIC_COEF] = {
12146 		.type = HDA_FIXUP_VERBS,
12147 		.v.verbs = (const struct hda_verb[]) {
12148 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12149 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12150 			{}
12151 		},
12152 	},
12153 	[ALC668_FIXUP_ASUS_G751] = {
12154 		.type = HDA_FIXUP_PINS,
12155 		.v.pins = (const struct hda_pintbl[]) {
12156 			{ 0x16, 0x0421101f }, /* HP */
12157 			{}
12158 		},
12159 		.chained = true,
12160 		.chain_id = ALC668_FIXUP_MIC_COEF
12161 	},
12162 	[ALC891_FIXUP_HEADSET_MODE] = {
12163 		.type = HDA_FIXUP_FUNC,
12164 		.v.func = alc_fixup_headset_mode,
12165 	},
12166 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
12167 		.type = HDA_FIXUP_PINS,
12168 		.v.pins = (const struct hda_pintbl[]) {
12169 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12170 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12171 			{ }
12172 		},
12173 		.chained = true,
12174 		.chain_id = ALC891_FIXUP_HEADSET_MODE
12175 	},
12176 	[ALC662_FIXUP_ACER_VERITON] = {
12177 		.type = HDA_FIXUP_PINS,
12178 		.v.pins = (const struct hda_pintbl[]) {
12179 			{ 0x15, 0x50170120 }, /* no internal speaker */
12180 			{ }
12181 		}
12182 	},
12183 	[ALC892_FIXUP_ASROCK_MOBO] = {
12184 		.type = HDA_FIXUP_PINS,
12185 		.v.pins = (const struct hda_pintbl[]) {
12186 			{ 0x15, 0x40f000f0 }, /* disabled */
12187 			{ 0x16, 0x40f000f0 }, /* disabled */
12188 			{ }
12189 		}
12190 	},
12191 	[ALC662_FIXUP_USI_FUNC] = {
12192 		.type = HDA_FIXUP_FUNC,
12193 		.v.func = alc662_fixup_usi_headset_mic,
12194 	},
12195 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
12196 		.type = HDA_FIXUP_PINS,
12197 		.v.pins = (const struct hda_pintbl[]) {
12198 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
12199 			{ 0x18, 0x01a1903d },
12200 			{ }
12201 		},
12202 		.chained = true,
12203 		.chain_id = ALC662_FIXUP_USI_FUNC
12204 	},
12205 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
12206 		.type = HDA_FIXUP_FUNC,
12207 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
12208 	},
12209 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
12210 		.type = HDA_FIXUP_FUNC,
12211 		.v.func = alc662_fixup_aspire_ethos_hp,
12212 	},
12213 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
12214 		.type = HDA_FIXUP_PINS,
12215 		.v.pins = (const struct hda_pintbl[]) {
12216 			{ 0x15, 0x92130110 }, /* front speakers */
12217 			{ 0x18, 0x99130111 }, /* center/subwoofer */
12218 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
12219 			{ }
12220 		},
12221 		.chained = true,
12222 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
12223 	},
12224 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
12225 		.type = HDA_FIXUP_FUNC,
12226 		.v.func = alc671_fixup_hp_headset_mic2,
12227 	},
12228 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
12229 		.type = HDA_FIXUP_PINS,
12230 		.v.pins = (const struct hda_pintbl[]) {
12231 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
12232 			{ }
12233 		},
12234 		.chained = true,
12235 		.chain_id = ALC662_FIXUP_USI_FUNC
12236 	},
12237 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
12238 		.type = HDA_FIXUP_PINS,
12239 		.v.pins = (const struct hda_pintbl[]) {
12240 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12241 			{ 0x1b, 0x0221144f },
12242 			{ }
12243 		},
12244 		.chained = true,
12245 		.chain_id = ALC662_FIXUP_USI_FUNC
12246 	},
12247 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
12248 		.type = HDA_FIXUP_PINS,
12249 		.v.pins = (const struct hda_pintbl[]) {
12250 			{ 0x1b, 0x04a1112c },
12251 			{ }
12252 		},
12253 		.chained = true,
12254 		.chain_id = ALC668_FIXUP_HEADSET_MIC
12255 	},
12256 	[ALC668_FIXUP_HEADSET_MIC] = {
12257 		.type = HDA_FIXUP_FUNC,
12258 		.v.func = alc269_fixup_headset_mic,
12259 		.chained = true,
12260 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
12261 	},
12262 	[ALC668_FIXUP_MIC_DET_COEF] = {
12263 		.type = HDA_FIXUP_VERBS,
12264 		.v.verbs = (const struct hda_verb[]) {
12265 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
12266 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
12267 			{}
12268 		},
12269 	},
12270 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
12271 		.type = HDA_FIXUP_FUNC,
12272 		.v.func = alc897_fixup_lenovo_headset_mic,
12273 	},
12274 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
12275 		.type = HDA_FIXUP_PINS,
12276 		.v.pins = (const struct hda_pintbl[]) {
12277 			{ 0x1a, 0x03a11050 },
12278 			{ }
12279 		},
12280 		.chained = true,
12281 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
12282 	},
12283 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
12284 		.type = HDA_FIXUP_PINS,
12285 		.v.pins = (const struct hda_pintbl[]) {
12286 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
12287 			{ }
12288 		},
12289 	},
12290 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
12291 		.type = HDA_FIXUP_FUNC,
12292 		.v.func = alc897_fixup_lenovo_headset_mode,
12293 	},
12294 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
12295 		.type = HDA_FIXUP_PINS,
12296 		.v.pins = (const struct hda_pintbl[]) {
12297 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12298 			{ }
12299 		},
12300 		.chained = true,
12301 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
12302 	},
12303 	[ALC897_FIXUP_UNIS_H3C_X500S] = {
12304 		.type = HDA_FIXUP_VERBS,
12305 		.v.verbs = (const struct hda_verb[]) {
12306 			{ 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
12307 			{}
12308 		},
12309 	},
12310 	[ALC897_FIXUP_HEADSET_MIC_PIN3] = {
12311 		.type = HDA_FIXUP_PINS,
12312 		.v.pins = (const struct hda_pintbl[]) {
12313 			{ 0x19, 0x03a11050 }, /* use as headset mic */
12314 			{ }
12315 		},
12316 	},
12317 };
12318 
12319 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
12320 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
12321 	SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
12322 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
12323 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
12324 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
12325 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
12326 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
12327 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
12328 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
12329 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
12330 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
12331 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
12332 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12333 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12334 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
12335 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
12336 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
12337 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12338 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12339 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12340 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12341 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12342 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
12343 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12344 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12345 	SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12346 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
12347 	SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
12348 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
12349 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
12350 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
12351 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
12352 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
12353 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
12354 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
12355 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12356 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
12357 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
12358 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
12359 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
12360 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
12361 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
12362 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12363 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
12364 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
12365 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
12366 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
12367 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
12368 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
12369 	SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
12370 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
12371 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
12372 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
12373 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
12374 	SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12375 	SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12376 	SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
12377 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
12378 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
12379 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
12380 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
12381 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
12382 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
12383 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
12384 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
12385 	SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
12386 
12387 #if 0
12388 	/* Below is a quirk table taken from the old code.
12389 	 * Basically the device should work as is without the fixup table.
12390 	 * If BIOS doesn't give a proper info, enable the corresponding
12391 	 * fixup entry.
12392 	 */
12393 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
12394 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
12395 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
12396 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
12397 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12398 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12399 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12400 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
12401 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
12402 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12403 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
12404 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
12405 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
12406 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
12407 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
12408 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12409 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
12410 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
12411 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12412 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12413 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12414 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12415 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
12416 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
12417 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
12418 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12419 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
12420 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12421 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12422 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
12423 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12424 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12425 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
12426 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
12427 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
12428 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
12429 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
12430 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
12431 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
12432 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12433 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
12434 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
12435 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12436 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
12437 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
12438 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
12439 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
12440 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
12441 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12442 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
12443 #endif
12444 	{}
12445 };
12446 
12447 static const struct hda_model_fixup alc662_fixup_models[] = {
12448 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
12449 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
12450 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
12451 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
12452 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
12453 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
12454 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
12455 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
12456 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
12457 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
12458 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
12459 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
12460 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
12461 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
12462 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
12463 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
12464 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
12465 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
12466 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
12467 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
12468 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
12469 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
12470 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
12471 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
12472 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
12473 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
12474 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
12475 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
12476 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
12477 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
12478 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
12479 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
12480 	{.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
12481 	{}
12482 };
12483 
12484 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
12485 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12486 		{0x17, 0x02211010},
12487 		{0x18, 0x01a19030},
12488 		{0x1a, 0x01813040},
12489 		{0x21, 0x01014020}),
12490 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12491 		{0x16, 0x01813030},
12492 		{0x17, 0x02211010},
12493 		{0x18, 0x01a19040},
12494 		{0x21, 0x01014020}),
12495 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12496 		{0x14, 0x01014010},
12497 		{0x18, 0x01a19020},
12498 		{0x1a, 0x0181302f},
12499 		{0x1b, 0x0221401f}),
12500 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12501 		{0x12, 0x99a30130},
12502 		{0x14, 0x90170110},
12503 		{0x15, 0x0321101f},
12504 		{0x16, 0x03011020}),
12505 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12506 		{0x12, 0x99a30140},
12507 		{0x14, 0x90170110},
12508 		{0x15, 0x0321101f},
12509 		{0x16, 0x03011020}),
12510 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12511 		{0x12, 0x99a30150},
12512 		{0x14, 0x90170110},
12513 		{0x15, 0x0321101f},
12514 		{0x16, 0x03011020}),
12515 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12516 		{0x14, 0x90170110},
12517 		{0x15, 0x0321101f},
12518 		{0x16, 0x03011020}),
12519 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
12520 		{0x12, 0x90a60130},
12521 		{0x14, 0x90170110},
12522 		{0x15, 0x0321101f}),
12523 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12524 		{0x14, 0x01014010},
12525 		{0x17, 0x90170150},
12526 		{0x19, 0x02a11060},
12527 		{0x1b, 0x01813030},
12528 		{0x21, 0x02211020}),
12529 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12530 		{0x14, 0x01014010},
12531 		{0x18, 0x01a19040},
12532 		{0x1b, 0x01813030},
12533 		{0x21, 0x02211020}),
12534 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12535 		{0x14, 0x01014020},
12536 		{0x17, 0x90170110},
12537 		{0x18, 0x01a19050},
12538 		{0x1b, 0x01813040},
12539 		{0x21, 0x02211030}),
12540 	{}
12541 };
12542 
12543 /*
12544  */
12545 static int patch_alc662(struct hda_codec *codec)
12546 {
12547 	struct alc_spec *spec;
12548 	int err;
12549 
12550 	err = alc_alloc_spec(codec, 0x0b);
12551 	if (err < 0)
12552 		return err;
12553 
12554 	spec = codec->spec;
12555 
12556 	spec->shutup = alc_eapd_shutup;
12557 
12558 	/* handle multiple HPs as is */
12559 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
12560 
12561 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
12562 
12563 	switch (codec->core.vendor_id) {
12564 	case 0x10ec0668:
12565 		spec->init_hook = alc668_restore_default_value;
12566 		break;
12567 	}
12568 
12569 	alc_pre_init(codec);
12570 
12571 	snd_hda_pick_fixup(codec, alc662_fixup_models,
12572 		       alc662_fixup_tbl, alc662_fixups);
12573 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
12574 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12575 
12576 	alc_auto_parse_customize_define(codec);
12577 
12578 	if (has_cdefine_beep(codec))
12579 		spec->gen.beep_nid = 0x01;
12580 
12581 	if ((alc_get_coef0(codec) & (1 << 14)) &&
12582 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
12583 	    spec->cdefine.platform_type == 1) {
12584 		err = alc_codec_rename(codec, "ALC272X");
12585 		if (err < 0)
12586 			goto error;
12587 	}
12588 
12589 	/* automatic parse from the BIOS config */
12590 	err = alc662_parse_auto_config(codec);
12591 	if (err < 0)
12592 		goto error;
12593 
12594 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
12595 		switch (codec->core.vendor_id) {
12596 		case 0x10ec0662:
12597 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12598 			break;
12599 		case 0x10ec0272:
12600 		case 0x10ec0663:
12601 		case 0x10ec0665:
12602 		case 0x10ec0668:
12603 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12604 			break;
12605 		case 0x10ec0273:
12606 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
12607 			break;
12608 		}
12609 		if (err < 0)
12610 			goto error;
12611 	}
12612 
12613 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12614 
12615 	return 0;
12616 
12617  error:
12618 	alc_free(codec);
12619 	return err;
12620 }
12621 
12622 /*
12623  * ALC680 support
12624  */
12625 
12626 static int alc680_parse_auto_config(struct hda_codec *codec)
12627 {
12628 	return alc_parse_auto_config(codec, NULL, NULL);
12629 }
12630 
12631 /*
12632  */
12633 static int patch_alc680(struct hda_codec *codec)
12634 {
12635 	int err;
12636 
12637 	/* ALC680 has no aa-loopback mixer */
12638 	err = alc_alloc_spec(codec, 0);
12639 	if (err < 0)
12640 		return err;
12641 
12642 	/* automatic parse from the BIOS config */
12643 	err = alc680_parse_auto_config(codec);
12644 	if (err < 0) {
12645 		alc_free(codec);
12646 		return err;
12647 	}
12648 
12649 	return 0;
12650 }
12651 
12652 /*
12653  * patch entries
12654  */
12655 static const struct hda_device_id snd_hda_id_realtek[] = {
12656 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
12657 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
12658 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
12659 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
12660 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
12661 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
12662 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
12663 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
12664 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
12665 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
12666 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
12667 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
12668 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
12669 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
12670 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
12671 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
12672 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
12673 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
12674 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
12675 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
12676 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
12677 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
12678 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
12679 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
12680 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
12681 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
12682 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
12683 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
12684 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
12685 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
12686 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
12687 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
12688 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
12689 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
12690 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
12691 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
12692 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
12693 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
12694 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
12695 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
12696 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
12697 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
12698 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
12699 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
12700 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
12701 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
12702 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
12703 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
12704 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
12705 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
12706 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
12707 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
12708 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
12709 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
12710 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
12711 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
12712 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
12713 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
12714 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
12715 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
12716 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
12717 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
12718 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
12719 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
12720 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
12721 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
12722 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
12723 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
12724 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
12725 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
12726 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
12727 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
12728 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
12729 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
12730 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
12731 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
12732 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
12733 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
12734 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
12735 	{} /* terminator */
12736 };
12737 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
12738 
12739 MODULE_LICENSE("GPL");
12740 MODULE_DESCRIPTION("Realtek HD-audio codec");
12741 
12742 static struct hda_codec_driver realtek_driver = {
12743 	.id = snd_hda_id_realtek,
12744 };
12745 
12746 module_hda_codec_driver(realtek_driver);
12747