xref: /openbmc/linux/sound/pci/hda/patch_realtek.c (revision 8ebc80a25f9d9bf7a8e368b266d5b740c485c362)
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 <linux/ctype.h>
22 #include <sound/core.h>
23 #include <sound/jack.h>
24 #include <sound/hda_codec.h>
25 #include "hda_local.h"
26 #include "hda_auto_parser.h"
27 #include "hda_jack.h"
28 #include "hda_generic.h"
29 #include "hda_component.h"
30 
31 /* keep halting ALC5505 DSP, for power saving */
32 #define HALT_REALTEK_ALC5505
33 
34 /* extra amp-initialization sequence types */
35 enum {
36 	ALC_INIT_UNDEFINED,
37 	ALC_INIT_NONE,
38 	ALC_INIT_DEFAULT,
39 };
40 
41 enum {
42 	ALC_HEADSET_MODE_UNKNOWN,
43 	ALC_HEADSET_MODE_UNPLUGGED,
44 	ALC_HEADSET_MODE_HEADSET,
45 	ALC_HEADSET_MODE_MIC,
46 	ALC_HEADSET_MODE_HEADPHONE,
47 };
48 
49 enum {
50 	ALC_HEADSET_TYPE_UNKNOWN,
51 	ALC_HEADSET_TYPE_CTIA,
52 	ALC_HEADSET_TYPE_OMTP,
53 };
54 
55 enum {
56 	ALC_KEY_MICMUTE_INDEX,
57 };
58 
59 struct alc_customize_define {
60 	unsigned int  sku_cfg;
61 	unsigned char port_connectivity;
62 	unsigned char check_sum;
63 	unsigned char customization;
64 	unsigned char external_amp;
65 	unsigned int  enable_pcbeep:1;
66 	unsigned int  platform_type:1;
67 	unsigned int  swap:1;
68 	unsigned int  override:1;
69 	unsigned int  fixup:1; /* Means that this sku is set by driver, not read from hw */
70 };
71 
72 struct alc_coef_led {
73 	unsigned int idx;
74 	unsigned int mask;
75 	unsigned int on;
76 	unsigned int off;
77 };
78 
79 struct alc_spec {
80 	struct hda_gen_spec gen; /* must be at head */
81 
82 	/* codec parameterization */
83 	struct alc_customize_define cdefine;
84 	unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
85 
86 	/* GPIO bits */
87 	unsigned int gpio_mask;
88 	unsigned int gpio_dir;
89 	unsigned int gpio_data;
90 	bool gpio_write_delay;	/* add a delay before writing gpio_data */
91 
92 	/* mute LED for HP laptops, see vref_mute_led_set() */
93 	int mute_led_polarity;
94 	int micmute_led_polarity;
95 	hda_nid_t mute_led_nid;
96 	hda_nid_t cap_mute_led_nid;
97 
98 	unsigned int gpio_mute_led_mask;
99 	unsigned int gpio_mic_led_mask;
100 	struct alc_coef_led mute_led_coef;
101 	struct alc_coef_led mic_led_coef;
102 	struct mutex coef_mutex;
103 
104 	hda_nid_t headset_mic_pin;
105 	hda_nid_t headphone_mic_pin;
106 	int current_headset_mode;
107 	int current_headset_type;
108 
109 	/* hooks */
110 	void (*init_hook)(struct hda_codec *codec);
111 #ifdef CONFIG_PM
112 	void (*power_hook)(struct hda_codec *codec);
113 #endif
114 	void (*shutup)(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 	/* component binding */
135 	struct component_match *match;
136 	struct hda_component comps[HDA_MAX_COMPONENTS];
137 };
138 
139 /*
140  * COEF access helper functions
141  */
142 
coef_mutex_lock(struct hda_codec * codec)143 static void coef_mutex_lock(struct hda_codec *codec)
144 {
145 	struct alc_spec *spec = codec->spec;
146 
147 	snd_hda_power_up_pm(codec);
148 	mutex_lock(&spec->coef_mutex);
149 }
150 
coef_mutex_unlock(struct hda_codec * codec)151 static void coef_mutex_unlock(struct hda_codec *codec)
152 {
153 	struct alc_spec *spec = codec->spec;
154 
155 	mutex_unlock(&spec->coef_mutex);
156 	snd_hda_power_down_pm(codec);
157 }
158 
__alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)159 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 				 unsigned int coef_idx)
161 {
162 	unsigned int val;
163 
164 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
165 	val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
166 	return val;
167 }
168 
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)169 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
170 			       unsigned int coef_idx)
171 {
172 	unsigned int val;
173 
174 	coef_mutex_lock(codec);
175 	val = __alc_read_coefex_idx(codec, nid, coef_idx);
176 	coef_mutex_unlock(codec);
177 	return val;
178 }
179 
180 #define alc_read_coef_idx(codec, coef_idx) \
181 	alc_read_coefex_idx(codec, 0x20, coef_idx)
182 
__alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)183 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
184 				   unsigned int coef_idx, unsigned int coef_val)
185 {
186 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
187 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
188 }
189 
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)190 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
191 				 unsigned int coef_idx, unsigned int coef_val)
192 {
193 	coef_mutex_lock(codec);
194 	__alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
195 	coef_mutex_unlock(codec);
196 }
197 
198 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
199 	alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
200 
__alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)201 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
202 				    unsigned int coef_idx, unsigned int mask,
203 				    unsigned int bits_set)
204 {
205 	unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
206 
207 	if (val != -1)
208 		__alc_write_coefex_idx(codec, nid, coef_idx,
209 				       (val & ~mask) | bits_set);
210 }
211 
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)212 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
213 				  unsigned int coef_idx, unsigned int mask,
214 				  unsigned int bits_set)
215 {
216 	coef_mutex_lock(codec);
217 	__alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
218 	coef_mutex_unlock(codec);
219 }
220 
221 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set)	\
222 	alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
223 
224 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)225 static unsigned int alc_get_coef0(struct hda_codec *codec)
226 {
227 	struct alc_spec *spec = codec->spec;
228 
229 	if (!spec->coef0)
230 		spec->coef0 = alc_read_coef_idx(codec, 0);
231 	return spec->coef0;
232 }
233 
234 /* coef writes/updates batch */
235 struct coef_fw {
236 	unsigned char nid;
237 	unsigned char idx;
238 	unsigned short mask;
239 	unsigned short val;
240 };
241 
242 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
243 	{ .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
244 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
245 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
246 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
247 
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)248 static void alc_process_coef_fw(struct hda_codec *codec,
249 				const struct coef_fw *fw)
250 {
251 	coef_mutex_lock(codec);
252 	for (; fw->nid; fw++) {
253 		if (fw->mask == (unsigned short)-1)
254 			__alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
255 		else
256 			__alc_update_coefex_idx(codec, fw->nid, fw->idx,
257 						fw->mask, fw->val);
258 	}
259 	coef_mutex_unlock(codec);
260 }
261 
262 /*
263  * GPIO setup tables, used in initialization
264  */
265 
266 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)267 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
268 {
269 	struct alc_spec *spec = codec->spec;
270 
271 	spec->gpio_mask |= mask;
272 	spec->gpio_dir |= mask;
273 	spec->gpio_data |= mask;
274 }
275 
alc_write_gpio_data(struct hda_codec * codec)276 static void alc_write_gpio_data(struct hda_codec *codec)
277 {
278 	struct alc_spec *spec = codec->spec;
279 
280 	snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
281 			    spec->gpio_data);
282 }
283 
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)284 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
285 				 bool on)
286 {
287 	struct alc_spec *spec = codec->spec;
288 	unsigned int oldval = spec->gpio_data;
289 
290 	if (on)
291 		spec->gpio_data |= mask;
292 	else
293 		spec->gpio_data &= ~mask;
294 	if (oldval != spec->gpio_data)
295 		alc_write_gpio_data(codec);
296 }
297 
alc_write_gpio(struct hda_codec * codec)298 static void alc_write_gpio(struct hda_codec *codec)
299 {
300 	struct alc_spec *spec = codec->spec;
301 
302 	if (!spec->gpio_mask)
303 		return;
304 
305 	snd_hda_codec_write(codec, codec->core.afg, 0,
306 			    AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
307 	snd_hda_codec_write(codec, codec->core.afg, 0,
308 			    AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
309 	if (spec->gpio_write_delay)
310 		msleep(1);
311 	alc_write_gpio_data(codec);
312 }
313 
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)314 static void alc_fixup_gpio(struct hda_codec *codec, int action,
315 			   unsigned int mask)
316 {
317 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
318 		alc_setup_gpio(codec, mask);
319 }
320 
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)321 static void alc_fixup_gpio1(struct hda_codec *codec,
322 			    const struct hda_fixup *fix, int action)
323 {
324 	alc_fixup_gpio(codec, action, 0x01);
325 }
326 
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)327 static void alc_fixup_gpio2(struct hda_codec *codec,
328 			    const struct hda_fixup *fix, int action)
329 {
330 	alc_fixup_gpio(codec, action, 0x02);
331 }
332 
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)333 static void alc_fixup_gpio3(struct hda_codec *codec,
334 			    const struct hda_fixup *fix, int action)
335 {
336 	alc_fixup_gpio(codec, action, 0x03);
337 }
338 
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)339 static void alc_fixup_gpio4(struct hda_codec *codec,
340 			    const struct hda_fixup *fix, int action)
341 {
342 	alc_fixup_gpio(codec, action, 0x04);
343 }
344 
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)345 static void alc_fixup_micmute_led(struct hda_codec *codec,
346 				  const struct hda_fixup *fix, int action)
347 {
348 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
349 		snd_hda_gen_add_micmute_led_cdev(codec, NULL);
350 }
351 
352 /*
353  * Fix hardware PLL issue
354  * On some codecs, the analog PLL gating control must be off while
355  * the default value is 1.
356  */
alc_fix_pll(struct hda_codec * codec)357 static void alc_fix_pll(struct hda_codec *codec)
358 {
359 	struct alc_spec *spec = codec->spec;
360 
361 	if (spec->pll_nid)
362 		alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
363 				      1 << spec->pll_coef_bit, 0);
364 }
365 
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)366 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
367 			     unsigned int coef_idx, unsigned int coef_bit)
368 {
369 	struct alc_spec *spec = codec->spec;
370 	spec->pll_nid = nid;
371 	spec->pll_coef_idx = coef_idx;
372 	spec->pll_coef_bit = coef_bit;
373 	alc_fix_pll(codec);
374 }
375 
376 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)377 static void alc_update_knob_master(struct hda_codec *codec,
378 				   struct hda_jack_callback *jack)
379 {
380 	unsigned int val;
381 	struct snd_kcontrol *kctl;
382 	struct snd_ctl_elem_value *uctl;
383 
384 	kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
385 	if (!kctl)
386 		return;
387 	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
388 	if (!uctl)
389 		return;
390 	val = snd_hda_codec_read(codec, jack->nid, 0,
391 				 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
392 	val &= HDA_AMP_VOLMASK;
393 	uctl->value.integer.value[0] = val;
394 	uctl->value.integer.value[1] = val;
395 	kctl->put(kctl, uctl);
396 	kfree(uctl);
397 }
398 
alc880_unsol_event(struct hda_codec * codec,unsigned int res)399 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
400 {
401 	/* For some reason, the res given from ALC880 is broken.
402 	   Here we adjust it properly. */
403 	snd_hda_jack_unsol_event(codec, res >> 2);
404 }
405 
406 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)407 static void alc_fill_eapd_coef(struct hda_codec *codec)
408 {
409 	int coef;
410 
411 	coef = alc_get_coef0(codec);
412 
413 	switch (codec->core.vendor_id) {
414 	case 0x10ec0262:
415 		alc_update_coef_idx(codec, 0x7, 0, 1<<5);
416 		break;
417 	case 0x10ec0267:
418 	case 0x10ec0268:
419 		alc_update_coef_idx(codec, 0x7, 0, 1<<13);
420 		break;
421 	case 0x10ec0269:
422 		if ((coef & 0x00f0) == 0x0010)
423 			alc_update_coef_idx(codec, 0xd, 0, 1<<14);
424 		if ((coef & 0x00f0) == 0x0020)
425 			alc_update_coef_idx(codec, 0x4, 1<<15, 0);
426 		if ((coef & 0x00f0) == 0x0030)
427 			alc_update_coef_idx(codec, 0x10, 1<<9, 0);
428 		break;
429 	case 0x10ec0280:
430 	case 0x10ec0284:
431 	case 0x10ec0290:
432 	case 0x10ec0292:
433 		alc_update_coef_idx(codec, 0x4, 1<<15, 0);
434 		break;
435 	case 0x10ec0225:
436 	case 0x10ec0295:
437 	case 0x10ec0299:
438 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
439 		fallthrough;
440 	case 0x10ec0215:
441 	case 0x10ec0285:
442 	case 0x10ec0289:
443 		alc_update_coef_idx(codec, 0x36, 1<<13, 0);
444 		fallthrough;
445 	case 0x10ec0230:
446 	case 0x10ec0233:
447 	case 0x10ec0235:
448 	case 0x10ec0236:
449 	case 0x10ec0245:
450 	case 0x10ec0255:
451 	case 0x10ec0256:
452 	case 0x19e58326:
453 	case 0x10ec0257:
454 	case 0x10ec0282:
455 	case 0x10ec0283:
456 	case 0x10ec0286:
457 	case 0x10ec0288:
458 	case 0x10ec0298:
459 	case 0x10ec0300:
460 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
461 		break;
462 	case 0x10ec0275:
463 		alc_update_coef_idx(codec, 0xe, 0, 1<<0);
464 		break;
465 	case 0x10ec0287:
466 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
467 		alc_write_coef_idx(codec, 0x8, 0x4ab7);
468 		break;
469 	case 0x10ec0293:
470 		alc_update_coef_idx(codec, 0xa, 1<<13, 0);
471 		break;
472 	case 0x10ec0234:
473 	case 0x10ec0274:
474 		alc_write_coef_idx(codec, 0x6e, 0x0c25);
475 		fallthrough;
476 	case 0x10ec0294:
477 	case 0x10ec0700:
478 	case 0x10ec0701:
479 	case 0x10ec0703:
480 	case 0x10ec0711:
481 		alc_update_coef_idx(codec, 0x10, 1<<15, 0);
482 		break;
483 	case 0x10ec0662:
484 		if ((coef & 0x00f0) == 0x0030)
485 			alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
486 		break;
487 	case 0x10ec0272:
488 	case 0x10ec0273:
489 	case 0x10ec0663:
490 	case 0x10ec0665:
491 	case 0x10ec0670:
492 	case 0x10ec0671:
493 	case 0x10ec0672:
494 		alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
495 		break;
496 	case 0x10ec0222:
497 	case 0x10ec0623:
498 		alc_update_coef_idx(codec, 0x19, 1<<13, 0);
499 		break;
500 	case 0x10ec0668:
501 		alc_update_coef_idx(codec, 0x7, 3<<13, 0);
502 		break;
503 	case 0x10ec0867:
504 		alc_update_coef_idx(codec, 0x4, 1<<10, 0);
505 		break;
506 	case 0x10ec0888:
507 		if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
508 			alc_update_coef_idx(codec, 0x7, 1<<5, 0);
509 		break;
510 	case 0x10ec0892:
511 	case 0x10ec0897:
512 		alc_update_coef_idx(codec, 0x7, 1<<5, 0);
513 		break;
514 	case 0x10ec0899:
515 	case 0x10ec0900:
516 	case 0x10ec0b00:
517 	case 0x10ec1168:
518 	case 0x10ec1220:
519 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
520 		break;
521 	}
522 }
523 
524 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)525 static void alc888_coef_init(struct hda_codec *codec)
526 {
527 	switch (alc_get_coef0(codec) & 0x00f0) {
528 	/* alc888-VA */
529 	case 0x00:
530 	/* alc888-VB */
531 	case 0x10:
532 		alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
533 		break;
534 	}
535 }
536 
537 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)538 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
539 {
540 	if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
541 		return;
542 	if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
543 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
544 				    on ? 2 : 0);
545 }
546 
547 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)548 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
549 {
550 	/* We currently only handle front, HP */
551 	static const hda_nid_t pins[] = {
552 		0x0f, 0x10, 0x14, 0x15, 0x17, 0
553 	};
554 	const hda_nid_t *p;
555 	for (p = pins; *p; p++)
556 		set_eapd(codec, *p, on);
557 }
558 
559 static int find_ext_mic_pin(struct hda_codec *codec);
560 
alc_headset_mic_no_shutup(struct hda_codec * codec)561 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
562 {
563 	const struct hda_pincfg *pin;
564 	int mic_pin = find_ext_mic_pin(codec);
565 	int i;
566 
567 	/* don't shut up pins when unloading the driver; otherwise it breaks
568 	 * the default pin setup at the next load of the driver
569 	 */
570 	if (codec->bus->shutdown)
571 		return;
572 
573 	snd_array_for_each(&codec->init_pins, i, pin) {
574 		/* use read here for syncing after issuing each verb */
575 		if (pin->nid != mic_pin)
576 			snd_hda_codec_read(codec, pin->nid, 0,
577 					AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
578 	}
579 
580 	codec->pins_shutup = 1;
581 }
582 
alc_shutup_pins(struct hda_codec * codec)583 static void alc_shutup_pins(struct hda_codec *codec)
584 {
585 	struct alc_spec *spec = codec->spec;
586 
587 	switch (codec->core.vendor_id) {
588 	case 0x10ec0236:
589 	case 0x10ec0256:
590 	case 0x10ec0257:
591 	case 0x19e58326:
592 	case 0x10ec0283:
593 	case 0x10ec0285:
594 	case 0x10ec0286:
595 	case 0x10ec0287:
596 	case 0x10ec0288:
597 	case 0x10ec0295:
598 	case 0x10ec0298:
599 		alc_headset_mic_no_shutup(codec);
600 		break;
601 	default:
602 		if (!spec->no_shutup_pins)
603 			snd_hda_shutup_pins(codec);
604 		break;
605 	}
606 }
607 
608 /* generic shutup callback;
609  * just turning off EAPD and a little pause for avoiding pop-noise
610  */
alc_eapd_shutup(struct hda_codec * codec)611 static void alc_eapd_shutup(struct hda_codec *codec)
612 {
613 	struct alc_spec *spec = codec->spec;
614 
615 	alc_auto_setup_eapd(codec, false);
616 	if (!spec->no_depop_delay)
617 		msleep(200);
618 	alc_shutup_pins(codec);
619 }
620 
621 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)622 static void alc_auto_init_amp(struct hda_codec *codec, int type)
623 {
624 	alc_auto_setup_eapd(codec, true);
625 	alc_write_gpio(codec);
626 	switch (type) {
627 	case ALC_INIT_DEFAULT:
628 		switch (codec->core.vendor_id) {
629 		case 0x10ec0260:
630 			alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
631 			break;
632 		case 0x10ec0880:
633 		case 0x10ec0882:
634 		case 0x10ec0883:
635 		case 0x10ec0885:
636 			alc_update_coef_idx(codec, 7, 0, 0x2030);
637 			break;
638 		case 0x10ec0888:
639 			alc888_coef_init(codec);
640 			break;
641 		}
642 		break;
643 	}
644 }
645 
646 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)647 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
648 {
649 	if (spec->gen.autocfg.hp_pins[0])
650 		return spec->gen.autocfg.hp_pins[0];
651 	if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
652 		return spec->gen.autocfg.line_out_pins[0];
653 	return 0;
654 }
655 
656 /*
657  * Realtek SSID verification
658  */
659 
660 /* Could be any non-zero and even value. When used as fixup, tells
661  * the driver to ignore any present sku defines.
662  */
663 #define ALC_FIXUP_SKU_IGNORE (2)
664 
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)665 static void alc_fixup_sku_ignore(struct hda_codec *codec,
666 				 const struct hda_fixup *fix, int action)
667 {
668 	struct alc_spec *spec = codec->spec;
669 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
670 		spec->cdefine.fixup = 1;
671 		spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
672 	}
673 }
674 
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)675 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
676 				    const struct hda_fixup *fix, int action)
677 {
678 	struct alc_spec *spec = codec->spec;
679 
680 	if (action == HDA_FIXUP_ACT_PROBE) {
681 		spec->no_depop_delay = 1;
682 		codec->depop_delay = 0;
683 	}
684 }
685 
alc_auto_parse_customize_define(struct hda_codec * codec)686 static int alc_auto_parse_customize_define(struct hda_codec *codec)
687 {
688 	unsigned int ass, tmp, i;
689 	unsigned nid = 0;
690 	struct alc_spec *spec = codec->spec;
691 
692 	spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
693 
694 	if (spec->cdefine.fixup) {
695 		ass = spec->cdefine.sku_cfg;
696 		if (ass == ALC_FIXUP_SKU_IGNORE)
697 			return -1;
698 		goto do_sku;
699 	}
700 
701 	if (!codec->bus->pci)
702 		return -1;
703 	ass = codec->core.subsystem_id & 0xffff;
704 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
705 		goto do_sku;
706 
707 	nid = 0x1d;
708 	if (codec->core.vendor_id == 0x10ec0260)
709 		nid = 0x17;
710 	ass = snd_hda_codec_get_pincfg(codec, nid);
711 
712 	if (!(ass & 1)) {
713 		codec_info(codec, "%s: SKU not ready 0x%08x\n",
714 			   codec->core.chip_name, ass);
715 		return -1;
716 	}
717 
718 	/* check sum */
719 	tmp = 0;
720 	for (i = 1; i < 16; i++) {
721 		if ((ass >> i) & 1)
722 			tmp++;
723 	}
724 	if (((ass >> 16) & 0xf) != tmp)
725 		return -1;
726 
727 	spec->cdefine.port_connectivity = ass >> 30;
728 	spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
729 	spec->cdefine.check_sum = (ass >> 16) & 0xf;
730 	spec->cdefine.customization = ass >> 8;
731 do_sku:
732 	spec->cdefine.sku_cfg = ass;
733 	spec->cdefine.external_amp = (ass & 0x38) >> 3;
734 	spec->cdefine.platform_type = (ass & 0x4) >> 2;
735 	spec->cdefine.swap = (ass & 0x2) >> 1;
736 	spec->cdefine.override = ass & 0x1;
737 
738 	codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
739 		   nid, spec->cdefine.sku_cfg);
740 	codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
741 		   spec->cdefine.port_connectivity);
742 	codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
743 	codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
744 	codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
745 	codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
746 	codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
747 	codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
748 	codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
749 
750 	return 0;
751 }
752 
753 /* return the position of NID in the list, or -1 if not found */
find_idx_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)754 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
755 {
756 	int i;
757 	for (i = 0; i < nums; i++)
758 		if (list[i] == nid)
759 			return i;
760 	return -1;
761 }
762 /* return true if the given NID is found in the list */
found_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)763 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
764 {
765 	return find_idx_in_nid_list(nid, list, nums) >= 0;
766 }
767 
768 /* check subsystem ID and set up device-specific initialization;
769  * return 1 if initialized, 0 if invalid SSID
770  */
771 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
772  *	31 ~ 16 :	Manufacture ID
773  *	15 ~ 8	:	SKU ID
774  *	7  ~ 0	:	Assembly ID
775  *	port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
776  */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)777 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
778 {
779 	unsigned int ass, tmp, i;
780 	unsigned nid;
781 	struct alc_spec *spec = codec->spec;
782 
783 	if (spec->cdefine.fixup) {
784 		ass = spec->cdefine.sku_cfg;
785 		if (ass == ALC_FIXUP_SKU_IGNORE)
786 			return 0;
787 		goto do_sku;
788 	}
789 
790 	ass = codec->core.subsystem_id & 0xffff;
791 	if (codec->bus->pci &&
792 	    ass != codec->bus->pci->subsystem_device && (ass & 1))
793 		goto do_sku;
794 
795 	/* invalid SSID, check the special NID pin defcfg instead */
796 	/*
797 	 * 31~30	: port connectivity
798 	 * 29~21	: reserve
799 	 * 20		: PCBEEP input
800 	 * 19~16	: Check sum (15:1)
801 	 * 15~1		: Custom
802 	 * 0		: override
803 	*/
804 	nid = 0x1d;
805 	if (codec->core.vendor_id == 0x10ec0260)
806 		nid = 0x17;
807 	ass = snd_hda_codec_get_pincfg(codec, nid);
808 	codec_dbg(codec,
809 		  "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
810 		   ass, nid);
811 	if (!(ass & 1))
812 		return 0;
813 	if ((ass >> 30) != 1)	/* no physical connection */
814 		return 0;
815 
816 	/* check sum */
817 	tmp = 0;
818 	for (i = 1; i < 16; i++) {
819 		if ((ass >> i) & 1)
820 			tmp++;
821 	}
822 	if (((ass >> 16) & 0xf) != tmp)
823 		return 0;
824 do_sku:
825 	codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
826 		   ass & 0xffff, codec->core.vendor_id);
827 	/*
828 	 * 0 : override
829 	 * 1 :	Swap Jack
830 	 * 2 : 0 --> Desktop, 1 --> Laptop
831 	 * 3~5 : External Amplifier control
832 	 * 7~6 : Reserved
833 	*/
834 	tmp = (ass & 0x38) >> 3;	/* external Amp control */
835 	if (spec->init_amp == ALC_INIT_UNDEFINED) {
836 		switch (tmp) {
837 		case 1:
838 			alc_setup_gpio(codec, 0x01);
839 			break;
840 		case 3:
841 			alc_setup_gpio(codec, 0x02);
842 			break;
843 		case 7:
844 			alc_setup_gpio(codec, 0x04);
845 			break;
846 		case 5:
847 		default:
848 			spec->init_amp = ALC_INIT_DEFAULT;
849 			break;
850 		}
851 	}
852 
853 	/* is laptop or Desktop and enable the function "Mute internal speaker
854 	 * when the external headphone out jack is plugged"
855 	 */
856 	if (!(ass & 0x8000))
857 		return 1;
858 	/*
859 	 * 10~8 : Jack location
860 	 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
861 	 * 14~13: Resvered
862 	 * 15   : 1 --> enable the function "Mute internal speaker
863 	 *	        when the external headphone out jack is plugged"
864 	 */
865 	if (!alc_get_hp_pin(spec)) {
866 		hda_nid_t nid;
867 		tmp = (ass >> 11) & 0x3;	/* HP to chassis */
868 		nid = ports[tmp];
869 		if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
870 				      spec->gen.autocfg.line_outs))
871 			return 1;
872 		spec->gen.autocfg.hp_pins[0] = nid;
873 	}
874 	return 1;
875 }
876 
877 /* Check the validity of ALC subsystem-id
878  * ports contains an array of 4 pin NIDs for port-A, E, D and I */
alc_ssid_check(struct hda_codec * codec,const hda_nid_t * ports)879 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
880 {
881 	if (!alc_subsystem_id(codec, ports)) {
882 		struct alc_spec *spec = codec->spec;
883 		if (spec->init_amp == ALC_INIT_UNDEFINED) {
884 			codec_dbg(codec,
885 				  "realtek: Enable default setup for auto mode as fallback\n");
886 			spec->init_amp = ALC_INIT_DEFAULT;
887 		}
888 	}
889 }
890 
891 /*
892  */
893 
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)894 static void alc_fixup_inv_dmic(struct hda_codec *codec,
895 			       const struct hda_fixup *fix, int action)
896 {
897 	struct alc_spec *spec = codec->spec;
898 
899 	spec->gen.inv_dmic_split = 1;
900 }
901 
902 
alc_build_controls(struct hda_codec * codec)903 static int alc_build_controls(struct hda_codec *codec)
904 {
905 	int err;
906 
907 	err = snd_hda_gen_build_controls(codec);
908 	if (err < 0)
909 		return err;
910 
911 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
912 	return 0;
913 }
914 
915 
916 /*
917  * Common callbacks
918  */
919 
alc_pre_init(struct hda_codec * codec)920 static void alc_pre_init(struct hda_codec *codec)
921 {
922 	alc_fill_eapd_coef(codec);
923 }
924 
925 #define is_s3_resume(codec) \
926 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
927 #define is_s4_resume(codec) \
928 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
929 
alc_init(struct hda_codec * codec)930 static int alc_init(struct hda_codec *codec)
931 {
932 	struct alc_spec *spec = codec->spec;
933 
934 	/* hibernation resume needs the full chip initialization */
935 	if (is_s4_resume(codec))
936 		alc_pre_init(codec);
937 
938 	if (spec->init_hook)
939 		spec->init_hook(codec);
940 
941 	spec->gen.skip_verbs = 1; /* applied in below */
942 	snd_hda_gen_init(codec);
943 	alc_fix_pll(codec);
944 	alc_auto_init_amp(codec, spec->init_amp);
945 	snd_hda_apply_verbs(codec); /* apply verbs here after own init */
946 
947 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
948 
949 	return 0;
950 }
951 
952 #define alc_free	snd_hda_gen_free
953 
954 #ifdef CONFIG_PM
alc_shutup(struct hda_codec * codec)955 static inline void alc_shutup(struct hda_codec *codec)
956 {
957 	struct alc_spec *spec = codec->spec;
958 
959 	if (!snd_hda_get_bool_hint(codec, "shutup"))
960 		return; /* disabled explicitly by hints */
961 
962 	if (spec && spec->shutup)
963 		spec->shutup(codec);
964 	else
965 		alc_shutup_pins(codec);
966 }
967 
alc_power_eapd(struct hda_codec * codec)968 static void alc_power_eapd(struct hda_codec *codec)
969 {
970 	alc_auto_setup_eapd(codec, false);
971 }
972 
alc_suspend(struct hda_codec * codec)973 static int alc_suspend(struct hda_codec *codec)
974 {
975 	struct alc_spec *spec = codec->spec;
976 	alc_shutup(codec);
977 	if (spec && spec->power_hook)
978 		spec->power_hook(codec);
979 	return 0;
980 }
981 
alc_resume(struct hda_codec * codec)982 static int alc_resume(struct hda_codec *codec)
983 {
984 	struct alc_spec *spec = codec->spec;
985 
986 	if (!spec->no_depop_delay)
987 		msleep(150); /* to avoid pop noise */
988 	codec->patch_ops.init(codec);
989 	snd_hda_regmap_sync(codec);
990 	hda_call_check_power_status(codec, 0x01);
991 	return 0;
992 }
993 #endif
994 
995 /*
996  */
997 static const struct hda_codec_ops alc_patch_ops = {
998 	.build_controls = alc_build_controls,
999 	.build_pcms = snd_hda_gen_build_pcms,
1000 	.init = alc_init,
1001 	.free = alc_free,
1002 	.unsol_event = snd_hda_jack_unsol_event,
1003 #ifdef CONFIG_PM
1004 	.resume = alc_resume,
1005 	.suspend = alc_suspend,
1006 	.check_power_status = snd_hda_gen_check_power_status,
1007 #endif
1008 };
1009 
1010 
1011 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1012 
1013 /*
1014  * Rename codecs appropriately from COEF value or subvendor id
1015  */
1016 struct alc_codec_rename_table {
1017 	unsigned int vendor_id;
1018 	unsigned short coef_mask;
1019 	unsigned short coef_bits;
1020 	const char *name;
1021 };
1022 
1023 struct alc_codec_rename_pci_table {
1024 	unsigned int codec_vendor_id;
1025 	unsigned short pci_subvendor;
1026 	unsigned short pci_subdevice;
1027 	const char *name;
1028 };
1029 
1030 static const struct alc_codec_rename_table rename_tbl[] = {
1031 	{ 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1032 	{ 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1033 	{ 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1034 	{ 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1035 	{ 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1036 	{ 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1037 	{ 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1038 	{ 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1039 	{ 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1040 	{ 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1041 	{ 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1042 	{ 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1043 	{ 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1044 	{ 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1045 	{ 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1046 	{ 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1047 	{ 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1048 	{ } /* terminator */
1049 };
1050 
1051 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1052 	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
1053 	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
1054 	{ 0x10ec0283, 0x1028, 0, "ALC3223" },
1055 	{ 0x10ec0288, 0x1028, 0, "ALC3263" },
1056 	{ 0x10ec0292, 0x1028, 0, "ALC3226" },
1057 	{ 0x10ec0293, 0x1028, 0, "ALC3235" },
1058 	{ 0x10ec0255, 0x1028, 0, "ALC3234" },
1059 	{ 0x10ec0668, 0x1028, 0, "ALC3661" },
1060 	{ 0x10ec0275, 0x1028, 0, "ALC3260" },
1061 	{ 0x10ec0899, 0x1028, 0, "ALC3861" },
1062 	{ 0x10ec0298, 0x1028, 0, "ALC3266" },
1063 	{ 0x10ec0236, 0x1028, 0, "ALC3204" },
1064 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
1065 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
1066 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
1067 	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
1068 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
1069 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
1070 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
1071 	{ 0x10ec0233, 0x1043, 0, "ALC3236" },
1072 	{ 0x10ec0280, 0x103c, 0, "ALC3228" },
1073 	{ 0x10ec0282, 0x103c, 0, "ALC3227" },
1074 	{ 0x10ec0286, 0x103c, 0, "ALC3242" },
1075 	{ 0x10ec0290, 0x103c, 0, "ALC3241" },
1076 	{ 0x10ec0668, 0x103c, 0, "ALC3662" },
1077 	{ 0x10ec0283, 0x17aa, 0, "ALC3239" },
1078 	{ 0x10ec0292, 0x17aa, 0, "ALC3232" },
1079 	{ } /* terminator */
1080 };
1081 
alc_codec_rename_from_preset(struct hda_codec * codec)1082 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1083 {
1084 	const struct alc_codec_rename_table *p;
1085 	const struct alc_codec_rename_pci_table *q;
1086 
1087 	for (p = rename_tbl; p->vendor_id; p++) {
1088 		if (p->vendor_id != codec->core.vendor_id)
1089 			continue;
1090 		if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1091 			return alc_codec_rename(codec, p->name);
1092 	}
1093 
1094 	if (!codec->bus->pci)
1095 		return 0;
1096 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1097 		if (q->codec_vendor_id != codec->core.vendor_id)
1098 			continue;
1099 		if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1100 			continue;
1101 		if (!q->pci_subdevice ||
1102 		    q->pci_subdevice == codec->bus->pci->subsystem_device)
1103 			return alc_codec_rename(codec, q->name);
1104 	}
1105 
1106 	return 0;
1107 }
1108 
1109 
1110 /*
1111  * Digital-beep handlers
1112  */
1113 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1114 
1115 /* additional beep mixers; private_value will be overwritten */
1116 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1117 	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1118 	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1119 };
1120 
1121 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1122 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1123 			int idx, int dir)
1124 {
1125 	struct snd_kcontrol_new *knew;
1126 	unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1127 	int i;
1128 
1129 	for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1130 		knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1131 					    &alc_beep_mixer[i]);
1132 		if (!knew)
1133 			return -ENOMEM;
1134 		knew->private_value = beep_amp;
1135 	}
1136 	return 0;
1137 }
1138 
1139 static const struct snd_pci_quirk beep_allow_list[] = {
1140 	SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1141 	SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1142 	SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1143 	SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1144 	SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1145 	SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1146 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1147 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1148 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1149 	/* denylist -- no beep available */
1150 	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1151 	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1152 	{}
1153 };
1154 
has_cdefine_beep(struct hda_codec * codec)1155 static inline int has_cdefine_beep(struct hda_codec *codec)
1156 {
1157 	struct alc_spec *spec = codec->spec;
1158 	const struct snd_pci_quirk *q;
1159 	q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1160 	if (q)
1161 		return q->value;
1162 	return spec->cdefine.enable_pcbeep;
1163 }
1164 #else
1165 #define set_beep_amp(spec, nid, idx, dir)	0
1166 #define has_cdefine_beep(codec)		0
1167 #endif
1168 
1169 /* parse the BIOS configuration and set up the alc_spec */
1170 /* return 1 if successful, 0 if the proper config is not found,
1171  * or a negative error code
1172  */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1173 static int alc_parse_auto_config(struct hda_codec *codec,
1174 				 const hda_nid_t *ignore_nids,
1175 				 const hda_nid_t *ssid_nids)
1176 {
1177 	struct alc_spec *spec = codec->spec;
1178 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1179 	int err;
1180 
1181 	err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1182 				       spec->parse_flags);
1183 	if (err < 0)
1184 		return err;
1185 
1186 	if (ssid_nids)
1187 		alc_ssid_check(codec, ssid_nids);
1188 
1189 	err = snd_hda_gen_parse_auto_config(codec, cfg);
1190 	if (err < 0)
1191 		return err;
1192 
1193 	return 1;
1194 }
1195 
1196 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1197 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1198 {
1199 	struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1200 	int err;
1201 
1202 	if (!spec)
1203 		return -ENOMEM;
1204 	codec->spec = spec;
1205 	snd_hda_gen_spec_init(&spec->gen);
1206 	spec->gen.mixer_nid = mixer_nid;
1207 	spec->gen.own_eapd_ctl = 1;
1208 	codec->single_adc_amp = 1;
1209 	/* FIXME: do we need this for all Realtek codec models? */
1210 	codec->spdif_status_reset = 1;
1211 	codec->forced_resume = 1;
1212 	codec->patch_ops = alc_patch_ops;
1213 	mutex_init(&spec->coef_mutex);
1214 
1215 	err = alc_codec_rename_from_preset(codec);
1216 	if (err < 0) {
1217 		kfree(spec);
1218 		return err;
1219 	}
1220 	return 0;
1221 }
1222 
alc880_parse_auto_config(struct hda_codec * codec)1223 static int alc880_parse_auto_config(struct hda_codec *codec)
1224 {
1225 	static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1226 	static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1227 	return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1228 }
1229 
1230 /*
1231  * ALC880 fix-ups
1232  */
1233 enum {
1234 	ALC880_FIXUP_GPIO1,
1235 	ALC880_FIXUP_GPIO2,
1236 	ALC880_FIXUP_MEDION_RIM,
1237 	ALC880_FIXUP_LG,
1238 	ALC880_FIXUP_LG_LW25,
1239 	ALC880_FIXUP_W810,
1240 	ALC880_FIXUP_EAPD_COEF,
1241 	ALC880_FIXUP_TCL_S700,
1242 	ALC880_FIXUP_VOL_KNOB,
1243 	ALC880_FIXUP_FUJITSU,
1244 	ALC880_FIXUP_F1734,
1245 	ALC880_FIXUP_UNIWILL,
1246 	ALC880_FIXUP_UNIWILL_DIG,
1247 	ALC880_FIXUP_Z71V,
1248 	ALC880_FIXUP_ASUS_W5A,
1249 	ALC880_FIXUP_3ST_BASE,
1250 	ALC880_FIXUP_3ST,
1251 	ALC880_FIXUP_3ST_DIG,
1252 	ALC880_FIXUP_5ST_BASE,
1253 	ALC880_FIXUP_5ST,
1254 	ALC880_FIXUP_5ST_DIG,
1255 	ALC880_FIXUP_6ST_BASE,
1256 	ALC880_FIXUP_6ST,
1257 	ALC880_FIXUP_6ST_DIG,
1258 	ALC880_FIXUP_6ST_AUTOMUTE,
1259 };
1260 
1261 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1262 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1263 				  const struct hda_fixup *fix, int action)
1264 {
1265 	if (action == HDA_FIXUP_ACT_PROBE)
1266 		snd_hda_jack_detect_enable_callback(codec, 0x21,
1267 						    alc_update_knob_master);
1268 }
1269 
1270 static const struct hda_fixup alc880_fixups[] = {
1271 	[ALC880_FIXUP_GPIO1] = {
1272 		.type = HDA_FIXUP_FUNC,
1273 		.v.func = alc_fixup_gpio1,
1274 	},
1275 	[ALC880_FIXUP_GPIO2] = {
1276 		.type = HDA_FIXUP_FUNC,
1277 		.v.func = alc_fixup_gpio2,
1278 	},
1279 	[ALC880_FIXUP_MEDION_RIM] = {
1280 		.type = HDA_FIXUP_VERBS,
1281 		.v.verbs = (const struct hda_verb[]) {
1282 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1283 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1284 			{ }
1285 		},
1286 		.chained = true,
1287 		.chain_id = ALC880_FIXUP_GPIO2,
1288 	},
1289 	[ALC880_FIXUP_LG] = {
1290 		.type = HDA_FIXUP_PINS,
1291 		.v.pins = (const struct hda_pintbl[]) {
1292 			/* disable bogus unused pins */
1293 			{ 0x16, 0x411111f0 },
1294 			{ 0x18, 0x411111f0 },
1295 			{ 0x1a, 0x411111f0 },
1296 			{ }
1297 		}
1298 	},
1299 	[ALC880_FIXUP_LG_LW25] = {
1300 		.type = HDA_FIXUP_PINS,
1301 		.v.pins = (const struct hda_pintbl[]) {
1302 			{ 0x1a, 0x0181344f }, /* line-in */
1303 			{ 0x1b, 0x0321403f }, /* headphone */
1304 			{ }
1305 		}
1306 	},
1307 	[ALC880_FIXUP_W810] = {
1308 		.type = HDA_FIXUP_PINS,
1309 		.v.pins = (const struct hda_pintbl[]) {
1310 			/* disable bogus unused pins */
1311 			{ 0x17, 0x411111f0 },
1312 			{ }
1313 		},
1314 		.chained = true,
1315 		.chain_id = ALC880_FIXUP_GPIO2,
1316 	},
1317 	[ALC880_FIXUP_EAPD_COEF] = {
1318 		.type = HDA_FIXUP_VERBS,
1319 		.v.verbs = (const struct hda_verb[]) {
1320 			/* change to EAPD mode */
1321 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1322 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1323 			{}
1324 		},
1325 	},
1326 	[ALC880_FIXUP_TCL_S700] = {
1327 		.type = HDA_FIXUP_VERBS,
1328 		.v.verbs = (const struct hda_verb[]) {
1329 			/* change to EAPD mode */
1330 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1331 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3070 },
1332 			{}
1333 		},
1334 		.chained = true,
1335 		.chain_id = ALC880_FIXUP_GPIO2,
1336 	},
1337 	[ALC880_FIXUP_VOL_KNOB] = {
1338 		.type = HDA_FIXUP_FUNC,
1339 		.v.func = alc880_fixup_vol_knob,
1340 	},
1341 	[ALC880_FIXUP_FUJITSU] = {
1342 		/* override all pins as BIOS on old Amilo is broken */
1343 		.type = HDA_FIXUP_PINS,
1344 		.v.pins = (const struct hda_pintbl[]) {
1345 			{ 0x14, 0x0121401f }, /* HP */
1346 			{ 0x15, 0x99030120 }, /* speaker */
1347 			{ 0x16, 0x99030130 }, /* bass speaker */
1348 			{ 0x17, 0x411111f0 }, /* N/A */
1349 			{ 0x18, 0x411111f0 }, /* N/A */
1350 			{ 0x19, 0x01a19950 }, /* mic-in */
1351 			{ 0x1a, 0x411111f0 }, /* N/A */
1352 			{ 0x1b, 0x411111f0 }, /* N/A */
1353 			{ 0x1c, 0x411111f0 }, /* N/A */
1354 			{ 0x1d, 0x411111f0 }, /* N/A */
1355 			{ 0x1e, 0x01454140 }, /* SPDIF out */
1356 			{ }
1357 		},
1358 		.chained = true,
1359 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1360 	},
1361 	[ALC880_FIXUP_F1734] = {
1362 		/* almost compatible with FUJITSU, but no bass and SPDIF */
1363 		.type = HDA_FIXUP_PINS,
1364 		.v.pins = (const struct hda_pintbl[]) {
1365 			{ 0x14, 0x0121401f }, /* HP */
1366 			{ 0x15, 0x99030120 }, /* speaker */
1367 			{ 0x16, 0x411111f0 }, /* N/A */
1368 			{ 0x17, 0x411111f0 }, /* N/A */
1369 			{ 0x18, 0x411111f0 }, /* N/A */
1370 			{ 0x19, 0x01a19950 }, /* mic-in */
1371 			{ 0x1a, 0x411111f0 }, /* N/A */
1372 			{ 0x1b, 0x411111f0 }, /* N/A */
1373 			{ 0x1c, 0x411111f0 }, /* N/A */
1374 			{ 0x1d, 0x411111f0 }, /* N/A */
1375 			{ 0x1e, 0x411111f0 }, /* N/A */
1376 			{ }
1377 		},
1378 		.chained = true,
1379 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1380 	},
1381 	[ALC880_FIXUP_UNIWILL] = {
1382 		/* need to fix HP and speaker pins to be parsed correctly */
1383 		.type = HDA_FIXUP_PINS,
1384 		.v.pins = (const struct hda_pintbl[]) {
1385 			{ 0x14, 0x0121411f }, /* HP */
1386 			{ 0x15, 0x99030120 }, /* speaker */
1387 			{ 0x16, 0x99030130 }, /* bass speaker */
1388 			{ }
1389 		},
1390 	},
1391 	[ALC880_FIXUP_UNIWILL_DIG] = {
1392 		.type = HDA_FIXUP_PINS,
1393 		.v.pins = (const struct hda_pintbl[]) {
1394 			/* disable bogus unused pins */
1395 			{ 0x17, 0x411111f0 },
1396 			{ 0x19, 0x411111f0 },
1397 			{ 0x1b, 0x411111f0 },
1398 			{ 0x1f, 0x411111f0 },
1399 			{ }
1400 		}
1401 	},
1402 	[ALC880_FIXUP_Z71V] = {
1403 		.type = HDA_FIXUP_PINS,
1404 		.v.pins = (const struct hda_pintbl[]) {
1405 			/* set up the whole pins as BIOS is utterly broken */
1406 			{ 0x14, 0x99030120 }, /* speaker */
1407 			{ 0x15, 0x0121411f }, /* HP */
1408 			{ 0x16, 0x411111f0 }, /* N/A */
1409 			{ 0x17, 0x411111f0 }, /* N/A */
1410 			{ 0x18, 0x01a19950 }, /* mic-in */
1411 			{ 0x19, 0x411111f0 }, /* N/A */
1412 			{ 0x1a, 0x01813031 }, /* line-in */
1413 			{ 0x1b, 0x411111f0 }, /* N/A */
1414 			{ 0x1c, 0x411111f0 }, /* N/A */
1415 			{ 0x1d, 0x411111f0 }, /* N/A */
1416 			{ 0x1e, 0x0144111e }, /* SPDIF */
1417 			{ }
1418 		}
1419 	},
1420 	[ALC880_FIXUP_ASUS_W5A] = {
1421 		.type = HDA_FIXUP_PINS,
1422 		.v.pins = (const struct hda_pintbl[]) {
1423 			/* set up the whole pins as BIOS is utterly broken */
1424 			{ 0x14, 0x0121411f }, /* HP */
1425 			{ 0x15, 0x411111f0 }, /* N/A */
1426 			{ 0x16, 0x411111f0 }, /* N/A */
1427 			{ 0x17, 0x411111f0 }, /* N/A */
1428 			{ 0x18, 0x90a60160 }, /* mic */
1429 			{ 0x19, 0x411111f0 }, /* N/A */
1430 			{ 0x1a, 0x411111f0 }, /* N/A */
1431 			{ 0x1b, 0x411111f0 }, /* N/A */
1432 			{ 0x1c, 0x411111f0 }, /* N/A */
1433 			{ 0x1d, 0x411111f0 }, /* N/A */
1434 			{ 0x1e, 0xb743111e }, /* SPDIF out */
1435 			{ }
1436 		},
1437 		.chained = true,
1438 		.chain_id = ALC880_FIXUP_GPIO1,
1439 	},
1440 	[ALC880_FIXUP_3ST_BASE] = {
1441 		.type = HDA_FIXUP_PINS,
1442 		.v.pins = (const struct hda_pintbl[]) {
1443 			{ 0x14, 0x01014010 }, /* line-out */
1444 			{ 0x15, 0x411111f0 }, /* N/A */
1445 			{ 0x16, 0x411111f0 }, /* N/A */
1446 			{ 0x17, 0x411111f0 }, /* N/A */
1447 			{ 0x18, 0x01a19c30 }, /* mic-in */
1448 			{ 0x19, 0x0121411f }, /* HP */
1449 			{ 0x1a, 0x01813031 }, /* line-in */
1450 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1451 			{ 0x1c, 0x411111f0 }, /* N/A */
1452 			{ 0x1d, 0x411111f0 }, /* N/A */
1453 			/* 0x1e is filled in below */
1454 			{ 0x1f, 0x411111f0 }, /* N/A */
1455 			{ }
1456 		}
1457 	},
1458 	[ALC880_FIXUP_3ST] = {
1459 		.type = HDA_FIXUP_PINS,
1460 		.v.pins = (const struct hda_pintbl[]) {
1461 			{ 0x1e, 0x411111f0 }, /* N/A */
1462 			{ }
1463 		},
1464 		.chained = true,
1465 		.chain_id = ALC880_FIXUP_3ST_BASE,
1466 	},
1467 	[ALC880_FIXUP_3ST_DIG] = {
1468 		.type = HDA_FIXUP_PINS,
1469 		.v.pins = (const struct hda_pintbl[]) {
1470 			{ 0x1e, 0x0144111e }, /* SPDIF */
1471 			{ }
1472 		},
1473 		.chained = true,
1474 		.chain_id = ALC880_FIXUP_3ST_BASE,
1475 	},
1476 	[ALC880_FIXUP_5ST_BASE] = {
1477 		.type = HDA_FIXUP_PINS,
1478 		.v.pins = (const struct hda_pintbl[]) {
1479 			{ 0x14, 0x01014010 }, /* front */
1480 			{ 0x15, 0x411111f0 }, /* N/A */
1481 			{ 0x16, 0x01011411 }, /* CLFE */
1482 			{ 0x17, 0x01016412 }, /* surr */
1483 			{ 0x18, 0x01a19c30 }, /* mic-in */
1484 			{ 0x19, 0x0121411f }, /* HP */
1485 			{ 0x1a, 0x01813031 }, /* line-in */
1486 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1487 			{ 0x1c, 0x411111f0 }, /* N/A */
1488 			{ 0x1d, 0x411111f0 }, /* N/A */
1489 			/* 0x1e is filled in below */
1490 			{ 0x1f, 0x411111f0 }, /* N/A */
1491 			{ }
1492 		}
1493 	},
1494 	[ALC880_FIXUP_5ST] = {
1495 		.type = HDA_FIXUP_PINS,
1496 		.v.pins = (const struct hda_pintbl[]) {
1497 			{ 0x1e, 0x411111f0 }, /* N/A */
1498 			{ }
1499 		},
1500 		.chained = true,
1501 		.chain_id = ALC880_FIXUP_5ST_BASE,
1502 	},
1503 	[ALC880_FIXUP_5ST_DIG] = {
1504 		.type = HDA_FIXUP_PINS,
1505 		.v.pins = (const struct hda_pintbl[]) {
1506 			{ 0x1e, 0x0144111e }, /* SPDIF */
1507 			{ }
1508 		},
1509 		.chained = true,
1510 		.chain_id = ALC880_FIXUP_5ST_BASE,
1511 	},
1512 	[ALC880_FIXUP_6ST_BASE] = {
1513 		.type = HDA_FIXUP_PINS,
1514 		.v.pins = (const struct hda_pintbl[]) {
1515 			{ 0x14, 0x01014010 }, /* front */
1516 			{ 0x15, 0x01016412 }, /* surr */
1517 			{ 0x16, 0x01011411 }, /* CLFE */
1518 			{ 0x17, 0x01012414 }, /* side */
1519 			{ 0x18, 0x01a19c30 }, /* mic-in */
1520 			{ 0x19, 0x02a19c40 }, /* front-mic */
1521 			{ 0x1a, 0x01813031 }, /* line-in */
1522 			{ 0x1b, 0x0121411f }, /* HP */
1523 			{ 0x1c, 0x411111f0 }, /* N/A */
1524 			{ 0x1d, 0x411111f0 }, /* N/A */
1525 			/* 0x1e is filled in below */
1526 			{ 0x1f, 0x411111f0 }, /* N/A */
1527 			{ }
1528 		}
1529 	},
1530 	[ALC880_FIXUP_6ST] = {
1531 		.type = HDA_FIXUP_PINS,
1532 		.v.pins = (const struct hda_pintbl[]) {
1533 			{ 0x1e, 0x411111f0 }, /* N/A */
1534 			{ }
1535 		},
1536 		.chained = true,
1537 		.chain_id = ALC880_FIXUP_6ST_BASE,
1538 	},
1539 	[ALC880_FIXUP_6ST_DIG] = {
1540 		.type = HDA_FIXUP_PINS,
1541 		.v.pins = (const struct hda_pintbl[]) {
1542 			{ 0x1e, 0x0144111e }, /* SPDIF */
1543 			{ }
1544 		},
1545 		.chained = true,
1546 		.chain_id = ALC880_FIXUP_6ST_BASE,
1547 	},
1548 	[ALC880_FIXUP_6ST_AUTOMUTE] = {
1549 		.type = HDA_FIXUP_PINS,
1550 		.v.pins = (const struct hda_pintbl[]) {
1551 			{ 0x1b, 0x0121401f }, /* HP with jack detect */
1552 			{ }
1553 		},
1554 		.chained_before = true,
1555 		.chain_id = ALC880_FIXUP_6ST_BASE,
1556 	},
1557 };
1558 
1559 static const struct hda_quirk alc880_fixup_tbl[] = {
1560 	SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1561 	SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1562 	SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1563 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1564 	SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1565 	SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1566 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1567 	SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1568 	SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1569 	SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1570 	SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1571 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1572 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1573 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1574 	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1575 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1576 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1577 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1578 	SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1579 	SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1580 	SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1581 	SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1582 	SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1583 
1584 	/* Below is the copied entries from alc880_quirks.c.
1585 	 * It's not quite sure whether BIOS sets the correct pin-config table
1586 	 * on these machines, thus they are kept to be compatible with
1587 	 * the old static quirks.  Once when it's confirmed to work without
1588 	 * these overrides, it'd be better to remove.
1589 	 */
1590 	SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1591 	SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1592 	SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1593 	SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1594 	SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1595 	SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1596 	SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1597 	SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1598 	SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1599 	SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1600 	SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1601 	SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1602 	SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1603 	SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1604 	SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1605 	SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1606 	SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1607 	SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1608 	SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1609 	SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1610 	SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1611 	SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1612 	SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1613 	SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1614 	SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1615 	SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1616 	SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1617 	SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1618 	SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1619 	SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1620 	SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1621 	SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1622 	SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1623 	/* default Intel */
1624 	SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1625 	SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1626 	SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1627 	{}
1628 };
1629 
1630 static const struct hda_model_fixup alc880_fixup_models[] = {
1631 	{.id = ALC880_FIXUP_3ST, .name = "3stack"},
1632 	{.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1633 	{.id = ALC880_FIXUP_5ST, .name = "5stack"},
1634 	{.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1635 	{.id = ALC880_FIXUP_6ST, .name = "6stack"},
1636 	{.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1637 	{.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1638 	{}
1639 };
1640 
1641 
1642 /*
1643  * OK, here we have finally the patch for ALC880
1644  */
patch_alc880(struct hda_codec * codec)1645 static int patch_alc880(struct hda_codec *codec)
1646 {
1647 	struct alc_spec *spec;
1648 	int err;
1649 
1650 	err = alc_alloc_spec(codec, 0x0b);
1651 	if (err < 0)
1652 		return err;
1653 
1654 	spec = codec->spec;
1655 	spec->gen.need_dac_fix = 1;
1656 	spec->gen.beep_nid = 0x01;
1657 
1658 	codec->patch_ops.unsol_event = alc880_unsol_event;
1659 
1660 	alc_pre_init(codec);
1661 
1662 	snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1663 		       alc880_fixups);
1664 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1665 
1666 	/* automatic parse from the BIOS config */
1667 	err = alc880_parse_auto_config(codec);
1668 	if (err < 0)
1669 		goto error;
1670 
1671 	if (!spec->gen.no_analog) {
1672 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1673 		if (err < 0)
1674 			goto error;
1675 	}
1676 
1677 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1678 
1679 	return 0;
1680 
1681  error:
1682 	alc_free(codec);
1683 	return err;
1684 }
1685 
1686 
1687 /*
1688  * ALC260 support
1689  */
alc260_parse_auto_config(struct hda_codec * codec)1690 static int alc260_parse_auto_config(struct hda_codec *codec)
1691 {
1692 	static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1693 	static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1694 	return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1695 }
1696 
1697 /*
1698  * Pin config fixes
1699  */
1700 enum {
1701 	ALC260_FIXUP_HP_DC5750,
1702 	ALC260_FIXUP_HP_PIN_0F,
1703 	ALC260_FIXUP_COEF,
1704 	ALC260_FIXUP_GPIO1,
1705 	ALC260_FIXUP_GPIO1_TOGGLE,
1706 	ALC260_FIXUP_REPLACER,
1707 	ALC260_FIXUP_HP_B1900,
1708 	ALC260_FIXUP_KN1,
1709 	ALC260_FIXUP_FSC_S7020,
1710 	ALC260_FIXUP_FSC_S7020_JWSE,
1711 	ALC260_FIXUP_VAIO_PINS,
1712 };
1713 
alc260_gpio1_automute(struct hda_codec * codec)1714 static void alc260_gpio1_automute(struct hda_codec *codec)
1715 {
1716 	struct alc_spec *spec = codec->spec;
1717 
1718 	alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1719 }
1720 
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1721 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1722 				      const struct hda_fixup *fix, int action)
1723 {
1724 	struct alc_spec *spec = codec->spec;
1725 	if (action == HDA_FIXUP_ACT_PROBE) {
1726 		/* although the machine has only one output pin, we need to
1727 		 * toggle GPIO1 according to the jack state
1728 		 */
1729 		spec->gen.automute_hook = alc260_gpio1_automute;
1730 		spec->gen.detect_hp = 1;
1731 		spec->gen.automute_speaker = 1;
1732 		spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1733 		snd_hda_jack_detect_enable_callback(codec, 0x0f,
1734 						    snd_hda_gen_hp_automute);
1735 		alc_setup_gpio(codec, 0x01);
1736 	}
1737 }
1738 
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1739 static void alc260_fixup_kn1(struct hda_codec *codec,
1740 			     const struct hda_fixup *fix, int action)
1741 {
1742 	struct alc_spec *spec = codec->spec;
1743 	static const struct hda_pintbl pincfgs[] = {
1744 		{ 0x0f, 0x02214000 }, /* HP/speaker */
1745 		{ 0x12, 0x90a60160 }, /* int mic */
1746 		{ 0x13, 0x02a19000 }, /* ext mic */
1747 		{ 0x18, 0x01446000 }, /* SPDIF out */
1748 		/* disable bogus I/O pins */
1749 		{ 0x10, 0x411111f0 },
1750 		{ 0x11, 0x411111f0 },
1751 		{ 0x14, 0x411111f0 },
1752 		{ 0x15, 0x411111f0 },
1753 		{ 0x16, 0x411111f0 },
1754 		{ 0x17, 0x411111f0 },
1755 		{ 0x19, 0x411111f0 },
1756 		{ }
1757 	};
1758 
1759 	switch (action) {
1760 	case HDA_FIXUP_ACT_PRE_PROBE:
1761 		snd_hda_apply_pincfgs(codec, pincfgs);
1762 		spec->init_amp = ALC_INIT_NONE;
1763 		break;
1764 	}
1765 }
1766 
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1767 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1768 				   const struct hda_fixup *fix, int action)
1769 {
1770 	struct alc_spec *spec = codec->spec;
1771 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
1772 		spec->init_amp = ALC_INIT_NONE;
1773 }
1774 
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1775 static void alc260_fixup_fsc_s7020_jwse(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->gen.add_jack_modes = 1;
1781 		spec->gen.hp_mic = 1;
1782 	}
1783 }
1784 
1785 static const struct hda_fixup alc260_fixups[] = {
1786 	[ALC260_FIXUP_HP_DC5750] = {
1787 		.type = HDA_FIXUP_PINS,
1788 		.v.pins = (const struct hda_pintbl[]) {
1789 			{ 0x11, 0x90130110 }, /* speaker */
1790 			{ }
1791 		}
1792 	},
1793 	[ALC260_FIXUP_HP_PIN_0F] = {
1794 		.type = HDA_FIXUP_PINS,
1795 		.v.pins = (const struct hda_pintbl[]) {
1796 			{ 0x0f, 0x01214000 }, /* HP */
1797 			{ }
1798 		}
1799 	},
1800 	[ALC260_FIXUP_COEF] = {
1801 		.type = HDA_FIXUP_VERBS,
1802 		.v.verbs = (const struct hda_verb[]) {
1803 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1804 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3040 },
1805 			{ }
1806 		},
1807 	},
1808 	[ALC260_FIXUP_GPIO1] = {
1809 		.type = HDA_FIXUP_FUNC,
1810 		.v.func = alc_fixup_gpio1,
1811 	},
1812 	[ALC260_FIXUP_GPIO1_TOGGLE] = {
1813 		.type = HDA_FIXUP_FUNC,
1814 		.v.func = alc260_fixup_gpio1_toggle,
1815 		.chained = true,
1816 		.chain_id = ALC260_FIXUP_HP_PIN_0F,
1817 	},
1818 	[ALC260_FIXUP_REPLACER] = {
1819 		.type = HDA_FIXUP_VERBS,
1820 		.v.verbs = (const struct hda_verb[]) {
1821 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1822 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3050 },
1823 			{ }
1824 		},
1825 		.chained = true,
1826 		.chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1827 	},
1828 	[ALC260_FIXUP_HP_B1900] = {
1829 		.type = HDA_FIXUP_FUNC,
1830 		.v.func = alc260_fixup_gpio1_toggle,
1831 		.chained = true,
1832 		.chain_id = ALC260_FIXUP_COEF,
1833 	},
1834 	[ALC260_FIXUP_KN1] = {
1835 		.type = HDA_FIXUP_FUNC,
1836 		.v.func = alc260_fixup_kn1,
1837 	},
1838 	[ALC260_FIXUP_FSC_S7020] = {
1839 		.type = HDA_FIXUP_FUNC,
1840 		.v.func = alc260_fixup_fsc_s7020,
1841 	},
1842 	[ALC260_FIXUP_FSC_S7020_JWSE] = {
1843 		.type = HDA_FIXUP_FUNC,
1844 		.v.func = alc260_fixup_fsc_s7020_jwse,
1845 		.chained = true,
1846 		.chain_id = ALC260_FIXUP_FSC_S7020,
1847 	},
1848 	[ALC260_FIXUP_VAIO_PINS] = {
1849 		.type = HDA_FIXUP_PINS,
1850 		.v.pins = (const struct hda_pintbl[]) {
1851 			/* Pin configs are missing completely on some VAIOs */
1852 			{ 0x0f, 0x01211020 },
1853 			{ 0x10, 0x0001003f },
1854 			{ 0x11, 0x411111f0 },
1855 			{ 0x12, 0x01a15930 },
1856 			{ 0x13, 0x411111f0 },
1857 			{ 0x14, 0x411111f0 },
1858 			{ 0x15, 0x411111f0 },
1859 			{ 0x16, 0x411111f0 },
1860 			{ 0x17, 0x411111f0 },
1861 			{ 0x18, 0x411111f0 },
1862 			{ 0x19, 0x411111f0 },
1863 			{ }
1864 		}
1865 	},
1866 };
1867 
1868 static const struct hda_quirk alc260_fixup_tbl[] = {
1869 	SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1870 	SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1871 	SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1872 	SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1873 	SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1874 	SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1875 	SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1876 	SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1877 	SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1878 	SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1879 	SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1880 	SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1881 	{}
1882 };
1883 
1884 static const struct hda_model_fixup alc260_fixup_models[] = {
1885 	{.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1886 	{.id = ALC260_FIXUP_COEF, .name = "coef"},
1887 	{.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1888 	{.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1889 	{}
1890 };
1891 
1892 /*
1893  */
patch_alc260(struct hda_codec * codec)1894 static int patch_alc260(struct hda_codec *codec)
1895 {
1896 	struct alc_spec *spec;
1897 	int err;
1898 
1899 	err = alc_alloc_spec(codec, 0x07);
1900 	if (err < 0)
1901 		return err;
1902 
1903 	spec = codec->spec;
1904 	/* as quite a few machines require HP amp for speaker outputs,
1905 	 * it's easier to enable it unconditionally; even if it's unneeded,
1906 	 * it's almost harmless.
1907 	 */
1908 	spec->gen.prefer_hp_amp = 1;
1909 	spec->gen.beep_nid = 0x01;
1910 
1911 	spec->shutup = alc_eapd_shutup;
1912 
1913 	alc_pre_init(codec);
1914 
1915 	snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1916 			   alc260_fixups);
1917 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1918 
1919 	/* automatic parse from the BIOS config */
1920 	err = alc260_parse_auto_config(codec);
1921 	if (err < 0)
1922 		goto error;
1923 
1924 	if (!spec->gen.no_analog) {
1925 		err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1926 		if (err < 0)
1927 			goto error;
1928 	}
1929 
1930 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1931 
1932 	return 0;
1933 
1934  error:
1935 	alc_free(codec);
1936 	return err;
1937 }
1938 
1939 
1940 /*
1941  * ALC882/883/885/888/889 support
1942  *
1943  * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1944  * configuration.  Each pin widget can choose any input DACs and a mixer.
1945  * Each ADC is connected from a mixer of all inputs.  This makes possible
1946  * 6-channel independent captures.
1947  *
1948  * In addition, an independent DAC for the multi-playback (not used in this
1949  * driver yet).
1950  */
1951 
1952 /*
1953  * Pin config fixes
1954  */
1955 enum {
1956 	ALC882_FIXUP_ABIT_AW9D_MAX,
1957 	ALC882_FIXUP_LENOVO_Y530,
1958 	ALC882_FIXUP_PB_M5210,
1959 	ALC882_FIXUP_ACER_ASPIRE_7736,
1960 	ALC882_FIXUP_ASUS_W90V,
1961 	ALC889_FIXUP_CD,
1962 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1963 	ALC889_FIXUP_VAIO_TT,
1964 	ALC888_FIXUP_EEE1601,
1965 	ALC886_FIXUP_EAPD,
1966 	ALC882_FIXUP_EAPD,
1967 	ALC883_FIXUP_EAPD,
1968 	ALC883_FIXUP_ACER_EAPD,
1969 	ALC882_FIXUP_GPIO1,
1970 	ALC882_FIXUP_GPIO2,
1971 	ALC882_FIXUP_GPIO3,
1972 	ALC889_FIXUP_COEF,
1973 	ALC882_FIXUP_ASUS_W2JC,
1974 	ALC882_FIXUP_ACER_ASPIRE_4930G,
1975 	ALC882_FIXUP_ACER_ASPIRE_8930G,
1976 	ALC882_FIXUP_ASPIRE_8930G_VERBS,
1977 	ALC885_FIXUP_MACPRO_GPIO,
1978 	ALC889_FIXUP_DAC_ROUTE,
1979 	ALC889_FIXUP_MBP_VREF,
1980 	ALC889_FIXUP_IMAC91_VREF,
1981 	ALC889_FIXUP_MBA11_VREF,
1982 	ALC889_FIXUP_MBA21_VREF,
1983 	ALC889_FIXUP_MP11_VREF,
1984 	ALC889_FIXUP_MP41_VREF,
1985 	ALC882_FIXUP_INV_DMIC,
1986 	ALC882_FIXUP_NO_PRIMARY_HP,
1987 	ALC887_FIXUP_ASUS_BASS,
1988 	ALC887_FIXUP_BASS_CHMAP,
1989 	ALC1220_FIXUP_GB_DUAL_CODECS,
1990 	ALC1220_FIXUP_GB_X570,
1991 	ALC1220_FIXUP_CLEVO_P950,
1992 	ALC1220_FIXUP_CLEVO_PB51ED,
1993 	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1994 	ALC887_FIXUP_ASUS_AUDIO,
1995 	ALC887_FIXUP_ASUS_HMIC,
1996 	ALCS1200A_FIXUP_MIC_VREF,
1997 	ALC888VD_FIXUP_MIC_100VREF,
1998 };
1999 
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)2000 static void alc889_fixup_coef(struct hda_codec *codec,
2001 			      const struct hda_fixup *fix, int action)
2002 {
2003 	if (action != HDA_FIXUP_ACT_INIT)
2004 		return;
2005 	alc_update_coef_idx(codec, 7, 0, 0x2030);
2006 }
2007 
2008 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2009 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2010 				     const struct hda_fixup *fix, int action)
2011 {
2012 	struct alc_spec *spec = codec->spec;
2013 
2014 	spec->gpio_write_delay = true;
2015 	alc_fixup_gpio3(codec, fix, action);
2016 }
2017 
2018 /* Fix the connection of some pins for ALC889:
2019  * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2020  * work correctly (bko#42740)
2021  */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2022 static void alc889_fixup_dac_route(struct hda_codec *codec,
2023 				   const struct hda_fixup *fix, int action)
2024 {
2025 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2026 		/* fake the connections during parsing the tree */
2027 		static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2028 		static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2029 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2030 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2031 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2032 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2033 	} else if (action == HDA_FIXUP_ACT_PROBE) {
2034 		/* restore the connections */
2035 		static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2036 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2037 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2038 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2039 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2040 	}
2041 }
2042 
2043 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2044 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2045 				  const struct hda_fixup *fix, int action)
2046 {
2047 	static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2048 	struct alc_spec *spec = codec->spec;
2049 	int i;
2050 
2051 	if (action != HDA_FIXUP_ACT_INIT)
2052 		return;
2053 	for (i = 0; i < ARRAY_SIZE(nids); i++) {
2054 		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2055 		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2056 			continue;
2057 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2058 		val |= AC_PINCTL_VREF_80;
2059 		snd_hda_set_pin_ctl(codec, nids[i], val);
2060 		spec->gen.keep_vref_in_automute = 1;
2061 		break;
2062 	}
2063 }
2064 
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2065 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2066 				  const hda_nid_t *nids, int num_nids)
2067 {
2068 	struct alc_spec *spec = codec->spec;
2069 	int i;
2070 
2071 	for (i = 0; i < num_nids; i++) {
2072 		unsigned int val;
2073 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2074 		val |= AC_PINCTL_VREF_50;
2075 		snd_hda_set_pin_ctl(codec, nids[i], val);
2076 	}
2077 	spec->gen.keep_vref_in_automute = 1;
2078 }
2079 
2080 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2081 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2082 				     const struct hda_fixup *fix, int action)
2083 {
2084 	static const hda_nid_t nids[] = { 0x18, 0x1a };
2085 
2086 	if (action == HDA_FIXUP_ACT_INIT)
2087 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2088 }
2089 
2090 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2091 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2092 				    const struct hda_fixup *fix, int action)
2093 {
2094 	static const hda_nid_t nids[] = { 0x18 };
2095 
2096 	if (action == HDA_FIXUP_ACT_INIT)
2097 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2098 }
2099 
2100 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2101 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2102 				    const struct hda_fixup *fix, int action)
2103 {
2104 	static const hda_nid_t nids[] = { 0x18, 0x19 };
2105 
2106 	if (action == HDA_FIXUP_ACT_INIT)
2107 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2108 }
2109 
2110 /* Don't take HP output as primary
2111  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2112  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2113  */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2114 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2115 				       const struct hda_fixup *fix, int action)
2116 {
2117 	struct alc_spec *spec = codec->spec;
2118 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2119 		spec->gen.no_primary_hp = 1;
2120 		spec->gen.no_multi_io = 1;
2121 	}
2122 }
2123 
2124 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2125 				 const struct hda_fixup *fix, int action);
2126 
2127 /* For dual-codec configuration, we need to disable some features to avoid
2128  * conflicts of kctls and PCM streams
2129  */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2130 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2131 				  const struct hda_fixup *fix, int action)
2132 {
2133 	struct alc_spec *spec = codec->spec;
2134 
2135 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2136 		return;
2137 	/* disable vmaster */
2138 	spec->gen.suppress_vmaster = 1;
2139 	/* auto-mute and auto-mic switch don't work with multiple codecs */
2140 	spec->gen.suppress_auto_mute = 1;
2141 	spec->gen.suppress_auto_mic = 1;
2142 	/* disable aamix as well */
2143 	spec->gen.mixer_nid = 0;
2144 	/* add location prefix to avoid conflicts */
2145 	codec->force_pin_prefix = 1;
2146 }
2147 
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2148 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2149 		       const char *newname)
2150 {
2151 	struct snd_kcontrol *kctl;
2152 
2153 	kctl = snd_hda_find_mixer_ctl(codec, oldname);
2154 	if (kctl)
2155 		snd_ctl_rename(codec->card, kctl, newname);
2156 }
2157 
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2158 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2159 					 const struct hda_fixup *fix,
2160 					 int action)
2161 {
2162 	alc_fixup_dual_codecs(codec, fix, action);
2163 	switch (action) {
2164 	case HDA_FIXUP_ACT_PRE_PROBE:
2165 		/* override card longname to provide a unique UCM profile */
2166 		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2167 		break;
2168 	case HDA_FIXUP_ACT_BUILD:
2169 		/* rename Capture controls depending on the codec */
2170 		rename_ctl(codec, "Capture Volume",
2171 			   codec->addr == 0 ?
2172 			   "Rear-Panel Capture Volume" :
2173 			   "Front-Panel Capture Volume");
2174 		rename_ctl(codec, "Capture Switch",
2175 			   codec->addr == 0 ?
2176 			   "Rear-Panel Capture Switch" :
2177 			   "Front-Panel Capture Switch");
2178 		break;
2179 	}
2180 }
2181 
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2182 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2183 				     const struct hda_fixup *fix,
2184 				     int action)
2185 {
2186 	static const hda_nid_t conn1[] = { 0x0c };
2187 	static const struct coef_fw gb_x570_coefs[] = {
2188 		WRITE_COEF(0x07, 0x03c0),
2189 		WRITE_COEF(0x1a, 0x01c1),
2190 		WRITE_COEF(0x1b, 0x0202),
2191 		WRITE_COEF(0x43, 0x3005),
2192 		{}
2193 	};
2194 
2195 	switch (action) {
2196 	case HDA_FIXUP_ACT_PRE_PROBE:
2197 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2198 		snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2199 		break;
2200 	case HDA_FIXUP_ACT_INIT:
2201 		alc_process_coef_fw(codec, gb_x570_coefs);
2202 		break;
2203 	}
2204 }
2205 
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2206 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2207 				     const struct hda_fixup *fix,
2208 				     int action)
2209 {
2210 	static const hda_nid_t conn1[] = { 0x0c };
2211 
2212 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2213 		return;
2214 
2215 	alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2216 	/* We therefore want to make sure 0x14 (front headphone) and
2217 	 * 0x1b (speakers) use the stereo DAC 0x02
2218 	 */
2219 	snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2220 	snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2221 }
2222 
2223 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2224 				const struct hda_fixup *fix, int action);
2225 
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2226 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2227 				     const struct hda_fixup *fix,
2228 				     int action)
2229 {
2230 	alc1220_fixup_clevo_p950(codec, fix, action);
2231 	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2232 }
2233 
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2234 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2235 					 struct hda_jack_callback *jack)
2236 {
2237 	struct alc_spec *spec = codec->spec;
2238 	unsigned int vref;
2239 
2240 	snd_hda_gen_hp_automute(codec, jack);
2241 
2242 	if (spec->gen.hp_jack_present)
2243 		vref = AC_PINCTL_VREF_80;
2244 	else
2245 		vref = AC_PINCTL_VREF_HIZ;
2246 	snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2247 }
2248 
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2249 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2250 				     const struct hda_fixup *fix, int action)
2251 {
2252 	struct alc_spec *spec = codec->spec;
2253 	if (action != HDA_FIXUP_ACT_PROBE)
2254 		return;
2255 	snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2256 	spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2257 }
2258 
2259 static const struct hda_fixup alc882_fixups[] = {
2260 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
2261 		.type = HDA_FIXUP_PINS,
2262 		.v.pins = (const struct hda_pintbl[]) {
2263 			{ 0x15, 0x01080104 }, /* side */
2264 			{ 0x16, 0x01011012 }, /* rear */
2265 			{ 0x17, 0x01016011 }, /* clfe */
2266 			{ }
2267 		}
2268 	},
2269 	[ALC882_FIXUP_LENOVO_Y530] = {
2270 		.type = HDA_FIXUP_PINS,
2271 		.v.pins = (const struct hda_pintbl[]) {
2272 			{ 0x15, 0x99130112 }, /* rear int speakers */
2273 			{ 0x16, 0x99130111 }, /* subwoofer */
2274 			{ }
2275 		}
2276 	},
2277 	[ALC882_FIXUP_PB_M5210] = {
2278 		.type = HDA_FIXUP_PINCTLS,
2279 		.v.pins = (const struct hda_pintbl[]) {
2280 			{ 0x19, PIN_VREF50 },
2281 			{}
2282 		}
2283 	},
2284 	[ALC882_FIXUP_ACER_ASPIRE_7736] = {
2285 		.type = HDA_FIXUP_FUNC,
2286 		.v.func = alc_fixup_sku_ignore,
2287 	},
2288 	[ALC882_FIXUP_ASUS_W90V] = {
2289 		.type = HDA_FIXUP_PINS,
2290 		.v.pins = (const struct hda_pintbl[]) {
2291 			{ 0x16, 0x99130110 }, /* fix sequence for CLFE */
2292 			{ }
2293 		}
2294 	},
2295 	[ALC889_FIXUP_CD] = {
2296 		.type = HDA_FIXUP_PINS,
2297 		.v.pins = (const struct hda_pintbl[]) {
2298 			{ 0x1c, 0x993301f0 }, /* CD */
2299 			{ }
2300 		}
2301 	},
2302 	[ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2303 		.type = HDA_FIXUP_PINS,
2304 		.v.pins = (const struct hda_pintbl[]) {
2305 			{ 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2306 			{ }
2307 		},
2308 		.chained = true,
2309 		.chain_id = ALC889_FIXUP_CD,
2310 	},
2311 	[ALC889_FIXUP_VAIO_TT] = {
2312 		.type = HDA_FIXUP_PINS,
2313 		.v.pins = (const struct hda_pintbl[]) {
2314 			{ 0x17, 0x90170111 }, /* hidden surround speaker */
2315 			{ }
2316 		}
2317 	},
2318 	[ALC888_FIXUP_EEE1601] = {
2319 		.type = HDA_FIXUP_VERBS,
2320 		.v.verbs = (const struct hda_verb[]) {
2321 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2322 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x0838 },
2323 			{ }
2324 		}
2325 	},
2326 	[ALC886_FIXUP_EAPD] = {
2327 		.type = HDA_FIXUP_VERBS,
2328 		.v.verbs = (const struct hda_verb[]) {
2329 			/* change to EAPD mode */
2330 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2331 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2332 			{ }
2333 		}
2334 	},
2335 	[ALC882_FIXUP_EAPD] = {
2336 		.type = HDA_FIXUP_VERBS,
2337 		.v.verbs = (const struct hda_verb[]) {
2338 			/* change to EAPD mode */
2339 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2340 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2341 			{ }
2342 		}
2343 	},
2344 	[ALC883_FIXUP_EAPD] = {
2345 		.type = HDA_FIXUP_VERBS,
2346 		.v.verbs = (const struct hda_verb[]) {
2347 			/* change to EAPD mode */
2348 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2349 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2350 			{ }
2351 		}
2352 	},
2353 	[ALC883_FIXUP_ACER_EAPD] = {
2354 		.type = HDA_FIXUP_VERBS,
2355 		.v.verbs = (const struct hda_verb[]) {
2356 			/* eanable EAPD on Acer laptops */
2357 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2358 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2359 			{ }
2360 		}
2361 	},
2362 	[ALC882_FIXUP_GPIO1] = {
2363 		.type = HDA_FIXUP_FUNC,
2364 		.v.func = alc_fixup_gpio1,
2365 	},
2366 	[ALC882_FIXUP_GPIO2] = {
2367 		.type = HDA_FIXUP_FUNC,
2368 		.v.func = alc_fixup_gpio2,
2369 	},
2370 	[ALC882_FIXUP_GPIO3] = {
2371 		.type = HDA_FIXUP_FUNC,
2372 		.v.func = alc_fixup_gpio3,
2373 	},
2374 	[ALC882_FIXUP_ASUS_W2JC] = {
2375 		.type = HDA_FIXUP_FUNC,
2376 		.v.func = alc_fixup_gpio1,
2377 		.chained = true,
2378 		.chain_id = ALC882_FIXUP_EAPD,
2379 	},
2380 	[ALC889_FIXUP_COEF] = {
2381 		.type = HDA_FIXUP_FUNC,
2382 		.v.func = alc889_fixup_coef,
2383 	},
2384 	[ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2385 		.type = HDA_FIXUP_PINS,
2386 		.v.pins = (const struct hda_pintbl[]) {
2387 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2388 			{ 0x17, 0x99130112 }, /* surround speaker */
2389 			{ }
2390 		},
2391 		.chained = true,
2392 		.chain_id = ALC882_FIXUP_GPIO1,
2393 	},
2394 	[ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2395 		.type = HDA_FIXUP_PINS,
2396 		.v.pins = (const struct hda_pintbl[]) {
2397 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2398 			{ 0x1b, 0x99130112 }, /* surround speaker */
2399 			{ }
2400 		},
2401 		.chained = true,
2402 		.chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2403 	},
2404 	[ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2405 		/* additional init verbs for Acer Aspire 8930G */
2406 		.type = HDA_FIXUP_VERBS,
2407 		.v.verbs = (const struct hda_verb[]) {
2408 			/* Enable all DACs */
2409 			/* DAC DISABLE/MUTE 1? */
2410 			/*  setting bits 1-5 disables DAC nids 0x02-0x06
2411 			 *  apparently. Init=0x38 */
2412 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2413 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2414 			/* DAC DISABLE/MUTE 2? */
2415 			/*  some bit here disables the other DACs.
2416 			 *  Init=0x4900 */
2417 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2418 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2419 			/* DMIC fix
2420 			 * This laptop has a stereo digital microphone.
2421 			 * The mics are only 1cm apart which makes the stereo
2422 			 * useless. However, either the mic or the ALC889
2423 			 * makes the signal become a difference/sum signal
2424 			 * instead of standard stereo, which is annoying.
2425 			 * So instead we flip this bit which makes the
2426 			 * codec replicate the sum signal to both channels,
2427 			 * turning it into a normal mono mic.
2428 			 */
2429 			/* DMIC_CONTROL? Init value = 0x0001 */
2430 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2431 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2432 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2433 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2434 			{ }
2435 		},
2436 		.chained = true,
2437 		.chain_id = ALC882_FIXUP_GPIO1,
2438 	},
2439 	[ALC885_FIXUP_MACPRO_GPIO] = {
2440 		.type = HDA_FIXUP_FUNC,
2441 		.v.func = alc885_fixup_macpro_gpio,
2442 	},
2443 	[ALC889_FIXUP_DAC_ROUTE] = {
2444 		.type = HDA_FIXUP_FUNC,
2445 		.v.func = alc889_fixup_dac_route,
2446 	},
2447 	[ALC889_FIXUP_MBP_VREF] = {
2448 		.type = HDA_FIXUP_FUNC,
2449 		.v.func = alc889_fixup_mbp_vref,
2450 		.chained = true,
2451 		.chain_id = ALC882_FIXUP_GPIO1,
2452 	},
2453 	[ALC889_FIXUP_IMAC91_VREF] = {
2454 		.type = HDA_FIXUP_FUNC,
2455 		.v.func = alc889_fixup_imac91_vref,
2456 		.chained = true,
2457 		.chain_id = ALC882_FIXUP_GPIO1,
2458 	},
2459 	[ALC889_FIXUP_MBA11_VREF] = {
2460 		.type = HDA_FIXUP_FUNC,
2461 		.v.func = alc889_fixup_mba11_vref,
2462 		.chained = true,
2463 		.chain_id = ALC889_FIXUP_MBP_VREF,
2464 	},
2465 	[ALC889_FIXUP_MBA21_VREF] = {
2466 		.type = HDA_FIXUP_FUNC,
2467 		.v.func = alc889_fixup_mba21_vref,
2468 		.chained = true,
2469 		.chain_id = ALC889_FIXUP_MBP_VREF,
2470 	},
2471 	[ALC889_FIXUP_MP11_VREF] = {
2472 		.type = HDA_FIXUP_FUNC,
2473 		.v.func = alc889_fixup_mba11_vref,
2474 		.chained = true,
2475 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2476 	},
2477 	[ALC889_FIXUP_MP41_VREF] = {
2478 		.type = HDA_FIXUP_FUNC,
2479 		.v.func = alc889_fixup_mbp_vref,
2480 		.chained = true,
2481 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2482 	},
2483 	[ALC882_FIXUP_INV_DMIC] = {
2484 		.type = HDA_FIXUP_FUNC,
2485 		.v.func = alc_fixup_inv_dmic,
2486 	},
2487 	[ALC882_FIXUP_NO_PRIMARY_HP] = {
2488 		.type = HDA_FIXUP_FUNC,
2489 		.v.func = alc882_fixup_no_primary_hp,
2490 	},
2491 	[ALC887_FIXUP_ASUS_BASS] = {
2492 		.type = HDA_FIXUP_PINS,
2493 		.v.pins = (const struct hda_pintbl[]) {
2494 			{0x16, 0x99130130}, /* bass speaker */
2495 			{}
2496 		},
2497 		.chained = true,
2498 		.chain_id = ALC887_FIXUP_BASS_CHMAP,
2499 	},
2500 	[ALC887_FIXUP_BASS_CHMAP] = {
2501 		.type = HDA_FIXUP_FUNC,
2502 		.v.func = alc_fixup_bass_chmap,
2503 	},
2504 	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
2505 		.type = HDA_FIXUP_FUNC,
2506 		.v.func = alc1220_fixup_gb_dual_codecs,
2507 	},
2508 	[ALC1220_FIXUP_GB_X570] = {
2509 		.type = HDA_FIXUP_FUNC,
2510 		.v.func = alc1220_fixup_gb_x570,
2511 	},
2512 	[ALC1220_FIXUP_CLEVO_P950] = {
2513 		.type = HDA_FIXUP_FUNC,
2514 		.v.func = alc1220_fixup_clevo_p950,
2515 	},
2516 	[ALC1220_FIXUP_CLEVO_PB51ED] = {
2517 		.type = HDA_FIXUP_FUNC,
2518 		.v.func = alc1220_fixup_clevo_pb51ed,
2519 	},
2520 	[ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2521 		.type = HDA_FIXUP_PINS,
2522 		.v.pins = (const struct hda_pintbl[]) {
2523 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2524 			{}
2525 		},
2526 		.chained = true,
2527 		.chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2528 	},
2529 	[ALC887_FIXUP_ASUS_AUDIO] = {
2530 		.type = HDA_FIXUP_PINS,
2531 		.v.pins = (const struct hda_pintbl[]) {
2532 			{ 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2533 			{ 0x19, 0x22219420 },
2534 			{}
2535 		},
2536 	},
2537 	[ALC887_FIXUP_ASUS_HMIC] = {
2538 		.type = HDA_FIXUP_FUNC,
2539 		.v.func = alc887_fixup_asus_jack,
2540 		.chained = true,
2541 		.chain_id = ALC887_FIXUP_ASUS_AUDIO,
2542 	},
2543 	[ALCS1200A_FIXUP_MIC_VREF] = {
2544 		.type = HDA_FIXUP_PINCTLS,
2545 		.v.pins = (const struct hda_pintbl[]) {
2546 			{ 0x18, PIN_VREF50 }, /* rear mic */
2547 			{ 0x19, PIN_VREF50 }, /* front mic */
2548 			{}
2549 		}
2550 	},
2551 	[ALC888VD_FIXUP_MIC_100VREF] = {
2552 		.type = HDA_FIXUP_PINCTLS,
2553 		.v.pins = (const struct hda_pintbl[]) {
2554 			{ 0x18, PIN_VREF100 }, /* headset mic */
2555 			{}
2556 		}
2557 	},
2558 };
2559 
2560 static const struct hda_quirk alc882_fixup_tbl[] = {
2561 	SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2562 	SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2563 	SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2564 	SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2565 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2566 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2567 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2568 	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2569 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2570 	SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2571 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2572 	SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2573 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2574 	SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2575 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2576 	SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2577 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2578 	SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2579 	SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2580 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2581 	SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2582 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2583 	SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2584 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2585 	SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2586 	SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2587 	SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2588 	SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2589 	SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2590 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2591 	SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2592 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2593 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2594 	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2595 	SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2596 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2597 	SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2598 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2599 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2600 	SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2601 
2602 	/* All Apple entries are in codec SSIDs */
2603 	SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2604 	SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2605 	SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2606 	SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2607 	SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2608 	SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2609 	SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2610 	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2611 	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2612 	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2613 	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2614 	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2615 	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2616 	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2617 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2618 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2619 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2620 	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2621 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2622 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2623 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2624 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2625 
2626 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2627 	SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2628 	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2629 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2630 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2631 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2632 	SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2633 	SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2634 	SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2635 	SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2636 	SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2637 	SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2638 	SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2639 	SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2640 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2641 	SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2642 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2643 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2644 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2645 	SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2646 	SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2647 	SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2648 	SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2649 	SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2650 	SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2651 	SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2652 	SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2653 	SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2654 	SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2655 	SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2656 	SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 	SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 	SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 	SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 	SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2661 	SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2662 	SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2663 	SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2664 	SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2665 	SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2666 	SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2667 	SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2668 	SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2669 	SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2670 	SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2671 	SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2672 	SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2673 	SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2674 	SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2675 	SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2676 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2677 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2678 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2679 	SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2680 	{}
2681 };
2682 
2683 static const struct hda_model_fixup alc882_fixup_models[] = {
2684 	{.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2685 	{.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2686 	{.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2687 	{.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2688 	{.id = ALC889_FIXUP_CD, .name = "cd"},
2689 	{.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2690 	{.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2691 	{.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2692 	{.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2693 	{.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2694 	{.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2695 	{.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2696 	{.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2697 	{.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2698 	{.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2699 	{.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2700 	{.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2701 	{.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2702 	{.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2703 	{.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2704 	{.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2705 	{.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2706 	{.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2707 	{.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2708 	{.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2709 	{.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2710 	{.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2711 	{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2712 	{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2713 	{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2714 	{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2715 	{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2716 	{}
2717 };
2718 
2719 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2720 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2721 		{0x14, 0x01014010},
2722 		{0x15, 0x01011012},
2723 		{0x16, 0x01016011},
2724 		{0x18, 0x01a19040},
2725 		{0x19, 0x02a19050},
2726 		{0x1a, 0x0181304f},
2727 		{0x1b, 0x0221401f},
2728 		{0x1e, 0x01456130}),
2729 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2730 		{0x14, 0x01015010},
2731 		{0x15, 0x01011012},
2732 		{0x16, 0x01011011},
2733 		{0x18, 0x01a11040},
2734 		{0x19, 0x02a19050},
2735 		{0x1a, 0x0181104f},
2736 		{0x1b, 0x0221401f},
2737 		{0x1e, 0x01451130}),
2738 	{}
2739 };
2740 
2741 /*
2742  * BIOS auto configuration
2743  */
2744 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2745 static int alc882_parse_auto_config(struct hda_codec *codec)
2746 {
2747 	static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2748 	static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2749 	return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2750 }
2751 
2752 /*
2753  */
patch_alc882(struct hda_codec * codec)2754 static int patch_alc882(struct hda_codec *codec)
2755 {
2756 	struct alc_spec *spec;
2757 	int err;
2758 
2759 	err = alc_alloc_spec(codec, 0x0b);
2760 	if (err < 0)
2761 		return err;
2762 
2763 	spec = codec->spec;
2764 
2765 	switch (codec->core.vendor_id) {
2766 	case 0x10ec0882:
2767 	case 0x10ec0885:
2768 	case 0x10ec0900:
2769 	case 0x10ec0b00:
2770 	case 0x10ec1220:
2771 		break;
2772 	default:
2773 		/* ALC883 and variants */
2774 		alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2775 		break;
2776 	}
2777 
2778 	alc_pre_init(codec);
2779 
2780 	snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2781 		       alc882_fixups);
2782 	snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2783 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2784 
2785 	alc_auto_parse_customize_define(codec);
2786 
2787 	if (has_cdefine_beep(codec))
2788 		spec->gen.beep_nid = 0x01;
2789 
2790 	/* automatic parse from the BIOS config */
2791 	err = alc882_parse_auto_config(codec);
2792 	if (err < 0)
2793 		goto error;
2794 
2795 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2796 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2797 		if (err < 0)
2798 			goto error;
2799 	}
2800 
2801 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2802 
2803 	return 0;
2804 
2805  error:
2806 	alc_free(codec);
2807 	return err;
2808 }
2809 
2810 
2811 /*
2812  * ALC262 support
2813  */
alc262_parse_auto_config(struct hda_codec * codec)2814 static int alc262_parse_auto_config(struct hda_codec *codec)
2815 {
2816 	static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2817 	static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2818 	return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2819 }
2820 
2821 /*
2822  * Pin config fixes
2823  */
2824 enum {
2825 	ALC262_FIXUP_FSC_H270,
2826 	ALC262_FIXUP_FSC_S7110,
2827 	ALC262_FIXUP_HP_Z200,
2828 	ALC262_FIXUP_TYAN,
2829 	ALC262_FIXUP_LENOVO_3000,
2830 	ALC262_FIXUP_BENQ,
2831 	ALC262_FIXUP_BENQ_T31,
2832 	ALC262_FIXUP_INV_DMIC,
2833 	ALC262_FIXUP_INTEL_BAYLEYBAY,
2834 };
2835 
2836 static const struct hda_fixup alc262_fixups[] = {
2837 	[ALC262_FIXUP_FSC_H270] = {
2838 		.type = HDA_FIXUP_PINS,
2839 		.v.pins = (const struct hda_pintbl[]) {
2840 			{ 0x14, 0x99130110 }, /* speaker */
2841 			{ 0x15, 0x0221142f }, /* front HP */
2842 			{ 0x1b, 0x0121141f }, /* rear HP */
2843 			{ }
2844 		}
2845 	},
2846 	[ALC262_FIXUP_FSC_S7110] = {
2847 		.type = HDA_FIXUP_PINS,
2848 		.v.pins = (const struct hda_pintbl[]) {
2849 			{ 0x15, 0x90170110 }, /* speaker */
2850 			{ }
2851 		},
2852 		.chained = true,
2853 		.chain_id = ALC262_FIXUP_BENQ,
2854 	},
2855 	[ALC262_FIXUP_HP_Z200] = {
2856 		.type = HDA_FIXUP_PINS,
2857 		.v.pins = (const struct hda_pintbl[]) {
2858 			{ 0x16, 0x99130120 }, /* internal speaker */
2859 			{ }
2860 		}
2861 	},
2862 	[ALC262_FIXUP_TYAN] = {
2863 		.type = HDA_FIXUP_PINS,
2864 		.v.pins = (const struct hda_pintbl[]) {
2865 			{ 0x14, 0x1993e1f0 }, /* int AUX */
2866 			{ }
2867 		}
2868 	},
2869 	[ALC262_FIXUP_LENOVO_3000] = {
2870 		.type = HDA_FIXUP_PINCTLS,
2871 		.v.pins = (const struct hda_pintbl[]) {
2872 			{ 0x19, PIN_VREF50 },
2873 			{}
2874 		},
2875 		.chained = true,
2876 		.chain_id = ALC262_FIXUP_BENQ,
2877 	},
2878 	[ALC262_FIXUP_BENQ] = {
2879 		.type = HDA_FIXUP_VERBS,
2880 		.v.verbs = (const struct hda_verb[]) {
2881 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2882 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2883 			{}
2884 		}
2885 	},
2886 	[ALC262_FIXUP_BENQ_T31] = {
2887 		.type = HDA_FIXUP_VERBS,
2888 		.v.verbs = (const struct hda_verb[]) {
2889 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2890 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2891 			{}
2892 		}
2893 	},
2894 	[ALC262_FIXUP_INV_DMIC] = {
2895 		.type = HDA_FIXUP_FUNC,
2896 		.v.func = alc_fixup_inv_dmic,
2897 	},
2898 	[ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2899 		.type = HDA_FIXUP_FUNC,
2900 		.v.func = alc_fixup_no_depop_delay,
2901 	},
2902 };
2903 
2904 static const struct hda_quirk alc262_fixup_tbl[] = {
2905 	SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2906 	SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2907 	SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2908 	SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2909 	SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2910 	SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2911 	SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2912 	SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2913 	SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2914 	SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2915 	{}
2916 };
2917 
2918 static const struct hda_model_fixup alc262_fixup_models[] = {
2919 	{.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2920 	{.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2921 	{.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2922 	{.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2923 	{.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2924 	{.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2925 	{.id = ALC262_FIXUP_BENQ, .name = "benq"},
2926 	{.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2927 	{.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2928 	{}
2929 };
2930 
2931 /*
2932  */
patch_alc262(struct hda_codec * codec)2933 static int patch_alc262(struct hda_codec *codec)
2934 {
2935 	struct alc_spec *spec;
2936 	int err;
2937 
2938 	err = alc_alloc_spec(codec, 0x0b);
2939 	if (err < 0)
2940 		return err;
2941 
2942 	spec = codec->spec;
2943 	spec->gen.shared_mic_vref_pin = 0x18;
2944 
2945 	spec->shutup = alc_eapd_shutup;
2946 
2947 #if 0
2948 	/* pshou 07/11/05  set a zero PCM sample to DAC when FIFO is
2949 	 * under-run
2950 	 */
2951 	alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2952 #endif
2953 	alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2954 
2955 	alc_pre_init(codec);
2956 
2957 	snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2958 		       alc262_fixups);
2959 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2960 
2961 	alc_auto_parse_customize_define(codec);
2962 
2963 	if (has_cdefine_beep(codec))
2964 		spec->gen.beep_nid = 0x01;
2965 
2966 	/* automatic parse from the BIOS config */
2967 	err = alc262_parse_auto_config(codec);
2968 	if (err < 0)
2969 		goto error;
2970 
2971 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2972 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2973 		if (err < 0)
2974 			goto error;
2975 	}
2976 
2977 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2978 
2979 	return 0;
2980 
2981  error:
2982 	alc_free(codec);
2983 	return err;
2984 }
2985 
2986 /*
2987  *  ALC268
2988  */
2989 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)2990 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2991 				  struct snd_ctl_elem_value *ucontrol)
2992 {
2993 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2994 	unsigned long pval;
2995 	int err;
2996 
2997 	mutex_lock(&codec->control_mutex);
2998 	pval = kcontrol->private_value;
2999 	kcontrol->private_value = (pval & ~0xff) | 0x0f;
3000 	err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3001 	if (err >= 0) {
3002 		kcontrol->private_value = (pval & ~0xff) | 0x10;
3003 		err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3004 	}
3005 	kcontrol->private_value = pval;
3006 	mutex_unlock(&codec->control_mutex);
3007 	return err;
3008 }
3009 
3010 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3011 	HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3012 	{
3013 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3014 		.name = "Beep Playback Switch",
3015 		.subdevice = HDA_SUBDEV_AMP_FLAG,
3016 		.info = snd_hda_mixer_amp_switch_info,
3017 		.get = snd_hda_mixer_amp_switch_get,
3018 		.put = alc268_beep_switch_put,
3019 		.private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3020 	},
3021 };
3022 
3023 /* set PCBEEP vol = 0, mute connections */
3024 static const struct hda_verb alc268_beep_init_verbs[] = {
3025 	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3026 	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3027 	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3028 	{ }
3029 };
3030 
3031 enum {
3032 	ALC268_FIXUP_INV_DMIC,
3033 	ALC268_FIXUP_HP_EAPD,
3034 	ALC268_FIXUP_SPDIF,
3035 };
3036 
3037 static const struct hda_fixup alc268_fixups[] = {
3038 	[ALC268_FIXUP_INV_DMIC] = {
3039 		.type = HDA_FIXUP_FUNC,
3040 		.v.func = alc_fixup_inv_dmic,
3041 	},
3042 	[ALC268_FIXUP_HP_EAPD] = {
3043 		.type = HDA_FIXUP_VERBS,
3044 		.v.verbs = (const struct hda_verb[]) {
3045 			{0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3046 			{}
3047 		}
3048 	},
3049 	[ALC268_FIXUP_SPDIF] = {
3050 		.type = HDA_FIXUP_PINS,
3051 		.v.pins = (const struct hda_pintbl[]) {
3052 			{ 0x1e, 0x014b1180 }, /* enable SPDIF out */
3053 			{}
3054 		}
3055 	},
3056 };
3057 
3058 static const struct hda_model_fixup alc268_fixup_models[] = {
3059 	{.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3060 	{.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3061 	{.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3062 	{}
3063 };
3064 
3065 static const struct hda_quirk alc268_fixup_tbl[] = {
3066 	SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3067 	SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3068 	/* below is codec SSID since multiple Toshiba laptops have the
3069 	 * same PCI SSID 1179:ff00
3070 	 */
3071 	SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3072 	{}
3073 };
3074 
3075 /*
3076  * BIOS auto configuration
3077  */
alc268_parse_auto_config(struct hda_codec * codec)3078 static int alc268_parse_auto_config(struct hda_codec *codec)
3079 {
3080 	static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3081 	return alc_parse_auto_config(codec, NULL, alc268_ssids);
3082 }
3083 
3084 /*
3085  */
patch_alc268(struct hda_codec * codec)3086 static int patch_alc268(struct hda_codec *codec)
3087 {
3088 	struct alc_spec *spec;
3089 	int i, err;
3090 
3091 	/* ALC268 has no aa-loopback mixer */
3092 	err = alc_alloc_spec(codec, 0);
3093 	if (err < 0)
3094 		return err;
3095 
3096 	spec = codec->spec;
3097 	if (has_cdefine_beep(codec))
3098 		spec->gen.beep_nid = 0x01;
3099 
3100 	spec->shutup = alc_eapd_shutup;
3101 
3102 	alc_pre_init(codec);
3103 
3104 	snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3105 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3106 
3107 	/* automatic parse from the BIOS config */
3108 	err = alc268_parse_auto_config(codec);
3109 	if (err < 0)
3110 		goto error;
3111 
3112 	if (err > 0 && !spec->gen.no_analog &&
3113 	    spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3114 		for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3115 			if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3116 						  &alc268_beep_mixer[i])) {
3117 				err = -ENOMEM;
3118 				goto error;
3119 			}
3120 		}
3121 		snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3122 		if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3123 			/* override the amp caps for beep generator */
3124 			snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3125 					  (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3126 					  (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3127 					  (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3128 					  (0 << AC_AMPCAP_MUTE_SHIFT));
3129 	}
3130 
3131 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3132 
3133 	return 0;
3134 
3135  error:
3136 	alc_free(codec);
3137 	return err;
3138 }
3139 
3140 /*
3141  * ALC269
3142  */
3143 
3144 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3145 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3146 };
3147 
3148 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3149 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3150 };
3151 
3152 /* different alc269-variants */
3153 enum {
3154 	ALC269_TYPE_ALC269VA,
3155 	ALC269_TYPE_ALC269VB,
3156 	ALC269_TYPE_ALC269VC,
3157 	ALC269_TYPE_ALC269VD,
3158 	ALC269_TYPE_ALC280,
3159 	ALC269_TYPE_ALC282,
3160 	ALC269_TYPE_ALC283,
3161 	ALC269_TYPE_ALC284,
3162 	ALC269_TYPE_ALC293,
3163 	ALC269_TYPE_ALC286,
3164 	ALC269_TYPE_ALC298,
3165 	ALC269_TYPE_ALC255,
3166 	ALC269_TYPE_ALC256,
3167 	ALC269_TYPE_ALC257,
3168 	ALC269_TYPE_ALC215,
3169 	ALC269_TYPE_ALC225,
3170 	ALC269_TYPE_ALC245,
3171 	ALC269_TYPE_ALC287,
3172 	ALC269_TYPE_ALC294,
3173 	ALC269_TYPE_ALC300,
3174 	ALC269_TYPE_ALC623,
3175 	ALC269_TYPE_ALC700,
3176 };
3177 
3178 /*
3179  * BIOS auto configuration
3180  */
alc269_parse_auto_config(struct hda_codec * codec)3181 static int alc269_parse_auto_config(struct hda_codec *codec)
3182 {
3183 	static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3184 	static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3185 	static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3186 	struct alc_spec *spec = codec->spec;
3187 	const hda_nid_t *ssids;
3188 
3189 	switch (spec->codec_variant) {
3190 	case ALC269_TYPE_ALC269VA:
3191 	case ALC269_TYPE_ALC269VC:
3192 	case ALC269_TYPE_ALC280:
3193 	case ALC269_TYPE_ALC284:
3194 	case ALC269_TYPE_ALC293:
3195 		ssids = alc269va_ssids;
3196 		break;
3197 	case ALC269_TYPE_ALC269VB:
3198 	case ALC269_TYPE_ALC269VD:
3199 	case ALC269_TYPE_ALC282:
3200 	case ALC269_TYPE_ALC283:
3201 	case ALC269_TYPE_ALC286:
3202 	case ALC269_TYPE_ALC298:
3203 	case ALC269_TYPE_ALC255:
3204 	case ALC269_TYPE_ALC256:
3205 	case ALC269_TYPE_ALC257:
3206 	case ALC269_TYPE_ALC215:
3207 	case ALC269_TYPE_ALC225:
3208 	case ALC269_TYPE_ALC245:
3209 	case ALC269_TYPE_ALC287:
3210 	case ALC269_TYPE_ALC294:
3211 	case ALC269_TYPE_ALC300:
3212 	case ALC269_TYPE_ALC623:
3213 	case ALC269_TYPE_ALC700:
3214 		ssids = alc269_ssids;
3215 		break;
3216 	default:
3217 		ssids = alc269_ssids;
3218 		break;
3219 	}
3220 
3221 	return alc_parse_auto_config(codec, alc269_ignore, ssids);
3222 }
3223 
3224 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3225 	{ SND_JACK_BTN_0, KEY_PLAYPAUSE },
3226 	{ SND_JACK_BTN_1, KEY_VOICECOMMAND },
3227 	{ SND_JACK_BTN_2, KEY_VOLUMEUP },
3228 	{ SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3229 	{}
3230 };
3231 
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3232 static void alc_headset_btn_callback(struct hda_codec *codec,
3233 				     struct hda_jack_callback *jack)
3234 {
3235 	int report = 0;
3236 
3237 	if (jack->unsol_res & (7 << 13))
3238 		report |= SND_JACK_BTN_0;
3239 
3240 	if (jack->unsol_res  & (1 << 16 | 3 << 8))
3241 		report |= SND_JACK_BTN_1;
3242 
3243 	/* Volume up key */
3244 	if (jack->unsol_res & (7 << 23))
3245 		report |= SND_JACK_BTN_2;
3246 
3247 	/* Volume down key */
3248 	if (jack->unsol_res & (7 << 10))
3249 		report |= SND_JACK_BTN_3;
3250 
3251 	snd_hda_jack_set_button_state(codec, jack->nid, report);
3252 }
3253 
alc_disable_headset_jack_key(struct hda_codec * codec)3254 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3255 {
3256 	struct alc_spec *spec = codec->spec;
3257 
3258 	if (!spec->has_hs_key)
3259 		return;
3260 
3261 	switch (codec->core.vendor_id) {
3262 	case 0x10ec0215:
3263 	case 0x10ec0225:
3264 	case 0x10ec0285:
3265 	case 0x10ec0287:
3266 	case 0x10ec0295:
3267 	case 0x10ec0289:
3268 	case 0x10ec0299:
3269 		alc_write_coef_idx(codec, 0x48, 0x0);
3270 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3271 		alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3272 		break;
3273 	case 0x10ec0230:
3274 	case 0x10ec0236:
3275 	case 0x10ec0256:
3276 	case 0x10ec0257:
3277 	case 0x19e58326:
3278 		alc_write_coef_idx(codec, 0x48, 0x0);
3279 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3280 		break;
3281 	}
3282 }
3283 
alc_enable_headset_jack_key(struct hda_codec * codec)3284 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3285 {
3286 	struct alc_spec *spec = codec->spec;
3287 
3288 	if (!spec->has_hs_key)
3289 		return;
3290 
3291 	switch (codec->core.vendor_id) {
3292 	case 0x10ec0215:
3293 	case 0x10ec0225:
3294 	case 0x10ec0285:
3295 	case 0x10ec0287:
3296 	case 0x10ec0295:
3297 	case 0x10ec0289:
3298 	case 0x10ec0299:
3299 		alc_write_coef_idx(codec, 0x48, 0xd011);
3300 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3301 		alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3302 		break;
3303 	case 0x10ec0230:
3304 	case 0x10ec0236:
3305 	case 0x10ec0256:
3306 	case 0x10ec0257:
3307 	case 0x19e58326:
3308 		alc_write_coef_idx(codec, 0x48, 0xd011);
3309 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3310 		break;
3311 	}
3312 }
3313 
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3314 static void alc_fixup_headset_jack(struct hda_codec *codec,
3315 				    const struct hda_fixup *fix, int action)
3316 {
3317 	struct alc_spec *spec = codec->spec;
3318 	hda_nid_t hp_pin;
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 		break;
3326 	case HDA_FIXUP_ACT_BUILD:
3327 		hp_pin = alc_get_hp_pin(spec);
3328 		if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3329 							alc_headset_btn_keymap,
3330 							hp_pin))
3331 			snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3332 					      false, SND_JACK_HEADSET,
3333 					      alc_headset_btn_keymap);
3334 
3335 		alc_enable_headset_jack_key(codec);
3336 		break;
3337 	}
3338 }
3339 
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3340 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3341 {
3342 	alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3343 }
3344 
alc269_shutup(struct hda_codec * codec)3345 static void alc269_shutup(struct hda_codec *codec)
3346 {
3347 	struct alc_spec *spec = codec->spec;
3348 
3349 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3350 		alc269vb_toggle_power_output(codec, 0);
3351 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3352 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3353 		msleep(150);
3354 	}
3355 	alc_shutup_pins(codec);
3356 }
3357 
3358 static const struct coef_fw alc282_coefs[] = {
3359 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3360 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3361 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3362 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3363 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3364 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3365 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3366 	WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3367 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3368 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3369 	WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3370 	UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3371 	WRITE_COEF(0x34, 0xa0c0), /* ANC */
3372 	UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3373 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3374 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3375 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3376 	WRITE_COEF(0x63, 0x2902), /* PLL */
3377 	WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3378 	WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3379 	WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3380 	WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3381 	UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3382 	WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3383 	UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3384 	WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3385 	WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3386 	UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3387 	WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3388 	{}
3389 };
3390 
alc282_restore_default_value(struct hda_codec * codec)3391 static void alc282_restore_default_value(struct hda_codec *codec)
3392 {
3393 	alc_process_coef_fw(codec, alc282_coefs);
3394 }
3395 
alc282_init(struct hda_codec * codec)3396 static void alc282_init(struct hda_codec *codec)
3397 {
3398 	struct alc_spec *spec = codec->spec;
3399 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3400 	bool hp_pin_sense;
3401 	int coef78;
3402 
3403 	alc282_restore_default_value(codec);
3404 
3405 	if (!hp_pin)
3406 		return;
3407 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3408 	coef78 = alc_read_coef_idx(codec, 0x78);
3409 
3410 	/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3411 	/* Headphone capless set to high power mode */
3412 	alc_write_coef_idx(codec, 0x78, 0x9004);
3413 
3414 	if (hp_pin_sense)
3415 		msleep(2);
3416 
3417 	snd_hda_codec_write(codec, hp_pin, 0,
3418 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3419 
3420 	if (hp_pin_sense)
3421 		msleep(85);
3422 
3423 	snd_hda_codec_write(codec, hp_pin, 0,
3424 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3425 
3426 	if (hp_pin_sense)
3427 		msleep(100);
3428 
3429 	/* Headphone capless set to normal mode */
3430 	alc_write_coef_idx(codec, 0x78, coef78);
3431 }
3432 
alc282_shutup(struct hda_codec * codec)3433 static void alc282_shutup(struct hda_codec *codec)
3434 {
3435 	struct alc_spec *spec = codec->spec;
3436 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3437 	bool hp_pin_sense;
3438 	int coef78;
3439 
3440 	if (!hp_pin) {
3441 		alc269_shutup(codec);
3442 		return;
3443 	}
3444 
3445 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3446 	coef78 = alc_read_coef_idx(codec, 0x78);
3447 	alc_write_coef_idx(codec, 0x78, 0x9004);
3448 
3449 	if (hp_pin_sense)
3450 		msleep(2);
3451 
3452 	snd_hda_codec_write(codec, hp_pin, 0,
3453 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3454 
3455 	if (hp_pin_sense)
3456 		msleep(85);
3457 
3458 	if (!spec->no_shutup_pins)
3459 		snd_hda_codec_write(codec, hp_pin, 0,
3460 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3461 
3462 	if (hp_pin_sense)
3463 		msleep(100);
3464 
3465 	alc_auto_setup_eapd(codec, false);
3466 	alc_shutup_pins(codec);
3467 	alc_write_coef_idx(codec, 0x78, coef78);
3468 }
3469 
3470 static const struct coef_fw alc283_coefs[] = {
3471 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3472 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3473 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3474 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3475 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3476 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3477 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3478 	WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3479 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3480 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3481 	WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3482 	UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3483 	WRITE_COEF(0x22, 0xa0c0), /* ANC */
3484 	UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3485 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3486 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3487 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3488 	WRITE_COEF(0x2e, 0x2902), /* PLL */
3489 	WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3490 	WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3491 	WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3492 	WRITE_COEF(0x36, 0x0), /* capless control 5 */
3493 	UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3494 	WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3495 	UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3496 	WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3497 	WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3498 	UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3499 	WRITE_COEF(0x49, 0x0), /* test mode */
3500 	UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3501 	UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3502 	WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3503 	UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3504 	{}
3505 };
3506 
alc283_restore_default_value(struct hda_codec * codec)3507 static void alc283_restore_default_value(struct hda_codec *codec)
3508 {
3509 	alc_process_coef_fw(codec, alc283_coefs);
3510 }
3511 
alc283_init(struct hda_codec * codec)3512 static void alc283_init(struct hda_codec *codec)
3513 {
3514 	struct alc_spec *spec = codec->spec;
3515 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3516 	bool hp_pin_sense;
3517 
3518 	alc283_restore_default_value(codec);
3519 
3520 	if (!hp_pin)
3521 		return;
3522 
3523 	msleep(30);
3524 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3525 
3526 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3527 	/* Headphone capless set to high power mode */
3528 	alc_write_coef_idx(codec, 0x43, 0x9004);
3529 
3530 	snd_hda_codec_write(codec, hp_pin, 0,
3531 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3532 
3533 	if (hp_pin_sense)
3534 		msleep(85);
3535 
3536 	snd_hda_codec_write(codec, hp_pin, 0,
3537 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3538 
3539 	if (hp_pin_sense)
3540 		msleep(85);
3541 	/* Index 0x46 Combo jack auto switch control 2 */
3542 	/* 3k pull low control for Headset jack. */
3543 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3544 	/* Headphone capless set to normal mode */
3545 	alc_write_coef_idx(codec, 0x43, 0x9614);
3546 }
3547 
alc283_shutup(struct hda_codec * codec)3548 static void alc283_shutup(struct hda_codec *codec)
3549 {
3550 	struct alc_spec *spec = codec->spec;
3551 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3552 	bool hp_pin_sense;
3553 
3554 	if (!hp_pin) {
3555 		alc269_shutup(codec);
3556 		return;
3557 	}
3558 
3559 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3560 
3561 	alc_write_coef_idx(codec, 0x43, 0x9004);
3562 
3563 	/*depop hp during suspend*/
3564 	alc_write_coef_idx(codec, 0x06, 0x2100);
3565 
3566 	snd_hda_codec_write(codec, hp_pin, 0,
3567 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3568 
3569 	if (hp_pin_sense)
3570 		msleep(100);
3571 
3572 	if (!spec->no_shutup_pins)
3573 		snd_hda_codec_write(codec, hp_pin, 0,
3574 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3575 
3576 	alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3577 
3578 	if (hp_pin_sense)
3579 		msleep(100);
3580 	alc_auto_setup_eapd(codec, false);
3581 	alc_shutup_pins(codec);
3582 	alc_write_coef_idx(codec, 0x43, 0x9614);
3583 }
3584 
alc256_init(struct hda_codec * codec)3585 static void alc256_init(struct hda_codec *codec)
3586 {
3587 	struct alc_spec *spec = codec->spec;
3588 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3589 	bool hp_pin_sense;
3590 
3591 	if (spec->ultra_low_power) {
3592 		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3593 		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3594 		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3595 		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3596 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3597 		msleep(30);
3598 	}
3599 
3600 	if (!hp_pin)
3601 		hp_pin = 0x21;
3602 
3603 	msleep(30);
3604 
3605 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3606 
3607 	if (hp_pin_sense) {
3608 		msleep(2);
3609 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3610 
3611 		snd_hda_codec_write(codec, hp_pin, 0,
3612 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3613 
3614 		msleep(75);
3615 
3616 		snd_hda_codec_write(codec, hp_pin, 0,
3617 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3618 
3619 		msleep(75);
3620 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3621 	}
3622 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3623 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3624 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3625 	/*
3626 	 * Expose headphone mic (or possibly Line In on some machines) instead
3627 	 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3628 	 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3629 	 * this register.
3630 	 */
3631 	alc_write_coef_idx(codec, 0x36, 0x5757);
3632 }
3633 
alc256_shutup(struct hda_codec * codec)3634 static void alc256_shutup(struct hda_codec *codec)
3635 {
3636 	struct alc_spec *spec = codec->spec;
3637 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3638 	bool hp_pin_sense;
3639 
3640 	if (!hp_pin)
3641 		hp_pin = 0x21;
3642 
3643 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3644 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3645 
3646 	if (hp_pin_sense) {
3647 		msleep(2);
3648 
3649 		snd_hda_codec_write(codec, hp_pin, 0,
3650 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3651 
3652 		msleep(75);
3653 
3654 	/* 3k pull low control for Headset jack. */
3655 	/* NOTE: call this before clearing the pin, otherwise codec stalls */
3656 	/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3657 	 * when booting with headset plugged. So skip setting it for the codec alc257
3658 	 */
3659 		if (spec->en_3kpull_low)
3660 			alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3661 
3662 		if (!spec->no_shutup_pins)
3663 			snd_hda_codec_write(codec, hp_pin, 0,
3664 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3665 
3666 		msleep(75);
3667 	}
3668 
3669 	alc_auto_setup_eapd(codec, false);
3670 	alc_shutup_pins(codec);
3671 	if (spec->ultra_low_power) {
3672 		msleep(50);
3673 		alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3674 		alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3675 		alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3676 		alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3677 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3678 		msleep(30);
3679 	}
3680 }
3681 
alc285_hp_init(struct hda_codec * codec)3682 static void alc285_hp_init(struct hda_codec *codec)
3683 {
3684 	struct alc_spec *spec = codec->spec;
3685 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3686 	int i, val;
3687 	int coef38, coef0d, coef36;
3688 
3689 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3690 	alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3691 	coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3692 	coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3693 	coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3694 	alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3695 	alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3696 
3697 	alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3698 
3699 	if (hp_pin)
3700 		snd_hda_codec_write(codec, hp_pin, 0,
3701 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3702 
3703 	msleep(130);
3704 	alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3705 	alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3706 
3707 	if (hp_pin)
3708 		snd_hda_codec_write(codec, hp_pin, 0,
3709 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3710 	msleep(10);
3711 	alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3712 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3713 	alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3714 	alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3715 
3716 	alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3717 	val = alc_read_coefex_idx(codec, 0x58, 0x00);
3718 	for (i = 0; i < 20 && val & 0x8000; i++) {
3719 		msleep(50);
3720 		val = alc_read_coefex_idx(codec, 0x58, 0x00);
3721 	} /* Wait for depop procedure finish  */
3722 
3723 	alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3724 	alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3725 	alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3726 	alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3727 
3728 	msleep(50);
3729 	alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3730 }
3731 
alc225_init(struct hda_codec * codec)3732 static void alc225_init(struct hda_codec *codec)
3733 {
3734 	struct alc_spec *spec = codec->spec;
3735 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3736 	bool hp1_pin_sense, hp2_pin_sense;
3737 
3738 	if (spec->ultra_low_power) {
3739 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3740 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3741 		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3742 		msleep(30);
3743 	}
3744 
3745 	if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3746 		spec->codec_variant != ALC269_TYPE_ALC245)
3747 		/* required only at boot or S3 and S4 resume time */
3748 		if (!spec->done_hp_init ||
3749 			is_s3_resume(codec) ||
3750 			is_s4_resume(codec)) {
3751 			alc285_hp_init(codec);
3752 			spec->done_hp_init = true;
3753 		}
3754 
3755 	if (!hp_pin)
3756 		hp_pin = 0x21;
3757 	msleep(30);
3758 
3759 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3760 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3761 
3762 	if (hp1_pin_sense || hp2_pin_sense) {
3763 		msleep(2);
3764 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3765 
3766 		if (hp1_pin_sense)
3767 			snd_hda_codec_write(codec, hp_pin, 0,
3768 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3769 		if (hp2_pin_sense)
3770 			snd_hda_codec_write(codec, 0x16, 0,
3771 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3772 		msleep(75);
3773 
3774 		if (hp1_pin_sense)
3775 			snd_hda_codec_write(codec, hp_pin, 0,
3776 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3777 		if (hp2_pin_sense)
3778 			snd_hda_codec_write(codec, 0x16, 0,
3779 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3780 
3781 		msleep(75);
3782 		alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3783 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3784 	}
3785 }
3786 
alc225_shutup(struct hda_codec * codec)3787 static void alc225_shutup(struct hda_codec *codec)
3788 {
3789 	struct alc_spec *spec = codec->spec;
3790 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3791 	bool hp1_pin_sense, hp2_pin_sense;
3792 
3793 	if (!hp_pin)
3794 		hp_pin = 0x21;
3795 
3796 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3797 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3798 
3799 	if (hp1_pin_sense || hp2_pin_sense) {
3800 		alc_disable_headset_jack_key(codec);
3801 		/* 3k pull low control for Headset jack. */
3802 		alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3803 		msleep(2);
3804 
3805 		if (hp1_pin_sense)
3806 			snd_hda_codec_write(codec, hp_pin, 0,
3807 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3808 		if (hp2_pin_sense)
3809 			snd_hda_codec_write(codec, 0x16, 0,
3810 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3811 
3812 		msleep(75);
3813 
3814 		if (hp1_pin_sense)
3815 			snd_hda_codec_write(codec, hp_pin, 0,
3816 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3817 		if (hp2_pin_sense)
3818 			snd_hda_codec_write(codec, 0x16, 0,
3819 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3820 
3821 		msleep(75);
3822 		alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3823 		alc_enable_headset_jack_key(codec);
3824 	}
3825 	alc_auto_setup_eapd(codec, false);
3826 	alc_shutup_pins(codec);
3827 	if (spec->ultra_low_power) {
3828 		msleep(50);
3829 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3830 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3831 		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3832 		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3833 		msleep(30);
3834 	}
3835 }
3836 
alc222_init(struct hda_codec * codec)3837 static void alc222_init(struct hda_codec *codec)
3838 {
3839 	struct alc_spec *spec = codec->spec;
3840 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3841 	bool hp1_pin_sense, hp2_pin_sense;
3842 
3843 	if (!hp_pin)
3844 		return;
3845 
3846 	msleep(30);
3847 
3848 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3849 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3850 
3851 	if (hp1_pin_sense || hp2_pin_sense) {
3852 		msleep(2);
3853 
3854 		if (hp1_pin_sense)
3855 			snd_hda_codec_write(codec, hp_pin, 0,
3856 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3857 		if (hp2_pin_sense)
3858 			snd_hda_codec_write(codec, 0x14, 0,
3859 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3860 		msleep(75);
3861 
3862 		if (hp1_pin_sense)
3863 			snd_hda_codec_write(codec, hp_pin, 0,
3864 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3865 		if (hp2_pin_sense)
3866 			snd_hda_codec_write(codec, 0x14, 0,
3867 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3868 
3869 		msleep(75);
3870 	}
3871 }
3872 
alc222_shutup(struct hda_codec * codec)3873 static void alc222_shutup(struct hda_codec *codec)
3874 {
3875 	struct alc_spec *spec = codec->spec;
3876 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3877 	bool hp1_pin_sense, hp2_pin_sense;
3878 
3879 	if (!hp_pin)
3880 		hp_pin = 0x21;
3881 
3882 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3883 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3884 
3885 	if (hp1_pin_sense || hp2_pin_sense) {
3886 		msleep(2);
3887 
3888 		if (hp1_pin_sense)
3889 			snd_hda_codec_write(codec, hp_pin, 0,
3890 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3891 		if (hp2_pin_sense)
3892 			snd_hda_codec_write(codec, 0x14, 0,
3893 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3894 
3895 		msleep(75);
3896 
3897 		if (hp1_pin_sense)
3898 			snd_hda_codec_write(codec, hp_pin, 0,
3899 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3900 		if (hp2_pin_sense)
3901 			snd_hda_codec_write(codec, 0x14, 0,
3902 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3903 
3904 		msleep(75);
3905 	}
3906 	alc_auto_setup_eapd(codec, false);
3907 	alc_shutup_pins(codec);
3908 }
3909 
alc_default_init(struct hda_codec * codec)3910 static void alc_default_init(struct hda_codec *codec)
3911 {
3912 	struct alc_spec *spec = codec->spec;
3913 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3914 	bool hp_pin_sense;
3915 
3916 	if (!hp_pin)
3917 		return;
3918 
3919 	msleep(30);
3920 
3921 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3922 
3923 	if (hp_pin_sense) {
3924 		msleep(2);
3925 
3926 		snd_hda_codec_write(codec, hp_pin, 0,
3927 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3928 
3929 		msleep(75);
3930 
3931 		snd_hda_codec_write(codec, hp_pin, 0,
3932 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3933 		msleep(75);
3934 	}
3935 }
3936 
alc_default_shutup(struct hda_codec * codec)3937 static void alc_default_shutup(struct hda_codec *codec)
3938 {
3939 	struct alc_spec *spec = codec->spec;
3940 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3941 	bool hp_pin_sense;
3942 
3943 	if (!hp_pin) {
3944 		alc269_shutup(codec);
3945 		return;
3946 	}
3947 
3948 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3949 
3950 	if (hp_pin_sense) {
3951 		msleep(2);
3952 
3953 		snd_hda_codec_write(codec, hp_pin, 0,
3954 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3955 
3956 		msleep(75);
3957 
3958 		if (!spec->no_shutup_pins)
3959 			snd_hda_codec_write(codec, hp_pin, 0,
3960 					    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3961 
3962 		msleep(75);
3963 	}
3964 	alc_auto_setup_eapd(codec, false);
3965 	alc_shutup_pins(codec);
3966 }
3967 
alc294_hp_init(struct hda_codec * codec)3968 static void alc294_hp_init(struct hda_codec *codec)
3969 {
3970 	struct alc_spec *spec = codec->spec;
3971 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3972 	int i, val;
3973 
3974 	if (!hp_pin)
3975 		return;
3976 
3977 	snd_hda_codec_write(codec, hp_pin, 0,
3978 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3979 
3980 	msleep(100);
3981 
3982 	if (!spec->no_shutup_pins)
3983 		snd_hda_codec_write(codec, hp_pin, 0,
3984 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3985 
3986 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3987 	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3988 
3989 	/* Wait for depop procedure finish  */
3990 	val = alc_read_coefex_idx(codec, 0x58, 0x01);
3991 	for (i = 0; i < 20 && val & 0x0080; i++) {
3992 		msleep(50);
3993 		val = alc_read_coefex_idx(codec, 0x58, 0x01);
3994 	}
3995 	/* Set HP depop to auto mode */
3996 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3997 	msleep(50);
3998 }
3999 
alc294_init(struct hda_codec * codec)4000 static void alc294_init(struct hda_codec *codec)
4001 {
4002 	struct alc_spec *spec = codec->spec;
4003 
4004 	/* required only at boot or S4 resume time */
4005 	if (!spec->done_hp_init ||
4006 	    codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
4007 		alc294_hp_init(codec);
4008 		spec->done_hp_init = true;
4009 	}
4010 	alc_default_init(codec);
4011 }
4012 
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)4013 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
4014 			     unsigned int val)
4015 {
4016 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
4017 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
4018 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
4019 }
4020 
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)4021 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
4022 {
4023 	unsigned int val;
4024 
4025 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
4026 	val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
4027 		& 0xffff;
4028 	val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
4029 		<< 16;
4030 	return val;
4031 }
4032 
alc5505_dsp_halt(struct hda_codec * codec)4033 static void alc5505_dsp_halt(struct hda_codec *codec)
4034 {
4035 	unsigned int val;
4036 
4037 	alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
4038 	alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
4039 	alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
4040 	alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
4041 	alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
4042 	alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
4043 	alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
4044 	val = alc5505_coef_get(codec, 0x6220);
4045 	alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
4046 }
4047 
alc5505_dsp_back_from_halt(struct hda_codec * codec)4048 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
4049 {
4050 	alc5505_coef_set(codec, 0x61b8, 0x04133302);
4051 	alc5505_coef_set(codec, 0x61b0, 0x00005b16);
4052 	alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
4053 	alc5505_coef_set(codec, 0x6230, 0xf80d4011);
4054 	alc5505_coef_set(codec, 0x6220, 0x2002010f);
4055 	alc5505_coef_set(codec, 0x880c, 0x00000004);
4056 }
4057 
alc5505_dsp_init(struct hda_codec * codec)4058 static void alc5505_dsp_init(struct hda_codec *codec)
4059 {
4060 	unsigned int val;
4061 
4062 	alc5505_dsp_halt(codec);
4063 	alc5505_dsp_back_from_halt(codec);
4064 	alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
4065 	alc5505_coef_set(codec, 0x61b0, 0x5b16);
4066 	alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
4067 	alc5505_coef_set(codec, 0x61b4, 0x04132b02);
4068 	alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
4069 	alc5505_coef_set(codec, 0x61b8, 0x041f3302);
4070 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
4071 	alc5505_coef_set(codec, 0x61b8, 0x041b3302);
4072 	alc5505_coef_set(codec, 0x61b8, 0x04173302);
4073 	alc5505_coef_set(codec, 0x61b8, 0x04163302);
4074 	alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4075 	alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4076 	alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4077 
4078 	val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4079 	if (val <= 3)
4080 		alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4081 	else
4082 		alc5505_coef_set(codec, 0x6220, 0x6002018f);
4083 
4084 	alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4085 	alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4086 	alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4087 	alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4088 	alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4089 	alc5505_coef_set(codec, 0x880c, 0x00000003);
4090 	alc5505_coef_set(codec, 0x880c, 0x00000010);
4091 
4092 #ifdef HALT_REALTEK_ALC5505
4093 	alc5505_dsp_halt(codec);
4094 #endif
4095 }
4096 
4097 #ifdef HALT_REALTEK_ALC5505
4098 #define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
4099 #define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
4100 #else
4101 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
4102 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
4103 #endif
4104 
4105 #ifdef CONFIG_PM
alc269_suspend(struct hda_codec * codec)4106 static int alc269_suspend(struct hda_codec *codec)
4107 {
4108 	struct alc_spec *spec = codec->spec;
4109 
4110 	if (spec->has_alc5505_dsp)
4111 		alc5505_dsp_suspend(codec);
4112 
4113 	return alc_suspend(codec);
4114 }
4115 
alc269_resume(struct hda_codec * codec)4116 static int alc269_resume(struct hda_codec *codec)
4117 {
4118 	struct alc_spec *spec = codec->spec;
4119 
4120 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4121 		alc269vb_toggle_power_output(codec, 0);
4122 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4123 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
4124 		msleep(150);
4125 	}
4126 
4127 	codec->patch_ops.init(codec);
4128 
4129 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4130 		alc269vb_toggle_power_output(codec, 1);
4131 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4132 			(alc_get_coef0(codec) & 0x00ff) == 0x017) {
4133 		msleep(200);
4134 	}
4135 
4136 	snd_hda_regmap_sync(codec);
4137 	hda_call_check_power_status(codec, 0x01);
4138 
4139 	/* on some machine, the BIOS will clear the codec gpio data when enter
4140 	 * suspend, and won't restore the data after resume, so we restore it
4141 	 * in the driver.
4142 	 */
4143 	if (spec->gpio_data)
4144 		alc_write_gpio_data(codec);
4145 
4146 	if (spec->has_alc5505_dsp)
4147 		alc5505_dsp_resume(codec);
4148 
4149 	return 0;
4150 }
4151 #endif /* CONFIG_PM */
4152 
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4153 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4154 						 const struct hda_fixup *fix, int action)
4155 {
4156 	struct alc_spec *spec = codec->spec;
4157 
4158 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4159 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4160 }
4161 
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4162 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4163 						 const struct hda_fixup *fix,
4164 						 int action)
4165 {
4166 	unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4167 	unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4168 
4169 	if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4170 		snd_hda_codec_set_pincfg(codec, 0x19,
4171 			(cfg_headphone & ~AC_DEFCFG_DEVICE) |
4172 			(AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4173 }
4174 
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4175 static void alc269_fixup_hweq(struct hda_codec *codec,
4176 			       const struct hda_fixup *fix, int action)
4177 {
4178 	if (action == HDA_FIXUP_ACT_INIT)
4179 		alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4180 }
4181 
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4182 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4183 				       const struct hda_fixup *fix, int action)
4184 {
4185 	struct alc_spec *spec = codec->spec;
4186 
4187 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4188 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4189 }
4190 
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4191 static void alc271_fixup_dmic(struct hda_codec *codec,
4192 			      const struct hda_fixup *fix, int action)
4193 {
4194 	static const struct hda_verb verbs[] = {
4195 		{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4196 		{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4197 		{}
4198 	};
4199 	unsigned int cfg;
4200 
4201 	if (strcmp(codec->core.chip_name, "ALC271X") &&
4202 	    strcmp(codec->core.chip_name, "ALC269VB"))
4203 		return;
4204 	cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4205 	if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4206 		snd_hda_sequence_write(codec, verbs);
4207 }
4208 
4209 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4210 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4211 					  const struct hda_fixup *fix,
4212 					  int action)
4213 {
4214 	if (action == HDA_FIXUP_ACT_INIT)
4215 		alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4216 }
4217 
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4218 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4219 				 const struct hda_fixup *fix, int action)
4220 {
4221 	struct alc_spec *spec = codec->spec;
4222 
4223 	if (action != HDA_FIXUP_ACT_PROBE)
4224 		return;
4225 
4226 	/* Due to a hardware problem on Lenovo Ideadpad, we need to
4227 	 * fix the sample rate of analog I/O to 44.1kHz
4228 	 */
4229 	spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4230 	spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4231 }
4232 
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4233 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4234 				     const struct hda_fixup *fix, int action)
4235 {
4236 	/* The digital-mic unit sends PDM (differential signal) instead of
4237 	 * the standard PCM, thus you can't record a valid mono stream as is.
4238 	 * Below is a workaround specific to ALC269 to control the dmic
4239 	 * signal source as mono.
4240 	 */
4241 	if (action == HDA_FIXUP_ACT_INIT)
4242 		alc_update_coef_idx(codec, 0x07, 0, 0x80);
4243 }
4244 
alc269_quanta_automute(struct hda_codec * codec)4245 static void alc269_quanta_automute(struct hda_codec *codec)
4246 {
4247 	snd_hda_gen_update_outputs(codec);
4248 
4249 	alc_write_coef_idx(codec, 0x0c, 0x680);
4250 	alc_write_coef_idx(codec, 0x0c, 0x480);
4251 }
4252 
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4253 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4254 				     const struct hda_fixup *fix, int action)
4255 {
4256 	struct alc_spec *spec = codec->spec;
4257 	if (action != HDA_FIXUP_ACT_PROBE)
4258 		return;
4259 	spec->gen.automute_hook = alc269_quanta_automute;
4260 }
4261 
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4262 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4263 					 struct hda_jack_callback *jack)
4264 {
4265 	struct alc_spec *spec = codec->spec;
4266 	int vref;
4267 	msleep(200);
4268 	snd_hda_gen_hp_automute(codec, jack);
4269 
4270 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4271 	msleep(100);
4272 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4273 			    vref);
4274 	msleep(500);
4275 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4276 			    vref);
4277 }
4278 
4279 /*
4280  * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4281  */
4282 struct hda_alc298_mbxinit {
4283 	unsigned char value_0x23;
4284 	unsigned char value_0x25;
4285 };
4286 
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4287 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4288 					 const struct hda_alc298_mbxinit *initval,
4289 					 bool first)
4290 {
4291 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4292 	alc_write_coef_idx(codec, 0x26, 0xb000);
4293 
4294 	if (first)
4295 		snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4296 
4297 	snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4298 	alc_write_coef_idx(codec, 0x26, 0xf000);
4299 	alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4300 
4301 	if (initval->value_0x23 != 0x1e)
4302 		alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4303 
4304 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4305 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4306 }
4307 
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4308 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4309 					   const struct hda_fixup *fix,
4310 					   int action)
4311 {
4312 	/* Initialization magic */
4313 	static const struct hda_alc298_mbxinit dac_init[] = {
4314 		{0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4315 		{0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4316 		{0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4317 		{0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4318 		{0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4319 		{0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4320 		{0x2f, 0x00},
4321 		{0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4322 		{0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4323 		{0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4324 		{}
4325 	};
4326 	const struct hda_alc298_mbxinit *seq;
4327 
4328 	if (action != HDA_FIXUP_ACT_INIT)
4329 		return;
4330 
4331 	/* Start */
4332 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4333 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4334 	alc_write_coef_idx(codec, 0x26, 0xf000);
4335 	alc_write_coef_idx(codec, 0x22, 0x31);
4336 	alc_write_coef_idx(codec, 0x23, 0x0b);
4337 	alc_write_coef_idx(codec, 0x25, 0x00);
4338 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4339 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4340 
4341 	for (seq = dac_init; seq->value_0x23; seq++)
4342 		alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4343 }
4344 
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4345 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4346 				     const struct hda_fixup *fix, int action)
4347 {
4348 	struct alc_spec *spec = codec->spec;
4349 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4350 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4351 		spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4352 	}
4353 }
4354 
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4355 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4356 				bool polarity, bool on)
4357 {
4358 	unsigned int pinval;
4359 
4360 	if (!pin)
4361 		return;
4362 	if (polarity)
4363 		on = !on;
4364 	pinval = snd_hda_codec_get_pin_target(codec, pin);
4365 	pinval &= ~AC_PINCTL_VREFEN;
4366 	pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4367 	/* temporarily power up/down for setting VREF */
4368 	snd_hda_power_up_pm(codec);
4369 	snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4370 	snd_hda_power_down_pm(codec);
4371 }
4372 
4373 /* update mute-LED according to the speaker mute state via mic VREF pin */
vref_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4374 static int vref_mute_led_set(struct led_classdev *led_cdev,
4375 			     enum led_brightness brightness)
4376 {
4377 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4378 	struct alc_spec *spec = codec->spec;
4379 
4380 	alc_update_vref_led(codec, spec->mute_led_nid,
4381 			    spec->mute_led_polarity, brightness);
4382 	return 0;
4383 }
4384 
4385 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4386 static unsigned int led_power_filter(struct hda_codec *codec,
4387 						  hda_nid_t nid,
4388 						  unsigned int power_state)
4389 {
4390 	struct alc_spec *spec = codec->spec;
4391 
4392 	if (power_state != AC_PWRST_D3 || nid == 0 ||
4393 	    (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4394 		return power_state;
4395 
4396 	/* Set pin ctl again, it might have just been set to 0 */
4397 	snd_hda_set_pin_ctl(codec, nid,
4398 			    snd_hda_codec_get_pin_target(codec, nid));
4399 
4400 	return snd_hda_gen_path_power_filter(codec, nid, power_state);
4401 }
4402 
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4403 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4404 				     const struct hda_fixup *fix, int action)
4405 {
4406 	struct alc_spec *spec = codec->spec;
4407 	const struct dmi_device *dev = NULL;
4408 
4409 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4410 		return;
4411 
4412 	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4413 		int pol, pin;
4414 		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4415 			continue;
4416 		if (pin < 0x0a || pin >= 0x10)
4417 			break;
4418 		spec->mute_led_polarity = pol;
4419 		spec->mute_led_nid = pin - 0x0a + 0x18;
4420 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4421 		codec->power_filter = led_power_filter;
4422 		codec_dbg(codec,
4423 			  "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4424 			   spec->mute_led_polarity);
4425 		break;
4426 	}
4427 }
4428 
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4429 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4430 					  const struct hda_fixup *fix,
4431 					  int action, hda_nid_t pin)
4432 {
4433 	struct alc_spec *spec = codec->spec;
4434 
4435 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4436 		spec->mute_led_polarity = 0;
4437 		spec->mute_led_nid = pin;
4438 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4439 		codec->power_filter = led_power_filter;
4440 	}
4441 }
4442 
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4443 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4444 				const struct hda_fixup *fix, int action)
4445 {
4446 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4447 }
4448 
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4449 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4450 				const struct hda_fixup *fix, int action)
4451 {
4452 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4453 }
4454 
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4455 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4456 				const struct hda_fixup *fix, int action)
4457 {
4458 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4459 }
4460 
4461 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4462 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4463 				int polarity, bool enabled)
4464 {
4465 	if (polarity)
4466 		enabled = !enabled;
4467 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4468 }
4469 
4470 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4471 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4472 			     enum led_brightness brightness)
4473 {
4474 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4475 	struct alc_spec *spec = codec->spec;
4476 
4477 	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4478 			    spec->mute_led_polarity, !brightness);
4479 	return 0;
4480 }
4481 
4482 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4483 static int micmute_led_set(struct led_classdev *led_cdev,
4484 			   enum led_brightness brightness)
4485 {
4486 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4487 	struct alc_spec *spec = codec->spec;
4488 
4489 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4490 			    spec->micmute_led_polarity, !brightness);
4491 	return 0;
4492 }
4493 
4494 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
alc_fixup_hp_gpio_led(struct hda_codec * codec,int action,unsigned int mute_mask,unsigned int micmute_mask)4495 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4496 				  int action,
4497 				  unsigned int mute_mask,
4498 				  unsigned int micmute_mask)
4499 {
4500 	struct alc_spec *spec = codec->spec;
4501 
4502 	alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4503 
4504 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4505 		return;
4506 	if (mute_mask) {
4507 		spec->gpio_mute_led_mask = mute_mask;
4508 		snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4509 	}
4510 	if (micmute_mask) {
4511 		spec->gpio_mic_led_mask = micmute_mask;
4512 		snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4513 	}
4514 }
4515 
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4516 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4517 				const struct hda_fixup *fix, int action)
4518 {
4519 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4520 }
4521 
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4522 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4523 				const struct hda_fixup *fix, int action)
4524 {
4525 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4526 }
4527 
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4528 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4529 				const struct hda_fixup *fix, int action)
4530 {
4531 	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4532 }
4533 
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4534 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4535 				const struct hda_fixup *fix, int action)
4536 {
4537 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4538 }
4539 
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4540 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4541 				const struct hda_fixup *fix, int action)
4542 {
4543 	alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4544 }
4545 
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4546 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4547 				const struct hda_fixup *fix, int action)
4548 {
4549 	struct alc_spec *spec = codec->spec;
4550 
4551 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4552 		spec->micmute_led_polarity = 1;
4553 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4554 }
4555 
4556 /* turn on/off mic-mute LED per capture hook via VREF change */
vref_micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4557 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4558 				enum led_brightness brightness)
4559 {
4560 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4561 	struct alc_spec *spec = codec->spec;
4562 
4563 	alc_update_vref_led(codec, spec->cap_mute_led_nid,
4564 			    spec->micmute_led_polarity, brightness);
4565 	return 0;
4566 }
4567 
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4568 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4569 				const struct hda_fixup *fix, int action)
4570 {
4571 	struct alc_spec *spec = codec->spec;
4572 
4573 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4574 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4575 		/* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4576 		 * enable headphone amp
4577 		 */
4578 		spec->gpio_mask |= 0x10;
4579 		spec->gpio_dir |= 0x10;
4580 		spec->cap_mute_led_nid = 0x18;
4581 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4582 		codec->power_filter = led_power_filter;
4583 	}
4584 }
4585 
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4586 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4587 				   const struct hda_fixup *fix, int action)
4588 {
4589 	struct alc_spec *spec = codec->spec;
4590 
4591 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4592 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4593 		spec->cap_mute_led_nid = 0x18;
4594 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4595 		codec->power_filter = led_power_filter;
4596 	}
4597 }
4598 
4599 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4600  * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4601  */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4602 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4603 				     const struct hda_fixup *fix, int action)
4604 {
4605 	struct alc_spec *spec = codec->spec;
4606 
4607 	switch (action) {
4608 	case HDA_FIXUP_ACT_PRE_PROBE:
4609 		spec->gpio_mask |= 0x01;
4610 		spec->gpio_dir |= 0x01;
4611 		break;
4612 	case HDA_FIXUP_ACT_INIT:
4613 		/* need to toggle GPIO to enable the amp */
4614 		alc_update_gpio_data(codec, 0x01, true);
4615 		msleep(100);
4616 		alc_update_gpio_data(codec, 0x01, false);
4617 		break;
4618 	}
4619 }
4620 
4621 /* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
alc274_hp_envy_pcm_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)4622 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4623 				    struct hda_codec *codec,
4624 				    struct snd_pcm_substream *substream,
4625 				    int action)
4626 {
4627 	switch (action) {
4628 	case HDA_GEN_PCM_ACT_PREPARE:
4629 		alc_update_gpio_data(codec, 0x04, true);
4630 		break;
4631 	case HDA_GEN_PCM_ACT_CLEANUP:
4632 		alc_update_gpio_data(codec, 0x04, false);
4633 		break;
4634 	}
4635 }
4636 
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4637 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4638 				      const struct hda_fixup *fix,
4639 				      int action)
4640 {
4641 	struct alc_spec *spec = codec->spec;
4642 
4643 	if (action == HDA_FIXUP_ACT_PROBE) {
4644 		spec->gpio_mask |= 0x04;
4645 		spec->gpio_dir |= 0x04;
4646 		spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4647 	}
4648 }
4649 
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4650 static void alc_update_coef_led(struct hda_codec *codec,
4651 				struct alc_coef_led *led,
4652 				bool polarity, bool on)
4653 {
4654 	if (polarity)
4655 		on = !on;
4656 	/* temporarily power up/down for setting COEF bit */
4657 	alc_update_coef_idx(codec, led->idx, led->mask,
4658 			    on ? led->on : led->off);
4659 }
4660 
4661 /* update mute-LED according to the speaker mute state via COEF bit */
coef_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4662 static int coef_mute_led_set(struct led_classdev *led_cdev,
4663 			     enum led_brightness brightness)
4664 {
4665 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4666 	struct alc_spec *spec = codec->spec;
4667 
4668 	alc_update_coef_led(codec, &spec->mute_led_coef,
4669 			    spec->mute_led_polarity, brightness);
4670 	return 0;
4671 }
4672 
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4673 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4674 					  const struct hda_fixup *fix,
4675 					  int action)
4676 {
4677 	struct alc_spec *spec = codec->spec;
4678 
4679 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4680 		spec->mute_led_polarity = 0;
4681 		spec->mute_led_coef.idx = 0x0b;
4682 		spec->mute_led_coef.mask = 1 << 3;
4683 		spec->mute_led_coef.on = 1 << 3;
4684 		spec->mute_led_coef.off = 0;
4685 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4686 	}
4687 }
4688 
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4689 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4690 					  const struct hda_fixup *fix,
4691 					  int action)
4692 {
4693 	struct alc_spec *spec = codec->spec;
4694 
4695 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4696 		spec->mute_led_polarity = 0;
4697 		spec->mute_led_coef.idx = 0x34;
4698 		spec->mute_led_coef.mask = 1 << 5;
4699 		spec->mute_led_coef.on = 0;
4700 		spec->mute_led_coef.off = 1 << 5;
4701 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4702 	}
4703 }
4704 
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4705 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4706 					  const struct hda_fixup *fix, int action)
4707 {
4708 	struct alc_spec *spec = codec->spec;
4709 
4710 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4711 		spec->mute_led_polarity = 0;
4712 		spec->mute_led_coef.idx = 0x07;
4713 		spec->mute_led_coef.mask = 1;
4714 		spec->mute_led_coef.on = 1;
4715 		spec->mute_led_coef.off = 0;
4716 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4717 	}
4718 }
4719 
alc245_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4720 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4721 					  const struct hda_fixup *fix,
4722 					  int action)
4723 {
4724 	struct alc_spec *spec = codec->spec;
4725 
4726 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4727 		spec->mute_led_polarity = 0;
4728 		spec->mute_led_coef.idx = 0x0b;
4729 		spec->mute_led_coef.mask = 3 << 2;
4730 		spec->mute_led_coef.on = 2 << 2;
4731 		spec->mute_led_coef.off = 1 << 2;
4732 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4733 	}
4734 }
4735 
4736 /* turn on/off mic-mute LED per capture hook by coef bit */
coef_micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4737 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4738 				enum led_brightness brightness)
4739 {
4740 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4741 	struct alc_spec *spec = codec->spec;
4742 
4743 	alc_update_coef_led(codec, &spec->mic_led_coef,
4744 			    spec->micmute_led_polarity, brightness);
4745 	return 0;
4746 }
4747 
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4748 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4749 				const struct hda_fixup *fix, int action)
4750 {
4751 	struct alc_spec *spec = codec->spec;
4752 
4753 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4754 		spec->mic_led_coef.idx = 0x19;
4755 		spec->mic_led_coef.mask = 1 << 13;
4756 		spec->mic_led_coef.on = 1 << 13;
4757 		spec->mic_led_coef.off = 0;
4758 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4759 	}
4760 }
4761 
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4762 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4763 				const struct hda_fixup *fix, int action)
4764 {
4765 	struct alc_spec *spec = codec->spec;
4766 
4767 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4768 		spec->micmute_led_polarity = 1;
4769 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4770 }
4771 
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4772 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4773 				const struct hda_fixup *fix, int action)
4774 {
4775 	struct alc_spec *spec = codec->spec;
4776 
4777 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4778 		spec->mic_led_coef.idx = 0x35;
4779 		spec->mic_led_coef.mask = 3 << 2;
4780 		spec->mic_led_coef.on = 2 << 2;
4781 		spec->mic_led_coef.off = 1 << 2;
4782 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4783 	}
4784 }
4785 
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4786 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4787 				const struct hda_fixup *fix, int action)
4788 {
4789 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4790 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4791 }
4792 
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4793 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4794 				const struct hda_fixup *fix, int action)
4795 {
4796 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4797 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4798 }
4799 
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4800 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4801 				const struct hda_fixup *fix, int action)
4802 {
4803 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4804 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4805 }
4806 
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4807 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4808 				const struct hda_fixup *fix, int action)
4809 {
4810 	struct alc_spec *spec = codec->spec;
4811 
4812 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4813 		spec->cap_mute_led_nid = 0x1a;
4814 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4815 		codec->power_filter = led_power_filter;
4816 	}
4817 }
4818 
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4819 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4820 				const struct hda_fixup *fix, int action)
4821 {
4822 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4823 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4824 }
4825 
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4826 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4827 						  const unsigned short coefs[2])
4828 {
4829 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4830 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4831 	alc_write_coef_idx(codec, 0x26, 0xb011);
4832 }
4833 
4834 struct alc298_samsung_amp_desc {
4835 	unsigned char nid;
4836 	unsigned short init_seq[2][2];
4837 };
4838 
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4839 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4840 				     const struct hda_fixup *fix, int action)
4841 {
4842 	int i, j;
4843 	static const unsigned short init_seq[][2] = {
4844 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4845 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4846 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4847 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4848 	};
4849 	static const struct alc298_samsung_amp_desc amps[] = {
4850 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4851 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4852 	};
4853 
4854 	if (action != HDA_FIXUP_ACT_INIT)
4855 		return;
4856 
4857 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4858 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4859 
4860 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4861 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4862 
4863 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4864 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4865 	}
4866 }
4867 
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)4868 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4869 				   struct hda_jack_callback *event)
4870 {
4871 	struct alc_spec *spec = codec->spec;
4872 
4873 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4874 	   send both key on and key off event for every interrupt. */
4875 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4876 	input_sync(spec->kb_dev);
4877 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4878 	input_sync(spec->kb_dev);
4879 }
4880 
alc_register_micmute_input_device(struct hda_codec * codec)4881 static int alc_register_micmute_input_device(struct hda_codec *codec)
4882 {
4883 	struct alc_spec *spec = codec->spec;
4884 	int i;
4885 
4886 	spec->kb_dev = input_allocate_device();
4887 	if (!spec->kb_dev) {
4888 		codec_err(codec, "Out of memory (input_allocate_device)\n");
4889 		return -ENOMEM;
4890 	}
4891 
4892 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4893 
4894 	spec->kb_dev->name = "Microphone Mute Button";
4895 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4896 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4897 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4898 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4899 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4900 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4901 
4902 	if (input_register_device(spec->kb_dev)) {
4903 		codec_err(codec, "input_register_device failed\n");
4904 		input_free_device(spec->kb_dev);
4905 		spec->kb_dev = NULL;
4906 		return -ENOMEM;
4907 	}
4908 
4909 	return 0;
4910 }
4911 
4912 /* GPIO1 = set according to SKU external amp
4913  * GPIO2 = mic mute hotkey
4914  * GPIO3 = mute LED
4915  * GPIO4 = mic mute LED
4916  */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4917 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4918 					     const struct hda_fixup *fix, int action)
4919 {
4920 	struct alc_spec *spec = codec->spec;
4921 
4922 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4923 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4924 		spec->init_amp = ALC_INIT_DEFAULT;
4925 		if (alc_register_micmute_input_device(codec) != 0)
4926 			return;
4927 
4928 		spec->gpio_mask |= 0x06;
4929 		spec->gpio_dir |= 0x02;
4930 		spec->gpio_data |= 0x02;
4931 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4932 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4933 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4934 						    gpio2_mic_hotkey_event);
4935 		return;
4936 	}
4937 
4938 	if (!spec->kb_dev)
4939 		return;
4940 
4941 	switch (action) {
4942 	case HDA_FIXUP_ACT_FREE:
4943 		input_unregister_device(spec->kb_dev);
4944 		spec->kb_dev = NULL;
4945 	}
4946 }
4947 
4948 /* Line2 = mic mute hotkey
4949  * GPIO2 = mic mute LED
4950  */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4951 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4952 					     const struct hda_fixup *fix, int action)
4953 {
4954 	struct alc_spec *spec = codec->spec;
4955 
4956 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4957 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4958 		spec->init_amp = ALC_INIT_DEFAULT;
4959 		if (alc_register_micmute_input_device(codec) != 0)
4960 			return;
4961 
4962 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
4963 						    gpio2_mic_hotkey_event);
4964 		return;
4965 	}
4966 
4967 	if (!spec->kb_dev)
4968 		return;
4969 
4970 	switch (action) {
4971 	case HDA_FIXUP_ACT_FREE:
4972 		input_unregister_device(spec->kb_dev);
4973 		spec->kb_dev = NULL;
4974 	}
4975 }
4976 
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4977 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4978 				const struct hda_fixup *fix, int action)
4979 {
4980 	struct alc_spec *spec = codec->spec;
4981 
4982 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4983 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4984 		spec->cap_mute_led_nid = 0x18;
4985 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4986 	}
4987 }
4988 
alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4989 static void alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec *codec,
4990 				const struct hda_fixup *fix, int action)
4991 {
4992 	struct alc_spec *spec = codec->spec;
4993 
4994 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4995 		spec->micmute_led_polarity = 1;
4996 	alc233_fixup_lenovo_line2_mic_hotkey(codec, fix, action);
4997 }
4998 
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)4999 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
5000 {
5001 	if (delay <= 0)
5002 		delay = 75;
5003 	snd_hda_codec_write(codec, 0x21, 0,
5004 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5005 	msleep(delay);
5006 	snd_hda_codec_write(codec, 0x21, 0,
5007 		    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5008 	msleep(delay);
5009 }
5010 
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)5011 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
5012 {
5013 	if (delay <= 0)
5014 		delay = 75;
5015 	snd_hda_codec_write(codec, 0x21, 0,
5016 		    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5017 	msleep(delay);
5018 	snd_hda_codec_write(codec, 0x21, 0,
5019 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5020 	msleep(delay);
5021 }
5022 
5023 static const struct coef_fw alc225_pre_hsmode[] = {
5024 	UPDATE_COEF(0x4a, 1<<8, 0),
5025 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
5026 	UPDATE_COEF(0x63, 3<<14, 3<<14),
5027 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
5028 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
5029 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
5030 	UPDATE_COEF(0x4a, 3<<10, 0),
5031 	{}
5032 };
5033 
alc_headset_mode_unplugged(struct hda_codec * codec)5034 static void alc_headset_mode_unplugged(struct hda_codec *codec)
5035 {
5036 	struct alc_spec *spec = codec->spec;
5037 	static const struct coef_fw coef0255[] = {
5038 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
5039 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5040 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5041 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5042 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
5043 		{}
5044 	};
5045 	static const struct coef_fw coef0256[] = {
5046 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
5047 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5048 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5049 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
5050 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5051 		{}
5052 	};
5053 	static const struct coef_fw coef0233[] = {
5054 		WRITE_COEF(0x1b, 0x0c0b),
5055 		WRITE_COEF(0x45, 0xc429),
5056 		UPDATE_COEF(0x35, 0x4000, 0),
5057 		WRITE_COEF(0x06, 0x2104),
5058 		WRITE_COEF(0x1a, 0x0001),
5059 		WRITE_COEF(0x26, 0x0004),
5060 		WRITE_COEF(0x32, 0x42a3),
5061 		{}
5062 	};
5063 	static const struct coef_fw coef0288[] = {
5064 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5065 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5066 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5067 		UPDATE_COEF(0x66, 0x0008, 0),
5068 		UPDATE_COEF(0x67, 0x2000, 0),
5069 		{}
5070 	};
5071 	static const struct coef_fw coef0298[] = {
5072 		UPDATE_COEF(0x19, 0x1300, 0x0300),
5073 		{}
5074 	};
5075 	static const struct coef_fw coef0292[] = {
5076 		WRITE_COEF(0x76, 0x000e),
5077 		WRITE_COEF(0x6c, 0x2400),
5078 		WRITE_COEF(0x18, 0x7308),
5079 		WRITE_COEF(0x6b, 0xc429),
5080 		{}
5081 	};
5082 	static const struct coef_fw coef0293[] = {
5083 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5084 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5085 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5086 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5087 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5088 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5089 		{}
5090 	};
5091 	static const struct coef_fw coef0668[] = {
5092 		WRITE_COEF(0x15, 0x0d40),
5093 		WRITE_COEF(0xb7, 0x802b),
5094 		{}
5095 	};
5096 	static const struct coef_fw coef0225[] = {
5097 		UPDATE_COEF(0x63, 3<<14, 0),
5098 		{}
5099 	};
5100 	static const struct coef_fw coef0274[] = {
5101 		UPDATE_COEF(0x4a, 0x0100, 0),
5102 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5103 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
5104 		UPDATE_COEF(0x4a, 0x0010, 0),
5105 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5106 		WRITE_COEF(0x45, 0x5289),
5107 		UPDATE_COEF(0x4a, 0x0c00, 0),
5108 		{}
5109 	};
5110 
5111 	if (spec->no_internal_mic_pin) {
5112 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5113 		return;
5114 	}
5115 
5116 	switch (codec->core.vendor_id) {
5117 	case 0x10ec0255:
5118 		alc_process_coef_fw(codec, coef0255);
5119 		break;
5120 	case 0x10ec0230:
5121 	case 0x10ec0236:
5122 	case 0x10ec0256:
5123 	case 0x19e58326:
5124 		alc_hp_mute_disable(codec, 75);
5125 		alc_process_coef_fw(codec, coef0256);
5126 		break;
5127 	case 0x10ec0234:
5128 	case 0x10ec0274:
5129 	case 0x10ec0294:
5130 		alc_process_coef_fw(codec, coef0274);
5131 		break;
5132 	case 0x10ec0233:
5133 	case 0x10ec0283:
5134 		alc_process_coef_fw(codec, coef0233);
5135 		break;
5136 	case 0x10ec0286:
5137 	case 0x10ec0288:
5138 		alc_process_coef_fw(codec, coef0288);
5139 		break;
5140 	case 0x10ec0298:
5141 		alc_process_coef_fw(codec, coef0298);
5142 		alc_process_coef_fw(codec, coef0288);
5143 		break;
5144 	case 0x10ec0292:
5145 		alc_process_coef_fw(codec, coef0292);
5146 		break;
5147 	case 0x10ec0293:
5148 		alc_process_coef_fw(codec, coef0293);
5149 		break;
5150 	case 0x10ec0668:
5151 		alc_process_coef_fw(codec, coef0668);
5152 		break;
5153 	case 0x10ec0215:
5154 	case 0x10ec0225:
5155 	case 0x10ec0285:
5156 	case 0x10ec0295:
5157 	case 0x10ec0289:
5158 	case 0x10ec0299:
5159 		alc_hp_mute_disable(codec, 75);
5160 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5161 		alc_process_coef_fw(codec, coef0225);
5162 		break;
5163 	case 0x10ec0867:
5164 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5165 		break;
5166 	}
5167 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5168 }
5169 
5170 
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5171 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5172 				    hda_nid_t mic_pin)
5173 {
5174 	static const struct coef_fw coef0255[] = {
5175 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5176 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5177 		{}
5178 	};
5179 	static const struct coef_fw coef0256[] = {
5180 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5181 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5182 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5183 		{}
5184 	};
5185 	static const struct coef_fw coef0233[] = {
5186 		UPDATE_COEF(0x35, 0, 1<<14),
5187 		WRITE_COEF(0x06, 0x2100),
5188 		WRITE_COEF(0x1a, 0x0021),
5189 		WRITE_COEF(0x26, 0x008c),
5190 		{}
5191 	};
5192 	static const struct coef_fw coef0288[] = {
5193 		UPDATE_COEF(0x4f, 0x00c0, 0),
5194 		UPDATE_COEF(0x50, 0x2000, 0),
5195 		UPDATE_COEF(0x56, 0x0006, 0),
5196 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5197 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5198 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5199 		{}
5200 	};
5201 	static const struct coef_fw coef0292[] = {
5202 		WRITE_COEF(0x19, 0xa208),
5203 		WRITE_COEF(0x2e, 0xacf0),
5204 		{}
5205 	};
5206 	static const struct coef_fw coef0293[] = {
5207 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5208 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5209 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5210 		{}
5211 	};
5212 	static const struct coef_fw coef0688[] = {
5213 		WRITE_COEF(0xb7, 0x802b),
5214 		WRITE_COEF(0xb5, 0x1040),
5215 		UPDATE_COEF(0xc3, 0, 1<<12),
5216 		{}
5217 	};
5218 	static const struct coef_fw coef0225[] = {
5219 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5220 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5221 		UPDATE_COEF(0x63, 3<<14, 0),
5222 		{}
5223 	};
5224 	static const struct coef_fw coef0274[] = {
5225 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5226 		UPDATE_COEF(0x4a, 0x0010, 0),
5227 		UPDATE_COEF(0x6b, 0xf000, 0),
5228 		{}
5229 	};
5230 
5231 	switch (codec->core.vendor_id) {
5232 	case 0x10ec0255:
5233 		alc_write_coef_idx(codec, 0x45, 0xc489);
5234 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5235 		alc_process_coef_fw(codec, coef0255);
5236 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5237 		break;
5238 	case 0x10ec0230:
5239 	case 0x10ec0236:
5240 	case 0x10ec0256:
5241 	case 0x19e58326:
5242 		alc_write_coef_idx(codec, 0x45, 0xc489);
5243 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5244 		alc_process_coef_fw(codec, coef0256);
5245 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5246 		break;
5247 	case 0x10ec0234:
5248 	case 0x10ec0274:
5249 	case 0x10ec0294:
5250 		alc_write_coef_idx(codec, 0x45, 0x4689);
5251 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5252 		alc_process_coef_fw(codec, coef0274);
5253 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5254 		break;
5255 	case 0x10ec0233:
5256 	case 0x10ec0283:
5257 		alc_write_coef_idx(codec, 0x45, 0xc429);
5258 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5259 		alc_process_coef_fw(codec, coef0233);
5260 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5261 		break;
5262 	case 0x10ec0286:
5263 	case 0x10ec0288:
5264 	case 0x10ec0298:
5265 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5266 		alc_process_coef_fw(codec, coef0288);
5267 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5268 		break;
5269 	case 0x10ec0292:
5270 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5271 		alc_process_coef_fw(codec, coef0292);
5272 		break;
5273 	case 0x10ec0293:
5274 		/* Set to TRS mode */
5275 		alc_write_coef_idx(codec, 0x45, 0xc429);
5276 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5277 		alc_process_coef_fw(codec, coef0293);
5278 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5279 		break;
5280 	case 0x10ec0867:
5281 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5282 		fallthrough;
5283 	case 0x10ec0221:
5284 	case 0x10ec0662:
5285 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5286 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5287 		break;
5288 	case 0x10ec0668:
5289 		alc_write_coef_idx(codec, 0x11, 0x0001);
5290 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5291 		alc_process_coef_fw(codec, coef0688);
5292 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5293 		break;
5294 	case 0x10ec0215:
5295 	case 0x10ec0225:
5296 	case 0x10ec0285:
5297 	case 0x10ec0295:
5298 	case 0x10ec0289:
5299 	case 0x10ec0299:
5300 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5301 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5302 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5303 		alc_process_coef_fw(codec, coef0225);
5304 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5305 		break;
5306 	}
5307 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5308 }
5309 
alc_headset_mode_default(struct hda_codec * codec)5310 static void alc_headset_mode_default(struct hda_codec *codec)
5311 {
5312 	static const struct coef_fw coef0225[] = {
5313 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5314 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5315 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5316 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5317 		UPDATE_COEF(0x63, 3<<14, 0),
5318 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5319 		{}
5320 	};
5321 	static const struct coef_fw coef0255[] = {
5322 		WRITE_COEF(0x45, 0xc089),
5323 		WRITE_COEF(0x45, 0xc489),
5324 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5325 		WRITE_COEF(0x49, 0x0049),
5326 		{}
5327 	};
5328 	static const struct coef_fw coef0256[] = {
5329 		WRITE_COEF(0x45, 0xc489),
5330 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5331 		WRITE_COEF(0x49, 0x0049),
5332 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5333 		WRITE_COEF(0x06, 0x6100),
5334 		{}
5335 	};
5336 	static const struct coef_fw coef0233[] = {
5337 		WRITE_COEF(0x06, 0x2100),
5338 		WRITE_COEF(0x32, 0x4ea3),
5339 		{}
5340 	};
5341 	static const struct coef_fw coef0288[] = {
5342 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5343 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5344 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5345 		UPDATE_COEF(0x66, 0x0008, 0),
5346 		UPDATE_COEF(0x67, 0x2000, 0),
5347 		{}
5348 	};
5349 	static const struct coef_fw coef0292[] = {
5350 		WRITE_COEF(0x76, 0x000e),
5351 		WRITE_COEF(0x6c, 0x2400),
5352 		WRITE_COEF(0x6b, 0xc429),
5353 		WRITE_COEF(0x18, 0x7308),
5354 		{}
5355 	};
5356 	static const struct coef_fw coef0293[] = {
5357 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5358 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5359 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5360 		{}
5361 	};
5362 	static const struct coef_fw coef0688[] = {
5363 		WRITE_COEF(0x11, 0x0041),
5364 		WRITE_COEF(0x15, 0x0d40),
5365 		WRITE_COEF(0xb7, 0x802b),
5366 		{}
5367 	};
5368 	static const struct coef_fw coef0274[] = {
5369 		WRITE_COEF(0x45, 0x4289),
5370 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5371 		UPDATE_COEF(0x6b, 0x0f00, 0),
5372 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5373 		{}
5374 	};
5375 
5376 	switch (codec->core.vendor_id) {
5377 	case 0x10ec0215:
5378 	case 0x10ec0225:
5379 	case 0x10ec0285:
5380 	case 0x10ec0295:
5381 	case 0x10ec0289:
5382 	case 0x10ec0299:
5383 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5384 		alc_process_coef_fw(codec, coef0225);
5385 		alc_hp_enable_unmute(codec, 75);
5386 		break;
5387 	case 0x10ec0255:
5388 		alc_process_coef_fw(codec, coef0255);
5389 		break;
5390 	case 0x10ec0230:
5391 	case 0x10ec0236:
5392 	case 0x10ec0256:
5393 	case 0x19e58326:
5394 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5395 		alc_write_coef_idx(codec, 0x45, 0xc089);
5396 		msleep(50);
5397 		alc_process_coef_fw(codec, coef0256);
5398 		alc_hp_enable_unmute(codec, 75);
5399 		break;
5400 	case 0x10ec0234:
5401 	case 0x10ec0274:
5402 	case 0x10ec0294:
5403 		alc_process_coef_fw(codec, coef0274);
5404 		break;
5405 	case 0x10ec0233:
5406 	case 0x10ec0283:
5407 		alc_process_coef_fw(codec, coef0233);
5408 		break;
5409 	case 0x10ec0286:
5410 	case 0x10ec0288:
5411 	case 0x10ec0298:
5412 		alc_process_coef_fw(codec, coef0288);
5413 		break;
5414 	case 0x10ec0292:
5415 		alc_process_coef_fw(codec, coef0292);
5416 		break;
5417 	case 0x10ec0293:
5418 		alc_process_coef_fw(codec, coef0293);
5419 		break;
5420 	case 0x10ec0668:
5421 		alc_process_coef_fw(codec, coef0688);
5422 		break;
5423 	case 0x10ec0867:
5424 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5425 		break;
5426 	}
5427 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5428 }
5429 
5430 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5431 static void alc_headset_mode_ctia(struct hda_codec *codec)
5432 {
5433 	int val;
5434 
5435 	static const struct coef_fw coef0255[] = {
5436 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5437 		WRITE_COEF(0x1b, 0x0c2b),
5438 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5439 		{}
5440 	};
5441 	static const struct coef_fw coef0256[] = {
5442 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5443 		WRITE_COEF(0x1b, 0x0e6b),
5444 		{}
5445 	};
5446 	static const struct coef_fw coef0233[] = {
5447 		WRITE_COEF(0x45, 0xd429),
5448 		WRITE_COEF(0x1b, 0x0c2b),
5449 		WRITE_COEF(0x32, 0x4ea3),
5450 		{}
5451 	};
5452 	static const struct coef_fw coef0288[] = {
5453 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5454 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5455 		UPDATE_COEF(0x66, 0x0008, 0),
5456 		UPDATE_COEF(0x67, 0x2000, 0),
5457 		{}
5458 	};
5459 	static const struct coef_fw coef0292[] = {
5460 		WRITE_COEF(0x6b, 0xd429),
5461 		WRITE_COEF(0x76, 0x0008),
5462 		WRITE_COEF(0x18, 0x7388),
5463 		{}
5464 	};
5465 	static const struct coef_fw coef0293[] = {
5466 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5467 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5468 		{}
5469 	};
5470 	static const struct coef_fw coef0688[] = {
5471 		WRITE_COEF(0x11, 0x0001),
5472 		WRITE_COEF(0x15, 0x0d60),
5473 		WRITE_COEF(0xc3, 0x0000),
5474 		{}
5475 	};
5476 	static const struct coef_fw coef0225_1[] = {
5477 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5478 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5479 		{}
5480 	};
5481 	static const struct coef_fw coef0225_2[] = {
5482 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5483 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5484 		{}
5485 	};
5486 
5487 	switch (codec->core.vendor_id) {
5488 	case 0x10ec0255:
5489 		alc_process_coef_fw(codec, coef0255);
5490 		break;
5491 	case 0x10ec0230:
5492 	case 0x10ec0236:
5493 	case 0x10ec0256:
5494 	case 0x19e58326:
5495 		alc_process_coef_fw(codec, coef0256);
5496 		alc_hp_enable_unmute(codec, 75);
5497 		break;
5498 	case 0x10ec0234:
5499 	case 0x10ec0274:
5500 	case 0x10ec0294:
5501 		alc_write_coef_idx(codec, 0x45, 0xd689);
5502 		break;
5503 	case 0x10ec0233:
5504 	case 0x10ec0283:
5505 		alc_process_coef_fw(codec, coef0233);
5506 		break;
5507 	case 0x10ec0298:
5508 		val = alc_read_coef_idx(codec, 0x50);
5509 		if (val & (1 << 12)) {
5510 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5511 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5512 			msleep(300);
5513 		} else {
5514 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5515 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5516 			msleep(300);
5517 		}
5518 		break;
5519 	case 0x10ec0286:
5520 	case 0x10ec0288:
5521 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5522 		msleep(300);
5523 		alc_process_coef_fw(codec, coef0288);
5524 		break;
5525 	case 0x10ec0292:
5526 		alc_process_coef_fw(codec, coef0292);
5527 		break;
5528 	case 0x10ec0293:
5529 		alc_process_coef_fw(codec, coef0293);
5530 		break;
5531 	case 0x10ec0668:
5532 		alc_process_coef_fw(codec, coef0688);
5533 		break;
5534 	case 0x10ec0215:
5535 	case 0x10ec0225:
5536 	case 0x10ec0285:
5537 	case 0x10ec0295:
5538 	case 0x10ec0289:
5539 	case 0x10ec0299:
5540 		val = alc_read_coef_idx(codec, 0x45);
5541 		if (val & (1 << 9))
5542 			alc_process_coef_fw(codec, coef0225_2);
5543 		else
5544 			alc_process_coef_fw(codec, coef0225_1);
5545 		alc_hp_enable_unmute(codec, 75);
5546 		break;
5547 	case 0x10ec0867:
5548 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5549 		break;
5550 	}
5551 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5552 }
5553 
5554 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5555 static void alc_headset_mode_omtp(struct hda_codec *codec)
5556 {
5557 	static const struct coef_fw coef0255[] = {
5558 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5559 		WRITE_COEF(0x1b, 0x0c2b),
5560 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5561 		{}
5562 	};
5563 	static const struct coef_fw coef0256[] = {
5564 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5565 		WRITE_COEF(0x1b, 0x0e6b),
5566 		{}
5567 	};
5568 	static const struct coef_fw coef0233[] = {
5569 		WRITE_COEF(0x45, 0xe429),
5570 		WRITE_COEF(0x1b, 0x0c2b),
5571 		WRITE_COEF(0x32, 0x4ea3),
5572 		{}
5573 	};
5574 	static const struct coef_fw coef0288[] = {
5575 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5576 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5577 		UPDATE_COEF(0x66, 0x0008, 0),
5578 		UPDATE_COEF(0x67, 0x2000, 0),
5579 		{}
5580 	};
5581 	static const struct coef_fw coef0292[] = {
5582 		WRITE_COEF(0x6b, 0xe429),
5583 		WRITE_COEF(0x76, 0x0008),
5584 		WRITE_COEF(0x18, 0x7388),
5585 		{}
5586 	};
5587 	static const struct coef_fw coef0293[] = {
5588 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5589 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5590 		{}
5591 	};
5592 	static const struct coef_fw coef0688[] = {
5593 		WRITE_COEF(0x11, 0x0001),
5594 		WRITE_COEF(0x15, 0x0d50),
5595 		WRITE_COEF(0xc3, 0x0000),
5596 		{}
5597 	};
5598 	static const struct coef_fw coef0225[] = {
5599 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5600 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5601 		{}
5602 	};
5603 
5604 	switch (codec->core.vendor_id) {
5605 	case 0x10ec0255:
5606 		alc_process_coef_fw(codec, coef0255);
5607 		break;
5608 	case 0x10ec0230:
5609 	case 0x10ec0236:
5610 	case 0x10ec0256:
5611 	case 0x19e58326:
5612 		alc_process_coef_fw(codec, coef0256);
5613 		alc_hp_enable_unmute(codec, 75);
5614 		break;
5615 	case 0x10ec0234:
5616 	case 0x10ec0274:
5617 	case 0x10ec0294:
5618 		alc_write_coef_idx(codec, 0x45, 0xe689);
5619 		break;
5620 	case 0x10ec0233:
5621 	case 0x10ec0283:
5622 		alc_process_coef_fw(codec, coef0233);
5623 		break;
5624 	case 0x10ec0298:
5625 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5626 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5627 		msleep(300);
5628 		break;
5629 	case 0x10ec0286:
5630 	case 0x10ec0288:
5631 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5632 		msleep(300);
5633 		alc_process_coef_fw(codec, coef0288);
5634 		break;
5635 	case 0x10ec0292:
5636 		alc_process_coef_fw(codec, coef0292);
5637 		break;
5638 	case 0x10ec0293:
5639 		alc_process_coef_fw(codec, coef0293);
5640 		break;
5641 	case 0x10ec0668:
5642 		alc_process_coef_fw(codec, coef0688);
5643 		break;
5644 	case 0x10ec0215:
5645 	case 0x10ec0225:
5646 	case 0x10ec0285:
5647 	case 0x10ec0295:
5648 	case 0x10ec0289:
5649 	case 0x10ec0299:
5650 		alc_process_coef_fw(codec, coef0225);
5651 		alc_hp_enable_unmute(codec, 75);
5652 		break;
5653 	}
5654 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5655 }
5656 
alc_determine_headset_type(struct hda_codec * codec)5657 static void alc_determine_headset_type(struct hda_codec *codec)
5658 {
5659 	int val;
5660 	bool is_ctia = false;
5661 	struct alc_spec *spec = codec->spec;
5662 	static const struct coef_fw coef0255[] = {
5663 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5664 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5665  conteol) */
5666 		{}
5667 	};
5668 	static const struct coef_fw coef0288[] = {
5669 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5670 		{}
5671 	};
5672 	static const struct coef_fw coef0298[] = {
5673 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5674 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5675 		UPDATE_COEF(0x66, 0x0008, 0),
5676 		UPDATE_COEF(0x67, 0x2000, 0),
5677 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5678 		{}
5679 	};
5680 	static const struct coef_fw coef0293[] = {
5681 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5682 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5683 		{}
5684 	};
5685 	static const struct coef_fw coef0688[] = {
5686 		WRITE_COEF(0x11, 0x0001),
5687 		WRITE_COEF(0xb7, 0x802b),
5688 		WRITE_COEF(0x15, 0x0d60),
5689 		WRITE_COEF(0xc3, 0x0c00),
5690 		{}
5691 	};
5692 	static const struct coef_fw coef0274[] = {
5693 		UPDATE_COEF(0x4a, 0x0010, 0),
5694 		UPDATE_COEF(0x4a, 0x8000, 0),
5695 		WRITE_COEF(0x45, 0xd289),
5696 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5697 		{}
5698 	};
5699 
5700 	if (spec->no_internal_mic_pin) {
5701 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5702 		return;
5703 	}
5704 
5705 	switch (codec->core.vendor_id) {
5706 	case 0x10ec0255:
5707 		alc_process_coef_fw(codec, coef0255);
5708 		msleep(300);
5709 		val = alc_read_coef_idx(codec, 0x46);
5710 		is_ctia = (val & 0x0070) == 0x0070;
5711 		break;
5712 	case 0x10ec0230:
5713 	case 0x10ec0236:
5714 	case 0x10ec0256:
5715 	case 0x19e58326:
5716 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5717 		alc_write_coef_idx(codec, 0x06, 0x6104);
5718 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5719 
5720 		alc_process_coef_fw(codec, coef0255);
5721 		msleep(300);
5722 		val = alc_read_coef_idx(codec, 0x46);
5723 		is_ctia = (val & 0x0070) == 0x0070;
5724 		if (!is_ctia) {
5725 			alc_write_coef_idx(codec, 0x45, 0xe089);
5726 			msleep(100);
5727 			val = alc_read_coef_idx(codec, 0x46);
5728 			if ((val & 0x0070) == 0x0070)
5729 				is_ctia = false;
5730 			else
5731 				is_ctia = true;
5732 		}
5733 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5734 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5735 		break;
5736 	case 0x10ec0234:
5737 	case 0x10ec0274:
5738 	case 0x10ec0294:
5739 		alc_process_coef_fw(codec, coef0274);
5740 		msleep(850);
5741 		val = alc_read_coef_idx(codec, 0x46);
5742 		is_ctia = (val & 0x00f0) == 0x00f0;
5743 		break;
5744 	case 0x10ec0233:
5745 	case 0x10ec0283:
5746 		alc_write_coef_idx(codec, 0x45, 0xd029);
5747 		msleep(300);
5748 		val = alc_read_coef_idx(codec, 0x46);
5749 		is_ctia = (val & 0x0070) == 0x0070;
5750 		break;
5751 	case 0x10ec0298:
5752 		snd_hda_codec_write(codec, 0x21, 0,
5753 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5754 		msleep(100);
5755 		snd_hda_codec_write(codec, 0x21, 0,
5756 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5757 		msleep(200);
5758 
5759 		val = alc_read_coef_idx(codec, 0x50);
5760 		if (val & (1 << 12)) {
5761 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5762 			alc_process_coef_fw(codec, coef0288);
5763 			msleep(350);
5764 			val = alc_read_coef_idx(codec, 0x50);
5765 			is_ctia = (val & 0x0070) == 0x0070;
5766 		} else {
5767 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5768 			alc_process_coef_fw(codec, coef0288);
5769 			msleep(350);
5770 			val = alc_read_coef_idx(codec, 0x50);
5771 			is_ctia = (val & 0x0070) == 0x0070;
5772 		}
5773 		alc_process_coef_fw(codec, coef0298);
5774 		snd_hda_codec_write(codec, 0x21, 0,
5775 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5776 		msleep(75);
5777 		snd_hda_codec_write(codec, 0x21, 0,
5778 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5779 		break;
5780 	case 0x10ec0286:
5781 	case 0x10ec0288:
5782 		alc_process_coef_fw(codec, coef0288);
5783 		msleep(350);
5784 		val = alc_read_coef_idx(codec, 0x50);
5785 		is_ctia = (val & 0x0070) == 0x0070;
5786 		break;
5787 	case 0x10ec0292:
5788 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5789 		msleep(300);
5790 		val = alc_read_coef_idx(codec, 0x6c);
5791 		is_ctia = (val & 0x001c) == 0x001c;
5792 		break;
5793 	case 0x10ec0293:
5794 		alc_process_coef_fw(codec, coef0293);
5795 		msleep(300);
5796 		val = alc_read_coef_idx(codec, 0x46);
5797 		is_ctia = (val & 0x0070) == 0x0070;
5798 		break;
5799 	case 0x10ec0668:
5800 		alc_process_coef_fw(codec, coef0688);
5801 		msleep(300);
5802 		val = alc_read_coef_idx(codec, 0xbe);
5803 		is_ctia = (val & 0x1c02) == 0x1c02;
5804 		break;
5805 	case 0x10ec0215:
5806 	case 0x10ec0225:
5807 	case 0x10ec0285:
5808 	case 0x10ec0295:
5809 	case 0x10ec0289:
5810 	case 0x10ec0299:
5811 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5812 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5813 		val = alc_read_coef_idx(codec, 0x45);
5814 		if (val & (1 << 9)) {
5815 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5816 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5817 			msleep(800);
5818 			val = alc_read_coef_idx(codec, 0x46);
5819 			is_ctia = (val & 0x00f0) == 0x00f0;
5820 		} else {
5821 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5822 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5823 			msleep(800);
5824 			val = alc_read_coef_idx(codec, 0x46);
5825 			is_ctia = (val & 0x00f0) == 0x00f0;
5826 		}
5827 		if (!is_ctia) {
5828 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5829 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5830 			msleep(100);
5831 			val = alc_read_coef_idx(codec, 0x46);
5832 			if ((val & 0x00f0) == 0x00f0)
5833 				is_ctia = false;
5834 			else
5835 				is_ctia = true;
5836 		}
5837 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5838 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5839 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5840 		break;
5841 	case 0x10ec0867:
5842 		is_ctia = true;
5843 		break;
5844 	}
5845 
5846 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5847 		    is_ctia ? "yes" : "no");
5848 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5849 }
5850 
alc_update_headset_mode(struct hda_codec * codec)5851 static void alc_update_headset_mode(struct hda_codec *codec)
5852 {
5853 	struct alc_spec *spec = codec->spec;
5854 
5855 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5856 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
5857 
5858 	int new_headset_mode;
5859 
5860 	if (!snd_hda_jack_detect(codec, hp_pin))
5861 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5862 	else if (mux_pin == spec->headset_mic_pin)
5863 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5864 	else if (mux_pin == spec->headphone_mic_pin)
5865 		new_headset_mode = ALC_HEADSET_MODE_MIC;
5866 	else
5867 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5868 
5869 	if (new_headset_mode == spec->current_headset_mode) {
5870 		snd_hda_gen_update_outputs(codec);
5871 		return;
5872 	}
5873 
5874 	switch (new_headset_mode) {
5875 	case ALC_HEADSET_MODE_UNPLUGGED:
5876 		alc_headset_mode_unplugged(codec);
5877 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5878 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5879 		spec->gen.hp_jack_present = false;
5880 		break;
5881 	case ALC_HEADSET_MODE_HEADSET:
5882 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5883 			alc_determine_headset_type(codec);
5884 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5885 			alc_headset_mode_ctia(codec);
5886 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5887 			alc_headset_mode_omtp(codec);
5888 		spec->gen.hp_jack_present = true;
5889 		break;
5890 	case ALC_HEADSET_MODE_MIC:
5891 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5892 		spec->gen.hp_jack_present = false;
5893 		break;
5894 	case ALC_HEADSET_MODE_HEADPHONE:
5895 		alc_headset_mode_default(codec);
5896 		spec->gen.hp_jack_present = true;
5897 		break;
5898 	}
5899 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5900 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
5901 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5902 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5903 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5904 						  PIN_VREFHIZ);
5905 	}
5906 	spec->current_headset_mode = new_headset_mode;
5907 
5908 	snd_hda_gen_update_outputs(codec);
5909 }
5910 
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)5911 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5912 					 struct snd_kcontrol *kcontrol,
5913 					 struct snd_ctl_elem_value *ucontrol)
5914 {
5915 	alc_update_headset_mode(codec);
5916 }
5917 
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5918 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5919 				       struct hda_jack_callback *jack)
5920 {
5921 	snd_hda_gen_hp_automute(codec, jack);
5922 	alc_update_headset_mode(codec);
5923 }
5924 
alc_probe_headset_mode(struct hda_codec * codec)5925 static void alc_probe_headset_mode(struct hda_codec *codec)
5926 {
5927 	int i;
5928 	struct alc_spec *spec = codec->spec;
5929 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5930 
5931 	/* Find mic pins */
5932 	for (i = 0; i < cfg->num_inputs; i++) {
5933 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5934 			spec->headset_mic_pin = cfg->inputs[i].pin;
5935 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5936 			spec->headphone_mic_pin = cfg->inputs[i].pin;
5937 	}
5938 
5939 	WARN_ON(spec->gen.cap_sync_hook);
5940 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5941 	spec->gen.automute_hook = alc_update_headset_mode;
5942 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5943 }
5944 
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)5945 static void alc_fixup_headset_mode(struct hda_codec *codec,
5946 				const struct hda_fixup *fix, int action)
5947 {
5948 	struct alc_spec *spec = codec->spec;
5949 
5950 	switch (action) {
5951 	case HDA_FIXUP_ACT_PRE_PROBE:
5952 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5953 		break;
5954 	case HDA_FIXUP_ACT_PROBE:
5955 		alc_probe_headset_mode(codec);
5956 		break;
5957 	case HDA_FIXUP_ACT_INIT:
5958 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
5959 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5960 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5961 		}
5962 		alc_update_headset_mode(codec);
5963 		break;
5964 	}
5965 }
5966 
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5967 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5968 				const struct hda_fixup *fix, int action)
5969 {
5970 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5971 		struct alc_spec *spec = codec->spec;
5972 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5973 	}
5974 	else
5975 		alc_fixup_headset_mode(codec, fix, action);
5976 }
5977 
alc255_set_default_jack_type(struct hda_codec * codec)5978 static void alc255_set_default_jack_type(struct hda_codec *codec)
5979 {
5980 	/* Set to iphone type */
5981 	static const struct coef_fw alc255fw[] = {
5982 		WRITE_COEF(0x1b, 0x880b),
5983 		WRITE_COEF(0x45, 0xd089),
5984 		WRITE_COEF(0x1b, 0x080b),
5985 		WRITE_COEF(0x46, 0x0004),
5986 		WRITE_COEF(0x1b, 0x0c0b),
5987 		{}
5988 	};
5989 	static const struct coef_fw alc256fw[] = {
5990 		WRITE_COEF(0x1b, 0x884b),
5991 		WRITE_COEF(0x45, 0xd089),
5992 		WRITE_COEF(0x1b, 0x084b),
5993 		WRITE_COEF(0x46, 0x0004),
5994 		WRITE_COEF(0x1b, 0x0c4b),
5995 		{}
5996 	};
5997 	switch (codec->core.vendor_id) {
5998 	case 0x10ec0255:
5999 		alc_process_coef_fw(codec, alc255fw);
6000 		break;
6001 	case 0x10ec0230:
6002 	case 0x10ec0236:
6003 	case 0x10ec0256:
6004 	case 0x19e58326:
6005 		alc_process_coef_fw(codec, alc256fw);
6006 		break;
6007 	}
6008 	msleep(30);
6009 }
6010 
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)6011 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
6012 				const struct hda_fixup *fix, int action)
6013 {
6014 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6015 		alc255_set_default_jack_type(codec);
6016 	}
6017 	alc_fixup_headset_mode(codec, fix, action);
6018 }
6019 
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6020 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
6021 				const struct hda_fixup *fix, int action)
6022 {
6023 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6024 		struct alc_spec *spec = codec->spec;
6025 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6026 		alc255_set_default_jack_type(codec);
6027 	}
6028 	else
6029 		alc_fixup_headset_mode(codec, fix, action);
6030 }
6031 
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)6032 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
6033 				       struct hda_jack_callback *jack)
6034 {
6035 	struct alc_spec *spec = codec->spec;
6036 
6037 	alc_update_headset_jack_cb(codec, jack);
6038 	/* Headset Mic enable or disable, only for Dell Dino */
6039 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
6040 }
6041 
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)6042 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
6043 				const struct hda_fixup *fix, int action)
6044 {
6045 	alc_fixup_headset_mode(codec, fix, action);
6046 	if (action == HDA_FIXUP_ACT_PROBE) {
6047 		struct alc_spec *spec = codec->spec;
6048 		/* toggled via hp_automute_hook */
6049 		spec->gpio_mask |= 0x40;
6050 		spec->gpio_dir |= 0x40;
6051 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
6052 	}
6053 }
6054 
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6055 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
6056 					const struct hda_fixup *fix, int action)
6057 {
6058 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6059 		struct alc_spec *spec = codec->spec;
6060 		spec->gen.auto_mute_via_amp = 1;
6061 	}
6062 }
6063 
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)6064 static void alc_fixup_no_shutup(struct hda_codec *codec,
6065 				const struct hda_fixup *fix, int action)
6066 {
6067 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6068 		struct alc_spec *spec = codec->spec;
6069 		spec->no_shutup_pins = 1;
6070 	}
6071 }
6072 
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)6073 static void alc_fixup_disable_aamix(struct hda_codec *codec,
6074 				    const struct hda_fixup *fix, int action)
6075 {
6076 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6077 		struct alc_spec *spec = codec->spec;
6078 		/* Disable AA-loopback as it causes white noise */
6079 		spec->gen.mixer_nid = 0;
6080 	}
6081 }
6082 
6083 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
alc_fixup_tpt440_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6084 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6085 				  const struct hda_fixup *fix, int action)
6086 {
6087 	static const struct hda_pintbl pincfgs[] = {
6088 		{ 0x16, 0x21211010 }, /* dock headphone */
6089 		{ 0x19, 0x21a11010 }, /* dock mic */
6090 		{ }
6091 	};
6092 	struct alc_spec *spec = codec->spec;
6093 
6094 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6095 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6096 		codec->power_save_node = 0; /* avoid click noises */
6097 		snd_hda_apply_pincfgs(codec, pincfgs);
6098 	}
6099 }
6100 
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6101 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6102 				  const struct hda_fixup *fix, int action)
6103 {
6104 	static const struct hda_pintbl pincfgs[] = {
6105 		{ 0x17, 0x21211010 }, /* dock headphone */
6106 		{ 0x19, 0x21a11010 }, /* dock mic */
6107 		{ }
6108 	};
6109 	struct alc_spec *spec = codec->spec;
6110 
6111 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6112 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6113 		snd_hda_apply_pincfgs(codec, pincfgs);
6114 	} else if (action == HDA_FIXUP_ACT_INIT) {
6115 		/* Enable DOCK device */
6116 		snd_hda_codec_write(codec, 0x17, 0,
6117 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6118 		/* Enable DOCK device */
6119 		snd_hda_codec_write(codec, 0x19, 0,
6120 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6121 	}
6122 }
6123 
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6124 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6125 				  const struct hda_fixup *fix, int action)
6126 {
6127 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6128 	 * the speaker output becomes too low by some reason on Thinkpads with
6129 	 * ALC298 codec
6130 	 */
6131 	static const hda_nid_t preferred_pairs[] = {
6132 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6133 		0
6134 	};
6135 	struct alc_spec *spec = codec->spec;
6136 
6137 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6138 		spec->gen.preferred_dacs = preferred_pairs;
6139 }
6140 
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6141 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6142 				   const struct hda_fixup *fix, int action)
6143 {
6144 	static const hda_nid_t preferred_pairs[] = {
6145 		0x17, 0x02, 0x21, 0x03, 0
6146 	};
6147 	struct alc_spec *spec = codec->spec;
6148 
6149 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6150 		spec->gen.preferred_dacs = preferred_pairs;
6151 }
6152 
alc_shutup_dell_xps13(struct hda_codec * codec)6153 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6154 {
6155 	struct alc_spec *spec = codec->spec;
6156 	int hp_pin = alc_get_hp_pin(spec);
6157 
6158 	/* Prevent pop noises when headphones are plugged in */
6159 	snd_hda_codec_write(codec, hp_pin, 0,
6160 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6161 	msleep(20);
6162 }
6163 
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6164 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6165 				const struct hda_fixup *fix, int action)
6166 {
6167 	struct alc_spec *spec = codec->spec;
6168 	struct hda_input_mux *imux = &spec->gen.input_mux;
6169 	int i;
6170 
6171 	switch (action) {
6172 	case HDA_FIXUP_ACT_PRE_PROBE:
6173 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6174 		 * it causes a click noise at start up
6175 		 */
6176 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6177 		spec->shutup = alc_shutup_dell_xps13;
6178 		break;
6179 	case HDA_FIXUP_ACT_PROBE:
6180 		/* Make the internal mic the default input source. */
6181 		for (i = 0; i < imux->num_items; i++) {
6182 			if (spec->gen.imux_pins[i] == 0x12) {
6183 				spec->gen.cur_mux[0] = i;
6184 				break;
6185 			}
6186 		}
6187 		break;
6188 	}
6189 }
6190 
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6191 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6192 				const struct hda_fixup *fix, int action)
6193 {
6194 	struct alc_spec *spec = codec->spec;
6195 
6196 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6197 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6198 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6199 
6200 		/* Disable boost for mic-in permanently. (This code is only called
6201 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6202 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6203 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6204 	} else
6205 		alc_fixup_headset_mode(codec, fix, action);
6206 }
6207 
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6208 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6209 				const struct hda_fixup *fix, int action)
6210 {
6211 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6212 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6213 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6214 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6215 	}
6216 	alc_fixup_headset_mode(codec, fix, action);
6217 }
6218 
6219 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6220 static int find_ext_mic_pin(struct hda_codec *codec)
6221 {
6222 	struct alc_spec *spec = codec->spec;
6223 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6224 	hda_nid_t nid;
6225 	unsigned int defcfg;
6226 	int i;
6227 
6228 	for (i = 0; i < cfg->num_inputs; i++) {
6229 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6230 			continue;
6231 		nid = cfg->inputs[i].pin;
6232 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6233 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6234 			continue;
6235 		return nid;
6236 	}
6237 
6238 	return 0;
6239 }
6240 
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6241 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6242 				    const struct hda_fixup *fix,
6243 				    int action)
6244 {
6245 	struct alc_spec *spec = codec->spec;
6246 
6247 	if (action == HDA_FIXUP_ACT_PROBE) {
6248 		int mic_pin = find_ext_mic_pin(codec);
6249 		int hp_pin = alc_get_hp_pin(spec);
6250 
6251 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6252 			return;
6253 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6254 	}
6255 }
6256 
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6257 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6258 					     const struct hda_fixup *fix,
6259 					     int action)
6260 {
6261 	struct alc_spec *spec = codec->spec;
6262 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6263 	int i;
6264 
6265 	/* The mic boosts on level 2 and 3 are too noisy
6266 	   on the internal mic input.
6267 	   Therefore limit the boost to 0 or 1. */
6268 
6269 	if (action != HDA_FIXUP_ACT_PROBE)
6270 		return;
6271 
6272 	for (i = 0; i < cfg->num_inputs; i++) {
6273 		hda_nid_t nid = cfg->inputs[i].pin;
6274 		unsigned int defcfg;
6275 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6276 			continue;
6277 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6278 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6279 			continue;
6280 
6281 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6282 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6283 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6284 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6285 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6286 	}
6287 }
6288 
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6289 static void alc283_hp_automute_hook(struct hda_codec *codec,
6290 				    struct hda_jack_callback *jack)
6291 {
6292 	struct alc_spec *spec = codec->spec;
6293 	int vref;
6294 
6295 	msleep(200);
6296 	snd_hda_gen_hp_automute(codec, jack);
6297 
6298 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6299 
6300 	msleep(600);
6301 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6302 			    vref);
6303 }
6304 
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6305 static void alc283_fixup_chromebook(struct hda_codec *codec,
6306 				    const struct hda_fixup *fix, int action)
6307 {
6308 	struct alc_spec *spec = codec->spec;
6309 
6310 	switch (action) {
6311 	case HDA_FIXUP_ACT_PRE_PROBE:
6312 		snd_hda_override_wcaps(codec, 0x03, 0);
6313 		/* Disable AA-loopback as it causes white noise */
6314 		spec->gen.mixer_nid = 0;
6315 		break;
6316 	case HDA_FIXUP_ACT_INIT:
6317 		/* MIC2-VREF control */
6318 		/* Set to manual mode */
6319 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6320 		/* Enable Line1 input control by verb */
6321 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6322 		break;
6323 	}
6324 }
6325 
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6326 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6327 				    const struct hda_fixup *fix, int action)
6328 {
6329 	struct alc_spec *spec = codec->spec;
6330 
6331 	switch (action) {
6332 	case HDA_FIXUP_ACT_PRE_PROBE:
6333 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6334 		break;
6335 	case HDA_FIXUP_ACT_INIT:
6336 		/* MIC2-VREF control */
6337 		/* Set to manual mode */
6338 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6339 		break;
6340 	}
6341 }
6342 
6343 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6344 static void asus_tx300_automute(struct hda_codec *codec)
6345 {
6346 	struct alc_spec *spec = codec->spec;
6347 	snd_hda_gen_update_outputs(codec);
6348 	if (snd_hda_jack_detect(codec, 0x1b))
6349 		spec->gen.mute_bits |= (1ULL << 0x14);
6350 }
6351 
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6352 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6353 				    const struct hda_fixup *fix, int action)
6354 {
6355 	struct alc_spec *spec = codec->spec;
6356 	static const struct hda_pintbl dock_pins[] = {
6357 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6358 		{}
6359 	};
6360 
6361 	switch (action) {
6362 	case HDA_FIXUP_ACT_PRE_PROBE:
6363 		spec->init_amp = ALC_INIT_DEFAULT;
6364 		/* TX300 needs to set up GPIO2 for the speaker amp */
6365 		alc_setup_gpio(codec, 0x04);
6366 		snd_hda_apply_pincfgs(codec, dock_pins);
6367 		spec->gen.auto_mute_via_amp = 1;
6368 		spec->gen.automute_hook = asus_tx300_automute;
6369 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6370 						    snd_hda_gen_hp_automute);
6371 		break;
6372 	case HDA_FIXUP_ACT_PROBE:
6373 		spec->init_amp = ALC_INIT_DEFAULT;
6374 		break;
6375 	case HDA_FIXUP_ACT_BUILD:
6376 		/* this is a bit tricky; give more sane names for the main
6377 		 * (tablet) speaker and the dock speaker, respectively
6378 		 */
6379 		rename_ctl(codec, "Speaker Playback Switch",
6380 			   "Dock Speaker Playback Switch");
6381 		rename_ctl(codec, "Bass Speaker Playback Switch",
6382 			   "Speaker Playback Switch");
6383 		break;
6384 	}
6385 }
6386 
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6387 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6388 				       const struct hda_fixup *fix, int action)
6389 {
6390 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6391 		/* DAC node 0x03 is giving mono output. We therefore want to
6392 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6393 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6394 		static const hda_nid_t conn1[] = { 0x0c };
6395 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6396 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6397 	}
6398 }
6399 
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6400 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6401 					const struct hda_fixup *fix, int action)
6402 {
6403 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6404 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6405 		   we can't adjust the speaker's volume since this node does not has
6406 		   Amp-out capability. we change the speaker's route to:
6407 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6408 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6409 		   speaker's volume now. */
6410 
6411 		static const hda_nid_t conn1[] = { 0x0c };
6412 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6413 	}
6414 }
6415 
6416 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
alc295_fixup_disable_dac3(struct hda_codec * codec,const struct hda_fixup * fix,int action)6417 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6418 				      const struct hda_fixup *fix, int action)
6419 {
6420 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6421 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6422 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6423 	}
6424 }
6425 
6426 /* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
alc285_fixup_speaker2_to_dac1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6427 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6428 					  const struct hda_fixup *fix, int action)
6429 {
6430 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6431 		static const hda_nid_t conn[] = { 0x02 };
6432 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6433 	}
6434 }
6435 
6436 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6437 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6438 					  struct hda_jack_callback *jack)
6439 {
6440 	struct alc_spec *spec = codec->spec;
6441 
6442 	snd_hda_gen_hp_automute(codec, jack);
6443 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6444 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6445 			    !spec->gen.hp_jack_present);
6446 }
6447 
6448 /* Manage GPIOs for HP EliteBook Folio 9480m.
6449  *
6450  * GPIO4 is the headphone amplifier power control
6451  * GPIO3 is the audio output mute indicator LED
6452  */
6453 
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6454 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6455 				  const struct hda_fixup *fix,
6456 				  int action)
6457 {
6458 	struct alc_spec *spec = codec->spec;
6459 
6460 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6461 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6462 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6463 		spec->gpio_mask |= 0x10;
6464 		spec->gpio_dir |= 0x10;
6465 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6466 	}
6467 }
6468 
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6469 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6470 				   const struct hda_fixup *fix,
6471 				   int action)
6472 {
6473 	struct alc_spec *spec = codec->spec;
6474 
6475 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6476 		spec->gpio_mask |= 0x04;
6477 		spec->gpio_dir |= 0x04;
6478 		/* set data bit low */
6479 	}
6480 }
6481 
6482 /* Quirk for Thinkpad X1 7th and 8th Gen
6483  * The following fixed routing needed
6484  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6485  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6486  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6487  */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6488 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6489 					  const struct hda_fixup *fix, int action)
6490 {
6491 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6492 	static const hda_nid_t preferred_pairs[] = {
6493 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6494 	};
6495 	struct alc_spec *spec = codec->spec;
6496 
6497 	switch (action) {
6498 	case HDA_FIXUP_ACT_PRE_PROBE:
6499 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6500 		spec->gen.preferred_dacs = preferred_pairs;
6501 		break;
6502 	case HDA_FIXUP_ACT_BUILD:
6503 		/* The generic parser creates somewhat unintuitive volume ctls
6504 		 * with the fixed routing above, and the shared DAC2 may be
6505 		 * confusing for PA.
6506 		 * Rename those to unique names so that PA doesn't touch them
6507 		 * and use only Master volume.
6508 		 */
6509 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6510 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6511 		break;
6512 	}
6513 }
6514 
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6515 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6516 					 const struct hda_fixup *fix,
6517 					 int action)
6518 {
6519 	alc_fixup_dual_codecs(codec, fix, action);
6520 	switch (action) {
6521 	case HDA_FIXUP_ACT_PRE_PROBE:
6522 		/* override card longname to provide a unique UCM profile */
6523 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6524 		break;
6525 	case HDA_FIXUP_ACT_BUILD:
6526 		/* rename Capture controls depending on the codec */
6527 		rename_ctl(codec, "Capture Volume",
6528 			   codec->addr == 0 ?
6529 			   "Rear-Panel Capture Volume" :
6530 			   "Front-Panel Capture Volume");
6531 		rename_ctl(codec, "Capture Switch",
6532 			   codec->addr == 0 ?
6533 			   "Rear-Panel Capture Switch" :
6534 			   "Front-Panel Capture Switch");
6535 		break;
6536 	}
6537 }
6538 
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6539 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6540 				      const struct hda_fixup *fix, int action)
6541 {
6542 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6543 		return;
6544 
6545 	codec->power_save_node = 1;
6546 }
6547 
6548 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
alc274_fixup_bind_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6549 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6550 				    const struct hda_fixup *fix, int action)
6551 {
6552 	struct alc_spec *spec = codec->spec;
6553 	static const hda_nid_t preferred_pairs[] = {
6554 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6555 		0
6556 	};
6557 
6558 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6559 		return;
6560 
6561 	spec->gen.preferred_dacs = preferred_pairs;
6562 	spec->gen.auto_mute_via_amp = 1;
6563 	codec->power_save_node = 0;
6564 }
6565 
6566 /* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
alc289_fixup_asus_ga401(struct hda_codec * codec,const struct hda_fixup * fix,int action)6567 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6568 				    const struct hda_fixup *fix, int action)
6569 {
6570 	static const hda_nid_t preferred_pairs[] = {
6571 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6572 	};
6573 	struct alc_spec *spec = codec->spec;
6574 
6575 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6576 		spec->gen.preferred_dacs = preferred_pairs;
6577 		spec->gen.obey_preferred_dacs = 1;
6578 	}
6579 }
6580 
6581 /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
alc285_fixup_invalidate_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6582 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6583 			      const struct hda_fixup *fix, int action)
6584 {
6585 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6586 		return;
6587 
6588 	snd_hda_override_wcaps(codec, 0x03, 0);
6589 }
6590 
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6591 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6592 {
6593 	switch (codec->core.vendor_id) {
6594 	case 0x10ec0274:
6595 	case 0x10ec0294:
6596 	case 0x10ec0225:
6597 	case 0x10ec0295:
6598 	case 0x10ec0299:
6599 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6600 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6601 		break;
6602 	case 0x10ec0230:
6603 	case 0x10ec0235:
6604 	case 0x10ec0236:
6605 	case 0x10ec0255:
6606 	case 0x10ec0256:
6607 	case 0x10ec0257:
6608 	case 0x19e58326:
6609 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6610 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6611 		break;
6612 	}
6613 }
6614 
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6615 static void alc295_fixup_chromebook(struct hda_codec *codec,
6616 				    const struct hda_fixup *fix, int action)
6617 {
6618 	struct alc_spec *spec = codec->spec;
6619 
6620 	switch (action) {
6621 	case HDA_FIXUP_ACT_PRE_PROBE:
6622 		spec->ultra_low_power = true;
6623 		break;
6624 	case HDA_FIXUP_ACT_INIT:
6625 		alc_combo_jack_hp_jd_restart(codec);
6626 		break;
6627 	}
6628 }
6629 
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6630 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6631 				  const struct hda_fixup *fix, int action)
6632 {
6633 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6634 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6635 }
6636 
6637 
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6638 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6639 					struct hda_jack_callback *cb)
6640 {
6641 	/* The Windows driver sets the codec up in a very different way where
6642 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6643 	 */
6644 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6645 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6646 	else
6647 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6648 }
6649 
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6650 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6651 					const struct hda_fixup *fix, int action)
6652 {
6653 	/* Pin 0x21: headphones/headset mic */
6654 	if (!is_jack_detectable(codec, 0x21))
6655 		return;
6656 
6657 	switch (action) {
6658 	case HDA_FIXUP_ACT_PRE_PROBE:
6659 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6660 				alc294_gx502_toggle_output);
6661 		break;
6662 	case HDA_FIXUP_ACT_INIT:
6663 		/* Make sure to start in a correct state, i.e. if
6664 		 * headphones have been plugged in before powering up the system
6665 		 */
6666 		alc294_gx502_toggle_output(codec, NULL);
6667 		break;
6668 	}
6669 }
6670 
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6671 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6672 				       struct hda_jack_callback *cb)
6673 {
6674 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6675 	 * responsible from changes between speakers and headphones
6676 	 */
6677 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6678 		alc_write_coef_idx(codec, 0x10, 0x8420);
6679 	else
6680 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6681 }
6682 
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6683 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6684 				  const struct hda_fixup *fix, int action)
6685 {
6686 	if (!is_jack_detectable(codec, 0x21))
6687 		return;
6688 
6689 	switch (action) {
6690 	case HDA_FIXUP_ACT_PRE_PROBE:
6691 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6692 				alc294_gu502_toggle_output);
6693 		break;
6694 	case HDA_FIXUP_ACT_INIT:
6695 		alc294_gu502_toggle_output(codec, NULL);
6696 		break;
6697 	}
6698 }
6699 
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6700 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6701 			      const struct hda_fixup *fix, int action)
6702 {
6703 	if (action != HDA_FIXUP_ACT_INIT)
6704 		return;
6705 
6706 	msleep(100);
6707 	alc_write_coef_idx(codec, 0x65, 0x0);
6708 }
6709 
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6710 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6711 				    const struct hda_fixup *fix, int action)
6712 {
6713 	switch (action) {
6714 	case HDA_FIXUP_ACT_INIT:
6715 		alc_combo_jack_hp_jd_restart(codec);
6716 		break;
6717 	}
6718 }
6719 
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6720 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6721 				    const struct hda_fixup *fix, int action)
6722 {
6723 	struct alc_spec *spec = codec->spec;
6724 
6725 	switch (action) {
6726 	case HDA_FIXUP_ACT_PRE_PROBE:
6727 		/* Mic RING SLEEVE swap for combo jack */
6728 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6729 		spec->no_internal_mic_pin = true;
6730 		break;
6731 	case HDA_FIXUP_ACT_INIT:
6732 		alc_combo_jack_hp_jd_restart(codec);
6733 		break;
6734 	}
6735 }
6736 
6737 /* GPIO1 = amplifier on/off
6738  * GPIO3 = mic mute LED
6739  */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6740 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6741 					  const struct hda_fixup *fix, int action)
6742 {
6743 	static const hda_nid_t conn[] = { 0x02 };
6744 
6745 	struct alc_spec *spec = codec->spec;
6746 	static const struct hda_pintbl pincfgs[] = {
6747 		{ 0x14, 0x90170110 },  /* front/high speakers */
6748 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6749 		{ }
6750 	};
6751 
6752 	//enable micmute led
6753 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6754 
6755 	switch (action) {
6756 	case HDA_FIXUP_ACT_PRE_PROBE:
6757 		spec->micmute_led_polarity = 1;
6758 		/* needed for amp of back speakers */
6759 		spec->gpio_mask |= 0x01;
6760 		spec->gpio_dir |= 0x01;
6761 		snd_hda_apply_pincfgs(codec, pincfgs);
6762 		/* share DAC to have unified volume control */
6763 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6764 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6765 		break;
6766 	case HDA_FIXUP_ACT_INIT:
6767 		/* need to toggle GPIO to enable the amp of back speakers */
6768 		alc_update_gpio_data(codec, 0x01, true);
6769 		msleep(100);
6770 		alc_update_gpio_data(codec, 0x01, false);
6771 		break;
6772 	}
6773 }
6774 
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6775 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6776 					  const struct hda_fixup *fix, int action)
6777 {
6778 	static const hda_nid_t conn[] = { 0x02 };
6779 	static const struct hda_pintbl pincfgs[] = {
6780 		{ 0x14, 0x90170110 },  /* rear speaker */
6781 		{ }
6782 	};
6783 
6784 	switch (action) {
6785 	case HDA_FIXUP_ACT_PRE_PROBE:
6786 		snd_hda_apply_pincfgs(codec, pincfgs);
6787 		/* force front speaker to DAC1 */
6788 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6789 		break;
6790 	}
6791 }
6792 
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6793 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6794 				      const struct hda_fixup *fix,
6795 				      int action)
6796 {
6797 	static const struct coef_fw coefs[] = {
6798 		WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6799 		WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6800 		WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6801 		WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6802 		WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6803 		WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6804 		WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6805 		WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6806 		WRITE_COEF(0x6e, 0x1005), { }
6807 	};
6808 
6809 	static const struct hda_pintbl pincfgs[] = {
6810 		{ 0x12, 0xb7a60130 },  /* Internal microphone*/
6811 		{ 0x14, 0x90170150 },  /* B&O soundbar speakers */
6812 		{ 0x17, 0x90170153 },  /* Side speakers */
6813 		{ 0x19, 0x03a11040 },  /* Headset microphone */
6814 		{ }
6815 	};
6816 
6817 	switch (action) {
6818 	case HDA_FIXUP_ACT_PRE_PROBE:
6819 		snd_hda_apply_pincfgs(codec, pincfgs);
6820 
6821 		/* Fixes volume control problem for side speakers */
6822 		alc295_fixup_disable_dac3(codec, fix, action);
6823 
6824 		/* Fixes no sound from headset speaker */
6825 		snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
6826 
6827 		/* Auto-enable headset mic when plugged */
6828 		snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
6829 
6830 		/* Headset mic volume enhancement */
6831 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
6832 		break;
6833 	case HDA_FIXUP_ACT_INIT:
6834 		alc_process_coef_fw(codec, coefs);
6835 		break;
6836 	case HDA_FIXUP_ACT_BUILD:
6837 		rename_ctl(codec, "Bass Speaker Playback Volume",
6838 			   "B&O-Tuned Playback Volume");
6839 		rename_ctl(codec, "Front Playback Switch",
6840 			   "B&O Soundbar Playback Switch");
6841 		rename_ctl(codec, "Bass Speaker Playback Switch",
6842 			   "Side Speaker Playback Switch");
6843 		break;
6844 	}
6845 }
6846 
6847 /* for hda_fixup_thinkpad_acpi() */
6848 #include "thinkpad_helper.c"
6849 
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)6850 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6851 				    const struct hda_fixup *fix, int action)
6852 {
6853 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6854 	hda_fixup_thinkpad_acpi(codec, fix, action);
6855 }
6856 
6857 /* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
alc287_fixup_legion_15imhg05_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6858 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6859 						  const struct hda_fixup *fix,
6860 						  int action)
6861 {
6862 	struct alc_spec *spec = codec->spec;
6863 
6864 	switch (action) {
6865 	case HDA_FIXUP_ACT_PRE_PROBE:
6866 		spec->gen.suppress_auto_mute = 1;
6867 		break;
6868 	}
6869 }
6870 
comp_bind(struct device * dev)6871 static int comp_bind(struct device *dev)
6872 {
6873 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6874 	struct alc_spec *spec = cdc->spec;
6875 
6876 	return component_bind_all(dev, spec->comps);
6877 }
6878 
comp_unbind(struct device * dev)6879 static void comp_unbind(struct device *dev)
6880 {
6881 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6882 	struct alc_spec *spec = cdc->spec;
6883 
6884 	component_unbind_all(dev, spec->comps);
6885 }
6886 
6887 static const struct component_master_ops comp_master_ops = {
6888 	.bind = comp_bind,
6889 	.unbind = comp_unbind,
6890 };
6891 
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)6892 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6893 				       struct snd_pcm_substream *sub, int action)
6894 {
6895 	struct alc_spec *spec = cdc->spec;
6896 	int i;
6897 
6898 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6899 		if (spec->comps[i].dev && spec->comps[i].pre_playback_hook)
6900 			spec->comps[i].pre_playback_hook(spec->comps[i].dev, action);
6901 	}
6902 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6903 		if (spec->comps[i].dev && spec->comps[i].playback_hook)
6904 			spec->comps[i].playback_hook(spec->comps[i].dev, action);
6905 	}
6906 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6907 		if (spec->comps[i].dev && spec->comps[i].post_playback_hook)
6908 			spec->comps[i].post_playback_hook(spec->comps[i].dev, action);
6909 	}
6910 }
6911 
6912 struct scodec_dev_name {
6913 	const char *bus;
6914 	const char *hid;
6915 	int index;
6916 };
6917 
6918 /* match the device name in a slightly relaxed manner */
comp_match_cs35l41_dev_name(struct device * dev,void * data)6919 static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
6920 {
6921 	struct scodec_dev_name *p = data;
6922 	const char *d = dev_name(dev);
6923 	int n = strlen(p->bus);
6924 	char tmp[32];
6925 
6926 	/* check the bus name */
6927 	if (strncmp(d, p->bus, n))
6928 		return 0;
6929 	/* skip the bus number */
6930 	if (isdigit(d[n]))
6931 		n++;
6932 	/* the rest must be exact matching */
6933 	snprintf(tmp, sizeof(tmp), "-%s:00-cs35l41-hda.%d", p->hid, p->index);
6934 	return !strcmp(d + n, tmp);
6935 }
6936 
comp_match_tas2781_dev_name(struct device * dev,void * data)6937 static int comp_match_tas2781_dev_name(struct device *dev,
6938 	void *data)
6939 {
6940 	struct scodec_dev_name *p = data;
6941 	const char *d = dev_name(dev);
6942 	int n = strlen(p->bus);
6943 	char tmp[32];
6944 
6945 	/* check the bus name */
6946 	if (strncmp(d, p->bus, n))
6947 		return 0;
6948 	/* skip the bus number */
6949 	if (isdigit(d[n]))
6950 		n++;
6951 	/* the rest must be exact matching */
6952 	snprintf(tmp, sizeof(tmp), "-%s:00", p->hid);
6953 
6954 	return !strcmp(d + n, tmp);
6955 }
6956 
cs35l41_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,int count)6957 static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6958 				  const char *hid, int count)
6959 {
6960 	struct device *dev = hda_codec_dev(cdc);
6961 	struct alc_spec *spec = cdc->spec;
6962 	struct scodec_dev_name *rec;
6963 	int ret, i;
6964 
6965 	switch (action) {
6966 	case HDA_FIXUP_ACT_PRE_PROBE:
6967 		for (i = 0; i < count; i++) {
6968 			rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6969 			if (!rec)
6970 				return;
6971 			rec->bus = bus;
6972 			rec->hid = hid;
6973 			rec->index = i;
6974 			spec->comps[i].codec = cdc;
6975 			component_match_add(dev, &spec->match,
6976 					    comp_match_cs35l41_dev_name, rec);
6977 		}
6978 		ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6979 		if (ret)
6980 			codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6981 		else
6982 			spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6983 		break;
6984 	case HDA_FIXUP_ACT_FREE:
6985 		component_master_del(dev, &comp_master_ops);
6986 		break;
6987 	}
6988 }
6989 
tas2781_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid)6990 static void tas2781_generic_fixup(struct hda_codec *cdc, int action,
6991 	const char *bus, const char *hid)
6992 {
6993 	struct device *dev = hda_codec_dev(cdc);
6994 	struct alc_spec *spec = cdc->spec;
6995 	struct scodec_dev_name *rec;
6996 	int ret;
6997 
6998 	switch (action) {
6999 	case HDA_FIXUP_ACT_PRE_PROBE:
7000 		rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
7001 		if (!rec)
7002 			return;
7003 		rec->bus = bus;
7004 		rec->hid = hid;
7005 		rec->index = 0;
7006 		spec->comps[0].codec = cdc;
7007 		component_match_add(dev, &spec->match,
7008 			comp_match_tas2781_dev_name, rec);
7009 		ret = component_master_add_with_match(dev, &comp_master_ops,
7010 			spec->match);
7011 		if (ret)
7012 			codec_err(cdc,
7013 				"Fail to register component aggregator %d\n",
7014 				ret);
7015 		else
7016 			spec->gen.pcm_playback_hook =
7017 				comp_generic_playback_hook;
7018 		break;
7019 	case HDA_FIXUP_ACT_FREE:
7020 		component_master_del(dev, &comp_master_ops);
7021 		break;
7022 	}
7023 }
7024 
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7025 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7026 {
7027 	cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
7028 }
7029 
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)7030 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7031 {
7032 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2);
7033 }
7034 
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)7035 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7036 {
7037 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4);
7038 }
7039 
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7040 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7041 						 int action)
7042 {
7043 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
7044 }
7045 
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7046 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7047 						 int action)
7048 {
7049 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0101", 2);
7050 }
7051 
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7052 static void tas2781_fixup_i2c(struct hda_codec *cdc,
7053 	const struct hda_fixup *fix, int action)
7054 {
7055 	 tas2781_generic_fixup(cdc, action, "i2c", "TIAS2781");
7056 }
7057 
7058 /* for alc295_fixup_hp_top_speakers */
7059 #include "hp_x360_helper.c"
7060 
7061 /* for alc285_fixup_ideapad_s740_coef() */
7062 #include "ideapad_s740_helper.c"
7063 
7064 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
7065 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
7066 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
7067 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
7068 	{}
7069 };
7070 
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)7071 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
7072 					   const struct hda_fixup *fix,
7073 					   int action)
7074 {
7075 	/*
7076 	 * A certain other OS sets these coeffs to different values. On at least
7077 	 * one TongFang barebone these settings might survive even a cold
7078 	 * reboot. So to restore a clean slate the values are explicitly reset
7079 	 * to default here. Without this, the external microphone is always in a
7080 	 * plugged-in state, while the internal microphone is always in an
7081 	 * unplugged state, breaking the ability to use the internal microphone.
7082 	 */
7083 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7084 }
7085 
7086 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7087 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7088 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7089 	WRITE_COEF(0x49, 0x0149),
7090 	{}
7091 };
7092 
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7093 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7094 				       const struct hda_fixup *fix,
7095 				       int action)
7096 {
7097 	/*
7098 	 * The audio jack input and output is not detected on the ASRock NUC Box
7099 	 * 1100 series when cold booting without this fix. Warm rebooting from a
7100 	 * certain other OS makes the audio functional, as COEF settings are
7101 	 * preserved in this case. This fix sets these altered COEF values as
7102 	 * the default.
7103 	 */
7104 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7105 }
7106 
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7107 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7108 						    const struct hda_fixup *fix,
7109 						    int action)
7110 {
7111 	/*
7112 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7113 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7114 	 * needs an additional quirk for sound working after suspend and resume.
7115 	 */
7116 	if (codec->core.vendor_id == 0x10ec0256) {
7117 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7118 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7119 	} else {
7120 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7121 	}
7122 }
7123 
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7124 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7125 						  const struct hda_fixup *fix,
7126 						  int action)
7127 {
7128 	struct alc_spec *spec = codec->spec;
7129 	struct hda_input_mux *imux = &spec->gen.input_mux;
7130 	int i;
7131 
7132 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
7133 
7134 	switch (action) {
7135 	case HDA_FIXUP_ACT_PRE_PROBE:
7136 		/**
7137 		 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7138 		 * to Hi-Z to avoid pop noises at startup and when plugging and
7139 		 * unplugging headphones.
7140 		 */
7141 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7142 		snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7143 		break;
7144 	case HDA_FIXUP_ACT_PROBE:
7145 		/**
7146 		 * Make the internal mic (0x12) the default input source to
7147 		 * prevent pop noises on cold boot.
7148 		 */
7149 		for (i = 0; i < imux->num_items; i++) {
7150 			if (spec->gen.imux_pins[i] == 0x12) {
7151 				spec->gen.cur_mux[0] = i;
7152 				break;
7153 			}
7154 		}
7155 		break;
7156 	}
7157 }
7158 
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7159 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7160 					  const struct hda_fixup *fix, int action)
7161 {
7162 	/*
7163 	 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7164 	 * unconnected.
7165 	 */
7166 	static const struct hda_pintbl pincfgs[] = {
7167 		{ 0x17, 0x90170121 },
7168 		{ }
7169 	};
7170 	/*
7171 	 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7172 	 * DAC 0x02 and 0x03 would be fine.
7173 	 */
7174 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7175 	/*
7176 	 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7177 	 * Headphones (0x21) are connected to DAC 0x03.
7178 	 */
7179 	static const hda_nid_t preferred_pairs[] = {
7180 		0x14, 0x02,
7181 		0x17, 0x02,
7182 		0x21, 0x03,
7183 		0
7184 	};
7185 	struct alc_spec *spec = codec->spec;
7186 
7187 	switch (action) {
7188 	case HDA_FIXUP_ACT_PRE_PROBE:
7189 		snd_hda_apply_pincfgs(codec, pincfgs);
7190 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7191 		spec->gen.preferred_dacs = preferred_pairs;
7192 		break;
7193 	}
7194 }
7195 
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7196 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7197 					  const struct hda_fixup *fix, int action)
7198 {
7199 	static const struct hda_pintbl pincfgs[] = {
7200 		{ 0x14, 0x90170151 },
7201 		{ 0x17, 0x90170150 },
7202 		{ }
7203 	};
7204 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7205 	static const hda_nid_t preferred_pairs[] = {
7206 		0x14, 0x02,
7207 		0x17, 0x03,
7208 		0x21, 0x02,
7209 		0
7210 	};
7211 	struct alc_spec *spec = codec->spec;
7212 
7213 	alc_fixup_no_shutup(codec, fix, action);
7214 
7215 	switch (action) {
7216 	case HDA_FIXUP_ACT_PRE_PROBE:
7217 		snd_hda_apply_pincfgs(codec, pincfgs);
7218 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7219 		spec->gen.preferred_dacs = preferred_pairs;
7220 		break;
7221 	}
7222 }
7223 
7224 /* Forcibly assign NID 0x03 to HP while NID 0x02 to SPK */
alc287_fixup_bind_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)7225 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7226 				    const struct hda_fixup *fix, int action)
7227 {
7228 	struct alc_spec *spec = codec->spec;
7229 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7230 	static const hda_nid_t preferred_pairs[] = {
7231 		0x17, 0x02, 0x21, 0x03, 0
7232 	};
7233 
7234 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7235 		return;
7236 
7237 	snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7238 	spec->gen.preferred_dacs = preferred_pairs;
7239 	spec->gen.auto_mute_via_amp = 1;
7240 	if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7241 		snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7242 					0x0); /* Make sure 0x14 was disable */
7243 	}
7244 }
7245 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7246 static void alc_fixup_headset_mic(struct hda_codec *codec,
7247 				   const struct hda_fixup *fix, int action)
7248 {
7249 	struct alc_spec *spec = codec->spec;
7250 	static const struct hda_pintbl pincfgs[] = {
7251 		{ 0x19, 0x03a1103c },
7252 		{ }
7253 	};
7254 
7255 	switch (action) {
7256 	case HDA_FIXUP_ACT_PRE_PROBE:
7257 		snd_hda_apply_pincfgs(codec, pincfgs);
7258 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7259 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7260 		break;
7261 	}
7262 }
7263 
7264 
7265 enum {
7266 	ALC269_FIXUP_GPIO2,
7267 	ALC269_FIXUP_SONY_VAIO,
7268 	ALC275_FIXUP_SONY_VAIO_GPIO2,
7269 	ALC269_FIXUP_DELL_M101Z,
7270 	ALC269_FIXUP_SKU_IGNORE,
7271 	ALC269_FIXUP_ASUS_G73JW,
7272 	ALC269_FIXUP_ASUS_N7601ZM_PINS,
7273 	ALC269_FIXUP_ASUS_N7601ZM,
7274 	ALC269_FIXUP_LENOVO_EAPD,
7275 	ALC275_FIXUP_SONY_HWEQ,
7276 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
7277 	ALC271_FIXUP_DMIC,
7278 	ALC269_FIXUP_PCM_44K,
7279 	ALC269_FIXUP_STEREO_DMIC,
7280 	ALC269_FIXUP_HEADSET_MIC,
7281 	ALC269_FIXUP_QUANTA_MUTE,
7282 	ALC269_FIXUP_LIFEBOOK,
7283 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
7284 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
7285 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7286 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7287 	ALC269_FIXUP_AMIC,
7288 	ALC269_FIXUP_DMIC,
7289 	ALC269VB_FIXUP_AMIC,
7290 	ALC269VB_FIXUP_DMIC,
7291 	ALC269_FIXUP_HP_MUTE_LED,
7292 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
7293 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
7294 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
7295 	ALC269_FIXUP_HP_GPIO_LED,
7296 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
7297 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
7298 	ALC269_FIXUP_INV_DMIC,
7299 	ALC269_FIXUP_LENOVO_DOCK,
7300 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7301 	ALC269_FIXUP_NO_SHUTUP,
7302 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7303 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7304 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7305 	ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7306 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7307 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7308 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7309 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7310 	ALC269_FIXUP_HEADSET_MODE,
7311 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7312 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7313 	ALC269_FIXUP_ASUS_X101_FUNC,
7314 	ALC269_FIXUP_ASUS_X101_VERB,
7315 	ALC269_FIXUP_ASUS_X101,
7316 	ALC271_FIXUP_AMIC_MIC2,
7317 	ALC271_FIXUP_HP_GATE_MIC_JACK,
7318 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7319 	ALC269_FIXUP_ACER_AC700,
7320 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7321 	ALC269VB_FIXUP_ASUS_ZENBOOK,
7322 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7323 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7324 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7325 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
7326 	ALC283_FIXUP_CHROME_BOOK,
7327 	ALC283_FIXUP_SENSE_COMBO_JACK,
7328 	ALC282_FIXUP_ASUS_TX300,
7329 	ALC283_FIXUP_INT_MIC,
7330 	ALC290_FIXUP_MONO_SPEAKERS,
7331 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7332 	ALC290_FIXUP_SUBWOOFER,
7333 	ALC290_FIXUP_SUBWOOFER_HSJACK,
7334 	ALC269_FIXUP_THINKPAD_ACPI,
7335 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7336 	ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
7337 	ALC269VC_FIXUP_INFINIX_Y4_MAX,
7338 	ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7339 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7340 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7341 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7342 	ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7343 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7344 	ALC255_FIXUP_HEADSET_MODE,
7345 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7346 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7347 	ALC292_FIXUP_TPT440_DOCK,
7348 	ALC292_FIXUP_TPT440,
7349 	ALC283_FIXUP_HEADSET_MIC,
7350 	ALC255_FIXUP_MIC_MUTE_LED,
7351 	ALC282_FIXUP_ASPIRE_V5_PINS,
7352 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
7353 	ALC280_FIXUP_HP_GPIO4,
7354 	ALC286_FIXUP_HP_GPIO_LED,
7355 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7356 	ALC280_FIXUP_HP_DOCK_PINS,
7357 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7358 	ALC280_FIXUP_HP_9480M,
7359 	ALC245_FIXUP_HP_X360_AMP,
7360 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7361 	ALC285_FIXUP_HP_ENVY_X360,
7362 	ALC288_FIXUP_DELL_HEADSET_MODE,
7363 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7364 	ALC288_FIXUP_DELL_XPS_13,
7365 	ALC288_FIXUP_DISABLE_AAMIX,
7366 	ALC292_FIXUP_DELL_E7X_AAMIX,
7367 	ALC292_FIXUP_DELL_E7X,
7368 	ALC292_FIXUP_DISABLE_AAMIX,
7369 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7370 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7371 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7372 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7373 	ALC275_FIXUP_DELL_XPS,
7374 	ALC293_FIXUP_LENOVO_SPK_NOISE,
7375 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7376 	ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED,
7377 	ALC255_FIXUP_DELL_SPK_NOISE,
7378 	ALC225_FIXUP_DISABLE_MIC_VREF,
7379 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7380 	ALC295_FIXUP_DISABLE_DAC3,
7381 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
7382 	ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7383 	ALC285_FIXUP_ASUS_HEADSET_MIC,
7384 	ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7385 	ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7386 	ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7387 	ALC280_FIXUP_HP_HEADSET_MIC,
7388 	ALC221_FIXUP_HP_FRONT_MIC,
7389 	ALC292_FIXUP_TPT460,
7390 	ALC298_FIXUP_SPK_VOLUME,
7391 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
7392 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7393 	ALC269_FIXUP_ATIV_BOOK_8,
7394 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7395 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7396 	ALC256_FIXUP_ASUS_HEADSET_MODE,
7397 	ALC256_FIXUP_ASUS_MIC,
7398 	ALC256_FIXUP_ASUS_AIO_GPIO2,
7399 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7400 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7401 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
7402 	ALC233_FIXUP_ACER_HEADSET_MIC,
7403 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
7404 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7405 	ALC225_FIXUP_S3_POP_NOISE,
7406 	ALC700_FIXUP_INTEL_REFERENCE,
7407 	ALC274_FIXUP_DELL_BIND_DACS,
7408 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7409 	ALC298_FIXUP_TPT470_DOCK_FIX,
7410 	ALC298_FIXUP_TPT470_DOCK,
7411 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7412 	ALC255_FIXUP_DELL_HEADSET_MIC,
7413 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7414 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
7415 	ALC295_FIXUP_HP_X360,
7416 	ALC221_FIXUP_HP_HEADSET_MIC,
7417 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7418 	ALC295_FIXUP_HP_AUTO_MUTE,
7419 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7420 	ALC294_FIXUP_ASUS_MIC,
7421 	ALC294_FIXUP_ASUS_HEADSET_MIC,
7422 	ALC294_FIXUP_ASUS_SPK,
7423 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7424 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7425 	ALC255_FIXUP_ACER_HEADSET_MIC,
7426 	ALC295_FIXUP_CHROME_BOOK,
7427 	ALC225_FIXUP_HEADSET_JACK,
7428 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7429 	ALC225_FIXUP_WYSE_AUTO_MUTE,
7430 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7431 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7432 	ALC256_FIXUP_ASUS_HEADSET_MIC,
7433 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7434 	ALC255_FIXUP_PREDATOR_SUBWOOFER,
7435 	ALC299_FIXUP_PREDATOR_SPK,
7436 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7437 	ALC289_FIXUP_DELL_SPK1,
7438 	ALC289_FIXUP_DELL_SPK2,
7439 	ALC289_FIXUP_DUAL_SPK,
7440 	ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7441 	ALC294_FIXUP_SPK2_TO_DAC1,
7442 	ALC294_FIXUP_ASUS_DUAL_SPK,
7443 	ALC285_FIXUP_THINKPAD_X1_GEN7,
7444 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7445 	ALC294_FIXUP_ASUS_ALLY,
7446 	ALC294_FIXUP_ASUS_ALLY_PINS,
7447 	ALC294_FIXUP_ASUS_ALLY_VERBS,
7448 	ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7449 	ALC294_FIXUP_ASUS_HPE,
7450 	ALC294_FIXUP_ASUS_COEF_1B,
7451 	ALC294_FIXUP_ASUS_GX502_HP,
7452 	ALC294_FIXUP_ASUS_GX502_PINS,
7453 	ALC294_FIXUP_ASUS_GX502_VERBS,
7454 	ALC294_FIXUP_ASUS_GU502_HP,
7455 	ALC294_FIXUP_ASUS_GU502_PINS,
7456 	ALC294_FIXUP_ASUS_GU502_VERBS,
7457 	ALC294_FIXUP_ASUS_G513_PINS,
7458 	ALC285_FIXUP_ASUS_G533Z_PINS,
7459 	ALC285_FIXUP_HP_GPIO_LED,
7460 	ALC285_FIXUP_HP_MUTE_LED,
7461 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7462 	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7463 	ALC236_FIXUP_HP_GPIO_LED,
7464 	ALC236_FIXUP_HP_MUTE_LED,
7465 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7466 	ALC236_FIXUP_LENOVO_INV_DMIC,
7467 	ALC298_FIXUP_SAMSUNG_AMP,
7468 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7469 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7470 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7471 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7472 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
7473 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7474 	ALC289_FIXUP_ASUS_GA401,
7475 	ALC289_FIXUP_ASUS_GA502,
7476 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7477 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
7478 	ALC269_FIXUP_CZC_B20,
7479 	ALC269_FIXUP_CZC_TMI,
7480 	ALC269_FIXUP_CZC_L101,
7481 	ALC269_FIXUP_LEMOTE_A1802,
7482 	ALC269_FIXUP_LEMOTE_A190X,
7483 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
7484 	ALC233_FIXUP_INTEL_NUC8_DMIC,
7485 	ALC233_FIXUP_INTEL_NUC8_BOOST,
7486 	ALC256_FIXUP_INTEL_NUC10,
7487 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7488 	ALC274_FIXUP_HP_MIC,
7489 	ALC274_FIXUP_HP_HEADSET_MIC,
7490 	ALC274_FIXUP_HP_ENVY_GPIO,
7491 	ALC256_FIXUP_ASUS_HPE,
7492 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7493 	ALC287_FIXUP_HP_GPIO_LED,
7494 	ALC256_FIXUP_HP_HEADSET_MIC,
7495 	ALC245_FIXUP_HP_GPIO_LED,
7496 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7497 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7498 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7499 	ALC256_FIXUP_ACER_HEADSET_MIC,
7500 	ALC285_FIXUP_IDEAPAD_S740_COEF,
7501 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7502 	ALC295_FIXUP_ASUS_DACS,
7503 	ALC295_FIXUP_HP_OMEN,
7504 	ALC285_FIXUP_HP_SPECTRE_X360,
7505 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7506 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7507 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7508 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7509 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7510 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7511 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7512 	ALC298_FIXUP_LENOVO_C940_DUET7,
7513 	ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
7514 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
7515 	ALC256_FIXUP_SET_COEF_DEFAULTS,
7516 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7517 	ALC233_FIXUP_NO_AUDIO_JACK,
7518 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7519 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7520 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7521 	ALC287_FIXUP_LEGION_16ACHG6,
7522 	ALC287_FIXUP_CS35L41_I2C_2,
7523 	ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7524 	ALC245_FIXUP_CS35L41_SPI_2,
7525 	ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7526 	ALC245_FIXUP_CS35L41_SPI_4,
7527 	ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7528 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7529 	ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7530 	ALC287_FIXUP_LEGION_16ITHG6,
7531 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7532 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7533 	ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7534 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7535 	ALC236_FIXUP_DELL_DUAL_CODECS,
7536 	ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7537 	ALC287_FIXUP_TAS2781_I2C,
7538 	ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7539 	ALC245_FIXUP_HP_X360_MUTE_LEDS,
7540 	ALC287_FIXUP_THINKPAD_I2S_SPK,
7541 	ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7542 	ALC2XX_FIXUP_HEADSET_MIC,
7543 	ALC289_FIXUP_DELL_CS35L41_SPI_2,
7544 	ALC294_FIXUP_CS35L41_I2C_2,
7545 };
7546 
7547 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7548  * both have the very same PCI SSID, and we need to apply different fixups
7549  * depending on the codec ID
7550  */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)7551 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7552 					   const struct hda_fixup *fix,
7553 					   int action)
7554 {
7555 	int id;
7556 
7557 	if (codec->core.vendor_id == 0x10ec0298)
7558 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7559 	else
7560 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7561 	__snd_hda_apply_fixup(codec, id, action, 0);
7562 }
7563 
7564 /* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
7565  * 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
7566  * so we need to apply a different fixup in this case. The only DuetITL codec
7567  * SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
7568  * and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
7569  * have matched correctly by their codecs.
7570  */
alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec * codec,const struct hda_fixup * fix,int action)7571 static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
7572 					      const struct hda_fixup *fix,
7573 					      int action)
7574 {
7575 	int id;
7576 
7577 	if (codec->core.subsystem_id == 0x17aa3802)
7578 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
7579 	else
7580 		id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
7581 	__snd_hda_apply_fixup(codec, id, action, 0);
7582 }
7583 
7584 static const struct hda_fixup alc269_fixups[] = {
7585 	[ALC269_FIXUP_GPIO2] = {
7586 		.type = HDA_FIXUP_FUNC,
7587 		.v.func = alc_fixup_gpio2,
7588 	},
7589 	[ALC269_FIXUP_SONY_VAIO] = {
7590 		.type = HDA_FIXUP_PINCTLS,
7591 		.v.pins = (const struct hda_pintbl[]) {
7592 			{0x19, PIN_VREFGRD},
7593 			{}
7594 		}
7595 	},
7596 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7597 		.type = HDA_FIXUP_FUNC,
7598 		.v.func = alc275_fixup_gpio4_off,
7599 		.chained = true,
7600 		.chain_id = ALC269_FIXUP_SONY_VAIO
7601 	},
7602 	[ALC269_FIXUP_DELL_M101Z] = {
7603 		.type = HDA_FIXUP_VERBS,
7604 		.v.verbs = (const struct hda_verb[]) {
7605 			/* Enables internal speaker */
7606 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
7607 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7608 			{}
7609 		}
7610 	},
7611 	[ALC269_FIXUP_SKU_IGNORE] = {
7612 		.type = HDA_FIXUP_FUNC,
7613 		.v.func = alc_fixup_sku_ignore,
7614 	},
7615 	[ALC269_FIXUP_ASUS_G73JW] = {
7616 		.type = HDA_FIXUP_PINS,
7617 		.v.pins = (const struct hda_pintbl[]) {
7618 			{ 0x17, 0x99130111 }, /* subwoofer */
7619 			{ }
7620 		}
7621 	},
7622 	[ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7623 		.type = HDA_FIXUP_PINS,
7624 		.v.pins = (const struct hda_pintbl[]) {
7625 			{ 0x19, 0x03A11050 },
7626 			{ 0x1a, 0x03A11C30 },
7627 			{ 0x21, 0x03211420 },
7628 			{ }
7629 		}
7630 	},
7631 	[ALC269_FIXUP_ASUS_N7601ZM] = {
7632 		.type = HDA_FIXUP_VERBS,
7633 		.v.verbs = (const struct hda_verb[]) {
7634 			{0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7635 			{0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7636 			{0x20, AC_VERB_SET_COEF_INDEX, 0x10},
7637 			{0x20, AC_VERB_SET_PROC_COEF, 0x8420},
7638 			{0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
7639 			{0x20, AC_VERB_SET_PROC_COEF, 0x7774},
7640 			{ }
7641 		},
7642 		.chained = true,
7643 		.chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
7644 	},
7645 	[ALC269_FIXUP_LENOVO_EAPD] = {
7646 		.type = HDA_FIXUP_VERBS,
7647 		.v.verbs = (const struct hda_verb[]) {
7648 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7649 			{}
7650 		}
7651 	},
7652 	[ALC275_FIXUP_SONY_HWEQ] = {
7653 		.type = HDA_FIXUP_FUNC,
7654 		.v.func = alc269_fixup_hweq,
7655 		.chained = true,
7656 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7657 	},
7658 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7659 		.type = HDA_FIXUP_FUNC,
7660 		.v.func = alc_fixup_disable_aamix,
7661 		.chained = true,
7662 		.chain_id = ALC269_FIXUP_SONY_VAIO
7663 	},
7664 	[ALC271_FIXUP_DMIC] = {
7665 		.type = HDA_FIXUP_FUNC,
7666 		.v.func = alc271_fixup_dmic,
7667 	},
7668 	[ALC269_FIXUP_PCM_44K] = {
7669 		.type = HDA_FIXUP_FUNC,
7670 		.v.func = alc269_fixup_pcm_44k,
7671 		.chained = true,
7672 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7673 	},
7674 	[ALC269_FIXUP_STEREO_DMIC] = {
7675 		.type = HDA_FIXUP_FUNC,
7676 		.v.func = alc269_fixup_stereo_dmic,
7677 	},
7678 	[ALC269_FIXUP_HEADSET_MIC] = {
7679 		.type = HDA_FIXUP_FUNC,
7680 		.v.func = alc269_fixup_headset_mic,
7681 	},
7682 	[ALC269_FIXUP_QUANTA_MUTE] = {
7683 		.type = HDA_FIXUP_FUNC,
7684 		.v.func = alc269_fixup_quanta_mute,
7685 	},
7686 	[ALC269_FIXUP_LIFEBOOK] = {
7687 		.type = HDA_FIXUP_PINS,
7688 		.v.pins = (const struct hda_pintbl[]) {
7689 			{ 0x1a, 0x2101103f }, /* dock line-out */
7690 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
7691 			{ }
7692 		},
7693 		.chained = true,
7694 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7695 	},
7696 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7697 		.type = HDA_FIXUP_PINS,
7698 		.v.pins = (const struct hda_pintbl[]) {
7699 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7700 			{ }
7701 		},
7702 	},
7703 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7704 		.type = HDA_FIXUP_PINS,
7705 		.v.pins = (const struct hda_pintbl[]) {
7706 			{ 0x21, 0x0221102f }, /* HP out */
7707 			{ }
7708 		},
7709 	},
7710 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7711 		.type = HDA_FIXUP_FUNC,
7712 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7713 	},
7714 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7715 		.type = HDA_FIXUP_FUNC,
7716 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7717 	},
7718 	[ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13] = {
7719 		.type = HDA_FIXUP_PINS,
7720 		.v.pins = (const struct hda_pintbl[]) {
7721 			{ 0x14, 0x90170151 }, /* use as internal speaker (LFE) */
7722 			{ 0x1b, 0x90170152 }, /* use as internal speaker (back) */
7723 			{ }
7724 		},
7725 		.chained = true,
7726 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7727 	},
7728 	[ALC269VC_FIXUP_INFINIX_Y4_MAX] = {
7729 		.type = HDA_FIXUP_PINS,
7730 		.v.pins = (const struct hda_pintbl[]) {
7731 			{ 0x1b, 0x90170150 }, /* use as internal speaker */
7732 			{ }
7733 		},
7734 		.chained = true,
7735 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7736 	},
7737 	[ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
7738 		.type = HDA_FIXUP_PINS,
7739 		.v.pins = (const struct hda_pintbl[]) {
7740 			{ 0x18, 0x03a19020 }, /* headset mic */
7741 			{ 0x1b, 0x90170150 }, /* speaker */
7742 			{ }
7743 		},
7744 	},
7745 	[ALC269_FIXUP_AMIC] = {
7746 		.type = HDA_FIXUP_PINS,
7747 		.v.pins = (const struct hda_pintbl[]) {
7748 			{ 0x14, 0x99130110 }, /* speaker */
7749 			{ 0x15, 0x0121401f }, /* HP out */
7750 			{ 0x18, 0x01a19c20 }, /* mic */
7751 			{ 0x19, 0x99a3092f }, /* int-mic */
7752 			{ }
7753 		},
7754 	},
7755 	[ALC269_FIXUP_DMIC] = {
7756 		.type = HDA_FIXUP_PINS,
7757 		.v.pins = (const struct hda_pintbl[]) {
7758 			{ 0x12, 0x99a3092f }, /* int-mic */
7759 			{ 0x14, 0x99130110 }, /* speaker */
7760 			{ 0x15, 0x0121401f }, /* HP out */
7761 			{ 0x18, 0x01a19c20 }, /* mic */
7762 			{ }
7763 		},
7764 	},
7765 	[ALC269VB_FIXUP_AMIC] = {
7766 		.type = HDA_FIXUP_PINS,
7767 		.v.pins = (const struct hda_pintbl[]) {
7768 			{ 0x14, 0x99130110 }, /* speaker */
7769 			{ 0x18, 0x01a19c20 }, /* mic */
7770 			{ 0x19, 0x99a3092f }, /* int-mic */
7771 			{ 0x21, 0x0121401f }, /* HP out */
7772 			{ }
7773 		},
7774 	},
7775 	[ALC269VB_FIXUP_DMIC] = {
7776 		.type = HDA_FIXUP_PINS,
7777 		.v.pins = (const struct hda_pintbl[]) {
7778 			{ 0x12, 0x99a3092f }, /* int-mic */
7779 			{ 0x14, 0x99130110 }, /* speaker */
7780 			{ 0x18, 0x01a19c20 }, /* mic */
7781 			{ 0x21, 0x0121401f }, /* HP out */
7782 			{ }
7783 		},
7784 	},
7785 	[ALC269_FIXUP_HP_MUTE_LED] = {
7786 		.type = HDA_FIXUP_FUNC,
7787 		.v.func = alc269_fixup_hp_mute_led,
7788 	},
7789 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7790 		.type = HDA_FIXUP_FUNC,
7791 		.v.func = alc269_fixup_hp_mute_led_mic1,
7792 	},
7793 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7794 		.type = HDA_FIXUP_FUNC,
7795 		.v.func = alc269_fixup_hp_mute_led_mic2,
7796 	},
7797 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7798 		.type = HDA_FIXUP_FUNC,
7799 		.v.func = alc269_fixup_hp_mute_led_mic3,
7800 		.chained = true,
7801 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7802 	},
7803 	[ALC269_FIXUP_HP_GPIO_LED] = {
7804 		.type = HDA_FIXUP_FUNC,
7805 		.v.func = alc269_fixup_hp_gpio_led,
7806 	},
7807 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7808 		.type = HDA_FIXUP_FUNC,
7809 		.v.func = alc269_fixup_hp_gpio_mic1_led,
7810 	},
7811 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7812 		.type = HDA_FIXUP_FUNC,
7813 		.v.func = alc269_fixup_hp_line1_mic1_led,
7814 	},
7815 	[ALC269_FIXUP_INV_DMIC] = {
7816 		.type = HDA_FIXUP_FUNC,
7817 		.v.func = alc_fixup_inv_dmic,
7818 	},
7819 	[ALC269_FIXUP_NO_SHUTUP] = {
7820 		.type = HDA_FIXUP_FUNC,
7821 		.v.func = alc_fixup_no_shutup,
7822 	},
7823 	[ALC269_FIXUP_LENOVO_DOCK] = {
7824 		.type = HDA_FIXUP_PINS,
7825 		.v.pins = (const struct hda_pintbl[]) {
7826 			{ 0x19, 0x23a11040 }, /* dock mic */
7827 			{ 0x1b, 0x2121103f }, /* dock headphone */
7828 			{ }
7829 		},
7830 		.chained = true,
7831 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7832 	},
7833 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7834 		.type = HDA_FIXUP_FUNC,
7835 		.v.func = alc269_fixup_limit_int_mic_boost,
7836 		.chained = true,
7837 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
7838 	},
7839 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7840 		.type = HDA_FIXUP_FUNC,
7841 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7842 		.chained = true,
7843 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7844 	},
7845 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7846 		.type = HDA_FIXUP_PINS,
7847 		.v.pins = (const struct hda_pintbl[]) {
7848 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7849 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7850 			{ }
7851 		},
7852 		.chained = true,
7853 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7854 	},
7855 	[ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
7856 		.type = HDA_FIXUP_FUNC,
7857 		.v.func = alc269_fixup_limit_int_mic_boost,
7858 		.chained = true,
7859 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7860 	},
7861 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7862 		.type = HDA_FIXUP_PINS,
7863 		.v.pins = (const struct hda_pintbl[]) {
7864 			{ 0x16, 0x21014020 }, /* dock line out */
7865 			{ 0x19, 0x21a19030 }, /* dock mic */
7866 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7867 			{ }
7868 		},
7869 		.chained = true,
7870 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7871 	},
7872 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7873 		.type = HDA_FIXUP_PINS,
7874 		.v.pins = (const struct hda_pintbl[]) {
7875 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7876 			{ }
7877 		},
7878 		.chained = true,
7879 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7880 	},
7881 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7882 		.type = HDA_FIXUP_PINS,
7883 		.v.pins = (const struct hda_pintbl[]) {
7884 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7885 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7886 			{ }
7887 		},
7888 		.chained = true,
7889 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7890 	},
7891 	[ALC269_FIXUP_HEADSET_MODE] = {
7892 		.type = HDA_FIXUP_FUNC,
7893 		.v.func = alc_fixup_headset_mode,
7894 		.chained = true,
7895 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7896 	},
7897 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7898 		.type = HDA_FIXUP_FUNC,
7899 		.v.func = alc_fixup_headset_mode_no_hp_mic,
7900 	},
7901 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7902 		.type = HDA_FIXUP_PINS,
7903 		.v.pins = (const struct hda_pintbl[]) {
7904 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7905 			{ }
7906 		},
7907 		.chained = true,
7908 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
7909 	},
7910 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7911 		.type = HDA_FIXUP_PINS,
7912 		.v.pins = (const struct hda_pintbl[]) {
7913 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7914 			{ }
7915 		},
7916 		.chained = true,
7917 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7918 	},
7919 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7920 		.type = HDA_FIXUP_PINS,
7921 		.v.pins = (const struct hda_pintbl[]) {
7922 			{0x12, 0x90a60130},
7923 			{0x13, 0x40000000},
7924 			{0x14, 0x90170110},
7925 			{0x18, 0x411111f0},
7926 			{0x19, 0x04a11040},
7927 			{0x1a, 0x411111f0},
7928 			{0x1b, 0x90170112},
7929 			{0x1d, 0x40759a05},
7930 			{0x1e, 0x411111f0},
7931 			{0x21, 0x04211020},
7932 			{ }
7933 		},
7934 		.chained = true,
7935 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7936 	},
7937 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7938 		.type = HDA_FIXUP_FUNC,
7939 		.v.func = alc298_fixup_huawei_mbx_stereo,
7940 		.chained = true,
7941 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7942 	},
7943 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
7944 		.type = HDA_FIXUP_FUNC,
7945 		.v.func = alc269_fixup_x101_headset_mic,
7946 	},
7947 	[ALC269_FIXUP_ASUS_X101_VERB] = {
7948 		.type = HDA_FIXUP_VERBS,
7949 		.v.verbs = (const struct hda_verb[]) {
7950 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7951 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7952 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
7953 			{ }
7954 		},
7955 		.chained = true,
7956 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7957 	},
7958 	[ALC269_FIXUP_ASUS_X101] = {
7959 		.type = HDA_FIXUP_PINS,
7960 		.v.pins = (const struct hda_pintbl[]) {
7961 			{ 0x18, 0x04a1182c }, /* Headset mic */
7962 			{ }
7963 		},
7964 		.chained = true,
7965 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
7966 	},
7967 	[ALC271_FIXUP_AMIC_MIC2] = {
7968 		.type = HDA_FIXUP_PINS,
7969 		.v.pins = (const struct hda_pintbl[]) {
7970 			{ 0x14, 0x99130110 }, /* speaker */
7971 			{ 0x19, 0x01a19c20 }, /* mic */
7972 			{ 0x1b, 0x99a7012f }, /* int-mic */
7973 			{ 0x21, 0x0121401f }, /* HP out */
7974 			{ }
7975 		},
7976 	},
7977 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7978 		.type = HDA_FIXUP_FUNC,
7979 		.v.func = alc271_hp_gate_mic_jack,
7980 		.chained = true,
7981 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
7982 	},
7983 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7984 		.type = HDA_FIXUP_FUNC,
7985 		.v.func = alc269_fixup_limit_int_mic_boost,
7986 		.chained = true,
7987 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7988 	},
7989 	[ALC269_FIXUP_ACER_AC700] = {
7990 		.type = HDA_FIXUP_PINS,
7991 		.v.pins = (const struct hda_pintbl[]) {
7992 			{ 0x12, 0x99a3092f }, /* int-mic */
7993 			{ 0x14, 0x99130110 }, /* speaker */
7994 			{ 0x18, 0x03a11c20 }, /* mic */
7995 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
7996 			{ 0x21, 0x0321101f }, /* HP out */
7997 			{ }
7998 		},
7999 		.chained = true,
8000 		.chain_id = ALC271_FIXUP_DMIC,
8001 	},
8002 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
8003 		.type = HDA_FIXUP_FUNC,
8004 		.v.func = alc269_fixup_limit_int_mic_boost,
8005 		.chained = true,
8006 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8007 	},
8008 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
8009 		.type = HDA_FIXUP_FUNC,
8010 		.v.func = alc269_fixup_limit_int_mic_boost,
8011 		.chained = true,
8012 		.chain_id = ALC269VB_FIXUP_DMIC,
8013 	},
8014 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
8015 		.type = HDA_FIXUP_VERBS,
8016 		.v.verbs = (const struct hda_verb[]) {
8017 			/* class-D output amp +5dB */
8018 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
8019 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
8020 			{}
8021 		},
8022 		.chained = true,
8023 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
8024 	},
8025 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8026 		.type = HDA_FIXUP_PINS,
8027 		.v.pins = (const struct hda_pintbl[]) {
8028 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
8029 			{ }
8030 		},
8031 		.chained = true,
8032 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8033 	},
8034 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
8035 		.type = HDA_FIXUP_FUNC,
8036 		.v.func = alc269_fixup_limit_int_mic_boost,
8037 		.chained = true,
8038 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
8039 	},
8040 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
8041 		.type = HDA_FIXUP_PINS,
8042 		.v.pins = (const struct hda_pintbl[]) {
8043 			{ 0x12, 0x99a3092f }, /* int-mic */
8044 			{ 0x18, 0x03a11d20 }, /* mic */
8045 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
8046 			{ }
8047 		},
8048 	},
8049 	[ALC283_FIXUP_CHROME_BOOK] = {
8050 		.type = HDA_FIXUP_FUNC,
8051 		.v.func = alc283_fixup_chromebook,
8052 	},
8053 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
8054 		.type = HDA_FIXUP_FUNC,
8055 		.v.func = alc283_fixup_sense_combo_jack,
8056 		.chained = true,
8057 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
8058 	},
8059 	[ALC282_FIXUP_ASUS_TX300] = {
8060 		.type = HDA_FIXUP_FUNC,
8061 		.v.func = alc282_fixup_asus_tx300,
8062 	},
8063 	[ALC283_FIXUP_INT_MIC] = {
8064 		.type = HDA_FIXUP_VERBS,
8065 		.v.verbs = (const struct hda_verb[]) {
8066 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
8067 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
8068 			{ }
8069 		},
8070 		.chained = true,
8071 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8072 	},
8073 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
8074 		.type = HDA_FIXUP_PINS,
8075 		.v.pins = (const struct hda_pintbl[]) {
8076 			{ 0x17, 0x90170112 }, /* subwoofer */
8077 			{ }
8078 		},
8079 		.chained = true,
8080 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
8081 	},
8082 	[ALC290_FIXUP_SUBWOOFER] = {
8083 		.type = HDA_FIXUP_PINS,
8084 		.v.pins = (const struct hda_pintbl[]) {
8085 			{ 0x17, 0x90170112 }, /* subwoofer */
8086 			{ }
8087 		},
8088 		.chained = true,
8089 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
8090 	},
8091 	[ALC290_FIXUP_MONO_SPEAKERS] = {
8092 		.type = HDA_FIXUP_FUNC,
8093 		.v.func = alc290_fixup_mono_speakers,
8094 	},
8095 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8096 		.type = HDA_FIXUP_FUNC,
8097 		.v.func = alc290_fixup_mono_speakers,
8098 		.chained = true,
8099 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8100 	},
8101 	[ALC269_FIXUP_THINKPAD_ACPI] = {
8102 		.type = HDA_FIXUP_FUNC,
8103 		.v.func = alc_fixup_thinkpad_acpi,
8104 		.chained = true,
8105 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
8106 	},
8107 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8108 		.type = HDA_FIXUP_FUNC,
8109 		.v.func = alc_fixup_inv_dmic,
8110 		.chained = true,
8111 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8112 	},
8113 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8114 		.type = HDA_FIXUP_PINS,
8115 		.v.pins = (const struct hda_pintbl[]) {
8116 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8117 			{ }
8118 		},
8119 		.chained = true,
8120 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8121 	},
8122 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8123 		.type = HDA_FIXUP_PINS,
8124 		.v.pins = (const struct hda_pintbl[]) {
8125 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8126 			{ }
8127 		},
8128 		.chained = true,
8129 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8130 	},
8131 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8132 		.type = HDA_FIXUP_PINS,
8133 		.v.pins = (const struct hda_pintbl[]) {
8134 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8135 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8136 			{ }
8137 		},
8138 		.chained = true,
8139 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8140 	},
8141 	[ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8142 		.type = HDA_FIXUP_FUNC,
8143 		.v.func = alc269_fixup_limit_int_mic_boost,
8144 		.chained = true,
8145 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8146 	},
8147 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8148 		.type = HDA_FIXUP_PINS,
8149 		.v.pins = (const struct hda_pintbl[]) {
8150 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8151 			{ }
8152 		},
8153 		.chained = true,
8154 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8155 	},
8156 	[ALC255_FIXUP_HEADSET_MODE] = {
8157 		.type = HDA_FIXUP_FUNC,
8158 		.v.func = alc_fixup_headset_mode_alc255,
8159 		.chained = true,
8160 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8161 	},
8162 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8163 		.type = HDA_FIXUP_FUNC,
8164 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8165 	},
8166 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8167 		.type = HDA_FIXUP_PINS,
8168 		.v.pins = (const struct hda_pintbl[]) {
8169 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8170 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8171 			{ }
8172 		},
8173 		.chained = true,
8174 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8175 	},
8176 	[ALC292_FIXUP_TPT440_DOCK] = {
8177 		.type = HDA_FIXUP_FUNC,
8178 		.v.func = alc_fixup_tpt440_dock,
8179 		.chained = true,
8180 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8181 	},
8182 	[ALC292_FIXUP_TPT440] = {
8183 		.type = HDA_FIXUP_FUNC,
8184 		.v.func = alc_fixup_disable_aamix,
8185 		.chained = true,
8186 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
8187 	},
8188 	[ALC283_FIXUP_HEADSET_MIC] = {
8189 		.type = HDA_FIXUP_PINS,
8190 		.v.pins = (const struct hda_pintbl[]) {
8191 			{ 0x19, 0x04a110f0 },
8192 			{ },
8193 		},
8194 	},
8195 	[ALC255_FIXUP_MIC_MUTE_LED] = {
8196 		.type = HDA_FIXUP_FUNC,
8197 		.v.func = alc_fixup_micmute_led,
8198 	},
8199 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
8200 		.type = HDA_FIXUP_PINS,
8201 		.v.pins = (const struct hda_pintbl[]) {
8202 			{ 0x12, 0x90a60130 },
8203 			{ 0x14, 0x90170110 },
8204 			{ 0x17, 0x40000008 },
8205 			{ 0x18, 0x411111f0 },
8206 			{ 0x19, 0x01a1913c },
8207 			{ 0x1a, 0x411111f0 },
8208 			{ 0x1b, 0x411111f0 },
8209 			{ 0x1d, 0x40f89b2d },
8210 			{ 0x1e, 0x411111f0 },
8211 			{ 0x21, 0x0321101f },
8212 			{ },
8213 		},
8214 	},
8215 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8216 		.type = HDA_FIXUP_FUNC,
8217 		.v.func = alc269vb_fixup_aspire_e1_coef,
8218 	},
8219 	[ALC280_FIXUP_HP_GPIO4] = {
8220 		.type = HDA_FIXUP_FUNC,
8221 		.v.func = alc280_fixup_hp_gpio4,
8222 	},
8223 	[ALC286_FIXUP_HP_GPIO_LED] = {
8224 		.type = HDA_FIXUP_FUNC,
8225 		.v.func = alc286_fixup_hp_gpio_led,
8226 	},
8227 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8228 		.type = HDA_FIXUP_FUNC,
8229 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8230 	},
8231 	[ALC280_FIXUP_HP_DOCK_PINS] = {
8232 		.type = HDA_FIXUP_PINS,
8233 		.v.pins = (const struct hda_pintbl[]) {
8234 			{ 0x1b, 0x21011020 }, /* line-out */
8235 			{ 0x1a, 0x01a1903c }, /* headset mic */
8236 			{ 0x18, 0x2181103f }, /* line-in */
8237 			{ },
8238 		},
8239 		.chained = true,
8240 		.chain_id = ALC280_FIXUP_HP_GPIO4
8241 	},
8242 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8243 		.type = HDA_FIXUP_PINS,
8244 		.v.pins = (const struct hda_pintbl[]) {
8245 			{ 0x1b, 0x21011020 }, /* line-out */
8246 			{ 0x18, 0x2181103f }, /* line-in */
8247 			{ },
8248 		},
8249 		.chained = true,
8250 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8251 	},
8252 	[ALC280_FIXUP_HP_9480M] = {
8253 		.type = HDA_FIXUP_FUNC,
8254 		.v.func = alc280_fixup_hp_9480m,
8255 	},
8256 	[ALC245_FIXUP_HP_X360_AMP] = {
8257 		.type = HDA_FIXUP_FUNC,
8258 		.v.func = alc245_fixup_hp_x360_amp,
8259 		.chained = true,
8260 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
8261 	},
8262 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
8263 		.type = HDA_FIXUP_FUNC,
8264 		.v.func = alc_fixup_headset_mode_dell_alc288,
8265 		.chained = true,
8266 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8267 	},
8268 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8269 		.type = HDA_FIXUP_PINS,
8270 		.v.pins = (const struct hda_pintbl[]) {
8271 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8272 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8273 			{ }
8274 		},
8275 		.chained = true,
8276 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8277 	},
8278 	[ALC288_FIXUP_DISABLE_AAMIX] = {
8279 		.type = HDA_FIXUP_FUNC,
8280 		.v.func = alc_fixup_disable_aamix,
8281 		.chained = true,
8282 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8283 	},
8284 	[ALC288_FIXUP_DELL_XPS_13] = {
8285 		.type = HDA_FIXUP_FUNC,
8286 		.v.func = alc_fixup_dell_xps13,
8287 		.chained = true,
8288 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
8289 	},
8290 	[ALC292_FIXUP_DISABLE_AAMIX] = {
8291 		.type = HDA_FIXUP_FUNC,
8292 		.v.func = alc_fixup_disable_aamix,
8293 		.chained = true,
8294 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8295 	},
8296 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8297 		.type = HDA_FIXUP_FUNC,
8298 		.v.func = alc_fixup_disable_aamix,
8299 		.chained = true,
8300 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8301 	},
8302 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
8303 		.type = HDA_FIXUP_FUNC,
8304 		.v.func = alc_fixup_dell_xps13,
8305 		.chained = true,
8306 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
8307 	},
8308 	[ALC292_FIXUP_DELL_E7X] = {
8309 		.type = HDA_FIXUP_FUNC,
8310 		.v.func = alc_fixup_micmute_led,
8311 		/* micmute fixup must be applied at last */
8312 		.chained_before = true,
8313 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8314 	},
8315 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8316 		.type = HDA_FIXUP_PINS,
8317 		.v.pins = (const struct hda_pintbl[]) {
8318 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8319 			{ }
8320 		},
8321 		.chained_before = true,
8322 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8323 	},
8324 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8325 		.type = HDA_FIXUP_PINS,
8326 		.v.pins = (const struct hda_pintbl[]) {
8327 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8328 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8329 			{ }
8330 		},
8331 		.chained = true,
8332 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8333 	},
8334 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8335 		.type = HDA_FIXUP_PINS,
8336 		.v.pins = (const struct hda_pintbl[]) {
8337 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8338 			{ }
8339 		},
8340 		.chained = true,
8341 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8342 	},
8343 	[ALC275_FIXUP_DELL_XPS] = {
8344 		.type = HDA_FIXUP_VERBS,
8345 		.v.verbs = (const struct hda_verb[]) {
8346 			/* Enables internal speaker */
8347 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8348 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8349 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8350 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8351 			{}
8352 		}
8353 	},
8354 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8355 		.type = HDA_FIXUP_FUNC,
8356 		.v.func = alc_fixup_disable_aamix,
8357 		.chained = true,
8358 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8359 	},
8360 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8361 		.type = HDA_FIXUP_FUNC,
8362 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8363 	},
8364 	[ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED] = {
8365 		.type = HDA_FIXUP_FUNC,
8366 		.v.func = alc233_fixup_lenovo_low_en_micmute_led,
8367 	},
8368 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8369 		.type = HDA_FIXUP_FUNC,
8370 		.v.func = alc_fixup_inv_dmic,
8371 		.chained = true,
8372 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8373 	},
8374 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8375 		.type = HDA_FIXUP_FUNC,
8376 		.v.func = alc269_fixup_limit_int_mic_boost
8377 	},
8378 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
8379 		.type = HDA_FIXUP_FUNC,
8380 		.v.func = alc_fixup_disable_aamix,
8381 		.chained = true,
8382 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8383 	},
8384 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
8385 		.type = HDA_FIXUP_FUNC,
8386 		.v.func = alc_fixup_disable_mic_vref,
8387 		.chained = true,
8388 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8389 	},
8390 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8391 		.type = HDA_FIXUP_VERBS,
8392 		.v.verbs = (const struct hda_verb[]) {
8393 			/* Disable pass-through path for FRONT 14h */
8394 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8395 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8396 			{}
8397 		},
8398 		.chained = true,
8399 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8400 	},
8401 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
8402 		.type = HDA_FIXUP_FUNC,
8403 		.v.func = alc_fixup_disable_aamix,
8404 		.chained = true,
8405 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
8406 	},
8407 	[ALC221_FIXUP_HP_FRONT_MIC] = {
8408 		.type = HDA_FIXUP_PINS,
8409 		.v.pins = (const struct hda_pintbl[]) {
8410 			{ 0x19, 0x02a19020 }, /* Front Mic */
8411 			{ }
8412 		},
8413 	},
8414 	[ALC292_FIXUP_TPT460] = {
8415 		.type = HDA_FIXUP_FUNC,
8416 		.v.func = alc_fixup_tpt440_dock,
8417 		.chained = true,
8418 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8419 	},
8420 	[ALC298_FIXUP_SPK_VOLUME] = {
8421 		.type = HDA_FIXUP_FUNC,
8422 		.v.func = alc298_fixup_speaker_volume,
8423 		.chained = true,
8424 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8425 	},
8426 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8427 		.type = HDA_FIXUP_FUNC,
8428 		.v.func = alc298_fixup_speaker_volume,
8429 	},
8430 	[ALC295_FIXUP_DISABLE_DAC3] = {
8431 		.type = HDA_FIXUP_FUNC,
8432 		.v.func = alc295_fixup_disable_dac3,
8433 	},
8434 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8435 		.type = HDA_FIXUP_FUNC,
8436 		.v.func = alc285_fixup_speaker2_to_dac1,
8437 		.chained = true,
8438 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8439 	},
8440 	[ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8441 		.type = HDA_FIXUP_FUNC,
8442 		.v.func = alc285_fixup_speaker2_to_dac1,
8443 		.chained = true,
8444 		.chain_id = ALC245_FIXUP_CS35L41_SPI_2
8445 	},
8446 	[ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8447 		.type = HDA_FIXUP_PINS,
8448 		.v.pins = (const struct hda_pintbl[]) {
8449 			{ 0x19, 0x03a11050 },
8450 			{ 0x1b, 0x03a11c30 },
8451 			{ }
8452 		},
8453 		.chained = true,
8454 		.chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8455 	},
8456 	[ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8457 		.type = HDA_FIXUP_PINS,
8458 		.v.pins = (const struct hda_pintbl[]) {
8459 			{ 0x14, 0x90170120 },
8460 			{ }
8461 		},
8462 		.chained = true,
8463 		.chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8464 	},
8465 	[ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8466 		.type = HDA_FIXUP_FUNC,
8467 		.v.func = alc285_fixup_speaker2_to_dac1,
8468 		.chained = true,
8469 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2
8470 	},
8471 	[ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8472 		.type = HDA_FIXUP_PINS,
8473 		.v.pins = (const struct hda_pintbl[]) {
8474 			{ 0x19, 0x03a11050 },
8475 			{ 0x1b, 0x03a11c30 },
8476 			{ }
8477 		},
8478 		.chained = true,
8479 		.chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8480 	},
8481 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8482 		.type = HDA_FIXUP_PINS,
8483 		.v.pins = (const struct hda_pintbl[]) {
8484 			{ 0x1b, 0x90170151 },
8485 			{ }
8486 		},
8487 		.chained = true,
8488 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8489 	},
8490 	[ALC269_FIXUP_ATIV_BOOK_8] = {
8491 		.type = HDA_FIXUP_FUNC,
8492 		.v.func = alc_fixup_auto_mute_via_amp,
8493 		.chained = true,
8494 		.chain_id = ALC269_FIXUP_NO_SHUTUP
8495 	},
8496 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8497 		.type = HDA_FIXUP_PINS,
8498 		.v.pins = (const struct hda_pintbl[]) {
8499 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8500 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8501 			{ }
8502 		},
8503 		.chained = true,
8504 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8505 	},
8506 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8507 		.type = HDA_FIXUP_PINS,
8508 		.v.pins = (const struct hda_pintbl[]) {
8509 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8510 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8511 			{ }
8512 		},
8513 		.chained = true,
8514 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8515 	},
8516 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8517 		.type = HDA_FIXUP_FUNC,
8518 		.v.func = alc_fixup_headset_mode,
8519 	},
8520 	[ALC256_FIXUP_ASUS_MIC] = {
8521 		.type = HDA_FIXUP_PINS,
8522 		.v.pins = (const struct hda_pintbl[]) {
8523 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8524 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8525 			{ }
8526 		},
8527 		.chained = true,
8528 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8529 	},
8530 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8531 		.type = HDA_FIXUP_FUNC,
8532 		/* Set up GPIO2 for the speaker amp */
8533 		.v.func = alc_fixup_gpio4,
8534 	},
8535 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8536 		.type = HDA_FIXUP_PINS,
8537 		.v.pins = (const struct hda_pintbl[]) {
8538 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8539 			{ }
8540 		},
8541 		.chained = true,
8542 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8543 	},
8544 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8545 		.type = HDA_FIXUP_VERBS,
8546 		.v.verbs = (const struct hda_verb[]) {
8547 			/* Enables internal speaker */
8548 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8549 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8550 			{}
8551 		},
8552 		.chained = true,
8553 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8554 	},
8555 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8556 		.type = HDA_FIXUP_FUNC,
8557 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8558 		.chained = true,
8559 		.chain_id = ALC269_FIXUP_GPIO2
8560 	},
8561 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
8562 		.type = HDA_FIXUP_VERBS,
8563 		.v.verbs = (const struct hda_verb[]) {
8564 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8565 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8566 			{ }
8567 		},
8568 		.chained = true,
8569 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8570 	},
8571 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8572 		.type = HDA_FIXUP_PINS,
8573 		.v.pins = (const struct hda_pintbl[]) {
8574 			/* Change the mic location from front to right, otherwise there are
8575 			   two front mics with the same name, pulseaudio can't handle them.
8576 			   This is just a temporary workaround, after applying this fixup,
8577 			   there will be one "Front Mic" and one "Mic" in this machine.
8578 			 */
8579 			{ 0x1a, 0x04a19040 },
8580 			{ }
8581 		},
8582 	},
8583 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8584 		.type = HDA_FIXUP_PINS,
8585 		.v.pins = (const struct hda_pintbl[]) {
8586 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
8587 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8588 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8589 			{ 0x1b, 0x02011020 },
8590 			{ }
8591 		},
8592 		.chained = true,
8593 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
8594 	},
8595 	[ALC225_FIXUP_S3_POP_NOISE] = {
8596 		.type = HDA_FIXUP_FUNC,
8597 		.v.func = alc225_fixup_s3_pop_noise,
8598 		.chained = true,
8599 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8600 	},
8601 	[ALC700_FIXUP_INTEL_REFERENCE] = {
8602 		.type = HDA_FIXUP_VERBS,
8603 		.v.verbs = (const struct hda_verb[]) {
8604 			/* Enables internal speaker */
8605 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8606 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8607 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8608 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8609 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8610 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8611 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8612 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8613 			{}
8614 		}
8615 	},
8616 	[ALC274_FIXUP_DELL_BIND_DACS] = {
8617 		.type = HDA_FIXUP_FUNC,
8618 		.v.func = alc274_fixup_bind_dacs,
8619 		.chained = true,
8620 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8621 	},
8622 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8623 		.type = HDA_FIXUP_PINS,
8624 		.v.pins = (const struct hda_pintbl[]) {
8625 			{ 0x1b, 0x0401102f },
8626 			{ }
8627 		},
8628 		.chained = true,
8629 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
8630 	},
8631 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
8632 		.type = HDA_FIXUP_FUNC,
8633 		.v.func = alc_fixup_tpt470_dock,
8634 		.chained = true,
8635 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8636 	},
8637 	[ALC298_FIXUP_TPT470_DOCK] = {
8638 		.type = HDA_FIXUP_FUNC,
8639 		.v.func = alc_fixup_tpt470_dacs,
8640 		.chained = true,
8641 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8642 	},
8643 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8644 		.type = HDA_FIXUP_PINS,
8645 		.v.pins = (const struct hda_pintbl[]) {
8646 			{ 0x14, 0x0201101f },
8647 			{ }
8648 		},
8649 		.chained = true,
8650 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8651 	},
8652 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
8653 		.type = HDA_FIXUP_PINS,
8654 		.v.pins = (const struct hda_pintbl[]) {
8655 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8656 			{ }
8657 		},
8658 		.chained = true,
8659 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8660 	},
8661 	[ALC295_FIXUP_HP_X360] = {
8662 		.type = HDA_FIXUP_FUNC,
8663 		.v.func = alc295_fixup_hp_top_speakers,
8664 		.chained = true,
8665 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8666 	},
8667 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
8668 		.type = HDA_FIXUP_PINS,
8669 		.v.pins = (const struct hda_pintbl[]) {
8670 			{ 0x19, 0x0181313f},
8671 			{ }
8672 		},
8673 		.chained = true,
8674 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8675 	},
8676 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8677 		.type = HDA_FIXUP_FUNC,
8678 		.v.func = alc285_fixup_invalidate_dacs,
8679 		.chained = true,
8680 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8681 	},
8682 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
8683 		.type = HDA_FIXUP_FUNC,
8684 		.v.func = alc_fixup_auto_mute_via_amp,
8685 	},
8686 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8687 		.type = HDA_FIXUP_PINS,
8688 		.v.pins = (const struct hda_pintbl[]) {
8689 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8690 			{ }
8691 		},
8692 		.chained = true,
8693 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8694 	},
8695 	[ALC294_FIXUP_ASUS_MIC] = {
8696 		.type = HDA_FIXUP_PINS,
8697 		.v.pins = (const struct hda_pintbl[]) {
8698 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8699 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8700 			{ }
8701 		},
8702 		.chained = true,
8703 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8704 	},
8705 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8706 		.type = HDA_FIXUP_PINS,
8707 		.v.pins = (const struct hda_pintbl[]) {
8708 			{ 0x19, 0x01a1103c }, /* use as headset mic */
8709 			{ }
8710 		},
8711 		.chained = true,
8712 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8713 	},
8714 	[ALC294_FIXUP_ASUS_SPK] = {
8715 		.type = HDA_FIXUP_VERBS,
8716 		.v.verbs = (const struct hda_verb[]) {
8717 			/* Set EAPD high */
8718 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8719 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8720 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8721 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8722 			{ }
8723 		},
8724 		.chained = true,
8725 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8726 	},
8727 	[ALC295_FIXUP_CHROME_BOOK] = {
8728 		.type = HDA_FIXUP_FUNC,
8729 		.v.func = alc295_fixup_chromebook,
8730 		.chained = true,
8731 		.chain_id = ALC225_FIXUP_HEADSET_JACK
8732 	},
8733 	[ALC225_FIXUP_HEADSET_JACK] = {
8734 		.type = HDA_FIXUP_FUNC,
8735 		.v.func = alc_fixup_headset_jack,
8736 	},
8737 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8738 		.type = HDA_FIXUP_PINS,
8739 		.v.pins = (const struct hda_pintbl[]) {
8740 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8741 			{ }
8742 		},
8743 		.chained = true,
8744 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8745 	},
8746 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8747 		.type = HDA_FIXUP_VERBS,
8748 		.v.verbs = (const struct hda_verb[]) {
8749 			/* Disable PCBEEP-IN passthrough */
8750 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8751 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8752 			{ }
8753 		},
8754 		.chained = true,
8755 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8756 	},
8757 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
8758 		.type = HDA_FIXUP_PINS,
8759 		.v.pins = (const struct hda_pintbl[]) {
8760 			{ 0x19, 0x03a11130 },
8761 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
8762 			{ }
8763 		},
8764 		.chained = true,
8765 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8766 	},
8767 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8768 		.type = HDA_FIXUP_PINS,
8769 		.v.pins = (const struct hda_pintbl[]) {
8770 			{ 0x16, 0x01011020 }, /* Rear Line out */
8771 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8772 			{ }
8773 		},
8774 		.chained = true,
8775 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8776 	},
8777 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8778 		.type = HDA_FIXUP_FUNC,
8779 		.v.func = alc_fixup_auto_mute_via_amp,
8780 		.chained = true,
8781 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8782 	},
8783 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8784 		.type = HDA_FIXUP_FUNC,
8785 		.v.func = alc_fixup_disable_mic_vref,
8786 		.chained = true,
8787 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8788 	},
8789 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8790 		.type = HDA_FIXUP_VERBS,
8791 		.v.verbs = (const struct hda_verb[]) {
8792 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8793 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8794 			{ }
8795 		},
8796 		.chained = true,
8797 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8798 	},
8799 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8800 		.type = HDA_FIXUP_PINS,
8801 		.v.pins = (const struct hda_pintbl[]) {
8802 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
8803 			{ }
8804 		},
8805 		.chained = true,
8806 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8807 	},
8808 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8809 		.type = HDA_FIXUP_PINS,
8810 		.v.pins = (const struct hda_pintbl[]) {
8811 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8812 			{ }
8813 		},
8814 		.chained = true,
8815 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8816 	},
8817 	[ALC255_FIXUP_PREDATOR_SUBWOOFER] = {
8818 		.type = HDA_FIXUP_PINS,
8819 		.v.pins = (const struct hda_pintbl[]) {
8820 			{ 0x17, 0x90170151 }, /* use as internal speaker (LFE) */
8821 			{ 0x1b, 0x90170152 } /* use as internal speaker (back) */
8822 		}
8823 	},
8824 	[ALC299_FIXUP_PREDATOR_SPK] = {
8825 		.type = HDA_FIXUP_PINS,
8826 		.v.pins = (const struct hda_pintbl[]) {
8827 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8828 			{ }
8829 		}
8830 	},
8831 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8832 		.type = HDA_FIXUP_PINS,
8833 		.v.pins = (const struct hda_pintbl[]) {
8834 			{ 0x19, 0x04a11040 },
8835 			{ 0x21, 0x04211020 },
8836 			{ }
8837 		},
8838 		.chained = true,
8839 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8840 	},
8841 	[ALC289_FIXUP_DELL_SPK1] = {
8842 		.type = HDA_FIXUP_PINS,
8843 		.v.pins = (const struct hda_pintbl[]) {
8844 			{ 0x14, 0x90170140 },
8845 			{ }
8846 		},
8847 		.chained = true,
8848 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8849 	},
8850 	[ALC289_FIXUP_DELL_SPK2] = {
8851 		.type = HDA_FIXUP_PINS,
8852 		.v.pins = (const struct hda_pintbl[]) {
8853 			{ 0x17, 0x90170130 }, /* bass spk */
8854 			{ }
8855 		},
8856 		.chained = true,
8857 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8858 	},
8859 	[ALC289_FIXUP_DUAL_SPK] = {
8860 		.type = HDA_FIXUP_FUNC,
8861 		.v.func = alc285_fixup_speaker2_to_dac1,
8862 		.chained = true,
8863 		.chain_id = ALC289_FIXUP_DELL_SPK2
8864 	},
8865 	[ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
8866 		.type = HDA_FIXUP_FUNC,
8867 		.v.func = alc285_fixup_speaker2_to_dac1,
8868 		.chained = true,
8869 		.chain_id = ALC289_FIXUP_DELL_SPK1
8870 	},
8871 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
8872 		.type = HDA_FIXUP_FUNC,
8873 		.v.func = alc285_fixup_speaker2_to_dac1,
8874 		.chained = true,
8875 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8876 	},
8877 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
8878 		.type = HDA_FIXUP_FUNC,
8879 		/* The GPIO must be pulled to initialize the AMP */
8880 		.v.func = alc_fixup_gpio4,
8881 		.chained = true,
8882 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8883 	},
8884 	[ALC294_FIXUP_ASUS_ALLY] = {
8885 		.type = HDA_FIXUP_FUNC,
8886 		.v.func = cs35l41_fixup_i2c_two,
8887 		.chained = true,
8888 		.chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
8889 	},
8890 	[ALC294_FIXUP_ASUS_ALLY_PINS] = {
8891 		.type = HDA_FIXUP_PINS,
8892 		.v.pins = (const struct hda_pintbl[]) {
8893 			{ 0x19, 0x03a11050 },
8894 			{ 0x1a, 0x03a11c30 },
8895 			{ 0x21, 0x03211420 },
8896 			{ }
8897 		},
8898 		.chained = true,
8899 		.chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
8900 	},
8901 	[ALC294_FIXUP_ASUS_ALLY_VERBS] = {
8902 		.type = HDA_FIXUP_VERBS,
8903 		.v.verbs = (const struct hda_verb[]) {
8904 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8905 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8906 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
8907 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
8908 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
8909 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
8910 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
8911 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
8912 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
8913 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
8914 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
8915 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
8916 			{ }
8917 		},
8918 		.chained = true,
8919 		.chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
8920 	},
8921 	[ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
8922 		.type = HDA_FIXUP_FUNC,
8923 		.v.func = alc285_fixup_speaker2_to_dac1,
8924 	},
8925 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8926 		.type = HDA_FIXUP_FUNC,
8927 		.v.func = alc285_fixup_thinkpad_x1_gen7,
8928 		.chained = true,
8929 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8930 	},
8931 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8932 		.type = HDA_FIXUP_FUNC,
8933 		.v.func = alc_fixup_headset_jack,
8934 		.chained = true,
8935 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8936 	},
8937 	[ALC294_FIXUP_ASUS_HPE] = {
8938 		.type = HDA_FIXUP_VERBS,
8939 		.v.verbs = (const struct hda_verb[]) {
8940 			/* Set EAPD high */
8941 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8942 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8943 			{ }
8944 		},
8945 		.chained = true,
8946 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8947 	},
8948 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
8949 		.type = HDA_FIXUP_PINS,
8950 		.v.pins = (const struct hda_pintbl[]) {
8951 			{ 0x19, 0x03a11050 }, /* front HP mic */
8952 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8953 			{ 0x21, 0x03211020 }, /* front HP out */
8954 			{ }
8955 		},
8956 		.chained = true,
8957 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8958 	},
8959 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
8960 		.type = HDA_FIXUP_VERBS,
8961 		.v.verbs = (const struct hda_verb[]) {
8962 			/* set 0x15 to HP-OUT ctrl */
8963 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8964 			/* unmute the 0x15 amp */
8965 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8966 			{ }
8967 		},
8968 		.chained = true,
8969 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
8970 	},
8971 	[ALC294_FIXUP_ASUS_GX502_HP] = {
8972 		.type = HDA_FIXUP_FUNC,
8973 		.v.func = alc294_fixup_gx502_hp,
8974 	},
8975 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
8976 		.type = HDA_FIXUP_PINS,
8977 		.v.pins = (const struct hda_pintbl[]) {
8978 			{ 0x19, 0x01a11050 }, /* rear HP mic */
8979 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8980 			{ 0x21, 0x012110f0 }, /* rear HP out */
8981 			{ }
8982 		},
8983 		.chained = true,
8984 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8985 	},
8986 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
8987 		.type = HDA_FIXUP_VERBS,
8988 		.v.verbs = (const struct hda_verb[]) {
8989 			/* set 0x15 to HP-OUT ctrl */
8990 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8991 			/* unmute the 0x15 amp */
8992 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8993 			/* set 0x1b to HP-OUT */
8994 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8995 			{ }
8996 		},
8997 		.chained = true,
8998 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
8999 	},
9000 	[ALC294_FIXUP_ASUS_GU502_HP] = {
9001 		.type = HDA_FIXUP_FUNC,
9002 		.v.func = alc294_fixup_gu502_hp,
9003 	},
9004 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
9005 		.type = HDA_FIXUP_PINS,
9006 		.v.pins = (const struct hda_pintbl[]) {
9007 				{ 0x19, 0x03a11050 }, /* front HP mic */
9008 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
9009 				{ 0x21, 0x03211420 }, /* front HP out */
9010 				{ }
9011 		},
9012 	},
9013 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
9014 		.type = HDA_FIXUP_PINS,
9015 		.v.pins = (const struct hda_pintbl[]) {
9016 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
9017 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
9018 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
9019 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
9020 			{ 0x21, 0x03211420 },
9021 			{ }
9022 		},
9023 	},
9024 	[ALC294_FIXUP_ASUS_COEF_1B] = {
9025 		.type = HDA_FIXUP_VERBS,
9026 		.v.verbs = (const struct hda_verb[]) {
9027 			/* Set bit 10 to correct noisy output after reboot from
9028 			 * Windows 10 (due to pop noise reduction?)
9029 			 */
9030 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
9031 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
9032 			{ }
9033 		},
9034 		.chained = true,
9035 		.chain_id = ALC289_FIXUP_ASUS_GA401,
9036 	},
9037 	[ALC285_FIXUP_HP_GPIO_LED] = {
9038 		.type = HDA_FIXUP_FUNC,
9039 		.v.func = alc285_fixup_hp_gpio_led,
9040 	},
9041 	[ALC285_FIXUP_HP_MUTE_LED] = {
9042 		.type = HDA_FIXUP_FUNC,
9043 		.v.func = alc285_fixup_hp_mute_led,
9044 	},
9045 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
9046 		.type = HDA_FIXUP_FUNC,
9047 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
9048 	},
9049 	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
9050 	    .type = HDA_FIXUP_FUNC,
9051 	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
9052 	},
9053 	[ALC236_FIXUP_HP_GPIO_LED] = {
9054 		.type = HDA_FIXUP_FUNC,
9055 		.v.func = alc236_fixup_hp_gpio_led,
9056 	},
9057 	[ALC236_FIXUP_HP_MUTE_LED] = {
9058 		.type = HDA_FIXUP_FUNC,
9059 		.v.func = alc236_fixup_hp_mute_led,
9060 	},
9061 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
9062 		.type = HDA_FIXUP_FUNC,
9063 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
9064 	},
9065 	[ALC236_FIXUP_LENOVO_INV_DMIC] = {
9066 		.type = HDA_FIXUP_FUNC,
9067 		.v.func = alc_fixup_inv_dmic,
9068 		.chained = true,
9069 		.chain_id = ALC283_FIXUP_INT_MIC,
9070 	},
9071 	[ALC298_FIXUP_SAMSUNG_AMP] = {
9072 		.type = HDA_FIXUP_FUNC,
9073 		.v.func = alc298_fixup_samsung_amp,
9074 		.chained = true,
9075 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
9076 	},
9077 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9078 		.type = HDA_FIXUP_VERBS,
9079 		.v.verbs = (const struct hda_verb[]) {
9080 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
9081 			{ }
9082 		},
9083 	},
9084 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9085 		.type = HDA_FIXUP_VERBS,
9086 		.v.verbs = (const struct hda_verb[]) {
9087 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
9088 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
9089 			{ }
9090 		},
9091 	},
9092 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9093 		.type = HDA_FIXUP_PINS,
9094 		.v.pins = (const struct hda_pintbl[]) {
9095 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9096 			{ }
9097 		},
9098 		.chained = true,
9099 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9100 	},
9101 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
9102 		.type = HDA_FIXUP_PINS,
9103 		.v.pins = (const struct hda_pintbl[]) {
9104 			{ 0x14, 0x90100120 }, /* use as internal speaker */
9105 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
9106 			{ 0x1a, 0x01011020 }, /* use as line out */
9107 			{ },
9108 		},
9109 		.chained = true,
9110 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9111 	},
9112 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9113 		.type = HDA_FIXUP_PINS,
9114 		.v.pins = (const struct hda_pintbl[]) {
9115 			{ 0x18, 0x02a11030 }, /* use as headset mic */
9116 			{ }
9117 		},
9118 		.chained = true,
9119 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9120 	},
9121 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9122 		.type = HDA_FIXUP_PINS,
9123 		.v.pins = (const struct hda_pintbl[]) {
9124 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9125 			{ }
9126 		},
9127 		.chained = true,
9128 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9129 	},
9130 	[ALC289_FIXUP_ASUS_GA401] = {
9131 		.type = HDA_FIXUP_FUNC,
9132 		.v.func = alc289_fixup_asus_ga401,
9133 		.chained = true,
9134 		.chain_id = ALC289_FIXUP_ASUS_GA502,
9135 	},
9136 	[ALC289_FIXUP_ASUS_GA502] = {
9137 		.type = HDA_FIXUP_PINS,
9138 		.v.pins = (const struct hda_pintbl[]) {
9139 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9140 			{ }
9141 		},
9142 	},
9143 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9144 		.type = HDA_FIXUP_PINS,
9145 		.v.pins = (const struct hda_pintbl[]) {
9146 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9147 			{ }
9148 		},
9149 		.chained = true,
9150 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9151 	},
9152 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9153 		.type = HDA_FIXUP_FUNC,
9154 		.v.func = alc285_fixup_hp_gpio_amp_init,
9155 		.chained = true,
9156 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
9157 	},
9158 	[ALC269_FIXUP_CZC_B20] = {
9159 		.type = HDA_FIXUP_PINS,
9160 		.v.pins = (const struct hda_pintbl[]) {
9161 			{ 0x12, 0x411111f0 },
9162 			{ 0x14, 0x90170110 }, /* speaker */
9163 			{ 0x15, 0x032f1020 }, /* HP out */
9164 			{ 0x17, 0x411111f0 },
9165 			{ 0x18, 0x03ab1040 }, /* mic */
9166 			{ 0x19, 0xb7a7013f },
9167 			{ 0x1a, 0x0181305f },
9168 			{ 0x1b, 0x411111f0 },
9169 			{ 0x1d, 0x411111f0 },
9170 			{ 0x1e, 0x411111f0 },
9171 			{ }
9172 		},
9173 		.chain_id = ALC269_FIXUP_DMIC,
9174 	},
9175 	[ALC269_FIXUP_CZC_TMI] = {
9176 		.type = HDA_FIXUP_PINS,
9177 		.v.pins = (const struct hda_pintbl[]) {
9178 			{ 0x12, 0x4000c000 },
9179 			{ 0x14, 0x90170110 }, /* speaker */
9180 			{ 0x15, 0x0421401f }, /* HP out */
9181 			{ 0x17, 0x411111f0 },
9182 			{ 0x18, 0x04a19020 }, /* mic */
9183 			{ 0x19, 0x411111f0 },
9184 			{ 0x1a, 0x411111f0 },
9185 			{ 0x1b, 0x411111f0 },
9186 			{ 0x1d, 0x40448505 },
9187 			{ 0x1e, 0x411111f0 },
9188 			{ 0x20, 0x8000ffff },
9189 			{ }
9190 		},
9191 		.chain_id = ALC269_FIXUP_DMIC,
9192 	},
9193 	[ALC269_FIXUP_CZC_L101] = {
9194 		.type = HDA_FIXUP_PINS,
9195 		.v.pins = (const struct hda_pintbl[]) {
9196 			{ 0x12, 0x40000000 },
9197 			{ 0x14, 0x01014010 }, /* speaker */
9198 			{ 0x15, 0x411111f0 }, /* HP out */
9199 			{ 0x16, 0x411111f0 },
9200 			{ 0x18, 0x01a19020 }, /* mic */
9201 			{ 0x19, 0x02a19021 },
9202 			{ 0x1a, 0x0181302f },
9203 			{ 0x1b, 0x0221401f },
9204 			{ 0x1c, 0x411111f0 },
9205 			{ 0x1d, 0x4044c601 },
9206 			{ 0x1e, 0x411111f0 },
9207 			{ }
9208 		},
9209 		.chain_id = ALC269_FIXUP_DMIC,
9210 	},
9211 	[ALC269_FIXUP_LEMOTE_A1802] = {
9212 		.type = HDA_FIXUP_PINS,
9213 		.v.pins = (const struct hda_pintbl[]) {
9214 			{ 0x12, 0x40000000 },
9215 			{ 0x14, 0x90170110 }, /* speaker */
9216 			{ 0x17, 0x411111f0 },
9217 			{ 0x18, 0x03a19040 }, /* mic1 */
9218 			{ 0x19, 0x90a70130 }, /* mic2 */
9219 			{ 0x1a, 0x411111f0 },
9220 			{ 0x1b, 0x411111f0 },
9221 			{ 0x1d, 0x40489d2d },
9222 			{ 0x1e, 0x411111f0 },
9223 			{ 0x20, 0x0003ffff },
9224 			{ 0x21, 0x03214020 },
9225 			{ }
9226 		},
9227 		.chain_id = ALC269_FIXUP_DMIC,
9228 	},
9229 	[ALC269_FIXUP_LEMOTE_A190X] = {
9230 		.type = HDA_FIXUP_PINS,
9231 		.v.pins = (const struct hda_pintbl[]) {
9232 			{ 0x14, 0x99130110 }, /* speaker */
9233 			{ 0x15, 0x0121401f }, /* HP out */
9234 			{ 0x18, 0x01a19c20 }, /* rear  mic */
9235 			{ 0x19, 0x99a3092f }, /* front mic */
9236 			{ 0x1b, 0x0201401f }, /* front lineout */
9237 			{ }
9238 		},
9239 		.chain_id = ALC269_FIXUP_DMIC,
9240 	},
9241 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9242 		.type = HDA_FIXUP_PINS,
9243 		.v.pins = (const struct hda_pintbl[]) {
9244 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9245 			{ }
9246 		},
9247 		.chained = true,
9248 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9249 	},
9250 	[ALC256_FIXUP_INTEL_NUC10] = {
9251 		.type = HDA_FIXUP_PINS,
9252 		.v.pins = (const struct hda_pintbl[]) {
9253 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9254 			{ }
9255 		},
9256 		.chained = true,
9257 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9258 	},
9259 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9260 		.type = HDA_FIXUP_VERBS,
9261 		.v.verbs = (const struct hda_verb[]) {
9262 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9263 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9264 			{ }
9265 		},
9266 		.chained = true,
9267 		.chain_id = ALC289_FIXUP_ASUS_GA502
9268 	},
9269 	[ALC274_FIXUP_HP_MIC] = {
9270 		.type = HDA_FIXUP_VERBS,
9271 		.v.verbs = (const struct hda_verb[]) {
9272 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9273 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9274 			{ }
9275 		},
9276 	},
9277 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
9278 		.type = HDA_FIXUP_FUNC,
9279 		.v.func = alc274_fixup_hp_headset_mic,
9280 		.chained = true,
9281 		.chain_id = ALC274_FIXUP_HP_MIC
9282 	},
9283 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
9284 		.type = HDA_FIXUP_FUNC,
9285 		.v.func = alc274_fixup_hp_envy_gpio,
9286 	},
9287 	[ALC256_FIXUP_ASUS_HPE] = {
9288 		.type = HDA_FIXUP_VERBS,
9289 		.v.verbs = (const struct hda_verb[]) {
9290 			/* Set EAPD high */
9291 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9292 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9293 			{ }
9294 		},
9295 		.chained = true,
9296 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9297 	},
9298 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9299 		.type = HDA_FIXUP_FUNC,
9300 		.v.func = alc_fixup_headset_jack,
9301 		.chained = true,
9302 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9303 	},
9304 	[ALC287_FIXUP_HP_GPIO_LED] = {
9305 		.type = HDA_FIXUP_FUNC,
9306 		.v.func = alc287_fixup_hp_gpio_led,
9307 	},
9308 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
9309 		.type = HDA_FIXUP_FUNC,
9310 		.v.func = alc274_fixup_hp_headset_mic,
9311 	},
9312 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9313 		.type = HDA_FIXUP_FUNC,
9314 		.v.func = alc_fixup_no_int_mic,
9315 		.chained = true,
9316 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9317 	},
9318 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9319 		.type = HDA_FIXUP_PINS,
9320 		.v.pins = (const struct hda_pintbl[]) {
9321 			{ 0x1b, 0x411111f0 },
9322 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9323 			{ },
9324 		},
9325 		.chained = true,
9326 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9327 	},
9328 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9329 		.type = HDA_FIXUP_FUNC,
9330 		.v.func = alc269_fixup_limit_int_mic_boost,
9331 		.chained = true,
9332 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9333 	},
9334 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
9335 		.type = HDA_FIXUP_PINS,
9336 		.v.pins = (const struct hda_pintbl[]) {
9337 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9338 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
9339 			{ }
9340 		},
9341 		.chained = true,
9342 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9343 	},
9344 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9345 		.type = HDA_FIXUP_FUNC,
9346 		.v.func = alc285_fixup_ideapad_s740_coef,
9347 		.chained = true,
9348 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9349 	},
9350 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9351 		.type = HDA_FIXUP_FUNC,
9352 		.v.func = alc269_fixup_limit_int_mic_boost,
9353 		.chained = true,
9354 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9355 	},
9356 	[ALC295_FIXUP_ASUS_DACS] = {
9357 		.type = HDA_FIXUP_FUNC,
9358 		.v.func = alc295_fixup_asus_dacs,
9359 	},
9360 	[ALC295_FIXUP_HP_OMEN] = {
9361 		.type = HDA_FIXUP_PINS,
9362 		.v.pins = (const struct hda_pintbl[]) {
9363 			{ 0x12, 0xb7a60130 },
9364 			{ 0x13, 0x40000000 },
9365 			{ 0x14, 0x411111f0 },
9366 			{ 0x16, 0x411111f0 },
9367 			{ 0x17, 0x90170110 },
9368 			{ 0x18, 0x411111f0 },
9369 			{ 0x19, 0x02a11030 },
9370 			{ 0x1a, 0x411111f0 },
9371 			{ 0x1b, 0x04a19030 },
9372 			{ 0x1d, 0x40600001 },
9373 			{ 0x1e, 0x411111f0 },
9374 			{ 0x21, 0x03211020 },
9375 			{}
9376 		},
9377 		.chained = true,
9378 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9379 	},
9380 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
9381 		.type = HDA_FIXUP_FUNC,
9382 		.v.func = alc285_fixup_hp_spectre_x360,
9383 	},
9384 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9385 		.type = HDA_FIXUP_FUNC,
9386 		.v.func = alc285_fixup_hp_spectre_x360_eb1
9387 	},
9388 	[ALC285_FIXUP_HP_ENVY_X360] = {
9389 		.type = HDA_FIXUP_FUNC,
9390 		.v.func = alc285_fixup_hp_envy_x360,
9391 		.chained = true,
9392 		.chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9393 	},
9394 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9395 		.type = HDA_FIXUP_FUNC,
9396 		.v.func = alc285_fixup_ideapad_s740_coef,
9397 		.chained = true,
9398 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9399 	},
9400 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9401 		.type = HDA_FIXUP_FUNC,
9402 		.v.func = alc_fixup_no_shutup,
9403 		.chained = true,
9404 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
9405 	},
9406 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9407 		.type = HDA_FIXUP_PINS,
9408 		.v.pins = (const struct hda_pintbl[]) {
9409 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9410 			{ }
9411 		},
9412 		.chained = true,
9413 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9414 	},
9415 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9416 		.type = HDA_FIXUP_FUNC,
9417 		.v.func = alc269_fixup_limit_int_mic_boost,
9418 		.chained = true,
9419 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9420 	},
9421 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9422 		.type = HDA_FIXUP_FUNC,
9423 		.v.func = alc285_fixup_ideapad_s740_coef,
9424 		.chained = true,
9425 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9426 	},
9427 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9428 		.type = HDA_FIXUP_FUNC,
9429 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9430 		.chained = true,
9431 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9432 	},
9433 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9434 		.type = HDA_FIXUP_VERBS,
9435 		//.v.verbs = legion_15imhg05_coefs,
9436 		.v.verbs = (const struct hda_verb[]) {
9437 			 // set left speaker Legion 7i.
9438 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9439 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9440 
9441 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9442 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9443 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9444 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9445 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9446 
9447 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9448 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9449 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9450 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9451 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9452 
9453 			 // set right speaker Legion 7i.
9454 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9455 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9456 
9457 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9458 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9459 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9460 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9461 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9462 
9463 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9464 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9465 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9466 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9467 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9468 			 {}
9469 		},
9470 		.chained = true,
9471 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9472 	},
9473 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9474 		.type = HDA_FIXUP_FUNC,
9475 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9476 		.chained = true,
9477 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9478 	},
9479 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9480 		.type = HDA_FIXUP_VERBS,
9481 		.v.verbs = (const struct hda_verb[]) {
9482 			 // set left speaker Yoga 7i.
9483 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9484 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9485 
9486 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9487 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9488 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9489 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9490 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9491 
9492 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9493 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9494 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9495 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9496 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9497 
9498 			 // set right speaker Yoga 7i.
9499 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9500 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9501 
9502 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9503 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9504 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9505 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9506 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9507 
9508 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9509 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9510 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9511 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9512 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9513 			 {}
9514 		},
9515 		.chained = true,
9516 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9517 	},
9518 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
9519 		.type = HDA_FIXUP_FUNC,
9520 		.v.func = alc298_fixup_lenovo_c940_duet7,
9521 	},
9522 	[ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
9523 		.type = HDA_FIXUP_FUNC,
9524 		.v.func = alc287_fixup_lenovo_14irp8_duetitl,
9525 	},
9526 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9527 		.type = HDA_FIXUP_VERBS,
9528 		.v.verbs = (const struct hda_verb[]) {
9529 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9530 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9531 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9532 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9533 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9534 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9535 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9536 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9537 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9538 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9539 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9540 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9541 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9542 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9543 			{}
9544 		},
9545 		.chained = true,
9546 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9547 	},
9548 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9549 		.type = HDA_FIXUP_FUNC,
9550 		.v.func = alc256_fixup_set_coef_defaults,
9551 	},
9552 	[ALC245_FIXUP_HP_GPIO_LED] = {
9553 		.type = HDA_FIXUP_FUNC,
9554 		.v.func = alc245_fixup_hp_gpio_led,
9555 	},
9556 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9557 		.type = HDA_FIXUP_PINS,
9558 		.v.pins = (const struct hda_pintbl[]) {
9559 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9560 			{ }
9561 		},
9562 		.chained = true,
9563 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9564 	},
9565 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
9566 		.type = HDA_FIXUP_FUNC,
9567 		.v.func = alc233_fixup_no_audio_jack,
9568 	},
9569 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9570 		.type = HDA_FIXUP_FUNC,
9571 		.v.func = alc256_fixup_mic_no_presence_and_resume,
9572 		.chained = true,
9573 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9574 	},
9575 	[ALC287_FIXUP_LEGION_16ACHG6] = {
9576 		.type = HDA_FIXUP_FUNC,
9577 		.v.func = alc287_fixup_legion_16achg6_speakers,
9578 	},
9579 	[ALC287_FIXUP_CS35L41_I2C_2] = {
9580 		.type = HDA_FIXUP_FUNC,
9581 		.v.func = cs35l41_fixup_i2c_two,
9582 	},
9583 	[ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9584 		.type = HDA_FIXUP_FUNC,
9585 		.v.func = cs35l41_fixup_i2c_two,
9586 		.chained = true,
9587 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9588 	},
9589 	[ALC245_FIXUP_CS35L41_SPI_2] = {
9590 		.type = HDA_FIXUP_FUNC,
9591 		.v.func = cs35l41_fixup_spi_two,
9592 	},
9593 	[ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9594 		.type = HDA_FIXUP_FUNC,
9595 		.v.func = cs35l41_fixup_spi_two,
9596 		.chained = true,
9597 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9598 	},
9599 	[ALC245_FIXUP_CS35L41_SPI_4] = {
9600 		.type = HDA_FIXUP_FUNC,
9601 		.v.func = cs35l41_fixup_spi_four,
9602 	},
9603 	[ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9604 		.type = HDA_FIXUP_FUNC,
9605 		.v.func = cs35l41_fixup_spi_four,
9606 		.chained = true,
9607 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9608 	},
9609 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9610 		.type = HDA_FIXUP_VERBS,
9611 		.v.verbs = (const struct hda_verb[]) {
9612 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9613 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9614 			 { }
9615 		},
9616 		.chained = true,
9617 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9618 	},
9619 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9620 		.type = HDA_FIXUP_FUNC,
9621 		.v.func = alc_fixup_dell4_mic_no_presence_quiet,
9622 		.chained = true,
9623 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9624 	},
9625 	[ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9626 		.type = HDA_FIXUP_PINS,
9627 		.v.pins = (const struct hda_pintbl[]) {
9628 			{ 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9629 			{ }
9630 		},
9631 		.chained = true,
9632 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9633 	},
9634 	[ALC287_FIXUP_LEGION_16ITHG6] = {
9635 		.type = HDA_FIXUP_FUNC,
9636 		.v.func = alc287_fixup_legion_16ithg6_speakers,
9637 	},
9638 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9639 		.type = HDA_FIXUP_VERBS,
9640 		.v.verbs = (const struct hda_verb[]) {
9641 			// enable left speaker
9642 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9643 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9644 
9645 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9646 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9647 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9648 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9649 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9650 
9651 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9652 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9653 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9654 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9655 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9656 
9657 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9658 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9659 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9660 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9661 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9662 
9663 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9664 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9665 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9666 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9667 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9668 
9669 			// enable right speaker
9670 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9671 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9672 
9673 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9674 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9675 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9676 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9677 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9678 
9679 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9680 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9681 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9682 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9683 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9684 
9685 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9686 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9687 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9688 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9689 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9690 
9691 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9692 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9693 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9694 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9695 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9696 
9697 			{ },
9698 		},
9699 	},
9700 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9701 		.type = HDA_FIXUP_FUNC,
9702 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9703 		.chained = true,
9704 		.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9705 	},
9706 	[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
9707 		.type = HDA_FIXUP_FUNC,
9708 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9709 		.chained = true,
9710 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2,
9711 	},
9712 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
9713 		.type = HDA_FIXUP_FUNC,
9714 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
9715 		.chained = true,
9716 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9717 	},
9718 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
9719 		.type = HDA_FIXUP_PINS,
9720 		.v.func = alc1220_fixup_gb_dual_codecs,
9721 		.chained = true,
9722 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9723 	},
9724 	[ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
9725 		.type = HDA_FIXUP_FUNC,
9726 		.v.func = cs35l41_fixup_i2c_two,
9727 		.chained = true,
9728 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9729 	},
9730 	[ALC287_FIXUP_TAS2781_I2C] = {
9731 		.type = HDA_FIXUP_FUNC,
9732 		.v.func = tas2781_fixup_i2c,
9733 		.chained = true,
9734 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9735 	},
9736 	[ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
9737 		.type = HDA_FIXUP_FUNC,
9738 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9739 	},
9740 	[ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
9741 		.type = HDA_FIXUP_FUNC,
9742 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9743 		.chained = true,
9744 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
9745 	},
9746 	[ALC287_FIXUP_THINKPAD_I2S_SPK] = {
9747 		.type = HDA_FIXUP_FUNC,
9748 		.v.func = alc287_fixup_bind_dacs,
9749 		.chained = true,
9750 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9751 	},
9752 	[ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
9753 		.type = HDA_FIXUP_FUNC,
9754 		.v.func = alc287_fixup_bind_dacs,
9755 		.chained = true,
9756 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
9757 	},
9758 	[ALC2XX_FIXUP_HEADSET_MIC] = {
9759 		.type = HDA_FIXUP_FUNC,
9760 		.v.func = alc_fixup_headset_mic,
9761 	},
9762 	[ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
9763 		.type = HDA_FIXUP_FUNC,
9764 		.v.func = cs35l41_fixup_spi_two,
9765 		.chained = true,
9766 		.chain_id = ALC289_FIXUP_DUAL_SPK
9767 	},
9768 	[ALC294_FIXUP_CS35L41_I2C_2] = {
9769 		.type = HDA_FIXUP_FUNC,
9770 		.v.func = cs35l41_fixup_i2c_two,
9771 	},
9772 };
9773 
9774 static const struct hda_quirk alc269_fixup_tbl[] = {
9775 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
9776 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9777 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
9778 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
9779 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9780 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9781 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
9782 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9783 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9784 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
9785 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9786 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
9787 	SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9788 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
9789 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
9790 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
9791 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
9792 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9793 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9794 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9795 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9796 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
9797 	SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9798 	SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9799 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
9800 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
9801 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
9802 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9803 	SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9804 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9805 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9806 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9807 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
9808 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9809 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9810 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9811 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
9812 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
9813 	SND_PCI_QUIRK(0x1025, 0x1360, "Acer Aspire A115", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9814 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9815 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9816 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9817 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
9818 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9819 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
9820 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
9821 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
9822 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
9823 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
9824 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9825 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
9826 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
9827 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9828 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9829 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9830 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9831 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9832 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
9833 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
9834 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
9835 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9836 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9837 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
9838 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9839 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
9840 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9841 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9842 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9843 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9844 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9845 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9846 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9847 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9848 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9849 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
9850 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
9851 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
9852 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
9853 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9854 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
9855 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
9856 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9857 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9858 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9859 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9860 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9861 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
9862 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
9863 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9864 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9865 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9866 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9867 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9868 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9869 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9870 	SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
9871 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
9872 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
9873 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
9874 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9875 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9876 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9877 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
9878 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9879 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9880 	SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9881 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9882 	SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9883 	SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9884 	SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9885 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9886 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9887 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9888 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9889 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9890 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9891 	SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9892 	SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9893 	SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9894 	SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9895 	SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9896 	SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9897 	SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9898 	SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9899 	SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9900 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9901 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9902 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9903 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
9904 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
9905 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9906 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9907 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9908 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9909 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9910 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9911 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9912 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9913 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9914 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9915 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9916 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9917 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9918 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9919 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9920 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9921 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9922 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9923 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
9924 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
9925 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9926 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9927 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9928 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9929 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9930 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9931 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9932 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9933 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9934 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9935 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9936 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9937 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9938 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9939 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9940 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9941 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9942 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9943 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9944 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9945 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9946 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9947 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9948 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9949 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9950 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9951 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9952 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9953 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9954 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9955 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9956 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9957 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9958 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9959 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
9960 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9961 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9962 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9963 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9964 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
9965 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9966 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
9967 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9968 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9969 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9970 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9971 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9972 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9973 	SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9974 	SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9975 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
9976 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9977 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
9978 	SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9979 	SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
9980 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9981 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9982 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9983 	SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9984 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
9985 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9986 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9987 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
9988 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9989 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9990 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
9991 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
9992 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
9993 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9994 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9995 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9996 	SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
9997 	SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9998 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
9999 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10000 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
10001 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10002 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
10003 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10004 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10005 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10006 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10007 	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10008 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
10009 	SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10010 	SND_PCI_QUIRK(0x103c, 0x87df, "HP ProBook 430 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10011 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10012 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10013 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10014 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10015 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
10016 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
10017 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10018 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10019 	SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10020 	SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10021 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10022 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10023 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10024 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10025 	SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10026 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10027 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10028 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10029 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10030 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10031 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10032 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10033 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10034 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10035 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10036 	SND_PCI_QUIRK(0x103c, 0x887c, "HP Laptop 14s-fq1xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10037 	SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10038 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
10039 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
10040 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
10041 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10042 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
10043 	SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
10044 	SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
10045 	SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10046 	SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
10047 	SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10048 	SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10049 	SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10050 	SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10051 	SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10052 	SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10053 	SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10054 	SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
10055 	SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
10056 	SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10057 	SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10058 	SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10059 	SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
10060 	SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10061 	SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
10062 	SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
10063 	SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
10064 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
10065 	SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
10066 	SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
10067 	SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10068 	SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10069 	SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10070 	SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10071 	SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10072 	SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
10073 	SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10074 	SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10075 	SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10076 	SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
10077 	SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
10078 	SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
10079 	SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
10080 	SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
10081 	SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10082 	SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10083 	SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10084 	SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10085 	SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10086 	SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
10087 	SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10088 	SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10089 	SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10090 	SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10091 	SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10092 	SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10093 	SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10094 	SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10095 	SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10096 	SND_PCI_QUIRK(0x103c, 0x8b5f, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10097 	SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10098 	SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10099 	SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10100 	SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10101 	SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10102 	SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10103 	SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
10104 	SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10105 	SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10106 	SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
10107 	SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10108 	SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
10109 	SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10110 	SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10111 	SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10112 	SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10113 	SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10114 	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10115 	SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10116 	SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10117 	SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10118 	SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10119 	SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10120 	SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10121 	SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10122 	SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10123 	SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10124 	SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10125 	SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10126 	SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10127 	SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10128 	SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10129 	SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10130 	SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10131 	SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10132 	SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10133 	SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10134 	SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10135 	SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10136 	SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10137 	SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10138 	SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10139 	SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10140 	SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10141 	SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10142 	SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10143 	SND_PCI_QUIRK(0x103c, 0x8d01, "HP ZBook Power 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10144 	SND_PCI_QUIRK(0x103c, 0x8d84, "HP EliteBook X G1i", ALC285_FIXUP_HP_GPIO_LED),
10145 	SND_PCI_QUIRK(0x103c, 0x8d91, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10146 	SND_PCI_QUIRK(0x103c, 0x8d92, "HP ZBook Firefly 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10147 	SND_PCI_QUIRK(0x103c, 0x8e18, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10148 	SND_PCI_QUIRK(0x103c, 0x8e19, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10149 	SND_PCI_QUIRK(0x103c, 0x8e1a, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10150 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10151 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10152 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10153 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10154 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10155 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10156 	SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10157 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10158 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10159 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10160 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10161 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10162 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10163 	SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10164 	SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10165 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10166 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10167 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10168 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10169 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10170 	SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVV", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10171 	SND_PCI_QUIRK(0x1043, 0x1460, "Asus VivoBook 15", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10172 	SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X/GA402N", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10173 	SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604VI/VC/VE/VG/VJ/VQ/VU/VV/VY/VZ", ALC285_FIXUP_ASUS_HEADSET_MIC),
10174 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603VQ/VU/VV/VJ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10175 	SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601VV/VU/VJ/VQ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10176 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G614JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10177 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS G513PI/PU/PV", ALC287_FIXUP_CS35L41_I2C_2),
10178 	SND_PCI_QUIRK(0x1043, 0x1503, "ASUS G733PY/PZ/PZV/PYV", ALC287_FIXUP_CS35L41_I2C_2),
10179 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10180 	SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA/XJ/XQ/XU/XV/XI", ALC287_FIXUP_CS35L41_I2C_2),
10181 	SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301VV/VQ/VU/VJ/VA/VC/VE/VVC/VQC/VUC/VJC/VEC/VCC", ALC285_FIXUP_ASUS_HEADSET_MIC),
10182 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10183 	SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZI/ZJ/ZQ/ZU/ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10184 	SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10185 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10186 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10187 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10188 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10189 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10190 	SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally NR2301L/X", ALC294_FIXUP_ASUS_ALLY),
10191 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10192 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10193 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10194 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10195 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10196 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10197 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10198 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10199 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10200 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10201 	SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10202 	SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10203 	SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10204 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10205 	SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
10206 	SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10207 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10208 	SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10209 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10210 	SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10211 	SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10212 	SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10213 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10214 	SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JU/JV/JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10215 	SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JY/JZ/JI/JG", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10216 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10217 	SND_PCI_QUIRK(0x1043, 0x1ccf, "ASUS G814JU/JV/JI", ALC245_FIXUP_CS35L41_SPI_2),
10218 	SND_PCI_QUIRK(0x1043, 0x1cdf, "ASUS G814JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10219 	SND_PCI_QUIRK(0x1043, 0x1cef, "ASUS G834JY/JZ/JI/JG", ALC285_FIXUP_ASUS_HEADSET_MIC),
10220 	SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS G713PI/PU/PV/PVN", ALC287_FIXUP_CS35L41_I2C_2),
10221 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10222 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10223 	SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10224 	SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10225 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10226 	SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10227 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10228 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10229 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10230 	SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10231 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10232 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10233 	SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10234 	SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10235 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10236 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10237 	SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2),
10238 	SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10239 	SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10240 	SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10241 	SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10242 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10243 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10244 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10245 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10246 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10247 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10248 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10249 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10250 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10251 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10252 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10253 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10254 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10255 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10256 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10257 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10258 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10259 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10260 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10261 	SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10262 	SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10263 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10264 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10265 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10266 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10267 	SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10268 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10269 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10270 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10271 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10272 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10273 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10274 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10275 	SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10276 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10277 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10278 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10279 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10280 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10281 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10282 	SND_PCI_QUIRK(0x144d, 0xca06, "Samsung Galaxy Book3 360 (NP730QFG)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10283 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10284 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10285 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10286 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10287 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10288 	SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10289 	SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10290 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10291 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10292 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10293 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10294 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10295 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10296 	SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10297 	SND_PCI_QUIRK(0x1558, 0x28c1, "Clevo V370VND", ALC2XX_FIXUP_HEADSET_MIC),
10298 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10299 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10300 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10301 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10302 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10303 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10304 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10305 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10306 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10307 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10308 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10309 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10310 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10311 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10312 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10313 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10314 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10315 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10316 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10317 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10318 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10319 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10320 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10321 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10322 	SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10323 	SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10324 	SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10325 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10326 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10327 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10328 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10329 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10330 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10331 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10332 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10333 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10334 	SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10335 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10336 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10337 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10338 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10339 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10340 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10341 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10342 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10343 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10344 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10345 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10346 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10347 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10348 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10349 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10350 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
10351 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10352 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10353 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10354 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10355 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10356 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10357 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10358 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10359 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10360 	SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10361 	SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10362 	SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10363 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10364 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10365 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10366 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10367 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10368 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10369 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
10370 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10371 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
10372 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
10373 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
10374 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
10375 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
10376 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
10377 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
10378 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
10379 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
10380 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
10381 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
10382 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
10383 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
10384 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
10385 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
10386 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10387 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10388 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10389 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
10390 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
10391 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10392 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10393 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10394 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
10395 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
10396 	SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
10397 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
10398 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10399 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10400 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
10401 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10402 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10403 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10404 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10405 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10406 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10407 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10408 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10409 	SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10410 	SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10411 	SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10412 	SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10413 	SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10414 	SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10415 	SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10416 	SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10417 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10418 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10419 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10420 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10421 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10422 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10423 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10424 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10425 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10426 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10427 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10428 	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
10429 	SND_PCI_QUIRK(0x17aa, 0x3384, "ThinkCentre M90a PRO", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
10430 	SND_PCI_QUIRK(0x17aa, 0x3386, "ThinkCentre M90a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
10431 	SND_PCI_QUIRK(0x17aa, 0x3387, "ThinkCentre M70a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
10432 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10433 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
10434 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10435 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
10436 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10437 	SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10438 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10439 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
10440 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10441 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10442 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
10443 	SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
10444 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10445 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10446 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10447 	SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
10448 	SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10449 	SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10450 	SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10451 	SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
10452 	SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
10453 	SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
10454 	SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10455 	SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10456 	SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10457 	SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10458 	SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
10459 	SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
10460 	SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
10461 	SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
10462 	SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
10463 	SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
10464 	SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
10465 	SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10466 	SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10467 	SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10468 	SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10469 	SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10470 	SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10471 	SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10472 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10473 	SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
10474 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
10475 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10476 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
10477 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10478 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
10479 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
10480 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10481 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
10482 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
10483 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
10484 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
10485 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
10486 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
10487 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
10488 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
10489 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10490 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10491 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10492 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10493 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10494 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10495 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10496 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
10497 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10498 	SND_PCI_QUIRK(0x1849, 0x0269, "Positivo Master C6400", ALC269VB_FIXUP_ASUS_ZENBOOK),
10499 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
10500 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
10501 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
10502 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10503 	SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
10504 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
10505 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
10506 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
10507 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
10508 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
10509 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
10510 	SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10511 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
10512 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
10513 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
10514 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
10515 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10516 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10517 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10518 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10519 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10520 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
10521 	SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10522 	SND_PCI_QUIRK(0x1d05, 0x1409, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10523 	SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10524 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10525 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
10526 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
10527 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
10528 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10529 	SND_PCI_QUIRK(0x1f66, 0x0105, "Ayaneo Portable Game Player", ALC287_FIXUP_CS35L41_I2C_2),
10530 	SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10531 	SND_PCI_QUIRK(0x2782, 0x0228, "Infinix ZERO BOOK 13", ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13),
10532 	SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
10533 	SND_PCI_QUIRK(0x2782, 0x1701, "Infinix Y4 Max", ALC269VC_FIXUP_INFINIX_Y4_MAX),
10534 	SND_PCI_QUIRK(0x2782, 0x1705, "MEDION E15433", ALC269VC_FIXUP_INFINIX_Y4_MAX),
10535 	SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
10536 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
10537 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
10538 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
10539 	SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
10540 	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10541 	SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10542 	SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10543 	SND_PCI_QUIRK(0xf111, 0x000c, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10544 
10545 #if 0
10546 	/* Below is a quirk table taken from the old code.
10547 	 * Basically the device should work as is without the fixup table.
10548 	 * If BIOS doesn't give a proper info, enable the corresponding
10549 	 * fixup entry.
10550 	 */
10551 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
10552 		      ALC269_FIXUP_AMIC),
10553 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
10554 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
10555 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
10556 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
10557 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
10558 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
10559 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
10560 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
10561 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
10562 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
10563 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
10564 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
10565 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
10566 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
10567 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
10568 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
10569 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
10570 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
10571 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
10572 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
10573 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
10574 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
10575 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
10576 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
10577 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
10578 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
10579 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
10580 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
10581 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
10582 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
10583 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
10584 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
10585 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
10586 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
10587 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
10588 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
10589 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
10590 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
10591 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
10592 #endif
10593 	{}
10594 };
10595 
10596 static const struct hda_quirk alc269_fixup_vendor_tbl[] = {
10597 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
10598 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
10599 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
10600 	SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
10601 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
10602 	{}
10603 };
10604 
10605 static const struct hda_model_fixup alc269_fixup_models[] = {
10606 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
10607 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
10608 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
10609 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
10610 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
10611 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
10612 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
10613 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
10614 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
10615 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
10616 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10617 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
10618 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10619 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
10620 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
10621 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
10622 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
10623 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
10624 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
10625 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
10626 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
10627 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
10628 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
10629 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
10630 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10631 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
10632 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
10633 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
10634 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
10635 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
10636 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
10637 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
10638 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
10639 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
10640 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
10641 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
10642 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
10643 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
10644 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
10645 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
10646 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
10647 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
10648 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
10649 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
10650 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
10651 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
10652 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
10653 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
10654 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
10655 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
10656 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
10657 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
10658 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
10659 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
10660 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
10661 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
10662 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
10663 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
10664 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
10665 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
10666 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
10667 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
10668 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
10669 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
10670 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
10671 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
10672 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
10673 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
10674 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
10675 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
10676 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10677 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
10678 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
10679 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
10680 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
10681 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
10682 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
10683 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
10684 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
10685 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
10686 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
10687 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
10688 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
10689 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
10690 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
10691 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
10692 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
10693 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
10694 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
10695 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
10696 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
10697 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
10698 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
10699 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
10700 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
10701 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
10702 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
10703 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
10704 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
10705 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
10706 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
10707 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
10708 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
10709 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
10710 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
10711 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
10712 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
10713 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
10714 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
10715 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
10716 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
10717 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
10718 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
10719 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
10720 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
10721 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
10722 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
10723 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
10724 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
10725 	{.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
10726 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
10727 	{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
10728 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
10729 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
10730 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
10731 	{.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
10732 	{.id = ALC2XX_FIXUP_HEADSET_MIC, .name = "alc2xx-fixup-headset-mic"},
10733 	{}
10734 };
10735 #define ALC225_STANDARD_PINS \
10736 	{0x21, 0x04211020}
10737 
10738 #define ALC256_STANDARD_PINS \
10739 	{0x12, 0x90a60140}, \
10740 	{0x14, 0x90170110}, \
10741 	{0x21, 0x02211020}
10742 
10743 #define ALC282_STANDARD_PINS \
10744 	{0x14, 0x90170110}
10745 
10746 #define ALC290_STANDARD_PINS \
10747 	{0x12, 0x99a30130}
10748 
10749 #define ALC292_STANDARD_PINS \
10750 	{0x14, 0x90170110}, \
10751 	{0x15, 0x0221401f}
10752 
10753 #define ALC295_STANDARD_PINS \
10754 	{0x12, 0xb7a60130}, \
10755 	{0x14, 0x90170110}, \
10756 	{0x21, 0x04211020}
10757 
10758 #define ALC298_STANDARD_PINS \
10759 	{0x12, 0x90a60130}, \
10760 	{0x21, 0x03211020}
10761 
10762 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
10763 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
10764 		{0x14, 0x01014020},
10765 		{0x17, 0x90170110},
10766 		{0x18, 0x02a11030},
10767 		{0x19, 0x0181303F},
10768 		{0x21, 0x0221102f}),
10769 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
10770 		{0x12, 0x90a601c0},
10771 		{0x14, 0x90171120},
10772 		{0x21, 0x02211030}),
10773 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10774 		{0x14, 0x90170110},
10775 		{0x1b, 0x90a70130},
10776 		{0x21, 0x03211020}),
10777 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10778 		{0x1a, 0x90a70130},
10779 		{0x1b, 0x90170110},
10780 		{0x21, 0x03211020}),
10781 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10782 		ALC225_STANDARD_PINS,
10783 		{0x12, 0xb7a60130},
10784 		{0x14, 0x901701a0}),
10785 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10786 		ALC225_STANDARD_PINS,
10787 		{0x12, 0xb7a60130},
10788 		{0x14, 0x901701b0}),
10789 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10790 		ALC225_STANDARD_PINS,
10791 		{0x12, 0xb7a60150},
10792 		{0x14, 0x901701a0}),
10793 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10794 		ALC225_STANDARD_PINS,
10795 		{0x12, 0xb7a60150},
10796 		{0x14, 0x901701b0}),
10797 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10798 		ALC225_STANDARD_PINS,
10799 		{0x12, 0xb7a60130},
10800 		{0x1b, 0x90170110}),
10801 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10802 		{0x1b, 0x01111010},
10803 		{0x1e, 0x01451130},
10804 		{0x21, 0x02211020}),
10805 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
10806 		{0x12, 0x90a60140},
10807 		{0x14, 0x90170110},
10808 		{0x19, 0x02a11030},
10809 		{0x21, 0x02211020}),
10810 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10811 		{0x14, 0x90170110},
10812 		{0x19, 0x02a11030},
10813 		{0x1a, 0x02a11040},
10814 		{0x1b, 0x01014020},
10815 		{0x21, 0x0221101f}),
10816 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10817 		{0x14, 0x90170110},
10818 		{0x19, 0x02a11030},
10819 		{0x1a, 0x02a11040},
10820 		{0x1b, 0x01011020},
10821 		{0x21, 0x0221101f}),
10822 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10823 		{0x14, 0x90170110},
10824 		{0x19, 0x02a11020},
10825 		{0x1a, 0x02a11030},
10826 		{0x21, 0x0221101f}),
10827 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
10828 		{0x21, 0x02211010}),
10829 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10830 		{0x14, 0x90170110},
10831 		{0x19, 0x02a11020},
10832 		{0x21, 0x02211030}),
10833 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
10834 		{0x14, 0x90170110},
10835 		{0x21, 0x02211020}),
10836 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10837 		{0x14, 0x90170130},
10838 		{0x21, 0x02211040}),
10839 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10840 		{0x12, 0x90a60140},
10841 		{0x14, 0x90170110},
10842 		{0x21, 0x02211020}),
10843 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10844 		{0x12, 0x90a60160},
10845 		{0x14, 0x90170120},
10846 		{0x21, 0x02211030}),
10847 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10848 		{0x14, 0x90170110},
10849 		{0x1b, 0x02011020},
10850 		{0x21, 0x0221101f}),
10851 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10852 		{0x14, 0x90170110},
10853 		{0x1b, 0x01011020},
10854 		{0x21, 0x0221101f}),
10855 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10856 		{0x14, 0x90170130},
10857 		{0x1b, 0x01014020},
10858 		{0x21, 0x0221103f}),
10859 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10860 		{0x14, 0x90170130},
10861 		{0x1b, 0x01011020},
10862 		{0x21, 0x0221103f}),
10863 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10864 		{0x14, 0x90170130},
10865 		{0x1b, 0x02011020},
10866 		{0x21, 0x0221103f}),
10867 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10868 		{0x14, 0x90170150},
10869 		{0x1b, 0x02011020},
10870 		{0x21, 0x0221105f}),
10871 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10872 		{0x14, 0x90170110},
10873 		{0x1b, 0x01014020},
10874 		{0x21, 0x0221101f}),
10875 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10876 		{0x12, 0x90a60160},
10877 		{0x14, 0x90170120},
10878 		{0x17, 0x90170140},
10879 		{0x21, 0x0321102f}),
10880 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10881 		{0x12, 0x90a60160},
10882 		{0x14, 0x90170130},
10883 		{0x21, 0x02211040}),
10884 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10885 		{0x12, 0x90a60160},
10886 		{0x14, 0x90170140},
10887 		{0x21, 0x02211050}),
10888 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10889 		{0x12, 0x90a60170},
10890 		{0x14, 0x90170120},
10891 		{0x21, 0x02211030}),
10892 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10893 		{0x12, 0x90a60170},
10894 		{0x14, 0x90170130},
10895 		{0x21, 0x02211040}),
10896 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10897 		{0x12, 0x90a60170},
10898 		{0x14, 0x90171130},
10899 		{0x21, 0x02211040}),
10900 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10901 		{0x12, 0x90a60170},
10902 		{0x14, 0x90170140},
10903 		{0x21, 0x02211050}),
10904 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10905 		{0x12, 0x90a60180},
10906 		{0x14, 0x90170130},
10907 		{0x21, 0x02211040}),
10908 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10909 		{0x12, 0x90a60180},
10910 		{0x14, 0x90170120},
10911 		{0x21, 0x02211030}),
10912 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10913 		{0x1b, 0x01011020},
10914 		{0x21, 0x02211010}),
10915 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10916 		{0x14, 0x90170110},
10917 		{0x1b, 0x90a70130},
10918 		{0x21, 0x04211020}),
10919 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10920 		{0x14, 0x90170110},
10921 		{0x1b, 0x90a70130},
10922 		{0x21, 0x03211020}),
10923 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10924 		{0x12, 0x90a60130},
10925 		{0x14, 0x90170110},
10926 		{0x21, 0x03211020}),
10927 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10928 		{0x12, 0x90a60130},
10929 		{0x14, 0x90170110},
10930 		{0x21, 0x04211020}),
10931 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10932 		{0x1a, 0x90a70130},
10933 		{0x1b, 0x90170110},
10934 		{0x21, 0x03211020}),
10935        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10936 		{0x14, 0x90170110},
10937 		{0x19, 0x02a11020},
10938 		{0x21, 0x0221101f}),
10939        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
10940 		{0x17, 0x90170110},
10941 		{0x19, 0x03a11030},
10942 		{0x21, 0x03211020}),
10943 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10944 		{0x12, 0x90a60130},
10945 		{0x14, 0x90170110},
10946 		{0x15, 0x0421101f},
10947 		{0x1a, 0x04a11020}),
10948 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10949 		{0x12, 0x90a60140},
10950 		{0x14, 0x90170110},
10951 		{0x15, 0x0421101f},
10952 		{0x18, 0x02811030},
10953 		{0x1a, 0x04a1103f},
10954 		{0x1b, 0x02011020}),
10955 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10956 		ALC282_STANDARD_PINS,
10957 		{0x12, 0x99a30130},
10958 		{0x19, 0x03a11020},
10959 		{0x21, 0x0321101f}),
10960 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10961 		ALC282_STANDARD_PINS,
10962 		{0x12, 0x99a30130},
10963 		{0x19, 0x03a11020},
10964 		{0x21, 0x03211040}),
10965 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10966 		ALC282_STANDARD_PINS,
10967 		{0x12, 0x99a30130},
10968 		{0x19, 0x03a11030},
10969 		{0x21, 0x03211020}),
10970 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10971 		ALC282_STANDARD_PINS,
10972 		{0x12, 0x99a30130},
10973 		{0x19, 0x04a11020},
10974 		{0x21, 0x0421101f}),
10975 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
10976 		ALC282_STANDARD_PINS,
10977 		{0x12, 0x90a60140},
10978 		{0x19, 0x04a11030},
10979 		{0x21, 0x04211020}),
10980 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10981 		ALC282_STANDARD_PINS,
10982 		{0x12, 0x90a609c0},
10983 		{0x18, 0x03a11830},
10984 		{0x19, 0x04a19831},
10985 		{0x1a, 0x0481303f},
10986 		{0x1b, 0x04211020},
10987 		{0x21, 0x0321101f}),
10988 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10989 		ALC282_STANDARD_PINS,
10990 		{0x12, 0x90a60940},
10991 		{0x18, 0x03a11830},
10992 		{0x19, 0x04a19831},
10993 		{0x1a, 0x0481303f},
10994 		{0x1b, 0x04211020},
10995 		{0x21, 0x0321101f}),
10996 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10997 		ALC282_STANDARD_PINS,
10998 		{0x12, 0x90a60130},
10999 		{0x21, 0x0321101f}),
11000 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11001 		{0x12, 0x90a60160},
11002 		{0x14, 0x90170120},
11003 		{0x21, 0x02211030}),
11004 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11005 		ALC282_STANDARD_PINS,
11006 		{0x12, 0x90a60130},
11007 		{0x19, 0x03a11020},
11008 		{0x21, 0x0321101f}),
11009 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11010 		{0x12, 0x90a60130},
11011 		{0x14, 0x90170110},
11012 		{0x19, 0x04a11040},
11013 		{0x21, 0x04211020}),
11014 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11015 		{0x14, 0x90170110},
11016 		{0x19, 0x04a11040},
11017 		{0x1d, 0x40600001},
11018 		{0x21, 0x04211020}),
11019 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
11020 		{0x14, 0x90170110},
11021 		{0x19, 0x04a11040},
11022 		{0x21, 0x04211020}),
11023 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
11024 		{0x14, 0x90170110},
11025 		{0x17, 0x90170111},
11026 		{0x19, 0x03a11030},
11027 		{0x21, 0x03211020}),
11028 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11029 		{0x17, 0x90170110},
11030 		{0x19, 0x03a11030},
11031 		{0x21, 0x03211020}),
11032 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11033 		{0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
11034 		{0x19, 0x04a11040},
11035 		{0x21, 0x04211020}),
11036 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
11037 		{0x12, 0x90a60130},
11038 		{0x17, 0x90170110},
11039 		{0x21, 0x02211020}),
11040 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
11041 		{0x12, 0x90a60120},
11042 		{0x14, 0x90170110},
11043 		{0x21, 0x0321101f}),
11044 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11045 		ALC290_STANDARD_PINS,
11046 		{0x15, 0x04211040},
11047 		{0x18, 0x90170112},
11048 		{0x1a, 0x04a11020}),
11049 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11050 		ALC290_STANDARD_PINS,
11051 		{0x15, 0x04211040},
11052 		{0x18, 0x90170110},
11053 		{0x1a, 0x04a11020}),
11054 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11055 		ALC290_STANDARD_PINS,
11056 		{0x15, 0x0421101f},
11057 		{0x1a, 0x04a11020}),
11058 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11059 		ALC290_STANDARD_PINS,
11060 		{0x15, 0x04211020},
11061 		{0x1a, 0x04a11040}),
11062 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11063 		ALC290_STANDARD_PINS,
11064 		{0x14, 0x90170110},
11065 		{0x15, 0x04211020},
11066 		{0x1a, 0x04a11040}),
11067 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11068 		ALC290_STANDARD_PINS,
11069 		{0x14, 0x90170110},
11070 		{0x15, 0x04211020},
11071 		{0x1a, 0x04a11020}),
11072 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11073 		ALC290_STANDARD_PINS,
11074 		{0x14, 0x90170110},
11075 		{0x15, 0x0421101f},
11076 		{0x1a, 0x04a11020}),
11077 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11078 		ALC292_STANDARD_PINS,
11079 		{0x12, 0x90a60140},
11080 		{0x16, 0x01014020},
11081 		{0x19, 0x01a19030}),
11082 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11083 		ALC292_STANDARD_PINS,
11084 		{0x12, 0x90a60140},
11085 		{0x16, 0x01014020},
11086 		{0x18, 0x02a19031},
11087 		{0x19, 0x01a1903e}),
11088 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
11089 		ALC292_STANDARD_PINS,
11090 		{0x12, 0x90a60140}),
11091 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11092 		ALC292_STANDARD_PINS,
11093 		{0x13, 0x90a60140},
11094 		{0x16, 0x21014020},
11095 		{0x19, 0x21a19030}),
11096 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11097 		ALC292_STANDARD_PINS,
11098 		{0x13, 0x90a60140}),
11099 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
11100 		{0x17, 0x90170110},
11101 		{0x21, 0x04211020}),
11102 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
11103 		{0x14, 0x90170110},
11104 		{0x1b, 0x90a70130},
11105 		{0x21, 0x04211020}),
11106 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11107 		{0x12, 0x90a60130},
11108 		{0x17, 0x90170110},
11109 		{0x21, 0x03211020}),
11110 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11111 		{0x12, 0x90a60130},
11112 		{0x17, 0x90170110},
11113 		{0x21, 0x04211020}),
11114 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11115 		{0x12, 0x90a60130},
11116 		{0x17, 0x90170110},
11117 		{0x21, 0x03211020}),
11118 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11119 		{0x12, 0x90a60120},
11120 		{0x17, 0x90170110},
11121 		{0x21, 0x04211030}),
11122 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11123 		{0x12, 0x90a60130},
11124 		{0x17, 0x90170110},
11125 		{0x21, 0x03211020}),
11126 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11127 		{0x12, 0x90a60130},
11128 		{0x17, 0x90170110},
11129 		{0x21, 0x03211020}),
11130 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11131 		ALC298_STANDARD_PINS,
11132 		{0x17, 0x90170110}),
11133 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11134 		ALC298_STANDARD_PINS,
11135 		{0x17, 0x90170140}),
11136 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11137 		ALC298_STANDARD_PINS,
11138 		{0x17, 0x90170150}),
11139 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11140 		{0x12, 0xb7a60140},
11141 		{0x13, 0xb7a60150},
11142 		{0x17, 0x90170110},
11143 		{0x1a, 0x03011020},
11144 		{0x21, 0x03211030}),
11145 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11146 		{0x12, 0xb7a60140},
11147 		{0x17, 0x90170110},
11148 		{0x1a, 0x03a11030},
11149 		{0x21, 0x03211020}),
11150 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11151 		ALC225_STANDARD_PINS,
11152 		{0x12, 0xb7a60130},
11153 		{0x17, 0x90170110}),
11154 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11155 		{0x14, 0x01014010},
11156 		{0x17, 0x90170120},
11157 		{0x18, 0x02a11030},
11158 		{0x19, 0x02a1103f},
11159 		{0x21, 0x0221101f}),
11160 	{}
11161 };
11162 
11163 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11164  * more machines, don't need to match all valid pins, just need to match
11165  * all the pins defined in the tbl. Just because of this reason, it is possible
11166  * that a single machine matches multiple tbls, so there is one limitation:
11167  *   at most one tbl is allowed to define for the same vendor and same codec
11168  */
11169 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11170 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11171 		{0x19, 0x40000000}),
11172 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11173 		{0x19, 0x40000000},
11174 		{0x1b, 0x40000000}),
11175 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
11176 		{0x19, 0x40000000},
11177 		{0x1b, 0x40000000}),
11178 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11179 		{0x19, 0x40000000},
11180 		{0x1a, 0x40000000}),
11181 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11182 		{0x19, 0x40000000},
11183 		{0x1a, 0x40000000}),
11184 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11185 		{0x19, 0x40000000},
11186 		{0x1a, 0x40000000}),
11187 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11188 		{0x19, 0x40000000}),
11189 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1558, "Clevo", ALC2XX_FIXUP_HEADSET_MIC,
11190 		{0x19, 0x40000000}),
11191 	{}
11192 };
11193 
alc269_fill_coef(struct hda_codec * codec)11194 static void alc269_fill_coef(struct hda_codec *codec)
11195 {
11196 	struct alc_spec *spec = codec->spec;
11197 	int val;
11198 
11199 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11200 		return;
11201 
11202 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11203 		alc_write_coef_idx(codec, 0xf, 0x960b);
11204 		alc_write_coef_idx(codec, 0xe, 0x8817);
11205 	}
11206 
11207 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11208 		alc_write_coef_idx(codec, 0xf, 0x960b);
11209 		alc_write_coef_idx(codec, 0xe, 0x8814);
11210 	}
11211 
11212 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11213 		/* Power up output pin */
11214 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11215 	}
11216 
11217 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11218 		val = alc_read_coef_idx(codec, 0xd);
11219 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11220 			/* Capless ramp up clock control */
11221 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
11222 		}
11223 		val = alc_read_coef_idx(codec, 0x17);
11224 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11225 			/* Class D power on reset */
11226 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
11227 		}
11228 	}
11229 
11230 	/* HP */
11231 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11232 }
11233 
11234 /*
11235  */
patch_alc269(struct hda_codec * codec)11236 static int patch_alc269(struct hda_codec *codec)
11237 {
11238 	struct alc_spec *spec;
11239 	int err;
11240 
11241 	err = alc_alloc_spec(codec, 0x0b);
11242 	if (err < 0)
11243 		return err;
11244 
11245 	spec = codec->spec;
11246 	spec->gen.shared_mic_vref_pin = 0x18;
11247 	codec->power_save_node = 0;
11248 	spec->en_3kpull_low = true;
11249 
11250 #ifdef CONFIG_PM
11251 	codec->patch_ops.suspend = alc269_suspend;
11252 	codec->patch_ops.resume = alc269_resume;
11253 #endif
11254 	spec->shutup = alc_default_shutup;
11255 	spec->init_hook = alc_default_init;
11256 
11257 	switch (codec->core.vendor_id) {
11258 	case 0x10ec0269:
11259 		spec->codec_variant = ALC269_TYPE_ALC269VA;
11260 		switch (alc_get_coef0(codec) & 0x00f0) {
11261 		case 0x0010:
11262 			if (codec->bus->pci &&
11263 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
11264 			    spec->cdefine.platform_type == 1)
11265 				err = alc_codec_rename(codec, "ALC271X");
11266 			spec->codec_variant = ALC269_TYPE_ALC269VB;
11267 			break;
11268 		case 0x0020:
11269 			if (codec->bus->pci &&
11270 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
11271 			    codec->bus->pci->subsystem_device == 0x21f3)
11272 				err = alc_codec_rename(codec, "ALC3202");
11273 			spec->codec_variant = ALC269_TYPE_ALC269VC;
11274 			break;
11275 		case 0x0030:
11276 			spec->codec_variant = ALC269_TYPE_ALC269VD;
11277 			break;
11278 		default:
11279 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
11280 		}
11281 		if (err < 0)
11282 			goto error;
11283 		spec->shutup = alc269_shutup;
11284 		spec->init_hook = alc269_fill_coef;
11285 		alc269_fill_coef(codec);
11286 		break;
11287 
11288 	case 0x10ec0280:
11289 	case 0x10ec0290:
11290 		spec->codec_variant = ALC269_TYPE_ALC280;
11291 		break;
11292 	case 0x10ec0282:
11293 		spec->codec_variant = ALC269_TYPE_ALC282;
11294 		spec->shutup = alc282_shutup;
11295 		spec->init_hook = alc282_init;
11296 		break;
11297 	case 0x10ec0233:
11298 	case 0x10ec0283:
11299 		spec->codec_variant = ALC269_TYPE_ALC283;
11300 		spec->shutup = alc283_shutup;
11301 		spec->init_hook = alc283_init;
11302 		break;
11303 	case 0x10ec0284:
11304 	case 0x10ec0292:
11305 		spec->codec_variant = ALC269_TYPE_ALC284;
11306 		break;
11307 	case 0x10ec0293:
11308 		spec->codec_variant = ALC269_TYPE_ALC293;
11309 		break;
11310 	case 0x10ec0286:
11311 	case 0x10ec0288:
11312 		spec->codec_variant = ALC269_TYPE_ALC286;
11313 		break;
11314 	case 0x10ec0298:
11315 		spec->codec_variant = ALC269_TYPE_ALC298;
11316 		break;
11317 	case 0x10ec0235:
11318 	case 0x10ec0255:
11319 		spec->codec_variant = ALC269_TYPE_ALC255;
11320 		spec->shutup = alc256_shutup;
11321 		spec->init_hook = alc256_init;
11322 		break;
11323 	case 0x10ec0230:
11324 	case 0x10ec0236:
11325 	case 0x10ec0256:
11326 	case 0x19e58326:
11327 		spec->codec_variant = ALC269_TYPE_ALC256;
11328 		spec->shutup = alc256_shutup;
11329 		spec->init_hook = alc256_init;
11330 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
11331 		if (codec->core.vendor_id == 0x10ec0236 &&
11332 		    codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
11333 			spec->en_3kpull_low = false;
11334 		break;
11335 	case 0x10ec0257:
11336 		spec->codec_variant = ALC269_TYPE_ALC257;
11337 		spec->shutup = alc256_shutup;
11338 		spec->init_hook = alc256_init;
11339 		spec->gen.mixer_nid = 0;
11340 		spec->en_3kpull_low = false;
11341 		break;
11342 	case 0x10ec0215:
11343 	case 0x10ec0245:
11344 	case 0x10ec0285:
11345 	case 0x10ec0289:
11346 		if (alc_get_coef0(codec) & 0x0010)
11347 			spec->codec_variant = ALC269_TYPE_ALC245;
11348 		else
11349 			spec->codec_variant = ALC269_TYPE_ALC215;
11350 		spec->shutup = alc225_shutup;
11351 		spec->init_hook = alc225_init;
11352 		spec->gen.mixer_nid = 0;
11353 		break;
11354 	case 0x10ec0225:
11355 	case 0x10ec0295:
11356 	case 0x10ec0299:
11357 		spec->codec_variant = ALC269_TYPE_ALC225;
11358 		spec->shutup = alc225_shutup;
11359 		spec->init_hook = alc225_init;
11360 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
11361 		break;
11362 	case 0x10ec0287:
11363 		spec->codec_variant = ALC269_TYPE_ALC287;
11364 		spec->shutup = alc225_shutup;
11365 		spec->init_hook = alc225_init;
11366 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
11367 		break;
11368 	case 0x10ec0234:
11369 	case 0x10ec0274:
11370 	case 0x10ec0294:
11371 		spec->codec_variant = ALC269_TYPE_ALC294;
11372 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
11373 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
11374 		spec->init_hook = alc294_init;
11375 		break;
11376 	case 0x10ec0300:
11377 		spec->codec_variant = ALC269_TYPE_ALC300;
11378 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
11379 		break;
11380 	case 0x10ec0222:
11381 	case 0x10ec0623:
11382 		spec->codec_variant = ALC269_TYPE_ALC623;
11383 		spec->shutup = alc222_shutup;
11384 		spec->init_hook = alc222_init;
11385 		break;
11386 	case 0x10ec0700:
11387 	case 0x10ec0701:
11388 	case 0x10ec0703:
11389 	case 0x10ec0711:
11390 		spec->codec_variant = ALC269_TYPE_ALC700;
11391 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
11392 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
11393 		spec->init_hook = alc294_init;
11394 		break;
11395 
11396 	}
11397 
11398 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
11399 		spec->has_alc5505_dsp = 1;
11400 		spec->init_hook = alc5505_dsp_init;
11401 	}
11402 
11403 	alc_pre_init(codec);
11404 
11405 	snd_hda_pick_fixup(codec, alc269_fixup_models,
11406 		       alc269_fixup_tbl, alc269_fixups);
11407 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
11408 	 * the quirk breaks the latter (bko#214101).
11409 	 * Clear the wrong entry.
11410 	 */
11411 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
11412 	    codec->core.vendor_id == 0x10ec0294) {
11413 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
11414 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
11415 	}
11416 
11417 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
11418 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
11419 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
11420 			   alc269_fixups);
11421 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11422 
11423 	alc_auto_parse_customize_define(codec);
11424 
11425 	if (has_cdefine_beep(codec))
11426 		spec->gen.beep_nid = 0x01;
11427 
11428 	/* automatic parse from the BIOS config */
11429 	err = alc269_parse_auto_config(codec);
11430 	if (err < 0)
11431 		goto error;
11432 
11433 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
11434 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
11435 		if (err < 0)
11436 			goto error;
11437 	}
11438 
11439 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11440 
11441 	return 0;
11442 
11443  error:
11444 	alc_free(codec);
11445 	return err;
11446 }
11447 
11448 /*
11449  * ALC861
11450  */
11451 
alc861_parse_auto_config(struct hda_codec * codec)11452 static int alc861_parse_auto_config(struct hda_codec *codec)
11453 {
11454 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11455 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
11456 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
11457 }
11458 
11459 /* Pin config fixes */
11460 enum {
11461 	ALC861_FIXUP_FSC_AMILO_PI1505,
11462 	ALC861_FIXUP_AMP_VREF_0F,
11463 	ALC861_FIXUP_NO_JACK_DETECT,
11464 	ALC861_FIXUP_ASUS_A6RP,
11465 	ALC660_FIXUP_ASUS_W7J,
11466 };
11467 
11468 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
alc861_fixup_asus_amp_vref_0f(struct hda_codec * codec,const struct hda_fixup * fix,int action)11469 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
11470 			const struct hda_fixup *fix, int action)
11471 {
11472 	struct alc_spec *spec = codec->spec;
11473 	unsigned int val;
11474 
11475 	if (action != HDA_FIXUP_ACT_INIT)
11476 		return;
11477 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
11478 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
11479 		val |= AC_PINCTL_IN_EN;
11480 	val |= AC_PINCTL_VREF_50;
11481 	snd_hda_set_pin_ctl(codec, 0x0f, val);
11482 	spec->gen.keep_vref_in_automute = 1;
11483 }
11484 
11485 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)11486 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
11487 				     const struct hda_fixup *fix, int action)
11488 {
11489 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11490 		codec->no_jack_detect = 1;
11491 }
11492 
11493 static const struct hda_fixup alc861_fixups[] = {
11494 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
11495 		.type = HDA_FIXUP_PINS,
11496 		.v.pins = (const struct hda_pintbl[]) {
11497 			{ 0x0b, 0x0221101f }, /* HP */
11498 			{ 0x0f, 0x90170310 }, /* speaker */
11499 			{ }
11500 		}
11501 	},
11502 	[ALC861_FIXUP_AMP_VREF_0F] = {
11503 		.type = HDA_FIXUP_FUNC,
11504 		.v.func = alc861_fixup_asus_amp_vref_0f,
11505 	},
11506 	[ALC861_FIXUP_NO_JACK_DETECT] = {
11507 		.type = HDA_FIXUP_FUNC,
11508 		.v.func = alc_fixup_no_jack_detect,
11509 	},
11510 	[ALC861_FIXUP_ASUS_A6RP] = {
11511 		.type = HDA_FIXUP_FUNC,
11512 		.v.func = alc861_fixup_asus_amp_vref_0f,
11513 		.chained = true,
11514 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
11515 	},
11516 	[ALC660_FIXUP_ASUS_W7J] = {
11517 		.type = HDA_FIXUP_VERBS,
11518 		.v.verbs = (const struct hda_verb[]) {
11519 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
11520 			 * for enabling outputs
11521 			 */
11522 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11523 			{ }
11524 		},
11525 	}
11526 };
11527 
11528 static const struct hda_quirk alc861_fixup_tbl[] = {
11529 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
11530 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
11531 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
11532 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
11533 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
11534 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
11535 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
11536 	{}
11537 };
11538 
11539 /*
11540  */
patch_alc861(struct hda_codec * codec)11541 static int patch_alc861(struct hda_codec *codec)
11542 {
11543 	struct alc_spec *spec;
11544 	int err;
11545 
11546 	err = alc_alloc_spec(codec, 0x15);
11547 	if (err < 0)
11548 		return err;
11549 
11550 	spec = codec->spec;
11551 	if (has_cdefine_beep(codec))
11552 		spec->gen.beep_nid = 0x23;
11553 
11554 #ifdef CONFIG_PM
11555 	spec->power_hook = alc_power_eapd;
11556 #endif
11557 
11558 	alc_pre_init(codec);
11559 
11560 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
11561 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11562 
11563 	/* automatic parse from the BIOS config */
11564 	err = alc861_parse_auto_config(codec);
11565 	if (err < 0)
11566 		goto error;
11567 
11568 	if (!spec->gen.no_analog) {
11569 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
11570 		if (err < 0)
11571 			goto error;
11572 	}
11573 
11574 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11575 
11576 	return 0;
11577 
11578  error:
11579 	alc_free(codec);
11580 	return err;
11581 }
11582 
11583 /*
11584  * ALC861-VD support
11585  *
11586  * Based on ALC882
11587  *
11588  * In addition, an independent DAC
11589  */
alc861vd_parse_auto_config(struct hda_codec * codec)11590 static int alc861vd_parse_auto_config(struct hda_codec *codec)
11591 {
11592 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
11593 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11594 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
11595 }
11596 
11597 enum {
11598 	ALC660VD_FIX_ASUS_GPIO1,
11599 	ALC861VD_FIX_DALLAS,
11600 };
11601 
11602 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)11603 static void alc861vd_fixup_dallas(struct hda_codec *codec,
11604 				  const struct hda_fixup *fix, int action)
11605 {
11606 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11607 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
11608 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
11609 	}
11610 }
11611 
11612 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11613 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
11614 				      const struct hda_fixup *fix, int action)
11615 {
11616 	struct alc_spec *spec = codec->spec;
11617 
11618 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11619 		spec->gpio_mask |= 0x02;
11620 	alc_fixup_gpio(codec, action, 0x01);
11621 }
11622 
11623 static const struct hda_fixup alc861vd_fixups[] = {
11624 	[ALC660VD_FIX_ASUS_GPIO1] = {
11625 		.type = HDA_FIXUP_FUNC,
11626 		.v.func = alc660vd_fixup_asus_gpio1,
11627 	},
11628 	[ALC861VD_FIX_DALLAS] = {
11629 		.type = HDA_FIXUP_FUNC,
11630 		.v.func = alc861vd_fixup_dallas,
11631 	},
11632 };
11633 
11634 static const struct hda_quirk alc861vd_fixup_tbl[] = {
11635 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
11636 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
11637 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
11638 	{}
11639 };
11640 
11641 /*
11642  */
patch_alc861vd(struct hda_codec * codec)11643 static int patch_alc861vd(struct hda_codec *codec)
11644 {
11645 	struct alc_spec *spec;
11646 	int err;
11647 
11648 	err = alc_alloc_spec(codec, 0x0b);
11649 	if (err < 0)
11650 		return err;
11651 
11652 	spec = codec->spec;
11653 	if (has_cdefine_beep(codec))
11654 		spec->gen.beep_nid = 0x23;
11655 
11656 	spec->shutup = alc_eapd_shutup;
11657 
11658 	alc_pre_init(codec);
11659 
11660 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
11661 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11662 
11663 	/* automatic parse from the BIOS config */
11664 	err = alc861vd_parse_auto_config(codec);
11665 	if (err < 0)
11666 		goto error;
11667 
11668 	if (!spec->gen.no_analog) {
11669 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11670 		if (err < 0)
11671 			goto error;
11672 	}
11673 
11674 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11675 
11676 	return 0;
11677 
11678  error:
11679 	alc_free(codec);
11680 	return err;
11681 }
11682 
11683 /*
11684  * ALC662 support
11685  *
11686  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11687  * configuration.  Each pin widget can choose any input DACs and a mixer.
11688  * Each ADC is connected from a mixer of all inputs.  This makes possible
11689  * 6-channel independent captures.
11690  *
11691  * In addition, an independent DAC for the multi-playback (not used in this
11692  * driver yet).
11693  */
11694 
11695 /*
11696  * BIOS auto configuration
11697  */
11698 
alc662_parse_auto_config(struct hda_codec * codec)11699 static int alc662_parse_auto_config(struct hda_codec *codec)
11700 {
11701 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11702 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
11703 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11704 	const hda_nid_t *ssids;
11705 
11706 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
11707 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
11708 	    codec->core.vendor_id == 0x10ec0671)
11709 		ssids = alc663_ssids;
11710 	else
11711 		ssids = alc662_ssids;
11712 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
11713 }
11714 
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)11715 static void alc272_fixup_mario(struct hda_codec *codec,
11716 			       const struct hda_fixup *fix, int action)
11717 {
11718 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
11719 		return;
11720 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
11721 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
11722 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
11723 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11724 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
11725 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
11726 }
11727 
11728 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
11729 	{ .channels = 2,
11730 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
11731 	{ .channels = 4,
11732 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
11733 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
11734 	{ }
11735 };
11736 
11737 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)11738 static void alc_fixup_bass_chmap(struct hda_codec *codec,
11739 				    const struct hda_fixup *fix, int action)
11740 {
11741 	if (action == HDA_FIXUP_ACT_BUILD) {
11742 		struct alc_spec *spec = codec->spec;
11743 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
11744 	}
11745 }
11746 
11747 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)11748 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
11749 					  hda_nid_t nid,
11750 					  unsigned int power_state)
11751 {
11752 	struct alc_spec *spec = codec->spec;
11753 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
11754 		return AC_PWRST_D0;
11755 	return power_state;
11756 }
11757 
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11758 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
11759 				   const struct hda_fixup *fix, int action)
11760 {
11761 	struct alc_spec *spec = codec->spec;
11762 
11763 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
11764 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11765 		spec->mute_led_polarity = 1;
11766 		codec->power_filter = gpio_led_power_filter;
11767 	}
11768 }
11769 
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11770 static void alc662_usi_automute_hook(struct hda_codec *codec,
11771 					 struct hda_jack_callback *jack)
11772 {
11773 	struct alc_spec *spec = codec->spec;
11774 	int vref;
11775 	msleep(200);
11776 	snd_hda_gen_hp_automute(codec, jack);
11777 
11778 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
11779 	msleep(100);
11780 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11781 			    vref);
11782 }
11783 
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11784 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
11785 				     const struct hda_fixup *fix, int action)
11786 {
11787 	struct alc_spec *spec = codec->spec;
11788 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11789 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11790 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
11791 	}
11792 }
11793 
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)11794 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
11795 					struct hda_jack_callback *cb)
11796 {
11797 	/* surround speakers at 0x1b already get muted automatically when
11798 	 * headphones are plugged in, but we have to mute/unmute the remaining
11799 	 * channels manually:
11800 	 * 0x15 - front left/front right
11801 	 * 0x18 - front center/ LFE
11802 	 */
11803 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
11804 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
11805 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
11806 	} else {
11807 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
11808 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
11809 	}
11810 }
11811 
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)11812 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
11813 					const struct hda_fixup *fix, int action)
11814 {
11815     /* Pin 0x1b: shared headphones jack and surround speakers */
11816 	if (!is_jack_detectable(codec, 0x1b))
11817 		return;
11818 
11819 	switch (action) {
11820 	case HDA_FIXUP_ACT_PRE_PROBE:
11821 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
11822 				alc662_aspire_ethos_mute_speakers);
11823 		/* subwoofer needs an extra GPIO setting to become audible */
11824 		alc_setup_gpio(codec, 0x02);
11825 		break;
11826 	case HDA_FIXUP_ACT_INIT:
11827 		/* Make sure to start in a correct state, i.e. if
11828 		 * headphones have been plugged in before powering up the system
11829 		 */
11830 		alc662_aspire_ethos_mute_speakers(codec, NULL);
11831 		break;
11832 	}
11833 }
11834 
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)11835 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
11836 					     const struct hda_fixup *fix, int action)
11837 {
11838 	struct alc_spec *spec = codec->spec;
11839 
11840 	static const struct hda_pintbl pincfgs[] = {
11841 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
11842 		{ 0x1b, 0x0181304f },
11843 		{ }
11844 	};
11845 
11846 	switch (action) {
11847 	case HDA_FIXUP_ACT_PRE_PROBE:
11848 		spec->gen.mixer_nid = 0;
11849 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11850 		snd_hda_apply_pincfgs(codec, pincfgs);
11851 		break;
11852 	case HDA_FIXUP_ACT_INIT:
11853 		alc_write_coef_idx(codec, 0x19, 0xa054);
11854 		break;
11855 	}
11856 }
11857 
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11858 static void alc897_hp_automute_hook(struct hda_codec *codec,
11859 					 struct hda_jack_callback *jack)
11860 {
11861 	struct alc_spec *spec = codec->spec;
11862 	int vref;
11863 
11864 	snd_hda_gen_hp_automute(codec, jack);
11865 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
11866 	snd_hda_set_pin_ctl(codec, 0x1b, vref);
11867 }
11868 
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11869 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
11870 				     const struct hda_fixup *fix, int action)
11871 {
11872 	struct alc_spec *spec = codec->spec;
11873 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11874 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11875 		spec->no_shutup_pins = 1;
11876 	}
11877 	if (action == HDA_FIXUP_ACT_PROBE) {
11878 		snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
11879 	}
11880 }
11881 
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)11882 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
11883 				     const struct hda_fixup *fix, int action)
11884 {
11885 	struct alc_spec *spec = codec->spec;
11886 
11887 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11888 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11889 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11890 	}
11891 }
11892 
11893 static const struct coef_fw alc668_coefs[] = {
11894 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
11895 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
11896 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
11897 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
11898 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
11899 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
11900 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
11901 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
11902 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
11903 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
11904 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
11905 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
11906 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
11907 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
11908 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
11909 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
11910 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
11911 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
11912 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
11913 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
11914 	{}
11915 };
11916 
alc668_restore_default_value(struct hda_codec * codec)11917 static void alc668_restore_default_value(struct hda_codec *codec)
11918 {
11919 	alc_process_coef_fw(codec, alc668_coefs);
11920 }
11921 
11922 enum {
11923 	ALC662_FIXUP_ASPIRE,
11924 	ALC662_FIXUP_LED_GPIO1,
11925 	ALC662_FIXUP_IDEAPAD,
11926 	ALC272_FIXUP_MARIO,
11927 	ALC662_FIXUP_CZC_ET26,
11928 	ALC662_FIXUP_CZC_P10T,
11929 	ALC662_FIXUP_SKU_IGNORE,
11930 	ALC662_FIXUP_HP_RP5800,
11931 	ALC662_FIXUP_ASUS_MODE1,
11932 	ALC662_FIXUP_ASUS_MODE2,
11933 	ALC662_FIXUP_ASUS_MODE3,
11934 	ALC662_FIXUP_ASUS_MODE4,
11935 	ALC662_FIXUP_ASUS_MODE5,
11936 	ALC662_FIXUP_ASUS_MODE6,
11937 	ALC662_FIXUP_ASUS_MODE7,
11938 	ALC662_FIXUP_ASUS_MODE8,
11939 	ALC662_FIXUP_NO_JACK_DETECT,
11940 	ALC662_FIXUP_ZOTAC_Z68,
11941 	ALC662_FIXUP_INV_DMIC,
11942 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11943 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
11944 	ALC662_FIXUP_HEADSET_MODE,
11945 	ALC668_FIXUP_HEADSET_MODE,
11946 	ALC662_FIXUP_BASS_MODE4_CHMAP,
11947 	ALC662_FIXUP_BASS_16,
11948 	ALC662_FIXUP_BASS_1A,
11949 	ALC662_FIXUP_BASS_CHMAP,
11950 	ALC668_FIXUP_AUTO_MUTE,
11951 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
11952 	ALC668_FIXUP_DELL_XPS13,
11953 	ALC662_FIXUP_ASUS_Nx50,
11954 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11955 	ALC668_FIXUP_ASUS_Nx51,
11956 	ALC668_FIXUP_MIC_COEF,
11957 	ALC668_FIXUP_ASUS_G751,
11958 	ALC891_FIXUP_HEADSET_MODE,
11959 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11960 	ALC662_FIXUP_ACER_VERITON,
11961 	ALC892_FIXUP_ASROCK_MOBO,
11962 	ALC662_FIXUP_USI_FUNC,
11963 	ALC662_FIXUP_USI_HEADSET_MODE,
11964 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
11965 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
11966 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
11967 	ALC671_FIXUP_HP_HEADSET_MIC2,
11968 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
11969 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
11970 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
11971 	ALC668_FIXUP_HEADSET_MIC,
11972 	ALC668_FIXUP_MIC_DET_COEF,
11973 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
11974 	ALC897_FIXUP_HEADSET_MIC_PIN,
11975 	ALC897_FIXUP_HP_HSMIC_VERB,
11976 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
11977 	ALC897_FIXUP_HEADSET_MIC_PIN2,
11978 	ALC897_FIXUP_UNIS_H3C_X500S,
11979 	ALC897_FIXUP_HEADSET_MIC_PIN3,
11980 };
11981 
11982 static const struct hda_fixup alc662_fixups[] = {
11983 	[ALC662_FIXUP_ASPIRE] = {
11984 		.type = HDA_FIXUP_PINS,
11985 		.v.pins = (const struct hda_pintbl[]) {
11986 			{ 0x15, 0x99130112 }, /* subwoofer */
11987 			{ }
11988 		}
11989 	},
11990 	[ALC662_FIXUP_LED_GPIO1] = {
11991 		.type = HDA_FIXUP_FUNC,
11992 		.v.func = alc662_fixup_led_gpio1,
11993 	},
11994 	[ALC662_FIXUP_IDEAPAD] = {
11995 		.type = HDA_FIXUP_PINS,
11996 		.v.pins = (const struct hda_pintbl[]) {
11997 			{ 0x17, 0x99130112 }, /* subwoofer */
11998 			{ }
11999 		},
12000 		.chained = true,
12001 		.chain_id = ALC662_FIXUP_LED_GPIO1,
12002 	},
12003 	[ALC272_FIXUP_MARIO] = {
12004 		.type = HDA_FIXUP_FUNC,
12005 		.v.func = alc272_fixup_mario,
12006 	},
12007 	[ALC662_FIXUP_CZC_ET26] = {
12008 		.type = HDA_FIXUP_PINS,
12009 		.v.pins = (const struct hda_pintbl[]) {
12010 			{0x12, 0x403cc000},
12011 			{0x14, 0x90170110}, /* speaker */
12012 			{0x15, 0x411111f0},
12013 			{0x16, 0x411111f0},
12014 			{0x18, 0x01a19030}, /* mic */
12015 			{0x19, 0x90a7013f}, /* int-mic */
12016 			{0x1a, 0x01014020},
12017 			{0x1b, 0x0121401f},
12018 			{0x1c, 0x411111f0},
12019 			{0x1d, 0x411111f0},
12020 			{0x1e, 0x40478e35},
12021 			{}
12022 		},
12023 		.chained = true,
12024 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12025 	},
12026 	[ALC662_FIXUP_CZC_P10T] = {
12027 		.type = HDA_FIXUP_VERBS,
12028 		.v.verbs = (const struct hda_verb[]) {
12029 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
12030 			{}
12031 		}
12032 	},
12033 	[ALC662_FIXUP_SKU_IGNORE] = {
12034 		.type = HDA_FIXUP_FUNC,
12035 		.v.func = alc_fixup_sku_ignore,
12036 	},
12037 	[ALC662_FIXUP_HP_RP5800] = {
12038 		.type = HDA_FIXUP_PINS,
12039 		.v.pins = (const struct hda_pintbl[]) {
12040 			{ 0x14, 0x0221201f }, /* HP out */
12041 			{ }
12042 		},
12043 		.chained = true,
12044 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12045 	},
12046 	[ALC662_FIXUP_ASUS_MODE1] = {
12047 		.type = HDA_FIXUP_PINS,
12048 		.v.pins = (const struct hda_pintbl[]) {
12049 			{ 0x14, 0x99130110 }, /* speaker */
12050 			{ 0x18, 0x01a19c20 }, /* mic */
12051 			{ 0x19, 0x99a3092f }, /* int-mic */
12052 			{ 0x21, 0x0121401f }, /* HP out */
12053 			{ }
12054 		},
12055 		.chained = true,
12056 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12057 	},
12058 	[ALC662_FIXUP_ASUS_MODE2] = {
12059 		.type = HDA_FIXUP_PINS,
12060 		.v.pins = (const struct hda_pintbl[]) {
12061 			{ 0x14, 0x99130110 }, /* speaker */
12062 			{ 0x18, 0x01a19820 }, /* mic */
12063 			{ 0x19, 0x99a3092f }, /* int-mic */
12064 			{ 0x1b, 0x0121401f }, /* HP out */
12065 			{ }
12066 		},
12067 		.chained = true,
12068 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12069 	},
12070 	[ALC662_FIXUP_ASUS_MODE3] = {
12071 		.type = HDA_FIXUP_PINS,
12072 		.v.pins = (const struct hda_pintbl[]) {
12073 			{ 0x14, 0x99130110 }, /* speaker */
12074 			{ 0x15, 0x0121441f }, /* HP */
12075 			{ 0x18, 0x01a19840 }, /* mic */
12076 			{ 0x19, 0x99a3094f }, /* int-mic */
12077 			{ 0x21, 0x01211420 }, /* HP2 */
12078 			{ }
12079 		},
12080 		.chained = true,
12081 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12082 	},
12083 	[ALC662_FIXUP_ASUS_MODE4] = {
12084 		.type = HDA_FIXUP_PINS,
12085 		.v.pins = (const struct hda_pintbl[]) {
12086 			{ 0x14, 0x99130110 }, /* speaker */
12087 			{ 0x16, 0x99130111 }, /* speaker */
12088 			{ 0x18, 0x01a19840 }, /* mic */
12089 			{ 0x19, 0x99a3094f }, /* int-mic */
12090 			{ 0x21, 0x0121441f }, /* HP */
12091 			{ }
12092 		},
12093 		.chained = true,
12094 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12095 	},
12096 	[ALC662_FIXUP_ASUS_MODE5] = {
12097 		.type = HDA_FIXUP_PINS,
12098 		.v.pins = (const struct hda_pintbl[]) {
12099 			{ 0x14, 0x99130110 }, /* speaker */
12100 			{ 0x15, 0x0121441f }, /* HP */
12101 			{ 0x16, 0x99130111 }, /* speaker */
12102 			{ 0x18, 0x01a19840 }, /* mic */
12103 			{ 0x19, 0x99a3094f }, /* int-mic */
12104 			{ }
12105 		},
12106 		.chained = true,
12107 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12108 	},
12109 	[ALC662_FIXUP_ASUS_MODE6] = {
12110 		.type = HDA_FIXUP_PINS,
12111 		.v.pins = (const struct hda_pintbl[]) {
12112 			{ 0x14, 0x99130110 }, /* speaker */
12113 			{ 0x15, 0x01211420 }, /* HP2 */
12114 			{ 0x18, 0x01a19840 }, /* mic */
12115 			{ 0x19, 0x99a3094f }, /* int-mic */
12116 			{ 0x1b, 0x0121441f }, /* HP */
12117 			{ }
12118 		},
12119 		.chained = true,
12120 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12121 	},
12122 	[ALC662_FIXUP_ASUS_MODE7] = {
12123 		.type = HDA_FIXUP_PINS,
12124 		.v.pins = (const struct hda_pintbl[]) {
12125 			{ 0x14, 0x99130110 }, /* speaker */
12126 			{ 0x17, 0x99130111 }, /* speaker */
12127 			{ 0x18, 0x01a19840 }, /* mic */
12128 			{ 0x19, 0x99a3094f }, /* int-mic */
12129 			{ 0x1b, 0x01214020 }, /* HP */
12130 			{ 0x21, 0x0121401f }, /* HP */
12131 			{ }
12132 		},
12133 		.chained = true,
12134 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12135 	},
12136 	[ALC662_FIXUP_ASUS_MODE8] = {
12137 		.type = HDA_FIXUP_PINS,
12138 		.v.pins = (const struct hda_pintbl[]) {
12139 			{ 0x14, 0x99130110 }, /* speaker */
12140 			{ 0x12, 0x99a30970 }, /* int-mic */
12141 			{ 0x15, 0x01214020 }, /* HP */
12142 			{ 0x17, 0x99130111 }, /* speaker */
12143 			{ 0x18, 0x01a19840 }, /* mic */
12144 			{ 0x21, 0x0121401f }, /* HP */
12145 			{ }
12146 		},
12147 		.chained = true,
12148 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12149 	},
12150 	[ALC662_FIXUP_NO_JACK_DETECT] = {
12151 		.type = HDA_FIXUP_FUNC,
12152 		.v.func = alc_fixup_no_jack_detect,
12153 	},
12154 	[ALC662_FIXUP_ZOTAC_Z68] = {
12155 		.type = HDA_FIXUP_PINS,
12156 		.v.pins = (const struct hda_pintbl[]) {
12157 			{ 0x1b, 0x02214020 }, /* Front HP */
12158 			{ }
12159 		}
12160 	},
12161 	[ALC662_FIXUP_INV_DMIC] = {
12162 		.type = HDA_FIXUP_FUNC,
12163 		.v.func = alc_fixup_inv_dmic,
12164 	},
12165 	[ALC668_FIXUP_DELL_XPS13] = {
12166 		.type = HDA_FIXUP_FUNC,
12167 		.v.func = alc_fixup_dell_xps13,
12168 		.chained = true,
12169 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12170 	},
12171 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12172 		.type = HDA_FIXUP_FUNC,
12173 		.v.func = alc_fixup_disable_aamix,
12174 		.chained = true,
12175 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12176 	},
12177 	[ALC668_FIXUP_AUTO_MUTE] = {
12178 		.type = HDA_FIXUP_FUNC,
12179 		.v.func = alc_fixup_auto_mute_via_amp,
12180 		.chained = true,
12181 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12182 	},
12183 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12184 		.type = HDA_FIXUP_PINS,
12185 		.v.pins = (const struct hda_pintbl[]) {
12186 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12187 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12188 			{ }
12189 		},
12190 		.chained = true,
12191 		.chain_id = ALC662_FIXUP_HEADSET_MODE
12192 	},
12193 	[ALC662_FIXUP_HEADSET_MODE] = {
12194 		.type = HDA_FIXUP_FUNC,
12195 		.v.func = alc_fixup_headset_mode_alc662,
12196 	},
12197 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12198 		.type = HDA_FIXUP_PINS,
12199 		.v.pins = (const struct hda_pintbl[]) {
12200 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12201 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12202 			{ }
12203 		},
12204 		.chained = true,
12205 		.chain_id = ALC668_FIXUP_HEADSET_MODE
12206 	},
12207 	[ALC668_FIXUP_HEADSET_MODE] = {
12208 		.type = HDA_FIXUP_FUNC,
12209 		.v.func = alc_fixup_headset_mode_alc668,
12210 	},
12211 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12212 		.type = HDA_FIXUP_FUNC,
12213 		.v.func = alc_fixup_bass_chmap,
12214 		.chained = true,
12215 		.chain_id = ALC662_FIXUP_ASUS_MODE4
12216 	},
12217 	[ALC662_FIXUP_BASS_16] = {
12218 		.type = HDA_FIXUP_PINS,
12219 		.v.pins = (const struct hda_pintbl[]) {
12220 			{0x16, 0x80106111}, /* bass speaker */
12221 			{}
12222 		},
12223 		.chained = true,
12224 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12225 	},
12226 	[ALC662_FIXUP_BASS_1A] = {
12227 		.type = HDA_FIXUP_PINS,
12228 		.v.pins = (const struct hda_pintbl[]) {
12229 			{0x1a, 0x80106111}, /* bass speaker */
12230 			{}
12231 		},
12232 		.chained = true,
12233 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12234 	},
12235 	[ALC662_FIXUP_BASS_CHMAP] = {
12236 		.type = HDA_FIXUP_FUNC,
12237 		.v.func = alc_fixup_bass_chmap,
12238 	},
12239 	[ALC662_FIXUP_ASUS_Nx50] = {
12240 		.type = HDA_FIXUP_FUNC,
12241 		.v.func = alc_fixup_auto_mute_via_amp,
12242 		.chained = true,
12243 		.chain_id = ALC662_FIXUP_BASS_1A
12244 	},
12245 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12246 		.type = HDA_FIXUP_FUNC,
12247 		.v.func = alc_fixup_headset_mode_alc668,
12248 		.chain_id = ALC662_FIXUP_BASS_CHMAP
12249 	},
12250 	[ALC668_FIXUP_ASUS_Nx51] = {
12251 		.type = HDA_FIXUP_PINS,
12252 		.v.pins = (const struct hda_pintbl[]) {
12253 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12254 			{ 0x1a, 0x90170151 }, /* bass speaker */
12255 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12256 			{}
12257 		},
12258 		.chained = true,
12259 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12260 	},
12261 	[ALC668_FIXUP_MIC_COEF] = {
12262 		.type = HDA_FIXUP_VERBS,
12263 		.v.verbs = (const struct hda_verb[]) {
12264 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12265 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12266 			{}
12267 		},
12268 	},
12269 	[ALC668_FIXUP_ASUS_G751] = {
12270 		.type = HDA_FIXUP_PINS,
12271 		.v.pins = (const struct hda_pintbl[]) {
12272 			{ 0x16, 0x0421101f }, /* HP */
12273 			{}
12274 		},
12275 		.chained = true,
12276 		.chain_id = ALC668_FIXUP_MIC_COEF
12277 	},
12278 	[ALC891_FIXUP_HEADSET_MODE] = {
12279 		.type = HDA_FIXUP_FUNC,
12280 		.v.func = alc_fixup_headset_mode,
12281 	},
12282 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
12283 		.type = HDA_FIXUP_PINS,
12284 		.v.pins = (const struct hda_pintbl[]) {
12285 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12286 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12287 			{ }
12288 		},
12289 		.chained = true,
12290 		.chain_id = ALC891_FIXUP_HEADSET_MODE
12291 	},
12292 	[ALC662_FIXUP_ACER_VERITON] = {
12293 		.type = HDA_FIXUP_PINS,
12294 		.v.pins = (const struct hda_pintbl[]) {
12295 			{ 0x15, 0x50170120 }, /* no internal speaker */
12296 			{ }
12297 		}
12298 	},
12299 	[ALC892_FIXUP_ASROCK_MOBO] = {
12300 		.type = HDA_FIXUP_PINS,
12301 		.v.pins = (const struct hda_pintbl[]) {
12302 			{ 0x15, 0x40f000f0 }, /* disabled */
12303 			{ 0x16, 0x40f000f0 }, /* disabled */
12304 			{ }
12305 		}
12306 	},
12307 	[ALC662_FIXUP_USI_FUNC] = {
12308 		.type = HDA_FIXUP_FUNC,
12309 		.v.func = alc662_fixup_usi_headset_mic,
12310 	},
12311 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
12312 		.type = HDA_FIXUP_PINS,
12313 		.v.pins = (const struct hda_pintbl[]) {
12314 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
12315 			{ 0x18, 0x01a1903d },
12316 			{ }
12317 		},
12318 		.chained = true,
12319 		.chain_id = ALC662_FIXUP_USI_FUNC
12320 	},
12321 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
12322 		.type = HDA_FIXUP_FUNC,
12323 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
12324 	},
12325 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
12326 		.type = HDA_FIXUP_FUNC,
12327 		.v.func = alc662_fixup_aspire_ethos_hp,
12328 	},
12329 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
12330 		.type = HDA_FIXUP_PINS,
12331 		.v.pins = (const struct hda_pintbl[]) {
12332 			{ 0x15, 0x92130110 }, /* front speakers */
12333 			{ 0x18, 0x99130111 }, /* center/subwoofer */
12334 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
12335 			{ }
12336 		},
12337 		.chained = true,
12338 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
12339 	},
12340 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
12341 		.type = HDA_FIXUP_FUNC,
12342 		.v.func = alc671_fixup_hp_headset_mic2,
12343 	},
12344 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
12345 		.type = HDA_FIXUP_PINS,
12346 		.v.pins = (const struct hda_pintbl[]) {
12347 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
12348 			{ }
12349 		},
12350 		.chained = true,
12351 		.chain_id = ALC662_FIXUP_USI_FUNC
12352 	},
12353 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
12354 		.type = HDA_FIXUP_PINS,
12355 		.v.pins = (const struct hda_pintbl[]) {
12356 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12357 			{ 0x1b, 0x0221144f },
12358 			{ }
12359 		},
12360 		.chained = true,
12361 		.chain_id = ALC662_FIXUP_USI_FUNC
12362 	},
12363 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
12364 		.type = HDA_FIXUP_PINS,
12365 		.v.pins = (const struct hda_pintbl[]) {
12366 			{ 0x1b, 0x04a1112c },
12367 			{ }
12368 		},
12369 		.chained = true,
12370 		.chain_id = ALC668_FIXUP_HEADSET_MIC
12371 	},
12372 	[ALC668_FIXUP_HEADSET_MIC] = {
12373 		.type = HDA_FIXUP_FUNC,
12374 		.v.func = alc269_fixup_headset_mic,
12375 		.chained = true,
12376 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
12377 	},
12378 	[ALC668_FIXUP_MIC_DET_COEF] = {
12379 		.type = HDA_FIXUP_VERBS,
12380 		.v.verbs = (const struct hda_verb[]) {
12381 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
12382 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
12383 			{}
12384 		},
12385 	},
12386 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
12387 		.type = HDA_FIXUP_FUNC,
12388 		.v.func = alc897_fixup_lenovo_headset_mic,
12389 	},
12390 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
12391 		.type = HDA_FIXUP_PINS,
12392 		.v.pins = (const struct hda_pintbl[]) {
12393 			{ 0x1a, 0x03a11050 },
12394 			{ }
12395 		},
12396 		.chained = true,
12397 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
12398 	},
12399 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
12400 		.type = HDA_FIXUP_PINS,
12401 		.v.pins = (const struct hda_pintbl[]) {
12402 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
12403 			{ }
12404 		},
12405 	},
12406 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
12407 		.type = HDA_FIXUP_FUNC,
12408 		.v.func = alc897_fixup_lenovo_headset_mode,
12409 	},
12410 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
12411 		.type = HDA_FIXUP_PINS,
12412 		.v.pins = (const struct hda_pintbl[]) {
12413 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12414 			{ }
12415 		},
12416 		.chained = true,
12417 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
12418 	},
12419 	[ALC897_FIXUP_UNIS_H3C_X500S] = {
12420 		.type = HDA_FIXUP_VERBS,
12421 		.v.verbs = (const struct hda_verb[]) {
12422 			{ 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
12423 			{}
12424 		},
12425 	},
12426 	[ALC897_FIXUP_HEADSET_MIC_PIN3] = {
12427 		.type = HDA_FIXUP_PINS,
12428 		.v.pins = (const struct hda_pintbl[]) {
12429 			{ 0x19, 0x03a11050 }, /* use as headset mic */
12430 			{ }
12431 		},
12432 	},
12433 };
12434 
12435 static const struct hda_quirk alc662_fixup_tbl[] = {
12436 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
12437 	SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
12438 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
12439 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
12440 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
12441 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
12442 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
12443 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
12444 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
12445 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
12446 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
12447 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
12448 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12449 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12450 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
12451 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
12452 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
12453 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12454 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12455 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12456 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12457 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12458 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
12459 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12460 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12461 	SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12462 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
12463 	SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
12464 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
12465 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
12466 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
12467 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
12468 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
12469 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
12470 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
12471 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12472 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
12473 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
12474 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
12475 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
12476 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
12477 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
12478 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12479 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
12480 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
12481 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
12482 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
12483 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
12484 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
12485 	SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
12486 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
12487 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
12488 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
12489 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
12490 	SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12491 	SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12492 	SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
12493 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
12494 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
12495 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
12496 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
12497 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
12498 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
12499 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
12500 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
12501 	SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
12502 
12503 #if 0
12504 	/* Below is a quirk table taken from the old code.
12505 	 * Basically the device should work as is without the fixup table.
12506 	 * If BIOS doesn't give a proper info, enable the corresponding
12507 	 * fixup entry.
12508 	 */
12509 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
12510 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
12511 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
12512 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
12513 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12514 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12515 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12516 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
12517 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
12518 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12519 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
12520 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
12521 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
12522 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
12523 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
12524 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12525 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
12526 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
12527 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12528 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12529 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12530 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12531 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
12532 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
12533 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
12534 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12535 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
12536 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12537 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12538 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
12539 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12540 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12541 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
12542 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
12543 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
12544 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
12545 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
12546 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
12547 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
12548 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12549 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
12550 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
12551 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12552 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
12553 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
12554 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
12555 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
12556 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
12557 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12558 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
12559 #endif
12560 	{}
12561 };
12562 
12563 static const struct hda_model_fixup alc662_fixup_models[] = {
12564 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
12565 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
12566 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
12567 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
12568 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
12569 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
12570 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
12571 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
12572 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
12573 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
12574 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
12575 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
12576 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
12577 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
12578 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
12579 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
12580 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
12581 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
12582 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
12583 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
12584 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
12585 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
12586 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
12587 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
12588 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
12589 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
12590 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
12591 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
12592 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
12593 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
12594 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
12595 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
12596 	{.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
12597 	{}
12598 };
12599 
12600 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
12601 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12602 		{0x17, 0x02211010},
12603 		{0x18, 0x01a19030},
12604 		{0x1a, 0x01813040},
12605 		{0x21, 0x01014020}),
12606 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12607 		{0x16, 0x01813030},
12608 		{0x17, 0x02211010},
12609 		{0x18, 0x01a19040},
12610 		{0x21, 0x01014020}),
12611 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12612 		{0x14, 0x01014010},
12613 		{0x18, 0x01a19020},
12614 		{0x1a, 0x0181302f},
12615 		{0x1b, 0x0221401f}),
12616 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12617 		{0x12, 0x99a30130},
12618 		{0x14, 0x90170110},
12619 		{0x15, 0x0321101f},
12620 		{0x16, 0x03011020}),
12621 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12622 		{0x12, 0x99a30140},
12623 		{0x14, 0x90170110},
12624 		{0x15, 0x0321101f},
12625 		{0x16, 0x03011020}),
12626 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12627 		{0x12, 0x99a30150},
12628 		{0x14, 0x90170110},
12629 		{0x15, 0x0321101f},
12630 		{0x16, 0x03011020}),
12631 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12632 		{0x14, 0x90170110},
12633 		{0x15, 0x0321101f},
12634 		{0x16, 0x03011020}),
12635 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
12636 		{0x12, 0x90a60130},
12637 		{0x14, 0x90170110},
12638 		{0x15, 0x0321101f}),
12639 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12640 		{0x14, 0x01014010},
12641 		{0x17, 0x90170150},
12642 		{0x19, 0x02a11060},
12643 		{0x1b, 0x01813030},
12644 		{0x21, 0x02211020}),
12645 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12646 		{0x14, 0x01014010},
12647 		{0x18, 0x01a19040},
12648 		{0x1b, 0x01813030},
12649 		{0x21, 0x02211020}),
12650 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12651 		{0x14, 0x01014020},
12652 		{0x17, 0x90170110},
12653 		{0x18, 0x01a19050},
12654 		{0x1b, 0x01813040},
12655 		{0x21, 0x02211030}),
12656 	{}
12657 };
12658 
12659 /*
12660  */
patch_alc662(struct hda_codec * codec)12661 static int patch_alc662(struct hda_codec *codec)
12662 {
12663 	struct alc_spec *spec;
12664 	int err;
12665 
12666 	err = alc_alloc_spec(codec, 0x0b);
12667 	if (err < 0)
12668 		return err;
12669 
12670 	spec = codec->spec;
12671 
12672 	spec->shutup = alc_eapd_shutup;
12673 
12674 	/* handle multiple HPs as is */
12675 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
12676 
12677 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
12678 
12679 	switch (codec->core.vendor_id) {
12680 	case 0x10ec0668:
12681 		spec->init_hook = alc668_restore_default_value;
12682 		break;
12683 	}
12684 
12685 	alc_pre_init(codec);
12686 
12687 	snd_hda_pick_fixup(codec, alc662_fixup_models,
12688 		       alc662_fixup_tbl, alc662_fixups);
12689 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
12690 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12691 
12692 	alc_auto_parse_customize_define(codec);
12693 
12694 	if (has_cdefine_beep(codec))
12695 		spec->gen.beep_nid = 0x01;
12696 
12697 	if ((alc_get_coef0(codec) & (1 << 14)) &&
12698 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
12699 	    spec->cdefine.platform_type == 1) {
12700 		err = alc_codec_rename(codec, "ALC272X");
12701 		if (err < 0)
12702 			goto error;
12703 	}
12704 
12705 	/* automatic parse from the BIOS config */
12706 	err = alc662_parse_auto_config(codec);
12707 	if (err < 0)
12708 		goto error;
12709 
12710 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
12711 		switch (codec->core.vendor_id) {
12712 		case 0x10ec0662:
12713 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12714 			break;
12715 		case 0x10ec0272:
12716 		case 0x10ec0663:
12717 		case 0x10ec0665:
12718 		case 0x10ec0668:
12719 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12720 			break;
12721 		case 0x10ec0273:
12722 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
12723 			break;
12724 		}
12725 		if (err < 0)
12726 			goto error;
12727 	}
12728 
12729 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12730 
12731 	return 0;
12732 
12733  error:
12734 	alc_free(codec);
12735 	return err;
12736 }
12737 
12738 /*
12739  * ALC680 support
12740  */
12741 
alc680_parse_auto_config(struct hda_codec * codec)12742 static int alc680_parse_auto_config(struct hda_codec *codec)
12743 {
12744 	return alc_parse_auto_config(codec, NULL, NULL);
12745 }
12746 
12747 /*
12748  */
patch_alc680(struct hda_codec * codec)12749 static int patch_alc680(struct hda_codec *codec)
12750 {
12751 	int err;
12752 
12753 	/* ALC680 has no aa-loopback mixer */
12754 	err = alc_alloc_spec(codec, 0);
12755 	if (err < 0)
12756 		return err;
12757 
12758 	/* automatic parse from the BIOS config */
12759 	err = alc680_parse_auto_config(codec);
12760 	if (err < 0) {
12761 		alc_free(codec);
12762 		return err;
12763 	}
12764 
12765 	return 0;
12766 }
12767 
12768 /*
12769  * patch entries
12770  */
12771 static const struct hda_device_id snd_hda_id_realtek[] = {
12772 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
12773 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
12774 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
12775 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
12776 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
12777 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
12778 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
12779 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
12780 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
12781 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
12782 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
12783 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
12784 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
12785 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
12786 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
12787 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
12788 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
12789 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
12790 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
12791 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
12792 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
12793 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
12794 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
12795 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
12796 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
12797 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
12798 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
12799 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
12800 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
12801 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
12802 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
12803 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
12804 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
12805 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
12806 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
12807 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
12808 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
12809 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
12810 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
12811 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
12812 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
12813 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
12814 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
12815 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
12816 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
12817 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
12818 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
12819 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
12820 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
12821 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
12822 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
12823 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
12824 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
12825 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
12826 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
12827 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
12828 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
12829 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
12830 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
12831 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
12832 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
12833 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
12834 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
12835 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
12836 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
12837 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
12838 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
12839 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
12840 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
12841 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
12842 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
12843 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
12844 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
12845 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
12846 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
12847 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
12848 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
12849 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
12850 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
12851 	{} /* terminator */
12852 };
12853 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
12854 
12855 MODULE_LICENSE("GPL");
12856 MODULE_DESCRIPTION("Realtek HD-audio codec");
12857 
12858 static struct hda_codec_driver realtek_driver = {
12859 	.id = snd_hda_id_realtek,
12860 };
12861 
12862 module_hda_codec_driver(realtek_driver);
12863