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