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