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