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