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