xref: /openbmc/linux/sound/pci/hda/patch_realtek.c (revision c96651a0)
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 /* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6433 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6434 						  const struct hda_fixup *fix,
6435 						  int action)
6436 {
6437 	struct alc_spec *spec = codec->spec;
6438 
6439 	switch (action) {
6440 	case HDA_FIXUP_ACT_PRE_PROBE:
6441 		spec->gen.suppress_auto_mute = 1;
6442 		break;
6443 	}
6444 }
6445 
6446 /* for alc295_fixup_hp_top_speakers */
6447 #include "hp_x360_helper.c"
6448 
6449 /* for alc285_fixup_ideapad_s740_coef() */
6450 #include "ideapad_s740_helper.c"
6451 
6452 enum {
6453 	ALC269_FIXUP_GPIO2,
6454 	ALC269_FIXUP_SONY_VAIO,
6455 	ALC275_FIXUP_SONY_VAIO_GPIO2,
6456 	ALC269_FIXUP_DELL_M101Z,
6457 	ALC269_FIXUP_SKU_IGNORE,
6458 	ALC269_FIXUP_ASUS_G73JW,
6459 	ALC269_FIXUP_LENOVO_EAPD,
6460 	ALC275_FIXUP_SONY_HWEQ,
6461 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
6462 	ALC271_FIXUP_DMIC,
6463 	ALC269_FIXUP_PCM_44K,
6464 	ALC269_FIXUP_STEREO_DMIC,
6465 	ALC269_FIXUP_HEADSET_MIC,
6466 	ALC269_FIXUP_QUANTA_MUTE,
6467 	ALC269_FIXUP_LIFEBOOK,
6468 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
6469 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
6470 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
6471 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
6472 	ALC269_FIXUP_AMIC,
6473 	ALC269_FIXUP_DMIC,
6474 	ALC269VB_FIXUP_AMIC,
6475 	ALC269VB_FIXUP_DMIC,
6476 	ALC269_FIXUP_HP_MUTE_LED,
6477 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
6478 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
6479 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
6480 	ALC269_FIXUP_HP_GPIO_LED,
6481 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
6482 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
6483 	ALC269_FIXUP_INV_DMIC,
6484 	ALC269_FIXUP_LENOVO_DOCK,
6485 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
6486 	ALC269_FIXUP_NO_SHUTUP,
6487 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
6488 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
6489 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6490 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6491 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6492 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6493 	ALC269_FIXUP_HEADSET_MODE,
6494 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
6495 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
6496 	ALC269_FIXUP_ASUS_X101_FUNC,
6497 	ALC269_FIXUP_ASUS_X101_VERB,
6498 	ALC269_FIXUP_ASUS_X101,
6499 	ALC271_FIXUP_AMIC_MIC2,
6500 	ALC271_FIXUP_HP_GATE_MIC_JACK,
6501 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
6502 	ALC269_FIXUP_ACER_AC700,
6503 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
6504 	ALC269VB_FIXUP_ASUS_ZENBOOK,
6505 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
6506 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
6507 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
6508 	ALC283_FIXUP_CHROME_BOOK,
6509 	ALC283_FIXUP_SENSE_COMBO_JACK,
6510 	ALC282_FIXUP_ASUS_TX300,
6511 	ALC283_FIXUP_INT_MIC,
6512 	ALC290_FIXUP_MONO_SPEAKERS,
6513 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6514 	ALC290_FIXUP_SUBWOOFER,
6515 	ALC290_FIXUP_SUBWOOFER_HSJACK,
6516 	ALC269_FIXUP_THINKPAD_ACPI,
6517 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
6518 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
6519 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6520 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6521 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
6522 	ALC255_FIXUP_HEADSET_MODE,
6523 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
6524 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
6525 	ALC292_FIXUP_TPT440_DOCK,
6526 	ALC292_FIXUP_TPT440,
6527 	ALC283_FIXUP_HEADSET_MIC,
6528 	ALC255_FIXUP_MIC_MUTE_LED,
6529 	ALC282_FIXUP_ASPIRE_V5_PINS,
6530 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
6531 	ALC280_FIXUP_HP_GPIO4,
6532 	ALC286_FIXUP_HP_GPIO_LED,
6533 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
6534 	ALC280_FIXUP_HP_DOCK_PINS,
6535 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
6536 	ALC280_FIXUP_HP_9480M,
6537 	ALC245_FIXUP_HP_X360_AMP,
6538 	ALC288_FIXUP_DELL_HEADSET_MODE,
6539 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
6540 	ALC288_FIXUP_DELL_XPS_13,
6541 	ALC288_FIXUP_DISABLE_AAMIX,
6542 	ALC292_FIXUP_DELL_E7X_AAMIX,
6543 	ALC292_FIXUP_DELL_E7X,
6544 	ALC292_FIXUP_DISABLE_AAMIX,
6545 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
6546 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
6547 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6548 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6549 	ALC275_FIXUP_DELL_XPS,
6550 	ALC293_FIXUP_LENOVO_SPK_NOISE,
6551 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
6552 	ALC255_FIXUP_DELL_SPK_NOISE,
6553 	ALC225_FIXUP_DISABLE_MIC_VREF,
6554 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6555 	ALC295_FIXUP_DISABLE_DAC3,
6556 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
6557 	ALC280_FIXUP_HP_HEADSET_MIC,
6558 	ALC221_FIXUP_HP_FRONT_MIC,
6559 	ALC292_FIXUP_TPT460,
6560 	ALC298_FIXUP_SPK_VOLUME,
6561 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
6562 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
6563 	ALC269_FIXUP_ATIV_BOOK_8,
6564 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
6565 	ALC256_FIXUP_ASUS_HEADSET_MODE,
6566 	ALC256_FIXUP_ASUS_MIC,
6567 	ALC256_FIXUP_ASUS_AIO_GPIO2,
6568 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6569 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
6570 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
6571 	ALC233_FIXUP_ACER_HEADSET_MIC,
6572 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
6573 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
6574 	ALC225_FIXUP_S3_POP_NOISE,
6575 	ALC700_FIXUP_INTEL_REFERENCE,
6576 	ALC274_FIXUP_DELL_BIND_DACS,
6577 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
6578 	ALC298_FIXUP_TPT470_DOCK_FIX,
6579 	ALC298_FIXUP_TPT470_DOCK,
6580 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
6581 	ALC255_FIXUP_DELL_HEADSET_MIC,
6582 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
6583 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
6584 	ALC295_FIXUP_HP_X360,
6585 	ALC221_FIXUP_HP_HEADSET_MIC,
6586 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
6587 	ALC295_FIXUP_HP_AUTO_MUTE,
6588 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
6589 	ALC294_FIXUP_ASUS_MIC,
6590 	ALC294_FIXUP_ASUS_HEADSET_MIC,
6591 	ALC294_FIXUP_ASUS_SPK,
6592 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
6593 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
6594 	ALC255_FIXUP_ACER_HEADSET_MIC,
6595 	ALC295_FIXUP_CHROME_BOOK,
6596 	ALC225_FIXUP_HEADSET_JACK,
6597 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6598 	ALC225_FIXUP_WYSE_AUTO_MUTE,
6599 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
6600 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
6601 	ALC256_FIXUP_ASUS_HEADSET_MIC,
6602 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
6603 	ALC299_FIXUP_PREDATOR_SPK,
6604 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
6605 	ALC289_FIXUP_DELL_SPK2,
6606 	ALC289_FIXUP_DUAL_SPK,
6607 	ALC294_FIXUP_SPK2_TO_DAC1,
6608 	ALC294_FIXUP_ASUS_DUAL_SPK,
6609 	ALC285_FIXUP_THINKPAD_X1_GEN7,
6610 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
6611 	ALC294_FIXUP_ASUS_HPE,
6612 	ALC294_FIXUP_ASUS_COEF_1B,
6613 	ALC294_FIXUP_ASUS_GX502_HP,
6614 	ALC294_FIXUP_ASUS_GX502_PINS,
6615 	ALC294_FIXUP_ASUS_GX502_VERBS,
6616 	ALC294_FIXUP_ASUS_GU502_HP,
6617 	ALC294_FIXUP_ASUS_GU502_PINS,
6618 	ALC294_FIXUP_ASUS_GU502_VERBS,
6619 	ALC285_FIXUP_HP_GPIO_LED,
6620 	ALC285_FIXUP_HP_MUTE_LED,
6621 	ALC236_FIXUP_HP_GPIO_LED,
6622 	ALC236_FIXUP_HP_MUTE_LED,
6623 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
6624 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
6625 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
6626 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6627 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
6628 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
6629 	ALC289_FIXUP_ASUS_GA401,
6630 	ALC289_FIXUP_ASUS_GA502,
6631 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
6632 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
6633 	ALC269_FIXUP_CZC_B20,
6634 	ALC269_FIXUP_CZC_TMI,
6635 	ALC269_FIXUP_CZC_L101,
6636 	ALC269_FIXUP_LEMOTE_A1802,
6637 	ALC269_FIXUP_LEMOTE_A190X,
6638 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
6639 	ALC233_FIXUP_INTEL_NUC8_DMIC,
6640 	ALC233_FIXUP_INTEL_NUC8_BOOST,
6641 	ALC256_FIXUP_INTEL_NUC10,
6642 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
6643 	ALC274_FIXUP_HP_MIC,
6644 	ALC274_FIXUP_HP_HEADSET_MIC,
6645 	ALC274_FIXUP_HP_ENVY_GPIO,
6646 	ALC256_FIXUP_ASUS_HPE,
6647 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
6648 	ALC287_FIXUP_HP_GPIO_LED,
6649 	ALC256_FIXUP_HP_HEADSET_MIC,
6650 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
6651 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
6652 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
6653 	ALC256_FIXUP_ACER_HEADSET_MIC,
6654 	ALC285_FIXUP_IDEAPAD_S740_COEF,
6655 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
6656 	ALC295_FIXUP_ASUS_DACS,
6657 	ALC295_FIXUP_HP_OMEN,
6658 	ALC285_FIXUP_HP_SPECTRE_X360,
6659 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
6660 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
6661 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
6662 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
6663 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6664 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6665 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
6666 	ALC287_FIXUP_13S_GEN2_SPEAKERS
6667 };
6668 
6669 static const struct hda_fixup alc269_fixups[] = {
6670 	[ALC269_FIXUP_GPIO2] = {
6671 		.type = HDA_FIXUP_FUNC,
6672 		.v.func = alc_fixup_gpio2,
6673 	},
6674 	[ALC269_FIXUP_SONY_VAIO] = {
6675 		.type = HDA_FIXUP_PINCTLS,
6676 		.v.pins = (const struct hda_pintbl[]) {
6677 			{0x19, PIN_VREFGRD},
6678 			{}
6679 		}
6680 	},
6681 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
6682 		.type = HDA_FIXUP_FUNC,
6683 		.v.func = alc275_fixup_gpio4_off,
6684 		.chained = true,
6685 		.chain_id = ALC269_FIXUP_SONY_VAIO
6686 	},
6687 	[ALC269_FIXUP_DELL_M101Z] = {
6688 		.type = HDA_FIXUP_VERBS,
6689 		.v.verbs = (const struct hda_verb[]) {
6690 			/* Enables internal speaker */
6691 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
6692 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6693 			{}
6694 		}
6695 	},
6696 	[ALC269_FIXUP_SKU_IGNORE] = {
6697 		.type = HDA_FIXUP_FUNC,
6698 		.v.func = alc_fixup_sku_ignore,
6699 	},
6700 	[ALC269_FIXUP_ASUS_G73JW] = {
6701 		.type = HDA_FIXUP_PINS,
6702 		.v.pins = (const struct hda_pintbl[]) {
6703 			{ 0x17, 0x99130111 }, /* subwoofer */
6704 			{ }
6705 		}
6706 	},
6707 	[ALC269_FIXUP_LENOVO_EAPD] = {
6708 		.type = HDA_FIXUP_VERBS,
6709 		.v.verbs = (const struct hda_verb[]) {
6710 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6711 			{}
6712 		}
6713 	},
6714 	[ALC275_FIXUP_SONY_HWEQ] = {
6715 		.type = HDA_FIXUP_FUNC,
6716 		.v.func = alc269_fixup_hweq,
6717 		.chained = true,
6718 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6719 	},
6720 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6721 		.type = HDA_FIXUP_FUNC,
6722 		.v.func = alc_fixup_disable_aamix,
6723 		.chained = true,
6724 		.chain_id = ALC269_FIXUP_SONY_VAIO
6725 	},
6726 	[ALC271_FIXUP_DMIC] = {
6727 		.type = HDA_FIXUP_FUNC,
6728 		.v.func = alc271_fixup_dmic,
6729 	},
6730 	[ALC269_FIXUP_PCM_44K] = {
6731 		.type = HDA_FIXUP_FUNC,
6732 		.v.func = alc269_fixup_pcm_44k,
6733 		.chained = true,
6734 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
6735 	},
6736 	[ALC269_FIXUP_STEREO_DMIC] = {
6737 		.type = HDA_FIXUP_FUNC,
6738 		.v.func = alc269_fixup_stereo_dmic,
6739 	},
6740 	[ALC269_FIXUP_HEADSET_MIC] = {
6741 		.type = HDA_FIXUP_FUNC,
6742 		.v.func = alc269_fixup_headset_mic,
6743 	},
6744 	[ALC269_FIXUP_QUANTA_MUTE] = {
6745 		.type = HDA_FIXUP_FUNC,
6746 		.v.func = alc269_fixup_quanta_mute,
6747 	},
6748 	[ALC269_FIXUP_LIFEBOOK] = {
6749 		.type = HDA_FIXUP_PINS,
6750 		.v.pins = (const struct hda_pintbl[]) {
6751 			{ 0x1a, 0x2101103f }, /* dock line-out */
6752 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
6753 			{ }
6754 		},
6755 		.chained = true,
6756 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
6757 	},
6758 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6759 		.type = HDA_FIXUP_PINS,
6760 		.v.pins = (const struct hda_pintbl[]) {
6761 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6762 			{ }
6763 		},
6764 	},
6765 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6766 		.type = HDA_FIXUP_PINS,
6767 		.v.pins = (const struct hda_pintbl[]) {
6768 			{ 0x21, 0x0221102f }, /* HP out */
6769 			{ }
6770 		},
6771 	},
6772 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6773 		.type = HDA_FIXUP_FUNC,
6774 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6775 	},
6776 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6777 		.type = HDA_FIXUP_FUNC,
6778 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6779 	},
6780 	[ALC269_FIXUP_AMIC] = {
6781 		.type = HDA_FIXUP_PINS,
6782 		.v.pins = (const struct hda_pintbl[]) {
6783 			{ 0x14, 0x99130110 }, /* speaker */
6784 			{ 0x15, 0x0121401f }, /* HP out */
6785 			{ 0x18, 0x01a19c20 }, /* mic */
6786 			{ 0x19, 0x99a3092f }, /* int-mic */
6787 			{ }
6788 		},
6789 	},
6790 	[ALC269_FIXUP_DMIC] = {
6791 		.type = HDA_FIXUP_PINS,
6792 		.v.pins = (const struct hda_pintbl[]) {
6793 			{ 0x12, 0x99a3092f }, /* int-mic */
6794 			{ 0x14, 0x99130110 }, /* speaker */
6795 			{ 0x15, 0x0121401f }, /* HP out */
6796 			{ 0x18, 0x01a19c20 }, /* mic */
6797 			{ }
6798 		},
6799 	},
6800 	[ALC269VB_FIXUP_AMIC] = {
6801 		.type = HDA_FIXUP_PINS,
6802 		.v.pins = (const struct hda_pintbl[]) {
6803 			{ 0x14, 0x99130110 }, /* speaker */
6804 			{ 0x18, 0x01a19c20 }, /* mic */
6805 			{ 0x19, 0x99a3092f }, /* int-mic */
6806 			{ 0x21, 0x0121401f }, /* HP out */
6807 			{ }
6808 		},
6809 	},
6810 	[ALC269VB_FIXUP_DMIC] = {
6811 		.type = HDA_FIXUP_PINS,
6812 		.v.pins = (const struct hda_pintbl[]) {
6813 			{ 0x12, 0x99a3092f }, /* int-mic */
6814 			{ 0x14, 0x99130110 }, /* speaker */
6815 			{ 0x18, 0x01a19c20 }, /* mic */
6816 			{ 0x21, 0x0121401f }, /* HP out */
6817 			{ }
6818 		},
6819 	},
6820 	[ALC269_FIXUP_HP_MUTE_LED] = {
6821 		.type = HDA_FIXUP_FUNC,
6822 		.v.func = alc269_fixup_hp_mute_led,
6823 	},
6824 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6825 		.type = HDA_FIXUP_FUNC,
6826 		.v.func = alc269_fixup_hp_mute_led_mic1,
6827 	},
6828 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
6829 		.type = HDA_FIXUP_FUNC,
6830 		.v.func = alc269_fixup_hp_mute_led_mic2,
6831 	},
6832 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6833 		.type = HDA_FIXUP_FUNC,
6834 		.v.func = alc269_fixup_hp_mute_led_mic3,
6835 		.chained = true,
6836 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
6837 	},
6838 	[ALC269_FIXUP_HP_GPIO_LED] = {
6839 		.type = HDA_FIXUP_FUNC,
6840 		.v.func = alc269_fixup_hp_gpio_led,
6841 	},
6842 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6843 		.type = HDA_FIXUP_FUNC,
6844 		.v.func = alc269_fixup_hp_gpio_mic1_led,
6845 	},
6846 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6847 		.type = HDA_FIXUP_FUNC,
6848 		.v.func = alc269_fixup_hp_line1_mic1_led,
6849 	},
6850 	[ALC269_FIXUP_INV_DMIC] = {
6851 		.type = HDA_FIXUP_FUNC,
6852 		.v.func = alc_fixup_inv_dmic,
6853 	},
6854 	[ALC269_FIXUP_NO_SHUTUP] = {
6855 		.type = HDA_FIXUP_FUNC,
6856 		.v.func = alc_fixup_no_shutup,
6857 	},
6858 	[ALC269_FIXUP_LENOVO_DOCK] = {
6859 		.type = HDA_FIXUP_PINS,
6860 		.v.pins = (const struct hda_pintbl[]) {
6861 			{ 0x19, 0x23a11040 }, /* dock mic */
6862 			{ 0x1b, 0x2121103f }, /* dock headphone */
6863 			{ }
6864 		},
6865 		.chained = true,
6866 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6867 	},
6868 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6869 		.type = HDA_FIXUP_FUNC,
6870 		.v.func = alc269_fixup_limit_int_mic_boost,
6871 		.chained = true,
6872 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
6873 	},
6874 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
6875 		.type = HDA_FIXUP_FUNC,
6876 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6877 		.chained = true,
6878 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6879 	},
6880 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6881 		.type = HDA_FIXUP_PINS,
6882 		.v.pins = (const struct hda_pintbl[]) {
6883 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6884 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6885 			{ }
6886 		},
6887 		.chained = true,
6888 		.chain_id = ALC269_FIXUP_HEADSET_MODE
6889 	},
6890 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6891 		.type = HDA_FIXUP_PINS,
6892 		.v.pins = (const struct hda_pintbl[]) {
6893 			{ 0x16, 0x21014020 }, /* dock line out */
6894 			{ 0x19, 0x21a19030 }, /* dock mic */
6895 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6896 			{ }
6897 		},
6898 		.chained = true,
6899 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6900 	},
6901 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
6902 		.type = HDA_FIXUP_PINS,
6903 		.v.pins = (const struct hda_pintbl[]) {
6904 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6905 			{ }
6906 		},
6907 		.chained = true,
6908 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6909 	},
6910 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6911 		.type = HDA_FIXUP_PINS,
6912 		.v.pins = (const struct hda_pintbl[]) {
6913 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6914 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6915 			{ }
6916 		},
6917 		.chained = true,
6918 		.chain_id = ALC269_FIXUP_HEADSET_MODE
6919 	},
6920 	[ALC269_FIXUP_HEADSET_MODE] = {
6921 		.type = HDA_FIXUP_FUNC,
6922 		.v.func = alc_fixup_headset_mode,
6923 		.chained = true,
6924 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
6925 	},
6926 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6927 		.type = HDA_FIXUP_FUNC,
6928 		.v.func = alc_fixup_headset_mode_no_hp_mic,
6929 	},
6930 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6931 		.type = HDA_FIXUP_PINS,
6932 		.v.pins = (const struct hda_pintbl[]) {
6933 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6934 			{ }
6935 		},
6936 		.chained = true,
6937 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
6938 	},
6939 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6940 		.type = HDA_FIXUP_PINS,
6941 		.v.pins = (const struct hda_pintbl[]) {
6942 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6943 			{ }
6944 		},
6945 		.chained = true,
6946 		.chain_id = ALC269_FIXUP_HEADSET_MIC
6947 	},
6948 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
6949 		.type = HDA_FIXUP_PINS,
6950 		.v.pins = (const struct hda_pintbl[]) {
6951 			{0x12, 0x90a60130},
6952 			{0x13, 0x40000000},
6953 			{0x14, 0x90170110},
6954 			{0x18, 0x411111f0},
6955 			{0x19, 0x04a11040},
6956 			{0x1a, 0x411111f0},
6957 			{0x1b, 0x90170112},
6958 			{0x1d, 0x40759a05},
6959 			{0x1e, 0x411111f0},
6960 			{0x21, 0x04211020},
6961 			{ }
6962 		},
6963 		.chained = true,
6964 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
6965 	},
6966 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
6967 		.type = HDA_FIXUP_FUNC,
6968 		.v.func = alc298_fixup_huawei_mbx_stereo,
6969 		.chained = true,
6970 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
6971 	},
6972 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
6973 		.type = HDA_FIXUP_FUNC,
6974 		.v.func = alc269_fixup_x101_headset_mic,
6975 	},
6976 	[ALC269_FIXUP_ASUS_X101_VERB] = {
6977 		.type = HDA_FIXUP_VERBS,
6978 		.v.verbs = (const struct hda_verb[]) {
6979 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6980 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6981 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
6982 			{ }
6983 		},
6984 		.chained = true,
6985 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6986 	},
6987 	[ALC269_FIXUP_ASUS_X101] = {
6988 		.type = HDA_FIXUP_PINS,
6989 		.v.pins = (const struct hda_pintbl[]) {
6990 			{ 0x18, 0x04a1182c }, /* Headset mic */
6991 			{ }
6992 		},
6993 		.chained = true,
6994 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
6995 	},
6996 	[ALC271_FIXUP_AMIC_MIC2] = {
6997 		.type = HDA_FIXUP_PINS,
6998 		.v.pins = (const struct hda_pintbl[]) {
6999 			{ 0x14, 0x99130110 }, /* speaker */
7000 			{ 0x19, 0x01a19c20 }, /* mic */
7001 			{ 0x1b, 0x99a7012f }, /* int-mic */
7002 			{ 0x21, 0x0121401f }, /* HP out */
7003 			{ }
7004 		},
7005 	},
7006 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7007 		.type = HDA_FIXUP_FUNC,
7008 		.v.func = alc271_hp_gate_mic_jack,
7009 		.chained = true,
7010 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
7011 	},
7012 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7013 		.type = HDA_FIXUP_FUNC,
7014 		.v.func = alc269_fixup_limit_int_mic_boost,
7015 		.chained = true,
7016 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7017 	},
7018 	[ALC269_FIXUP_ACER_AC700] = {
7019 		.type = HDA_FIXUP_PINS,
7020 		.v.pins = (const struct hda_pintbl[]) {
7021 			{ 0x12, 0x99a3092f }, /* int-mic */
7022 			{ 0x14, 0x99130110 }, /* speaker */
7023 			{ 0x18, 0x03a11c20 }, /* mic */
7024 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
7025 			{ 0x21, 0x0321101f }, /* HP out */
7026 			{ }
7027 		},
7028 		.chained = true,
7029 		.chain_id = ALC271_FIXUP_DMIC,
7030 	},
7031 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7032 		.type = HDA_FIXUP_FUNC,
7033 		.v.func = alc269_fixup_limit_int_mic_boost,
7034 		.chained = true,
7035 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7036 	},
7037 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7038 		.type = HDA_FIXUP_FUNC,
7039 		.v.func = alc269_fixup_limit_int_mic_boost,
7040 		.chained = true,
7041 		.chain_id = ALC269VB_FIXUP_DMIC,
7042 	},
7043 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7044 		.type = HDA_FIXUP_VERBS,
7045 		.v.verbs = (const struct hda_verb[]) {
7046 			/* class-D output amp +5dB */
7047 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7048 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7049 			{}
7050 		},
7051 		.chained = true,
7052 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7053 	},
7054 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7055 		.type = HDA_FIXUP_FUNC,
7056 		.v.func = alc269_fixup_limit_int_mic_boost,
7057 		.chained = true,
7058 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7059 	},
7060 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7061 		.type = HDA_FIXUP_PINS,
7062 		.v.pins = (const struct hda_pintbl[]) {
7063 			{ 0x12, 0x99a3092f }, /* int-mic */
7064 			{ 0x18, 0x03a11d20 }, /* mic */
7065 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
7066 			{ }
7067 		},
7068 	},
7069 	[ALC283_FIXUP_CHROME_BOOK] = {
7070 		.type = HDA_FIXUP_FUNC,
7071 		.v.func = alc283_fixup_chromebook,
7072 	},
7073 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
7074 		.type = HDA_FIXUP_FUNC,
7075 		.v.func = alc283_fixup_sense_combo_jack,
7076 		.chained = true,
7077 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
7078 	},
7079 	[ALC282_FIXUP_ASUS_TX300] = {
7080 		.type = HDA_FIXUP_FUNC,
7081 		.v.func = alc282_fixup_asus_tx300,
7082 	},
7083 	[ALC283_FIXUP_INT_MIC] = {
7084 		.type = HDA_FIXUP_VERBS,
7085 		.v.verbs = (const struct hda_verb[]) {
7086 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7087 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7088 			{ }
7089 		},
7090 		.chained = true,
7091 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7092 	},
7093 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7094 		.type = HDA_FIXUP_PINS,
7095 		.v.pins = (const struct hda_pintbl[]) {
7096 			{ 0x17, 0x90170112 }, /* subwoofer */
7097 			{ }
7098 		},
7099 		.chained = true,
7100 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7101 	},
7102 	[ALC290_FIXUP_SUBWOOFER] = {
7103 		.type = HDA_FIXUP_PINS,
7104 		.v.pins = (const struct hda_pintbl[]) {
7105 			{ 0x17, 0x90170112 }, /* subwoofer */
7106 			{ }
7107 		},
7108 		.chained = true,
7109 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7110 	},
7111 	[ALC290_FIXUP_MONO_SPEAKERS] = {
7112 		.type = HDA_FIXUP_FUNC,
7113 		.v.func = alc290_fixup_mono_speakers,
7114 	},
7115 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7116 		.type = HDA_FIXUP_FUNC,
7117 		.v.func = alc290_fixup_mono_speakers,
7118 		.chained = true,
7119 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7120 	},
7121 	[ALC269_FIXUP_THINKPAD_ACPI] = {
7122 		.type = HDA_FIXUP_FUNC,
7123 		.v.func = alc_fixup_thinkpad_acpi,
7124 		.chained = true,
7125 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
7126 	},
7127 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7128 		.type = HDA_FIXUP_FUNC,
7129 		.v.func = alc_fixup_inv_dmic,
7130 		.chained = true,
7131 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7132 	},
7133 	[ALC255_FIXUP_ACER_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 			{ }
7138 		},
7139 		.chained = true,
7140 		.chain_id = ALC255_FIXUP_HEADSET_MODE
7141 	},
7142 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7143 		.type = HDA_FIXUP_PINS,
7144 		.v.pins = (const struct hda_pintbl[]) {
7145 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7146 			{ }
7147 		},
7148 		.chained = true,
7149 		.chain_id = ALC255_FIXUP_HEADSET_MODE
7150 	},
7151 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7152 		.type = HDA_FIXUP_PINS,
7153 		.v.pins = (const struct hda_pintbl[]) {
7154 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7155 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7156 			{ }
7157 		},
7158 		.chained = true,
7159 		.chain_id = ALC255_FIXUP_HEADSET_MODE
7160 	},
7161 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7162 		.type = HDA_FIXUP_PINS,
7163 		.v.pins = (const struct hda_pintbl[]) {
7164 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7165 			{ }
7166 		},
7167 		.chained = true,
7168 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7169 	},
7170 	[ALC255_FIXUP_HEADSET_MODE] = {
7171 		.type = HDA_FIXUP_FUNC,
7172 		.v.func = alc_fixup_headset_mode_alc255,
7173 		.chained = true,
7174 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7175 	},
7176 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7177 		.type = HDA_FIXUP_FUNC,
7178 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7179 	},
7180 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7181 		.type = HDA_FIXUP_PINS,
7182 		.v.pins = (const struct hda_pintbl[]) {
7183 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7184 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7185 			{ }
7186 		},
7187 		.chained = true,
7188 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7189 	},
7190 	[ALC292_FIXUP_TPT440_DOCK] = {
7191 		.type = HDA_FIXUP_FUNC,
7192 		.v.func = alc_fixup_tpt440_dock,
7193 		.chained = true,
7194 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7195 	},
7196 	[ALC292_FIXUP_TPT440] = {
7197 		.type = HDA_FIXUP_FUNC,
7198 		.v.func = alc_fixup_disable_aamix,
7199 		.chained = true,
7200 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
7201 	},
7202 	[ALC283_FIXUP_HEADSET_MIC] = {
7203 		.type = HDA_FIXUP_PINS,
7204 		.v.pins = (const struct hda_pintbl[]) {
7205 			{ 0x19, 0x04a110f0 },
7206 			{ },
7207 		},
7208 	},
7209 	[ALC255_FIXUP_MIC_MUTE_LED] = {
7210 		.type = HDA_FIXUP_FUNC,
7211 		.v.func = alc_fixup_micmute_led,
7212 	},
7213 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
7214 		.type = HDA_FIXUP_PINS,
7215 		.v.pins = (const struct hda_pintbl[]) {
7216 			{ 0x12, 0x90a60130 },
7217 			{ 0x14, 0x90170110 },
7218 			{ 0x17, 0x40000008 },
7219 			{ 0x18, 0x411111f0 },
7220 			{ 0x19, 0x01a1913c },
7221 			{ 0x1a, 0x411111f0 },
7222 			{ 0x1b, 0x411111f0 },
7223 			{ 0x1d, 0x40f89b2d },
7224 			{ 0x1e, 0x411111f0 },
7225 			{ 0x21, 0x0321101f },
7226 			{ },
7227 		},
7228 	},
7229 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7230 		.type = HDA_FIXUP_FUNC,
7231 		.v.func = alc269vb_fixup_aspire_e1_coef,
7232 	},
7233 	[ALC280_FIXUP_HP_GPIO4] = {
7234 		.type = HDA_FIXUP_FUNC,
7235 		.v.func = alc280_fixup_hp_gpio4,
7236 	},
7237 	[ALC286_FIXUP_HP_GPIO_LED] = {
7238 		.type = HDA_FIXUP_FUNC,
7239 		.v.func = alc286_fixup_hp_gpio_led,
7240 	},
7241 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7242 		.type = HDA_FIXUP_FUNC,
7243 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7244 	},
7245 	[ALC280_FIXUP_HP_DOCK_PINS] = {
7246 		.type = HDA_FIXUP_PINS,
7247 		.v.pins = (const struct hda_pintbl[]) {
7248 			{ 0x1b, 0x21011020 }, /* line-out */
7249 			{ 0x1a, 0x01a1903c }, /* headset mic */
7250 			{ 0x18, 0x2181103f }, /* line-in */
7251 			{ },
7252 		},
7253 		.chained = true,
7254 		.chain_id = ALC280_FIXUP_HP_GPIO4
7255 	},
7256 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7257 		.type = HDA_FIXUP_PINS,
7258 		.v.pins = (const struct hda_pintbl[]) {
7259 			{ 0x1b, 0x21011020 }, /* line-out */
7260 			{ 0x18, 0x2181103f }, /* line-in */
7261 			{ },
7262 		},
7263 		.chained = true,
7264 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7265 	},
7266 	[ALC280_FIXUP_HP_9480M] = {
7267 		.type = HDA_FIXUP_FUNC,
7268 		.v.func = alc280_fixup_hp_9480m,
7269 	},
7270 	[ALC245_FIXUP_HP_X360_AMP] = {
7271 		.type = HDA_FIXUP_FUNC,
7272 		.v.func = alc245_fixup_hp_x360_amp,
7273 	},
7274 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
7275 		.type = HDA_FIXUP_FUNC,
7276 		.v.func = alc_fixup_headset_mode_dell_alc288,
7277 		.chained = true,
7278 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7279 	},
7280 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7281 		.type = HDA_FIXUP_PINS,
7282 		.v.pins = (const struct hda_pintbl[]) {
7283 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7284 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7285 			{ }
7286 		},
7287 		.chained = true,
7288 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7289 	},
7290 	[ALC288_FIXUP_DISABLE_AAMIX] = {
7291 		.type = HDA_FIXUP_FUNC,
7292 		.v.func = alc_fixup_disable_aamix,
7293 		.chained = true,
7294 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
7295 	},
7296 	[ALC288_FIXUP_DELL_XPS_13] = {
7297 		.type = HDA_FIXUP_FUNC,
7298 		.v.func = alc_fixup_dell_xps13,
7299 		.chained = true,
7300 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
7301 	},
7302 	[ALC292_FIXUP_DISABLE_AAMIX] = {
7303 		.type = HDA_FIXUP_FUNC,
7304 		.v.func = alc_fixup_disable_aamix,
7305 		.chained = true,
7306 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
7307 	},
7308 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7309 		.type = HDA_FIXUP_FUNC,
7310 		.v.func = alc_fixup_disable_aamix,
7311 		.chained = true,
7312 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7313 	},
7314 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
7315 		.type = HDA_FIXUP_FUNC,
7316 		.v.func = alc_fixup_dell_xps13,
7317 		.chained = true,
7318 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
7319 	},
7320 	[ALC292_FIXUP_DELL_E7X] = {
7321 		.type = HDA_FIXUP_FUNC,
7322 		.v.func = alc_fixup_micmute_led,
7323 		/* micmute fixup must be applied at last */
7324 		.chained_before = true,
7325 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7326 	},
7327 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7328 		.type = HDA_FIXUP_PINS,
7329 		.v.pins = (const struct hda_pintbl[]) {
7330 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7331 			{ }
7332 		},
7333 		.chained_before = true,
7334 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
7335 	},
7336 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7337 		.type = HDA_FIXUP_PINS,
7338 		.v.pins = (const struct hda_pintbl[]) {
7339 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7340 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7341 			{ }
7342 		},
7343 		.chained = true,
7344 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7345 	},
7346 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7347 		.type = HDA_FIXUP_PINS,
7348 		.v.pins = (const struct hda_pintbl[]) {
7349 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7350 			{ }
7351 		},
7352 		.chained = true,
7353 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7354 	},
7355 	[ALC275_FIXUP_DELL_XPS] = {
7356 		.type = HDA_FIXUP_VERBS,
7357 		.v.verbs = (const struct hda_verb[]) {
7358 			/* Enables internal speaker */
7359 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7360 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7361 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7362 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7363 			{}
7364 		}
7365 	},
7366 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7367 		.type = HDA_FIXUP_FUNC,
7368 		.v.func = alc_fixup_disable_aamix,
7369 		.chained = true,
7370 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
7371 	},
7372 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7373 		.type = HDA_FIXUP_FUNC,
7374 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7375 	},
7376 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7377 		.type = HDA_FIXUP_FUNC,
7378 		.v.func = alc_fixup_inv_dmic,
7379 		.chained = true,
7380 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7381 	},
7382 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7383 		.type = HDA_FIXUP_FUNC,
7384 		.v.func = alc269_fixup_limit_int_mic_boost
7385 	},
7386 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
7387 		.type = HDA_FIXUP_FUNC,
7388 		.v.func = alc_fixup_disable_aamix,
7389 		.chained = true,
7390 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7391 	},
7392 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
7393 		.type = HDA_FIXUP_FUNC,
7394 		.v.func = alc_fixup_disable_mic_vref,
7395 		.chained = true,
7396 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7397 	},
7398 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7399 		.type = HDA_FIXUP_VERBS,
7400 		.v.verbs = (const struct hda_verb[]) {
7401 			/* Disable pass-through path for FRONT 14h */
7402 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7403 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7404 			{}
7405 		},
7406 		.chained = true,
7407 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
7408 	},
7409 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
7410 		.type = HDA_FIXUP_FUNC,
7411 		.v.func = alc_fixup_disable_aamix,
7412 		.chained = true,
7413 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
7414 	},
7415 	[ALC221_FIXUP_HP_FRONT_MIC] = {
7416 		.type = HDA_FIXUP_PINS,
7417 		.v.pins = (const struct hda_pintbl[]) {
7418 			{ 0x19, 0x02a19020 }, /* Front Mic */
7419 			{ }
7420 		},
7421 	},
7422 	[ALC292_FIXUP_TPT460] = {
7423 		.type = HDA_FIXUP_FUNC,
7424 		.v.func = alc_fixup_tpt440_dock,
7425 		.chained = true,
7426 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7427 	},
7428 	[ALC298_FIXUP_SPK_VOLUME] = {
7429 		.type = HDA_FIXUP_FUNC,
7430 		.v.func = alc298_fixup_speaker_volume,
7431 		.chained = true,
7432 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7433 	},
7434 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7435 		.type = HDA_FIXUP_FUNC,
7436 		.v.func = alc298_fixup_speaker_volume,
7437 	},
7438 	[ALC295_FIXUP_DISABLE_DAC3] = {
7439 		.type = HDA_FIXUP_FUNC,
7440 		.v.func = alc295_fixup_disable_dac3,
7441 	},
7442 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7443 		.type = HDA_FIXUP_FUNC,
7444 		.v.func = alc285_fixup_speaker2_to_dac1,
7445 		.chained = true,
7446 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
7447 	},
7448 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7449 		.type = HDA_FIXUP_PINS,
7450 		.v.pins = (const struct hda_pintbl[]) {
7451 			{ 0x1b, 0x90170151 },
7452 			{ }
7453 		},
7454 		.chained = true,
7455 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7456 	},
7457 	[ALC269_FIXUP_ATIV_BOOK_8] = {
7458 		.type = HDA_FIXUP_FUNC,
7459 		.v.func = alc_fixup_auto_mute_via_amp,
7460 		.chained = true,
7461 		.chain_id = ALC269_FIXUP_NO_SHUTUP
7462 	},
7463 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7464 		.type = HDA_FIXUP_PINS,
7465 		.v.pins = (const struct hda_pintbl[]) {
7466 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7467 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7468 			{ }
7469 		},
7470 		.chained = true,
7471 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7472 	},
7473 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7474 		.type = HDA_FIXUP_FUNC,
7475 		.v.func = alc_fixup_headset_mode,
7476 	},
7477 	[ALC256_FIXUP_ASUS_MIC] = {
7478 		.type = HDA_FIXUP_PINS,
7479 		.v.pins = (const struct hda_pintbl[]) {
7480 			{ 0x13, 0x90a60160 }, /* use as internal mic */
7481 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7482 			{ }
7483 		},
7484 		.chained = true,
7485 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7486 	},
7487 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
7488 		.type = HDA_FIXUP_FUNC,
7489 		/* Set up GPIO2 for the speaker amp */
7490 		.v.func = alc_fixup_gpio4,
7491 	},
7492 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7493 		.type = HDA_FIXUP_PINS,
7494 		.v.pins = (const struct hda_pintbl[]) {
7495 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7496 			{ }
7497 		},
7498 		.chained = true,
7499 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7500 	},
7501 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7502 		.type = HDA_FIXUP_VERBS,
7503 		.v.verbs = (const struct hda_verb[]) {
7504 			/* Enables internal speaker */
7505 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7506 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7507 			{}
7508 		},
7509 		.chained = true,
7510 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7511 	},
7512 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7513 		.type = HDA_FIXUP_FUNC,
7514 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
7515 		.chained = true,
7516 		.chain_id = ALC269_FIXUP_GPIO2
7517 	},
7518 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
7519 		.type = HDA_FIXUP_VERBS,
7520 		.v.verbs = (const struct hda_verb[]) {
7521 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7522 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7523 			{ }
7524 		},
7525 		.chained = true,
7526 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7527 	},
7528 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7529 		.type = HDA_FIXUP_PINS,
7530 		.v.pins = (const struct hda_pintbl[]) {
7531 			/* Change the mic location from front to right, otherwise there are
7532 			   two front mics with the same name, pulseaudio can't handle them.
7533 			   This is just a temporary workaround, after applying this fixup,
7534 			   there will be one "Front Mic" and one "Mic" in this machine.
7535 			 */
7536 			{ 0x1a, 0x04a19040 },
7537 			{ }
7538 		},
7539 	},
7540 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7541 		.type = HDA_FIXUP_PINS,
7542 		.v.pins = (const struct hda_pintbl[]) {
7543 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
7544 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7545 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7546 			{ 0x1b, 0x02011020 },
7547 			{ }
7548 		},
7549 		.chained = true,
7550 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
7551 	},
7552 	[ALC225_FIXUP_S3_POP_NOISE] = {
7553 		.type = HDA_FIXUP_FUNC,
7554 		.v.func = alc225_fixup_s3_pop_noise,
7555 		.chained = true,
7556 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7557 	},
7558 	[ALC700_FIXUP_INTEL_REFERENCE] = {
7559 		.type = HDA_FIXUP_VERBS,
7560 		.v.verbs = (const struct hda_verb[]) {
7561 			/* Enables internal speaker */
7562 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7563 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7564 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7565 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7566 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7567 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7568 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7569 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7570 			{}
7571 		}
7572 	},
7573 	[ALC274_FIXUP_DELL_BIND_DACS] = {
7574 		.type = HDA_FIXUP_FUNC,
7575 		.v.func = alc274_fixup_bind_dacs,
7576 		.chained = true,
7577 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7578 	},
7579 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7580 		.type = HDA_FIXUP_PINS,
7581 		.v.pins = (const struct hda_pintbl[]) {
7582 			{ 0x1b, 0x0401102f },
7583 			{ }
7584 		},
7585 		.chained = true,
7586 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
7587 	},
7588 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
7589 		.type = HDA_FIXUP_FUNC,
7590 		.v.func = alc_fixup_tpt470_dock,
7591 		.chained = true,
7592 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7593 	},
7594 	[ALC298_FIXUP_TPT470_DOCK] = {
7595 		.type = HDA_FIXUP_FUNC,
7596 		.v.func = alc_fixup_tpt470_dacs,
7597 		.chained = true,
7598 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7599 	},
7600 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7601 		.type = HDA_FIXUP_PINS,
7602 		.v.pins = (const struct hda_pintbl[]) {
7603 			{ 0x14, 0x0201101f },
7604 			{ }
7605 		},
7606 		.chained = true,
7607 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7608 	},
7609 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
7610 		.type = HDA_FIXUP_PINS,
7611 		.v.pins = (const struct hda_pintbl[]) {
7612 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7613 			{ }
7614 		},
7615 		.chained = true,
7616 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7617 	},
7618 	[ALC295_FIXUP_HP_X360] = {
7619 		.type = HDA_FIXUP_FUNC,
7620 		.v.func = alc295_fixup_hp_top_speakers,
7621 		.chained = true,
7622 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
7623 	},
7624 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
7625 		.type = HDA_FIXUP_PINS,
7626 		.v.pins = (const struct hda_pintbl[]) {
7627 			{ 0x19, 0x0181313f},
7628 			{ }
7629 		},
7630 		.chained = true,
7631 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7632 	},
7633 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7634 		.type = HDA_FIXUP_FUNC,
7635 		.v.func = alc285_fixup_invalidate_dacs,
7636 		.chained = true,
7637 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
7638 	},
7639 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
7640 		.type = HDA_FIXUP_FUNC,
7641 		.v.func = alc_fixup_auto_mute_via_amp,
7642 	},
7643 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7644 		.type = HDA_FIXUP_PINS,
7645 		.v.pins = (const struct hda_pintbl[]) {
7646 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7647 			{ }
7648 		},
7649 		.chained = true,
7650 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7651 	},
7652 	[ALC294_FIXUP_ASUS_MIC] = {
7653 		.type = HDA_FIXUP_PINS,
7654 		.v.pins = (const struct hda_pintbl[]) {
7655 			{ 0x13, 0x90a60160 }, /* use as internal mic */
7656 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7657 			{ }
7658 		},
7659 		.chained = true,
7660 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7661 	},
7662 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7663 		.type = HDA_FIXUP_PINS,
7664 		.v.pins = (const struct hda_pintbl[]) {
7665 			{ 0x19, 0x01a1103c }, /* use as headset mic */
7666 			{ }
7667 		},
7668 		.chained = true,
7669 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7670 	},
7671 	[ALC294_FIXUP_ASUS_SPK] = {
7672 		.type = HDA_FIXUP_VERBS,
7673 		.v.verbs = (const struct hda_verb[]) {
7674 			/* Set EAPD high */
7675 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7676 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
7677 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7678 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7679 			{ }
7680 		},
7681 		.chained = true,
7682 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7683 	},
7684 	[ALC295_FIXUP_CHROME_BOOK] = {
7685 		.type = HDA_FIXUP_FUNC,
7686 		.v.func = alc295_fixup_chromebook,
7687 		.chained = true,
7688 		.chain_id = ALC225_FIXUP_HEADSET_JACK
7689 	},
7690 	[ALC225_FIXUP_HEADSET_JACK] = {
7691 		.type = HDA_FIXUP_FUNC,
7692 		.v.func = alc_fixup_headset_jack,
7693 	},
7694 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7695 		.type = HDA_FIXUP_PINS,
7696 		.v.pins = (const struct hda_pintbl[]) {
7697 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7698 			{ }
7699 		},
7700 		.chained = true,
7701 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7702 	},
7703 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7704 		.type = HDA_FIXUP_VERBS,
7705 		.v.verbs = (const struct hda_verb[]) {
7706 			/* Disable PCBEEP-IN passthrough */
7707 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7708 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7709 			{ }
7710 		},
7711 		.chained = true,
7712 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7713 	},
7714 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
7715 		.type = HDA_FIXUP_PINS,
7716 		.v.pins = (const struct hda_pintbl[]) {
7717 			{ 0x19, 0x03a11130 },
7718 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
7719 			{ }
7720 		},
7721 		.chained = true,
7722 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7723 	},
7724 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7725 		.type = HDA_FIXUP_PINS,
7726 		.v.pins = (const struct hda_pintbl[]) {
7727 			{ 0x16, 0x01011020 }, /* Rear Line out */
7728 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7729 			{ }
7730 		},
7731 		.chained = true,
7732 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7733 	},
7734 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7735 		.type = HDA_FIXUP_FUNC,
7736 		.v.func = alc_fixup_auto_mute_via_amp,
7737 		.chained = true,
7738 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7739 	},
7740 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7741 		.type = HDA_FIXUP_FUNC,
7742 		.v.func = alc_fixup_disable_mic_vref,
7743 		.chained = true,
7744 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7745 	},
7746 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7747 		.type = HDA_FIXUP_VERBS,
7748 		.v.verbs = (const struct hda_verb[]) {
7749 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7750 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7751 			{ }
7752 		},
7753 		.chained = true,
7754 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7755 	},
7756 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7757 		.type = HDA_FIXUP_PINS,
7758 		.v.pins = (const struct hda_pintbl[]) {
7759 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
7760 			{ }
7761 		},
7762 		.chained = true,
7763 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7764 	},
7765 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7766 		.type = HDA_FIXUP_PINS,
7767 		.v.pins = (const struct hda_pintbl[]) {
7768 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7769 			{ }
7770 		},
7771 		.chained = true,
7772 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7773 	},
7774 	[ALC299_FIXUP_PREDATOR_SPK] = {
7775 		.type = HDA_FIXUP_PINS,
7776 		.v.pins = (const struct hda_pintbl[]) {
7777 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7778 			{ }
7779 		}
7780 	},
7781 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7782 		.type = HDA_FIXUP_PINS,
7783 		.v.pins = (const struct hda_pintbl[]) {
7784 			{ 0x19, 0x04a11040 },
7785 			{ 0x21, 0x04211020 },
7786 			{ }
7787 		},
7788 		.chained = true,
7789 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7790 	},
7791 	[ALC289_FIXUP_DELL_SPK2] = {
7792 		.type = HDA_FIXUP_PINS,
7793 		.v.pins = (const struct hda_pintbl[]) {
7794 			{ 0x17, 0x90170130 }, /* bass spk */
7795 			{ }
7796 		},
7797 		.chained = true,
7798 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
7799 	},
7800 	[ALC289_FIXUP_DUAL_SPK] = {
7801 		.type = HDA_FIXUP_FUNC,
7802 		.v.func = alc285_fixup_speaker2_to_dac1,
7803 		.chained = true,
7804 		.chain_id = ALC289_FIXUP_DELL_SPK2
7805 	},
7806 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
7807 		.type = HDA_FIXUP_FUNC,
7808 		.v.func = alc285_fixup_speaker2_to_dac1,
7809 		.chained = true,
7810 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7811 	},
7812 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
7813 		.type = HDA_FIXUP_FUNC,
7814 		/* The GPIO must be pulled to initialize the AMP */
7815 		.v.func = alc_fixup_gpio4,
7816 		.chained = true,
7817 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
7818 	},
7819 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7820 		.type = HDA_FIXUP_FUNC,
7821 		.v.func = alc285_fixup_thinkpad_x1_gen7,
7822 		.chained = true,
7823 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
7824 	},
7825 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7826 		.type = HDA_FIXUP_FUNC,
7827 		.v.func = alc_fixup_headset_jack,
7828 		.chained = true,
7829 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
7830 	},
7831 	[ALC294_FIXUP_ASUS_HPE] = {
7832 		.type = HDA_FIXUP_VERBS,
7833 		.v.verbs = (const struct hda_verb[]) {
7834 			/* Set EAPD high */
7835 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7836 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7837 			{ }
7838 		},
7839 		.chained = true,
7840 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7841 	},
7842 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
7843 		.type = HDA_FIXUP_PINS,
7844 		.v.pins = (const struct hda_pintbl[]) {
7845 			{ 0x19, 0x03a11050 }, /* front HP mic */
7846 			{ 0x1a, 0x01a11830 }, /* rear external mic */
7847 			{ 0x21, 0x03211020 }, /* front HP out */
7848 			{ }
7849 		},
7850 		.chained = true,
7851 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7852 	},
7853 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
7854 		.type = HDA_FIXUP_VERBS,
7855 		.v.verbs = (const struct hda_verb[]) {
7856 			/* set 0x15 to HP-OUT ctrl */
7857 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7858 			/* unmute the 0x15 amp */
7859 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7860 			{ }
7861 		},
7862 		.chained = true,
7863 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
7864 	},
7865 	[ALC294_FIXUP_ASUS_GX502_HP] = {
7866 		.type = HDA_FIXUP_FUNC,
7867 		.v.func = alc294_fixup_gx502_hp,
7868 	},
7869 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
7870 		.type = HDA_FIXUP_PINS,
7871 		.v.pins = (const struct hda_pintbl[]) {
7872 			{ 0x19, 0x01a11050 }, /* rear HP mic */
7873 			{ 0x1a, 0x01a11830 }, /* rear external mic */
7874 			{ 0x21, 0x012110f0 }, /* rear HP out */
7875 			{ }
7876 		},
7877 		.chained = true,
7878 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
7879 	},
7880 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
7881 		.type = HDA_FIXUP_VERBS,
7882 		.v.verbs = (const struct hda_verb[]) {
7883 			/* set 0x15 to HP-OUT ctrl */
7884 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7885 			/* unmute the 0x15 amp */
7886 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7887 			/* set 0x1b to HP-OUT */
7888 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
7889 			{ }
7890 		},
7891 		.chained = true,
7892 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
7893 	},
7894 	[ALC294_FIXUP_ASUS_GU502_HP] = {
7895 		.type = HDA_FIXUP_FUNC,
7896 		.v.func = alc294_fixup_gu502_hp,
7897 	},
7898 	[ALC294_FIXUP_ASUS_COEF_1B] = {
7899 		.type = HDA_FIXUP_VERBS,
7900 		.v.verbs = (const struct hda_verb[]) {
7901 			/* Set bit 10 to correct noisy output after reboot from
7902 			 * Windows 10 (due to pop noise reduction?)
7903 			 */
7904 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
7905 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
7906 			{ }
7907 		},
7908 		.chained = true,
7909 		.chain_id = ALC289_FIXUP_ASUS_GA401,
7910 	},
7911 	[ALC285_FIXUP_HP_GPIO_LED] = {
7912 		.type = HDA_FIXUP_FUNC,
7913 		.v.func = alc285_fixup_hp_gpio_led,
7914 	},
7915 	[ALC285_FIXUP_HP_MUTE_LED] = {
7916 		.type = HDA_FIXUP_FUNC,
7917 		.v.func = alc285_fixup_hp_mute_led,
7918 	},
7919 	[ALC236_FIXUP_HP_GPIO_LED] = {
7920 		.type = HDA_FIXUP_FUNC,
7921 		.v.func = alc236_fixup_hp_gpio_led,
7922 	},
7923 	[ALC236_FIXUP_HP_MUTE_LED] = {
7924 		.type = HDA_FIXUP_FUNC,
7925 		.v.func = alc236_fixup_hp_mute_led,
7926 	},
7927 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
7928 		.type = HDA_FIXUP_FUNC,
7929 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
7930 	},
7931 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
7932 		.type = HDA_FIXUP_VERBS,
7933 		.v.verbs = (const struct hda_verb[]) {
7934 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
7935 			{ }
7936 		},
7937 	},
7938 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7939 		.type = HDA_FIXUP_PINS,
7940 		.v.pins = (const struct hda_pintbl[]) {
7941 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7942 			{ }
7943 		},
7944 		.chained = true,
7945 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7946 	},
7947 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
7948 		.type = HDA_FIXUP_PINS,
7949 		.v.pins = (const struct hda_pintbl[]) {
7950 			{ 0x14, 0x90100120 }, /* use as internal speaker */
7951 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
7952 			{ 0x1a, 0x01011020 }, /* use as line out */
7953 			{ },
7954 		},
7955 		.chained = true,
7956 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7957 	},
7958 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
7959 		.type = HDA_FIXUP_PINS,
7960 		.v.pins = (const struct hda_pintbl[]) {
7961 			{ 0x18, 0x02a11030 }, /* use as headset mic */
7962 			{ }
7963 		},
7964 		.chained = true,
7965 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7966 	},
7967 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
7968 		.type = HDA_FIXUP_PINS,
7969 		.v.pins = (const struct hda_pintbl[]) {
7970 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
7971 			{ }
7972 		},
7973 		.chained = true,
7974 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7975 	},
7976 	[ALC289_FIXUP_ASUS_GA401] = {
7977 		.type = HDA_FIXUP_FUNC,
7978 		.v.func = alc289_fixup_asus_ga401,
7979 		.chained = true,
7980 		.chain_id = ALC289_FIXUP_ASUS_GA502,
7981 	},
7982 	[ALC289_FIXUP_ASUS_GA502] = {
7983 		.type = HDA_FIXUP_PINS,
7984 		.v.pins = (const struct hda_pintbl[]) {
7985 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
7986 			{ }
7987 		},
7988 	},
7989 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
7990 		.type = HDA_FIXUP_PINS,
7991 		.v.pins = (const struct hda_pintbl[]) {
7992 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
7993 			{ }
7994 		},
7995 		.chained = true,
7996 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7997 	},
7998 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
7999 		.type = HDA_FIXUP_FUNC,
8000 		.v.func = alc285_fixup_hp_gpio_amp_init,
8001 		.chained = true,
8002 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
8003 	},
8004 	[ALC269_FIXUP_CZC_B20] = {
8005 		.type = HDA_FIXUP_PINS,
8006 		.v.pins = (const struct hda_pintbl[]) {
8007 			{ 0x12, 0x411111f0 },
8008 			{ 0x14, 0x90170110 }, /* speaker */
8009 			{ 0x15, 0x032f1020 }, /* HP out */
8010 			{ 0x17, 0x411111f0 },
8011 			{ 0x18, 0x03ab1040 }, /* mic */
8012 			{ 0x19, 0xb7a7013f },
8013 			{ 0x1a, 0x0181305f },
8014 			{ 0x1b, 0x411111f0 },
8015 			{ 0x1d, 0x411111f0 },
8016 			{ 0x1e, 0x411111f0 },
8017 			{ }
8018 		},
8019 		.chain_id = ALC269_FIXUP_DMIC,
8020 	},
8021 	[ALC269_FIXUP_CZC_TMI] = {
8022 		.type = HDA_FIXUP_PINS,
8023 		.v.pins = (const struct hda_pintbl[]) {
8024 			{ 0x12, 0x4000c000 },
8025 			{ 0x14, 0x90170110 }, /* speaker */
8026 			{ 0x15, 0x0421401f }, /* HP out */
8027 			{ 0x17, 0x411111f0 },
8028 			{ 0x18, 0x04a19020 }, /* mic */
8029 			{ 0x19, 0x411111f0 },
8030 			{ 0x1a, 0x411111f0 },
8031 			{ 0x1b, 0x411111f0 },
8032 			{ 0x1d, 0x40448505 },
8033 			{ 0x1e, 0x411111f0 },
8034 			{ 0x20, 0x8000ffff },
8035 			{ }
8036 		},
8037 		.chain_id = ALC269_FIXUP_DMIC,
8038 	},
8039 	[ALC269_FIXUP_CZC_L101] = {
8040 		.type = HDA_FIXUP_PINS,
8041 		.v.pins = (const struct hda_pintbl[]) {
8042 			{ 0x12, 0x40000000 },
8043 			{ 0x14, 0x01014010 }, /* speaker */
8044 			{ 0x15, 0x411111f0 }, /* HP out */
8045 			{ 0x16, 0x411111f0 },
8046 			{ 0x18, 0x01a19020 }, /* mic */
8047 			{ 0x19, 0x02a19021 },
8048 			{ 0x1a, 0x0181302f },
8049 			{ 0x1b, 0x0221401f },
8050 			{ 0x1c, 0x411111f0 },
8051 			{ 0x1d, 0x4044c601 },
8052 			{ 0x1e, 0x411111f0 },
8053 			{ }
8054 		},
8055 		.chain_id = ALC269_FIXUP_DMIC,
8056 	},
8057 	[ALC269_FIXUP_LEMOTE_A1802] = {
8058 		.type = HDA_FIXUP_PINS,
8059 		.v.pins = (const struct hda_pintbl[]) {
8060 			{ 0x12, 0x40000000 },
8061 			{ 0x14, 0x90170110 }, /* speaker */
8062 			{ 0x17, 0x411111f0 },
8063 			{ 0x18, 0x03a19040 }, /* mic1 */
8064 			{ 0x19, 0x90a70130 }, /* mic2 */
8065 			{ 0x1a, 0x411111f0 },
8066 			{ 0x1b, 0x411111f0 },
8067 			{ 0x1d, 0x40489d2d },
8068 			{ 0x1e, 0x411111f0 },
8069 			{ 0x20, 0x0003ffff },
8070 			{ 0x21, 0x03214020 },
8071 			{ }
8072 		},
8073 		.chain_id = ALC269_FIXUP_DMIC,
8074 	},
8075 	[ALC269_FIXUP_LEMOTE_A190X] = {
8076 		.type = HDA_FIXUP_PINS,
8077 		.v.pins = (const struct hda_pintbl[]) {
8078 			{ 0x14, 0x99130110 }, /* speaker */
8079 			{ 0x15, 0x0121401f }, /* HP out */
8080 			{ 0x18, 0x01a19c20 }, /* rear  mic */
8081 			{ 0x19, 0x99a3092f }, /* front mic */
8082 			{ 0x1b, 0x0201401f }, /* front lineout */
8083 			{ }
8084 		},
8085 		.chain_id = ALC269_FIXUP_DMIC,
8086 	},
8087 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8088 		.type = HDA_FIXUP_PINS,
8089 		.v.pins = (const struct hda_pintbl[]) {
8090 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8091 			{ }
8092 		},
8093 		.chained = true,
8094 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8095 	},
8096 	[ALC256_FIXUP_INTEL_NUC10] = {
8097 		.type = HDA_FIXUP_PINS,
8098 		.v.pins = (const struct hda_pintbl[]) {
8099 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8100 			{ }
8101 		},
8102 		.chained = true,
8103 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8104 	},
8105 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8106 		.type = HDA_FIXUP_VERBS,
8107 		.v.verbs = (const struct hda_verb[]) {
8108 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8109 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8110 			{ }
8111 		},
8112 		.chained = true,
8113 		.chain_id = ALC289_FIXUP_ASUS_GA502
8114 	},
8115 	[ALC274_FIXUP_HP_MIC] = {
8116 		.type = HDA_FIXUP_VERBS,
8117 		.v.verbs = (const struct hda_verb[]) {
8118 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8119 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8120 			{ }
8121 		},
8122 	},
8123 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
8124 		.type = HDA_FIXUP_FUNC,
8125 		.v.func = alc274_fixup_hp_headset_mic,
8126 		.chained = true,
8127 		.chain_id = ALC274_FIXUP_HP_MIC
8128 	},
8129 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
8130 		.type = HDA_FIXUP_FUNC,
8131 		.v.func = alc274_fixup_hp_envy_gpio,
8132 	},
8133 	[ALC256_FIXUP_ASUS_HPE] = {
8134 		.type = HDA_FIXUP_VERBS,
8135 		.v.verbs = (const struct hda_verb[]) {
8136 			/* Set EAPD high */
8137 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8138 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8139 			{ }
8140 		},
8141 		.chained = true,
8142 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8143 	},
8144 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8145 		.type = HDA_FIXUP_FUNC,
8146 		.v.func = alc_fixup_headset_jack,
8147 		.chained = true,
8148 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8149 	},
8150 	[ALC287_FIXUP_HP_GPIO_LED] = {
8151 		.type = HDA_FIXUP_FUNC,
8152 		.v.func = alc287_fixup_hp_gpio_led,
8153 	},
8154 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
8155 		.type = HDA_FIXUP_FUNC,
8156 		.v.func = alc274_fixup_hp_headset_mic,
8157 	},
8158 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8159 		.type = HDA_FIXUP_FUNC,
8160 		.v.func = alc_fixup_no_int_mic,
8161 		.chained = true,
8162 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8163 	},
8164 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8165 		.type = HDA_FIXUP_PINS,
8166 		.v.pins = (const struct hda_pintbl[]) {
8167 			{ 0x1b, 0x411111f0 },
8168 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8169 			{ },
8170 		},
8171 		.chained = true,
8172 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8173 	},
8174 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8175 		.type = HDA_FIXUP_FUNC,
8176 		.v.func = alc269_fixup_limit_int_mic_boost,
8177 		.chained = true,
8178 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8179 	},
8180 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
8181 		.type = HDA_FIXUP_PINS,
8182 		.v.pins = (const struct hda_pintbl[]) {
8183 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8184 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
8185 			{ }
8186 		},
8187 		.chained = true,
8188 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8189 	},
8190 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8191 		.type = HDA_FIXUP_FUNC,
8192 		.v.func = alc285_fixup_ideapad_s740_coef,
8193 		.chained = true,
8194 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8195 	},
8196 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8197 		.type = HDA_FIXUP_FUNC,
8198 		.v.func = alc269_fixup_limit_int_mic_boost,
8199 		.chained = true,
8200 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
8201 	},
8202 	[ALC295_FIXUP_ASUS_DACS] = {
8203 		.type = HDA_FIXUP_FUNC,
8204 		.v.func = alc295_fixup_asus_dacs,
8205 	},
8206 	[ALC295_FIXUP_HP_OMEN] = {
8207 		.type = HDA_FIXUP_PINS,
8208 		.v.pins = (const struct hda_pintbl[]) {
8209 			{ 0x12, 0xb7a60130 },
8210 			{ 0x13, 0x40000000 },
8211 			{ 0x14, 0x411111f0 },
8212 			{ 0x16, 0x411111f0 },
8213 			{ 0x17, 0x90170110 },
8214 			{ 0x18, 0x411111f0 },
8215 			{ 0x19, 0x02a11030 },
8216 			{ 0x1a, 0x411111f0 },
8217 			{ 0x1b, 0x04a19030 },
8218 			{ 0x1d, 0x40600001 },
8219 			{ 0x1e, 0x411111f0 },
8220 			{ 0x21, 0x03211020 },
8221 			{}
8222 		},
8223 		.chained = true,
8224 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8225 	},
8226 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
8227 		.type = HDA_FIXUP_FUNC,
8228 		.v.func = alc285_fixup_hp_spectre_x360,
8229 	},
8230 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8231 		.type = HDA_FIXUP_FUNC,
8232 		.v.func = alc285_fixup_ideapad_s740_coef,
8233 		.chained = true,
8234 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8235 	},
8236 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8237 		.type = HDA_FIXUP_FUNC,
8238 		.v.func = alc_fixup_no_shutup,
8239 		.chained = true,
8240 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
8241 	},
8242 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8243 		.type = HDA_FIXUP_PINS,
8244 		.v.pins = (const struct hda_pintbl[]) {
8245 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8246 			{ }
8247 		},
8248 		.chained = true,
8249 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8250 	},
8251 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8252 		.type = HDA_FIXUP_FUNC,
8253 		.v.func = alc269_fixup_limit_int_mic_boost,
8254 		.chained = true,
8255 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8256 	},
8257 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8258 		.type = HDA_FIXUP_VERBS,
8259 		//.v.verbs = legion_15imhg05_coefs,
8260 		.v.verbs = (const struct hda_verb[]) {
8261 			 // set left speaker Legion 7i.
8262 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8263 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8264 
8265 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8266 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8267 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8268 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8269 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8270 
8271 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8272 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8273 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8274 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8275 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8276 
8277 			 // set right speaker Legion 7i.
8278 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8279 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8280 
8281 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8282 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8283 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8284 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8285 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8286 
8287 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8288 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8289 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8290 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8291 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8292 			 {}
8293 		},
8294 		.chained = true,
8295 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8296 	},
8297 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8298 		.type = HDA_FIXUP_FUNC,
8299 		.v.func = alc287_fixup_legion_15imhg05_speakers,
8300 		.chained = true,
8301 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8302 	},
8303 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8304 		.type = HDA_FIXUP_VERBS,
8305 		.v.verbs = (const struct hda_verb[]) {
8306 			 // set left speaker Yoga 7i.
8307 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8308 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8309 
8310 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8311 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8312 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8313 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8314 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8315 
8316 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8317 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8318 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8319 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8320 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8321 
8322 			 // set right speaker Yoga 7i.
8323 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8324 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8325 
8326 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8327 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8328 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8329 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8330 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8331 
8332 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8333 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8334 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8335 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8336 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8337 			 {}
8338 		},
8339 		.chained = true,
8340 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8341 	},
8342 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8343 		.type = HDA_FIXUP_VERBS,
8344 		.v.verbs = (const struct hda_verb[]) {
8345 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8346 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8347 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8348 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8349 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8350 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8351 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8352 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8353 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8354 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8355 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8356 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8357 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8358 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8359 			{}
8360 		},
8361 		.chained = true,
8362 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8363 	},
8364 };
8365 
8366 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
8367 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
8368 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8369 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
8370 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
8371 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
8372 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8373 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
8374 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8375 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8376 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
8377 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
8378 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
8379 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
8380 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
8381 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
8382 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
8383 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
8384 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8385 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8386 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8387 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
8388 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
8389 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
8390 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
8391 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
8392 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8393 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8394 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8395 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
8396 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8397 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8398 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
8399 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
8400 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8401 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8402 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
8403 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
8404 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
8405 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
8406 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8407 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8408 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
8409 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
8410 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8411 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8412 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8413 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8414 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8415 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
8416 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
8417 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
8418 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8419 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8420 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
8421 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
8422 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8423 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
8424 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8425 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8426 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8427 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8428 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8429 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8430 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8431 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
8432 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
8433 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
8434 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
8435 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
8436 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
8437 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
8438 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
8439 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8440 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8441 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8442 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8443 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
8444 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
8445 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
8446 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8447 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
8448 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
8449 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8450 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8451 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8452 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8453 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
8454 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
8455 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8456 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8457 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
8458 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8459 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
8460 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8461 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8462 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8463 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8464 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8465 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8466 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8467 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8468 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8469 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8470 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8471 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8472 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8473 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8474 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8475 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8476 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8477 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8478 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
8479 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
8480 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8481 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8482 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8483 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8484 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8485 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8486 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8487 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8488 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
8489 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8490 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
8491 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8492 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
8493 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8494 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8495 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8496 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8497 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8498 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8499 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8500 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8501 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8502 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8503 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8504 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8505 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8506 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8507 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8508 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8509 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8510 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8511 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8512 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8513 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8514 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8515 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8516 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8517 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8518 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8519 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
8520 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
8521 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8522 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8523 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8524 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8525 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8526 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8527 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
8528 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8529 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
8530 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8531 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
8532 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
8533 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8534 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8535 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
8536 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
8537 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
8538 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8539 	SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
8540 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
8541 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
8542 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8543 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
8544 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8545 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
8546 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
8547 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8548 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8549 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8550 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8551 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8552 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
8553 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
8554 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
8555 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8556 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8557 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8558 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8559 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8560 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8561 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8562 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8563 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8564 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8565 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8566 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
8567 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
8568 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8569 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
8570 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
8571 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
8572 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8573 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
8574 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
8575 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8576 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8577 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8578 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8579 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
8580 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8581 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8582 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
8583 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
8584 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
8585 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
8586 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
8587 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
8588 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
8589 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
8590 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
8591 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
8592 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
8593 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
8594 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
8595 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
8596 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
8597 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
8598 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
8599 	SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
8600 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
8601 	SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
8602 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8603 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8604 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
8605 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
8606 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
8607 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
8608 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
8609 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
8610 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
8611 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8612 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8613 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8614 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8615 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
8616 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8617 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8618 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8619 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
8620 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8621 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8622 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
8623 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
8624 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
8625 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
8626 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
8627 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
8628 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
8629 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
8630 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8631 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8632 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8633 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
8634 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
8635 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8636 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8637 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8638 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8639 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
8640 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8641 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8642 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8643 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8644 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
8645 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
8646 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8647 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8648 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8649 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8650 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8651 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8652 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8653 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8654 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8655 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8656 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8657 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8658 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8659 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8660 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8661 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8662 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8663 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8664 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8665 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8666 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8667 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8668 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8669 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8670 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8671 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8672 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8673 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8674 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8675 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8676 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8677 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8678 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8679 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8680 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8681 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8682 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8683 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8684 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
8685 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
8686 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
8687 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8688 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8689 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8690 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8691 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8692 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8693 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8694 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8695 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8696 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8697 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8698 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8699 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8700 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8701 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8702 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8703 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8704 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8705 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
8706 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
8707 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8708 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8709 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8710 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8711 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
8712 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
8713 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
8714 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
8715 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
8716 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
8717 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
8718 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
8719 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
8720 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
8721 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
8722 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
8723 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
8724 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8725 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
8726 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
8727 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
8728 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8729 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8730 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
8731 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
8732 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8733 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8734 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8735 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
8736 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8737 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8738 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8739 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8740 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
8741 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
8742 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8743 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8744 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
8745 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
8746 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8747 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8748 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8749 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8750 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8751 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8752 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8753 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8754 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
8755 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
8756 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
8757 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
8758 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
8759 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8760 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8761 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
8762 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
8763 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
8764 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
8765 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
8766 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8767 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
8768 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
8769 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8770 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
8771 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
8772 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
8773 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
8774 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
8775 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
8776 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
8777 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
8778 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8779 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8780 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8781 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8782 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8783 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8784 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
8785 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
8786 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8787 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8788 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
8789 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
8790 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8791 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
8792 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
8793 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
8794 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
8795 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
8796 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
8797 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
8798 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
8799 
8800 #if 0
8801 	/* Below is a quirk table taken from the old code.
8802 	 * Basically the device should work as is without the fixup table.
8803 	 * If BIOS doesn't give a proper info, enable the corresponding
8804 	 * fixup entry.
8805 	 */
8806 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
8807 		      ALC269_FIXUP_AMIC),
8808 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
8809 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
8810 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
8811 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
8812 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
8813 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
8814 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
8815 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
8816 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
8817 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
8818 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
8819 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
8820 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
8821 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
8822 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
8823 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
8824 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
8825 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
8826 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
8827 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8828 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8829 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8830 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8831 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8832 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8833 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8834 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8835 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8836 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8837 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8838 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8839 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8840 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8841 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8842 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8843 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8844 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8845 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8846 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8847 #endif
8848 	{}
8849 };
8850 
8851 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
8852 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
8853 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
8854 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
8855 	SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
8856 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
8857 	{}
8858 };
8859 
8860 static const struct hda_model_fixup alc269_fixup_models[] = {
8861 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
8862 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
8863 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
8864 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
8865 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
8866 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
8867 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
8868 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
8869 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
8870 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
8871 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
8872 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
8873 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8874 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
8875 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
8876 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
8877 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
8878 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
8879 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
8880 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
8881 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
8882 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
8883 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
8884 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
8885 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
8886 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
8887 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
8888 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
8889 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
8890 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
8891 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
8892 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
8893 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
8894 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
8895 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
8896 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
8897 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
8898 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
8899 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
8900 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
8901 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
8902 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
8903 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
8904 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
8905 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
8906 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
8907 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
8908 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
8909 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
8910 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
8911 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
8912 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
8913 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
8914 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
8915 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
8916 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
8917 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
8918 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
8919 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
8920 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
8921 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
8922 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
8923 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
8924 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
8925 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
8926 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
8927 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
8928 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
8929 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
8930 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
8931 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
8932 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
8933 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
8934 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
8935 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
8936 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
8937 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
8938 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
8939 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
8940 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
8941 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
8942 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
8943 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
8944 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
8945 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
8946 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
8947 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
8948 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
8949 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
8950 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
8951 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
8952 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
8953 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
8954 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
8955 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
8956 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
8957 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
8958 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
8959 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
8960 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
8961 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
8962 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
8963 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
8964 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
8965 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
8966 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
8967 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
8968 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
8969 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
8970 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
8971 	{.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
8972 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
8973 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
8974 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
8975 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
8976 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
8977 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
8978 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
8979 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
8980 	{}
8981 };
8982 #define ALC225_STANDARD_PINS \
8983 	{0x21, 0x04211020}
8984 
8985 #define ALC256_STANDARD_PINS \
8986 	{0x12, 0x90a60140}, \
8987 	{0x14, 0x90170110}, \
8988 	{0x21, 0x02211020}
8989 
8990 #define ALC282_STANDARD_PINS \
8991 	{0x14, 0x90170110}
8992 
8993 #define ALC290_STANDARD_PINS \
8994 	{0x12, 0x99a30130}
8995 
8996 #define ALC292_STANDARD_PINS \
8997 	{0x14, 0x90170110}, \
8998 	{0x15, 0x0221401f}
8999 
9000 #define ALC295_STANDARD_PINS \
9001 	{0x12, 0xb7a60130}, \
9002 	{0x14, 0x90170110}, \
9003 	{0x21, 0x04211020}
9004 
9005 #define ALC298_STANDARD_PINS \
9006 	{0x12, 0x90a60130}, \
9007 	{0x21, 0x03211020}
9008 
9009 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
9010 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9011 		{0x14, 0x01014020},
9012 		{0x17, 0x90170110},
9013 		{0x18, 0x02a11030},
9014 		{0x19, 0x0181303F},
9015 		{0x21, 0x0221102f}),
9016 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9017 		{0x12, 0x90a601c0},
9018 		{0x14, 0x90171120},
9019 		{0x21, 0x02211030}),
9020 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9021 		{0x14, 0x90170110},
9022 		{0x1b, 0x90a70130},
9023 		{0x21, 0x03211020}),
9024 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9025 		{0x1a, 0x90a70130},
9026 		{0x1b, 0x90170110},
9027 		{0x21, 0x03211020}),
9028 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9029 		ALC225_STANDARD_PINS,
9030 		{0x12, 0xb7a60130},
9031 		{0x14, 0x901701a0}),
9032 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9033 		ALC225_STANDARD_PINS,
9034 		{0x12, 0xb7a60130},
9035 		{0x14, 0x901701b0}),
9036 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9037 		ALC225_STANDARD_PINS,
9038 		{0x12, 0xb7a60150},
9039 		{0x14, 0x901701a0}),
9040 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9041 		ALC225_STANDARD_PINS,
9042 		{0x12, 0xb7a60150},
9043 		{0x14, 0x901701b0}),
9044 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9045 		ALC225_STANDARD_PINS,
9046 		{0x12, 0xb7a60130},
9047 		{0x1b, 0x90170110}),
9048 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9049 		{0x1b, 0x01111010},
9050 		{0x1e, 0x01451130},
9051 		{0x21, 0x02211020}),
9052 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9053 		{0x12, 0x90a60140},
9054 		{0x14, 0x90170110},
9055 		{0x19, 0x02a11030},
9056 		{0x21, 0x02211020}),
9057 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9058 		{0x14, 0x90170110},
9059 		{0x19, 0x02a11030},
9060 		{0x1a, 0x02a11040},
9061 		{0x1b, 0x01014020},
9062 		{0x21, 0x0221101f}),
9063 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9064 		{0x14, 0x90170110},
9065 		{0x19, 0x02a11030},
9066 		{0x1a, 0x02a11040},
9067 		{0x1b, 0x01011020},
9068 		{0x21, 0x0221101f}),
9069 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9070 		{0x14, 0x90170110},
9071 		{0x19, 0x02a11020},
9072 		{0x1a, 0x02a11030},
9073 		{0x21, 0x0221101f}),
9074 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9075 		{0x21, 0x02211010}),
9076 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9077 		{0x14, 0x90170110},
9078 		{0x19, 0x02a11020},
9079 		{0x21, 0x02211030}),
9080 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9081 		{0x14, 0x90170110},
9082 		{0x21, 0x02211020}),
9083 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9084 		{0x14, 0x90170130},
9085 		{0x21, 0x02211040}),
9086 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9087 		{0x12, 0x90a60140},
9088 		{0x14, 0x90170110},
9089 		{0x21, 0x02211020}),
9090 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9091 		{0x12, 0x90a60160},
9092 		{0x14, 0x90170120},
9093 		{0x21, 0x02211030}),
9094 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9095 		{0x14, 0x90170110},
9096 		{0x1b, 0x02011020},
9097 		{0x21, 0x0221101f}),
9098 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9099 		{0x14, 0x90170110},
9100 		{0x1b, 0x01011020},
9101 		{0x21, 0x0221101f}),
9102 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9103 		{0x14, 0x90170130},
9104 		{0x1b, 0x01014020},
9105 		{0x21, 0x0221103f}),
9106 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9107 		{0x14, 0x90170130},
9108 		{0x1b, 0x01011020},
9109 		{0x21, 0x0221103f}),
9110 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9111 		{0x14, 0x90170130},
9112 		{0x1b, 0x02011020},
9113 		{0x21, 0x0221103f}),
9114 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9115 		{0x14, 0x90170150},
9116 		{0x1b, 0x02011020},
9117 		{0x21, 0x0221105f}),
9118 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9119 		{0x14, 0x90170110},
9120 		{0x1b, 0x01014020},
9121 		{0x21, 0x0221101f}),
9122 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9123 		{0x12, 0x90a60160},
9124 		{0x14, 0x90170120},
9125 		{0x17, 0x90170140},
9126 		{0x21, 0x0321102f}),
9127 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9128 		{0x12, 0x90a60160},
9129 		{0x14, 0x90170130},
9130 		{0x21, 0x02211040}),
9131 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9132 		{0x12, 0x90a60160},
9133 		{0x14, 0x90170140},
9134 		{0x21, 0x02211050}),
9135 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9136 		{0x12, 0x90a60170},
9137 		{0x14, 0x90170120},
9138 		{0x21, 0x02211030}),
9139 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9140 		{0x12, 0x90a60170},
9141 		{0x14, 0x90170130},
9142 		{0x21, 0x02211040}),
9143 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9144 		{0x12, 0x90a60170},
9145 		{0x14, 0x90171130},
9146 		{0x21, 0x02211040}),
9147 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9148 		{0x12, 0x90a60170},
9149 		{0x14, 0x90170140},
9150 		{0x21, 0x02211050}),
9151 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9152 		{0x12, 0x90a60180},
9153 		{0x14, 0x90170130},
9154 		{0x21, 0x02211040}),
9155 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9156 		{0x12, 0x90a60180},
9157 		{0x14, 0x90170120},
9158 		{0x21, 0x02211030}),
9159 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9160 		{0x1b, 0x01011020},
9161 		{0x21, 0x02211010}),
9162 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9163 		{0x14, 0x90170110},
9164 		{0x1b, 0x90a70130},
9165 		{0x21, 0x04211020}),
9166 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9167 		{0x14, 0x90170110},
9168 		{0x1b, 0x90a70130},
9169 		{0x21, 0x03211020}),
9170 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9171 		{0x12, 0x90a60130},
9172 		{0x14, 0x90170110},
9173 		{0x21, 0x03211020}),
9174 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9175 		{0x12, 0x90a60130},
9176 		{0x14, 0x90170110},
9177 		{0x21, 0x04211020}),
9178 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9179 		{0x1a, 0x90a70130},
9180 		{0x1b, 0x90170110},
9181 		{0x21, 0x03211020}),
9182        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9183 		{0x14, 0x90170110},
9184 		{0x19, 0x02a11020},
9185 		{0x21, 0x0221101f}),
9186        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9187 		{0x17, 0x90170110},
9188 		{0x19, 0x03a11030},
9189 		{0x21, 0x03211020}),
9190 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9191 		{0x12, 0x90a60130},
9192 		{0x14, 0x90170110},
9193 		{0x15, 0x0421101f},
9194 		{0x1a, 0x04a11020}),
9195 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9196 		{0x12, 0x90a60140},
9197 		{0x14, 0x90170110},
9198 		{0x15, 0x0421101f},
9199 		{0x18, 0x02811030},
9200 		{0x1a, 0x04a1103f},
9201 		{0x1b, 0x02011020}),
9202 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9203 		ALC282_STANDARD_PINS,
9204 		{0x12, 0x99a30130},
9205 		{0x19, 0x03a11020},
9206 		{0x21, 0x0321101f}),
9207 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9208 		ALC282_STANDARD_PINS,
9209 		{0x12, 0x99a30130},
9210 		{0x19, 0x03a11020},
9211 		{0x21, 0x03211040}),
9212 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9213 		ALC282_STANDARD_PINS,
9214 		{0x12, 0x99a30130},
9215 		{0x19, 0x03a11030},
9216 		{0x21, 0x03211020}),
9217 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9218 		ALC282_STANDARD_PINS,
9219 		{0x12, 0x99a30130},
9220 		{0x19, 0x04a11020},
9221 		{0x21, 0x0421101f}),
9222 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
9223 		ALC282_STANDARD_PINS,
9224 		{0x12, 0x90a60140},
9225 		{0x19, 0x04a11030},
9226 		{0x21, 0x04211020}),
9227 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9228 		ALC282_STANDARD_PINS,
9229 		{0x12, 0x90a609c0},
9230 		{0x18, 0x03a11830},
9231 		{0x19, 0x04a19831},
9232 		{0x1a, 0x0481303f},
9233 		{0x1b, 0x04211020},
9234 		{0x21, 0x0321101f}),
9235 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9236 		ALC282_STANDARD_PINS,
9237 		{0x12, 0x90a60940},
9238 		{0x18, 0x03a11830},
9239 		{0x19, 0x04a19831},
9240 		{0x1a, 0x0481303f},
9241 		{0x1b, 0x04211020},
9242 		{0x21, 0x0321101f}),
9243 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9244 		ALC282_STANDARD_PINS,
9245 		{0x12, 0x90a60130},
9246 		{0x21, 0x0321101f}),
9247 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9248 		{0x12, 0x90a60160},
9249 		{0x14, 0x90170120},
9250 		{0x21, 0x02211030}),
9251 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9252 		ALC282_STANDARD_PINS,
9253 		{0x12, 0x90a60130},
9254 		{0x19, 0x03a11020},
9255 		{0x21, 0x0321101f}),
9256 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9257 		{0x12, 0x90a60130},
9258 		{0x14, 0x90170110},
9259 		{0x19, 0x04a11040},
9260 		{0x21, 0x04211020}),
9261 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9262 		{0x14, 0x90170110},
9263 		{0x19, 0x04a11040},
9264 		{0x1d, 0x40600001},
9265 		{0x21, 0x04211020}),
9266 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9267 		{0x14, 0x90170110},
9268 		{0x19, 0x04a11040},
9269 		{0x21, 0x04211020}),
9270 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9271 		{0x14, 0x90170110},
9272 		{0x17, 0x90170111},
9273 		{0x19, 0x03a11030},
9274 		{0x21, 0x03211020}),
9275 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9276 		{0x12, 0x90a60130},
9277 		{0x17, 0x90170110},
9278 		{0x21, 0x02211020}),
9279 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
9280 		{0x12, 0x90a60120},
9281 		{0x14, 0x90170110},
9282 		{0x21, 0x0321101f}),
9283 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9284 		ALC290_STANDARD_PINS,
9285 		{0x15, 0x04211040},
9286 		{0x18, 0x90170112},
9287 		{0x1a, 0x04a11020}),
9288 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9289 		ALC290_STANDARD_PINS,
9290 		{0x15, 0x04211040},
9291 		{0x18, 0x90170110},
9292 		{0x1a, 0x04a11020}),
9293 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9294 		ALC290_STANDARD_PINS,
9295 		{0x15, 0x0421101f},
9296 		{0x1a, 0x04a11020}),
9297 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9298 		ALC290_STANDARD_PINS,
9299 		{0x15, 0x04211020},
9300 		{0x1a, 0x04a11040}),
9301 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9302 		ALC290_STANDARD_PINS,
9303 		{0x14, 0x90170110},
9304 		{0x15, 0x04211020},
9305 		{0x1a, 0x04a11040}),
9306 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9307 		ALC290_STANDARD_PINS,
9308 		{0x14, 0x90170110},
9309 		{0x15, 0x04211020},
9310 		{0x1a, 0x04a11020}),
9311 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9312 		ALC290_STANDARD_PINS,
9313 		{0x14, 0x90170110},
9314 		{0x15, 0x0421101f},
9315 		{0x1a, 0x04a11020}),
9316 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
9317 		ALC292_STANDARD_PINS,
9318 		{0x12, 0x90a60140},
9319 		{0x16, 0x01014020},
9320 		{0x19, 0x01a19030}),
9321 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
9322 		ALC292_STANDARD_PINS,
9323 		{0x12, 0x90a60140},
9324 		{0x16, 0x01014020},
9325 		{0x18, 0x02a19031},
9326 		{0x19, 0x01a1903e}),
9327 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
9328 		ALC292_STANDARD_PINS,
9329 		{0x12, 0x90a60140}),
9330 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
9331 		ALC292_STANDARD_PINS,
9332 		{0x13, 0x90a60140},
9333 		{0x16, 0x21014020},
9334 		{0x19, 0x21a19030}),
9335 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
9336 		ALC292_STANDARD_PINS,
9337 		{0x13, 0x90a60140}),
9338 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9339 		{0x17, 0x90170110},
9340 		{0x21, 0x04211020}),
9341 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9342 		{0x14, 0x90170110},
9343 		{0x1b, 0x90a70130},
9344 		{0x21, 0x04211020}),
9345 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9346 		{0x12, 0x90a60130},
9347 		{0x17, 0x90170110},
9348 		{0x21, 0x03211020}),
9349 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9350 		{0x12, 0x90a60130},
9351 		{0x17, 0x90170110},
9352 		{0x21, 0x04211020}),
9353 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9354 		{0x12, 0x90a60130},
9355 		{0x17, 0x90170110},
9356 		{0x21, 0x03211020}),
9357 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9358 		{0x12, 0x90a60120},
9359 		{0x17, 0x90170110},
9360 		{0x21, 0x04211030}),
9361 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9362 		{0x12, 0x90a60130},
9363 		{0x17, 0x90170110},
9364 		{0x21, 0x03211020}),
9365 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9366 		{0x12, 0x90a60130},
9367 		{0x17, 0x90170110},
9368 		{0x21, 0x03211020}),
9369 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9370 		{0x14, 0x90170110},
9371 		{0x21, 0x04211020}),
9372 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9373 		{0x14, 0x90170110},
9374 		{0x21, 0x04211030}),
9375 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9376 		ALC295_STANDARD_PINS,
9377 		{0x17, 0x21014020},
9378 		{0x18, 0x21a19030}),
9379 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9380 		ALC295_STANDARD_PINS,
9381 		{0x17, 0x21014040},
9382 		{0x18, 0x21a19050}),
9383 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9384 		ALC295_STANDARD_PINS),
9385 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9386 		ALC298_STANDARD_PINS,
9387 		{0x17, 0x90170110}),
9388 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9389 		ALC298_STANDARD_PINS,
9390 		{0x17, 0x90170140}),
9391 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9392 		ALC298_STANDARD_PINS,
9393 		{0x17, 0x90170150}),
9394 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9395 		{0x12, 0xb7a60140},
9396 		{0x13, 0xb7a60150},
9397 		{0x17, 0x90170110},
9398 		{0x1a, 0x03011020},
9399 		{0x21, 0x03211030}),
9400 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9401 		{0x12, 0xb7a60140},
9402 		{0x17, 0x90170110},
9403 		{0x1a, 0x03a11030},
9404 		{0x21, 0x03211020}),
9405 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9406 		ALC225_STANDARD_PINS,
9407 		{0x12, 0xb7a60130},
9408 		{0x17, 0x90170110}),
9409 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9410 		{0x14, 0x01014010},
9411 		{0x17, 0x90170120},
9412 		{0x18, 0x02a11030},
9413 		{0x19, 0x02a1103f},
9414 		{0x21, 0x0221101f}),
9415 	{}
9416 };
9417 
9418 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9419  * more machines, don't need to match all valid pins, just need to match
9420  * all the pins defined in the tbl. Just because of this reason, it is possible
9421  * that a single machine matches multiple tbls, so there is one limitation:
9422  *   at most one tbl is allowed to define for the same vendor and same codec
9423  */
9424 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9425 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9426 		{0x19, 0x40000000},
9427 		{0x1b, 0x40000000}),
9428 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9429 		{0x19, 0x40000000},
9430 		{0x1a, 0x40000000}),
9431 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9432 		{0x19, 0x40000000},
9433 		{0x1a, 0x40000000}),
9434 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9435 		{0x19, 0x40000000},
9436 		{0x1a, 0x40000000}),
9437 	{}
9438 };
9439 
9440 static void alc269_fill_coef(struct hda_codec *codec)
9441 {
9442 	struct alc_spec *spec = codec->spec;
9443 	int val;
9444 
9445 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
9446 		return;
9447 
9448 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
9449 		alc_write_coef_idx(codec, 0xf, 0x960b);
9450 		alc_write_coef_idx(codec, 0xe, 0x8817);
9451 	}
9452 
9453 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
9454 		alc_write_coef_idx(codec, 0xf, 0x960b);
9455 		alc_write_coef_idx(codec, 0xe, 0x8814);
9456 	}
9457 
9458 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
9459 		/* Power up output pin */
9460 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
9461 	}
9462 
9463 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
9464 		val = alc_read_coef_idx(codec, 0xd);
9465 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
9466 			/* Capless ramp up clock control */
9467 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
9468 		}
9469 		val = alc_read_coef_idx(codec, 0x17);
9470 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
9471 			/* Class D power on reset */
9472 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
9473 		}
9474 	}
9475 
9476 	/* HP */
9477 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
9478 }
9479 
9480 /*
9481  */
9482 static int patch_alc269(struct hda_codec *codec)
9483 {
9484 	struct alc_spec *spec;
9485 	int err;
9486 
9487 	err = alc_alloc_spec(codec, 0x0b);
9488 	if (err < 0)
9489 		return err;
9490 
9491 	spec = codec->spec;
9492 	spec->gen.shared_mic_vref_pin = 0x18;
9493 	codec->power_save_node = 0;
9494 
9495 #ifdef CONFIG_PM
9496 	codec->patch_ops.suspend = alc269_suspend;
9497 	codec->patch_ops.resume = alc269_resume;
9498 #endif
9499 	spec->shutup = alc_default_shutup;
9500 	spec->init_hook = alc_default_init;
9501 
9502 	switch (codec->core.vendor_id) {
9503 	case 0x10ec0269:
9504 		spec->codec_variant = ALC269_TYPE_ALC269VA;
9505 		switch (alc_get_coef0(codec) & 0x00f0) {
9506 		case 0x0010:
9507 			if (codec->bus->pci &&
9508 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
9509 			    spec->cdefine.platform_type == 1)
9510 				err = alc_codec_rename(codec, "ALC271X");
9511 			spec->codec_variant = ALC269_TYPE_ALC269VB;
9512 			break;
9513 		case 0x0020:
9514 			if (codec->bus->pci &&
9515 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
9516 			    codec->bus->pci->subsystem_device == 0x21f3)
9517 				err = alc_codec_rename(codec, "ALC3202");
9518 			spec->codec_variant = ALC269_TYPE_ALC269VC;
9519 			break;
9520 		case 0x0030:
9521 			spec->codec_variant = ALC269_TYPE_ALC269VD;
9522 			break;
9523 		default:
9524 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
9525 		}
9526 		if (err < 0)
9527 			goto error;
9528 		spec->shutup = alc269_shutup;
9529 		spec->init_hook = alc269_fill_coef;
9530 		alc269_fill_coef(codec);
9531 		break;
9532 
9533 	case 0x10ec0280:
9534 	case 0x10ec0290:
9535 		spec->codec_variant = ALC269_TYPE_ALC280;
9536 		break;
9537 	case 0x10ec0282:
9538 		spec->codec_variant = ALC269_TYPE_ALC282;
9539 		spec->shutup = alc282_shutup;
9540 		spec->init_hook = alc282_init;
9541 		break;
9542 	case 0x10ec0233:
9543 	case 0x10ec0283:
9544 		spec->codec_variant = ALC269_TYPE_ALC283;
9545 		spec->shutup = alc283_shutup;
9546 		spec->init_hook = alc283_init;
9547 		break;
9548 	case 0x10ec0284:
9549 	case 0x10ec0292:
9550 		spec->codec_variant = ALC269_TYPE_ALC284;
9551 		break;
9552 	case 0x10ec0293:
9553 		spec->codec_variant = ALC269_TYPE_ALC293;
9554 		break;
9555 	case 0x10ec0286:
9556 	case 0x10ec0288:
9557 		spec->codec_variant = ALC269_TYPE_ALC286;
9558 		break;
9559 	case 0x10ec0298:
9560 		spec->codec_variant = ALC269_TYPE_ALC298;
9561 		break;
9562 	case 0x10ec0235:
9563 	case 0x10ec0255:
9564 		spec->codec_variant = ALC269_TYPE_ALC255;
9565 		spec->shutup = alc256_shutup;
9566 		spec->init_hook = alc256_init;
9567 		break;
9568 	case 0x10ec0230:
9569 	case 0x10ec0236:
9570 	case 0x10ec0256:
9571 		spec->codec_variant = ALC269_TYPE_ALC256;
9572 		spec->shutup = alc256_shutup;
9573 		spec->init_hook = alc256_init;
9574 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
9575 		break;
9576 	case 0x10ec0257:
9577 		spec->codec_variant = ALC269_TYPE_ALC257;
9578 		spec->shutup = alc256_shutup;
9579 		spec->init_hook = alc256_init;
9580 		spec->gen.mixer_nid = 0;
9581 		break;
9582 	case 0x10ec0215:
9583 	case 0x10ec0245:
9584 	case 0x10ec0285:
9585 	case 0x10ec0289:
9586 		spec->codec_variant = ALC269_TYPE_ALC215;
9587 		spec->shutup = alc225_shutup;
9588 		spec->init_hook = alc225_init;
9589 		spec->gen.mixer_nid = 0;
9590 		break;
9591 	case 0x10ec0225:
9592 	case 0x10ec0295:
9593 	case 0x10ec0299:
9594 		spec->codec_variant = ALC269_TYPE_ALC225;
9595 		spec->shutup = alc225_shutup;
9596 		spec->init_hook = alc225_init;
9597 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
9598 		break;
9599 	case 0x10ec0287:
9600 		spec->codec_variant = ALC269_TYPE_ALC287;
9601 		spec->shutup = alc225_shutup;
9602 		spec->init_hook = alc225_init;
9603 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
9604 		break;
9605 	case 0x10ec0234:
9606 	case 0x10ec0274:
9607 	case 0x10ec0294:
9608 		spec->codec_variant = ALC269_TYPE_ALC294;
9609 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
9610 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
9611 		spec->init_hook = alc294_init;
9612 		break;
9613 	case 0x10ec0300:
9614 		spec->codec_variant = ALC269_TYPE_ALC300;
9615 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
9616 		break;
9617 	case 0x10ec0623:
9618 		spec->codec_variant = ALC269_TYPE_ALC623;
9619 		break;
9620 	case 0x10ec0700:
9621 	case 0x10ec0701:
9622 	case 0x10ec0703:
9623 	case 0x10ec0711:
9624 		spec->codec_variant = ALC269_TYPE_ALC700;
9625 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
9626 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
9627 		spec->init_hook = alc294_init;
9628 		break;
9629 
9630 	}
9631 
9632 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
9633 		spec->has_alc5505_dsp = 1;
9634 		spec->init_hook = alc5505_dsp_init;
9635 	}
9636 
9637 	alc_pre_init(codec);
9638 
9639 	snd_hda_pick_fixup(codec, alc269_fixup_models,
9640 		       alc269_fixup_tbl, alc269_fixups);
9641 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
9642 	 * the quirk breaks the latter (bko#214101).
9643 	 * Clear the wrong entry.
9644 	 */
9645 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
9646 	    codec->core.vendor_id == 0x10ec0294) {
9647 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
9648 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
9649 	}
9650 
9651 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
9652 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
9653 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
9654 			   alc269_fixups);
9655 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9656 
9657 	alc_auto_parse_customize_define(codec);
9658 
9659 	if (has_cdefine_beep(codec))
9660 		spec->gen.beep_nid = 0x01;
9661 
9662 	/* automatic parse from the BIOS config */
9663 	err = alc269_parse_auto_config(codec);
9664 	if (err < 0)
9665 		goto error;
9666 
9667 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
9668 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
9669 		if (err < 0)
9670 			goto error;
9671 	}
9672 
9673 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
9674 
9675 	return 0;
9676 
9677  error:
9678 	alc_free(codec);
9679 	return err;
9680 }
9681 
9682 /*
9683  * ALC861
9684  */
9685 
9686 static int alc861_parse_auto_config(struct hda_codec *codec)
9687 {
9688 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
9689 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
9690 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
9691 }
9692 
9693 /* Pin config fixes */
9694 enum {
9695 	ALC861_FIXUP_FSC_AMILO_PI1505,
9696 	ALC861_FIXUP_AMP_VREF_0F,
9697 	ALC861_FIXUP_NO_JACK_DETECT,
9698 	ALC861_FIXUP_ASUS_A6RP,
9699 	ALC660_FIXUP_ASUS_W7J,
9700 };
9701 
9702 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
9703 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
9704 			const struct hda_fixup *fix, int action)
9705 {
9706 	struct alc_spec *spec = codec->spec;
9707 	unsigned int val;
9708 
9709 	if (action != HDA_FIXUP_ACT_INIT)
9710 		return;
9711 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
9712 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
9713 		val |= AC_PINCTL_IN_EN;
9714 	val |= AC_PINCTL_VREF_50;
9715 	snd_hda_set_pin_ctl(codec, 0x0f, val);
9716 	spec->gen.keep_vref_in_automute = 1;
9717 }
9718 
9719 /* suppress the jack-detection */
9720 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
9721 				     const struct hda_fixup *fix, int action)
9722 {
9723 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
9724 		codec->no_jack_detect = 1;
9725 }
9726 
9727 static const struct hda_fixup alc861_fixups[] = {
9728 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
9729 		.type = HDA_FIXUP_PINS,
9730 		.v.pins = (const struct hda_pintbl[]) {
9731 			{ 0x0b, 0x0221101f }, /* HP */
9732 			{ 0x0f, 0x90170310 }, /* speaker */
9733 			{ }
9734 		}
9735 	},
9736 	[ALC861_FIXUP_AMP_VREF_0F] = {
9737 		.type = HDA_FIXUP_FUNC,
9738 		.v.func = alc861_fixup_asus_amp_vref_0f,
9739 	},
9740 	[ALC861_FIXUP_NO_JACK_DETECT] = {
9741 		.type = HDA_FIXUP_FUNC,
9742 		.v.func = alc_fixup_no_jack_detect,
9743 	},
9744 	[ALC861_FIXUP_ASUS_A6RP] = {
9745 		.type = HDA_FIXUP_FUNC,
9746 		.v.func = alc861_fixup_asus_amp_vref_0f,
9747 		.chained = true,
9748 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
9749 	},
9750 	[ALC660_FIXUP_ASUS_W7J] = {
9751 		.type = HDA_FIXUP_VERBS,
9752 		.v.verbs = (const struct hda_verb[]) {
9753 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
9754 			 * for enabling outputs
9755 			 */
9756 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9757 			{ }
9758 		},
9759 	}
9760 };
9761 
9762 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
9763 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
9764 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
9765 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
9766 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
9767 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
9768 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
9769 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
9770 	{}
9771 };
9772 
9773 /*
9774  */
9775 static int patch_alc861(struct hda_codec *codec)
9776 {
9777 	struct alc_spec *spec;
9778 	int err;
9779 
9780 	err = alc_alloc_spec(codec, 0x15);
9781 	if (err < 0)
9782 		return err;
9783 
9784 	spec = codec->spec;
9785 	if (has_cdefine_beep(codec))
9786 		spec->gen.beep_nid = 0x23;
9787 
9788 #ifdef CONFIG_PM
9789 	spec->power_hook = alc_power_eapd;
9790 #endif
9791 
9792 	alc_pre_init(codec);
9793 
9794 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
9795 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9796 
9797 	/* automatic parse from the BIOS config */
9798 	err = alc861_parse_auto_config(codec);
9799 	if (err < 0)
9800 		goto error;
9801 
9802 	if (!spec->gen.no_analog) {
9803 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
9804 		if (err < 0)
9805 			goto error;
9806 	}
9807 
9808 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
9809 
9810 	return 0;
9811 
9812  error:
9813 	alc_free(codec);
9814 	return err;
9815 }
9816 
9817 /*
9818  * ALC861-VD support
9819  *
9820  * Based on ALC882
9821  *
9822  * In addition, an independent DAC
9823  */
9824 static int alc861vd_parse_auto_config(struct hda_codec *codec)
9825 {
9826 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
9827 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9828 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
9829 }
9830 
9831 enum {
9832 	ALC660VD_FIX_ASUS_GPIO1,
9833 	ALC861VD_FIX_DALLAS,
9834 };
9835 
9836 /* exclude VREF80 */
9837 static void alc861vd_fixup_dallas(struct hda_codec *codec,
9838 				  const struct hda_fixup *fix, int action)
9839 {
9840 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9841 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
9842 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
9843 	}
9844 }
9845 
9846 /* reset GPIO1 */
9847 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
9848 				      const struct hda_fixup *fix, int action)
9849 {
9850 	struct alc_spec *spec = codec->spec;
9851 
9852 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
9853 		spec->gpio_mask |= 0x02;
9854 	alc_fixup_gpio(codec, action, 0x01);
9855 }
9856 
9857 static const struct hda_fixup alc861vd_fixups[] = {
9858 	[ALC660VD_FIX_ASUS_GPIO1] = {
9859 		.type = HDA_FIXUP_FUNC,
9860 		.v.func = alc660vd_fixup_asus_gpio1,
9861 	},
9862 	[ALC861VD_FIX_DALLAS] = {
9863 		.type = HDA_FIXUP_FUNC,
9864 		.v.func = alc861vd_fixup_dallas,
9865 	},
9866 };
9867 
9868 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
9869 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
9870 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
9871 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
9872 	{}
9873 };
9874 
9875 /*
9876  */
9877 static int patch_alc861vd(struct hda_codec *codec)
9878 {
9879 	struct alc_spec *spec;
9880 	int err;
9881 
9882 	err = alc_alloc_spec(codec, 0x0b);
9883 	if (err < 0)
9884 		return err;
9885 
9886 	spec = codec->spec;
9887 	if (has_cdefine_beep(codec))
9888 		spec->gen.beep_nid = 0x23;
9889 
9890 	spec->shutup = alc_eapd_shutup;
9891 
9892 	alc_pre_init(codec);
9893 
9894 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
9895 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9896 
9897 	/* automatic parse from the BIOS config */
9898 	err = alc861vd_parse_auto_config(codec);
9899 	if (err < 0)
9900 		goto error;
9901 
9902 	if (!spec->gen.no_analog) {
9903 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9904 		if (err < 0)
9905 			goto error;
9906 	}
9907 
9908 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
9909 
9910 	return 0;
9911 
9912  error:
9913 	alc_free(codec);
9914 	return err;
9915 }
9916 
9917 /*
9918  * ALC662 support
9919  *
9920  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
9921  * configuration.  Each pin widget can choose any input DACs and a mixer.
9922  * Each ADC is connected from a mixer of all inputs.  This makes possible
9923  * 6-channel independent captures.
9924  *
9925  * In addition, an independent DAC for the multi-playback (not used in this
9926  * driver yet).
9927  */
9928 
9929 /*
9930  * BIOS auto configuration
9931  */
9932 
9933 static int alc662_parse_auto_config(struct hda_codec *codec)
9934 {
9935 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
9936 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
9937 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9938 	const hda_nid_t *ssids;
9939 
9940 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
9941 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
9942 	    codec->core.vendor_id == 0x10ec0671)
9943 		ssids = alc663_ssids;
9944 	else
9945 		ssids = alc662_ssids;
9946 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
9947 }
9948 
9949 static void alc272_fixup_mario(struct hda_codec *codec,
9950 			       const struct hda_fixup *fix, int action)
9951 {
9952 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
9953 		return;
9954 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
9955 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
9956 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
9957 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
9958 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
9959 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
9960 }
9961 
9962 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
9963 	{ .channels = 2,
9964 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
9965 	{ .channels = 4,
9966 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
9967 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
9968 	{ }
9969 };
9970 
9971 /* override the 2.1 chmap */
9972 static void alc_fixup_bass_chmap(struct hda_codec *codec,
9973 				    const struct hda_fixup *fix, int action)
9974 {
9975 	if (action == HDA_FIXUP_ACT_BUILD) {
9976 		struct alc_spec *spec = codec->spec;
9977 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
9978 	}
9979 }
9980 
9981 /* avoid D3 for keeping GPIO up */
9982 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
9983 					  hda_nid_t nid,
9984 					  unsigned int power_state)
9985 {
9986 	struct alc_spec *spec = codec->spec;
9987 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
9988 		return AC_PWRST_D0;
9989 	return power_state;
9990 }
9991 
9992 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
9993 				   const struct hda_fixup *fix, int action)
9994 {
9995 	struct alc_spec *spec = codec->spec;
9996 
9997 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
9998 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9999 		spec->mute_led_polarity = 1;
10000 		codec->power_filter = gpio_led_power_filter;
10001 	}
10002 }
10003 
10004 static void alc662_usi_automute_hook(struct hda_codec *codec,
10005 					 struct hda_jack_callback *jack)
10006 {
10007 	struct alc_spec *spec = codec->spec;
10008 	int vref;
10009 	msleep(200);
10010 	snd_hda_gen_hp_automute(codec, jack);
10011 
10012 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10013 	msleep(100);
10014 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10015 			    vref);
10016 }
10017 
10018 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10019 				     const struct hda_fixup *fix, int action)
10020 {
10021 	struct alc_spec *spec = codec->spec;
10022 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10023 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10024 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10025 	}
10026 }
10027 
10028 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10029 					struct hda_jack_callback *cb)
10030 {
10031 	/* surround speakers at 0x1b already get muted automatically when
10032 	 * headphones are plugged in, but we have to mute/unmute the remaining
10033 	 * channels manually:
10034 	 * 0x15 - front left/front right
10035 	 * 0x18 - front center/ LFE
10036 	 */
10037 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10038 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10039 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10040 	} else {
10041 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10042 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10043 	}
10044 }
10045 
10046 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10047 					const struct hda_fixup *fix, int action)
10048 {
10049     /* Pin 0x1b: shared headphones jack and surround speakers */
10050 	if (!is_jack_detectable(codec, 0x1b))
10051 		return;
10052 
10053 	switch (action) {
10054 	case HDA_FIXUP_ACT_PRE_PROBE:
10055 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
10056 				alc662_aspire_ethos_mute_speakers);
10057 		/* subwoofer needs an extra GPIO setting to become audible */
10058 		alc_setup_gpio(codec, 0x02);
10059 		break;
10060 	case HDA_FIXUP_ACT_INIT:
10061 		/* Make sure to start in a correct state, i.e. if
10062 		 * headphones have been plugged in before powering up the system
10063 		 */
10064 		alc662_aspire_ethos_mute_speakers(codec, NULL);
10065 		break;
10066 	}
10067 }
10068 
10069 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10070 					     const struct hda_fixup *fix, int action)
10071 {
10072 	struct alc_spec *spec = codec->spec;
10073 
10074 	static const struct hda_pintbl pincfgs[] = {
10075 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10076 		{ 0x1b, 0x0181304f },
10077 		{ }
10078 	};
10079 
10080 	switch (action) {
10081 	case HDA_FIXUP_ACT_PRE_PROBE:
10082 		spec->gen.mixer_nid = 0;
10083 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10084 		snd_hda_apply_pincfgs(codec, pincfgs);
10085 		break;
10086 	case HDA_FIXUP_ACT_INIT:
10087 		alc_write_coef_idx(codec, 0x19, 0xa054);
10088 		break;
10089 	}
10090 }
10091 
10092 static const struct coef_fw alc668_coefs[] = {
10093 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
10094 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
10095 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
10096 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10097 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10098 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10099 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
10100 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
10101 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10102 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10103 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10104 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10105 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
10106 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10107 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
10108 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
10109 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10110 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10111 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10112 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10113 	{}
10114 };
10115 
10116 static void alc668_restore_default_value(struct hda_codec *codec)
10117 {
10118 	alc_process_coef_fw(codec, alc668_coefs);
10119 }
10120 
10121 enum {
10122 	ALC662_FIXUP_ASPIRE,
10123 	ALC662_FIXUP_LED_GPIO1,
10124 	ALC662_FIXUP_IDEAPAD,
10125 	ALC272_FIXUP_MARIO,
10126 	ALC662_FIXUP_CZC_ET26,
10127 	ALC662_FIXUP_CZC_P10T,
10128 	ALC662_FIXUP_SKU_IGNORE,
10129 	ALC662_FIXUP_HP_RP5800,
10130 	ALC662_FIXUP_ASUS_MODE1,
10131 	ALC662_FIXUP_ASUS_MODE2,
10132 	ALC662_FIXUP_ASUS_MODE3,
10133 	ALC662_FIXUP_ASUS_MODE4,
10134 	ALC662_FIXUP_ASUS_MODE5,
10135 	ALC662_FIXUP_ASUS_MODE6,
10136 	ALC662_FIXUP_ASUS_MODE7,
10137 	ALC662_FIXUP_ASUS_MODE8,
10138 	ALC662_FIXUP_NO_JACK_DETECT,
10139 	ALC662_FIXUP_ZOTAC_Z68,
10140 	ALC662_FIXUP_INV_DMIC,
10141 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
10142 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
10143 	ALC662_FIXUP_HEADSET_MODE,
10144 	ALC668_FIXUP_HEADSET_MODE,
10145 	ALC662_FIXUP_BASS_MODE4_CHMAP,
10146 	ALC662_FIXUP_BASS_16,
10147 	ALC662_FIXUP_BASS_1A,
10148 	ALC662_FIXUP_BASS_CHMAP,
10149 	ALC668_FIXUP_AUTO_MUTE,
10150 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
10151 	ALC668_FIXUP_DELL_XPS13,
10152 	ALC662_FIXUP_ASUS_Nx50,
10153 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
10154 	ALC668_FIXUP_ASUS_Nx51,
10155 	ALC668_FIXUP_MIC_COEF,
10156 	ALC668_FIXUP_ASUS_G751,
10157 	ALC891_FIXUP_HEADSET_MODE,
10158 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10159 	ALC662_FIXUP_ACER_VERITON,
10160 	ALC892_FIXUP_ASROCK_MOBO,
10161 	ALC662_FIXUP_USI_FUNC,
10162 	ALC662_FIXUP_USI_HEADSET_MODE,
10163 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
10164 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
10165 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
10166 	ALC671_FIXUP_HP_HEADSET_MIC2,
10167 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
10168 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
10169 };
10170 
10171 static const struct hda_fixup alc662_fixups[] = {
10172 	[ALC662_FIXUP_ASPIRE] = {
10173 		.type = HDA_FIXUP_PINS,
10174 		.v.pins = (const struct hda_pintbl[]) {
10175 			{ 0x15, 0x99130112 }, /* subwoofer */
10176 			{ }
10177 		}
10178 	},
10179 	[ALC662_FIXUP_LED_GPIO1] = {
10180 		.type = HDA_FIXUP_FUNC,
10181 		.v.func = alc662_fixup_led_gpio1,
10182 	},
10183 	[ALC662_FIXUP_IDEAPAD] = {
10184 		.type = HDA_FIXUP_PINS,
10185 		.v.pins = (const struct hda_pintbl[]) {
10186 			{ 0x17, 0x99130112 }, /* subwoofer */
10187 			{ }
10188 		},
10189 		.chained = true,
10190 		.chain_id = ALC662_FIXUP_LED_GPIO1,
10191 	},
10192 	[ALC272_FIXUP_MARIO] = {
10193 		.type = HDA_FIXUP_FUNC,
10194 		.v.func = alc272_fixup_mario,
10195 	},
10196 	[ALC662_FIXUP_CZC_ET26] = {
10197 		.type = HDA_FIXUP_PINS,
10198 		.v.pins = (const struct hda_pintbl[]) {
10199 			{0x12, 0x403cc000},
10200 			{0x14, 0x90170110}, /* speaker */
10201 			{0x15, 0x411111f0},
10202 			{0x16, 0x411111f0},
10203 			{0x18, 0x01a19030}, /* mic */
10204 			{0x19, 0x90a7013f}, /* int-mic */
10205 			{0x1a, 0x01014020},
10206 			{0x1b, 0x0121401f},
10207 			{0x1c, 0x411111f0},
10208 			{0x1d, 0x411111f0},
10209 			{0x1e, 0x40478e35},
10210 			{}
10211 		},
10212 		.chained = true,
10213 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10214 	},
10215 	[ALC662_FIXUP_CZC_P10T] = {
10216 		.type = HDA_FIXUP_VERBS,
10217 		.v.verbs = (const struct hda_verb[]) {
10218 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10219 			{}
10220 		}
10221 	},
10222 	[ALC662_FIXUP_SKU_IGNORE] = {
10223 		.type = HDA_FIXUP_FUNC,
10224 		.v.func = alc_fixup_sku_ignore,
10225 	},
10226 	[ALC662_FIXUP_HP_RP5800] = {
10227 		.type = HDA_FIXUP_PINS,
10228 		.v.pins = (const struct hda_pintbl[]) {
10229 			{ 0x14, 0x0221201f }, /* HP out */
10230 			{ }
10231 		},
10232 		.chained = true,
10233 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10234 	},
10235 	[ALC662_FIXUP_ASUS_MODE1] = {
10236 		.type = HDA_FIXUP_PINS,
10237 		.v.pins = (const struct hda_pintbl[]) {
10238 			{ 0x14, 0x99130110 }, /* speaker */
10239 			{ 0x18, 0x01a19c20 }, /* mic */
10240 			{ 0x19, 0x99a3092f }, /* int-mic */
10241 			{ 0x21, 0x0121401f }, /* HP out */
10242 			{ }
10243 		},
10244 		.chained = true,
10245 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10246 	},
10247 	[ALC662_FIXUP_ASUS_MODE2] = {
10248 		.type = HDA_FIXUP_PINS,
10249 		.v.pins = (const struct hda_pintbl[]) {
10250 			{ 0x14, 0x99130110 }, /* speaker */
10251 			{ 0x18, 0x01a19820 }, /* mic */
10252 			{ 0x19, 0x99a3092f }, /* int-mic */
10253 			{ 0x1b, 0x0121401f }, /* HP out */
10254 			{ }
10255 		},
10256 		.chained = true,
10257 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10258 	},
10259 	[ALC662_FIXUP_ASUS_MODE3] = {
10260 		.type = HDA_FIXUP_PINS,
10261 		.v.pins = (const struct hda_pintbl[]) {
10262 			{ 0x14, 0x99130110 }, /* speaker */
10263 			{ 0x15, 0x0121441f }, /* HP */
10264 			{ 0x18, 0x01a19840 }, /* mic */
10265 			{ 0x19, 0x99a3094f }, /* int-mic */
10266 			{ 0x21, 0x01211420 }, /* HP2 */
10267 			{ }
10268 		},
10269 		.chained = true,
10270 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10271 	},
10272 	[ALC662_FIXUP_ASUS_MODE4] = {
10273 		.type = HDA_FIXUP_PINS,
10274 		.v.pins = (const struct hda_pintbl[]) {
10275 			{ 0x14, 0x99130110 }, /* speaker */
10276 			{ 0x16, 0x99130111 }, /* speaker */
10277 			{ 0x18, 0x01a19840 }, /* mic */
10278 			{ 0x19, 0x99a3094f }, /* int-mic */
10279 			{ 0x21, 0x0121441f }, /* HP */
10280 			{ }
10281 		},
10282 		.chained = true,
10283 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10284 	},
10285 	[ALC662_FIXUP_ASUS_MODE5] = {
10286 		.type = HDA_FIXUP_PINS,
10287 		.v.pins = (const struct hda_pintbl[]) {
10288 			{ 0x14, 0x99130110 }, /* speaker */
10289 			{ 0x15, 0x0121441f }, /* HP */
10290 			{ 0x16, 0x99130111 }, /* speaker */
10291 			{ 0x18, 0x01a19840 }, /* mic */
10292 			{ 0x19, 0x99a3094f }, /* int-mic */
10293 			{ }
10294 		},
10295 		.chained = true,
10296 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10297 	},
10298 	[ALC662_FIXUP_ASUS_MODE6] = {
10299 		.type = HDA_FIXUP_PINS,
10300 		.v.pins = (const struct hda_pintbl[]) {
10301 			{ 0x14, 0x99130110 }, /* speaker */
10302 			{ 0x15, 0x01211420 }, /* HP2 */
10303 			{ 0x18, 0x01a19840 }, /* mic */
10304 			{ 0x19, 0x99a3094f }, /* int-mic */
10305 			{ 0x1b, 0x0121441f }, /* HP */
10306 			{ }
10307 		},
10308 		.chained = true,
10309 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10310 	},
10311 	[ALC662_FIXUP_ASUS_MODE7] = {
10312 		.type = HDA_FIXUP_PINS,
10313 		.v.pins = (const struct hda_pintbl[]) {
10314 			{ 0x14, 0x99130110 }, /* speaker */
10315 			{ 0x17, 0x99130111 }, /* speaker */
10316 			{ 0x18, 0x01a19840 }, /* mic */
10317 			{ 0x19, 0x99a3094f }, /* int-mic */
10318 			{ 0x1b, 0x01214020 }, /* HP */
10319 			{ 0x21, 0x0121401f }, /* HP */
10320 			{ }
10321 		},
10322 		.chained = true,
10323 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10324 	},
10325 	[ALC662_FIXUP_ASUS_MODE8] = {
10326 		.type = HDA_FIXUP_PINS,
10327 		.v.pins = (const struct hda_pintbl[]) {
10328 			{ 0x14, 0x99130110 }, /* speaker */
10329 			{ 0x12, 0x99a30970 }, /* int-mic */
10330 			{ 0x15, 0x01214020 }, /* HP */
10331 			{ 0x17, 0x99130111 }, /* speaker */
10332 			{ 0x18, 0x01a19840 }, /* mic */
10333 			{ 0x21, 0x0121401f }, /* HP */
10334 			{ }
10335 		},
10336 		.chained = true,
10337 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10338 	},
10339 	[ALC662_FIXUP_NO_JACK_DETECT] = {
10340 		.type = HDA_FIXUP_FUNC,
10341 		.v.func = alc_fixup_no_jack_detect,
10342 	},
10343 	[ALC662_FIXUP_ZOTAC_Z68] = {
10344 		.type = HDA_FIXUP_PINS,
10345 		.v.pins = (const struct hda_pintbl[]) {
10346 			{ 0x1b, 0x02214020 }, /* Front HP */
10347 			{ }
10348 		}
10349 	},
10350 	[ALC662_FIXUP_INV_DMIC] = {
10351 		.type = HDA_FIXUP_FUNC,
10352 		.v.func = alc_fixup_inv_dmic,
10353 	},
10354 	[ALC668_FIXUP_DELL_XPS13] = {
10355 		.type = HDA_FIXUP_FUNC,
10356 		.v.func = alc_fixup_dell_xps13,
10357 		.chained = true,
10358 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10359 	},
10360 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10361 		.type = HDA_FIXUP_FUNC,
10362 		.v.func = alc_fixup_disable_aamix,
10363 		.chained = true,
10364 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10365 	},
10366 	[ALC668_FIXUP_AUTO_MUTE] = {
10367 		.type = HDA_FIXUP_FUNC,
10368 		.v.func = alc_fixup_auto_mute_via_amp,
10369 		.chained = true,
10370 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10371 	},
10372 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10373 		.type = HDA_FIXUP_PINS,
10374 		.v.pins = (const struct hda_pintbl[]) {
10375 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10376 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10377 			{ }
10378 		},
10379 		.chained = true,
10380 		.chain_id = ALC662_FIXUP_HEADSET_MODE
10381 	},
10382 	[ALC662_FIXUP_HEADSET_MODE] = {
10383 		.type = HDA_FIXUP_FUNC,
10384 		.v.func = alc_fixup_headset_mode_alc662,
10385 	},
10386 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10387 		.type = HDA_FIXUP_PINS,
10388 		.v.pins = (const struct hda_pintbl[]) {
10389 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10390 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10391 			{ }
10392 		},
10393 		.chained = true,
10394 		.chain_id = ALC668_FIXUP_HEADSET_MODE
10395 	},
10396 	[ALC668_FIXUP_HEADSET_MODE] = {
10397 		.type = HDA_FIXUP_FUNC,
10398 		.v.func = alc_fixup_headset_mode_alc668,
10399 	},
10400 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
10401 		.type = HDA_FIXUP_FUNC,
10402 		.v.func = alc_fixup_bass_chmap,
10403 		.chained = true,
10404 		.chain_id = ALC662_FIXUP_ASUS_MODE4
10405 	},
10406 	[ALC662_FIXUP_BASS_16] = {
10407 		.type = HDA_FIXUP_PINS,
10408 		.v.pins = (const struct hda_pintbl[]) {
10409 			{0x16, 0x80106111}, /* bass speaker */
10410 			{}
10411 		},
10412 		.chained = true,
10413 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
10414 	},
10415 	[ALC662_FIXUP_BASS_1A] = {
10416 		.type = HDA_FIXUP_PINS,
10417 		.v.pins = (const struct hda_pintbl[]) {
10418 			{0x1a, 0x80106111}, /* bass speaker */
10419 			{}
10420 		},
10421 		.chained = true,
10422 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
10423 	},
10424 	[ALC662_FIXUP_BASS_CHMAP] = {
10425 		.type = HDA_FIXUP_FUNC,
10426 		.v.func = alc_fixup_bass_chmap,
10427 	},
10428 	[ALC662_FIXUP_ASUS_Nx50] = {
10429 		.type = HDA_FIXUP_FUNC,
10430 		.v.func = alc_fixup_auto_mute_via_amp,
10431 		.chained = true,
10432 		.chain_id = ALC662_FIXUP_BASS_1A
10433 	},
10434 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10435 		.type = HDA_FIXUP_FUNC,
10436 		.v.func = alc_fixup_headset_mode_alc668,
10437 		.chain_id = ALC662_FIXUP_BASS_CHMAP
10438 	},
10439 	[ALC668_FIXUP_ASUS_Nx51] = {
10440 		.type = HDA_FIXUP_PINS,
10441 		.v.pins = (const struct hda_pintbl[]) {
10442 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10443 			{ 0x1a, 0x90170151 }, /* bass speaker */
10444 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10445 			{}
10446 		},
10447 		.chained = true,
10448 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
10449 	},
10450 	[ALC668_FIXUP_MIC_COEF] = {
10451 		.type = HDA_FIXUP_VERBS,
10452 		.v.verbs = (const struct hda_verb[]) {
10453 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10454 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10455 			{}
10456 		},
10457 	},
10458 	[ALC668_FIXUP_ASUS_G751] = {
10459 		.type = HDA_FIXUP_PINS,
10460 		.v.pins = (const struct hda_pintbl[]) {
10461 			{ 0x16, 0x0421101f }, /* HP */
10462 			{}
10463 		},
10464 		.chained = true,
10465 		.chain_id = ALC668_FIXUP_MIC_COEF
10466 	},
10467 	[ALC891_FIXUP_HEADSET_MODE] = {
10468 		.type = HDA_FIXUP_FUNC,
10469 		.v.func = alc_fixup_headset_mode,
10470 	},
10471 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10472 		.type = HDA_FIXUP_PINS,
10473 		.v.pins = (const struct hda_pintbl[]) {
10474 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10475 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10476 			{ }
10477 		},
10478 		.chained = true,
10479 		.chain_id = ALC891_FIXUP_HEADSET_MODE
10480 	},
10481 	[ALC662_FIXUP_ACER_VERITON] = {
10482 		.type = HDA_FIXUP_PINS,
10483 		.v.pins = (const struct hda_pintbl[]) {
10484 			{ 0x15, 0x50170120 }, /* no internal speaker */
10485 			{ }
10486 		}
10487 	},
10488 	[ALC892_FIXUP_ASROCK_MOBO] = {
10489 		.type = HDA_FIXUP_PINS,
10490 		.v.pins = (const struct hda_pintbl[]) {
10491 			{ 0x15, 0x40f000f0 }, /* disabled */
10492 			{ 0x16, 0x40f000f0 }, /* disabled */
10493 			{ }
10494 		}
10495 	},
10496 	[ALC662_FIXUP_USI_FUNC] = {
10497 		.type = HDA_FIXUP_FUNC,
10498 		.v.func = alc662_fixup_usi_headset_mic,
10499 	},
10500 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
10501 		.type = HDA_FIXUP_PINS,
10502 		.v.pins = (const struct hda_pintbl[]) {
10503 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10504 			{ 0x18, 0x01a1903d },
10505 			{ }
10506 		},
10507 		.chained = true,
10508 		.chain_id = ALC662_FIXUP_USI_FUNC
10509 	},
10510 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10511 		.type = HDA_FIXUP_FUNC,
10512 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10513 	},
10514 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10515 		.type = HDA_FIXUP_FUNC,
10516 		.v.func = alc662_fixup_aspire_ethos_hp,
10517 	},
10518 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10519 		.type = HDA_FIXUP_PINS,
10520 		.v.pins = (const struct hda_pintbl[]) {
10521 			{ 0x15, 0x92130110 }, /* front speakers */
10522 			{ 0x18, 0x99130111 }, /* center/subwoofer */
10523 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
10524 			{ }
10525 		},
10526 		.chained = true,
10527 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
10528 	},
10529 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
10530 		.type = HDA_FIXUP_FUNC,
10531 		.v.func = alc671_fixup_hp_headset_mic2,
10532 	},
10533 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10534 		.type = HDA_FIXUP_PINS,
10535 		.v.pins = (const struct hda_pintbl[]) {
10536 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10537 			{ }
10538 		},
10539 		.chained = true,
10540 		.chain_id = ALC662_FIXUP_USI_FUNC
10541 	},
10542 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10543 		.type = HDA_FIXUP_PINS,
10544 		.v.pins = (const struct hda_pintbl[]) {
10545 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10546 			{ 0x1b, 0x0221144f },
10547 			{ }
10548 		},
10549 		.chained = true,
10550 		.chain_id = ALC662_FIXUP_USI_FUNC
10551 	},
10552 };
10553 
10554 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
10555 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
10556 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
10557 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
10558 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
10559 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
10560 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
10561 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
10562 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
10563 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
10564 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
10565 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
10566 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10567 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10568 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
10569 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
10570 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
10571 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10572 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10573 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10574 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10575 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10576 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
10577 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
10578 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
10579 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
10580 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
10581 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
10582 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
10583 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
10584 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
10585 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
10586 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
10587 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
10588 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
10589 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
10590 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
10591 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
10592 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
10593 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
10594 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
10595 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
10596 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
10597 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
10598 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
10599 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
10600 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
10601 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
10602 
10603 #if 0
10604 	/* Below is a quirk table taken from the old code.
10605 	 * Basically the device should work as is without the fixup table.
10606 	 * If BIOS doesn't give a proper info, enable the corresponding
10607 	 * fixup entry.
10608 	 */
10609 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
10610 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
10611 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
10612 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
10613 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10614 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10615 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10616 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
10617 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
10618 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10619 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
10620 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
10621 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
10622 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
10623 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
10624 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10625 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
10626 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
10627 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10628 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10629 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10630 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10631 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
10632 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
10633 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
10634 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10635 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
10636 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10637 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10638 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
10639 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10640 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10641 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
10642 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
10643 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
10644 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
10645 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
10646 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
10647 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
10648 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10649 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
10650 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
10651 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10652 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
10653 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
10654 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
10655 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
10656 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
10657 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10658 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
10659 #endif
10660 	{}
10661 };
10662 
10663 static const struct hda_model_fixup alc662_fixup_models[] = {
10664 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
10665 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
10666 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
10667 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
10668 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
10669 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
10670 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
10671 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
10672 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
10673 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
10674 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
10675 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
10676 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
10677 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
10678 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
10679 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10680 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
10681 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
10682 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
10683 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
10684 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
10685 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
10686 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
10687 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
10688 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
10689 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
10690 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
10691 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
10692 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
10693 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
10694 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10695 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
10696 	{}
10697 };
10698 
10699 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
10700 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10701 		{0x17, 0x02211010},
10702 		{0x18, 0x01a19030},
10703 		{0x1a, 0x01813040},
10704 		{0x21, 0x01014020}),
10705 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10706 		{0x16, 0x01813030},
10707 		{0x17, 0x02211010},
10708 		{0x18, 0x01a19040},
10709 		{0x21, 0x01014020}),
10710 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
10711 		{0x14, 0x01014010},
10712 		{0x18, 0x01a19020},
10713 		{0x1a, 0x0181302f},
10714 		{0x1b, 0x0221401f}),
10715 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10716 		{0x12, 0x99a30130},
10717 		{0x14, 0x90170110},
10718 		{0x15, 0x0321101f},
10719 		{0x16, 0x03011020}),
10720 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10721 		{0x12, 0x99a30140},
10722 		{0x14, 0x90170110},
10723 		{0x15, 0x0321101f},
10724 		{0x16, 0x03011020}),
10725 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10726 		{0x12, 0x99a30150},
10727 		{0x14, 0x90170110},
10728 		{0x15, 0x0321101f},
10729 		{0x16, 0x03011020}),
10730 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10731 		{0x14, 0x90170110},
10732 		{0x15, 0x0321101f},
10733 		{0x16, 0x03011020}),
10734 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
10735 		{0x12, 0x90a60130},
10736 		{0x14, 0x90170110},
10737 		{0x15, 0x0321101f}),
10738 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10739 		{0x14, 0x01014010},
10740 		{0x17, 0x90170150},
10741 		{0x19, 0x02a11060},
10742 		{0x1b, 0x01813030},
10743 		{0x21, 0x02211020}),
10744 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10745 		{0x14, 0x01014010},
10746 		{0x18, 0x01a19040},
10747 		{0x1b, 0x01813030},
10748 		{0x21, 0x02211020}),
10749 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10750 		{0x14, 0x01014020},
10751 		{0x17, 0x90170110},
10752 		{0x18, 0x01a19050},
10753 		{0x1b, 0x01813040},
10754 		{0x21, 0x02211030}),
10755 	{}
10756 };
10757 
10758 /*
10759  */
10760 static int patch_alc662(struct hda_codec *codec)
10761 {
10762 	struct alc_spec *spec;
10763 	int err;
10764 
10765 	err = alc_alloc_spec(codec, 0x0b);
10766 	if (err < 0)
10767 		return err;
10768 
10769 	spec = codec->spec;
10770 
10771 	spec->shutup = alc_eapd_shutup;
10772 
10773 	/* handle multiple HPs as is */
10774 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
10775 
10776 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
10777 
10778 	switch (codec->core.vendor_id) {
10779 	case 0x10ec0668:
10780 		spec->init_hook = alc668_restore_default_value;
10781 		break;
10782 	}
10783 
10784 	alc_pre_init(codec);
10785 
10786 	snd_hda_pick_fixup(codec, alc662_fixup_models,
10787 		       alc662_fixup_tbl, alc662_fixups);
10788 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
10789 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10790 
10791 	alc_auto_parse_customize_define(codec);
10792 
10793 	if (has_cdefine_beep(codec))
10794 		spec->gen.beep_nid = 0x01;
10795 
10796 	if ((alc_get_coef0(codec) & (1 << 14)) &&
10797 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
10798 	    spec->cdefine.platform_type == 1) {
10799 		err = alc_codec_rename(codec, "ALC272X");
10800 		if (err < 0)
10801 			goto error;
10802 	}
10803 
10804 	/* automatic parse from the BIOS config */
10805 	err = alc662_parse_auto_config(codec);
10806 	if (err < 0)
10807 		goto error;
10808 
10809 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
10810 		switch (codec->core.vendor_id) {
10811 		case 0x10ec0662:
10812 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10813 			break;
10814 		case 0x10ec0272:
10815 		case 0x10ec0663:
10816 		case 0x10ec0665:
10817 		case 0x10ec0668:
10818 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
10819 			break;
10820 		case 0x10ec0273:
10821 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
10822 			break;
10823 		}
10824 		if (err < 0)
10825 			goto error;
10826 	}
10827 
10828 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10829 
10830 	return 0;
10831 
10832  error:
10833 	alc_free(codec);
10834 	return err;
10835 }
10836 
10837 /*
10838  * ALC680 support
10839  */
10840 
10841 static int alc680_parse_auto_config(struct hda_codec *codec)
10842 {
10843 	return alc_parse_auto_config(codec, NULL, NULL);
10844 }
10845 
10846 /*
10847  */
10848 static int patch_alc680(struct hda_codec *codec)
10849 {
10850 	int err;
10851 
10852 	/* ALC680 has no aa-loopback mixer */
10853 	err = alc_alloc_spec(codec, 0);
10854 	if (err < 0)
10855 		return err;
10856 
10857 	/* automatic parse from the BIOS config */
10858 	err = alc680_parse_auto_config(codec);
10859 	if (err < 0) {
10860 		alc_free(codec);
10861 		return err;
10862 	}
10863 
10864 	return 0;
10865 }
10866 
10867 /*
10868  * patch entries
10869  */
10870 static const struct hda_device_id snd_hda_id_realtek[] = {
10871 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
10872 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
10873 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
10874 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
10875 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
10876 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
10877 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
10878 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
10879 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
10880 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
10881 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
10882 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
10883 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
10884 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
10885 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
10886 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
10887 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
10888 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
10889 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
10890 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
10891 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
10892 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
10893 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
10894 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
10895 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
10896 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
10897 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
10898 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
10899 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
10900 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
10901 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
10902 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
10903 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
10904 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
10905 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
10906 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
10907 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
10908 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
10909 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
10910 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
10911 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
10912 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
10913 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
10914 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
10915 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
10916 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
10917 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
10918 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
10919 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
10920 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
10921 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
10922 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
10923 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
10924 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
10925 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
10926 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
10927 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
10928 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
10929 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
10930 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
10931 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
10932 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
10933 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
10934 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
10935 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
10936 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
10937 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
10938 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
10939 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
10940 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
10941 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
10942 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
10943 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
10944 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
10945 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
10946 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
10947 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
10948 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
10949 	{} /* terminator */
10950 };
10951 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
10952 
10953 MODULE_LICENSE("GPL");
10954 MODULE_DESCRIPTION("Realtek HD-audio codec");
10955 
10956 static struct hda_codec_driver realtek_driver = {
10957 	.id = snd_hda_id_realtek,
10958 };
10959 
10960 module_hda_codec_driver(realtek_driver);
10961