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