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