xref: /openbmc/linux/sound/pci/hda/patch_realtek.c (revision 49a9fe95)
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 	case 0x10ec0294:
475 	case 0x10ec0700:
476 	case 0x10ec0701:
477 	case 0x10ec0703:
478 	case 0x10ec0711:
479 		alc_update_coef_idx(codec, 0x10, 1<<15, 0);
480 		break;
481 	case 0x10ec0662:
482 		if ((coef & 0x00f0) == 0x0030)
483 			alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
484 		break;
485 	case 0x10ec0272:
486 	case 0x10ec0273:
487 	case 0x10ec0663:
488 	case 0x10ec0665:
489 	case 0x10ec0670:
490 	case 0x10ec0671:
491 	case 0x10ec0672:
492 		alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
493 		break;
494 	case 0x10ec0222:
495 	case 0x10ec0623:
496 		alc_update_coef_idx(codec, 0x19, 1<<13, 0);
497 		break;
498 	case 0x10ec0668:
499 		alc_update_coef_idx(codec, 0x7, 3<<13, 0);
500 		break;
501 	case 0x10ec0867:
502 		alc_update_coef_idx(codec, 0x4, 1<<10, 0);
503 		break;
504 	case 0x10ec0888:
505 		if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
506 			alc_update_coef_idx(codec, 0x7, 1<<5, 0);
507 		break;
508 	case 0x10ec0892:
509 	case 0x10ec0897:
510 		alc_update_coef_idx(codec, 0x7, 1<<5, 0);
511 		break;
512 	case 0x10ec0899:
513 	case 0x10ec0900:
514 	case 0x10ec0b00:
515 	case 0x10ec1168:
516 	case 0x10ec1220:
517 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
518 		break;
519 	}
520 }
521 
522 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)523 static void alc888_coef_init(struct hda_codec *codec)
524 {
525 	switch (alc_get_coef0(codec) & 0x00f0) {
526 	/* alc888-VA */
527 	case 0x00:
528 	/* alc888-VB */
529 	case 0x10:
530 		alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
531 		break;
532 	}
533 }
534 
535 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)536 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
537 {
538 	if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
539 		return;
540 	if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
541 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
542 				    on ? 2 : 0);
543 }
544 
545 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)546 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
547 {
548 	/* We currently only handle front, HP */
549 	static const hda_nid_t pins[] = {
550 		0x0f, 0x10, 0x14, 0x15, 0x17, 0
551 	};
552 	const hda_nid_t *p;
553 	for (p = pins; *p; p++)
554 		set_eapd(codec, *p, on);
555 }
556 
557 static int find_ext_mic_pin(struct hda_codec *codec);
558 
alc_headset_mic_no_shutup(struct hda_codec * codec)559 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
560 {
561 	const struct hda_pincfg *pin;
562 	int mic_pin = find_ext_mic_pin(codec);
563 	int i;
564 
565 	/* don't shut up pins when unloading the driver; otherwise it breaks
566 	 * the default pin setup at the next load of the driver
567 	 */
568 	if (codec->bus->shutdown)
569 		return;
570 
571 	snd_array_for_each(&codec->init_pins, i, pin) {
572 		/* use read here for syncing after issuing each verb */
573 		if (pin->nid != mic_pin)
574 			snd_hda_codec_read(codec, pin->nid, 0,
575 					AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
576 	}
577 
578 	codec->pins_shutup = 1;
579 }
580 
alc_shutup_pins(struct hda_codec * codec)581 static void alc_shutup_pins(struct hda_codec *codec)
582 {
583 	struct alc_spec *spec = codec->spec;
584 
585 	switch (codec->core.vendor_id) {
586 	case 0x10ec0236:
587 	case 0x10ec0256:
588 	case 0x19e58326:
589 	case 0x10ec0283:
590 	case 0x10ec0285:
591 	case 0x10ec0286:
592 	case 0x10ec0287:
593 	case 0x10ec0288:
594 	case 0x10ec0295:
595 	case 0x10ec0298:
596 		alc_headset_mic_no_shutup(codec);
597 		break;
598 	default:
599 		if (!spec->no_shutup_pins)
600 			snd_hda_shutup_pins(codec);
601 		break;
602 	}
603 }
604 
605 /* generic shutup callback;
606  * just turning off EAPD and a little pause for avoiding pop-noise
607  */
alc_eapd_shutup(struct hda_codec * codec)608 static void alc_eapd_shutup(struct hda_codec *codec)
609 {
610 	struct alc_spec *spec = codec->spec;
611 
612 	alc_auto_setup_eapd(codec, false);
613 	if (!spec->no_depop_delay)
614 		msleep(200);
615 	alc_shutup_pins(codec);
616 }
617 
618 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)619 static void alc_auto_init_amp(struct hda_codec *codec, int type)
620 {
621 	alc_auto_setup_eapd(codec, true);
622 	alc_write_gpio(codec);
623 	switch (type) {
624 	case ALC_INIT_DEFAULT:
625 		switch (codec->core.vendor_id) {
626 		case 0x10ec0260:
627 			alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
628 			break;
629 		case 0x10ec0880:
630 		case 0x10ec0882:
631 		case 0x10ec0883:
632 		case 0x10ec0885:
633 			alc_update_coef_idx(codec, 7, 0, 0x2030);
634 			break;
635 		case 0x10ec0888:
636 			alc888_coef_init(codec);
637 			break;
638 		}
639 		break;
640 	}
641 }
642 
643 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)644 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
645 {
646 	if (spec->gen.autocfg.hp_pins[0])
647 		return spec->gen.autocfg.hp_pins[0];
648 	if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
649 		return spec->gen.autocfg.line_out_pins[0];
650 	return 0;
651 }
652 
653 /*
654  * Realtek SSID verification
655  */
656 
657 /* Could be any non-zero and even value. When used as fixup, tells
658  * the driver to ignore any present sku defines.
659  */
660 #define ALC_FIXUP_SKU_IGNORE (2)
661 
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)662 static void alc_fixup_sku_ignore(struct hda_codec *codec,
663 				 const struct hda_fixup *fix, int action)
664 {
665 	struct alc_spec *spec = codec->spec;
666 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
667 		spec->cdefine.fixup = 1;
668 		spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
669 	}
670 }
671 
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)672 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
673 				    const struct hda_fixup *fix, int action)
674 {
675 	struct alc_spec *spec = codec->spec;
676 
677 	if (action == HDA_FIXUP_ACT_PROBE) {
678 		spec->no_depop_delay = 1;
679 		codec->depop_delay = 0;
680 	}
681 }
682 
alc_auto_parse_customize_define(struct hda_codec * codec)683 static int alc_auto_parse_customize_define(struct hda_codec *codec)
684 {
685 	unsigned int ass, tmp, i;
686 	unsigned nid = 0;
687 	struct alc_spec *spec = codec->spec;
688 
689 	spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
690 
691 	if (spec->cdefine.fixup) {
692 		ass = spec->cdefine.sku_cfg;
693 		if (ass == ALC_FIXUP_SKU_IGNORE)
694 			return -1;
695 		goto do_sku;
696 	}
697 
698 	if (!codec->bus->pci)
699 		return -1;
700 	ass = codec->core.subsystem_id & 0xffff;
701 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
702 		goto do_sku;
703 
704 	nid = 0x1d;
705 	if (codec->core.vendor_id == 0x10ec0260)
706 		nid = 0x17;
707 	ass = snd_hda_codec_get_pincfg(codec, nid);
708 
709 	if (!(ass & 1)) {
710 		codec_info(codec, "%s: SKU not ready 0x%08x\n",
711 			   codec->core.chip_name, ass);
712 		return -1;
713 	}
714 
715 	/* check sum */
716 	tmp = 0;
717 	for (i = 1; i < 16; i++) {
718 		if ((ass >> i) & 1)
719 			tmp++;
720 	}
721 	if (((ass >> 16) & 0xf) != tmp)
722 		return -1;
723 
724 	spec->cdefine.port_connectivity = ass >> 30;
725 	spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
726 	spec->cdefine.check_sum = (ass >> 16) & 0xf;
727 	spec->cdefine.customization = ass >> 8;
728 do_sku:
729 	spec->cdefine.sku_cfg = ass;
730 	spec->cdefine.external_amp = (ass & 0x38) >> 3;
731 	spec->cdefine.platform_type = (ass & 0x4) >> 2;
732 	spec->cdefine.swap = (ass & 0x2) >> 1;
733 	spec->cdefine.override = ass & 0x1;
734 
735 	codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
736 		   nid, spec->cdefine.sku_cfg);
737 	codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
738 		   spec->cdefine.port_connectivity);
739 	codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
740 	codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
741 	codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
742 	codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
743 	codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
744 	codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
745 	codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
746 
747 	return 0;
748 }
749 
750 /* 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)751 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
752 {
753 	int i;
754 	for (i = 0; i < nums; i++)
755 		if (list[i] == nid)
756 			return i;
757 	return -1;
758 }
759 /* 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)760 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
761 {
762 	return find_idx_in_nid_list(nid, list, nums) >= 0;
763 }
764 
765 /* check subsystem ID and set up device-specific initialization;
766  * return 1 if initialized, 0 if invalid SSID
767  */
768 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
769  *	31 ~ 16 :	Manufacture ID
770  *	15 ~ 8	:	SKU ID
771  *	7  ~ 0	:	Assembly ID
772  *	port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
773  */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)774 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
775 {
776 	unsigned int ass, tmp, i;
777 	unsigned nid;
778 	struct alc_spec *spec = codec->spec;
779 
780 	if (spec->cdefine.fixup) {
781 		ass = spec->cdefine.sku_cfg;
782 		if (ass == ALC_FIXUP_SKU_IGNORE)
783 			return 0;
784 		goto do_sku;
785 	}
786 
787 	ass = codec->core.subsystem_id & 0xffff;
788 	if (codec->bus->pci &&
789 	    ass != codec->bus->pci->subsystem_device && (ass & 1))
790 		goto do_sku;
791 
792 	/* invalid SSID, check the special NID pin defcfg instead */
793 	/*
794 	 * 31~30	: port connectivity
795 	 * 29~21	: reserve
796 	 * 20		: PCBEEP input
797 	 * 19~16	: Check sum (15:1)
798 	 * 15~1		: Custom
799 	 * 0		: override
800 	*/
801 	nid = 0x1d;
802 	if (codec->core.vendor_id == 0x10ec0260)
803 		nid = 0x17;
804 	ass = snd_hda_codec_get_pincfg(codec, nid);
805 	codec_dbg(codec,
806 		  "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
807 		   ass, nid);
808 	if (!(ass & 1))
809 		return 0;
810 	if ((ass >> 30) != 1)	/* no physical connection */
811 		return 0;
812 
813 	/* check sum */
814 	tmp = 0;
815 	for (i = 1; i < 16; i++) {
816 		if ((ass >> i) & 1)
817 			tmp++;
818 	}
819 	if (((ass >> 16) & 0xf) != tmp)
820 		return 0;
821 do_sku:
822 	codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
823 		   ass & 0xffff, codec->core.vendor_id);
824 	/*
825 	 * 0 : override
826 	 * 1 :	Swap Jack
827 	 * 2 : 0 --> Desktop, 1 --> Laptop
828 	 * 3~5 : External Amplifier control
829 	 * 7~6 : Reserved
830 	*/
831 	tmp = (ass & 0x38) >> 3;	/* external Amp control */
832 	if (spec->init_amp == ALC_INIT_UNDEFINED) {
833 		switch (tmp) {
834 		case 1:
835 			alc_setup_gpio(codec, 0x01);
836 			break;
837 		case 3:
838 			alc_setup_gpio(codec, 0x02);
839 			break;
840 		case 7:
841 			alc_setup_gpio(codec, 0x04);
842 			break;
843 		case 5:
844 		default:
845 			spec->init_amp = ALC_INIT_DEFAULT;
846 			break;
847 		}
848 	}
849 
850 	/* is laptop or Desktop and enable the function "Mute internal speaker
851 	 * when the external headphone out jack is plugged"
852 	 */
853 	if (!(ass & 0x8000))
854 		return 1;
855 	/*
856 	 * 10~8 : Jack location
857 	 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
858 	 * 14~13: Resvered
859 	 * 15   : 1 --> enable the function "Mute internal speaker
860 	 *	        when the external headphone out jack is plugged"
861 	 */
862 	if (!alc_get_hp_pin(spec)) {
863 		hda_nid_t nid;
864 		tmp = (ass >> 11) & 0x3;	/* HP to chassis */
865 		nid = ports[tmp];
866 		if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
867 				      spec->gen.autocfg.line_outs))
868 			return 1;
869 		spec->gen.autocfg.hp_pins[0] = nid;
870 	}
871 	return 1;
872 }
873 
874 /* Check the validity of ALC subsystem-id
875  * 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)876 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
877 {
878 	if (!alc_subsystem_id(codec, ports)) {
879 		struct alc_spec *spec = codec->spec;
880 		if (spec->init_amp == ALC_INIT_UNDEFINED) {
881 			codec_dbg(codec,
882 				  "realtek: Enable default setup for auto mode as fallback\n");
883 			spec->init_amp = ALC_INIT_DEFAULT;
884 		}
885 	}
886 }
887 
888 /*
889  */
890 
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)891 static void alc_fixup_inv_dmic(struct hda_codec *codec,
892 			       const struct hda_fixup *fix, int action)
893 {
894 	struct alc_spec *spec = codec->spec;
895 
896 	spec->gen.inv_dmic_split = 1;
897 }
898 
899 
alc_build_controls(struct hda_codec * codec)900 static int alc_build_controls(struct hda_codec *codec)
901 {
902 	int err;
903 
904 	err = snd_hda_gen_build_controls(codec);
905 	if (err < 0)
906 		return err;
907 
908 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
909 	return 0;
910 }
911 
912 
913 /*
914  * Common callbacks
915  */
916 
alc_pre_init(struct hda_codec * codec)917 static void alc_pre_init(struct hda_codec *codec)
918 {
919 	alc_fill_eapd_coef(codec);
920 }
921 
922 #define is_s3_resume(codec) \
923 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
924 #define is_s4_resume(codec) \
925 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
926 
alc_init(struct hda_codec * codec)927 static int alc_init(struct hda_codec *codec)
928 {
929 	struct alc_spec *spec = codec->spec;
930 
931 	/* hibernation resume needs the full chip initialization */
932 	if (is_s4_resume(codec))
933 		alc_pre_init(codec);
934 
935 	if (spec->init_hook)
936 		spec->init_hook(codec);
937 
938 	spec->gen.skip_verbs = 1; /* applied in below */
939 	snd_hda_gen_init(codec);
940 	alc_fix_pll(codec);
941 	alc_auto_init_amp(codec, spec->init_amp);
942 	snd_hda_apply_verbs(codec); /* apply verbs here after own init */
943 
944 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
945 
946 	return 0;
947 }
948 
949 #define alc_free	snd_hda_gen_free
950 
951 #ifdef CONFIG_PM
alc_shutup(struct hda_codec * codec)952 static inline void alc_shutup(struct hda_codec *codec)
953 {
954 	struct alc_spec *spec = codec->spec;
955 
956 	if (!snd_hda_get_bool_hint(codec, "shutup"))
957 		return; /* disabled explicitly by hints */
958 
959 	if (spec && spec->shutup)
960 		spec->shutup(codec);
961 	else
962 		alc_shutup_pins(codec);
963 }
964 
alc_power_eapd(struct hda_codec * codec)965 static void alc_power_eapd(struct hda_codec *codec)
966 {
967 	alc_auto_setup_eapd(codec, false);
968 }
969 
alc_suspend(struct hda_codec * codec)970 static int alc_suspend(struct hda_codec *codec)
971 {
972 	struct alc_spec *spec = codec->spec;
973 	alc_shutup(codec);
974 	if (spec && spec->power_hook)
975 		spec->power_hook(codec);
976 	return 0;
977 }
978 
alc_resume(struct hda_codec * codec)979 static int alc_resume(struct hda_codec *codec)
980 {
981 	struct alc_spec *spec = codec->spec;
982 
983 	if (!spec->no_depop_delay)
984 		msleep(150); /* to avoid pop noise */
985 	codec->patch_ops.init(codec);
986 	snd_hda_regmap_sync(codec);
987 	hda_call_check_power_status(codec, 0x01);
988 	return 0;
989 }
990 #endif
991 
992 /*
993  */
994 static const struct hda_codec_ops alc_patch_ops = {
995 	.build_controls = alc_build_controls,
996 	.build_pcms = snd_hda_gen_build_pcms,
997 	.init = alc_init,
998 	.free = alc_free,
999 	.unsol_event = snd_hda_jack_unsol_event,
1000 #ifdef CONFIG_PM
1001 	.resume = alc_resume,
1002 	.suspend = alc_suspend,
1003 	.check_power_status = snd_hda_gen_check_power_status,
1004 #endif
1005 };
1006 
1007 
1008 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1009 
1010 /*
1011  * Rename codecs appropriately from COEF value or subvendor id
1012  */
1013 struct alc_codec_rename_table {
1014 	unsigned int vendor_id;
1015 	unsigned short coef_mask;
1016 	unsigned short coef_bits;
1017 	const char *name;
1018 };
1019 
1020 struct alc_codec_rename_pci_table {
1021 	unsigned int codec_vendor_id;
1022 	unsigned short pci_subvendor;
1023 	unsigned short pci_subdevice;
1024 	const char *name;
1025 };
1026 
1027 static const struct alc_codec_rename_table rename_tbl[] = {
1028 	{ 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1029 	{ 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1030 	{ 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1031 	{ 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1032 	{ 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1033 	{ 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1034 	{ 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1035 	{ 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1036 	{ 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1037 	{ 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1038 	{ 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1039 	{ 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1040 	{ 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1041 	{ 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1042 	{ 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1043 	{ 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1044 	{ 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1045 	{ } /* terminator */
1046 };
1047 
1048 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1049 	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
1050 	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
1051 	{ 0x10ec0283, 0x1028, 0, "ALC3223" },
1052 	{ 0x10ec0288, 0x1028, 0, "ALC3263" },
1053 	{ 0x10ec0292, 0x1028, 0, "ALC3226" },
1054 	{ 0x10ec0293, 0x1028, 0, "ALC3235" },
1055 	{ 0x10ec0255, 0x1028, 0, "ALC3234" },
1056 	{ 0x10ec0668, 0x1028, 0, "ALC3661" },
1057 	{ 0x10ec0275, 0x1028, 0, "ALC3260" },
1058 	{ 0x10ec0899, 0x1028, 0, "ALC3861" },
1059 	{ 0x10ec0298, 0x1028, 0, "ALC3266" },
1060 	{ 0x10ec0236, 0x1028, 0, "ALC3204" },
1061 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
1062 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
1063 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
1064 	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
1065 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
1066 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
1067 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
1068 	{ 0x10ec0233, 0x1043, 0, "ALC3236" },
1069 	{ 0x10ec0280, 0x103c, 0, "ALC3228" },
1070 	{ 0x10ec0282, 0x103c, 0, "ALC3227" },
1071 	{ 0x10ec0286, 0x103c, 0, "ALC3242" },
1072 	{ 0x10ec0290, 0x103c, 0, "ALC3241" },
1073 	{ 0x10ec0668, 0x103c, 0, "ALC3662" },
1074 	{ 0x10ec0283, 0x17aa, 0, "ALC3239" },
1075 	{ 0x10ec0292, 0x17aa, 0, "ALC3232" },
1076 	{ } /* terminator */
1077 };
1078 
alc_codec_rename_from_preset(struct hda_codec * codec)1079 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1080 {
1081 	const struct alc_codec_rename_table *p;
1082 	const struct alc_codec_rename_pci_table *q;
1083 
1084 	for (p = rename_tbl; p->vendor_id; p++) {
1085 		if (p->vendor_id != codec->core.vendor_id)
1086 			continue;
1087 		if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1088 			return alc_codec_rename(codec, p->name);
1089 	}
1090 
1091 	if (!codec->bus->pci)
1092 		return 0;
1093 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1094 		if (q->codec_vendor_id != codec->core.vendor_id)
1095 			continue;
1096 		if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1097 			continue;
1098 		if (!q->pci_subdevice ||
1099 		    q->pci_subdevice == codec->bus->pci->subsystem_device)
1100 			return alc_codec_rename(codec, q->name);
1101 	}
1102 
1103 	return 0;
1104 }
1105 
1106 
1107 /*
1108  * Digital-beep handlers
1109  */
1110 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1111 
1112 /* additional beep mixers; private_value will be overwritten */
1113 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1114 	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1115 	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1116 };
1117 
1118 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1119 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1120 			int idx, int dir)
1121 {
1122 	struct snd_kcontrol_new *knew;
1123 	unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1124 	int i;
1125 
1126 	for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1127 		knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1128 					    &alc_beep_mixer[i]);
1129 		if (!knew)
1130 			return -ENOMEM;
1131 		knew->private_value = beep_amp;
1132 	}
1133 	return 0;
1134 }
1135 
1136 static const struct snd_pci_quirk beep_allow_list[] = {
1137 	SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1138 	SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1139 	SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1140 	SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1141 	SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1142 	SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1143 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1144 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1145 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1146 	/* denylist -- no beep available */
1147 	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1148 	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1149 	{}
1150 };
1151 
has_cdefine_beep(struct hda_codec * codec)1152 static inline int has_cdefine_beep(struct hda_codec *codec)
1153 {
1154 	struct alc_spec *spec = codec->spec;
1155 	const struct snd_pci_quirk *q;
1156 	q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1157 	if (q)
1158 		return q->value;
1159 	return spec->cdefine.enable_pcbeep;
1160 }
1161 #else
1162 #define set_beep_amp(spec, nid, idx, dir)	0
1163 #define has_cdefine_beep(codec)		0
1164 #endif
1165 
1166 /* parse the BIOS configuration and set up the alc_spec */
1167 /* return 1 if successful, 0 if the proper config is not found,
1168  * or a negative error code
1169  */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1170 static int alc_parse_auto_config(struct hda_codec *codec,
1171 				 const hda_nid_t *ignore_nids,
1172 				 const hda_nid_t *ssid_nids)
1173 {
1174 	struct alc_spec *spec = codec->spec;
1175 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1176 	int err;
1177 
1178 	err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1179 				       spec->parse_flags);
1180 	if (err < 0)
1181 		return err;
1182 
1183 	if (ssid_nids)
1184 		alc_ssid_check(codec, ssid_nids);
1185 
1186 	err = snd_hda_gen_parse_auto_config(codec, cfg);
1187 	if (err < 0)
1188 		return err;
1189 
1190 	return 1;
1191 }
1192 
1193 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1194 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1195 {
1196 	struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1197 	int err;
1198 
1199 	if (!spec)
1200 		return -ENOMEM;
1201 	codec->spec = spec;
1202 	snd_hda_gen_spec_init(&spec->gen);
1203 	spec->gen.mixer_nid = mixer_nid;
1204 	spec->gen.own_eapd_ctl = 1;
1205 	codec->single_adc_amp = 1;
1206 	/* FIXME: do we need this for all Realtek codec models? */
1207 	codec->spdif_status_reset = 1;
1208 	codec->forced_resume = 1;
1209 	codec->patch_ops = alc_patch_ops;
1210 	mutex_init(&spec->coef_mutex);
1211 
1212 	err = alc_codec_rename_from_preset(codec);
1213 	if (err < 0) {
1214 		kfree(spec);
1215 		return err;
1216 	}
1217 	return 0;
1218 }
1219 
alc880_parse_auto_config(struct hda_codec * codec)1220 static int alc880_parse_auto_config(struct hda_codec *codec)
1221 {
1222 	static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1223 	static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1224 	return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1225 }
1226 
1227 /*
1228  * ALC880 fix-ups
1229  */
1230 enum {
1231 	ALC880_FIXUP_GPIO1,
1232 	ALC880_FIXUP_GPIO2,
1233 	ALC880_FIXUP_MEDION_RIM,
1234 	ALC880_FIXUP_LG,
1235 	ALC880_FIXUP_LG_LW25,
1236 	ALC880_FIXUP_W810,
1237 	ALC880_FIXUP_EAPD_COEF,
1238 	ALC880_FIXUP_TCL_S700,
1239 	ALC880_FIXUP_VOL_KNOB,
1240 	ALC880_FIXUP_FUJITSU,
1241 	ALC880_FIXUP_F1734,
1242 	ALC880_FIXUP_UNIWILL,
1243 	ALC880_FIXUP_UNIWILL_DIG,
1244 	ALC880_FIXUP_Z71V,
1245 	ALC880_FIXUP_ASUS_W5A,
1246 	ALC880_FIXUP_3ST_BASE,
1247 	ALC880_FIXUP_3ST,
1248 	ALC880_FIXUP_3ST_DIG,
1249 	ALC880_FIXUP_5ST_BASE,
1250 	ALC880_FIXUP_5ST,
1251 	ALC880_FIXUP_5ST_DIG,
1252 	ALC880_FIXUP_6ST_BASE,
1253 	ALC880_FIXUP_6ST,
1254 	ALC880_FIXUP_6ST_DIG,
1255 	ALC880_FIXUP_6ST_AUTOMUTE,
1256 };
1257 
1258 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1259 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1260 				  const struct hda_fixup *fix, int action)
1261 {
1262 	if (action == HDA_FIXUP_ACT_PROBE)
1263 		snd_hda_jack_detect_enable_callback(codec, 0x21,
1264 						    alc_update_knob_master);
1265 }
1266 
1267 static const struct hda_fixup alc880_fixups[] = {
1268 	[ALC880_FIXUP_GPIO1] = {
1269 		.type = HDA_FIXUP_FUNC,
1270 		.v.func = alc_fixup_gpio1,
1271 	},
1272 	[ALC880_FIXUP_GPIO2] = {
1273 		.type = HDA_FIXUP_FUNC,
1274 		.v.func = alc_fixup_gpio2,
1275 	},
1276 	[ALC880_FIXUP_MEDION_RIM] = {
1277 		.type = HDA_FIXUP_VERBS,
1278 		.v.verbs = (const struct hda_verb[]) {
1279 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1280 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1281 			{ }
1282 		},
1283 		.chained = true,
1284 		.chain_id = ALC880_FIXUP_GPIO2,
1285 	},
1286 	[ALC880_FIXUP_LG] = {
1287 		.type = HDA_FIXUP_PINS,
1288 		.v.pins = (const struct hda_pintbl[]) {
1289 			/* disable bogus unused pins */
1290 			{ 0x16, 0x411111f0 },
1291 			{ 0x18, 0x411111f0 },
1292 			{ 0x1a, 0x411111f0 },
1293 			{ }
1294 		}
1295 	},
1296 	[ALC880_FIXUP_LG_LW25] = {
1297 		.type = HDA_FIXUP_PINS,
1298 		.v.pins = (const struct hda_pintbl[]) {
1299 			{ 0x1a, 0x0181344f }, /* line-in */
1300 			{ 0x1b, 0x0321403f }, /* headphone */
1301 			{ }
1302 		}
1303 	},
1304 	[ALC880_FIXUP_W810] = {
1305 		.type = HDA_FIXUP_PINS,
1306 		.v.pins = (const struct hda_pintbl[]) {
1307 			/* disable bogus unused pins */
1308 			{ 0x17, 0x411111f0 },
1309 			{ }
1310 		},
1311 		.chained = true,
1312 		.chain_id = ALC880_FIXUP_GPIO2,
1313 	},
1314 	[ALC880_FIXUP_EAPD_COEF] = {
1315 		.type = HDA_FIXUP_VERBS,
1316 		.v.verbs = (const struct hda_verb[]) {
1317 			/* change to EAPD mode */
1318 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1319 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1320 			{}
1321 		},
1322 	},
1323 	[ALC880_FIXUP_TCL_S700] = {
1324 		.type = HDA_FIXUP_VERBS,
1325 		.v.verbs = (const struct hda_verb[]) {
1326 			/* change to EAPD mode */
1327 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1328 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3070 },
1329 			{}
1330 		},
1331 		.chained = true,
1332 		.chain_id = ALC880_FIXUP_GPIO2,
1333 	},
1334 	[ALC880_FIXUP_VOL_KNOB] = {
1335 		.type = HDA_FIXUP_FUNC,
1336 		.v.func = alc880_fixup_vol_knob,
1337 	},
1338 	[ALC880_FIXUP_FUJITSU] = {
1339 		/* override all pins as BIOS on old Amilo is broken */
1340 		.type = HDA_FIXUP_PINS,
1341 		.v.pins = (const struct hda_pintbl[]) {
1342 			{ 0x14, 0x0121401f }, /* HP */
1343 			{ 0x15, 0x99030120 }, /* speaker */
1344 			{ 0x16, 0x99030130 }, /* bass speaker */
1345 			{ 0x17, 0x411111f0 }, /* N/A */
1346 			{ 0x18, 0x411111f0 }, /* N/A */
1347 			{ 0x19, 0x01a19950 }, /* mic-in */
1348 			{ 0x1a, 0x411111f0 }, /* N/A */
1349 			{ 0x1b, 0x411111f0 }, /* N/A */
1350 			{ 0x1c, 0x411111f0 }, /* N/A */
1351 			{ 0x1d, 0x411111f0 }, /* N/A */
1352 			{ 0x1e, 0x01454140 }, /* SPDIF out */
1353 			{ }
1354 		},
1355 		.chained = true,
1356 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1357 	},
1358 	[ALC880_FIXUP_F1734] = {
1359 		/* almost compatible with FUJITSU, but no bass and SPDIF */
1360 		.type = HDA_FIXUP_PINS,
1361 		.v.pins = (const struct hda_pintbl[]) {
1362 			{ 0x14, 0x0121401f }, /* HP */
1363 			{ 0x15, 0x99030120 }, /* speaker */
1364 			{ 0x16, 0x411111f0 }, /* N/A */
1365 			{ 0x17, 0x411111f0 }, /* N/A */
1366 			{ 0x18, 0x411111f0 }, /* N/A */
1367 			{ 0x19, 0x01a19950 }, /* mic-in */
1368 			{ 0x1a, 0x411111f0 }, /* N/A */
1369 			{ 0x1b, 0x411111f0 }, /* N/A */
1370 			{ 0x1c, 0x411111f0 }, /* N/A */
1371 			{ 0x1d, 0x411111f0 }, /* N/A */
1372 			{ 0x1e, 0x411111f0 }, /* N/A */
1373 			{ }
1374 		},
1375 		.chained = true,
1376 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1377 	},
1378 	[ALC880_FIXUP_UNIWILL] = {
1379 		/* need to fix HP and speaker pins to be parsed correctly */
1380 		.type = HDA_FIXUP_PINS,
1381 		.v.pins = (const struct hda_pintbl[]) {
1382 			{ 0x14, 0x0121411f }, /* HP */
1383 			{ 0x15, 0x99030120 }, /* speaker */
1384 			{ 0x16, 0x99030130 }, /* bass speaker */
1385 			{ }
1386 		},
1387 	},
1388 	[ALC880_FIXUP_UNIWILL_DIG] = {
1389 		.type = HDA_FIXUP_PINS,
1390 		.v.pins = (const struct hda_pintbl[]) {
1391 			/* disable bogus unused pins */
1392 			{ 0x17, 0x411111f0 },
1393 			{ 0x19, 0x411111f0 },
1394 			{ 0x1b, 0x411111f0 },
1395 			{ 0x1f, 0x411111f0 },
1396 			{ }
1397 		}
1398 	},
1399 	[ALC880_FIXUP_Z71V] = {
1400 		.type = HDA_FIXUP_PINS,
1401 		.v.pins = (const struct hda_pintbl[]) {
1402 			/* set up the whole pins as BIOS is utterly broken */
1403 			{ 0x14, 0x99030120 }, /* speaker */
1404 			{ 0x15, 0x0121411f }, /* HP */
1405 			{ 0x16, 0x411111f0 }, /* N/A */
1406 			{ 0x17, 0x411111f0 }, /* N/A */
1407 			{ 0x18, 0x01a19950 }, /* mic-in */
1408 			{ 0x19, 0x411111f0 }, /* N/A */
1409 			{ 0x1a, 0x01813031 }, /* line-in */
1410 			{ 0x1b, 0x411111f0 }, /* N/A */
1411 			{ 0x1c, 0x411111f0 }, /* N/A */
1412 			{ 0x1d, 0x411111f0 }, /* N/A */
1413 			{ 0x1e, 0x0144111e }, /* SPDIF */
1414 			{ }
1415 		}
1416 	},
1417 	[ALC880_FIXUP_ASUS_W5A] = {
1418 		.type = HDA_FIXUP_PINS,
1419 		.v.pins = (const struct hda_pintbl[]) {
1420 			/* set up the whole pins as BIOS is utterly broken */
1421 			{ 0x14, 0x0121411f }, /* HP */
1422 			{ 0x15, 0x411111f0 }, /* N/A */
1423 			{ 0x16, 0x411111f0 }, /* N/A */
1424 			{ 0x17, 0x411111f0 }, /* N/A */
1425 			{ 0x18, 0x90a60160 }, /* mic */
1426 			{ 0x19, 0x411111f0 }, /* N/A */
1427 			{ 0x1a, 0x411111f0 }, /* N/A */
1428 			{ 0x1b, 0x411111f0 }, /* N/A */
1429 			{ 0x1c, 0x411111f0 }, /* N/A */
1430 			{ 0x1d, 0x411111f0 }, /* N/A */
1431 			{ 0x1e, 0xb743111e }, /* SPDIF out */
1432 			{ }
1433 		},
1434 		.chained = true,
1435 		.chain_id = ALC880_FIXUP_GPIO1,
1436 	},
1437 	[ALC880_FIXUP_3ST_BASE] = {
1438 		.type = HDA_FIXUP_PINS,
1439 		.v.pins = (const struct hda_pintbl[]) {
1440 			{ 0x14, 0x01014010 }, /* line-out */
1441 			{ 0x15, 0x411111f0 }, /* N/A */
1442 			{ 0x16, 0x411111f0 }, /* N/A */
1443 			{ 0x17, 0x411111f0 }, /* N/A */
1444 			{ 0x18, 0x01a19c30 }, /* mic-in */
1445 			{ 0x19, 0x0121411f }, /* HP */
1446 			{ 0x1a, 0x01813031 }, /* line-in */
1447 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1448 			{ 0x1c, 0x411111f0 }, /* N/A */
1449 			{ 0x1d, 0x411111f0 }, /* N/A */
1450 			/* 0x1e is filled in below */
1451 			{ 0x1f, 0x411111f0 }, /* N/A */
1452 			{ }
1453 		}
1454 	},
1455 	[ALC880_FIXUP_3ST] = {
1456 		.type = HDA_FIXUP_PINS,
1457 		.v.pins = (const struct hda_pintbl[]) {
1458 			{ 0x1e, 0x411111f0 }, /* N/A */
1459 			{ }
1460 		},
1461 		.chained = true,
1462 		.chain_id = ALC880_FIXUP_3ST_BASE,
1463 	},
1464 	[ALC880_FIXUP_3ST_DIG] = {
1465 		.type = HDA_FIXUP_PINS,
1466 		.v.pins = (const struct hda_pintbl[]) {
1467 			{ 0x1e, 0x0144111e }, /* SPDIF */
1468 			{ }
1469 		},
1470 		.chained = true,
1471 		.chain_id = ALC880_FIXUP_3ST_BASE,
1472 	},
1473 	[ALC880_FIXUP_5ST_BASE] = {
1474 		.type = HDA_FIXUP_PINS,
1475 		.v.pins = (const struct hda_pintbl[]) {
1476 			{ 0x14, 0x01014010 }, /* front */
1477 			{ 0x15, 0x411111f0 }, /* N/A */
1478 			{ 0x16, 0x01011411 }, /* CLFE */
1479 			{ 0x17, 0x01016412 }, /* surr */
1480 			{ 0x18, 0x01a19c30 }, /* mic-in */
1481 			{ 0x19, 0x0121411f }, /* HP */
1482 			{ 0x1a, 0x01813031 }, /* line-in */
1483 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1484 			{ 0x1c, 0x411111f0 }, /* N/A */
1485 			{ 0x1d, 0x411111f0 }, /* N/A */
1486 			/* 0x1e is filled in below */
1487 			{ 0x1f, 0x411111f0 }, /* N/A */
1488 			{ }
1489 		}
1490 	},
1491 	[ALC880_FIXUP_5ST] = {
1492 		.type = HDA_FIXUP_PINS,
1493 		.v.pins = (const struct hda_pintbl[]) {
1494 			{ 0x1e, 0x411111f0 }, /* N/A */
1495 			{ }
1496 		},
1497 		.chained = true,
1498 		.chain_id = ALC880_FIXUP_5ST_BASE,
1499 	},
1500 	[ALC880_FIXUP_5ST_DIG] = {
1501 		.type = HDA_FIXUP_PINS,
1502 		.v.pins = (const struct hda_pintbl[]) {
1503 			{ 0x1e, 0x0144111e }, /* SPDIF */
1504 			{ }
1505 		},
1506 		.chained = true,
1507 		.chain_id = ALC880_FIXUP_5ST_BASE,
1508 	},
1509 	[ALC880_FIXUP_6ST_BASE] = {
1510 		.type = HDA_FIXUP_PINS,
1511 		.v.pins = (const struct hda_pintbl[]) {
1512 			{ 0x14, 0x01014010 }, /* front */
1513 			{ 0x15, 0x01016412 }, /* surr */
1514 			{ 0x16, 0x01011411 }, /* CLFE */
1515 			{ 0x17, 0x01012414 }, /* side */
1516 			{ 0x18, 0x01a19c30 }, /* mic-in */
1517 			{ 0x19, 0x02a19c40 }, /* front-mic */
1518 			{ 0x1a, 0x01813031 }, /* line-in */
1519 			{ 0x1b, 0x0121411f }, /* HP */
1520 			{ 0x1c, 0x411111f0 }, /* N/A */
1521 			{ 0x1d, 0x411111f0 }, /* N/A */
1522 			/* 0x1e is filled in below */
1523 			{ 0x1f, 0x411111f0 }, /* N/A */
1524 			{ }
1525 		}
1526 	},
1527 	[ALC880_FIXUP_6ST] = {
1528 		.type = HDA_FIXUP_PINS,
1529 		.v.pins = (const struct hda_pintbl[]) {
1530 			{ 0x1e, 0x411111f0 }, /* N/A */
1531 			{ }
1532 		},
1533 		.chained = true,
1534 		.chain_id = ALC880_FIXUP_6ST_BASE,
1535 	},
1536 	[ALC880_FIXUP_6ST_DIG] = {
1537 		.type = HDA_FIXUP_PINS,
1538 		.v.pins = (const struct hda_pintbl[]) {
1539 			{ 0x1e, 0x0144111e }, /* SPDIF */
1540 			{ }
1541 		},
1542 		.chained = true,
1543 		.chain_id = ALC880_FIXUP_6ST_BASE,
1544 	},
1545 	[ALC880_FIXUP_6ST_AUTOMUTE] = {
1546 		.type = HDA_FIXUP_PINS,
1547 		.v.pins = (const struct hda_pintbl[]) {
1548 			{ 0x1b, 0x0121401f }, /* HP with jack detect */
1549 			{ }
1550 		},
1551 		.chained_before = true,
1552 		.chain_id = ALC880_FIXUP_6ST_BASE,
1553 	},
1554 };
1555 
1556 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1557 	SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1558 	SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1559 	SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1560 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1561 	SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1562 	SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1563 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1564 	SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1565 	SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1566 	SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1567 	SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1568 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1569 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1570 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1571 	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1572 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1573 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1574 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1575 	SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1576 	SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1577 	SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1578 	SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1579 	SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1580 
1581 	/* Below is the copied entries from alc880_quirks.c.
1582 	 * It's not quite sure whether BIOS sets the correct pin-config table
1583 	 * on these machines, thus they are kept to be compatible with
1584 	 * the old static quirks.  Once when it's confirmed to work without
1585 	 * these overrides, it'd be better to remove.
1586 	 */
1587 	SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1588 	SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1589 	SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1590 	SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1591 	SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1592 	SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1593 	SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1594 	SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1595 	SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1596 	SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1597 	SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1598 	SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1599 	SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1600 	SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1601 	SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1602 	SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1603 	SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1604 	SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1605 	SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1606 	SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1607 	SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1608 	SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1609 	SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1610 	SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1611 	SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1612 	SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1613 	SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1614 	SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1615 	SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1616 	SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1617 	SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1618 	SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1619 	SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1620 	/* default Intel */
1621 	SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1622 	SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1623 	SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1624 	{}
1625 };
1626 
1627 static const struct hda_model_fixup alc880_fixup_models[] = {
1628 	{.id = ALC880_FIXUP_3ST, .name = "3stack"},
1629 	{.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1630 	{.id = ALC880_FIXUP_5ST, .name = "5stack"},
1631 	{.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1632 	{.id = ALC880_FIXUP_6ST, .name = "6stack"},
1633 	{.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1634 	{.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1635 	{}
1636 };
1637 
1638 
1639 /*
1640  * OK, here we have finally the patch for ALC880
1641  */
patch_alc880(struct hda_codec * codec)1642 static int patch_alc880(struct hda_codec *codec)
1643 {
1644 	struct alc_spec *spec;
1645 	int err;
1646 
1647 	err = alc_alloc_spec(codec, 0x0b);
1648 	if (err < 0)
1649 		return err;
1650 
1651 	spec = codec->spec;
1652 	spec->gen.need_dac_fix = 1;
1653 	spec->gen.beep_nid = 0x01;
1654 
1655 	codec->patch_ops.unsol_event = alc880_unsol_event;
1656 
1657 	alc_pre_init(codec);
1658 
1659 	snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1660 		       alc880_fixups);
1661 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1662 
1663 	/* automatic parse from the BIOS config */
1664 	err = alc880_parse_auto_config(codec);
1665 	if (err < 0)
1666 		goto error;
1667 
1668 	if (!spec->gen.no_analog) {
1669 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1670 		if (err < 0)
1671 			goto error;
1672 	}
1673 
1674 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1675 
1676 	return 0;
1677 
1678  error:
1679 	alc_free(codec);
1680 	return err;
1681 }
1682 
1683 
1684 /*
1685  * ALC260 support
1686  */
alc260_parse_auto_config(struct hda_codec * codec)1687 static int alc260_parse_auto_config(struct hda_codec *codec)
1688 {
1689 	static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1690 	static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1691 	return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1692 }
1693 
1694 /*
1695  * Pin config fixes
1696  */
1697 enum {
1698 	ALC260_FIXUP_HP_DC5750,
1699 	ALC260_FIXUP_HP_PIN_0F,
1700 	ALC260_FIXUP_COEF,
1701 	ALC260_FIXUP_GPIO1,
1702 	ALC260_FIXUP_GPIO1_TOGGLE,
1703 	ALC260_FIXUP_REPLACER,
1704 	ALC260_FIXUP_HP_B1900,
1705 	ALC260_FIXUP_KN1,
1706 	ALC260_FIXUP_FSC_S7020,
1707 	ALC260_FIXUP_FSC_S7020_JWSE,
1708 	ALC260_FIXUP_VAIO_PINS,
1709 };
1710 
alc260_gpio1_automute(struct hda_codec * codec)1711 static void alc260_gpio1_automute(struct hda_codec *codec)
1712 {
1713 	struct alc_spec *spec = codec->spec;
1714 
1715 	alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1716 }
1717 
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1718 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1719 				      const struct hda_fixup *fix, int action)
1720 {
1721 	struct alc_spec *spec = codec->spec;
1722 	if (action == HDA_FIXUP_ACT_PROBE) {
1723 		/* although the machine has only one output pin, we need to
1724 		 * toggle GPIO1 according to the jack state
1725 		 */
1726 		spec->gen.automute_hook = alc260_gpio1_automute;
1727 		spec->gen.detect_hp = 1;
1728 		spec->gen.automute_speaker = 1;
1729 		spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1730 		snd_hda_jack_detect_enable_callback(codec, 0x0f,
1731 						    snd_hda_gen_hp_automute);
1732 		alc_setup_gpio(codec, 0x01);
1733 	}
1734 }
1735 
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1736 static void alc260_fixup_kn1(struct hda_codec *codec,
1737 			     const struct hda_fixup *fix, int action)
1738 {
1739 	struct alc_spec *spec = codec->spec;
1740 	static const struct hda_pintbl pincfgs[] = {
1741 		{ 0x0f, 0x02214000 }, /* HP/speaker */
1742 		{ 0x12, 0x90a60160 }, /* int mic */
1743 		{ 0x13, 0x02a19000 }, /* ext mic */
1744 		{ 0x18, 0x01446000 }, /* SPDIF out */
1745 		/* disable bogus I/O pins */
1746 		{ 0x10, 0x411111f0 },
1747 		{ 0x11, 0x411111f0 },
1748 		{ 0x14, 0x411111f0 },
1749 		{ 0x15, 0x411111f0 },
1750 		{ 0x16, 0x411111f0 },
1751 		{ 0x17, 0x411111f0 },
1752 		{ 0x19, 0x411111f0 },
1753 		{ }
1754 	};
1755 
1756 	switch (action) {
1757 	case HDA_FIXUP_ACT_PRE_PROBE:
1758 		snd_hda_apply_pincfgs(codec, pincfgs);
1759 		spec->init_amp = ALC_INIT_NONE;
1760 		break;
1761 	}
1762 }
1763 
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1764 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1765 				   const struct hda_fixup *fix, int action)
1766 {
1767 	struct alc_spec *spec = codec->spec;
1768 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
1769 		spec->init_amp = ALC_INIT_NONE;
1770 }
1771 
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1772 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1773 				   const struct hda_fixup *fix, int action)
1774 {
1775 	struct alc_spec *spec = codec->spec;
1776 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1777 		spec->gen.add_jack_modes = 1;
1778 		spec->gen.hp_mic = 1;
1779 	}
1780 }
1781 
1782 static const struct hda_fixup alc260_fixups[] = {
1783 	[ALC260_FIXUP_HP_DC5750] = {
1784 		.type = HDA_FIXUP_PINS,
1785 		.v.pins = (const struct hda_pintbl[]) {
1786 			{ 0x11, 0x90130110 }, /* speaker */
1787 			{ }
1788 		}
1789 	},
1790 	[ALC260_FIXUP_HP_PIN_0F] = {
1791 		.type = HDA_FIXUP_PINS,
1792 		.v.pins = (const struct hda_pintbl[]) {
1793 			{ 0x0f, 0x01214000 }, /* HP */
1794 			{ }
1795 		}
1796 	},
1797 	[ALC260_FIXUP_COEF] = {
1798 		.type = HDA_FIXUP_VERBS,
1799 		.v.verbs = (const struct hda_verb[]) {
1800 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1801 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3040 },
1802 			{ }
1803 		},
1804 	},
1805 	[ALC260_FIXUP_GPIO1] = {
1806 		.type = HDA_FIXUP_FUNC,
1807 		.v.func = alc_fixup_gpio1,
1808 	},
1809 	[ALC260_FIXUP_GPIO1_TOGGLE] = {
1810 		.type = HDA_FIXUP_FUNC,
1811 		.v.func = alc260_fixup_gpio1_toggle,
1812 		.chained = true,
1813 		.chain_id = ALC260_FIXUP_HP_PIN_0F,
1814 	},
1815 	[ALC260_FIXUP_REPLACER] = {
1816 		.type = HDA_FIXUP_VERBS,
1817 		.v.verbs = (const struct hda_verb[]) {
1818 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1819 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3050 },
1820 			{ }
1821 		},
1822 		.chained = true,
1823 		.chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1824 	},
1825 	[ALC260_FIXUP_HP_B1900] = {
1826 		.type = HDA_FIXUP_FUNC,
1827 		.v.func = alc260_fixup_gpio1_toggle,
1828 		.chained = true,
1829 		.chain_id = ALC260_FIXUP_COEF,
1830 	},
1831 	[ALC260_FIXUP_KN1] = {
1832 		.type = HDA_FIXUP_FUNC,
1833 		.v.func = alc260_fixup_kn1,
1834 	},
1835 	[ALC260_FIXUP_FSC_S7020] = {
1836 		.type = HDA_FIXUP_FUNC,
1837 		.v.func = alc260_fixup_fsc_s7020,
1838 	},
1839 	[ALC260_FIXUP_FSC_S7020_JWSE] = {
1840 		.type = HDA_FIXUP_FUNC,
1841 		.v.func = alc260_fixup_fsc_s7020_jwse,
1842 		.chained = true,
1843 		.chain_id = ALC260_FIXUP_FSC_S7020,
1844 	},
1845 	[ALC260_FIXUP_VAIO_PINS] = {
1846 		.type = HDA_FIXUP_PINS,
1847 		.v.pins = (const struct hda_pintbl[]) {
1848 			/* Pin configs are missing completely on some VAIOs */
1849 			{ 0x0f, 0x01211020 },
1850 			{ 0x10, 0x0001003f },
1851 			{ 0x11, 0x411111f0 },
1852 			{ 0x12, 0x01a15930 },
1853 			{ 0x13, 0x411111f0 },
1854 			{ 0x14, 0x411111f0 },
1855 			{ 0x15, 0x411111f0 },
1856 			{ 0x16, 0x411111f0 },
1857 			{ 0x17, 0x411111f0 },
1858 			{ 0x18, 0x411111f0 },
1859 			{ 0x19, 0x411111f0 },
1860 			{ }
1861 		}
1862 	},
1863 };
1864 
1865 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1866 	SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1867 	SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1868 	SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1869 	SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1870 	SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1871 	SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1872 	SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1873 	SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1874 	SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1875 	SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1876 	SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1877 	SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1878 	{}
1879 };
1880 
1881 static const struct hda_model_fixup alc260_fixup_models[] = {
1882 	{.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1883 	{.id = ALC260_FIXUP_COEF, .name = "coef"},
1884 	{.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1885 	{.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1886 	{}
1887 };
1888 
1889 /*
1890  */
patch_alc260(struct hda_codec * codec)1891 static int patch_alc260(struct hda_codec *codec)
1892 {
1893 	struct alc_spec *spec;
1894 	int err;
1895 
1896 	err = alc_alloc_spec(codec, 0x07);
1897 	if (err < 0)
1898 		return err;
1899 
1900 	spec = codec->spec;
1901 	/* as quite a few machines require HP amp for speaker outputs,
1902 	 * it's easier to enable it unconditionally; even if it's unneeded,
1903 	 * it's almost harmless.
1904 	 */
1905 	spec->gen.prefer_hp_amp = 1;
1906 	spec->gen.beep_nid = 0x01;
1907 
1908 	spec->shutup = alc_eapd_shutup;
1909 
1910 	alc_pre_init(codec);
1911 
1912 	snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1913 			   alc260_fixups);
1914 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1915 
1916 	/* automatic parse from the BIOS config */
1917 	err = alc260_parse_auto_config(codec);
1918 	if (err < 0)
1919 		goto error;
1920 
1921 	if (!spec->gen.no_analog) {
1922 		err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1923 		if (err < 0)
1924 			goto error;
1925 	}
1926 
1927 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1928 
1929 	return 0;
1930 
1931  error:
1932 	alc_free(codec);
1933 	return err;
1934 }
1935 
1936 
1937 /*
1938  * ALC882/883/885/888/889 support
1939  *
1940  * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1941  * configuration.  Each pin widget can choose any input DACs and a mixer.
1942  * Each ADC is connected from a mixer of all inputs.  This makes possible
1943  * 6-channel independent captures.
1944  *
1945  * In addition, an independent DAC for the multi-playback (not used in this
1946  * driver yet).
1947  */
1948 
1949 /*
1950  * Pin config fixes
1951  */
1952 enum {
1953 	ALC882_FIXUP_ABIT_AW9D_MAX,
1954 	ALC882_FIXUP_LENOVO_Y530,
1955 	ALC882_FIXUP_PB_M5210,
1956 	ALC882_FIXUP_ACER_ASPIRE_7736,
1957 	ALC882_FIXUP_ASUS_W90V,
1958 	ALC889_FIXUP_CD,
1959 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1960 	ALC889_FIXUP_VAIO_TT,
1961 	ALC888_FIXUP_EEE1601,
1962 	ALC886_FIXUP_EAPD,
1963 	ALC882_FIXUP_EAPD,
1964 	ALC883_FIXUP_EAPD,
1965 	ALC883_FIXUP_ACER_EAPD,
1966 	ALC882_FIXUP_GPIO1,
1967 	ALC882_FIXUP_GPIO2,
1968 	ALC882_FIXUP_GPIO3,
1969 	ALC889_FIXUP_COEF,
1970 	ALC882_FIXUP_ASUS_W2JC,
1971 	ALC882_FIXUP_ACER_ASPIRE_4930G,
1972 	ALC882_FIXUP_ACER_ASPIRE_8930G,
1973 	ALC882_FIXUP_ASPIRE_8930G_VERBS,
1974 	ALC885_FIXUP_MACPRO_GPIO,
1975 	ALC889_FIXUP_DAC_ROUTE,
1976 	ALC889_FIXUP_MBP_VREF,
1977 	ALC889_FIXUP_IMAC91_VREF,
1978 	ALC889_FIXUP_MBA11_VREF,
1979 	ALC889_FIXUP_MBA21_VREF,
1980 	ALC889_FIXUP_MP11_VREF,
1981 	ALC889_FIXUP_MP41_VREF,
1982 	ALC882_FIXUP_INV_DMIC,
1983 	ALC882_FIXUP_NO_PRIMARY_HP,
1984 	ALC887_FIXUP_ASUS_BASS,
1985 	ALC887_FIXUP_BASS_CHMAP,
1986 	ALC1220_FIXUP_GB_DUAL_CODECS,
1987 	ALC1220_FIXUP_GB_X570,
1988 	ALC1220_FIXUP_CLEVO_P950,
1989 	ALC1220_FIXUP_CLEVO_PB51ED,
1990 	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1991 	ALC887_FIXUP_ASUS_AUDIO,
1992 	ALC887_FIXUP_ASUS_HMIC,
1993 	ALCS1200A_FIXUP_MIC_VREF,
1994 	ALC888VD_FIXUP_MIC_100VREF,
1995 };
1996 
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)1997 static void alc889_fixup_coef(struct hda_codec *codec,
1998 			      const struct hda_fixup *fix, int action)
1999 {
2000 	if (action != HDA_FIXUP_ACT_INIT)
2001 		return;
2002 	alc_update_coef_idx(codec, 7, 0, 0x2030);
2003 }
2004 
2005 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2006 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2007 				     const struct hda_fixup *fix, int action)
2008 {
2009 	struct alc_spec *spec = codec->spec;
2010 
2011 	spec->gpio_write_delay = true;
2012 	alc_fixup_gpio3(codec, fix, action);
2013 }
2014 
2015 /* Fix the connection of some pins for ALC889:
2016  * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2017  * work correctly (bko#42740)
2018  */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2019 static void alc889_fixup_dac_route(struct hda_codec *codec,
2020 				   const struct hda_fixup *fix, int action)
2021 {
2022 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2023 		/* fake the connections during parsing the tree */
2024 		static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2025 		static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2026 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2027 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2028 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2029 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2030 	} else if (action == HDA_FIXUP_ACT_PROBE) {
2031 		/* restore the connections */
2032 		static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2033 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2034 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2035 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2036 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2037 	}
2038 }
2039 
2040 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2041 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2042 				  const struct hda_fixup *fix, int action)
2043 {
2044 	static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2045 	struct alc_spec *spec = codec->spec;
2046 	int i;
2047 
2048 	if (action != HDA_FIXUP_ACT_INIT)
2049 		return;
2050 	for (i = 0; i < ARRAY_SIZE(nids); i++) {
2051 		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2052 		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2053 			continue;
2054 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2055 		val |= AC_PINCTL_VREF_80;
2056 		snd_hda_set_pin_ctl(codec, nids[i], val);
2057 		spec->gen.keep_vref_in_automute = 1;
2058 		break;
2059 	}
2060 }
2061 
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2062 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2063 				  const hda_nid_t *nids, int num_nids)
2064 {
2065 	struct alc_spec *spec = codec->spec;
2066 	int i;
2067 
2068 	for (i = 0; i < num_nids; i++) {
2069 		unsigned int val;
2070 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2071 		val |= AC_PINCTL_VREF_50;
2072 		snd_hda_set_pin_ctl(codec, nids[i], val);
2073 	}
2074 	spec->gen.keep_vref_in_automute = 1;
2075 }
2076 
2077 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2078 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2079 				     const struct hda_fixup *fix, int action)
2080 {
2081 	static const hda_nid_t nids[] = { 0x18, 0x1a };
2082 
2083 	if (action == HDA_FIXUP_ACT_INIT)
2084 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2085 }
2086 
2087 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2088 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2089 				    const struct hda_fixup *fix, int action)
2090 {
2091 	static const hda_nid_t nids[] = { 0x18 };
2092 
2093 	if (action == HDA_FIXUP_ACT_INIT)
2094 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2095 }
2096 
2097 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2098 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2099 				    const struct hda_fixup *fix, int action)
2100 {
2101 	static const hda_nid_t nids[] = { 0x18, 0x19 };
2102 
2103 	if (action == HDA_FIXUP_ACT_INIT)
2104 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2105 }
2106 
2107 /* Don't take HP output as primary
2108  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2109  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2110  */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2111 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2112 				       const struct hda_fixup *fix, int action)
2113 {
2114 	struct alc_spec *spec = codec->spec;
2115 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2116 		spec->gen.no_primary_hp = 1;
2117 		spec->gen.no_multi_io = 1;
2118 	}
2119 }
2120 
2121 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2122 				 const struct hda_fixup *fix, int action);
2123 
2124 /* For dual-codec configuration, we need to disable some features to avoid
2125  * conflicts of kctls and PCM streams
2126  */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2127 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2128 				  const struct hda_fixup *fix, int action)
2129 {
2130 	struct alc_spec *spec = codec->spec;
2131 
2132 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2133 		return;
2134 	/* disable vmaster */
2135 	spec->gen.suppress_vmaster = 1;
2136 	/* auto-mute and auto-mic switch don't work with multiple codecs */
2137 	spec->gen.suppress_auto_mute = 1;
2138 	spec->gen.suppress_auto_mic = 1;
2139 	/* disable aamix as well */
2140 	spec->gen.mixer_nid = 0;
2141 	/* add location prefix to avoid conflicts */
2142 	codec->force_pin_prefix = 1;
2143 }
2144 
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2145 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2146 		       const char *newname)
2147 {
2148 	struct snd_kcontrol *kctl;
2149 
2150 	kctl = snd_hda_find_mixer_ctl(codec, oldname);
2151 	if (kctl)
2152 		snd_ctl_rename(codec->card, kctl, newname);
2153 }
2154 
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2155 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2156 					 const struct hda_fixup *fix,
2157 					 int action)
2158 {
2159 	alc_fixup_dual_codecs(codec, fix, action);
2160 	switch (action) {
2161 	case HDA_FIXUP_ACT_PRE_PROBE:
2162 		/* override card longname to provide a unique UCM profile */
2163 		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2164 		break;
2165 	case HDA_FIXUP_ACT_BUILD:
2166 		/* rename Capture controls depending on the codec */
2167 		rename_ctl(codec, "Capture Volume",
2168 			   codec->addr == 0 ?
2169 			   "Rear-Panel Capture Volume" :
2170 			   "Front-Panel Capture Volume");
2171 		rename_ctl(codec, "Capture Switch",
2172 			   codec->addr == 0 ?
2173 			   "Rear-Panel Capture Switch" :
2174 			   "Front-Panel Capture Switch");
2175 		break;
2176 	}
2177 }
2178 
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2179 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2180 				     const struct hda_fixup *fix,
2181 				     int action)
2182 {
2183 	static const hda_nid_t conn1[] = { 0x0c };
2184 	static const struct coef_fw gb_x570_coefs[] = {
2185 		WRITE_COEF(0x07, 0x03c0),
2186 		WRITE_COEF(0x1a, 0x01c1),
2187 		WRITE_COEF(0x1b, 0x0202),
2188 		WRITE_COEF(0x43, 0x3005),
2189 		{}
2190 	};
2191 
2192 	switch (action) {
2193 	case HDA_FIXUP_ACT_PRE_PROBE:
2194 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2195 		snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2196 		break;
2197 	case HDA_FIXUP_ACT_INIT:
2198 		alc_process_coef_fw(codec, gb_x570_coefs);
2199 		break;
2200 	}
2201 }
2202 
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2203 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2204 				     const struct hda_fixup *fix,
2205 				     int action)
2206 {
2207 	static const hda_nid_t conn1[] = { 0x0c };
2208 
2209 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2210 		return;
2211 
2212 	alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2213 	/* We therefore want to make sure 0x14 (front headphone) and
2214 	 * 0x1b (speakers) use the stereo DAC 0x02
2215 	 */
2216 	snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2217 	snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2218 }
2219 
2220 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2221 				const struct hda_fixup *fix, int action);
2222 
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2223 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2224 				     const struct hda_fixup *fix,
2225 				     int action)
2226 {
2227 	alc1220_fixup_clevo_p950(codec, fix, action);
2228 	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2229 }
2230 
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2231 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2232 					 struct hda_jack_callback *jack)
2233 {
2234 	struct alc_spec *spec = codec->spec;
2235 	unsigned int vref;
2236 
2237 	snd_hda_gen_hp_automute(codec, jack);
2238 
2239 	if (spec->gen.hp_jack_present)
2240 		vref = AC_PINCTL_VREF_80;
2241 	else
2242 		vref = AC_PINCTL_VREF_HIZ;
2243 	snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2244 }
2245 
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2246 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2247 				     const struct hda_fixup *fix, int action)
2248 {
2249 	struct alc_spec *spec = codec->spec;
2250 	if (action != HDA_FIXUP_ACT_PROBE)
2251 		return;
2252 	snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2253 	spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2254 }
2255 
2256 static const struct hda_fixup alc882_fixups[] = {
2257 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
2258 		.type = HDA_FIXUP_PINS,
2259 		.v.pins = (const struct hda_pintbl[]) {
2260 			{ 0x15, 0x01080104 }, /* side */
2261 			{ 0x16, 0x01011012 }, /* rear */
2262 			{ 0x17, 0x01016011 }, /* clfe */
2263 			{ }
2264 		}
2265 	},
2266 	[ALC882_FIXUP_LENOVO_Y530] = {
2267 		.type = HDA_FIXUP_PINS,
2268 		.v.pins = (const struct hda_pintbl[]) {
2269 			{ 0x15, 0x99130112 }, /* rear int speakers */
2270 			{ 0x16, 0x99130111 }, /* subwoofer */
2271 			{ }
2272 		}
2273 	},
2274 	[ALC882_FIXUP_PB_M5210] = {
2275 		.type = HDA_FIXUP_PINCTLS,
2276 		.v.pins = (const struct hda_pintbl[]) {
2277 			{ 0x19, PIN_VREF50 },
2278 			{}
2279 		}
2280 	},
2281 	[ALC882_FIXUP_ACER_ASPIRE_7736] = {
2282 		.type = HDA_FIXUP_FUNC,
2283 		.v.func = alc_fixup_sku_ignore,
2284 	},
2285 	[ALC882_FIXUP_ASUS_W90V] = {
2286 		.type = HDA_FIXUP_PINS,
2287 		.v.pins = (const struct hda_pintbl[]) {
2288 			{ 0x16, 0x99130110 }, /* fix sequence for CLFE */
2289 			{ }
2290 		}
2291 	},
2292 	[ALC889_FIXUP_CD] = {
2293 		.type = HDA_FIXUP_PINS,
2294 		.v.pins = (const struct hda_pintbl[]) {
2295 			{ 0x1c, 0x993301f0 }, /* CD */
2296 			{ }
2297 		}
2298 	},
2299 	[ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2300 		.type = HDA_FIXUP_PINS,
2301 		.v.pins = (const struct hda_pintbl[]) {
2302 			{ 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2303 			{ }
2304 		},
2305 		.chained = true,
2306 		.chain_id = ALC889_FIXUP_CD,
2307 	},
2308 	[ALC889_FIXUP_VAIO_TT] = {
2309 		.type = HDA_FIXUP_PINS,
2310 		.v.pins = (const struct hda_pintbl[]) {
2311 			{ 0x17, 0x90170111 }, /* hidden surround speaker */
2312 			{ }
2313 		}
2314 	},
2315 	[ALC888_FIXUP_EEE1601] = {
2316 		.type = HDA_FIXUP_VERBS,
2317 		.v.verbs = (const struct hda_verb[]) {
2318 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2319 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x0838 },
2320 			{ }
2321 		}
2322 	},
2323 	[ALC886_FIXUP_EAPD] = {
2324 		.type = HDA_FIXUP_VERBS,
2325 		.v.verbs = (const struct hda_verb[]) {
2326 			/* change to EAPD mode */
2327 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2328 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2329 			{ }
2330 		}
2331 	},
2332 	[ALC882_FIXUP_EAPD] = {
2333 		.type = HDA_FIXUP_VERBS,
2334 		.v.verbs = (const struct hda_verb[]) {
2335 			/* change to EAPD mode */
2336 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2337 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2338 			{ }
2339 		}
2340 	},
2341 	[ALC883_FIXUP_EAPD] = {
2342 		.type = HDA_FIXUP_VERBS,
2343 		.v.verbs = (const struct hda_verb[]) {
2344 			/* change to EAPD mode */
2345 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2346 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2347 			{ }
2348 		}
2349 	},
2350 	[ALC883_FIXUP_ACER_EAPD] = {
2351 		.type = HDA_FIXUP_VERBS,
2352 		.v.verbs = (const struct hda_verb[]) {
2353 			/* eanable EAPD on Acer laptops */
2354 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2355 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2356 			{ }
2357 		}
2358 	},
2359 	[ALC882_FIXUP_GPIO1] = {
2360 		.type = HDA_FIXUP_FUNC,
2361 		.v.func = alc_fixup_gpio1,
2362 	},
2363 	[ALC882_FIXUP_GPIO2] = {
2364 		.type = HDA_FIXUP_FUNC,
2365 		.v.func = alc_fixup_gpio2,
2366 	},
2367 	[ALC882_FIXUP_GPIO3] = {
2368 		.type = HDA_FIXUP_FUNC,
2369 		.v.func = alc_fixup_gpio3,
2370 	},
2371 	[ALC882_FIXUP_ASUS_W2JC] = {
2372 		.type = HDA_FIXUP_FUNC,
2373 		.v.func = alc_fixup_gpio1,
2374 		.chained = true,
2375 		.chain_id = ALC882_FIXUP_EAPD,
2376 	},
2377 	[ALC889_FIXUP_COEF] = {
2378 		.type = HDA_FIXUP_FUNC,
2379 		.v.func = alc889_fixup_coef,
2380 	},
2381 	[ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2382 		.type = HDA_FIXUP_PINS,
2383 		.v.pins = (const struct hda_pintbl[]) {
2384 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2385 			{ 0x17, 0x99130112 }, /* surround speaker */
2386 			{ }
2387 		},
2388 		.chained = true,
2389 		.chain_id = ALC882_FIXUP_GPIO1,
2390 	},
2391 	[ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2392 		.type = HDA_FIXUP_PINS,
2393 		.v.pins = (const struct hda_pintbl[]) {
2394 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2395 			{ 0x1b, 0x99130112 }, /* surround speaker */
2396 			{ }
2397 		},
2398 		.chained = true,
2399 		.chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2400 	},
2401 	[ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2402 		/* additional init verbs for Acer Aspire 8930G */
2403 		.type = HDA_FIXUP_VERBS,
2404 		.v.verbs = (const struct hda_verb[]) {
2405 			/* Enable all DACs */
2406 			/* DAC DISABLE/MUTE 1? */
2407 			/*  setting bits 1-5 disables DAC nids 0x02-0x06
2408 			 *  apparently. Init=0x38 */
2409 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2410 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2411 			/* DAC DISABLE/MUTE 2? */
2412 			/*  some bit here disables the other DACs.
2413 			 *  Init=0x4900 */
2414 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2415 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2416 			/* DMIC fix
2417 			 * This laptop has a stereo digital microphone.
2418 			 * The mics are only 1cm apart which makes the stereo
2419 			 * useless. However, either the mic or the ALC889
2420 			 * makes the signal become a difference/sum signal
2421 			 * instead of standard stereo, which is annoying.
2422 			 * So instead we flip this bit which makes the
2423 			 * codec replicate the sum signal to both channels,
2424 			 * turning it into a normal mono mic.
2425 			 */
2426 			/* DMIC_CONTROL? Init value = 0x0001 */
2427 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2428 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2429 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2430 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2431 			{ }
2432 		},
2433 		.chained = true,
2434 		.chain_id = ALC882_FIXUP_GPIO1,
2435 	},
2436 	[ALC885_FIXUP_MACPRO_GPIO] = {
2437 		.type = HDA_FIXUP_FUNC,
2438 		.v.func = alc885_fixup_macpro_gpio,
2439 	},
2440 	[ALC889_FIXUP_DAC_ROUTE] = {
2441 		.type = HDA_FIXUP_FUNC,
2442 		.v.func = alc889_fixup_dac_route,
2443 	},
2444 	[ALC889_FIXUP_MBP_VREF] = {
2445 		.type = HDA_FIXUP_FUNC,
2446 		.v.func = alc889_fixup_mbp_vref,
2447 		.chained = true,
2448 		.chain_id = ALC882_FIXUP_GPIO1,
2449 	},
2450 	[ALC889_FIXUP_IMAC91_VREF] = {
2451 		.type = HDA_FIXUP_FUNC,
2452 		.v.func = alc889_fixup_imac91_vref,
2453 		.chained = true,
2454 		.chain_id = ALC882_FIXUP_GPIO1,
2455 	},
2456 	[ALC889_FIXUP_MBA11_VREF] = {
2457 		.type = HDA_FIXUP_FUNC,
2458 		.v.func = alc889_fixup_mba11_vref,
2459 		.chained = true,
2460 		.chain_id = ALC889_FIXUP_MBP_VREF,
2461 	},
2462 	[ALC889_FIXUP_MBA21_VREF] = {
2463 		.type = HDA_FIXUP_FUNC,
2464 		.v.func = alc889_fixup_mba21_vref,
2465 		.chained = true,
2466 		.chain_id = ALC889_FIXUP_MBP_VREF,
2467 	},
2468 	[ALC889_FIXUP_MP11_VREF] = {
2469 		.type = HDA_FIXUP_FUNC,
2470 		.v.func = alc889_fixup_mba11_vref,
2471 		.chained = true,
2472 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2473 	},
2474 	[ALC889_FIXUP_MP41_VREF] = {
2475 		.type = HDA_FIXUP_FUNC,
2476 		.v.func = alc889_fixup_mbp_vref,
2477 		.chained = true,
2478 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2479 	},
2480 	[ALC882_FIXUP_INV_DMIC] = {
2481 		.type = HDA_FIXUP_FUNC,
2482 		.v.func = alc_fixup_inv_dmic,
2483 	},
2484 	[ALC882_FIXUP_NO_PRIMARY_HP] = {
2485 		.type = HDA_FIXUP_FUNC,
2486 		.v.func = alc882_fixup_no_primary_hp,
2487 	},
2488 	[ALC887_FIXUP_ASUS_BASS] = {
2489 		.type = HDA_FIXUP_PINS,
2490 		.v.pins = (const struct hda_pintbl[]) {
2491 			{0x16, 0x99130130}, /* bass speaker */
2492 			{}
2493 		},
2494 		.chained = true,
2495 		.chain_id = ALC887_FIXUP_BASS_CHMAP,
2496 	},
2497 	[ALC887_FIXUP_BASS_CHMAP] = {
2498 		.type = HDA_FIXUP_FUNC,
2499 		.v.func = alc_fixup_bass_chmap,
2500 	},
2501 	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
2502 		.type = HDA_FIXUP_FUNC,
2503 		.v.func = alc1220_fixup_gb_dual_codecs,
2504 	},
2505 	[ALC1220_FIXUP_GB_X570] = {
2506 		.type = HDA_FIXUP_FUNC,
2507 		.v.func = alc1220_fixup_gb_x570,
2508 	},
2509 	[ALC1220_FIXUP_CLEVO_P950] = {
2510 		.type = HDA_FIXUP_FUNC,
2511 		.v.func = alc1220_fixup_clevo_p950,
2512 	},
2513 	[ALC1220_FIXUP_CLEVO_PB51ED] = {
2514 		.type = HDA_FIXUP_FUNC,
2515 		.v.func = alc1220_fixup_clevo_pb51ed,
2516 	},
2517 	[ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2518 		.type = HDA_FIXUP_PINS,
2519 		.v.pins = (const struct hda_pintbl[]) {
2520 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2521 			{}
2522 		},
2523 		.chained = true,
2524 		.chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2525 	},
2526 	[ALC887_FIXUP_ASUS_AUDIO] = {
2527 		.type = HDA_FIXUP_PINS,
2528 		.v.pins = (const struct hda_pintbl[]) {
2529 			{ 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2530 			{ 0x19, 0x22219420 },
2531 			{}
2532 		},
2533 	},
2534 	[ALC887_FIXUP_ASUS_HMIC] = {
2535 		.type = HDA_FIXUP_FUNC,
2536 		.v.func = alc887_fixup_asus_jack,
2537 		.chained = true,
2538 		.chain_id = ALC887_FIXUP_ASUS_AUDIO,
2539 	},
2540 	[ALCS1200A_FIXUP_MIC_VREF] = {
2541 		.type = HDA_FIXUP_PINCTLS,
2542 		.v.pins = (const struct hda_pintbl[]) {
2543 			{ 0x18, PIN_VREF50 }, /* rear mic */
2544 			{ 0x19, PIN_VREF50 }, /* front mic */
2545 			{}
2546 		}
2547 	},
2548 	[ALC888VD_FIXUP_MIC_100VREF] = {
2549 		.type = HDA_FIXUP_PINCTLS,
2550 		.v.pins = (const struct hda_pintbl[]) {
2551 			{ 0x18, PIN_VREF100 }, /* headset mic */
2552 			{}
2553 		}
2554 	},
2555 };
2556 
2557 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2558 	SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2559 	SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2560 	SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2561 	SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2562 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2563 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2564 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2565 	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2566 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2567 	SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2568 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2569 	SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2570 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2571 	SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2572 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2573 	SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2574 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2575 	SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2576 	SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2577 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2578 	SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2579 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2580 	SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2581 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2582 	SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2583 	SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2584 	SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2585 	SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2586 	SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2587 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2588 	SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2589 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2590 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2591 	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2592 	SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2593 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2594 	SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2595 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2596 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2597 	SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2598 
2599 	/* All Apple entries are in codec SSIDs */
2600 	SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2601 	SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2602 	SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2603 	SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2604 	SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2605 	SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2606 	SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2607 	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2608 	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2609 	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2610 	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2611 	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2612 	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2613 	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2614 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2615 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2616 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2617 	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2618 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2619 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2620 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2621 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2622 
2623 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2624 	SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2625 	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2626 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2627 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2628 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2629 	SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2630 	SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2631 	SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2632 	SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2633 	SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2634 	SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2635 	SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2636 	SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2637 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2638 	SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2639 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2640 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2641 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2642 	SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2643 	SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2644 	SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2645 	SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2646 	SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2647 	SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2648 	SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2649 	SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2650 	SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2651 	SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2652 	SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2653 	SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2654 	SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2655 	SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2656 	SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 	SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 	SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 	SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2660 	SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2661 	SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2662 	SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2663 	SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2664 	SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2665 	SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2666 	SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2667 	SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2668 	SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2669 	SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2670 	SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2671 	SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2672 	SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2673 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2674 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2675 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2676 	SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2677 	{}
2678 };
2679 
2680 static const struct hda_model_fixup alc882_fixup_models[] = {
2681 	{.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2682 	{.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2683 	{.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2684 	{.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2685 	{.id = ALC889_FIXUP_CD, .name = "cd"},
2686 	{.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2687 	{.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2688 	{.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2689 	{.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2690 	{.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2691 	{.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2692 	{.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2693 	{.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2694 	{.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2695 	{.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2696 	{.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2697 	{.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2698 	{.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2699 	{.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2700 	{.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2701 	{.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2702 	{.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2703 	{.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2704 	{.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2705 	{.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2706 	{.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2707 	{.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2708 	{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2709 	{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2710 	{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2711 	{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2712 	{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2713 	{}
2714 };
2715 
2716 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2717 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2718 		{0x14, 0x01014010},
2719 		{0x15, 0x01011012},
2720 		{0x16, 0x01016011},
2721 		{0x18, 0x01a19040},
2722 		{0x19, 0x02a19050},
2723 		{0x1a, 0x0181304f},
2724 		{0x1b, 0x0221401f},
2725 		{0x1e, 0x01456130}),
2726 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2727 		{0x14, 0x01015010},
2728 		{0x15, 0x01011012},
2729 		{0x16, 0x01011011},
2730 		{0x18, 0x01a11040},
2731 		{0x19, 0x02a19050},
2732 		{0x1a, 0x0181104f},
2733 		{0x1b, 0x0221401f},
2734 		{0x1e, 0x01451130}),
2735 	{}
2736 };
2737 
2738 /*
2739  * BIOS auto configuration
2740  */
2741 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2742 static int alc882_parse_auto_config(struct hda_codec *codec)
2743 {
2744 	static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2745 	static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2746 	return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2747 }
2748 
2749 /*
2750  */
patch_alc882(struct hda_codec * codec)2751 static int patch_alc882(struct hda_codec *codec)
2752 {
2753 	struct alc_spec *spec;
2754 	int err;
2755 
2756 	err = alc_alloc_spec(codec, 0x0b);
2757 	if (err < 0)
2758 		return err;
2759 
2760 	spec = codec->spec;
2761 
2762 	switch (codec->core.vendor_id) {
2763 	case 0x10ec0882:
2764 	case 0x10ec0885:
2765 	case 0x10ec0900:
2766 	case 0x10ec0b00:
2767 	case 0x10ec1220:
2768 		break;
2769 	default:
2770 		/* ALC883 and variants */
2771 		alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2772 		break;
2773 	}
2774 
2775 	alc_pre_init(codec);
2776 
2777 	snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2778 		       alc882_fixups);
2779 	snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2780 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2781 
2782 	alc_auto_parse_customize_define(codec);
2783 
2784 	if (has_cdefine_beep(codec))
2785 		spec->gen.beep_nid = 0x01;
2786 
2787 	/* automatic parse from the BIOS config */
2788 	err = alc882_parse_auto_config(codec);
2789 	if (err < 0)
2790 		goto error;
2791 
2792 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2793 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2794 		if (err < 0)
2795 			goto error;
2796 	}
2797 
2798 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2799 
2800 	return 0;
2801 
2802  error:
2803 	alc_free(codec);
2804 	return err;
2805 }
2806 
2807 
2808 /*
2809  * ALC262 support
2810  */
alc262_parse_auto_config(struct hda_codec * codec)2811 static int alc262_parse_auto_config(struct hda_codec *codec)
2812 {
2813 	static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2814 	static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2815 	return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2816 }
2817 
2818 /*
2819  * Pin config fixes
2820  */
2821 enum {
2822 	ALC262_FIXUP_FSC_H270,
2823 	ALC262_FIXUP_FSC_S7110,
2824 	ALC262_FIXUP_HP_Z200,
2825 	ALC262_FIXUP_TYAN,
2826 	ALC262_FIXUP_LENOVO_3000,
2827 	ALC262_FIXUP_BENQ,
2828 	ALC262_FIXUP_BENQ_T31,
2829 	ALC262_FIXUP_INV_DMIC,
2830 	ALC262_FIXUP_INTEL_BAYLEYBAY,
2831 };
2832 
2833 static const struct hda_fixup alc262_fixups[] = {
2834 	[ALC262_FIXUP_FSC_H270] = {
2835 		.type = HDA_FIXUP_PINS,
2836 		.v.pins = (const struct hda_pintbl[]) {
2837 			{ 0x14, 0x99130110 }, /* speaker */
2838 			{ 0x15, 0x0221142f }, /* front HP */
2839 			{ 0x1b, 0x0121141f }, /* rear HP */
2840 			{ }
2841 		}
2842 	},
2843 	[ALC262_FIXUP_FSC_S7110] = {
2844 		.type = HDA_FIXUP_PINS,
2845 		.v.pins = (const struct hda_pintbl[]) {
2846 			{ 0x15, 0x90170110 }, /* speaker */
2847 			{ }
2848 		},
2849 		.chained = true,
2850 		.chain_id = ALC262_FIXUP_BENQ,
2851 	},
2852 	[ALC262_FIXUP_HP_Z200] = {
2853 		.type = HDA_FIXUP_PINS,
2854 		.v.pins = (const struct hda_pintbl[]) {
2855 			{ 0x16, 0x99130120 }, /* internal speaker */
2856 			{ }
2857 		}
2858 	},
2859 	[ALC262_FIXUP_TYAN] = {
2860 		.type = HDA_FIXUP_PINS,
2861 		.v.pins = (const struct hda_pintbl[]) {
2862 			{ 0x14, 0x1993e1f0 }, /* int AUX */
2863 			{ }
2864 		}
2865 	},
2866 	[ALC262_FIXUP_LENOVO_3000] = {
2867 		.type = HDA_FIXUP_PINCTLS,
2868 		.v.pins = (const struct hda_pintbl[]) {
2869 			{ 0x19, PIN_VREF50 },
2870 			{}
2871 		},
2872 		.chained = true,
2873 		.chain_id = ALC262_FIXUP_BENQ,
2874 	},
2875 	[ALC262_FIXUP_BENQ] = {
2876 		.type = HDA_FIXUP_VERBS,
2877 		.v.verbs = (const struct hda_verb[]) {
2878 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2879 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2880 			{}
2881 		}
2882 	},
2883 	[ALC262_FIXUP_BENQ_T31] = {
2884 		.type = HDA_FIXUP_VERBS,
2885 		.v.verbs = (const struct hda_verb[]) {
2886 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2887 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2888 			{}
2889 		}
2890 	},
2891 	[ALC262_FIXUP_INV_DMIC] = {
2892 		.type = HDA_FIXUP_FUNC,
2893 		.v.func = alc_fixup_inv_dmic,
2894 	},
2895 	[ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2896 		.type = HDA_FIXUP_FUNC,
2897 		.v.func = alc_fixup_no_depop_delay,
2898 	},
2899 };
2900 
2901 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2902 	SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2903 	SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2904 	SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2905 	SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2906 	SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2907 	SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2908 	SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2909 	SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2910 	SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2911 	SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2912 	{}
2913 };
2914 
2915 static const struct hda_model_fixup alc262_fixup_models[] = {
2916 	{.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2917 	{.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2918 	{.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2919 	{.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2920 	{.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2921 	{.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2922 	{.id = ALC262_FIXUP_BENQ, .name = "benq"},
2923 	{.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2924 	{.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2925 	{}
2926 };
2927 
2928 /*
2929  */
patch_alc262(struct hda_codec * codec)2930 static int patch_alc262(struct hda_codec *codec)
2931 {
2932 	struct alc_spec *spec;
2933 	int err;
2934 
2935 	err = alc_alloc_spec(codec, 0x0b);
2936 	if (err < 0)
2937 		return err;
2938 
2939 	spec = codec->spec;
2940 	spec->gen.shared_mic_vref_pin = 0x18;
2941 
2942 	spec->shutup = alc_eapd_shutup;
2943 
2944 #if 0
2945 	/* pshou 07/11/05  set a zero PCM sample to DAC when FIFO is
2946 	 * under-run
2947 	 */
2948 	alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2949 #endif
2950 	alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2951 
2952 	alc_pre_init(codec);
2953 
2954 	snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2955 		       alc262_fixups);
2956 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2957 
2958 	alc_auto_parse_customize_define(codec);
2959 
2960 	if (has_cdefine_beep(codec))
2961 		spec->gen.beep_nid = 0x01;
2962 
2963 	/* automatic parse from the BIOS config */
2964 	err = alc262_parse_auto_config(codec);
2965 	if (err < 0)
2966 		goto error;
2967 
2968 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2969 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2970 		if (err < 0)
2971 			goto error;
2972 	}
2973 
2974 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2975 
2976 	return 0;
2977 
2978  error:
2979 	alc_free(codec);
2980 	return err;
2981 }
2982 
2983 /*
2984  *  ALC268
2985  */
2986 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)2987 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2988 				  struct snd_ctl_elem_value *ucontrol)
2989 {
2990 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2991 	unsigned long pval;
2992 	int err;
2993 
2994 	mutex_lock(&codec->control_mutex);
2995 	pval = kcontrol->private_value;
2996 	kcontrol->private_value = (pval & ~0xff) | 0x0f;
2997 	err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2998 	if (err >= 0) {
2999 		kcontrol->private_value = (pval & ~0xff) | 0x10;
3000 		err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3001 	}
3002 	kcontrol->private_value = pval;
3003 	mutex_unlock(&codec->control_mutex);
3004 	return err;
3005 }
3006 
3007 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3008 	HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3009 	{
3010 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3011 		.name = "Beep Playback Switch",
3012 		.subdevice = HDA_SUBDEV_AMP_FLAG,
3013 		.info = snd_hda_mixer_amp_switch_info,
3014 		.get = snd_hda_mixer_amp_switch_get,
3015 		.put = alc268_beep_switch_put,
3016 		.private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3017 	},
3018 };
3019 
3020 /* set PCBEEP vol = 0, mute connections */
3021 static const struct hda_verb alc268_beep_init_verbs[] = {
3022 	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3023 	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3024 	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3025 	{ }
3026 };
3027 
3028 enum {
3029 	ALC268_FIXUP_INV_DMIC,
3030 	ALC268_FIXUP_HP_EAPD,
3031 	ALC268_FIXUP_SPDIF,
3032 };
3033 
3034 static const struct hda_fixup alc268_fixups[] = {
3035 	[ALC268_FIXUP_INV_DMIC] = {
3036 		.type = HDA_FIXUP_FUNC,
3037 		.v.func = alc_fixup_inv_dmic,
3038 	},
3039 	[ALC268_FIXUP_HP_EAPD] = {
3040 		.type = HDA_FIXUP_VERBS,
3041 		.v.verbs = (const struct hda_verb[]) {
3042 			{0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3043 			{}
3044 		}
3045 	},
3046 	[ALC268_FIXUP_SPDIF] = {
3047 		.type = HDA_FIXUP_PINS,
3048 		.v.pins = (const struct hda_pintbl[]) {
3049 			{ 0x1e, 0x014b1180 }, /* enable SPDIF out */
3050 			{}
3051 		}
3052 	},
3053 };
3054 
3055 static const struct hda_model_fixup alc268_fixup_models[] = {
3056 	{.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3057 	{.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3058 	{.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3059 	{}
3060 };
3061 
3062 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
3063 	SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3064 	SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3065 	/* below is codec SSID since multiple Toshiba laptops have the
3066 	 * same PCI SSID 1179:ff00
3067 	 */
3068 	SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3069 	{}
3070 };
3071 
3072 /*
3073  * BIOS auto configuration
3074  */
alc268_parse_auto_config(struct hda_codec * codec)3075 static int alc268_parse_auto_config(struct hda_codec *codec)
3076 {
3077 	static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3078 	return alc_parse_auto_config(codec, NULL, alc268_ssids);
3079 }
3080 
3081 /*
3082  */
patch_alc268(struct hda_codec * codec)3083 static int patch_alc268(struct hda_codec *codec)
3084 {
3085 	struct alc_spec *spec;
3086 	int i, err;
3087 
3088 	/* ALC268 has no aa-loopback mixer */
3089 	err = alc_alloc_spec(codec, 0);
3090 	if (err < 0)
3091 		return err;
3092 
3093 	spec = codec->spec;
3094 	if (has_cdefine_beep(codec))
3095 		spec->gen.beep_nid = 0x01;
3096 
3097 	spec->shutup = alc_eapd_shutup;
3098 
3099 	alc_pre_init(codec);
3100 
3101 	snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3102 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3103 
3104 	/* automatic parse from the BIOS config */
3105 	err = alc268_parse_auto_config(codec);
3106 	if (err < 0)
3107 		goto error;
3108 
3109 	if (err > 0 && !spec->gen.no_analog &&
3110 	    spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3111 		for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3112 			if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3113 						  &alc268_beep_mixer[i])) {
3114 				err = -ENOMEM;
3115 				goto error;
3116 			}
3117 		}
3118 		snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3119 		if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3120 			/* override the amp caps for beep generator */
3121 			snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3122 					  (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3123 					  (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3124 					  (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3125 					  (0 << AC_AMPCAP_MUTE_SHIFT));
3126 	}
3127 
3128 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3129 
3130 	return 0;
3131 
3132  error:
3133 	alc_free(codec);
3134 	return err;
3135 }
3136 
3137 /*
3138  * ALC269
3139  */
3140 
3141 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3142 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3143 };
3144 
3145 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3146 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3147 };
3148 
3149 /* different alc269-variants */
3150 enum {
3151 	ALC269_TYPE_ALC269VA,
3152 	ALC269_TYPE_ALC269VB,
3153 	ALC269_TYPE_ALC269VC,
3154 	ALC269_TYPE_ALC269VD,
3155 	ALC269_TYPE_ALC280,
3156 	ALC269_TYPE_ALC282,
3157 	ALC269_TYPE_ALC283,
3158 	ALC269_TYPE_ALC284,
3159 	ALC269_TYPE_ALC293,
3160 	ALC269_TYPE_ALC286,
3161 	ALC269_TYPE_ALC298,
3162 	ALC269_TYPE_ALC255,
3163 	ALC269_TYPE_ALC256,
3164 	ALC269_TYPE_ALC257,
3165 	ALC269_TYPE_ALC215,
3166 	ALC269_TYPE_ALC225,
3167 	ALC269_TYPE_ALC245,
3168 	ALC269_TYPE_ALC287,
3169 	ALC269_TYPE_ALC294,
3170 	ALC269_TYPE_ALC300,
3171 	ALC269_TYPE_ALC623,
3172 	ALC269_TYPE_ALC700,
3173 };
3174 
3175 /*
3176  * BIOS auto configuration
3177  */
alc269_parse_auto_config(struct hda_codec * codec)3178 static int alc269_parse_auto_config(struct hda_codec *codec)
3179 {
3180 	static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3181 	static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3182 	static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3183 	struct alc_spec *spec = codec->spec;
3184 	const hda_nid_t *ssids;
3185 
3186 	switch (spec->codec_variant) {
3187 	case ALC269_TYPE_ALC269VA:
3188 	case ALC269_TYPE_ALC269VC:
3189 	case ALC269_TYPE_ALC280:
3190 	case ALC269_TYPE_ALC284:
3191 	case ALC269_TYPE_ALC293:
3192 		ssids = alc269va_ssids;
3193 		break;
3194 	case ALC269_TYPE_ALC269VB:
3195 	case ALC269_TYPE_ALC269VD:
3196 	case ALC269_TYPE_ALC282:
3197 	case ALC269_TYPE_ALC283:
3198 	case ALC269_TYPE_ALC286:
3199 	case ALC269_TYPE_ALC298:
3200 	case ALC269_TYPE_ALC255:
3201 	case ALC269_TYPE_ALC256:
3202 	case ALC269_TYPE_ALC257:
3203 	case ALC269_TYPE_ALC215:
3204 	case ALC269_TYPE_ALC225:
3205 	case ALC269_TYPE_ALC245:
3206 	case ALC269_TYPE_ALC287:
3207 	case ALC269_TYPE_ALC294:
3208 	case ALC269_TYPE_ALC300:
3209 	case ALC269_TYPE_ALC623:
3210 	case ALC269_TYPE_ALC700:
3211 		ssids = alc269_ssids;
3212 		break;
3213 	default:
3214 		ssids = alc269_ssids;
3215 		break;
3216 	}
3217 
3218 	return alc_parse_auto_config(codec, alc269_ignore, ssids);
3219 }
3220 
3221 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3222 	{ SND_JACK_BTN_0, KEY_PLAYPAUSE },
3223 	{ SND_JACK_BTN_1, KEY_VOICECOMMAND },
3224 	{ SND_JACK_BTN_2, KEY_VOLUMEUP },
3225 	{ SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3226 	{}
3227 };
3228 
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3229 static void alc_headset_btn_callback(struct hda_codec *codec,
3230 				     struct hda_jack_callback *jack)
3231 {
3232 	int report = 0;
3233 
3234 	if (jack->unsol_res & (7 << 13))
3235 		report |= SND_JACK_BTN_0;
3236 
3237 	if (jack->unsol_res  & (1 << 16 | 3 << 8))
3238 		report |= SND_JACK_BTN_1;
3239 
3240 	/* Volume up key */
3241 	if (jack->unsol_res & (7 << 23))
3242 		report |= SND_JACK_BTN_2;
3243 
3244 	/* Volume down key */
3245 	if (jack->unsol_res & (7 << 10))
3246 		report |= SND_JACK_BTN_3;
3247 
3248 	snd_hda_jack_set_button_state(codec, jack->nid, report);
3249 }
3250 
alc_disable_headset_jack_key(struct hda_codec * codec)3251 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3252 {
3253 	struct alc_spec *spec = codec->spec;
3254 
3255 	if (!spec->has_hs_key)
3256 		return;
3257 
3258 	switch (codec->core.vendor_id) {
3259 	case 0x10ec0215:
3260 	case 0x10ec0225:
3261 	case 0x10ec0285:
3262 	case 0x10ec0287:
3263 	case 0x10ec0295:
3264 	case 0x10ec0289:
3265 	case 0x10ec0299:
3266 		alc_write_coef_idx(codec, 0x48, 0x0);
3267 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3268 		alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3269 		break;
3270 	case 0x10ec0230:
3271 	case 0x10ec0236:
3272 	case 0x10ec0256:
3273 	case 0x10ec0257:
3274 	case 0x19e58326:
3275 		alc_write_coef_idx(codec, 0x48, 0x0);
3276 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3277 		break;
3278 	}
3279 }
3280 
alc_enable_headset_jack_key(struct hda_codec * codec)3281 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3282 {
3283 	struct alc_spec *spec = codec->spec;
3284 
3285 	if (!spec->has_hs_key)
3286 		return;
3287 
3288 	switch (codec->core.vendor_id) {
3289 	case 0x10ec0215:
3290 	case 0x10ec0225:
3291 	case 0x10ec0285:
3292 	case 0x10ec0287:
3293 	case 0x10ec0295:
3294 	case 0x10ec0289:
3295 	case 0x10ec0299:
3296 		alc_write_coef_idx(codec, 0x48, 0xd011);
3297 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3298 		alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3299 		break;
3300 	case 0x10ec0230:
3301 	case 0x10ec0236:
3302 	case 0x10ec0256:
3303 	case 0x10ec0257:
3304 	case 0x19e58326:
3305 		alc_write_coef_idx(codec, 0x48, 0xd011);
3306 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3307 		break;
3308 	}
3309 }
3310 
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3311 static void alc_fixup_headset_jack(struct hda_codec *codec,
3312 				    const struct hda_fixup *fix, int action)
3313 {
3314 	struct alc_spec *spec = codec->spec;
3315 	hda_nid_t hp_pin;
3316 
3317 	switch (action) {
3318 	case HDA_FIXUP_ACT_PRE_PROBE:
3319 		spec->has_hs_key = 1;
3320 		snd_hda_jack_detect_enable_callback(codec, 0x55,
3321 						    alc_headset_btn_callback);
3322 		break;
3323 	case HDA_FIXUP_ACT_BUILD:
3324 		hp_pin = alc_get_hp_pin(spec);
3325 		if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3326 							alc_headset_btn_keymap,
3327 							hp_pin))
3328 			snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3329 					      false, SND_JACK_HEADSET,
3330 					      alc_headset_btn_keymap);
3331 
3332 		alc_enable_headset_jack_key(codec);
3333 		break;
3334 	}
3335 }
3336 
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3337 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3338 {
3339 	alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3340 }
3341 
alc269_shutup(struct hda_codec * codec)3342 static void alc269_shutup(struct hda_codec *codec)
3343 {
3344 	struct alc_spec *spec = codec->spec;
3345 
3346 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3347 		alc269vb_toggle_power_output(codec, 0);
3348 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3349 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3350 		msleep(150);
3351 	}
3352 	alc_shutup_pins(codec);
3353 }
3354 
3355 static const struct coef_fw alc282_coefs[] = {
3356 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3357 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3358 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3359 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3360 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3361 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3362 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3363 	WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3364 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3365 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3366 	WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3367 	UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3368 	WRITE_COEF(0x34, 0xa0c0), /* ANC */
3369 	UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3370 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3371 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3372 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3373 	WRITE_COEF(0x63, 0x2902), /* PLL */
3374 	WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3375 	WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3376 	WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3377 	WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3378 	UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3379 	WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3380 	UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3381 	WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3382 	WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3383 	UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3384 	WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3385 	{}
3386 };
3387 
alc282_restore_default_value(struct hda_codec * codec)3388 static void alc282_restore_default_value(struct hda_codec *codec)
3389 {
3390 	alc_process_coef_fw(codec, alc282_coefs);
3391 }
3392 
alc282_init(struct hda_codec * codec)3393 static void alc282_init(struct hda_codec *codec)
3394 {
3395 	struct alc_spec *spec = codec->spec;
3396 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3397 	bool hp_pin_sense;
3398 	int coef78;
3399 
3400 	alc282_restore_default_value(codec);
3401 
3402 	if (!hp_pin)
3403 		return;
3404 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3405 	coef78 = alc_read_coef_idx(codec, 0x78);
3406 
3407 	/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3408 	/* Headphone capless set to high power mode */
3409 	alc_write_coef_idx(codec, 0x78, 0x9004);
3410 
3411 	if (hp_pin_sense)
3412 		msleep(2);
3413 
3414 	snd_hda_codec_write(codec, hp_pin, 0,
3415 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3416 
3417 	if (hp_pin_sense)
3418 		msleep(85);
3419 
3420 	snd_hda_codec_write(codec, hp_pin, 0,
3421 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3422 
3423 	if (hp_pin_sense)
3424 		msleep(100);
3425 
3426 	/* Headphone capless set to normal mode */
3427 	alc_write_coef_idx(codec, 0x78, coef78);
3428 }
3429 
alc282_shutup(struct hda_codec * codec)3430 static void alc282_shutup(struct hda_codec *codec)
3431 {
3432 	struct alc_spec *spec = codec->spec;
3433 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3434 	bool hp_pin_sense;
3435 	int coef78;
3436 
3437 	if (!hp_pin) {
3438 		alc269_shutup(codec);
3439 		return;
3440 	}
3441 
3442 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3443 	coef78 = alc_read_coef_idx(codec, 0x78);
3444 	alc_write_coef_idx(codec, 0x78, 0x9004);
3445 
3446 	if (hp_pin_sense)
3447 		msleep(2);
3448 
3449 	snd_hda_codec_write(codec, hp_pin, 0,
3450 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3451 
3452 	if (hp_pin_sense)
3453 		msleep(85);
3454 
3455 	if (!spec->no_shutup_pins)
3456 		snd_hda_codec_write(codec, hp_pin, 0,
3457 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3458 
3459 	if (hp_pin_sense)
3460 		msleep(100);
3461 
3462 	alc_auto_setup_eapd(codec, false);
3463 	alc_shutup_pins(codec);
3464 	alc_write_coef_idx(codec, 0x78, coef78);
3465 }
3466 
3467 static const struct coef_fw alc283_coefs[] = {
3468 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3469 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3470 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3471 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3472 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3473 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3474 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3475 	WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3476 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3477 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3478 	WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3479 	UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3480 	WRITE_COEF(0x22, 0xa0c0), /* ANC */
3481 	UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3482 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3483 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3484 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3485 	WRITE_COEF(0x2e, 0x2902), /* PLL */
3486 	WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3487 	WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3488 	WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3489 	WRITE_COEF(0x36, 0x0), /* capless control 5 */
3490 	UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3491 	WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3492 	UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3493 	WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3494 	WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3495 	UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3496 	WRITE_COEF(0x49, 0x0), /* test mode */
3497 	UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3498 	UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3499 	WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3500 	UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3501 	{}
3502 };
3503 
alc283_restore_default_value(struct hda_codec * codec)3504 static void alc283_restore_default_value(struct hda_codec *codec)
3505 {
3506 	alc_process_coef_fw(codec, alc283_coefs);
3507 }
3508 
alc283_init(struct hda_codec * codec)3509 static void alc283_init(struct hda_codec *codec)
3510 {
3511 	struct alc_spec *spec = codec->spec;
3512 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3513 	bool hp_pin_sense;
3514 
3515 	alc283_restore_default_value(codec);
3516 
3517 	if (!hp_pin)
3518 		return;
3519 
3520 	msleep(30);
3521 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3522 
3523 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3524 	/* Headphone capless set to high power mode */
3525 	alc_write_coef_idx(codec, 0x43, 0x9004);
3526 
3527 	snd_hda_codec_write(codec, hp_pin, 0,
3528 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3529 
3530 	if (hp_pin_sense)
3531 		msleep(85);
3532 
3533 	snd_hda_codec_write(codec, hp_pin, 0,
3534 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3535 
3536 	if (hp_pin_sense)
3537 		msleep(85);
3538 	/* Index 0x46 Combo jack auto switch control 2 */
3539 	/* 3k pull low control for Headset jack. */
3540 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3541 	/* Headphone capless set to normal mode */
3542 	alc_write_coef_idx(codec, 0x43, 0x9614);
3543 }
3544 
alc283_shutup(struct hda_codec * codec)3545 static void alc283_shutup(struct hda_codec *codec)
3546 {
3547 	struct alc_spec *spec = codec->spec;
3548 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3549 	bool hp_pin_sense;
3550 
3551 	if (!hp_pin) {
3552 		alc269_shutup(codec);
3553 		return;
3554 	}
3555 
3556 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3557 
3558 	alc_write_coef_idx(codec, 0x43, 0x9004);
3559 
3560 	/*depop hp during suspend*/
3561 	alc_write_coef_idx(codec, 0x06, 0x2100);
3562 
3563 	snd_hda_codec_write(codec, hp_pin, 0,
3564 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3565 
3566 	if (hp_pin_sense)
3567 		msleep(100);
3568 
3569 	if (!spec->no_shutup_pins)
3570 		snd_hda_codec_write(codec, hp_pin, 0,
3571 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3572 
3573 	alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3574 
3575 	if (hp_pin_sense)
3576 		msleep(100);
3577 	alc_auto_setup_eapd(codec, false);
3578 	alc_shutup_pins(codec);
3579 	alc_write_coef_idx(codec, 0x43, 0x9614);
3580 }
3581 
alc256_init(struct hda_codec * codec)3582 static void alc256_init(struct hda_codec *codec)
3583 {
3584 	struct alc_spec *spec = codec->spec;
3585 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3586 	bool hp_pin_sense;
3587 
3588 	if (spec->ultra_low_power) {
3589 		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3590 		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3591 		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3592 		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3593 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3594 		msleep(30);
3595 	}
3596 
3597 	if (!hp_pin)
3598 		hp_pin = 0x21;
3599 
3600 	msleep(30);
3601 
3602 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3603 
3604 	if (hp_pin_sense)
3605 		msleep(2);
3606 
3607 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3608 
3609 	snd_hda_codec_write(codec, hp_pin, 0,
3610 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3611 
3612 	if (hp_pin_sense || spec->ultra_low_power)
3613 		msleep(85);
3614 
3615 	snd_hda_codec_write(codec, hp_pin, 0,
3616 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3617 
3618 	if (hp_pin_sense || spec->ultra_low_power)
3619 		msleep(100);
3620 
3621 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3622 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
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 	if (hp_pin_sense || spec->ultra_low_power)
3653 		msleep(85);
3654 
3655 	/* 3k pull low control for Headset jack. */
3656 	/* NOTE: call this before clearing the pin, otherwise codec stalls */
3657 	/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3658 	 * when booting with headset plugged. So skip setting it for the codec alc257
3659 	 */
3660 	if (spec->en_3kpull_low)
3661 		alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3662 
3663 	if (!spec->no_shutup_pins)
3664 		snd_hda_codec_write(codec, hp_pin, 0,
3665 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3666 
3667 	if (hp_pin_sense || spec->ultra_low_power)
3668 		msleep(100);
3669 
3670 	alc_auto_setup_eapd(codec, false);
3671 	alc_shutup_pins(codec);
3672 	if (spec->ultra_low_power) {
3673 		msleep(50);
3674 		alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3675 		alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3676 		alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3677 		alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3678 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3679 		msleep(30);
3680 	}
3681 }
3682 
alc285_hp_init(struct hda_codec * codec)3683 static void alc285_hp_init(struct hda_codec *codec)
3684 {
3685 	struct alc_spec *spec = codec->spec;
3686 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3687 	int i, val;
3688 	int coef38, coef0d, coef36;
3689 
3690 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3691 	alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3692 	coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3693 	coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3694 	coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3695 	alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3696 	alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3697 
3698 	alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3699 
3700 	if (hp_pin)
3701 		snd_hda_codec_write(codec, hp_pin, 0,
3702 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3703 
3704 	msleep(130);
3705 	alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3706 	alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3707 
3708 	if (hp_pin)
3709 		snd_hda_codec_write(codec, hp_pin, 0,
3710 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3711 	msleep(10);
3712 	alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3713 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3714 	alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3715 	alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3716 
3717 	alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3718 	val = alc_read_coefex_idx(codec, 0x58, 0x00);
3719 	for (i = 0; i < 20 && val & 0x8000; i++) {
3720 		msleep(50);
3721 		val = alc_read_coefex_idx(codec, 0x58, 0x00);
3722 	} /* Wait for depop procedure finish  */
3723 
3724 	alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3725 	alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3726 	alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3727 	alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3728 
3729 	msleep(50);
3730 	alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3731 }
3732 
alc225_init(struct hda_codec * codec)3733 static void alc225_init(struct hda_codec *codec)
3734 {
3735 	struct alc_spec *spec = codec->spec;
3736 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3737 	bool hp1_pin_sense, hp2_pin_sense;
3738 
3739 	if (spec->ultra_low_power) {
3740 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3741 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3742 		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3743 		msleep(30);
3744 	}
3745 
3746 	if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3747 		spec->codec_variant != ALC269_TYPE_ALC245)
3748 		/* required only at boot or S3 and S4 resume time */
3749 		if (!spec->done_hp_init ||
3750 			is_s3_resume(codec) ||
3751 			is_s4_resume(codec)) {
3752 			alc285_hp_init(codec);
3753 			spec->done_hp_init = true;
3754 		}
3755 
3756 	if (!hp_pin)
3757 		hp_pin = 0x21;
3758 	msleep(30);
3759 
3760 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3761 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3762 
3763 	if (hp1_pin_sense || hp2_pin_sense)
3764 		msleep(2);
3765 
3766 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3767 
3768 	if (hp1_pin_sense || spec->ultra_low_power)
3769 		snd_hda_codec_write(codec, hp_pin, 0,
3770 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3771 	if (hp2_pin_sense)
3772 		snd_hda_codec_write(codec, 0x16, 0,
3773 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3774 
3775 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3776 		msleep(85);
3777 
3778 	if (hp1_pin_sense || spec->ultra_low_power)
3779 		snd_hda_codec_write(codec, hp_pin, 0,
3780 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3781 	if (hp2_pin_sense)
3782 		snd_hda_codec_write(codec, 0x16, 0,
3783 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3784 
3785 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3786 		msleep(100);
3787 
3788 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3789 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3790 }
3791 
alc225_shutup(struct hda_codec * codec)3792 static void alc225_shutup(struct hda_codec *codec)
3793 {
3794 	struct alc_spec *spec = codec->spec;
3795 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3796 	bool hp1_pin_sense, hp2_pin_sense;
3797 
3798 	if (!hp_pin)
3799 		hp_pin = 0x21;
3800 
3801 	alc_disable_headset_jack_key(codec);
3802 	/* 3k pull low control for Headset jack. */
3803 	alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3804 
3805 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3806 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3807 
3808 	if (hp1_pin_sense || hp2_pin_sense)
3809 		msleep(2);
3810 
3811 	if (hp1_pin_sense || spec->ultra_low_power)
3812 		snd_hda_codec_write(codec, hp_pin, 0,
3813 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3814 	if (hp2_pin_sense)
3815 		snd_hda_codec_write(codec, 0x16, 0,
3816 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3817 
3818 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3819 		msleep(85);
3820 
3821 	if (hp1_pin_sense || spec->ultra_low_power)
3822 		snd_hda_codec_write(codec, hp_pin, 0,
3823 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3824 	if (hp2_pin_sense)
3825 		snd_hda_codec_write(codec, 0x16, 0,
3826 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3827 
3828 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3829 		msleep(100);
3830 
3831 	alc_auto_setup_eapd(codec, false);
3832 	alc_shutup_pins(codec);
3833 	if (spec->ultra_low_power) {
3834 		msleep(50);
3835 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3836 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3837 		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3838 		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3839 		msleep(30);
3840 	}
3841 
3842 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3843 	alc_enable_headset_jack_key(codec);
3844 }
3845 
alc_default_init(struct hda_codec * codec)3846 static void alc_default_init(struct hda_codec *codec)
3847 {
3848 	struct alc_spec *spec = codec->spec;
3849 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3850 	bool hp_pin_sense;
3851 
3852 	if (!hp_pin)
3853 		return;
3854 
3855 	msleep(30);
3856 
3857 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3858 
3859 	if (hp_pin_sense)
3860 		msleep(2);
3861 
3862 	snd_hda_codec_write(codec, hp_pin, 0,
3863 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3864 
3865 	if (hp_pin_sense)
3866 		msleep(85);
3867 
3868 	snd_hda_codec_write(codec, hp_pin, 0,
3869 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3870 
3871 	if (hp_pin_sense)
3872 		msleep(100);
3873 }
3874 
alc_default_shutup(struct hda_codec * codec)3875 static void alc_default_shutup(struct hda_codec *codec)
3876 {
3877 	struct alc_spec *spec = codec->spec;
3878 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3879 	bool hp_pin_sense;
3880 
3881 	if (!hp_pin) {
3882 		alc269_shutup(codec);
3883 		return;
3884 	}
3885 
3886 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3887 
3888 	if (hp_pin_sense)
3889 		msleep(2);
3890 
3891 	snd_hda_codec_write(codec, hp_pin, 0,
3892 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3893 
3894 	if (hp_pin_sense)
3895 		msleep(85);
3896 
3897 	if (!spec->no_shutup_pins)
3898 		snd_hda_codec_write(codec, hp_pin, 0,
3899 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3900 
3901 	if (hp_pin_sense)
3902 		msleep(100);
3903 
3904 	alc_auto_setup_eapd(codec, false);
3905 	alc_shutup_pins(codec);
3906 }
3907 
alc294_hp_init(struct hda_codec * codec)3908 static void alc294_hp_init(struct hda_codec *codec)
3909 {
3910 	struct alc_spec *spec = codec->spec;
3911 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3912 	int i, val;
3913 
3914 	if (!hp_pin)
3915 		return;
3916 
3917 	snd_hda_codec_write(codec, hp_pin, 0,
3918 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3919 
3920 	msleep(100);
3921 
3922 	if (!spec->no_shutup_pins)
3923 		snd_hda_codec_write(codec, hp_pin, 0,
3924 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3925 
3926 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3927 	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3928 
3929 	/* Wait for depop procedure finish  */
3930 	val = alc_read_coefex_idx(codec, 0x58, 0x01);
3931 	for (i = 0; i < 20 && val & 0x0080; i++) {
3932 		msleep(50);
3933 		val = alc_read_coefex_idx(codec, 0x58, 0x01);
3934 	}
3935 	/* Set HP depop to auto mode */
3936 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3937 	msleep(50);
3938 }
3939 
alc294_init(struct hda_codec * codec)3940 static void alc294_init(struct hda_codec *codec)
3941 {
3942 	struct alc_spec *spec = codec->spec;
3943 
3944 	/* required only at boot or S4 resume time */
3945 	if (!spec->done_hp_init ||
3946 	    codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3947 		alc294_hp_init(codec);
3948 		spec->done_hp_init = true;
3949 	}
3950 	alc_default_init(codec);
3951 }
3952 
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)3953 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3954 			     unsigned int val)
3955 {
3956 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3957 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3958 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3959 }
3960 
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)3961 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3962 {
3963 	unsigned int val;
3964 
3965 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3966 	val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3967 		& 0xffff;
3968 	val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3969 		<< 16;
3970 	return val;
3971 }
3972 
alc5505_dsp_halt(struct hda_codec * codec)3973 static void alc5505_dsp_halt(struct hda_codec *codec)
3974 {
3975 	unsigned int val;
3976 
3977 	alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3978 	alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3979 	alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3980 	alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3981 	alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3982 	alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3983 	alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3984 	val = alc5505_coef_get(codec, 0x6220);
3985 	alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3986 }
3987 
alc5505_dsp_back_from_halt(struct hda_codec * codec)3988 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3989 {
3990 	alc5505_coef_set(codec, 0x61b8, 0x04133302);
3991 	alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3992 	alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3993 	alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3994 	alc5505_coef_set(codec, 0x6220, 0x2002010f);
3995 	alc5505_coef_set(codec, 0x880c, 0x00000004);
3996 }
3997 
alc5505_dsp_init(struct hda_codec * codec)3998 static void alc5505_dsp_init(struct hda_codec *codec)
3999 {
4000 	unsigned int val;
4001 
4002 	alc5505_dsp_halt(codec);
4003 	alc5505_dsp_back_from_halt(codec);
4004 	alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
4005 	alc5505_coef_set(codec, 0x61b0, 0x5b16);
4006 	alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
4007 	alc5505_coef_set(codec, 0x61b4, 0x04132b02);
4008 	alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
4009 	alc5505_coef_set(codec, 0x61b8, 0x041f3302);
4010 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
4011 	alc5505_coef_set(codec, 0x61b8, 0x041b3302);
4012 	alc5505_coef_set(codec, 0x61b8, 0x04173302);
4013 	alc5505_coef_set(codec, 0x61b8, 0x04163302);
4014 	alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4015 	alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4016 	alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4017 
4018 	val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4019 	if (val <= 3)
4020 		alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4021 	else
4022 		alc5505_coef_set(codec, 0x6220, 0x6002018f);
4023 
4024 	alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4025 	alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4026 	alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4027 	alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4028 	alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4029 	alc5505_coef_set(codec, 0x880c, 0x00000003);
4030 	alc5505_coef_set(codec, 0x880c, 0x00000010);
4031 
4032 #ifdef HALT_REALTEK_ALC5505
4033 	alc5505_dsp_halt(codec);
4034 #endif
4035 }
4036 
4037 #ifdef HALT_REALTEK_ALC5505
4038 #define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
4039 #define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
4040 #else
4041 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
4042 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
4043 #endif
4044 
4045 #ifdef CONFIG_PM
alc269_suspend(struct hda_codec * codec)4046 static int alc269_suspend(struct hda_codec *codec)
4047 {
4048 	struct alc_spec *spec = codec->spec;
4049 
4050 	if (spec->has_alc5505_dsp)
4051 		alc5505_dsp_suspend(codec);
4052 
4053 	return alc_suspend(codec);
4054 }
4055 
alc269_resume(struct hda_codec * codec)4056 static int alc269_resume(struct hda_codec *codec)
4057 {
4058 	struct alc_spec *spec = codec->spec;
4059 
4060 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4061 		alc269vb_toggle_power_output(codec, 0);
4062 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4063 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
4064 		msleep(150);
4065 	}
4066 
4067 	codec->patch_ops.init(codec);
4068 
4069 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4070 		alc269vb_toggle_power_output(codec, 1);
4071 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4072 			(alc_get_coef0(codec) & 0x00ff) == 0x017) {
4073 		msleep(200);
4074 	}
4075 
4076 	snd_hda_regmap_sync(codec);
4077 	hda_call_check_power_status(codec, 0x01);
4078 
4079 	/* on some machine, the BIOS will clear the codec gpio data when enter
4080 	 * suspend, and won't restore the data after resume, so we restore it
4081 	 * in the driver.
4082 	 */
4083 	if (spec->gpio_data)
4084 		alc_write_gpio_data(codec);
4085 
4086 	if (spec->has_alc5505_dsp)
4087 		alc5505_dsp_resume(codec);
4088 
4089 	return 0;
4090 }
4091 #endif /* CONFIG_PM */
4092 
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4093 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4094 						 const struct hda_fixup *fix, int action)
4095 {
4096 	struct alc_spec *spec = codec->spec;
4097 
4098 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4099 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4100 }
4101 
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4102 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4103 						 const struct hda_fixup *fix,
4104 						 int action)
4105 {
4106 	unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4107 	unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4108 
4109 	if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4110 		snd_hda_codec_set_pincfg(codec, 0x19,
4111 			(cfg_headphone & ~AC_DEFCFG_DEVICE) |
4112 			(AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4113 }
4114 
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4115 static void alc269_fixup_hweq(struct hda_codec *codec,
4116 			       const struct hda_fixup *fix, int action)
4117 {
4118 	if (action == HDA_FIXUP_ACT_INIT)
4119 		alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4120 }
4121 
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4122 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4123 				       const struct hda_fixup *fix, int action)
4124 {
4125 	struct alc_spec *spec = codec->spec;
4126 
4127 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4128 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4129 }
4130 
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4131 static void alc271_fixup_dmic(struct hda_codec *codec,
4132 			      const struct hda_fixup *fix, int action)
4133 {
4134 	static const struct hda_verb verbs[] = {
4135 		{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4136 		{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4137 		{}
4138 	};
4139 	unsigned int cfg;
4140 
4141 	if (strcmp(codec->core.chip_name, "ALC271X") &&
4142 	    strcmp(codec->core.chip_name, "ALC269VB"))
4143 		return;
4144 	cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4145 	if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4146 		snd_hda_sequence_write(codec, verbs);
4147 }
4148 
4149 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4150 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4151 					  const struct hda_fixup *fix,
4152 					  int action)
4153 {
4154 	if (action == HDA_FIXUP_ACT_INIT)
4155 		alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4156 }
4157 
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4158 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4159 				 const struct hda_fixup *fix, int action)
4160 {
4161 	struct alc_spec *spec = codec->spec;
4162 
4163 	if (action != HDA_FIXUP_ACT_PROBE)
4164 		return;
4165 
4166 	/* Due to a hardware problem on Lenovo Ideadpad, we need to
4167 	 * fix the sample rate of analog I/O to 44.1kHz
4168 	 */
4169 	spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4170 	spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4171 }
4172 
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4173 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4174 				     const struct hda_fixup *fix, int action)
4175 {
4176 	/* The digital-mic unit sends PDM (differential signal) instead of
4177 	 * the standard PCM, thus you can't record a valid mono stream as is.
4178 	 * Below is a workaround specific to ALC269 to control the dmic
4179 	 * signal source as mono.
4180 	 */
4181 	if (action == HDA_FIXUP_ACT_INIT)
4182 		alc_update_coef_idx(codec, 0x07, 0, 0x80);
4183 }
4184 
alc269_quanta_automute(struct hda_codec * codec)4185 static void alc269_quanta_automute(struct hda_codec *codec)
4186 {
4187 	snd_hda_gen_update_outputs(codec);
4188 
4189 	alc_write_coef_idx(codec, 0x0c, 0x680);
4190 	alc_write_coef_idx(codec, 0x0c, 0x480);
4191 }
4192 
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4193 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4194 				     const struct hda_fixup *fix, int action)
4195 {
4196 	struct alc_spec *spec = codec->spec;
4197 	if (action != HDA_FIXUP_ACT_PROBE)
4198 		return;
4199 	spec->gen.automute_hook = alc269_quanta_automute;
4200 }
4201 
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4202 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4203 					 struct hda_jack_callback *jack)
4204 {
4205 	struct alc_spec *spec = codec->spec;
4206 	int vref;
4207 	msleep(200);
4208 	snd_hda_gen_hp_automute(codec, jack);
4209 
4210 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4211 	msleep(100);
4212 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4213 			    vref);
4214 	msleep(500);
4215 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4216 			    vref);
4217 }
4218 
4219 /*
4220  * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4221  */
4222 struct hda_alc298_mbxinit {
4223 	unsigned char value_0x23;
4224 	unsigned char value_0x25;
4225 };
4226 
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4227 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4228 					 const struct hda_alc298_mbxinit *initval,
4229 					 bool first)
4230 {
4231 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4232 	alc_write_coef_idx(codec, 0x26, 0xb000);
4233 
4234 	if (first)
4235 		snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4236 
4237 	snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4238 	alc_write_coef_idx(codec, 0x26, 0xf000);
4239 	alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4240 
4241 	if (initval->value_0x23 != 0x1e)
4242 		alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4243 
4244 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4245 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4246 }
4247 
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4248 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4249 					   const struct hda_fixup *fix,
4250 					   int action)
4251 {
4252 	/* Initialization magic */
4253 	static const struct hda_alc298_mbxinit dac_init[] = {
4254 		{0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4255 		{0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4256 		{0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4257 		{0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4258 		{0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4259 		{0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4260 		{0x2f, 0x00},
4261 		{0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4262 		{0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4263 		{0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4264 		{}
4265 	};
4266 	const struct hda_alc298_mbxinit *seq;
4267 
4268 	if (action != HDA_FIXUP_ACT_INIT)
4269 		return;
4270 
4271 	/* Start */
4272 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4273 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4274 	alc_write_coef_idx(codec, 0x26, 0xf000);
4275 	alc_write_coef_idx(codec, 0x22, 0x31);
4276 	alc_write_coef_idx(codec, 0x23, 0x0b);
4277 	alc_write_coef_idx(codec, 0x25, 0x00);
4278 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4279 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4280 
4281 	for (seq = dac_init; seq->value_0x23; seq++)
4282 		alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4283 }
4284 
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4285 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4286 				     const struct hda_fixup *fix, int action)
4287 {
4288 	struct alc_spec *spec = codec->spec;
4289 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4290 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4291 		spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4292 	}
4293 }
4294 
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4295 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4296 				bool polarity, bool on)
4297 {
4298 	unsigned int pinval;
4299 
4300 	if (!pin)
4301 		return;
4302 	if (polarity)
4303 		on = !on;
4304 	pinval = snd_hda_codec_get_pin_target(codec, pin);
4305 	pinval &= ~AC_PINCTL_VREFEN;
4306 	pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4307 	/* temporarily power up/down for setting VREF */
4308 	snd_hda_power_up_pm(codec);
4309 	snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4310 	snd_hda_power_down_pm(codec);
4311 }
4312 
4313 /* 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)4314 static int vref_mute_led_set(struct led_classdev *led_cdev,
4315 			     enum led_brightness brightness)
4316 {
4317 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4318 	struct alc_spec *spec = codec->spec;
4319 
4320 	alc_update_vref_led(codec, spec->mute_led_nid,
4321 			    spec->mute_led_polarity, brightness);
4322 	return 0;
4323 }
4324 
4325 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4326 static unsigned int led_power_filter(struct hda_codec *codec,
4327 						  hda_nid_t nid,
4328 						  unsigned int power_state)
4329 {
4330 	struct alc_spec *spec = codec->spec;
4331 
4332 	if (power_state != AC_PWRST_D3 || nid == 0 ||
4333 	    (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4334 		return power_state;
4335 
4336 	/* Set pin ctl again, it might have just been set to 0 */
4337 	snd_hda_set_pin_ctl(codec, nid,
4338 			    snd_hda_codec_get_pin_target(codec, nid));
4339 
4340 	return snd_hda_gen_path_power_filter(codec, nid, power_state);
4341 }
4342 
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4343 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4344 				     const struct hda_fixup *fix, int action)
4345 {
4346 	struct alc_spec *spec = codec->spec;
4347 	const struct dmi_device *dev = NULL;
4348 
4349 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4350 		return;
4351 
4352 	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4353 		int pol, pin;
4354 		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4355 			continue;
4356 		if (pin < 0x0a || pin >= 0x10)
4357 			break;
4358 		spec->mute_led_polarity = pol;
4359 		spec->mute_led_nid = pin - 0x0a + 0x18;
4360 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4361 		codec->power_filter = led_power_filter;
4362 		codec_dbg(codec,
4363 			  "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4364 			   spec->mute_led_polarity);
4365 		break;
4366 	}
4367 }
4368 
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4369 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4370 					  const struct hda_fixup *fix,
4371 					  int action, hda_nid_t pin)
4372 {
4373 	struct alc_spec *spec = codec->spec;
4374 
4375 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4376 		spec->mute_led_polarity = 0;
4377 		spec->mute_led_nid = pin;
4378 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4379 		codec->power_filter = led_power_filter;
4380 	}
4381 }
4382 
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4383 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4384 				const struct hda_fixup *fix, int action)
4385 {
4386 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4387 }
4388 
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4389 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4390 				const struct hda_fixup *fix, int action)
4391 {
4392 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4393 }
4394 
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4395 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4396 				const struct hda_fixup *fix, int action)
4397 {
4398 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4399 }
4400 
4401 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4402 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4403 				int polarity, bool enabled)
4404 {
4405 	if (polarity)
4406 		enabled = !enabled;
4407 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4408 }
4409 
4410 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4411 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4412 			     enum led_brightness brightness)
4413 {
4414 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4415 	struct alc_spec *spec = codec->spec;
4416 
4417 	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4418 			    spec->mute_led_polarity, !brightness);
4419 	return 0;
4420 }
4421 
4422 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4423 static int micmute_led_set(struct led_classdev *led_cdev,
4424 			   enum led_brightness brightness)
4425 {
4426 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4427 	struct alc_spec *spec = codec->spec;
4428 
4429 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4430 			    spec->micmute_led_polarity, !brightness);
4431 	return 0;
4432 }
4433 
4434 /* 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)4435 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4436 				  int action,
4437 				  unsigned int mute_mask,
4438 				  unsigned int micmute_mask)
4439 {
4440 	struct alc_spec *spec = codec->spec;
4441 
4442 	alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4443 
4444 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4445 		return;
4446 	if (mute_mask) {
4447 		spec->gpio_mute_led_mask = mute_mask;
4448 		snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4449 	}
4450 	if (micmute_mask) {
4451 		spec->gpio_mic_led_mask = micmute_mask;
4452 		snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4453 	}
4454 }
4455 
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4456 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4457 				const struct hda_fixup *fix, int action)
4458 {
4459 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4460 }
4461 
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4462 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4463 				const struct hda_fixup *fix, int action)
4464 {
4465 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4466 }
4467 
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4468 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4469 				const struct hda_fixup *fix, int action)
4470 {
4471 	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4472 }
4473 
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4474 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4475 				const struct hda_fixup *fix, int action)
4476 {
4477 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4478 }
4479 
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4480 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4481 				const struct hda_fixup *fix, int action)
4482 {
4483 	alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4484 }
4485 
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4486 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4487 				const struct hda_fixup *fix, int action)
4488 {
4489 	struct alc_spec *spec = codec->spec;
4490 
4491 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4492 		spec->micmute_led_polarity = 1;
4493 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4494 }
4495 
4496 /* 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)4497 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4498 				enum led_brightness brightness)
4499 {
4500 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4501 	struct alc_spec *spec = codec->spec;
4502 
4503 	alc_update_vref_led(codec, spec->cap_mute_led_nid,
4504 			    spec->micmute_led_polarity, brightness);
4505 	return 0;
4506 }
4507 
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4508 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4509 				const struct hda_fixup *fix, int action)
4510 {
4511 	struct alc_spec *spec = codec->spec;
4512 
4513 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4514 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4515 		/* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4516 		 * enable headphone amp
4517 		 */
4518 		spec->gpio_mask |= 0x10;
4519 		spec->gpio_dir |= 0x10;
4520 		spec->cap_mute_led_nid = 0x18;
4521 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4522 		codec->power_filter = led_power_filter;
4523 	}
4524 }
4525 
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4526 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4527 				   const struct hda_fixup *fix, int action)
4528 {
4529 	struct alc_spec *spec = codec->spec;
4530 
4531 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4532 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4533 		spec->cap_mute_led_nid = 0x18;
4534 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4535 		codec->power_filter = led_power_filter;
4536 	}
4537 }
4538 
4539 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4540  * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4541  */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4542 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4543 				     const struct hda_fixup *fix, int action)
4544 {
4545 	struct alc_spec *spec = codec->spec;
4546 
4547 	switch (action) {
4548 	case HDA_FIXUP_ACT_PRE_PROBE:
4549 		spec->gpio_mask |= 0x01;
4550 		spec->gpio_dir |= 0x01;
4551 		break;
4552 	case HDA_FIXUP_ACT_INIT:
4553 		/* need to toggle GPIO to enable the amp */
4554 		alc_update_gpio_data(codec, 0x01, true);
4555 		msleep(100);
4556 		alc_update_gpio_data(codec, 0x01, false);
4557 		break;
4558 	}
4559 }
4560 
4561 /* 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)4562 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4563 				    struct hda_codec *codec,
4564 				    struct snd_pcm_substream *substream,
4565 				    int action)
4566 {
4567 	switch (action) {
4568 	case HDA_GEN_PCM_ACT_PREPARE:
4569 		alc_update_gpio_data(codec, 0x04, true);
4570 		break;
4571 	case HDA_GEN_PCM_ACT_CLEANUP:
4572 		alc_update_gpio_data(codec, 0x04, false);
4573 		break;
4574 	}
4575 }
4576 
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4577 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4578 				      const struct hda_fixup *fix,
4579 				      int action)
4580 {
4581 	struct alc_spec *spec = codec->spec;
4582 
4583 	if (action == HDA_FIXUP_ACT_PROBE) {
4584 		spec->gpio_mask |= 0x04;
4585 		spec->gpio_dir |= 0x04;
4586 		spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4587 	}
4588 }
4589 
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4590 static void alc_update_coef_led(struct hda_codec *codec,
4591 				struct alc_coef_led *led,
4592 				bool polarity, bool on)
4593 {
4594 	if (polarity)
4595 		on = !on;
4596 	/* temporarily power up/down for setting COEF bit */
4597 	alc_update_coef_idx(codec, led->idx, led->mask,
4598 			    on ? led->on : led->off);
4599 }
4600 
4601 /* 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)4602 static int coef_mute_led_set(struct led_classdev *led_cdev,
4603 			     enum led_brightness brightness)
4604 {
4605 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4606 	struct alc_spec *spec = codec->spec;
4607 
4608 	alc_update_coef_led(codec, &spec->mute_led_coef,
4609 			    spec->mute_led_polarity, brightness);
4610 	return 0;
4611 }
4612 
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4613 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4614 					  const struct hda_fixup *fix,
4615 					  int action)
4616 {
4617 	struct alc_spec *spec = codec->spec;
4618 
4619 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4620 		spec->mute_led_polarity = 0;
4621 		spec->mute_led_coef.idx = 0x0b;
4622 		spec->mute_led_coef.mask = 1 << 3;
4623 		spec->mute_led_coef.on = 1 << 3;
4624 		spec->mute_led_coef.off = 0;
4625 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4626 	}
4627 }
4628 
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4629 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4630 					  const struct hda_fixup *fix,
4631 					  int action)
4632 {
4633 	struct alc_spec *spec = codec->spec;
4634 
4635 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4636 		spec->mute_led_polarity = 0;
4637 		spec->mute_led_coef.idx = 0x34;
4638 		spec->mute_led_coef.mask = 1 << 5;
4639 		spec->mute_led_coef.on = 0;
4640 		spec->mute_led_coef.off = 1 << 5;
4641 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4642 	}
4643 }
4644 
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4645 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4646 					  const struct hda_fixup *fix, int action)
4647 {
4648 	struct alc_spec *spec = codec->spec;
4649 
4650 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4651 		spec->mute_led_polarity = 0;
4652 		spec->mute_led_coef.idx = 0x07;
4653 		spec->mute_led_coef.mask = 1;
4654 		spec->mute_led_coef.on = 1;
4655 		spec->mute_led_coef.off = 0;
4656 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4657 	}
4658 }
4659 
alc245_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4660 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4661 					  const struct hda_fixup *fix,
4662 					  int action)
4663 {
4664 	struct alc_spec *spec = codec->spec;
4665 
4666 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4667 		spec->mute_led_polarity = 0;
4668 		spec->mute_led_coef.idx = 0x0b;
4669 		spec->mute_led_coef.mask = 3 << 2;
4670 		spec->mute_led_coef.on = 2 << 2;
4671 		spec->mute_led_coef.off = 1 << 2;
4672 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4673 	}
4674 }
4675 
4676 /* 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)4677 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4678 				enum led_brightness brightness)
4679 {
4680 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4681 	struct alc_spec *spec = codec->spec;
4682 
4683 	alc_update_coef_led(codec, &spec->mic_led_coef,
4684 			    spec->micmute_led_polarity, brightness);
4685 	return 0;
4686 }
4687 
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4688 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4689 				const struct hda_fixup *fix, int action)
4690 {
4691 	struct alc_spec *spec = codec->spec;
4692 
4693 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4694 		spec->mic_led_coef.idx = 0x19;
4695 		spec->mic_led_coef.mask = 1 << 13;
4696 		spec->mic_led_coef.on = 1 << 13;
4697 		spec->mic_led_coef.off = 0;
4698 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4699 	}
4700 }
4701 
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4702 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4703 				const struct hda_fixup *fix, int action)
4704 {
4705 	struct alc_spec *spec = codec->spec;
4706 
4707 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4708 		spec->micmute_led_polarity = 1;
4709 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4710 }
4711 
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4712 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4713 				const struct hda_fixup *fix, int action)
4714 {
4715 	struct alc_spec *spec = codec->spec;
4716 
4717 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4718 		spec->mic_led_coef.idx = 0x35;
4719 		spec->mic_led_coef.mask = 3 << 2;
4720 		spec->mic_led_coef.on = 2 << 2;
4721 		spec->mic_led_coef.off = 1 << 2;
4722 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4723 	}
4724 }
4725 
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4726 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4727 				const struct hda_fixup *fix, int action)
4728 {
4729 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4730 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4731 }
4732 
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4733 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4734 				const struct hda_fixup *fix, int action)
4735 {
4736 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4737 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4738 }
4739 
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4740 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4741 				const struct hda_fixup *fix, int action)
4742 {
4743 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4744 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4745 }
4746 
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4747 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4748 				const struct hda_fixup *fix, int action)
4749 {
4750 	struct alc_spec *spec = codec->spec;
4751 
4752 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4753 		spec->cap_mute_led_nid = 0x1a;
4754 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4755 		codec->power_filter = led_power_filter;
4756 	}
4757 }
4758 
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4759 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4760 				const struct hda_fixup *fix, int action)
4761 {
4762 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4763 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4764 }
4765 
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4766 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4767 						  const unsigned short coefs[2])
4768 {
4769 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4770 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4771 	alc_write_coef_idx(codec, 0x26, 0xb011);
4772 }
4773 
4774 struct alc298_samsung_amp_desc {
4775 	unsigned char nid;
4776 	unsigned short init_seq[2][2];
4777 };
4778 
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4779 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4780 				     const struct hda_fixup *fix, int action)
4781 {
4782 	int i, j;
4783 	static const unsigned short init_seq[][2] = {
4784 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4785 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4786 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4787 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4788 	};
4789 	static const struct alc298_samsung_amp_desc amps[] = {
4790 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4791 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4792 	};
4793 
4794 	if (action != HDA_FIXUP_ACT_INIT)
4795 		return;
4796 
4797 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4798 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4799 
4800 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4801 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4802 
4803 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4804 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4805 	}
4806 }
4807 
4808 #if IS_REACHABLE(CONFIG_INPUT)
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)4809 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4810 				   struct hda_jack_callback *event)
4811 {
4812 	struct alc_spec *spec = codec->spec;
4813 
4814 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4815 	   send both key on and key off event for every interrupt. */
4816 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4817 	input_sync(spec->kb_dev);
4818 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4819 	input_sync(spec->kb_dev);
4820 }
4821 
alc_register_micmute_input_device(struct hda_codec * codec)4822 static int alc_register_micmute_input_device(struct hda_codec *codec)
4823 {
4824 	struct alc_spec *spec = codec->spec;
4825 	int i;
4826 
4827 	spec->kb_dev = input_allocate_device();
4828 	if (!spec->kb_dev) {
4829 		codec_err(codec, "Out of memory (input_allocate_device)\n");
4830 		return -ENOMEM;
4831 	}
4832 
4833 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4834 
4835 	spec->kb_dev->name = "Microphone Mute Button";
4836 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4837 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4838 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4839 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4840 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4841 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4842 
4843 	if (input_register_device(spec->kb_dev)) {
4844 		codec_err(codec, "input_register_device failed\n");
4845 		input_free_device(spec->kb_dev);
4846 		spec->kb_dev = NULL;
4847 		return -ENOMEM;
4848 	}
4849 
4850 	return 0;
4851 }
4852 
4853 /* GPIO1 = set according to SKU external amp
4854  * GPIO2 = mic mute hotkey
4855  * GPIO3 = mute LED
4856  * GPIO4 = mic mute LED
4857  */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4858 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4859 					     const struct hda_fixup *fix, int action)
4860 {
4861 	struct alc_spec *spec = codec->spec;
4862 
4863 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4864 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4865 		spec->init_amp = ALC_INIT_DEFAULT;
4866 		if (alc_register_micmute_input_device(codec) != 0)
4867 			return;
4868 
4869 		spec->gpio_mask |= 0x06;
4870 		spec->gpio_dir |= 0x02;
4871 		spec->gpio_data |= 0x02;
4872 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4873 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4874 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4875 						    gpio2_mic_hotkey_event);
4876 		return;
4877 	}
4878 
4879 	if (!spec->kb_dev)
4880 		return;
4881 
4882 	switch (action) {
4883 	case HDA_FIXUP_ACT_FREE:
4884 		input_unregister_device(spec->kb_dev);
4885 		spec->kb_dev = NULL;
4886 	}
4887 }
4888 
4889 /* Line2 = mic mute hotkey
4890  * GPIO2 = mic mute LED
4891  */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4892 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4893 					     const struct hda_fixup *fix, int action)
4894 {
4895 	struct alc_spec *spec = codec->spec;
4896 
4897 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4898 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4899 		spec->init_amp = ALC_INIT_DEFAULT;
4900 		if (alc_register_micmute_input_device(codec) != 0)
4901 			return;
4902 
4903 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
4904 						    gpio2_mic_hotkey_event);
4905 		return;
4906 	}
4907 
4908 	if (!spec->kb_dev)
4909 		return;
4910 
4911 	switch (action) {
4912 	case HDA_FIXUP_ACT_FREE:
4913 		input_unregister_device(spec->kb_dev);
4914 		spec->kb_dev = NULL;
4915 	}
4916 }
4917 #else /* INPUT */
4918 #define alc280_fixup_hp_gpio2_mic_hotkey	NULL
4919 #define alc233_fixup_lenovo_line2_mic_hotkey	NULL
4920 #endif /* INPUT */
4921 
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4922 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4923 				const struct hda_fixup *fix, int action)
4924 {
4925 	struct alc_spec *spec = codec->spec;
4926 
4927 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4928 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4929 		spec->cap_mute_led_nid = 0x18;
4930 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4931 	}
4932 }
4933 
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)4934 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
4935 {
4936 	if (delay <= 0)
4937 		delay = 75;
4938 	snd_hda_codec_write(codec, 0x21, 0,
4939 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4940 	msleep(delay);
4941 	snd_hda_codec_write(codec, 0x21, 0,
4942 		    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4943 	msleep(delay);
4944 }
4945 
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)4946 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
4947 {
4948 	if (delay <= 0)
4949 		delay = 75;
4950 	snd_hda_codec_write(codec, 0x21, 0,
4951 		    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4952 	msleep(delay);
4953 	snd_hda_codec_write(codec, 0x21, 0,
4954 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4955 	msleep(delay);
4956 }
4957 
4958 static const struct coef_fw alc225_pre_hsmode[] = {
4959 	UPDATE_COEF(0x4a, 1<<8, 0),
4960 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4961 	UPDATE_COEF(0x63, 3<<14, 3<<14),
4962 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
4963 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
4964 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4965 	UPDATE_COEF(0x4a, 3<<10, 0),
4966 	{}
4967 };
4968 
alc_headset_mode_unplugged(struct hda_codec * codec)4969 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4970 {
4971 	struct alc_spec *spec = codec->spec;
4972 	static const struct coef_fw coef0255[] = {
4973 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4974 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4975 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4976 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4977 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4978 		{}
4979 	};
4980 	static const struct coef_fw coef0256[] = {
4981 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4982 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4983 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4984 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4985 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4986 		{}
4987 	};
4988 	static const struct coef_fw coef0233[] = {
4989 		WRITE_COEF(0x1b, 0x0c0b),
4990 		WRITE_COEF(0x45, 0xc429),
4991 		UPDATE_COEF(0x35, 0x4000, 0),
4992 		WRITE_COEF(0x06, 0x2104),
4993 		WRITE_COEF(0x1a, 0x0001),
4994 		WRITE_COEF(0x26, 0x0004),
4995 		WRITE_COEF(0x32, 0x42a3),
4996 		{}
4997 	};
4998 	static const struct coef_fw coef0288[] = {
4999 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5000 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5001 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5002 		UPDATE_COEF(0x66, 0x0008, 0),
5003 		UPDATE_COEF(0x67, 0x2000, 0),
5004 		{}
5005 	};
5006 	static const struct coef_fw coef0298[] = {
5007 		UPDATE_COEF(0x19, 0x1300, 0x0300),
5008 		{}
5009 	};
5010 	static const struct coef_fw coef0292[] = {
5011 		WRITE_COEF(0x76, 0x000e),
5012 		WRITE_COEF(0x6c, 0x2400),
5013 		WRITE_COEF(0x18, 0x7308),
5014 		WRITE_COEF(0x6b, 0xc429),
5015 		{}
5016 	};
5017 	static const struct coef_fw coef0293[] = {
5018 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5019 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5020 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5021 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5022 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5023 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5024 		{}
5025 	};
5026 	static const struct coef_fw coef0668[] = {
5027 		WRITE_COEF(0x15, 0x0d40),
5028 		WRITE_COEF(0xb7, 0x802b),
5029 		{}
5030 	};
5031 	static const struct coef_fw coef0225[] = {
5032 		UPDATE_COEF(0x63, 3<<14, 0),
5033 		{}
5034 	};
5035 	static const struct coef_fw coef0274[] = {
5036 		UPDATE_COEF(0x4a, 0x0100, 0),
5037 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5038 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
5039 		UPDATE_COEF(0x4a, 0x0010, 0),
5040 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5041 		WRITE_COEF(0x45, 0x5289),
5042 		UPDATE_COEF(0x4a, 0x0c00, 0),
5043 		{}
5044 	};
5045 
5046 	if (spec->no_internal_mic_pin) {
5047 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5048 		return;
5049 	}
5050 
5051 	switch (codec->core.vendor_id) {
5052 	case 0x10ec0255:
5053 		alc_process_coef_fw(codec, coef0255);
5054 		break;
5055 	case 0x10ec0230:
5056 	case 0x10ec0236:
5057 	case 0x10ec0256:
5058 	case 0x19e58326:
5059 		alc_hp_mute_disable(codec, 75);
5060 		alc_process_coef_fw(codec, coef0256);
5061 		break;
5062 	case 0x10ec0234:
5063 	case 0x10ec0274:
5064 	case 0x10ec0294:
5065 		alc_process_coef_fw(codec, coef0274);
5066 		break;
5067 	case 0x10ec0233:
5068 	case 0x10ec0283:
5069 		alc_process_coef_fw(codec, coef0233);
5070 		break;
5071 	case 0x10ec0286:
5072 	case 0x10ec0288:
5073 		alc_process_coef_fw(codec, coef0288);
5074 		break;
5075 	case 0x10ec0298:
5076 		alc_process_coef_fw(codec, coef0298);
5077 		alc_process_coef_fw(codec, coef0288);
5078 		break;
5079 	case 0x10ec0292:
5080 		alc_process_coef_fw(codec, coef0292);
5081 		break;
5082 	case 0x10ec0293:
5083 		alc_process_coef_fw(codec, coef0293);
5084 		break;
5085 	case 0x10ec0668:
5086 		alc_process_coef_fw(codec, coef0668);
5087 		break;
5088 	case 0x10ec0215:
5089 	case 0x10ec0225:
5090 	case 0x10ec0285:
5091 	case 0x10ec0295:
5092 	case 0x10ec0289:
5093 	case 0x10ec0299:
5094 		alc_hp_mute_disable(codec, 75);
5095 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5096 		alc_process_coef_fw(codec, coef0225);
5097 		break;
5098 	case 0x10ec0867:
5099 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5100 		break;
5101 	}
5102 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5103 }
5104 
5105 
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5106 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5107 				    hda_nid_t mic_pin)
5108 {
5109 	static const struct coef_fw coef0255[] = {
5110 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5111 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5112 		{}
5113 	};
5114 	static const struct coef_fw coef0256[] = {
5115 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5116 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5117 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5118 		{}
5119 	};
5120 	static const struct coef_fw coef0233[] = {
5121 		UPDATE_COEF(0x35, 0, 1<<14),
5122 		WRITE_COEF(0x06, 0x2100),
5123 		WRITE_COEF(0x1a, 0x0021),
5124 		WRITE_COEF(0x26, 0x008c),
5125 		{}
5126 	};
5127 	static const struct coef_fw coef0288[] = {
5128 		UPDATE_COEF(0x4f, 0x00c0, 0),
5129 		UPDATE_COEF(0x50, 0x2000, 0),
5130 		UPDATE_COEF(0x56, 0x0006, 0),
5131 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5132 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5133 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5134 		{}
5135 	};
5136 	static const struct coef_fw coef0292[] = {
5137 		WRITE_COEF(0x19, 0xa208),
5138 		WRITE_COEF(0x2e, 0xacf0),
5139 		{}
5140 	};
5141 	static const struct coef_fw coef0293[] = {
5142 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5143 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5144 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5145 		{}
5146 	};
5147 	static const struct coef_fw coef0688[] = {
5148 		WRITE_COEF(0xb7, 0x802b),
5149 		WRITE_COEF(0xb5, 0x1040),
5150 		UPDATE_COEF(0xc3, 0, 1<<12),
5151 		{}
5152 	};
5153 	static const struct coef_fw coef0225[] = {
5154 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5155 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5156 		UPDATE_COEF(0x63, 3<<14, 0),
5157 		{}
5158 	};
5159 	static const struct coef_fw coef0274[] = {
5160 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5161 		UPDATE_COEF(0x4a, 0x0010, 0),
5162 		UPDATE_COEF(0x6b, 0xf000, 0),
5163 		{}
5164 	};
5165 
5166 	switch (codec->core.vendor_id) {
5167 	case 0x10ec0255:
5168 		alc_write_coef_idx(codec, 0x45, 0xc489);
5169 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5170 		alc_process_coef_fw(codec, coef0255);
5171 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5172 		break;
5173 	case 0x10ec0230:
5174 	case 0x10ec0236:
5175 	case 0x10ec0256:
5176 	case 0x19e58326:
5177 		alc_write_coef_idx(codec, 0x45, 0xc489);
5178 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5179 		alc_process_coef_fw(codec, coef0256);
5180 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5181 		break;
5182 	case 0x10ec0234:
5183 	case 0x10ec0274:
5184 	case 0x10ec0294:
5185 		alc_write_coef_idx(codec, 0x45, 0x4689);
5186 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5187 		alc_process_coef_fw(codec, coef0274);
5188 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5189 		break;
5190 	case 0x10ec0233:
5191 	case 0x10ec0283:
5192 		alc_write_coef_idx(codec, 0x45, 0xc429);
5193 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5194 		alc_process_coef_fw(codec, coef0233);
5195 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5196 		break;
5197 	case 0x10ec0286:
5198 	case 0x10ec0288:
5199 	case 0x10ec0298:
5200 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5201 		alc_process_coef_fw(codec, coef0288);
5202 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5203 		break;
5204 	case 0x10ec0292:
5205 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5206 		alc_process_coef_fw(codec, coef0292);
5207 		break;
5208 	case 0x10ec0293:
5209 		/* Set to TRS mode */
5210 		alc_write_coef_idx(codec, 0x45, 0xc429);
5211 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5212 		alc_process_coef_fw(codec, coef0293);
5213 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5214 		break;
5215 	case 0x10ec0867:
5216 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5217 		fallthrough;
5218 	case 0x10ec0221:
5219 	case 0x10ec0662:
5220 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5221 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5222 		break;
5223 	case 0x10ec0668:
5224 		alc_write_coef_idx(codec, 0x11, 0x0001);
5225 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5226 		alc_process_coef_fw(codec, coef0688);
5227 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5228 		break;
5229 	case 0x10ec0215:
5230 	case 0x10ec0225:
5231 	case 0x10ec0285:
5232 	case 0x10ec0295:
5233 	case 0x10ec0289:
5234 	case 0x10ec0299:
5235 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5236 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5237 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5238 		alc_process_coef_fw(codec, coef0225);
5239 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5240 		break;
5241 	}
5242 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5243 }
5244 
alc_headset_mode_default(struct hda_codec * codec)5245 static void alc_headset_mode_default(struct hda_codec *codec)
5246 {
5247 	static const struct coef_fw coef0225[] = {
5248 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5249 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5250 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5251 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5252 		UPDATE_COEF(0x63, 3<<14, 0),
5253 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5254 		{}
5255 	};
5256 	static const struct coef_fw coef0255[] = {
5257 		WRITE_COEF(0x45, 0xc089),
5258 		WRITE_COEF(0x45, 0xc489),
5259 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5260 		WRITE_COEF(0x49, 0x0049),
5261 		{}
5262 	};
5263 	static const struct coef_fw coef0256[] = {
5264 		WRITE_COEF(0x45, 0xc489),
5265 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5266 		WRITE_COEF(0x49, 0x0049),
5267 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5268 		WRITE_COEF(0x06, 0x6100),
5269 		{}
5270 	};
5271 	static const struct coef_fw coef0233[] = {
5272 		WRITE_COEF(0x06, 0x2100),
5273 		WRITE_COEF(0x32, 0x4ea3),
5274 		{}
5275 	};
5276 	static const struct coef_fw coef0288[] = {
5277 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5278 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5279 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5280 		UPDATE_COEF(0x66, 0x0008, 0),
5281 		UPDATE_COEF(0x67, 0x2000, 0),
5282 		{}
5283 	};
5284 	static const struct coef_fw coef0292[] = {
5285 		WRITE_COEF(0x76, 0x000e),
5286 		WRITE_COEF(0x6c, 0x2400),
5287 		WRITE_COEF(0x6b, 0xc429),
5288 		WRITE_COEF(0x18, 0x7308),
5289 		{}
5290 	};
5291 	static const struct coef_fw coef0293[] = {
5292 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5293 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5294 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5295 		{}
5296 	};
5297 	static const struct coef_fw coef0688[] = {
5298 		WRITE_COEF(0x11, 0x0041),
5299 		WRITE_COEF(0x15, 0x0d40),
5300 		WRITE_COEF(0xb7, 0x802b),
5301 		{}
5302 	};
5303 	static const struct coef_fw coef0274[] = {
5304 		WRITE_COEF(0x45, 0x4289),
5305 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5306 		UPDATE_COEF(0x6b, 0x0f00, 0),
5307 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5308 		{}
5309 	};
5310 
5311 	switch (codec->core.vendor_id) {
5312 	case 0x10ec0215:
5313 	case 0x10ec0225:
5314 	case 0x10ec0285:
5315 	case 0x10ec0295:
5316 	case 0x10ec0289:
5317 	case 0x10ec0299:
5318 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5319 		alc_process_coef_fw(codec, coef0225);
5320 		alc_hp_enable_unmute(codec, 75);
5321 		break;
5322 	case 0x10ec0255:
5323 		alc_process_coef_fw(codec, coef0255);
5324 		break;
5325 	case 0x10ec0230:
5326 	case 0x10ec0236:
5327 	case 0x10ec0256:
5328 	case 0x19e58326:
5329 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5330 		alc_write_coef_idx(codec, 0x45, 0xc089);
5331 		msleep(50);
5332 		alc_process_coef_fw(codec, coef0256);
5333 		alc_hp_enable_unmute(codec, 75);
5334 		break;
5335 	case 0x10ec0234:
5336 	case 0x10ec0274:
5337 	case 0x10ec0294:
5338 		alc_process_coef_fw(codec, coef0274);
5339 		break;
5340 	case 0x10ec0233:
5341 	case 0x10ec0283:
5342 		alc_process_coef_fw(codec, coef0233);
5343 		break;
5344 	case 0x10ec0286:
5345 	case 0x10ec0288:
5346 	case 0x10ec0298:
5347 		alc_process_coef_fw(codec, coef0288);
5348 		break;
5349 	case 0x10ec0292:
5350 		alc_process_coef_fw(codec, coef0292);
5351 		break;
5352 	case 0x10ec0293:
5353 		alc_process_coef_fw(codec, coef0293);
5354 		break;
5355 	case 0x10ec0668:
5356 		alc_process_coef_fw(codec, coef0688);
5357 		break;
5358 	case 0x10ec0867:
5359 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5360 		break;
5361 	}
5362 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5363 }
5364 
5365 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5366 static void alc_headset_mode_ctia(struct hda_codec *codec)
5367 {
5368 	int val;
5369 
5370 	static const struct coef_fw coef0255[] = {
5371 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5372 		WRITE_COEF(0x1b, 0x0c2b),
5373 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5374 		{}
5375 	};
5376 	static const struct coef_fw coef0256[] = {
5377 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5378 		WRITE_COEF(0x1b, 0x0e6b),
5379 		{}
5380 	};
5381 	static const struct coef_fw coef0233[] = {
5382 		WRITE_COEF(0x45, 0xd429),
5383 		WRITE_COEF(0x1b, 0x0c2b),
5384 		WRITE_COEF(0x32, 0x4ea3),
5385 		{}
5386 	};
5387 	static const struct coef_fw coef0288[] = {
5388 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5389 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5390 		UPDATE_COEF(0x66, 0x0008, 0),
5391 		UPDATE_COEF(0x67, 0x2000, 0),
5392 		{}
5393 	};
5394 	static const struct coef_fw coef0292[] = {
5395 		WRITE_COEF(0x6b, 0xd429),
5396 		WRITE_COEF(0x76, 0x0008),
5397 		WRITE_COEF(0x18, 0x7388),
5398 		{}
5399 	};
5400 	static const struct coef_fw coef0293[] = {
5401 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5402 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5403 		{}
5404 	};
5405 	static const struct coef_fw coef0688[] = {
5406 		WRITE_COEF(0x11, 0x0001),
5407 		WRITE_COEF(0x15, 0x0d60),
5408 		WRITE_COEF(0xc3, 0x0000),
5409 		{}
5410 	};
5411 	static const struct coef_fw coef0225_1[] = {
5412 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5413 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5414 		{}
5415 	};
5416 	static const struct coef_fw coef0225_2[] = {
5417 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5418 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5419 		{}
5420 	};
5421 
5422 	switch (codec->core.vendor_id) {
5423 	case 0x10ec0255:
5424 		alc_process_coef_fw(codec, coef0255);
5425 		break;
5426 	case 0x10ec0230:
5427 	case 0x10ec0236:
5428 	case 0x10ec0256:
5429 	case 0x19e58326:
5430 		alc_process_coef_fw(codec, coef0256);
5431 		alc_hp_enable_unmute(codec, 75);
5432 		break;
5433 	case 0x10ec0234:
5434 	case 0x10ec0274:
5435 	case 0x10ec0294:
5436 		alc_write_coef_idx(codec, 0x45, 0xd689);
5437 		break;
5438 	case 0x10ec0233:
5439 	case 0x10ec0283:
5440 		alc_process_coef_fw(codec, coef0233);
5441 		break;
5442 	case 0x10ec0298:
5443 		val = alc_read_coef_idx(codec, 0x50);
5444 		if (val & (1 << 12)) {
5445 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5446 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5447 			msleep(300);
5448 		} else {
5449 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5450 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5451 			msleep(300);
5452 		}
5453 		break;
5454 	case 0x10ec0286:
5455 	case 0x10ec0288:
5456 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5457 		msleep(300);
5458 		alc_process_coef_fw(codec, coef0288);
5459 		break;
5460 	case 0x10ec0292:
5461 		alc_process_coef_fw(codec, coef0292);
5462 		break;
5463 	case 0x10ec0293:
5464 		alc_process_coef_fw(codec, coef0293);
5465 		break;
5466 	case 0x10ec0668:
5467 		alc_process_coef_fw(codec, coef0688);
5468 		break;
5469 	case 0x10ec0215:
5470 	case 0x10ec0225:
5471 	case 0x10ec0285:
5472 	case 0x10ec0295:
5473 	case 0x10ec0289:
5474 	case 0x10ec0299:
5475 		val = alc_read_coef_idx(codec, 0x45);
5476 		if (val & (1 << 9))
5477 			alc_process_coef_fw(codec, coef0225_2);
5478 		else
5479 			alc_process_coef_fw(codec, coef0225_1);
5480 		alc_hp_enable_unmute(codec, 75);
5481 		break;
5482 	case 0x10ec0867:
5483 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5484 		break;
5485 	}
5486 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5487 }
5488 
5489 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5490 static void alc_headset_mode_omtp(struct hda_codec *codec)
5491 {
5492 	static const struct coef_fw coef0255[] = {
5493 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5494 		WRITE_COEF(0x1b, 0x0c2b),
5495 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5496 		{}
5497 	};
5498 	static const struct coef_fw coef0256[] = {
5499 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5500 		WRITE_COEF(0x1b, 0x0e6b),
5501 		{}
5502 	};
5503 	static const struct coef_fw coef0233[] = {
5504 		WRITE_COEF(0x45, 0xe429),
5505 		WRITE_COEF(0x1b, 0x0c2b),
5506 		WRITE_COEF(0x32, 0x4ea3),
5507 		{}
5508 	};
5509 	static const struct coef_fw coef0288[] = {
5510 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5511 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5512 		UPDATE_COEF(0x66, 0x0008, 0),
5513 		UPDATE_COEF(0x67, 0x2000, 0),
5514 		{}
5515 	};
5516 	static const struct coef_fw coef0292[] = {
5517 		WRITE_COEF(0x6b, 0xe429),
5518 		WRITE_COEF(0x76, 0x0008),
5519 		WRITE_COEF(0x18, 0x7388),
5520 		{}
5521 	};
5522 	static const struct coef_fw coef0293[] = {
5523 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5524 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5525 		{}
5526 	};
5527 	static const struct coef_fw coef0688[] = {
5528 		WRITE_COEF(0x11, 0x0001),
5529 		WRITE_COEF(0x15, 0x0d50),
5530 		WRITE_COEF(0xc3, 0x0000),
5531 		{}
5532 	};
5533 	static const struct coef_fw coef0225[] = {
5534 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5535 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5536 		{}
5537 	};
5538 
5539 	switch (codec->core.vendor_id) {
5540 	case 0x10ec0255:
5541 		alc_process_coef_fw(codec, coef0255);
5542 		break;
5543 	case 0x10ec0230:
5544 	case 0x10ec0236:
5545 	case 0x10ec0256:
5546 	case 0x19e58326:
5547 		alc_process_coef_fw(codec, coef0256);
5548 		alc_hp_enable_unmute(codec, 75);
5549 		break;
5550 	case 0x10ec0234:
5551 	case 0x10ec0274:
5552 	case 0x10ec0294:
5553 		alc_write_coef_idx(codec, 0x45, 0xe689);
5554 		break;
5555 	case 0x10ec0233:
5556 	case 0x10ec0283:
5557 		alc_process_coef_fw(codec, coef0233);
5558 		break;
5559 	case 0x10ec0298:
5560 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5561 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5562 		msleep(300);
5563 		break;
5564 	case 0x10ec0286:
5565 	case 0x10ec0288:
5566 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5567 		msleep(300);
5568 		alc_process_coef_fw(codec, coef0288);
5569 		break;
5570 	case 0x10ec0292:
5571 		alc_process_coef_fw(codec, coef0292);
5572 		break;
5573 	case 0x10ec0293:
5574 		alc_process_coef_fw(codec, coef0293);
5575 		break;
5576 	case 0x10ec0668:
5577 		alc_process_coef_fw(codec, coef0688);
5578 		break;
5579 	case 0x10ec0215:
5580 	case 0x10ec0225:
5581 	case 0x10ec0285:
5582 	case 0x10ec0295:
5583 	case 0x10ec0289:
5584 	case 0x10ec0299:
5585 		alc_process_coef_fw(codec, coef0225);
5586 		alc_hp_enable_unmute(codec, 75);
5587 		break;
5588 	}
5589 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5590 }
5591 
alc_determine_headset_type(struct hda_codec * codec)5592 static void alc_determine_headset_type(struct hda_codec *codec)
5593 {
5594 	int val;
5595 	bool is_ctia = false;
5596 	struct alc_spec *spec = codec->spec;
5597 	static const struct coef_fw coef0255[] = {
5598 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5599 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5600  conteol) */
5601 		{}
5602 	};
5603 	static const struct coef_fw coef0288[] = {
5604 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5605 		{}
5606 	};
5607 	static const struct coef_fw coef0298[] = {
5608 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5609 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5610 		UPDATE_COEF(0x66, 0x0008, 0),
5611 		UPDATE_COEF(0x67, 0x2000, 0),
5612 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5613 		{}
5614 	};
5615 	static const struct coef_fw coef0293[] = {
5616 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5617 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5618 		{}
5619 	};
5620 	static const struct coef_fw coef0688[] = {
5621 		WRITE_COEF(0x11, 0x0001),
5622 		WRITE_COEF(0xb7, 0x802b),
5623 		WRITE_COEF(0x15, 0x0d60),
5624 		WRITE_COEF(0xc3, 0x0c00),
5625 		{}
5626 	};
5627 	static const struct coef_fw coef0274[] = {
5628 		UPDATE_COEF(0x4a, 0x0010, 0),
5629 		UPDATE_COEF(0x4a, 0x8000, 0),
5630 		WRITE_COEF(0x45, 0xd289),
5631 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5632 		{}
5633 	};
5634 
5635 	if (spec->no_internal_mic_pin) {
5636 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5637 		return;
5638 	}
5639 
5640 	switch (codec->core.vendor_id) {
5641 	case 0x10ec0255:
5642 		alc_process_coef_fw(codec, coef0255);
5643 		msleep(300);
5644 		val = alc_read_coef_idx(codec, 0x46);
5645 		is_ctia = (val & 0x0070) == 0x0070;
5646 		break;
5647 	case 0x10ec0230:
5648 	case 0x10ec0236:
5649 	case 0x10ec0256:
5650 	case 0x19e58326:
5651 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5652 		alc_write_coef_idx(codec, 0x06, 0x6104);
5653 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5654 
5655 		alc_process_coef_fw(codec, coef0255);
5656 		msleep(300);
5657 		val = alc_read_coef_idx(codec, 0x46);
5658 		is_ctia = (val & 0x0070) == 0x0070;
5659 		if (!is_ctia) {
5660 			alc_write_coef_idx(codec, 0x45, 0xe089);
5661 			msleep(100);
5662 			val = alc_read_coef_idx(codec, 0x46);
5663 			if ((val & 0x0070) == 0x0070)
5664 				is_ctia = false;
5665 			else
5666 				is_ctia = true;
5667 		}
5668 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5669 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5670 		break;
5671 	case 0x10ec0234:
5672 	case 0x10ec0274:
5673 	case 0x10ec0294:
5674 		alc_process_coef_fw(codec, coef0274);
5675 		msleep(850);
5676 		val = alc_read_coef_idx(codec, 0x46);
5677 		is_ctia = (val & 0x00f0) == 0x00f0;
5678 		break;
5679 	case 0x10ec0233:
5680 	case 0x10ec0283:
5681 		alc_write_coef_idx(codec, 0x45, 0xd029);
5682 		msleep(300);
5683 		val = alc_read_coef_idx(codec, 0x46);
5684 		is_ctia = (val & 0x0070) == 0x0070;
5685 		break;
5686 	case 0x10ec0298:
5687 		snd_hda_codec_write(codec, 0x21, 0,
5688 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5689 		msleep(100);
5690 		snd_hda_codec_write(codec, 0x21, 0,
5691 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5692 		msleep(200);
5693 
5694 		val = alc_read_coef_idx(codec, 0x50);
5695 		if (val & (1 << 12)) {
5696 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5697 			alc_process_coef_fw(codec, coef0288);
5698 			msleep(350);
5699 			val = alc_read_coef_idx(codec, 0x50);
5700 			is_ctia = (val & 0x0070) == 0x0070;
5701 		} else {
5702 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5703 			alc_process_coef_fw(codec, coef0288);
5704 			msleep(350);
5705 			val = alc_read_coef_idx(codec, 0x50);
5706 			is_ctia = (val & 0x0070) == 0x0070;
5707 		}
5708 		alc_process_coef_fw(codec, coef0298);
5709 		snd_hda_codec_write(codec, 0x21, 0,
5710 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5711 		msleep(75);
5712 		snd_hda_codec_write(codec, 0x21, 0,
5713 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5714 		break;
5715 	case 0x10ec0286:
5716 	case 0x10ec0288:
5717 		alc_process_coef_fw(codec, coef0288);
5718 		msleep(350);
5719 		val = alc_read_coef_idx(codec, 0x50);
5720 		is_ctia = (val & 0x0070) == 0x0070;
5721 		break;
5722 	case 0x10ec0292:
5723 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5724 		msleep(300);
5725 		val = alc_read_coef_idx(codec, 0x6c);
5726 		is_ctia = (val & 0x001c) == 0x001c;
5727 		break;
5728 	case 0x10ec0293:
5729 		alc_process_coef_fw(codec, coef0293);
5730 		msleep(300);
5731 		val = alc_read_coef_idx(codec, 0x46);
5732 		is_ctia = (val & 0x0070) == 0x0070;
5733 		break;
5734 	case 0x10ec0668:
5735 		alc_process_coef_fw(codec, coef0688);
5736 		msleep(300);
5737 		val = alc_read_coef_idx(codec, 0xbe);
5738 		is_ctia = (val & 0x1c02) == 0x1c02;
5739 		break;
5740 	case 0x10ec0215:
5741 	case 0x10ec0225:
5742 	case 0x10ec0285:
5743 	case 0x10ec0295:
5744 	case 0x10ec0289:
5745 	case 0x10ec0299:
5746 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5747 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5748 		val = alc_read_coef_idx(codec, 0x45);
5749 		if (val & (1 << 9)) {
5750 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5751 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5752 			msleep(800);
5753 			val = alc_read_coef_idx(codec, 0x46);
5754 			is_ctia = (val & 0x00f0) == 0x00f0;
5755 		} else {
5756 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5757 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5758 			msleep(800);
5759 			val = alc_read_coef_idx(codec, 0x46);
5760 			is_ctia = (val & 0x00f0) == 0x00f0;
5761 		}
5762 		if (!is_ctia) {
5763 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5764 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5765 			msleep(100);
5766 			val = alc_read_coef_idx(codec, 0x46);
5767 			if ((val & 0x00f0) == 0x00f0)
5768 				is_ctia = false;
5769 			else
5770 				is_ctia = true;
5771 		}
5772 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5773 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5774 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5775 		break;
5776 	case 0x10ec0867:
5777 		is_ctia = true;
5778 		break;
5779 	}
5780 
5781 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5782 		    is_ctia ? "yes" : "no");
5783 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5784 }
5785 
alc_update_headset_mode(struct hda_codec * codec)5786 static void alc_update_headset_mode(struct hda_codec *codec)
5787 {
5788 	struct alc_spec *spec = codec->spec;
5789 
5790 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5791 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
5792 
5793 	int new_headset_mode;
5794 
5795 	if (!snd_hda_jack_detect(codec, hp_pin))
5796 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5797 	else if (mux_pin == spec->headset_mic_pin)
5798 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5799 	else if (mux_pin == spec->headphone_mic_pin)
5800 		new_headset_mode = ALC_HEADSET_MODE_MIC;
5801 	else
5802 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5803 
5804 	if (new_headset_mode == spec->current_headset_mode) {
5805 		snd_hda_gen_update_outputs(codec);
5806 		return;
5807 	}
5808 
5809 	switch (new_headset_mode) {
5810 	case ALC_HEADSET_MODE_UNPLUGGED:
5811 		alc_headset_mode_unplugged(codec);
5812 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5813 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5814 		spec->gen.hp_jack_present = false;
5815 		break;
5816 	case ALC_HEADSET_MODE_HEADSET:
5817 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5818 			alc_determine_headset_type(codec);
5819 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5820 			alc_headset_mode_ctia(codec);
5821 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5822 			alc_headset_mode_omtp(codec);
5823 		spec->gen.hp_jack_present = true;
5824 		break;
5825 	case ALC_HEADSET_MODE_MIC:
5826 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5827 		spec->gen.hp_jack_present = false;
5828 		break;
5829 	case ALC_HEADSET_MODE_HEADPHONE:
5830 		alc_headset_mode_default(codec);
5831 		spec->gen.hp_jack_present = true;
5832 		break;
5833 	}
5834 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5835 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
5836 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5837 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5838 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5839 						  PIN_VREFHIZ);
5840 	}
5841 	spec->current_headset_mode = new_headset_mode;
5842 
5843 	snd_hda_gen_update_outputs(codec);
5844 }
5845 
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)5846 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5847 					 struct snd_kcontrol *kcontrol,
5848 					 struct snd_ctl_elem_value *ucontrol)
5849 {
5850 	alc_update_headset_mode(codec);
5851 }
5852 
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5853 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5854 				       struct hda_jack_callback *jack)
5855 {
5856 	snd_hda_gen_hp_automute(codec, jack);
5857 	alc_update_headset_mode(codec);
5858 }
5859 
alc_probe_headset_mode(struct hda_codec * codec)5860 static void alc_probe_headset_mode(struct hda_codec *codec)
5861 {
5862 	int i;
5863 	struct alc_spec *spec = codec->spec;
5864 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5865 
5866 	/* Find mic pins */
5867 	for (i = 0; i < cfg->num_inputs; i++) {
5868 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5869 			spec->headset_mic_pin = cfg->inputs[i].pin;
5870 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5871 			spec->headphone_mic_pin = cfg->inputs[i].pin;
5872 	}
5873 
5874 	WARN_ON(spec->gen.cap_sync_hook);
5875 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5876 	spec->gen.automute_hook = alc_update_headset_mode;
5877 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5878 }
5879 
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)5880 static void alc_fixup_headset_mode(struct hda_codec *codec,
5881 				const struct hda_fixup *fix, int action)
5882 {
5883 	struct alc_spec *spec = codec->spec;
5884 
5885 	switch (action) {
5886 	case HDA_FIXUP_ACT_PRE_PROBE:
5887 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5888 		break;
5889 	case HDA_FIXUP_ACT_PROBE:
5890 		alc_probe_headset_mode(codec);
5891 		break;
5892 	case HDA_FIXUP_ACT_INIT:
5893 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
5894 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5895 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5896 		}
5897 		alc_update_headset_mode(codec);
5898 		break;
5899 	}
5900 }
5901 
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5902 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5903 				const struct hda_fixup *fix, int action)
5904 {
5905 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5906 		struct alc_spec *spec = codec->spec;
5907 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5908 	}
5909 	else
5910 		alc_fixup_headset_mode(codec, fix, action);
5911 }
5912 
alc255_set_default_jack_type(struct hda_codec * codec)5913 static void alc255_set_default_jack_type(struct hda_codec *codec)
5914 {
5915 	/* Set to iphone type */
5916 	static const struct coef_fw alc255fw[] = {
5917 		WRITE_COEF(0x1b, 0x880b),
5918 		WRITE_COEF(0x45, 0xd089),
5919 		WRITE_COEF(0x1b, 0x080b),
5920 		WRITE_COEF(0x46, 0x0004),
5921 		WRITE_COEF(0x1b, 0x0c0b),
5922 		{}
5923 	};
5924 	static const struct coef_fw alc256fw[] = {
5925 		WRITE_COEF(0x1b, 0x884b),
5926 		WRITE_COEF(0x45, 0xd089),
5927 		WRITE_COEF(0x1b, 0x084b),
5928 		WRITE_COEF(0x46, 0x0004),
5929 		WRITE_COEF(0x1b, 0x0c4b),
5930 		{}
5931 	};
5932 	switch (codec->core.vendor_id) {
5933 	case 0x10ec0255:
5934 		alc_process_coef_fw(codec, alc255fw);
5935 		break;
5936 	case 0x10ec0230:
5937 	case 0x10ec0236:
5938 	case 0x10ec0256:
5939 	case 0x19e58326:
5940 		alc_process_coef_fw(codec, alc256fw);
5941 		break;
5942 	}
5943 	msleep(30);
5944 }
5945 
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)5946 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5947 				const struct hda_fixup *fix, int action)
5948 {
5949 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5950 		alc255_set_default_jack_type(codec);
5951 	}
5952 	alc_fixup_headset_mode(codec, fix, action);
5953 }
5954 
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5955 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5956 				const struct hda_fixup *fix, int action)
5957 {
5958 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5959 		struct alc_spec *spec = codec->spec;
5960 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5961 		alc255_set_default_jack_type(codec);
5962 	}
5963 	else
5964 		alc_fixup_headset_mode(codec, fix, action);
5965 }
5966 
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5967 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5968 				       struct hda_jack_callback *jack)
5969 {
5970 	struct alc_spec *spec = codec->spec;
5971 
5972 	alc_update_headset_jack_cb(codec, jack);
5973 	/* Headset Mic enable or disable, only for Dell Dino */
5974 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5975 }
5976 
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)5977 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5978 				const struct hda_fixup *fix, int action)
5979 {
5980 	alc_fixup_headset_mode(codec, fix, action);
5981 	if (action == HDA_FIXUP_ACT_PROBE) {
5982 		struct alc_spec *spec = codec->spec;
5983 		/* toggled via hp_automute_hook */
5984 		spec->gpio_mask |= 0x40;
5985 		spec->gpio_dir |= 0x40;
5986 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5987 	}
5988 }
5989 
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)5990 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5991 					const struct hda_fixup *fix, int action)
5992 {
5993 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5994 		struct alc_spec *spec = codec->spec;
5995 		spec->gen.auto_mute_via_amp = 1;
5996 	}
5997 }
5998 
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)5999 static void alc_fixup_no_shutup(struct hda_codec *codec,
6000 				const struct hda_fixup *fix, int action)
6001 {
6002 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6003 		struct alc_spec *spec = codec->spec;
6004 		spec->no_shutup_pins = 1;
6005 	}
6006 }
6007 
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)6008 static void alc_fixup_disable_aamix(struct hda_codec *codec,
6009 				    const struct hda_fixup *fix, int action)
6010 {
6011 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6012 		struct alc_spec *spec = codec->spec;
6013 		/* Disable AA-loopback as it causes white noise */
6014 		spec->gen.mixer_nid = 0;
6015 	}
6016 }
6017 
6018 /* 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)6019 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6020 				  const struct hda_fixup *fix, int action)
6021 {
6022 	static const struct hda_pintbl pincfgs[] = {
6023 		{ 0x16, 0x21211010 }, /* dock headphone */
6024 		{ 0x19, 0x21a11010 }, /* dock mic */
6025 		{ }
6026 	};
6027 	struct alc_spec *spec = codec->spec;
6028 
6029 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6030 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6031 		codec->power_save_node = 0; /* avoid click noises */
6032 		snd_hda_apply_pincfgs(codec, pincfgs);
6033 	}
6034 }
6035 
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6036 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6037 				  const struct hda_fixup *fix, int action)
6038 {
6039 	static const struct hda_pintbl pincfgs[] = {
6040 		{ 0x17, 0x21211010 }, /* dock headphone */
6041 		{ 0x19, 0x21a11010 }, /* dock mic */
6042 		{ }
6043 	};
6044 	struct alc_spec *spec = codec->spec;
6045 
6046 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6047 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6048 		snd_hda_apply_pincfgs(codec, pincfgs);
6049 	} else if (action == HDA_FIXUP_ACT_INIT) {
6050 		/* Enable DOCK device */
6051 		snd_hda_codec_write(codec, 0x17, 0,
6052 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6053 		/* Enable DOCK device */
6054 		snd_hda_codec_write(codec, 0x19, 0,
6055 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6056 	}
6057 }
6058 
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6059 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6060 				  const struct hda_fixup *fix, int action)
6061 {
6062 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6063 	 * the speaker output becomes too low by some reason on Thinkpads with
6064 	 * ALC298 codec
6065 	 */
6066 	static const hda_nid_t preferred_pairs[] = {
6067 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6068 		0
6069 	};
6070 	struct alc_spec *spec = codec->spec;
6071 
6072 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6073 		spec->gen.preferred_dacs = preferred_pairs;
6074 }
6075 
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6076 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6077 				   const struct hda_fixup *fix, int action)
6078 {
6079 	static const hda_nid_t preferred_pairs[] = {
6080 		0x17, 0x02, 0x21, 0x03, 0
6081 	};
6082 	struct alc_spec *spec = codec->spec;
6083 
6084 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6085 		spec->gen.preferred_dacs = preferred_pairs;
6086 }
6087 
alc_shutup_dell_xps13(struct hda_codec * codec)6088 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6089 {
6090 	struct alc_spec *spec = codec->spec;
6091 	int hp_pin = alc_get_hp_pin(spec);
6092 
6093 	/* Prevent pop noises when headphones are plugged in */
6094 	snd_hda_codec_write(codec, hp_pin, 0,
6095 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6096 	msleep(20);
6097 }
6098 
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6099 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6100 				const struct hda_fixup *fix, int action)
6101 {
6102 	struct alc_spec *spec = codec->spec;
6103 	struct hda_input_mux *imux = &spec->gen.input_mux;
6104 	int i;
6105 
6106 	switch (action) {
6107 	case HDA_FIXUP_ACT_PRE_PROBE:
6108 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6109 		 * it causes a click noise at start up
6110 		 */
6111 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6112 		spec->shutup = alc_shutup_dell_xps13;
6113 		break;
6114 	case HDA_FIXUP_ACT_PROBE:
6115 		/* Make the internal mic the default input source. */
6116 		for (i = 0; i < imux->num_items; i++) {
6117 			if (spec->gen.imux_pins[i] == 0x12) {
6118 				spec->gen.cur_mux[0] = i;
6119 				break;
6120 			}
6121 		}
6122 		break;
6123 	}
6124 }
6125 
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6126 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6127 				const struct hda_fixup *fix, int action)
6128 {
6129 	struct alc_spec *spec = codec->spec;
6130 
6131 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6132 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6133 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6134 
6135 		/* Disable boost for mic-in permanently. (This code is only called
6136 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6137 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6138 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6139 	} else
6140 		alc_fixup_headset_mode(codec, fix, action);
6141 }
6142 
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6143 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6144 				const struct hda_fixup *fix, int action)
6145 {
6146 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6147 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6148 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6149 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6150 	}
6151 	alc_fixup_headset_mode(codec, fix, action);
6152 }
6153 
6154 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6155 static int find_ext_mic_pin(struct hda_codec *codec)
6156 {
6157 	struct alc_spec *spec = codec->spec;
6158 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6159 	hda_nid_t nid;
6160 	unsigned int defcfg;
6161 	int i;
6162 
6163 	for (i = 0; i < cfg->num_inputs; i++) {
6164 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6165 			continue;
6166 		nid = cfg->inputs[i].pin;
6167 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6168 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6169 			continue;
6170 		return nid;
6171 	}
6172 
6173 	return 0;
6174 }
6175 
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6176 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6177 				    const struct hda_fixup *fix,
6178 				    int action)
6179 {
6180 	struct alc_spec *spec = codec->spec;
6181 
6182 	if (action == HDA_FIXUP_ACT_PROBE) {
6183 		int mic_pin = find_ext_mic_pin(codec);
6184 		int hp_pin = alc_get_hp_pin(spec);
6185 
6186 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6187 			return;
6188 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6189 	}
6190 }
6191 
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6192 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6193 					     const struct hda_fixup *fix,
6194 					     int action)
6195 {
6196 	struct alc_spec *spec = codec->spec;
6197 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6198 	int i;
6199 
6200 	/* The mic boosts on level 2 and 3 are too noisy
6201 	   on the internal mic input.
6202 	   Therefore limit the boost to 0 or 1. */
6203 
6204 	if (action != HDA_FIXUP_ACT_PROBE)
6205 		return;
6206 
6207 	for (i = 0; i < cfg->num_inputs; i++) {
6208 		hda_nid_t nid = cfg->inputs[i].pin;
6209 		unsigned int defcfg;
6210 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6211 			continue;
6212 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6213 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6214 			continue;
6215 
6216 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6217 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6218 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6219 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6220 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6221 	}
6222 }
6223 
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6224 static void alc283_hp_automute_hook(struct hda_codec *codec,
6225 				    struct hda_jack_callback *jack)
6226 {
6227 	struct alc_spec *spec = codec->spec;
6228 	int vref;
6229 
6230 	msleep(200);
6231 	snd_hda_gen_hp_automute(codec, jack);
6232 
6233 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6234 
6235 	msleep(600);
6236 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6237 			    vref);
6238 }
6239 
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6240 static void alc283_fixup_chromebook(struct hda_codec *codec,
6241 				    const struct hda_fixup *fix, int action)
6242 {
6243 	struct alc_spec *spec = codec->spec;
6244 
6245 	switch (action) {
6246 	case HDA_FIXUP_ACT_PRE_PROBE:
6247 		snd_hda_override_wcaps(codec, 0x03, 0);
6248 		/* Disable AA-loopback as it causes white noise */
6249 		spec->gen.mixer_nid = 0;
6250 		break;
6251 	case HDA_FIXUP_ACT_INIT:
6252 		/* MIC2-VREF control */
6253 		/* Set to manual mode */
6254 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6255 		/* Enable Line1 input control by verb */
6256 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6257 		break;
6258 	}
6259 }
6260 
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6261 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6262 				    const struct hda_fixup *fix, int action)
6263 {
6264 	struct alc_spec *spec = codec->spec;
6265 
6266 	switch (action) {
6267 	case HDA_FIXUP_ACT_PRE_PROBE:
6268 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6269 		break;
6270 	case HDA_FIXUP_ACT_INIT:
6271 		/* MIC2-VREF control */
6272 		/* Set to manual mode */
6273 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6274 		break;
6275 	}
6276 }
6277 
6278 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6279 static void asus_tx300_automute(struct hda_codec *codec)
6280 {
6281 	struct alc_spec *spec = codec->spec;
6282 	snd_hda_gen_update_outputs(codec);
6283 	if (snd_hda_jack_detect(codec, 0x1b))
6284 		spec->gen.mute_bits |= (1ULL << 0x14);
6285 }
6286 
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6287 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6288 				    const struct hda_fixup *fix, int action)
6289 {
6290 	struct alc_spec *spec = codec->spec;
6291 	static const struct hda_pintbl dock_pins[] = {
6292 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6293 		{}
6294 	};
6295 
6296 	switch (action) {
6297 	case HDA_FIXUP_ACT_PRE_PROBE:
6298 		spec->init_amp = ALC_INIT_DEFAULT;
6299 		/* TX300 needs to set up GPIO2 for the speaker amp */
6300 		alc_setup_gpio(codec, 0x04);
6301 		snd_hda_apply_pincfgs(codec, dock_pins);
6302 		spec->gen.auto_mute_via_amp = 1;
6303 		spec->gen.automute_hook = asus_tx300_automute;
6304 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6305 						    snd_hda_gen_hp_automute);
6306 		break;
6307 	case HDA_FIXUP_ACT_PROBE:
6308 		spec->init_amp = ALC_INIT_DEFAULT;
6309 		break;
6310 	case HDA_FIXUP_ACT_BUILD:
6311 		/* this is a bit tricky; give more sane names for the main
6312 		 * (tablet) speaker and the dock speaker, respectively
6313 		 */
6314 		rename_ctl(codec, "Speaker Playback Switch",
6315 			   "Dock Speaker Playback Switch");
6316 		rename_ctl(codec, "Bass Speaker Playback Switch",
6317 			   "Speaker Playback Switch");
6318 		break;
6319 	}
6320 }
6321 
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6322 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6323 				       const struct hda_fixup *fix, int action)
6324 {
6325 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6326 		/* DAC node 0x03 is giving mono output. We therefore want to
6327 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6328 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6329 		static const hda_nid_t conn1[] = { 0x0c };
6330 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6331 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6332 	}
6333 }
6334 
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6335 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6336 					const struct hda_fixup *fix, int action)
6337 {
6338 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6339 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6340 		   we can't adjust the speaker's volume since this node does not has
6341 		   Amp-out capability. we change the speaker's route to:
6342 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6343 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6344 		   speaker's volume now. */
6345 
6346 		static const hda_nid_t conn1[] = { 0x0c };
6347 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6348 	}
6349 }
6350 
6351 /* 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)6352 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6353 				      const struct hda_fixup *fix, int action)
6354 {
6355 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6356 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6357 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6358 	}
6359 }
6360 
6361 /* 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)6362 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6363 					  const struct hda_fixup *fix, int action)
6364 {
6365 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6366 		static const hda_nid_t conn[] = { 0x02 };
6367 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6368 	}
6369 }
6370 
6371 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6372 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6373 					  struct hda_jack_callback *jack)
6374 {
6375 	struct alc_spec *spec = codec->spec;
6376 
6377 	snd_hda_gen_hp_automute(codec, jack);
6378 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6379 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6380 			    !spec->gen.hp_jack_present);
6381 }
6382 
6383 /* Manage GPIOs for HP EliteBook Folio 9480m.
6384  *
6385  * GPIO4 is the headphone amplifier power control
6386  * GPIO3 is the audio output mute indicator LED
6387  */
6388 
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6389 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6390 				  const struct hda_fixup *fix,
6391 				  int action)
6392 {
6393 	struct alc_spec *spec = codec->spec;
6394 
6395 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6396 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6397 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6398 		spec->gpio_mask |= 0x10;
6399 		spec->gpio_dir |= 0x10;
6400 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6401 	}
6402 }
6403 
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6404 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6405 				   const struct hda_fixup *fix,
6406 				   int action)
6407 {
6408 	struct alc_spec *spec = codec->spec;
6409 
6410 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6411 		spec->gpio_mask |= 0x04;
6412 		spec->gpio_dir |= 0x04;
6413 		/* set data bit low */
6414 	}
6415 }
6416 
6417 /* Quirk for Thinkpad X1 7th and 8th Gen
6418  * The following fixed routing needed
6419  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6420  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6421  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6422  */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6423 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6424 					  const struct hda_fixup *fix, int action)
6425 {
6426 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6427 	static const hda_nid_t preferred_pairs[] = {
6428 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6429 	};
6430 	struct alc_spec *spec = codec->spec;
6431 
6432 	switch (action) {
6433 	case HDA_FIXUP_ACT_PRE_PROBE:
6434 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6435 		spec->gen.preferred_dacs = preferred_pairs;
6436 		break;
6437 	case HDA_FIXUP_ACT_BUILD:
6438 		/* The generic parser creates somewhat unintuitive volume ctls
6439 		 * with the fixed routing above, and the shared DAC2 may be
6440 		 * confusing for PA.
6441 		 * Rename those to unique names so that PA doesn't touch them
6442 		 * and use only Master volume.
6443 		 */
6444 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6445 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6446 		break;
6447 	}
6448 }
6449 
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6450 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6451 					 const struct hda_fixup *fix,
6452 					 int action)
6453 {
6454 	alc_fixup_dual_codecs(codec, fix, action);
6455 	switch (action) {
6456 	case HDA_FIXUP_ACT_PRE_PROBE:
6457 		/* override card longname to provide a unique UCM profile */
6458 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6459 		break;
6460 	case HDA_FIXUP_ACT_BUILD:
6461 		/* rename Capture controls depending on the codec */
6462 		rename_ctl(codec, "Capture Volume",
6463 			   codec->addr == 0 ?
6464 			   "Rear-Panel Capture Volume" :
6465 			   "Front-Panel Capture Volume");
6466 		rename_ctl(codec, "Capture Switch",
6467 			   codec->addr == 0 ?
6468 			   "Rear-Panel Capture Switch" :
6469 			   "Front-Panel Capture Switch");
6470 		break;
6471 	}
6472 }
6473 
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6474 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6475 				      const struct hda_fixup *fix, int action)
6476 {
6477 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6478 		return;
6479 
6480 	codec->power_save_node = 1;
6481 }
6482 
6483 /* 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)6484 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6485 				    const struct hda_fixup *fix, int action)
6486 {
6487 	struct alc_spec *spec = codec->spec;
6488 	static const hda_nid_t preferred_pairs[] = {
6489 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6490 		0
6491 	};
6492 
6493 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6494 		return;
6495 
6496 	spec->gen.preferred_dacs = preferred_pairs;
6497 	spec->gen.auto_mute_via_amp = 1;
6498 	codec->power_save_node = 0;
6499 }
6500 
6501 /* 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)6502 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6503 				    const struct hda_fixup *fix, int action)
6504 {
6505 	static const hda_nid_t preferred_pairs[] = {
6506 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6507 	};
6508 	struct alc_spec *spec = codec->spec;
6509 
6510 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6511 		spec->gen.preferred_dacs = preferred_pairs;
6512 		spec->gen.obey_preferred_dacs = 1;
6513 	}
6514 }
6515 
6516 /* 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)6517 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6518 			      const struct hda_fixup *fix, int action)
6519 {
6520 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6521 		return;
6522 
6523 	snd_hda_override_wcaps(codec, 0x03, 0);
6524 }
6525 
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6526 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6527 {
6528 	switch (codec->core.vendor_id) {
6529 	case 0x10ec0274:
6530 	case 0x10ec0294:
6531 	case 0x10ec0225:
6532 	case 0x10ec0295:
6533 	case 0x10ec0299:
6534 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6535 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6536 		break;
6537 	case 0x10ec0230:
6538 	case 0x10ec0235:
6539 	case 0x10ec0236:
6540 	case 0x10ec0255:
6541 	case 0x10ec0256:
6542 	case 0x10ec0257:
6543 	case 0x19e58326:
6544 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6545 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6546 		break;
6547 	}
6548 }
6549 
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6550 static void alc295_fixup_chromebook(struct hda_codec *codec,
6551 				    const struct hda_fixup *fix, int action)
6552 {
6553 	struct alc_spec *spec = codec->spec;
6554 
6555 	switch (action) {
6556 	case HDA_FIXUP_ACT_PRE_PROBE:
6557 		spec->ultra_low_power = true;
6558 		break;
6559 	case HDA_FIXUP_ACT_INIT:
6560 		alc_combo_jack_hp_jd_restart(codec);
6561 		break;
6562 	}
6563 }
6564 
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6565 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6566 				  const struct hda_fixup *fix, int action)
6567 {
6568 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6569 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6570 }
6571 
6572 
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6573 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6574 					struct hda_jack_callback *cb)
6575 {
6576 	/* The Windows driver sets the codec up in a very different way where
6577 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6578 	 */
6579 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6580 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6581 	else
6582 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6583 }
6584 
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6585 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6586 					const struct hda_fixup *fix, int action)
6587 {
6588 	/* Pin 0x21: headphones/headset mic */
6589 	if (!is_jack_detectable(codec, 0x21))
6590 		return;
6591 
6592 	switch (action) {
6593 	case HDA_FIXUP_ACT_PRE_PROBE:
6594 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6595 				alc294_gx502_toggle_output);
6596 		break;
6597 	case HDA_FIXUP_ACT_INIT:
6598 		/* Make sure to start in a correct state, i.e. if
6599 		 * headphones have been plugged in before powering up the system
6600 		 */
6601 		alc294_gx502_toggle_output(codec, NULL);
6602 		break;
6603 	}
6604 }
6605 
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6606 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6607 				       struct hda_jack_callback *cb)
6608 {
6609 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6610 	 * responsible from changes between speakers and headphones
6611 	 */
6612 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6613 		alc_write_coef_idx(codec, 0x10, 0x8420);
6614 	else
6615 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6616 }
6617 
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6618 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6619 				  const struct hda_fixup *fix, int action)
6620 {
6621 	if (!is_jack_detectable(codec, 0x21))
6622 		return;
6623 
6624 	switch (action) {
6625 	case HDA_FIXUP_ACT_PRE_PROBE:
6626 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6627 				alc294_gu502_toggle_output);
6628 		break;
6629 	case HDA_FIXUP_ACT_INIT:
6630 		alc294_gu502_toggle_output(codec, NULL);
6631 		break;
6632 	}
6633 }
6634 
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6635 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6636 			      const struct hda_fixup *fix, int action)
6637 {
6638 	if (action != HDA_FIXUP_ACT_INIT)
6639 		return;
6640 
6641 	msleep(100);
6642 	alc_write_coef_idx(codec, 0x65, 0x0);
6643 }
6644 
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6645 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6646 				    const struct hda_fixup *fix, int action)
6647 {
6648 	switch (action) {
6649 	case HDA_FIXUP_ACT_INIT:
6650 		alc_combo_jack_hp_jd_restart(codec);
6651 		break;
6652 	}
6653 }
6654 
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6655 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6656 				    const struct hda_fixup *fix, int action)
6657 {
6658 	struct alc_spec *spec = codec->spec;
6659 
6660 	switch (action) {
6661 	case HDA_FIXUP_ACT_PRE_PROBE:
6662 		/* Mic RING SLEEVE swap for combo jack */
6663 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6664 		spec->no_internal_mic_pin = true;
6665 		break;
6666 	case HDA_FIXUP_ACT_INIT:
6667 		alc_combo_jack_hp_jd_restart(codec);
6668 		break;
6669 	}
6670 }
6671 
6672 /* GPIO1 = amplifier on/off
6673  * GPIO3 = mic mute LED
6674  */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6675 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6676 					  const struct hda_fixup *fix, int action)
6677 {
6678 	static const hda_nid_t conn[] = { 0x02 };
6679 
6680 	struct alc_spec *spec = codec->spec;
6681 	static const struct hda_pintbl pincfgs[] = {
6682 		{ 0x14, 0x90170110 },  /* front/high speakers */
6683 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6684 		{ }
6685 	};
6686 
6687 	//enable micmute led
6688 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6689 
6690 	switch (action) {
6691 	case HDA_FIXUP_ACT_PRE_PROBE:
6692 		spec->micmute_led_polarity = 1;
6693 		/* needed for amp of back speakers */
6694 		spec->gpio_mask |= 0x01;
6695 		spec->gpio_dir |= 0x01;
6696 		snd_hda_apply_pincfgs(codec, pincfgs);
6697 		/* share DAC to have unified volume control */
6698 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6699 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6700 		break;
6701 	case HDA_FIXUP_ACT_INIT:
6702 		/* need to toggle GPIO to enable the amp of back speakers */
6703 		alc_update_gpio_data(codec, 0x01, true);
6704 		msleep(100);
6705 		alc_update_gpio_data(codec, 0x01, false);
6706 		break;
6707 	}
6708 }
6709 
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6710 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6711 					  const struct hda_fixup *fix, int action)
6712 {
6713 	static const hda_nid_t conn[] = { 0x02 };
6714 	static const struct hda_pintbl pincfgs[] = {
6715 		{ 0x14, 0x90170110 },  /* rear speaker */
6716 		{ }
6717 	};
6718 
6719 	switch (action) {
6720 	case HDA_FIXUP_ACT_PRE_PROBE:
6721 		snd_hda_apply_pincfgs(codec, pincfgs);
6722 		/* force front speaker to DAC1 */
6723 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6724 		break;
6725 	}
6726 }
6727 
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6728 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6729 				      const struct hda_fixup *fix,
6730 				      int action)
6731 {
6732 	static const struct coef_fw coefs[] = {
6733 		WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6734 		WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6735 		WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6736 		WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6737 		WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6738 		WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6739 		WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6740 		WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6741 		WRITE_COEF(0x6e, 0x1005), { }
6742 	};
6743 
6744 	static const struct hda_pintbl pincfgs[] = {
6745 		{ 0x12, 0xb7a60130 },  /* Internal microphone*/
6746 		{ 0x14, 0x90170150 },  /* B&O soundbar speakers */
6747 		{ 0x17, 0x90170153 },  /* Side speakers */
6748 		{ 0x19, 0x03a11040 },  /* Headset microphone */
6749 		{ }
6750 	};
6751 
6752 	switch (action) {
6753 	case HDA_FIXUP_ACT_PRE_PROBE:
6754 		snd_hda_apply_pincfgs(codec, pincfgs);
6755 
6756 		/* Fixes volume control problem for side speakers */
6757 		alc295_fixup_disable_dac3(codec, fix, action);
6758 
6759 		/* Fixes no sound from headset speaker */
6760 		snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
6761 
6762 		/* Auto-enable headset mic when plugged */
6763 		snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
6764 
6765 		/* Headset mic volume enhancement */
6766 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
6767 		break;
6768 	case HDA_FIXUP_ACT_INIT:
6769 		alc_process_coef_fw(codec, coefs);
6770 		break;
6771 	case HDA_FIXUP_ACT_BUILD:
6772 		rename_ctl(codec, "Bass Speaker Playback Volume",
6773 			   "B&O-Tuned Playback Volume");
6774 		rename_ctl(codec, "Front Playback Switch",
6775 			   "B&O Soundbar Playback Switch");
6776 		rename_ctl(codec, "Bass Speaker Playback Switch",
6777 			   "Side Speaker Playback Switch");
6778 		break;
6779 	}
6780 }
6781 
6782 /* for hda_fixup_thinkpad_acpi() */
6783 #include "thinkpad_helper.c"
6784 
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)6785 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6786 				    const struct hda_fixup *fix, int action)
6787 {
6788 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6789 	hda_fixup_thinkpad_acpi(codec, fix, action);
6790 }
6791 
6792 /* 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)6793 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6794 						  const struct hda_fixup *fix,
6795 						  int action)
6796 {
6797 	struct alc_spec *spec = codec->spec;
6798 
6799 	switch (action) {
6800 	case HDA_FIXUP_ACT_PRE_PROBE:
6801 		spec->gen.suppress_auto_mute = 1;
6802 		break;
6803 	}
6804 }
6805 
comp_bind(struct device * dev)6806 static int comp_bind(struct device *dev)
6807 {
6808 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6809 	struct alc_spec *spec = cdc->spec;
6810 
6811 	return component_bind_all(dev, spec->comps);
6812 }
6813 
comp_unbind(struct device * dev)6814 static void comp_unbind(struct device *dev)
6815 {
6816 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6817 	struct alc_spec *spec = cdc->spec;
6818 
6819 	component_unbind_all(dev, spec->comps);
6820 }
6821 
6822 static const struct component_master_ops comp_master_ops = {
6823 	.bind = comp_bind,
6824 	.unbind = comp_unbind,
6825 };
6826 
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)6827 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6828 				       struct snd_pcm_substream *sub, int action)
6829 {
6830 	struct alc_spec *spec = cdc->spec;
6831 	int i;
6832 
6833 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6834 		if (spec->comps[i].dev && spec->comps[i].pre_playback_hook)
6835 			spec->comps[i].pre_playback_hook(spec->comps[i].dev, action);
6836 	}
6837 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6838 		if (spec->comps[i].dev && spec->comps[i].playback_hook)
6839 			spec->comps[i].playback_hook(spec->comps[i].dev, action);
6840 	}
6841 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6842 		if (spec->comps[i].dev && spec->comps[i].post_playback_hook)
6843 			spec->comps[i].post_playback_hook(spec->comps[i].dev, action);
6844 	}
6845 }
6846 
6847 struct scodec_dev_name {
6848 	const char *bus;
6849 	const char *hid;
6850 	int index;
6851 };
6852 
6853 /* match the device name in a slightly relaxed manner */
comp_match_cs35l41_dev_name(struct device * dev,void * data)6854 static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
6855 {
6856 	struct scodec_dev_name *p = data;
6857 	const char *d = dev_name(dev);
6858 	int n = strlen(p->bus);
6859 	char tmp[32];
6860 
6861 	/* check the bus name */
6862 	if (strncmp(d, p->bus, n))
6863 		return 0;
6864 	/* skip the bus number */
6865 	if (isdigit(d[n]))
6866 		n++;
6867 	/* the rest must be exact matching */
6868 	snprintf(tmp, sizeof(tmp), "-%s:00-cs35l41-hda.%d", p->hid, p->index);
6869 	return !strcmp(d + n, tmp);
6870 }
6871 
comp_match_tas2781_dev_name(struct device * dev,void * data)6872 static int comp_match_tas2781_dev_name(struct device *dev,
6873 	void *data)
6874 {
6875 	struct scodec_dev_name *p = data;
6876 	const char *d = dev_name(dev);
6877 	int n = strlen(p->bus);
6878 	char tmp[32];
6879 
6880 	/* check the bus name */
6881 	if (strncmp(d, p->bus, n))
6882 		return 0;
6883 	/* skip the bus number */
6884 	if (isdigit(d[n]))
6885 		n++;
6886 	/* the rest must be exact matching */
6887 	snprintf(tmp, sizeof(tmp), "-%s:00", p->hid);
6888 
6889 	return !strcmp(d + n, tmp);
6890 }
6891 
cs35l41_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,int count)6892 static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6893 				  const char *hid, int count)
6894 {
6895 	struct device *dev = hda_codec_dev(cdc);
6896 	struct alc_spec *spec = cdc->spec;
6897 	struct scodec_dev_name *rec;
6898 	int ret, i;
6899 
6900 	switch (action) {
6901 	case HDA_FIXUP_ACT_PRE_PROBE:
6902 		for (i = 0; i < count; i++) {
6903 			rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6904 			if (!rec)
6905 				return;
6906 			rec->bus = bus;
6907 			rec->hid = hid;
6908 			rec->index = i;
6909 			spec->comps[i].codec = cdc;
6910 			component_match_add(dev, &spec->match,
6911 					    comp_match_cs35l41_dev_name, rec);
6912 		}
6913 		ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6914 		if (ret)
6915 			codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6916 		else
6917 			spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6918 		break;
6919 	case HDA_FIXUP_ACT_FREE:
6920 		component_master_del(dev, &comp_master_ops);
6921 		break;
6922 	}
6923 }
6924 
tas2781_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid)6925 static void tas2781_generic_fixup(struct hda_codec *cdc, int action,
6926 	const char *bus, const char *hid)
6927 {
6928 	struct device *dev = hda_codec_dev(cdc);
6929 	struct alc_spec *spec = cdc->spec;
6930 	struct scodec_dev_name *rec;
6931 	int ret;
6932 
6933 	switch (action) {
6934 	case HDA_FIXUP_ACT_PRE_PROBE:
6935 		rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6936 		if (!rec)
6937 			return;
6938 		rec->bus = bus;
6939 		rec->hid = hid;
6940 		rec->index = 0;
6941 		spec->comps[0].codec = cdc;
6942 		component_match_add(dev, &spec->match,
6943 			comp_match_tas2781_dev_name, rec);
6944 		ret = component_master_add_with_match(dev, &comp_master_ops,
6945 			spec->match);
6946 		if (ret)
6947 			codec_err(cdc,
6948 				"Fail to register component aggregator %d\n",
6949 				ret);
6950 		else
6951 			spec->gen.pcm_playback_hook =
6952 				comp_generic_playback_hook;
6953 		break;
6954 	case HDA_FIXUP_ACT_FREE:
6955 		component_master_del(dev, &comp_master_ops);
6956 		break;
6957 	}
6958 }
6959 
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6960 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6961 {
6962 	cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6963 }
6964 
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)6965 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6966 {
6967 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2);
6968 }
6969 
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)6970 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6971 {
6972 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4);
6973 }
6974 
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6975 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6976 						 int action)
6977 {
6978 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
6979 }
6980 
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6981 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6982 						 int action)
6983 {
6984 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0101", 2);
6985 }
6986 
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6987 static void tas2781_fixup_i2c(struct hda_codec *cdc,
6988 	const struct hda_fixup *fix, int action)
6989 {
6990 	 tas2781_generic_fixup(cdc, action, "i2c", "TIAS2781");
6991 }
6992 
6993 /* for alc295_fixup_hp_top_speakers */
6994 #include "hp_x360_helper.c"
6995 
6996 /* for alc285_fixup_ideapad_s740_coef() */
6997 #include "ideapad_s740_helper.c"
6998 
6999 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
7000 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
7001 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
7002 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
7003 	{}
7004 };
7005 
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)7006 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
7007 					   const struct hda_fixup *fix,
7008 					   int action)
7009 {
7010 	/*
7011 	 * A certain other OS sets these coeffs to different values. On at least
7012 	 * one TongFang barebone these settings might survive even a cold
7013 	 * reboot. So to restore a clean slate the values are explicitly reset
7014 	 * to default here. Without this, the external microphone is always in a
7015 	 * plugged-in state, while the internal microphone is always in an
7016 	 * unplugged state, breaking the ability to use the internal microphone.
7017 	 */
7018 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7019 }
7020 
7021 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7022 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7023 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7024 	WRITE_COEF(0x49, 0x0149),
7025 	{}
7026 };
7027 
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7028 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7029 				       const struct hda_fixup *fix,
7030 				       int action)
7031 {
7032 	/*
7033 	 * The audio jack input and output is not detected on the ASRock NUC Box
7034 	 * 1100 series when cold booting without this fix. Warm rebooting from a
7035 	 * certain other OS makes the audio functional, as COEF settings are
7036 	 * preserved in this case. This fix sets these altered COEF values as
7037 	 * the default.
7038 	 */
7039 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7040 }
7041 
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7042 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7043 						    const struct hda_fixup *fix,
7044 						    int action)
7045 {
7046 	/*
7047 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7048 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7049 	 * needs an additional quirk for sound working after suspend and resume.
7050 	 */
7051 	if (codec->core.vendor_id == 0x10ec0256) {
7052 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7053 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7054 	} else {
7055 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7056 	}
7057 }
7058 
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7059 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7060 						  const struct hda_fixup *fix,
7061 						  int action)
7062 {
7063 	struct alc_spec *spec = codec->spec;
7064 	struct hda_input_mux *imux = &spec->gen.input_mux;
7065 	int i;
7066 
7067 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
7068 
7069 	switch (action) {
7070 	case HDA_FIXUP_ACT_PRE_PROBE:
7071 		/**
7072 		 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7073 		 * to Hi-Z to avoid pop noises at startup and when plugging and
7074 		 * unplugging headphones.
7075 		 */
7076 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7077 		snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7078 		break;
7079 	case HDA_FIXUP_ACT_PROBE:
7080 		/**
7081 		 * Make the internal mic (0x12) the default input source to
7082 		 * prevent pop noises on cold boot.
7083 		 */
7084 		for (i = 0; i < imux->num_items; i++) {
7085 			if (spec->gen.imux_pins[i] == 0x12) {
7086 				spec->gen.cur_mux[0] = i;
7087 				break;
7088 			}
7089 		}
7090 		break;
7091 	}
7092 }
7093 
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7094 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7095 					  const struct hda_fixup *fix, int action)
7096 {
7097 	/*
7098 	 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7099 	 * unconnected.
7100 	 */
7101 	static const struct hda_pintbl pincfgs[] = {
7102 		{ 0x17, 0x90170121 },
7103 		{ }
7104 	};
7105 	/*
7106 	 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7107 	 * DAC 0x02 and 0x03 would be fine.
7108 	 */
7109 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7110 	/*
7111 	 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7112 	 * Headphones (0x21) are connected to DAC 0x03.
7113 	 */
7114 	static const hda_nid_t preferred_pairs[] = {
7115 		0x14, 0x02,
7116 		0x17, 0x02,
7117 		0x21, 0x03,
7118 		0
7119 	};
7120 	struct alc_spec *spec = codec->spec;
7121 
7122 	switch (action) {
7123 	case HDA_FIXUP_ACT_PRE_PROBE:
7124 		snd_hda_apply_pincfgs(codec, pincfgs);
7125 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7126 		spec->gen.preferred_dacs = preferred_pairs;
7127 		break;
7128 	}
7129 }
7130 
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7131 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7132 					  const struct hda_fixup *fix, int action)
7133 {
7134 	static const struct hda_pintbl pincfgs[] = {
7135 		{ 0x14, 0x90170151 },
7136 		{ 0x17, 0x90170150 },
7137 		{ }
7138 	};
7139 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7140 	static const hda_nid_t preferred_pairs[] = {
7141 		0x14, 0x02,
7142 		0x17, 0x03,
7143 		0x21, 0x02,
7144 		0
7145 	};
7146 	struct alc_spec *spec = codec->spec;
7147 
7148 	alc_fixup_no_shutup(codec, fix, action);
7149 
7150 	switch (action) {
7151 	case HDA_FIXUP_ACT_PRE_PROBE:
7152 		snd_hda_apply_pincfgs(codec, pincfgs);
7153 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7154 		spec->gen.preferred_dacs = preferred_pairs;
7155 		break;
7156 	}
7157 }
7158 
7159 /* 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)7160 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7161 				    const struct hda_fixup *fix, int action)
7162 {
7163 	struct alc_spec *spec = codec->spec;
7164 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7165 	static const hda_nid_t preferred_pairs[] = {
7166 		0x17, 0x02, 0x21, 0x03, 0
7167 	};
7168 
7169 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7170 		return;
7171 
7172 	snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7173 	spec->gen.preferred_dacs = preferred_pairs;
7174 	spec->gen.auto_mute_via_amp = 1;
7175 	if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7176 		snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7177 					0x0); /* Make sure 0x14 was disable */
7178 	}
7179 }
7180 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7181 static void alc_fixup_headset_mic(struct hda_codec *codec,
7182 				   const struct hda_fixup *fix, int action)
7183 {
7184 	struct alc_spec *spec = codec->spec;
7185 	static const struct hda_pintbl pincfgs[] = {
7186 		{ 0x19, 0x03a1103c },
7187 		{ }
7188 	};
7189 
7190 	switch (action) {
7191 	case HDA_FIXUP_ACT_PRE_PROBE:
7192 		snd_hda_apply_pincfgs(codec, pincfgs);
7193 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7194 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7195 		break;
7196 	}
7197 }
7198 
7199 
7200 enum {
7201 	ALC269_FIXUP_GPIO2,
7202 	ALC269_FIXUP_SONY_VAIO,
7203 	ALC275_FIXUP_SONY_VAIO_GPIO2,
7204 	ALC269_FIXUP_DELL_M101Z,
7205 	ALC269_FIXUP_SKU_IGNORE,
7206 	ALC269_FIXUP_ASUS_G73JW,
7207 	ALC269_FIXUP_ASUS_N7601ZM_PINS,
7208 	ALC269_FIXUP_ASUS_N7601ZM,
7209 	ALC269_FIXUP_LENOVO_EAPD,
7210 	ALC275_FIXUP_SONY_HWEQ,
7211 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
7212 	ALC271_FIXUP_DMIC,
7213 	ALC269_FIXUP_PCM_44K,
7214 	ALC269_FIXUP_STEREO_DMIC,
7215 	ALC269_FIXUP_HEADSET_MIC,
7216 	ALC269_FIXUP_QUANTA_MUTE,
7217 	ALC269_FIXUP_LIFEBOOK,
7218 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
7219 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
7220 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7221 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7222 	ALC269_FIXUP_AMIC,
7223 	ALC269_FIXUP_DMIC,
7224 	ALC269VB_FIXUP_AMIC,
7225 	ALC269VB_FIXUP_DMIC,
7226 	ALC269_FIXUP_HP_MUTE_LED,
7227 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
7228 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
7229 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
7230 	ALC269_FIXUP_HP_GPIO_LED,
7231 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
7232 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
7233 	ALC269_FIXUP_INV_DMIC,
7234 	ALC269_FIXUP_LENOVO_DOCK,
7235 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7236 	ALC269_FIXUP_NO_SHUTUP,
7237 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7238 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7239 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7240 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7241 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7242 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7243 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7244 	ALC269_FIXUP_HEADSET_MODE,
7245 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7246 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7247 	ALC269_FIXUP_ASUS_X101_FUNC,
7248 	ALC269_FIXUP_ASUS_X101_VERB,
7249 	ALC269_FIXUP_ASUS_X101,
7250 	ALC271_FIXUP_AMIC_MIC2,
7251 	ALC271_FIXUP_HP_GATE_MIC_JACK,
7252 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7253 	ALC269_FIXUP_ACER_AC700,
7254 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7255 	ALC269VB_FIXUP_ASUS_ZENBOOK,
7256 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7257 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7258 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7259 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
7260 	ALC283_FIXUP_CHROME_BOOK,
7261 	ALC283_FIXUP_SENSE_COMBO_JACK,
7262 	ALC282_FIXUP_ASUS_TX300,
7263 	ALC283_FIXUP_INT_MIC,
7264 	ALC290_FIXUP_MONO_SPEAKERS,
7265 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7266 	ALC290_FIXUP_SUBWOOFER,
7267 	ALC290_FIXUP_SUBWOOFER_HSJACK,
7268 	ALC269_FIXUP_THINKPAD_ACPI,
7269 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7270 	ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7271 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7272 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7273 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7274 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7275 	ALC255_FIXUP_HEADSET_MODE,
7276 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7277 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7278 	ALC292_FIXUP_TPT440_DOCK,
7279 	ALC292_FIXUP_TPT440,
7280 	ALC283_FIXUP_HEADSET_MIC,
7281 	ALC255_FIXUP_MIC_MUTE_LED,
7282 	ALC282_FIXUP_ASPIRE_V5_PINS,
7283 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
7284 	ALC280_FIXUP_HP_GPIO4,
7285 	ALC286_FIXUP_HP_GPIO_LED,
7286 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7287 	ALC280_FIXUP_HP_DOCK_PINS,
7288 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7289 	ALC280_FIXUP_HP_9480M,
7290 	ALC245_FIXUP_HP_X360_AMP,
7291 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7292 	ALC285_FIXUP_HP_ENVY_X360,
7293 	ALC288_FIXUP_DELL_HEADSET_MODE,
7294 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7295 	ALC288_FIXUP_DELL_XPS_13,
7296 	ALC288_FIXUP_DISABLE_AAMIX,
7297 	ALC292_FIXUP_DELL_E7X_AAMIX,
7298 	ALC292_FIXUP_DELL_E7X,
7299 	ALC292_FIXUP_DISABLE_AAMIX,
7300 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7301 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7302 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7303 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7304 	ALC275_FIXUP_DELL_XPS,
7305 	ALC293_FIXUP_LENOVO_SPK_NOISE,
7306 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7307 	ALC255_FIXUP_DELL_SPK_NOISE,
7308 	ALC225_FIXUP_DISABLE_MIC_VREF,
7309 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7310 	ALC295_FIXUP_DISABLE_DAC3,
7311 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
7312 	ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7313 	ALC285_FIXUP_ASUS_HEADSET_MIC,
7314 	ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7315 	ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7316 	ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7317 	ALC280_FIXUP_HP_HEADSET_MIC,
7318 	ALC221_FIXUP_HP_FRONT_MIC,
7319 	ALC292_FIXUP_TPT460,
7320 	ALC298_FIXUP_SPK_VOLUME,
7321 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
7322 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7323 	ALC269_FIXUP_ATIV_BOOK_8,
7324 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7325 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7326 	ALC256_FIXUP_ASUS_HEADSET_MODE,
7327 	ALC256_FIXUP_ASUS_MIC,
7328 	ALC256_FIXUP_ASUS_AIO_GPIO2,
7329 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7330 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7331 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
7332 	ALC233_FIXUP_ACER_HEADSET_MIC,
7333 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
7334 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7335 	ALC225_FIXUP_S3_POP_NOISE,
7336 	ALC700_FIXUP_INTEL_REFERENCE,
7337 	ALC274_FIXUP_DELL_BIND_DACS,
7338 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7339 	ALC298_FIXUP_TPT470_DOCK_FIX,
7340 	ALC298_FIXUP_TPT470_DOCK,
7341 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7342 	ALC255_FIXUP_DELL_HEADSET_MIC,
7343 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7344 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
7345 	ALC295_FIXUP_HP_X360,
7346 	ALC221_FIXUP_HP_HEADSET_MIC,
7347 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7348 	ALC295_FIXUP_HP_AUTO_MUTE,
7349 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7350 	ALC294_FIXUP_ASUS_MIC,
7351 	ALC294_FIXUP_ASUS_HEADSET_MIC,
7352 	ALC294_FIXUP_ASUS_SPK,
7353 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7354 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7355 	ALC255_FIXUP_ACER_HEADSET_MIC,
7356 	ALC295_FIXUP_CHROME_BOOK,
7357 	ALC225_FIXUP_HEADSET_JACK,
7358 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7359 	ALC225_FIXUP_WYSE_AUTO_MUTE,
7360 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7361 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7362 	ALC256_FIXUP_ASUS_HEADSET_MIC,
7363 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7364 	ALC299_FIXUP_PREDATOR_SPK,
7365 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7366 	ALC289_FIXUP_DELL_SPK1,
7367 	ALC289_FIXUP_DELL_SPK2,
7368 	ALC289_FIXUP_DUAL_SPK,
7369 	ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7370 	ALC294_FIXUP_SPK2_TO_DAC1,
7371 	ALC294_FIXUP_ASUS_DUAL_SPK,
7372 	ALC285_FIXUP_THINKPAD_X1_GEN7,
7373 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7374 	ALC294_FIXUP_ASUS_ALLY,
7375 	ALC294_FIXUP_ASUS_ALLY_PINS,
7376 	ALC294_FIXUP_ASUS_ALLY_VERBS,
7377 	ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7378 	ALC294_FIXUP_ASUS_HPE,
7379 	ALC294_FIXUP_ASUS_COEF_1B,
7380 	ALC294_FIXUP_ASUS_GX502_HP,
7381 	ALC294_FIXUP_ASUS_GX502_PINS,
7382 	ALC294_FIXUP_ASUS_GX502_VERBS,
7383 	ALC294_FIXUP_ASUS_GU502_HP,
7384 	ALC294_FIXUP_ASUS_GU502_PINS,
7385 	ALC294_FIXUP_ASUS_GU502_VERBS,
7386 	ALC294_FIXUP_ASUS_G513_PINS,
7387 	ALC285_FIXUP_ASUS_G533Z_PINS,
7388 	ALC285_FIXUP_HP_GPIO_LED,
7389 	ALC285_FIXUP_HP_MUTE_LED,
7390 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7391 	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7392 	ALC236_FIXUP_HP_GPIO_LED,
7393 	ALC236_FIXUP_HP_MUTE_LED,
7394 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7395 	ALC236_FIXUP_LENOVO_INV_DMIC,
7396 	ALC298_FIXUP_SAMSUNG_AMP,
7397 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7398 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7399 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7400 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7401 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
7402 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7403 	ALC289_FIXUP_ASUS_GA401,
7404 	ALC289_FIXUP_ASUS_GA502,
7405 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7406 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
7407 	ALC269_FIXUP_CZC_B20,
7408 	ALC269_FIXUP_CZC_TMI,
7409 	ALC269_FIXUP_CZC_L101,
7410 	ALC269_FIXUP_LEMOTE_A1802,
7411 	ALC269_FIXUP_LEMOTE_A190X,
7412 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
7413 	ALC233_FIXUP_INTEL_NUC8_DMIC,
7414 	ALC233_FIXUP_INTEL_NUC8_BOOST,
7415 	ALC256_FIXUP_INTEL_NUC10,
7416 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7417 	ALC274_FIXUP_HP_MIC,
7418 	ALC274_FIXUP_HP_HEADSET_MIC,
7419 	ALC274_FIXUP_HP_ENVY_GPIO,
7420 	ALC256_FIXUP_ASUS_HPE,
7421 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7422 	ALC287_FIXUP_HP_GPIO_LED,
7423 	ALC256_FIXUP_HP_HEADSET_MIC,
7424 	ALC245_FIXUP_HP_GPIO_LED,
7425 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7426 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7427 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7428 	ALC256_FIXUP_ACER_HEADSET_MIC,
7429 	ALC285_FIXUP_IDEAPAD_S740_COEF,
7430 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7431 	ALC295_FIXUP_ASUS_DACS,
7432 	ALC295_FIXUP_HP_OMEN,
7433 	ALC285_FIXUP_HP_SPECTRE_X360,
7434 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7435 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7436 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7437 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7438 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7439 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7440 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7441 	ALC298_FIXUP_LENOVO_C940_DUET7,
7442 	ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
7443 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
7444 	ALC256_FIXUP_SET_COEF_DEFAULTS,
7445 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7446 	ALC233_FIXUP_NO_AUDIO_JACK,
7447 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7448 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7449 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7450 	ALC287_FIXUP_LEGION_16ACHG6,
7451 	ALC287_FIXUP_CS35L41_I2C_2,
7452 	ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7453 	ALC245_FIXUP_CS35L41_SPI_2,
7454 	ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7455 	ALC245_FIXUP_CS35L41_SPI_4,
7456 	ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7457 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7458 	ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7459 	ALC287_FIXUP_LEGION_16ITHG6,
7460 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7461 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7462 	ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7463 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7464 	ALC236_FIXUP_DELL_DUAL_CODECS,
7465 	ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7466 	ALC287_FIXUP_TAS2781_I2C,
7467 	ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7468 	ALC245_FIXUP_HP_X360_MUTE_LEDS,
7469 	ALC287_FIXUP_THINKPAD_I2S_SPK,
7470 	ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7471 	ALC2XX_FIXUP_HEADSET_MIC,
7472 	ALC289_FIXUP_DELL_CS35L41_SPI_2,
7473 	ALC294_FIXUP_CS35L41_I2C_2,
7474 };
7475 
7476 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7477  * both have the very same PCI SSID, and we need to apply different fixups
7478  * depending on the codec ID
7479  */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)7480 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7481 					   const struct hda_fixup *fix,
7482 					   int action)
7483 {
7484 	int id;
7485 
7486 	if (codec->core.vendor_id == 0x10ec0298)
7487 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7488 	else
7489 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7490 	__snd_hda_apply_fixup(codec, id, action, 0);
7491 }
7492 
7493 /* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
7494  * 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
7495  * so we need to apply a different fixup in this case. The only DuetITL codec
7496  * SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
7497  * and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
7498  * have matched correctly by their codecs.
7499  */
alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec * codec,const struct hda_fixup * fix,int action)7500 static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
7501 					      const struct hda_fixup *fix,
7502 					      int action)
7503 {
7504 	int id;
7505 
7506 	if (codec->core.subsystem_id == 0x17aa3802)
7507 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
7508 	else
7509 		id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
7510 	__snd_hda_apply_fixup(codec, id, action, 0);
7511 }
7512 
7513 static const struct hda_fixup alc269_fixups[] = {
7514 	[ALC269_FIXUP_GPIO2] = {
7515 		.type = HDA_FIXUP_FUNC,
7516 		.v.func = alc_fixup_gpio2,
7517 	},
7518 	[ALC269_FIXUP_SONY_VAIO] = {
7519 		.type = HDA_FIXUP_PINCTLS,
7520 		.v.pins = (const struct hda_pintbl[]) {
7521 			{0x19, PIN_VREFGRD},
7522 			{}
7523 		}
7524 	},
7525 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7526 		.type = HDA_FIXUP_FUNC,
7527 		.v.func = alc275_fixup_gpio4_off,
7528 		.chained = true,
7529 		.chain_id = ALC269_FIXUP_SONY_VAIO
7530 	},
7531 	[ALC269_FIXUP_DELL_M101Z] = {
7532 		.type = HDA_FIXUP_VERBS,
7533 		.v.verbs = (const struct hda_verb[]) {
7534 			/* Enables internal speaker */
7535 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
7536 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7537 			{}
7538 		}
7539 	},
7540 	[ALC269_FIXUP_SKU_IGNORE] = {
7541 		.type = HDA_FIXUP_FUNC,
7542 		.v.func = alc_fixup_sku_ignore,
7543 	},
7544 	[ALC269_FIXUP_ASUS_G73JW] = {
7545 		.type = HDA_FIXUP_PINS,
7546 		.v.pins = (const struct hda_pintbl[]) {
7547 			{ 0x17, 0x99130111 }, /* subwoofer */
7548 			{ }
7549 		}
7550 	},
7551 	[ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7552 		.type = HDA_FIXUP_PINS,
7553 		.v.pins = (const struct hda_pintbl[]) {
7554 			{ 0x19, 0x03A11050 },
7555 			{ 0x1a, 0x03A11C30 },
7556 			{ 0x21, 0x03211420 },
7557 			{ }
7558 		}
7559 	},
7560 	[ALC269_FIXUP_ASUS_N7601ZM] = {
7561 		.type = HDA_FIXUP_VERBS,
7562 		.v.verbs = (const struct hda_verb[]) {
7563 			{0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7564 			{0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7565 			{0x20, AC_VERB_SET_COEF_INDEX, 0x10},
7566 			{0x20, AC_VERB_SET_PROC_COEF, 0x8420},
7567 			{0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
7568 			{0x20, AC_VERB_SET_PROC_COEF, 0x7774},
7569 			{ }
7570 		},
7571 		.chained = true,
7572 		.chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
7573 	},
7574 	[ALC269_FIXUP_LENOVO_EAPD] = {
7575 		.type = HDA_FIXUP_VERBS,
7576 		.v.verbs = (const struct hda_verb[]) {
7577 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7578 			{}
7579 		}
7580 	},
7581 	[ALC275_FIXUP_SONY_HWEQ] = {
7582 		.type = HDA_FIXUP_FUNC,
7583 		.v.func = alc269_fixup_hweq,
7584 		.chained = true,
7585 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7586 	},
7587 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7588 		.type = HDA_FIXUP_FUNC,
7589 		.v.func = alc_fixup_disable_aamix,
7590 		.chained = true,
7591 		.chain_id = ALC269_FIXUP_SONY_VAIO
7592 	},
7593 	[ALC271_FIXUP_DMIC] = {
7594 		.type = HDA_FIXUP_FUNC,
7595 		.v.func = alc271_fixup_dmic,
7596 	},
7597 	[ALC269_FIXUP_PCM_44K] = {
7598 		.type = HDA_FIXUP_FUNC,
7599 		.v.func = alc269_fixup_pcm_44k,
7600 		.chained = true,
7601 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7602 	},
7603 	[ALC269_FIXUP_STEREO_DMIC] = {
7604 		.type = HDA_FIXUP_FUNC,
7605 		.v.func = alc269_fixup_stereo_dmic,
7606 	},
7607 	[ALC269_FIXUP_HEADSET_MIC] = {
7608 		.type = HDA_FIXUP_FUNC,
7609 		.v.func = alc269_fixup_headset_mic,
7610 	},
7611 	[ALC269_FIXUP_QUANTA_MUTE] = {
7612 		.type = HDA_FIXUP_FUNC,
7613 		.v.func = alc269_fixup_quanta_mute,
7614 	},
7615 	[ALC269_FIXUP_LIFEBOOK] = {
7616 		.type = HDA_FIXUP_PINS,
7617 		.v.pins = (const struct hda_pintbl[]) {
7618 			{ 0x1a, 0x2101103f }, /* dock line-out */
7619 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
7620 			{ }
7621 		},
7622 		.chained = true,
7623 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7624 	},
7625 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7626 		.type = HDA_FIXUP_PINS,
7627 		.v.pins = (const struct hda_pintbl[]) {
7628 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7629 			{ }
7630 		},
7631 	},
7632 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7633 		.type = HDA_FIXUP_PINS,
7634 		.v.pins = (const struct hda_pintbl[]) {
7635 			{ 0x21, 0x0221102f }, /* HP out */
7636 			{ }
7637 		},
7638 	},
7639 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7640 		.type = HDA_FIXUP_FUNC,
7641 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7642 	},
7643 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7644 		.type = HDA_FIXUP_FUNC,
7645 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7646 	},
7647 	[ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
7648 		.type = HDA_FIXUP_PINS,
7649 		.v.pins = (const struct hda_pintbl[]) {
7650 			{ 0x18, 0x03a19020 }, /* headset mic */
7651 			{ 0x1b, 0x90170150 }, /* speaker */
7652 			{ }
7653 		},
7654 	},
7655 	[ALC269_FIXUP_AMIC] = {
7656 		.type = HDA_FIXUP_PINS,
7657 		.v.pins = (const struct hda_pintbl[]) {
7658 			{ 0x14, 0x99130110 }, /* speaker */
7659 			{ 0x15, 0x0121401f }, /* HP out */
7660 			{ 0x18, 0x01a19c20 }, /* mic */
7661 			{ 0x19, 0x99a3092f }, /* int-mic */
7662 			{ }
7663 		},
7664 	},
7665 	[ALC269_FIXUP_DMIC] = {
7666 		.type = HDA_FIXUP_PINS,
7667 		.v.pins = (const struct hda_pintbl[]) {
7668 			{ 0x12, 0x99a3092f }, /* int-mic */
7669 			{ 0x14, 0x99130110 }, /* speaker */
7670 			{ 0x15, 0x0121401f }, /* HP out */
7671 			{ 0x18, 0x01a19c20 }, /* mic */
7672 			{ }
7673 		},
7674 	},
7675 	[ALC269VB_FIXUP_AMIC] = {
7676 		.type = HDA_FIXUP_PINS,
7677 		.v.pins = (const struct hda_pintbl[]) {
7678 			{ 0x14, 0x99130110 }, /* speaker */
7679 			{ 0x18, 0x01a19c20 }, /* mic */
7680 			{ 0x19, 0x99a3092f }, /* int-mic */
7681 			{ 0x21, 0x0121401f }, /* HP out */
7682 			{ }
7683 		},
7684 	},
7685 	[ALC269VB_FIXUP_DMIC] = {
7686 		.type = HDA_FIXUP_PINS,
7687 		.v.pins = (const struct hda_pintbl[]) {
7688 			{ 0x12, 0x99a3092f }, /* int-mic */
7689 			{ 0x14, 0x99130110 }, /* speaker */
7690 			{ 0x18, 0x01a19c20 }, /* mic */
7691 			{ 0x21, 0x0121401f }, /* HP out */
7692 			{ }
7693 		},
7694 	},
7695 	[ALC269_FIXUP_HP_MUTE_LED] = {
7696 		.type = HDA_FIXUP_FUNC,
7697 		.v.func = alc269_fixup_hp_mute_led,
7698 	},
7699 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7700 		.type = HDA_FIXUP_FUNC,
7701 		.v.func = alc269_fixup_hp_mute_led_mic1,
7702 	},
7703 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7704 		.type = HDA_FIXUP_FUNC,
7705 		.v.func = alc269_fixup_hp_mute_led_mic2,
7706 	},
7707 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7708 		.type = HDA_FIXUP_FUNC,
7709 		.v.func = alc269_fixup_hp_mute_led_mic3,
7710 		.chained = true,
7711 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7712 	},
7713 	[ALC269_FIXUP_HP_GPIO_LED] = {
7714 		.type = HDA_FIXUP_FUNC,
7715 		.v.func = alc269_fixup_hp_gpio_led,
7716 	},
7717 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7718 		.type = HDA_FIXUP_FUNC,
7719 		.v.func = alc269_fixup_hp_gpio_mic1_led,
7720 	},
7721 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7722 		.type = HDA_FIXUP_FUNC,
7723 		.v.func = alc269_fixup_hp_line1_mic1_led,
7724 	},
7725 	[ALC269_FIXUP_INV_DMIC] = {
7726 		.type = HDA_FIXUP_FUNC,
7727 		.v.func = alc_fixup_inv_dmic,
7728 	},
7729 	[ALC269_FIXUP_NO_SHUTUP] = {
7730 		.type = HDA_FIXUP_FUNC,
7731 		.v.func = alc_fixup_no_shutup,
7732 	},
7733 	[ALC269_FIXUP_LENOVO_DOCK] = {
7734 		.type = HDA_FIXUP_PINS,
7735 		.v.pins = (const struct hda_pintbl[]) {
7736 			{ 0x19, 0x23a11040 }, /* dock mic */
7737 			{ 0x1b, 0x2121103f }, /* dock headphone */
7738 			{ }
7739 		},
7740 		.chained = true,
7741 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7742 	},
7743 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7744 		.type = HDA_FIXUP_FUNC,
7745 		.v.func = alc269_fixup_limit_int_mic_boost,
7746 		.chained = true,
7747 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
7748 	},
7749 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7750 		.type = HDA_FIXUP_FUNC,
7751 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7752 		.chained = true,
7753 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7754 	},
7755 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7756 		.type = HDA_FIXUP_PINS,
7757 		.v.pins = (const struct hda_pintbl[]) {
7758 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7759 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7760 			{ }
7761 		},
7762 		.chained = true,
7763 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7764 	},
7765 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7766 		.type = HDA_FIXUP_PINS,
7767 		.v.pins = (const struct hda_pintbl[]) {
7768 			{ 0x16, 0x21014020 }, /* dock line out */
7769 			{ 0x19, 0x21a19030 }, /* dock mic */
7770 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7771 			{ }
7772 		},
7773 		.chained = true,
7774 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7775 	},
7776 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7777 		.type = HDA_FIXUP_PINS,
7778 		.v.pins = (const struct hda_pintbl[]) {
7779 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7780 			{ }
7781 		},
7782 		.chained = true,
7783 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7784 	},
7785 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7786 		.type = HDA_FIXUP_PINS,
7787 		.v.pins = (const struct hda_pintbl[]) {
7788 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7789 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7790 			{ }
7791 		},
7792 		.chained = true,
7793 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7794 	},
7795 	[ALC269_FIXUP_HEADSET_MODE] = {
7796 		.type = HDA_FIXUP_FUNC,
7797 		.v.func = alc_fixup_headset_mode,
7798 		.chained = true,
7799 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7800 	},
7801 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7802 		.type = HDA_FIXUP_FUNC,
7803 		.v.func = alc_fixup_headset_mode_no_hp_mic,
7804 	},
7805 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7806 		.type = HDA_FIXUP_PINS,
7807 		.v.pins = (const struct hda_pintbl[]) {
7808 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7809 			{ }
7810 		},
7811 		.chained = true,
7812 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
7813 	},
7814 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7815 		.type = HDA_FIXUP_PINS,
7816 		.v.pins = (const struct hda_pintbl[]) {
7817 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7818 			{ }
7819 		},
7820 		.chained = true,
7821 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7822 	},
7823 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7824 		.type = HDA_FIXUP_PINS,
7825 		.v.pins = (const struct hda_pintbl[]) {
7826 			{0x12, 0x90a60130},
7827 			{0x13, 0x40000000},
7828 			{0x14, 0x90170110},
7829 			{0x18, 0x411111f0},
7830 			{0x19, 0x04a11040},
7831 			{0x1a, 0x411111f0},
7832 			{0x1b, 0x90170112},
7833 			{0x1d, 0x40759a05},
7834 			{0x1e, 0x411111f0},
7835 			{0x21, 0x04211020},
7836 			{ }
7837 		},
7838 		.chained = true,
7839 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7840 	},
7841 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7842 		.type = HDA_FIXUP_FUNC,
7843 		.v.func = alc298_fixup_huawei_mbx_stereo,
7844 		.chained = true,
7845 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7846 	},
7847 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
7848 		.type = HDA_FIXUP_FUNC,
7849 		.v.func = alc269_fixup_x101_headset_mic,
7850 	},
7851 	[ALC269_FIXUP_ASUS_X101_VERB] = {
7852 		.type = HDA_FIXUP_VERBS,
7853 		.v.verbs = (const struct hda_verb[]) {
7854 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7855 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7856 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
7857 			{ }
7858 		},
7859 		.chained = true,
7860 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7861 	},
7862 	[ALC269_FIXUP_ASUS_X101] = {
7863 		.type = HDA_FIXUP_PINS,
7864 		.v.pins = (const struct hda_pintbl[]) {
7865 			{ 0x18, 0x04a1182c }, /* Headset mic */
7866 			{ }
7867 		},
7868 		.chained = true,
7869 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
7870 	},
7871 	[ALC271_FIXUP_AMIC_MIC2] = {
7872 		.type = HDA_FIXUP_PINS,
7873 		.v.pins = (const struct hda_pintbl[]) {
7874 			{ 0x14, 0x99130110 }, /* speaker */
7875 			{ 0x19, 0x01a19c20 }, /* mic */
7876 			{ 0x1b, 0x99a7012f }, /* int-mic */
7877 			{ 0x21, 0x0121401f }, /* HP out */
7878 			{ }
7879 		},
7880 	},
7881 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7882 		.type = HDA_FIXUP_FUNC,
7883 		.v.func = alc271_hp_gate_mic_jack,
7884 		.chained = true,
7885 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
7886 	},
7887 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7888 		.type = HDA_FIXUP_FUNC,
7889 		.v.func = alc269_fixup_limit_int_mic_boost,
7890 		.chained = true,
7891 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7892 	},
7893 	[ALC269_FIXUP_ACER_AC700] = {
7894 		.type = HDA_FIXUP_PINS,
7895 		.v.pins = (const struct hda_pintbl[]) {
7896 			{ 0x12, 0x99a3092f }, /* int-mic */
7897 			{ 0x14, 0x99130110 }, /* speaker */
7898 			{ 0x18, 0x03a11c20 }, /* mic */
7899 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
7900 			{ 0x21, 0x0321101f }, /* HP out */
7901 			{ }
7902 		},
7903 		.chained = true,
7904 		.chain_id = ALC271_FIXUP_DMIC,
7905 	},
7906 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7907 		.type = HDA_FIXUP_FUNC,
7908 		.v.func = alc269_fixup_limit_int_mic_boost,
7909 		.chained = true,
7910 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7911 	},
7912 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7913 		.type = HDA_FIXUP_FUNC,
7914 		.v.func = alc269_fixup_limit_int_mic_boost,
7915 		.chained = true,
7916 		.chain_id = ALC269VB_FIXUP_DMIC,
7917 	},
7918 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7919 		.type = HDA_FIXUP_VERBS,
7920 		.v.verbs = (const struct hda_verb[]) {
7921 			/* class-D output amp +5dB */
7922 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7923 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7924 			{}
7925 		},
7926 		.chained = true,
7927 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7928 	},
7929 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7930 		.type = HDA_FIXUP_PINS,
7931 		.v.pins = (const struct hda_pintbl[]) {
7932 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
7933 			{ }
7934 		},
7935 		.chained = true,
7936 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7937 	},
7938 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7939 		.type = HDA_FIXUP_FUNC,
7940 		.v.func = alc269_fixup_limit_int_mic_boost,
7941 		.chained = true,
7942 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7943 	},
7944 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7945 		.type = HDA_FIXUP_PINS,
7946 		.v.pins = (const struct hda_pintbl[]) {
7947 			{ 0x12, 0x99a3092f }, /* int-mic */
7948 			{ 0x18, 0x03a11d20 }, /* mic */
7949 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
7950 			{ }
7951 		},
7952 	},
7953 	[ALC283_FIXUP_CHROME_BOOK] = {
7954 		.type = HDA_FIXUP_FUNC,
7955 		.v.func = alc283_fixup_chromebook,
7956 	},
7957 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
7958 		.type = HDA_FIXUP_FUNC,
7959 		.v.func = alc283_fixup_sense_combo_jack,
7960 		.chained = true,
7961 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
7962 	},
7963 	[ALC282_FIXUP_ASUS_TX300] = {
7964 		.type = HDA_FIXUP_FUNC,
7965 		.v.func = alc282_fixup_asus_tx300,
7966 	},
7967 	[ALC283_FIXUP_INT_MIC] = {
7968 		.type = HDA_FIXUP_VERBS,
7969 		.v.verbs = (const struct hda_verb[]) {
7970 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7971 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7972 			{ }
7973 		},
7974 		.chained = true,
7975 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7976 	},
7977 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7978 		.type = HDA_FIXUP_PINS,
7979 		.v.pins = (const struct hda_pintbl[]) {
7980 			{ 0x17, 0x90170112 }, /* subwoofer */
7981 			{ }
7982 		},
7983 		.chained = true,
7984 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7985 	},
7986 	[ALC290_FIXUP_SUBWOOFER] = {
7987 		.type = HDA_FIXUP_PINS,
7988 		.v.pins = (const struct hda_pintbl[]) {
7989 			{ 0x17, 0x90170112 }, /* subwoofer */
7990 			{ }
7991 		},
7992 		.chained = true,
7993 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7994 	},
7995 	[ALC290_FIXUP_MONO_SPEAKERS] = {
7996 		.type = HDA_FIXUP_FUNC,
7997 		.v.func = alc290_fixup_mono_speakers,
7998 	},
7999 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8000 		.type = HDA_FIXUP_FUNC,
8001 		.v.func = alc290_fixup_mono_speakers,
8002 		.chained = true,
8003 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8004 	},
8005 	[ALC269_FIXUP_THINKPAD_ACPI] = {
8006 		.type = HDA_FIXUP_FUNC,
8007 		.v.func = alc_fixup_thinkpad_acpi,
8008 		.chained = true,
8009 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
8010 	},
8011 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8012 		.type = HDA_FIXUP_FUNC,
8013 		.v.func = alc_fixup_inv_dmic,
8014 		.chained = true,
8015 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8016 	},
8017 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8018 		.type = HDA_FIXUP_PINS,
8019 		.v.pins = (const struct hda_pintbl[]) {
8020 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8021 			{ }
8022 		},
8023 		.chained = true,
8024 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8025 	},
8026 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8027 		.type = HDA_FIXUP_PINS,
8028 		.v.pins = (const struct hda_pintbl[]) {
8029 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8030 			{ }
8031 		},
8032 		.chained = true,
8033 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8034 	},
8035 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8036 		.type = HDA_FIXUP_PINS,
8037 		.v.pins = (const struct hda_pintbl[]) {
8038 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8039 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8040 			{ }
8041 		},
8042 		.chained = true,
8043 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8044 	},
8045 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8046 		.type = HDA_FIXUP_PINS,
8047 		.v.pins = (const struct hda_pintbl[]) {
8048 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8049 			{ }
8050 		},
8051 		.chained = true,
8052 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8053 	},
8054 	[ALC255_FIXUP_HEADSET_MODE] = {
8055 		.type = HDA_FIXUP_FUNC,
8056 		.v.func = alc_fixup_headset_mode_alc255,
8057 		.chained = true,
8058 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8059 	},
8060 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8061 		.type = HDA_FIXUP_FUNC,
8062 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8063 	},
8064 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8065 		.type = HDA_FIXUP_PINS,
8066 		.v.pins = (const struct hda_pintbl[]) {
8067 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8068 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8069 			{ }
8070 		},
8071 		.chained = true,
8072 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8073 	},
8074 	[ALC292_FIXUP_TPT440_DOCK] = {
8075 		.type = HDA_FIXUP_FUNC,
8076 		.v.func = alc_fixup_tpt440_dock,
8077 		.chained = true,
8078 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8079 	},
8080 	[ALC292_FIXUP_TPT440] = {
8081 		.type = HDA_FIXUP_FUNC,
8082 		.v.func = alc_fixup_disable_aamix,
8083 		.chained = true,
8084 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
8085 	},
8086 	[ALC283_FIXUP_HEADSET_MIC] = {
8087 		.type = HDA_FIXUP_PINS,
8088 		.v.pins = (const struct hda_pintbl[]) {
8089 			{ 0x19, 0x04a110f0 },
8090 			{ },
8091 		},
8092 	},
8093 	[ALC255_FIXUP_MIC_MUTE_LED] = {
8094 		.type = HDA_FIXUP_FUNC,
8095 		.v.func = alc_fixup_micmute_led,
8096 	},
8097 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
8098 		.type = HDA_FIXUP_PINS,
8099 		.v.pins = (const struct hda_pintbl[]) {
8100 			{ 0x12, 0x90a60130 },
8101 			{ 0x14, 0x90170110 },
8102 			{ 0x17, 0x40000008 },
8103 			{ 0x18, 0x411111f0 },
8104 			{ 0x19, 0x01a1913c },
8105 			{ 0x1a, 0x411111f0 },
8106 			{ 0x1b, 0x411111f0 },
8107 			{ 0x1d, 0x40f89b2d },
8108 			{ 0x1e, 0x411111f0 },
8109 			{ 0x21, 0x0321101f },
8110 			{ },
8111 		},
8112 	},
8113 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8114 		.type = HDA_FIXUP_FUNC,
8115 		.v.func = alc269vb_fixup_aspire_e1_coef,
8116 	},
8117 	[ALC280_FIXUP_HP_GPIO4] = {
8118 		.type = HDA_FIXUP_FUNC,
8119 		.v.func = alc280_fixup_hp_gpio4,
8120 	},
8121 	[ALC286_FIXUP_HP_GPIO_LED] = {
8122 		.type = HDA_FIXUP_FUNC,
8123 		.v.func = alc286_fixup_hp_gpio_led,
8124 	},
8125 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8126 		.type = HDA_FIXUP_FUNC,
8127 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8128 	},
8129 	[ALC280_FIXUP_HP_DOCK_PINS] = {
8130 		.type = HDA_FIXUP_PINS,
8131 		.v.pins = (const struct hda_pintbl[]) {
8132 			{ 0x1b, 0x21011020 }, /* line-out */
8133 			{ 0x1a, 0x01a1903c }, /* headset mic */
8134 			{ 0x18, 0x2181103f }, /* line-in */
8135 			{ },
8136 		},
8137 		.chained = true,
8138 		.chain_id = ALC280_FIXUP_HP_GPIO4
8139 	},
8140 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8141 		.type = HDA_FIXUP_PINS,
8142 		.v.pins = (const struct hda_pintbl[]) {
8143 			{ 0x1b, 0x21011020 }, /* line-out */
8144 			{ 0x18, 0x2181103f }, /* line-in */
8145 			{ },
8146 		},
8147 		.chained = true,
8148 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8149 	},
8150 	[ALC280_FIXUP_HP_9480M] = {
8151 		.type = HDA_FIXUP_FUNC,
8152 		.v.func = alc280_fixup_hp_9480m,
8153 	},
8154 	[ALC245_FIXUP_HP_X360_AMP] = {
8155 		.type = HDA_FIXUP_FUNC,
8156 		.v.func = alc245_fixup_hp_x360_amp,
8157 		.chained = true,
8158 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
8159 	},
8160 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
8161 		.type = HDA_FIXUP_FUNC,
8162 		.v.func = alc_fixup_headset_mode_dell_alc288,
8163 		.chained = true,
8164 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8165 	},
8166 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8167 		.type = HDA_FIXUP_PINS,
8168 		.v.pins = (const struct hda_pintbl[]) {
8169 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8170 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8171 			{ }
8172 		},
8173 		.chained = true,
8174 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8175 	},
8176 	[ALC288_FIXUP_DISABLE_AAMIX] = {
8177 		.type = HDA_FIXUP_FUNC,
8178 		.v.func = alc_fixup_disable_aamix,
8179 		.chained = true,
8180 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8181 	},
8182 	[ALC288_FIXUP_DELL_XPS_13] = {
8183 		.type = HDA_FIXUP_FUNC,
8184 		.v.func = alc_fixup_dell_xps13,
8185 		.chained = true,
8186 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
8187 	},
8188 	[ALC292_FIXUP_DISABLE_AAMIX] = {
8189 		.type = HDA_FIXUP_FUNC,
8190 		.v.func = alc_fixup_disable_aamix,
8191 		.chained = true,
8192 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8193 	},
8194 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8195 		.type = HDA_FIXUP_FUNC,
8196 		.v.func = alc_fixup_disable_aamix,
8197 		.chained = true,
8198 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8199 	},
8200 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
8201 		.type = HDA_FIXUP_FUNC,
8202 		.v.func = alc_fixup_dell_xps13,
8203 		.chained = true,
8204 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
8205 	},
8206 	[ALC292_FIXUP_DELL_E7X] = {
8207 		.type = HDA_FIXUP_FUNC,
8208 		.v.func = alc_fixup_micmute_led,
8209 		/* micmute fixup must be applied at last */
8210 		.chained_before = true,
8211 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8212 	},
8213 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8214 		.type = HDA_FIXUP_PINS,
8215 		.v.pins = (const struct hda_pintbl[]) {
8216 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8217 			{ }
8218 		},
8219 		.chained_before = true,
8220 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8221 	},
8222 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8223 		.type = HDA_FIXUP_PINS,
8224 		.v.pins = (const struct hda_pintbl[]) {
8225 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8226 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8227 			{ }
8228 		},
8229 		.chained = true,
8230 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8231 	},
8232 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8233 		.type = HDA_FIXUP_PINS,
8234 		.v.pins = (const struct hda_pintbl[]) {
8235 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8236 			{ }
8237 		},
8238 		.chained = true,
8239 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8240 	},
8241 	[ALC275_FIXUP_DELL_XPS] = {
8242 		.type = HDA_FIXUP_VERBS,
8243 		.v.verbs = (const struct hda_verb[]) {
8244 			/* Enables internal speaker */
8245 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8246 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8247 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8248 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8249 			{}
8250 		}
8251 	},
8252 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8253 		.type = HDA_FIXUP_FUNC,
8254 		.v.func = alc_fixup_disable_aamix,
8255 		.chained = true,
8256 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8257 	},
8258 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8259 		.type = HDA_FIXUP_FUNC,
8260 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8261 	},
8262 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8263 		.type = HDA_FIXUP_FUNC,
8264 		.v.func = alc_fixup_inv_dmic,
8265 		.chained = true,
8266 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8267 	},
8268 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8269 		.type = HDA_FIXUP_FUNC,
8270 		.v.func = alc269_fixup_limit_int_mic_boost
8271 	},
8272 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
8273 		.type = HDA_FIXUP_FUNC,
8274 		.v.func = alc_fixup_disable_aamix,
8275 		.chained = true,
8276 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8277 	},
8278 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
8279 		.type = HDA_FIXUP_FUNC,
8280 		.v.func = alc_fixup_disable_mic_vref,
8281 		.chained = true,
8282 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8283 	},
8284 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8285 		.type = HDA_FIXUP_VERBS,
8286 		.v.verbs = (const struct hda_verb[]) {
8287 			/* Disable pass-through path for FRONT 14h */
8288 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8289 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8290 			{}
8291 		},
8292 		.chained = true,
8293 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8294 	},
8295 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
8296 		.type = HDA_FIXUP_FUNC,
8297 		.v.func = alc_fixup_disable_aamix,
8298 		.chained = true,
8299 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
8300 	},
8301 	[ALC221_FIXUP_HP_FRONT_MIC] = {
8302 		.type = HDA_FIXUP_PINS,
8303 		.v.pins = (const struct hda_pintbl[]) {
8304 			{ 0x19, 0x02a19020 }, /* Front Mic */
8305 			{ }
8306 		},
8307 	},
8308 	[ALC292_FIXUP_TPT460] = {
8309 		.type = HDA_FIXUP_FUNC,
8310 		.v.func = alc_fixup_tpt440_dock,
8311 		.chained = true,
8312 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8313 	},
8314 	[ALC298_FIXUP_SPK_VOLUME] = {
8315 		.type = HDA_FIXUP_FUNC,
8316 		.v.func = alc298_fixup_speaker_volume,
8317 		.chained = true,
8318 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8319 	},
8320 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8321 		.type = HDA_FIXUP_FUNC,
8322 		.v.func = alc298_fixup_speaker_volume,
8323 	},
8324 	[ALC295_FIXUP_DISABLE_DAC3] = {
8325 		.type = HDA_FIXUP_FUNC,
8326 		.v.func = alc295_fixup_disable_dac3,
8327 	},
8328 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8329 		.type = HDA_FIXUP_FUNC,
8330 		.v.func = alc285_fixup_speaker2_to_dac1,
8331 		.chained = true,
8332 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8333 	},
8334 	[ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8335 		.type = HDA_FIXUP_FUNC,
8336 		.v.func = alc285_fixup_speaker2_to_dac1,
8337 		.chained = true,
8338 		.chain_id = ALC245_FIXUP_CS35L41_SPI_2
8339 	},
8340 	[ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8341 		.type = HDA_FIXUP_PINS,
8342 		.v.pins = (const struct hda_pintbl[]) {
8343 			{ 0x19, 0x03a11050 },
8344 			{ 0x1b, 0x03a11c30 },
8345 			{ }
8346 		},
8347 		.chained = true,
8348 		.chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8349 	},
8350 	[ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8351 		.type = HDA_FIXUP_PINS,
8352 		.v.pins = (const struct hda_pintbl[]) {
8353 			{ 0x14, 0x90170120 },
8354 			{ }
8355 		},
8356 		.chained = true,
8357 		.chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8358 	},
8359 	[ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8360 		.type = HDA_FIXUP_FUNC,
8361 		.v.func = alc285_fixup_speaker2_to_dac1,
8362 		.chained = true,
8363 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2
8364 	},
8365 	[ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8366 		.type = HDA_FIXUP_PINS,
8367 		.v.pins = (const struct hda_pintbl[]) {
8368 			{ 0x19, 0x03a11050 },
8369 			{ 0x1b, 0x03a11c30 },
8370 			{ }
8371 		},
8372 		.chained = true,
8373 		.chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8374 	},
8375 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8376 		.type = HDA_FIXUP_PINS,
8377 		.v.pins = (const struct hda_pintbl[]) {
8378 			{ 0x1b, 0x90170151 },
8379 			{ }
8380 		},
8381 		.chained = true,
8382 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8383 	},
8384 	[ALC269_FIXUP_ATIV_BOOK_8] = {
8385 		.type = HDA_FIXUP_FUNC,
8386 		.v.func = alc_fixup_auto_mute_via_amp,
8387 		.chained = true,
8388 		.chain_id = ALC269_FIXUP_NO_SHUTUP
8389 	},
8390 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8391 		.type = HDA_FIXUP_PINS,
8392 		.v.pins = (const struct hda_pintbl[]) {
8393 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8394 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8395 			{ }
8396 		},
8397 		.chained = true,
8398 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8399 	},
8400 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8401 		.type = HDA_FIXUP_PINS,
8402 		.v.pins = (const struct hda_pintbl[]) {
8403 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8404 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8405 			{ }
8406 		},
8407 		.chained = true,
8408 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8409 	},
8410 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8411 		.type = HDA_FIXUP_FUNC,
8412 		.v.func = alc_fixup_headset_mode,
8413 	},
8414 	[ALC256_FIXUP_ASUS_MIC] = {
8415 		.type = HDA_FIXUP_PINS,
8416 		.v.pins = (const struct hda_pintbl[]) {
8417 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8418 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8419 			{ }
8420 		},
8421 		.chained = true,
8422 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8423 	},
8424 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8425 		.type = HDA_FIXUP_FUNC,
8426 		/* Set up GPIO2 for the speaker amp */
8427 		.v.func = alc_fixup_gpio4,
8428 	},
8429 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8430 		.type = HDA_FIXUP_PINS,
8431 		.v.pins = (const struct hda_pintbl[]) {
8432 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8433 			{ }
8434 		},
8435 		.chained = true,
8436 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8437 	},
8438 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8439 		.type = HDA_FIXUP_VERBS,
8440 		.v.verbs = (const struct hda_verb[]) {
8441 			/* Enables internal speaker */
8442 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8443 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8444 			{}
8445 		},
8446 		.chained = true,
8447 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8448 	},
8449 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8450 		.type = HDA_FIXUP_FUNC,
8451 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8452 		.chained = true,
8453 		.chain_id = ALC269_FIXUP_GPIO2
8454 	},
8455 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
8456 		.type = HDA_FIXUP_VERBS,
8457 		.v.verbs = (const struct hda_verb[]) {
8458 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8459 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8460 			{ }
8461 		},
8462 		.chained = true,
8463 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8464 	},
8465 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8466 		.type = HDA_FIXUP_PINS,
8467 		.v.pins = (const struct hda_pintbl[]) {
8468 			/* Change the mic location from front to right, otherwise there are
8469 			   two front mics with the same name, pulseaudio can't handle them.
8470 			   This is just a temporary workaround, after applying this fixup,
8471 			   there will be one "Front Mic" and one "Mic" in this machine.
8472 			 */
8473 			{ 0x1a, 0x04a19040 },
8474 			{ }
8475 		},
8476 	},
8477 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8478 		.type = HDA_FIXUP_PINS,
8479 		.v.pins = (const struct hda_pintbl[]) {
8480 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
8481 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8482 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8483 			{ 0x1b, 0x02011020 },
8484 			{ }
8485 		},
8486 		.chained = true,
8487 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
8488 	},
8489 	[ALC225_FIXUP_S3_POP_NOISE] = {
8490 		.type = HDA_FIXUP_FUNC,
8491 		.v.func = alc225_fixup_s3_pop_noise,
8492 		.chained = true,
8493 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8494 	},
8495 	[ALC700_FIXUP_INTEL_REFERENCE] = {
8496 		.type = HDA_FIXUP_VERBS,
8497 		.v.verbs = (const struct hda_verb[]) {
8498 			/* Enables internal speaker */
8499 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8500 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8501 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8502 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8503 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8504 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8505 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8506 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8507 			{}
8508 		}
8509 	},
8510 	[ALC274_FIXUP_DELL_BIND_DACS] = {
8511 		.type = HDA_FIXUP_FUNC,
8512 		.v.func = alc274_fixup_bind_dacs,
8513 		.chained = true,
8514 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8515 	},
8516 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8517 		.type = HDA_FIXUP_PINS,
8518 		.v.pins = (const struct hda_pintbl[]) {
8519 			{ 0x1b, 0x0401102f },
8520 			{ }
8521 		},
8522 		.chained = true,
8523 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
8524 	},
8525 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
8526 		.type = HDA_FIXUP_FUNC,
8527 		.v.func = alc_fixup_tpt470_dock,
8528 		.chained = true,
8529 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8530 	},
8531 	[ALC298_FIXUP_TPT470_DOCK] = {
8532 		.type = HDA_FIXUP_FUNC,
8533 		.v.func = alc_fixup_tpt470_dacs,
8534 		.chained = true,
8535 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8536 	},
8537 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8538 		.type = HDA_FIXUP_PINS,
8539 		.v.pins = (const struct hda_pintbl[]) {
8540 			{ 0x14, 0x0201101f },
8541 			{ }
8542 		},
8543 		.chained = true,
8544 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8545 	},
8546 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
8547 		.type = HDA_FIXUP_PINS,
8548 		.v.pins = (const struct hda_pintbl[]) {
8549 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8550 			{ }
8551 		},
8552 		.chained = true,
8553 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8554 	},
8555 	[ALC295_FIXUP_HP_X360] = {
8556 		.type = HDA_FIXUP_FUNC,
8557 		.v.func = alc295_fixup_hp_top_speakers,
8558 		.chained = true,
8559 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8560 	},
8561 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
8562 		.type = HDA_FIXUP_PINS,
8563 		.v.pins = (const struct hda_pintbl[]) {
8564 			{ 0x19, 0x0181313f},
8565 			{ }
8566 		},
8567 		.chained = true,
8568 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8569 	},
8570 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8571 		.type = HDA_FIXUP_FUNC,
8572 		.v.func = alc285_fixup_invalidate_dacs,
8573 		.chained = true,
8574 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8575 	},
8576 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
8577 		.type = HDA_FIXUP_FUNC,
8578 		.v.func = alc_fixup_auto_mute_via_amp,
8579 	},
8580 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8581 		.type = HDA_FIXUP_PINS,
8582 		.v.pins = (const struct hda_pintbl[]) {
8583 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8584 			{ }
8585 		},
8586 		.chained = true,
8587 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8588 	},
8589 	[ALC294_FIXUP_ASUS_MIC] = {
8590 		.type = HDA_FIXUP_PINS,
8591 		.v.pins = (const struct hda_pintbl[]) {
8592 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8593 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8594 			{ }
8595 		},
8596 		.chained = true,
8597 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8598 	},
8599 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8600 		.type = HDA_FIXUP_PINS,
8601 		.v.pins = (const struct hda_pintbl[]) {
8602 			{ 0x19, 0x01a1103c }, /* use as headset mic */
8603 			{ }
8604 		},
8605 		.chained = true,
8606 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8607 	},
8608 	[ALC294_FIXUP_ASUS_SPK] = {
8609 		.type = HDA_FIXUP_VERBS,
8610 		.v.verbs = (const struct hda_verb[]) {
8611 			/* Set EAPD high */
8612 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8613 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8614 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8615 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8616 			{ }
8617 		},
8618 		.chained = true,
8619 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8620 	},
8621 	[ALC295_FIXUP_CHROME_BOOK] = {
8622 		.type = HDA_FIXUP_FUNC,
8623 		.v.func = alc295_fixup_chromebook,
8624 		.chained = true,
8625 		.chain_id = ALC225_FIXUP_HEADSET_JACK
8626 	},
8627 	[ALC225_FIXUP_HEADSET_JACK] = {
8628 		.type = HDA_FIXUP_FUNC,
8629 		.v.func = alc_fixup_headset_jack,
8630 	},
8631 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8632 		.type = HDA_FIXUP_PINS,
8633 		.v.pins = (const struct hda_pintbl[]) {
8634 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8635 			{ }
8636 		},
8637 		.chained = true,
8638 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8639 	},
8640 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8641 		.type = HDA_FIXUP_VERBS,
8642 		.v.verbs = (const struct hda_verb[]) {
8643 			/* Disable PCBEEP-IN passthrough */
8644 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8645 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8646 			{ }
8647 		},
8648 		.chained = true,
8649 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8650 	},
8651 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
8652 		.type = HDA_FIXUP_PINS,
8653 		.v.pins = (const struct hda_pintbl[]) {
8654 			{ 0x19, 0x03a11130 },
8655 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
8656 			{ }
8657 		},
8658 		.chained = true,
8659 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8660 	},
8661 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8662 		.type = HDA_FIXUP_PINS,
8663 		.v.pins = (const struct hda_pintbl[]) {
8664 			{ 0x16, 0x01011020 }, /* Rear Line out */
8665 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8666 			{ }
8667 		},
8668 		.chained = true,
8669 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8670 	},
8671 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8672 		.type = HDA_FIXUP_FUNC,
8673 		.v.func = alc_fixup_auto_mute_via_amp,
8674 		.chained = true,
8675 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8676 	},
8677 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8678 		.type = HDA_FIXUP_FUNC,
8679 		.v.func = alc_fixup_disable_mic_vref,
8680 		.chained = true,
8681 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8682 	},
8683 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8684 		.type = HDA_FIXUP_VERBS,
8685 		.v.verbs = (const struct hda_verb[]) {
8686 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8687 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8688 			{ }
8689 		},
8690 		.chained = true,
8691 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8692 	},
8693 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8694 		.type = HDA_FIXUP_PINS,
8695 		.v.pins = (const struct hda_pintbl[]) {
8696 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
8697 			{ }
8698 		},
8699 		.chained = true,
8700 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8701 	},
8702 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8703 		.type = HDA_FIXUP_PINS,
8704 		.v.pins = (const struct hda_pintbl[]) {
8705 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8706 			{ }
8707 		},
8708 		.chained = true,
8709 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8710 	},
8711 	[ALC299_FIXUP_PREDATOR_SPK] = {
8712 		.type = HDA_FIXUP_PINS,
8713 		.v.pins = (const struct hda_pintbl[]) {
8714 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8715 			{ }
8716 		}
8717 	},
8718 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8719 		.type = HDA_FIXUP_PINS,
8720 		.v.pins = (const struct hda_pintbl[]) {
8721 			{ 0x19, 0x04a11040 },
8722 			{ 0x21, 0x04211020 },
8723 			{ }
8724 		},
8725 		.chained = true,
8726 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8727 	},
8728 	[ALC289_FIXUP_DELL_SPK1] = {
8729 		.type = HDA_FIXUP_PINS,
8730 		.v.pins = (const struct hda_pintbl[]) {
8731 			{ 0x14, 0x90170140 },
8732 			{ }
8733 		},
8734 		.chained = true,
8735 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8736 	},
8737 	[ALC289_FIXUP_DELL_SPK2] = {
8738 		.type = HDA_FIXUP_PINS,
8739 		.v.pins = (const struct hda_pintbl[]) {
8740 			{ 0x17, 0x90170130 }, /* bass spk */
8741 			{ }
8742 		},
8743 		.chained = true,
8744 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8745 	},
8746 	[ALC289_FIXUP_DUAL_SPK] = {
8747 		.type = HDA_FIXUP_FUNC,
8748 		.v.func = alc285_fixup_speaker2_to_dac1,
8749 		.chained = true,
8750 		.chain_id = ALC289_FIXUP_DELL_SPK2
8751 	},
8752 	[ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
8753 		.type = HDA_FIXUP_FUNC,
8754 		.v.func = alc285_fixup_speaker2_to_dac1,
8755 		.chained = true,
8756 		.chain_id = ALC289_FIXUP_DELL_SPK1
8757 	},
8758 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
8759 		.type = HDA_FIXUP_FUNC,
8760 		.v.func = alc285_fixup_speaker2_to_dac1,
8761 		.chained = true,
8762 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8763 	},
8764 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
8765 		.type = HDA_FIXUP_FUNC,
8766 		/* The GPIO must be pulled to initialize the AMP */
8767 		.v.func = alc_fixup_gpio4,
8768 		.chained = true,
8769 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8770 	},
8771 	[ALC294_FIXUP_ASUS_ALLY] = {
8772 		.type = HDA_FIXUP_FUNC,
8773 		.v.func = cs35l41_fixup_i2c_two,
8774 		.chained = true,
8775 		.chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
8776 	},
8777 	[ALC294_FIXUP_ASUS_ALLY_PINS] = {
8778 		.type = HDA_FIXUP_PINS,
8779 		.v.pins = (const struct hda_pintbl[]) {
8780 			{ 0x19, 0x03a11050 },
8781 			{ 0x1a, 0x03a11c30 },
8782 			{ 0x21, 0x03211420 },
8783 			{ }
8784 		},
8785 		.chained = true,
8786 		.chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
8787 	},
8788 	[ALC294_FIXUP_ASUS_ALLY_VERBS] = {
8789 		.type = HDA_FIXUP_VERBS,
8790 		.v.verbs = (const struct hda_verb[]) {
8791 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8792 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8793 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
8794 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
8795 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
8796 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
8797 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
8798 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
8799 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
8800 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
8801 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
8802 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
8803 			{ }
8804 		},
8805 		.chained = true,
8806 		.chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
8807 	},
8808 	[ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
8809 		.type = HDA_FIXUP_FUNC,
8810 		.v.func = alc285_fixup_speaker2_to_dac1,
8811 	},
8812 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8813 		.type = HDA_FIXUP_FUNC,
8814 		.v.func = alc285_fixup_thinkpad_x1_gen7,
8815 		.chained = true,
8816 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8817 	},
8818 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8819 		.type = HDA_FIXUP_FUNC,
8820 		.v.func = alc_fixup_headset_jack,
8821 		.chained = true,
8822 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8823 	},
8824 	[ALC294_FIXUP_ASUS_HPE] = {
8825 		.type = HDA_FIXUP_VERBS,
8826 		.v.verbs = (const struct hda_verb[]) {
8827 			/* Set EAPD high */
8828 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8829 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8830 			{ }
8831 		},
8832 		.chained = true,
8833 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8834 	},
8835 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
8836 		.type = HDA_FIXUP_PINS,
8837 		.v.pins = (const struct hda_pintbl[]) {
8838 			{ 0x19, 0x03a11050 }, /* front HP mic */
8839 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8840 			{ 0x21, 0x03211020 }, /* front HP out */
8841 			{ }
8842 		},
8843 		.chained = true,
8844 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8845 	},
8846 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
8847 		.type = HDA_FIXUP_VERBS,
8848 		.v.verbs = (const struct hda_verb[]) {
8849 			/* set 0x15 to HP-OUT ctrl */
8850 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8851 			/* unmute the 0x15 amp */
8852 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8853 			{ }
8854 		},
8855 		.chained = true,
8856 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
8857 	},
8858 	[ALC294_FIXUP_ASUS_GX502_HP] = {
8859 		.type = HDA_FIXUP_FUNC,
8860 		.v.func = alc294_fixup_gx502_hp,
8861 	},
8862 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
8863 		.type = HDA_FIXUP_PINS,
8864 		.v.pins = (const struct hda_pintbl[]) {
8865 			{ 0x19, 0x01a11050 }, /* rear HP mic */
8866 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8867 			{ 0x21, 0x012110f0 }, /* rear HP out */
8868 			{ }
8869 		},
8870 		.chained = true,
8871 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8872 	},
8873 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
8874 		.type = HDA_FIXUP_VERBS,
8875 		.v.verbs = (const struct hda_verb[]) {
8876 			/* set 0x15 to HP-OUT ctrl */
8877 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8878 			/* unmute the 0x15 amp */
8879 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8880 			/* set 0x1b to HP-OUT */
8881 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8882 			{ }
8883 		},
8884 		.chained = true,
8885 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
8886 	},
8887 	[ALC294_FIXUP_ASUS_GU502_HP] = {
8888 		.type = HDA_FIXUP_FUNC,
8889 		.v.func = alc294_fixup_gu502_hp,
8890 	},
8891 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
8892 		.type = HDA_FIXUP_PINS,
8893 		.v.pins = (const struct hda_pintbl[]) {
8894 				{ 0x19, 0x03a11050 }, /* front HP mic */
8895 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
8896 				{ 0x21, 0x03211420 }, /* front HP out */
8897 				{ }
8898 		},
8899 	},
8900 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
8901 		.type = HDA_FIXUP_PINS,
8902 		.v.pins = (const struct hda_pintbl[]) {
8903 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
8904 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
8905 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
8906 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
8907 			{ 0x21, 0x03211420 },
8908 			{ }
8909 		},
8910 	},
8911 	[ALC294_FIXUP_ASUS_COEF_1B] = {
8912 		.type = HDA_FIXUP_VERBS,
8913 		.v.verbs = (const struct hda_verb[]) {
8914 			/* Set bit 10 to correct noisy output after reboot from
8915 			 * Windows 10 (due to pop noise reduction?)
8916 			 */
8917 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8918 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8919 			{ }
8920 		},
8921 		.chained = true,
8922 		.chain_id = ALC289_FIXUP_ASUS_GA401,
8923 	},
8924 	[ALC285_FIXUP_HP_GPIO_LED] = {
8925 		.type = HDA_FIXUP_FUNC,
8926 		.v.func = alc285_fixup_hp_gpio_led,
8927 	},
8928 	[ALC285_FIXUP_HP_MUTE_LED] = {
8929 		.type = HDA_FIXUP_FUNC,
8930 		.v.func = alc285_fixup_hp_mute_led,
8931 	},
8932 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
8933 		.type = HDA_FIXUP_FUNC,
8934 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
8935 	},
8936 	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
8937 	    .type = HDA_FIXUP_FUNC,
8938 	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
8939 	},
8940 	[ALC236_FIXUP_HP_GPIO_LED] = {
8941 		.type = HDA_FIXUP_FUNC,
8942 		.v.func = alc236_fixup_hp_gpio_led,
8943 	},
8944 	[ALC236_FIXUP_HP_MUTE_LED] = {
8945 		.type = HDA_FIXUP_FUNC,
8946 		.v.func = alc236_fixup_hp_mute_led,
8947 	},
8948 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8949 		.type = HDA_FIXUP_FUNC,
8950 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
8951 	},
8952 	[ALC236_FIXUP_LENOVO_INV_DMIC] = {
8953 		.type = HDA_FIXUP_FUNC,
8954 		.v.func = alc_fixup_inv_dmic,
8955 		.chained = true,
8956 		.chain_id = ALC283_FIXUP_INT_MIC,
8957 	},
8958 	[ALC298_FIXUP_SAMSUNG_AMP] = {
8959 		.type = HDA_FIXUP_FUNC,
8960 		.v.func = alc298_fixup_samsung_amp,
8961 		.chained = true,
8962 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
8963 	},
8964 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8965 		.type = HDA_FIXUP_VERBS,
8966 		.v.verbs = (const struct hda_verb[]) {
8967 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8968 			{ }
8969 		},
8970 	},
8971 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8972 		.type = HDA_FIXUP_VERBS,
8973 		.v.verbs = (const struct hda_verb[]) {
8974 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8975 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
8976 			{ }
8977 		},
8978 	},
8979 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8980 		.type = HDA_FIXUP_PINS,
8981 		.v.pins = (const struct hda_pintbl[]) {
8982 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8983 			{ }
8984 		},
8985 		.chained = true,
8986 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8987 	},
8988 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8989 		.type = HDA_FIXUP_PINS,
8990 		.v.pins = (const struct hda_pintbl[]) {
8991 			{ 0x14, 0x90100120 }, /* use as internal speaker */
8992 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8993 			{ 0x1a, 0x01011020 }, /* use as line out */
8994 			{ },
8995 		},
8996 		.chained = true,
8997 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8998 	},
8999 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9000 		.type = HDA_FIXUP_PINS,
9001 		.v.pins = (const struct hda_pintbl[]) {
9002 			{ 0x18, 0x02a11030 }, /* use as headset mic */
9003 			{ }
9004 		},
9005 		.chained = true,
9006 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9007 	},
9008 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9009 		.type = HDA_FIXUP_PINS,
9010 		.v.pins = (const struct hda_pintbl[]) {
9011 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9012 			{ }
9013 		},
9014 		.chained = true,
9015 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9016 	},
9017 	[ALC289_FIXUP_ASUS_GA401] = {
9018 		.type = HDA_FIXUP_FUNC,
9019 		.v.func = alc289_fixup_asus_ga401,
9020 		.chained = true,
9021 		.chain_id = ALC289_FIXUP_ASUS_GA502,
9022 	},
9023 	[ALC289_FIXUP_ASUS_GA502] = {
9024 		.type = HDA_FIXUP_PINS,
9025 		.v.pins = (const struct hda_pintbl[]) {
9026 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9027 			{ }
9028 		},
9029 	},
9030 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9031 		.type = HDA_FIXUP_PINS,
9032 		.v.pins = (const struct hda_pintbl[]) {
9033 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9034 			{ }
9035 		},
9036 		.chained = true,
9037 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9038 	},
9039 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9040 		.type = HDA_FIXUP_FUNC,
9041 		.v.func = alc285_fixup_hp_gpio_amp_init,
9042 		.chained = true,
9043 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
9044 	},
9045 	[ALC269_FIXUP_CZC_B20] = {
9046 		.type = HDA_FIXUP_PINS,
9047 		.v.pins = (const struct hda_pintbl[]) {
9048 			{ 0x12, 0x411111f0 },
9049 			{ 0x14, 0x90170110 }, /* speaker */
9050 			{ 0x15, 0x032f1020 }, /* HP out */
9051 			{ 0x17, 0x411111f0 },
9052 			{ 0x18, 0x03ab1040 }, /* mic */
9053 			{ 0x19, 0xb7a7013f },
9054 			{ 0x1a, 0x0181305f },
9055 			{ 0x1b, 0x411111f0 },
9056 			{ 0x1d, 0x411111f0 },
9057 			{ 0x1e, 0x411111f0 },
9058 			{ }
9059 		},
9060 		.chain_id = ALC269_FIXUP_DMIC,
9061 	},
9062 	[ALC269_FIXUP_CZC_TMI] = {
9063 		.type = HDA_FIXUP_PINS,
9064 		.v.pins = (const struct hda_pintbl[]) {
9065 			{ 0x12, 0x4000c000 },
9066 			{ 0x14, 0x90170110 }, /* speaker */
9067 			{ 0x15, 0x0421401f }, /* HP out */
9068 			{ 0x17, 0x411111f0 },
9069 			{ 0x18, 0x04a19020 }, /* mic */
9070 			{ 0x19, 0x411111f0 },
9071 			{ 0x1a, 0x411111f0 },
9072 			{ 0x1b, 0x411111f0 },
9073 			{ 0x1d, 0x40448505 },
9074 			{ 0x1e, 0x411111f0 },
9075 			{ 0x20, 0x8000ffff },
9076 			{ }
9077 		},
9078 		.chain_id = ALC269_FIXUP_DMIC,
9079 	},
9080 	[ALC269_FIXUP_CZC_L101] = {
9081 		.type = HDA_FIXUP_PINS,
9082 		.v.pins = (const struct hda_pintbl[]) {
9083 			{ 0x12, 0x40000000 },
9084 			{ 0x14, 0x01014010 }, /* speaker */
9085 			{ 0x15, 0x411111f0 }, /* HP out */
9086 			{ 0x16, 0x411111f0 },
9087 			{ 0x18, 0x01a19020 }, /* mic */
9088 			{ 0x19, 0x02a19021 },
9089 			{ 0x1a, 0x0181302f },
9090 			{ 0x1b, 0x0221401f },
9091 			{ 0x1c, 0x411111f0 },
9092 			{ 0x1d, 0x4044c601 },
9093 			{ 0x1e, 0x411111f0 },
9094 			{ }
9095 		},
9096 		.chain_id = ALC269_FIXUP_DMIC,
9097 	},
9098 	[ALC269_FIXUP_LEMOTE_A1802] = {
9099 		.type = HDA_FIXUP_PINS,
9100 		.v.pins = (const struct hda_pintbl[]) {
9101 			{ 0x12, 0x40000000 },
9102 			{ 0x14, 0x90170110 }, /* speaker */
9103 			{ 0x17, 0x411111f0 },
9104 			{ 0x18, 0x03a19040 }, /* mic1 */
9105 			{ 0x19, 0x90a70130 }, /* mic2 */
9106 			{ 0x1a, 0x411111f0 },
9107 			{ 0x1b, 0x411111f0 },
9108 			{ 0x1d, 0x40489d2d },
9109 			{ 0x1e, 0x411111f0 },
9110 			{ 0x20, 0x0003ffff },
9111 			{ 0x21, 0x03214020 },
9112 			{ }
9113 		},
9114 		.chain_id = ALC269_FIXUP_DMIC,
9115 	},
9116 	[ALC269_FIXUP_LEMOTE_A190X] = {
9117 		.type = HDA_FIXUP_PINS,
9118 		.v.pins = (const struct hda_pintbl[]) {
9119 			{ 0x14, 0x99130110 }, /* speaker */
9120 			{ 0x15, 0x0121401f }, /* HP out */
9121 			{ 0x18, 0x01a19c20 }, /* rear  mic */
9122 			{ 0x19, 0x99a3092f }, /* front mic */
9123 			{ 0x1b, 0x0201401f }, /* front lineout */
9124 			{ }
9125 		},
9126 		.chain_id = ALC269_FIXUP_DMIC,
9127 	},
9128 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9129 		.type = HDA_FIXUP_PINS,
9130 		.v.pins = (const struct hda_pintbl[]) {
9131 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9132 			{ }
9133 		},
9134 		.chained = true,
9135 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9136 	},
9137 	[ALC256_FIXUP_INTEL_NUC10] = {
9138 		.type = HDA_FIXUP_PINS,
9139 		.v.pins = (const struct hda_pintbl[]) {
9140 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9141 			{ }
9142 		},
9143 		.chained = true,
9144 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9145 	},
9146 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9147 		.type = HDA_FIXUP_VERBS,
9148 		.v.verbs = (const struct hda_verb[]) {
9149 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9150 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9151 			{ }
9152 		},
9153 		.chained = true,
9154 		.chain_id = ALC289_FIXUP_ASUS_GA502
9155 	},
9156 	[ALC274_FIXUP_HP_MIC] = {
9157 		.type = HDA_FIXUP_VERBS,
9158 		.v.verbs = (const struct hda_verb[]) {
9159 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9160 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9161 			{ }
9162 		},
9163 	},
9164 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
9165 		.type = HDA_FIXUP_FUNC,
9166 		.v.func = alc274_fixup_hp_headset_mic,
9167 		.chained = true,
9168 		.chain_id = ALC274_FIXUP_HP_MIC
9169 	},
9170 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
9171 		.type = HDA_FIXUP_FUNC,
9172 		.v.func = alc274_fixup_hp_envy_gpio,
9173 	},
9174 	[ALC256_FIXUP_ASUS_HPE] = {
9175 		.type = HDA_FIXUP_VERBS,
9176 		.v.verbs = (const struct hda_verb[]) {
9177 			/* Set EAPD high */
9178 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9179 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9180 			{ }
9181 		},
9182 		.chained = true,
9183 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9184 	},
9185 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9186 		.type = HDA_FIXUP_FUNC,
9187 		.v.func = alc_fixup_headset_jack,
9188 		.chained = true,
9189 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9190 	},
9191 	[ALC287_FIXUP_HP_GPIO_LED] = {
9192 		.type = HDA_FIXUP_FUNC,
9193 		.v.func = alc287_fixup_hp_gpio_led,
9194 	},
9195 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
9196 		.type = HDA_FIXUP_FUNC,
9197 		.v.func = alc274_fixup_hp_headset_mic,
9198 	},
9199 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9200 		.type = HDA_FIXUP_FUNC,
9201 		.v.func = alc_fixup_no_int_mic,
9202 		.chained = true,
9203 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9204 	},
9205 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9206 		.type = HDA_FIXUP_PINS,
9207 		.v.pins = (const struct hda_pintbl[]) {
9208 			{ 0x1b, 0x411111f0 },
9209 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9210 			{ },
9211 		},
9212 		.chained = true,
9213 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9214 	},
9215 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9216 		.type = HDA_FIXUP_FUNC,
9217 		.v.func = alc269_fixup_limit_int_mic_boost,
9218 		.chained = true,
9219 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9220 	},
9221 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
9222 		.type = HDA_FIXUP_PINS,
9223 		.v.pins = (const struct hda_pintbl[]) {
9224 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9225 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
9226 			{ }
9227 		},
9228 		.chained = true,
9229 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9230 	},
9231 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9232 		.type = HDA_FIXUP_FUNC,
9233 		.v.func = alc285_fixup_ideapad_s740_coef,
9234 		.chained = true,
9235 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9236 	},
9237 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9238 		.type = HDA_FIXUP_FUNC,
9239 		.v.func = alc269_fixup_limit_int_mic_boost,
9240 		.chained = true,
9241 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9242 	},
9243 	[ALC295_FIXUP_ASUS_DACS] = {
9244 		.type = HDA_FIXUP_FUNC,
9245 		.v.func = alc295_fixup_asus_dacs,
9246 	},
9247 	[ALC295_FIXUP_HP_OMEN] = {
9248 		.type = HDA_FIXUP_PINS,
9249 		.v.pins = (const struct hda_pintbl[]) {
9250 			{ 0x12, 0xb7a60130 },
9251 			{ 0x13, 0x40000000 },
9252 			{ 0x14, 0x411111f0 },
9253 			{ 0x16, 0x411111f0 },
9254 			{ 0x17, 0x90170110 },
9255 			{ 0x18, 0x411111f0 },
9256 			{ 0x19, 0x02a11030 },
9257 			{ 0x1a, 0x411111f0 },
9258 			{ 0x1b, 0x04a19030 },
9259 			{ 0x1d, 0x40600001 },
9260 			{ 0x1e, 0x411111f0 },
9261 			{ 0x21, 0x03211020 },
9262 			{}
9263 		},
9264 		.chained = true,
9265 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9266 	},
9267 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
9268 		.type = HDA_FIXUP_FUNC,
9269 		.v.func = alc285_fixup_hp_spectre_x360,
9270 	},
9271 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9272 		.type = HDA_FIXUP_FUNC,
9273 		.v.func = alc285_fixup_hp_spectre_x360_eb1
9274 	},
9275 	[ALC285_FIXUP_HP_ENVY_X360] = {
9276 		.type = HDA_FIXUP_FUNC,
9277 		.v.func = alc285_fixup_hp_envy_x360,
9278 		.chained = true,
9279 		.chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9280 	},
9281 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9282 		.type = HDA_FIXUP_FUNC,
9283 		.v.func = alc285_fixup_ideapad_s740_coef,
9284 		.chained = true,
9285 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9286 	},
9287 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9288 		.type = HDA_FIXUP_FUNC,
9289 		.v.func = alc_fixup_no_shutup,
9290 		.chained = true,
9291 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
9292 	},
9293 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9294 		.type = HDA_FIXUP_PINS,
9295 		.v.pins = (const struct hda_pintbl[]) {
9296 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9297 			{ }
9298 		},
9299 		.chained = true,
9300 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9301 	},
9302 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9303 		.type = HDA_FIXUP_FUNC,
9304 		.v.func = alc269_fixup_limit_int_mic_boost,
9305 		.chained = true,
9306 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9307 	},
9308 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9309 		.type = HDA_FIXUP_FUNC,
9310 		.v.func = alc285_fixup_ideapad_s740_coef,
9311 		.chained = true,
9312 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9313 	},
9314 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9315 		.type = HDA_FIXUP_FUNC,
9316 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9317 		.chained = true,
9318 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9319 	},
9320 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9321 		.type = HDA_FIXUP_VERBS,
9322 		//.v.verbs = legion_15imhg05_coefs,
9323 		.v.verbs = (const struct hda_verb[]) {
9324 			 // set left speaker Legion 7i.
9325 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9326 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9327 
9328 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9329 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9330 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9331 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9332 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9333 
9334 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9335 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9336 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9337 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9338 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9339 
9340 			 // set right speaker Legion 7i.
9341 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9342 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9343 
9344 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9345 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9346 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9347 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9348 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9349 
9350 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9351 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9352 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9353 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9354 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9355 			 {}
9356 		},
9357 		.chained = true,
9358 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9359 	},
9360 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9361 		.type = HDA_FIXUP_FUNC,
9362 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9363 		.chained = true,
9364 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9365 	},
9366 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9367 		.type = HDA_FIXUP_VERBS,
9368 		.v.verbs = (const struct hda_verb[]) {
9369 			 // set left speaker Yoga 7i.
9370 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9371 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9372 
9373 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9374 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9375 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9376 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9377 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9378 
9379 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9380 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9381 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9382 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9383 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9384 
9385 			 // set right speaker Yoga 7i.
9386 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9387 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9388 
9389 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9390 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9391 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9392 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9393 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9394 
9395 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9396 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9397 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9398 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9399 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9400 			 {}
9401 		},
9402 		.chained = true,
9403 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9404 	},
9405 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
9406 		.type = HDA_FIXUP_FUNC,
9407 		.v.func = alc298_fixup_lenovo_c940_duet7,
9408 	},
9409 	[ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
9410 		.type = HDA_FIXUP_FUNC,
9411 		.v.func = alc287_fixup_lenovo_14irp8_duetitl,
9412 	},
9413 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9414 		.type = HDA_FIXUP_VERBS,
9415 		.v.verbs = (const struct hda_verb[]) {
9416 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9417 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9418 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9419 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9420 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9421 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9422 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9423 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9424 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9425 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9426 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9427 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9428 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9429 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9430 			{}
9431 		},
9432 		.chained = true,
9433 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9434 	},
9435 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9436 		.type = HDA_FIXUP_FUNC,
9437 		.v.func = alc256_fixup_set_coef_defaults,
9438 	},
9439 	[ALC245_FIXUP_HP_GPIO_LED] = {
9440 		.type = HDA_FIXUP_FUNC,
9441 		.v.func = alc245_fixup_hp_gpio_led,
9442 	},
9443 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9444 		.type = HDA_FIXUP_PINS,
9445 		.v.pins = (const struct hda_pintbl[]) {
9446 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9447 			{ }
9448 		},
9449 		.chained = true,
9450 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9451 	},
9452 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
9453 		.type = HDA_FIXUP_FUNC,
9454 		.v.func = alc233_fixup_no_audio_jack,
9455 	},
9456 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9457 		.type = HDA_FIXUP_FUNC,
9458 		.v.func = alc256_fixup_mic_no_presence_and_resume,
9459 		.chained = true,
9460 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9461 	},
9462 	[ALC287_FIXUP_LEGION_16ACHG6] = {
9463 		.type = HDA_FIXUP_FUNC,
9464 		.v.func = alc287_fixup_legion_16achg6_speakers,
9465 	},
9466 	[ALC287_FIXUP_CS35L41_I2C_2] = {
9467 		.type = HDA_FIXUP_FUNC,
9468 		.v.func = cs35l41_fixup_i2c_two,
9469 	},
9470 	[ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9471 		.type = HDA_FIXUP_FUNC,
9472 		.v.func = cs35l41_fixup_i2c_two,
9473 		.chained = true,
9474 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9475 	},
9476 	[ALC245_FIXUP_CS35L41_SPI_2] = {
9477 		.type = HDA_FIXUP_FUNC,
9478 		.v.func = cs35l41_fixup_spi_two,
9479 	},
9480 	[ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9481 		.type = HDA_FIXUP_FUNC,
9482 		.v.func = cs35l41_fixup_spi_two,
9483 		.chained = true,
9484 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9485 	},
9486 	[ALC245_FIXUP_CS35L41_SPI_4] = {
9487 		.type = HDA_FIXUP_FUNC,
9488 		.v.func = cs35l41_fixup_spi_four,
9489 	},
9490 	[ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9491 		.type = HDA_FIXUP_FUNC,
9492 		.v.func = cs35l41_fixup_spi_four,
9493 		.chained = true,
9494 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9495 	},
9496 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9497 		.type = HDA_FIXUP_VERBS,
9498 		.v.verbs = (const struct hda_verb[]) {
9499 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9500 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9501 			 { }
9502 		},
9503 		.chained = true,
9504 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9505 	},
9506 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9507 		.type = HDA_FIXUP_FUNC,
9508 		.v.func = alc_fixup_dell4_mic_no_presence_quiet,
9509 		.chained = true,
9510 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9511 	},
9512 	[ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9513 		.type = HDA_FIXUP_PINS,
9514 		.v.pins = (const struct hda_pintbl[]) {
9515 			{ 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9516 			{ }
9517 		},
9518 		.chained = true,
9519 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9520 	},
9521 	[ALC287_FIXUP_LEGION_16ITHG6] = {
9522 		.type = HDA_FIXUP_FUNC,
9523 		.v.func = alc287_fixup_legion_16ithg6_speakers,
9524 	},
9525 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9526 		.type = HDA_FIXUP_VERBS,
9527 		.v.verbs = (const struct hda_verb[]) {
9528 			// enable left speaker
9529 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9530 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9531 
9532 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9533 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9534 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9535 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9536 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9537 
9538 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9539 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9540 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9541 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9542 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9543 
9544 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9545 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9546 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9547 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9548 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9549 
9550 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9551 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9552 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9553 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9554 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9555 
9556 			// enable right speaker
9557 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9558 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9559 
9560 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9561 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9562 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9563 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9564 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9565 
9566 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9567 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9568 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9569 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9570 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9571 
9572 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9573 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9574 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9575 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9576 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9577 
9578 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9579 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9580 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9581 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9582 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9583 
9584 			{ },
9585 		},
9586 	},
9587 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9588 		.type = HDA_FIXUP_FUNC,
9589 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9590 		.chained = true,
9591 		.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9592 	},
9593 	[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
9594 		.type = HDA_FIXUP_FUNC,
9595 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9596 		.chained = true,
9597 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2,
9598 	},
9599 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
9600 		.type = HDA_FIXUP_FUNC,
9601 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
9602 		.chained = true,
9603 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9604 	},
9605 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
9606 		.type = HDA_FIXUP_PINS,
9607 		.v.func = alc1220_fixup_gb_dual_codecs,
9608 		.chained = true,
9609 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9610 	},
9611 	[ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
9612 		.type = HDA_FIXUP_FUNC,
9613 		.v.func = cs35l41_fixup_i2c_two,
9614 		.chained = true,
9615 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9616 	},
9617 	[ALC287_FIXUP_TAS2781_I2C] = {
9618 		.type = HDA_FIXUP_FUNC,
9619 		.v.func = tas2781_fixup_i2c,
9620 		.chained = true,
9621 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9622 	},
9623 	[ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
9624 		.type = HDA_FIXUP_FUNC,
9625 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9626 	},
9627 	[ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
9628 		.type = HDA_FIXUP_FUNC,
9629 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9630 		.chained = true,
9631 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
9632 	},
9633 	[ALC287_FIXUP_THINKPAD_I2S_SPK] = {
9634 		.type = HDA_FIXUP_FUNC,
9635 		.v.func = alc287_fixup_bind_dacs,
9636 		.chained = true,
9637 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9638 	},
9639 	[ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
9640 		.type = HDA_FIXUP_FUNC,
9641 		.v.func = alc287_fixup_bind_dacs,
9642 		.chained = true,
9643 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
9644 	},
9645 	[ALC2XX_FIXUP_HEADSET_MIC] = {
9646 		.type = HDA_FIXUP_FUNC,
9647 		.v.func = alc_fixup_headset_mic,
9648 	},
9649 	[ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
9650 		.type = HDA_FIXUP_FUNC,
9651 		.v.func = cs35l41_fixup_spi_two,
9652 		.chained = true,
9653 		.chain_id = ALC289_FIXUP_DUAL_SPK
9654 	},
9655 	[ALC294_FIXUP_CS35L41_I2C_2] = {
9656 		.type = HDA_FIXUP_FUNC,
9657 		.v.func = cs35l41_fixup_i2c_two,
9658 	},
9659 };
9660 
9661 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
9662 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
9663 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9664 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
9665 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
9666 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9667 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9668 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
9669 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9670 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9671 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
9672 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9673 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
9674 	SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9675 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
9676 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
9677 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
9678 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
9679 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9680 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9681 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9682 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9683 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
9684 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
9685 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
9686 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
9687 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9688 	SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9689 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9690 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9691 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9692 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
9693 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9694 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9695 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9696 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
9697 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
9698 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9699 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9700 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9701 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
9702 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9703 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
9704 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
9705 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
9706 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
9707 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
9708 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9709 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
9710 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
9711 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9712 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9713 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9714 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9715 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9716 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
9717 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
9718 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
9719 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9720 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9721 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
9722 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9723 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
9724 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9725 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9726 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9727 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9728 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9729 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9730 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9731 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9732 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9733 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
9734 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
9735 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
9736 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
9737 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9738 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
9739 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
9740 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9741 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9742 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9743 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9744 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9745 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
9746 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
9747 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9748 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9749 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9750 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9751 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9752 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9753 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9754 	SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
9755 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
9756 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
9757 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
9758 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9759 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9760 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9761 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
9762 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9763 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9764 	SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9765 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9766 	SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9767 	SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9768 	SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9769 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9770 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9771 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9772 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9773 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9774 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9775 	SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9776 	SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9777 	SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9778 	SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9779 	SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9780 	SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9781 	SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9782 	SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9783 	SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9784 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9785 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9786 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9787 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
9788 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
9789 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9790 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9791 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9792 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9793 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9794 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9795 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9796 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9797 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9798 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9799 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9800 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9801 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9802 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9803 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9804 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9805 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9806 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9807 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
9808 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
9809 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9810 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9811 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9812 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9813 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9814 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9815 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9816 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9817 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9818 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9819 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9820 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9821 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9822 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9823 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9824 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9825 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9826 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9827 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9828 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9829 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9830 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9831 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9832 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9833 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9834 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9835 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9836 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9837 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9838 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9839 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9840 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9841 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9842 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9843 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
9844 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9845 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9846 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9847 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9848 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
9849 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9850 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
9851 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9852 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9853 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9854 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9855 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9856 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9857 	SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9858 	SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9859 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
9860 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9861 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
9862 	SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9863 	SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
9864 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9865 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9866 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9867 	SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9868 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
9869 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9870 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9871 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
9872 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9873 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9874 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
9875 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
9876 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
9877 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9878 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9879 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9880 	SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
9881 	SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9882 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
9883 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9884 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
9885 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
9886 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
9887 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
9888 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9889 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9890 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9891 	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9892 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
9893 	SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9894 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9895 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9896 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9897 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9898 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
9899 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
9900 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9901 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9902 	SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9903 	SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9904 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9905 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9906 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9907 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9908 	SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9909 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9910 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9911 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9912 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9913 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9914 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9915 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9916 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9917 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9918 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9919 	SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9920 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
9921 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
9922 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
9923 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9924 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
9925 	SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
9926 	SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9927 	SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
9928 	SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9929 	SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9930 	SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9931 	SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9932 	SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9933 	SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9934 	SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9935 	SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
9936 	SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
9937 	SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9938 	SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9939 	SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9940 	SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
9941 	SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9942 	SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
9943 	SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
9944 	SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
9945 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
9946 	SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
9947 	SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
9948 	SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9949 	SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9950 	SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9951 	SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9952 	SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9953 	SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
9954 	SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9955 	SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
9956 	SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9957 	SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
9958 	SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
9959 	SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
9960 	SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
9961 	SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
9962 	SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9963 	SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9964 	SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9965 	SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9966 	SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9967 	SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
9968 	SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9969 	SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9970 	SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9971 	SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9972 	SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9973 	SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9974 	SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9975 	SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9976 	SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9977 	SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9978 	SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9979 	SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9980 	SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9981 	SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9982 	SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9983 	SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
9984 	SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
9985 	SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
9986 	SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
9987 	SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
9988 	SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
9989 	SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
9990 	SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9991 	SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9992 	SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9993 	SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9994 	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
9995 	SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9996 	SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9997 	SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9998 	SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9999 	SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10000 	SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10001 	SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10002 	SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10003 	SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10004 	SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10005 	SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10006 	SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10007 	SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10008 	SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10009 	SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10010 	SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10011 	SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10012 	SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10013 	SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10014 	SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10015 	SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10016 	SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10017 	SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10018 	SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10019 	SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10020 	SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10021 	SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10022 	SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10023 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10024 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10025 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10026 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10027 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10028 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10029 	SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10030 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10031 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10032 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10033 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10034 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10035 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10036 	SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10037 	SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10038 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10039 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10040 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10041 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10042 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10043 	SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650P", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10044 	SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10045 	SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10046 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10047 	SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10048 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10049 	SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA", ALC287_FIXUP_CS35L41_I2C_2),
10050 	SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10051 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10052 	SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10053 	SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10054 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10055 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10056 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10057 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10058 	SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally RC71L_RC71L", ALC294_FIXUP_ASUS_ALLY),
10059 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10060 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10061 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10062 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10063 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10064 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10065 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10066 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10067 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10068 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10069 	SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
10070 	SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10071 	SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10072 	SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10073 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10074 	SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
10075 	SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10076 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10077 	SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10078 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10079 	SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10080 	SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10081 	SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10082 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10083 	SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10084 	SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10085 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10086 	SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS ROG Strix G17 2023 (G713PV)", ALC287_FIXUP_CS35L41_I2C_2),
10087 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10088 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10089 	SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10090 	SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10091 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10092 	SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10093 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10094 	SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10095 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10096 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10097 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10098 	SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10099 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10100 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10101 	SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10102 	SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10103 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10104 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10105 	SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2),
10106 	SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10107 	SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10108 	SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10109 	SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10110 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10111 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10112 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10113 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10114 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10115 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10116 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10117 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10118 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10119 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10120 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10121 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10122 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10123 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10124 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10125 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10126 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10127 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10128 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10129 	SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10130 	SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10131 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10132 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10133 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10134 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10135 	SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10136 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10137 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10138 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10139 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10140 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10141 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10142 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10143 	SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10144 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10145 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10146 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10147 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10148 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10149 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10150 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10151 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10152 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10153 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10154 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10155 	SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10156 	SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10157 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10158 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10159 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10160 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10161 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10162 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10163 	SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10164 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10165 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10166 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10167 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10168 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10169 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10170 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10171 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10172 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10173 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10174 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10175 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10176 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10177 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10178 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10179 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10180 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10181 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10182 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10183 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10184 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10185 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10186 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10187 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10188 	SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10189 	SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10190 	SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10191 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10192 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10193 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10194 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10195 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10196 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10197 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10198 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10199 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10200 	SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10201 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10202 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10203 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10204 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10205 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10206 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10207 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10208 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10209 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10210 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10211 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10212 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10213 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10214 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10215 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10216 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
10217 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10218 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10219 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10220 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10221 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10222 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10223 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10224 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10225 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10226 	SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10227 	SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10228 	SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10229 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10230 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10231 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10232 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10233 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10234 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10235 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
10236 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10237 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
10238 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
10239 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
10240 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
10241 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
10242 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
10243 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
10244 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
10245 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
10246 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
10247 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
10248 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
10249 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
10250 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
10251 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
10252 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10253 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10254 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10255 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
10256 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
10257 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10258 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10259 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10260 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
10261 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
10262 	SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
10263 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
10264 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10265 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10266 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
10267 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10268 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10269 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10270 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10271 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10272 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10273 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10274 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10275 	SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10276 	SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10277 	SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10278 	SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10279 	SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10280 	SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10281 	SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10282 	SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10283 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10284 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10285 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10286 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10287 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10288 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10289 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10290 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10291 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10292 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10293 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10294 	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
10295 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10296 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
10297 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10298 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
10299 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10300 	SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10301 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10302 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
10303 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10304 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10305 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
10306 	SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
10307 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10308 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10309 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10310 	SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
10311 	SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10312 	SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10313 	SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10314 	SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
10315 	SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
10316 	SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
10317 	SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10318 	SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10319 	SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10320 	SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10321 	SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
10322 	SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
10323 	SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
10324 	SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
10325 	SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
10326 	SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
10327 	SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
10328 	SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10329 	SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10330 	SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10331 	SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10332 	SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10333 	SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10334 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10335 	SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
10336 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
10337 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10338 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
10339 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10340 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
10341 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
10342 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10343 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
10344 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
10345 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
10346 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
10347 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
10348 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
10349 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
10350 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
10351 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10352 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10353 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10354 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10355 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10356 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10357 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10358 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
10359 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10360 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
10361 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
10362 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
10363 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10364 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
10365 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
10366 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
10367 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
10368 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
10369 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
10370 	SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10371 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
10372 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
10373 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
10374 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
10375 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10376 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10377 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10378 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10379 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10380 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
10381 	SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10382 	SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10383 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10384 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
10385 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
10386 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
10387 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10388 	SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10389 	SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
10390 	SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
10391 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
10392 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
10393 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
10394 	SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
10395 	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10396 	SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10397 	SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10398 
10399 #if 0
10400 	/* Below is a quirk table taken from the old code.
10401 	 * Basically the device should work as is without the fixup table.
10402 	 * If BIOS doesn't give a proper info, enable the corresponding
10403 	 * fixup entry.
10404 	 */
10405 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
10406 		      ALC269_FIXUP_AMIC),
10407 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
10408 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
10409 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
10410 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
10411 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
10412 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
10413 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
10414 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
10415 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
10416 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
10417 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
10418 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
10419 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
10420 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
10421 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
10422 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
10423 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
10424 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
10425 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
10426 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
10427 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
10428 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
10429 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
10430 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
10431 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
10432 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
10433 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
10434 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
10435 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
10436 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
10437 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
10438 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
10439 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
10440 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
10441 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
10442 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
10443 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
10444 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
10445 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
10446 #endif
10447 	{}
10448 };
10449 
10450 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
10451 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
10452 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
10453 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
10454 	SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
10455 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
10456 	{}
10457 };
10458 
10459 static const struct hda_model_fixup alc269_fixup_models[] = {
10460 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
10461 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
10462 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
10463 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
10464 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
10465 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
10466 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
10467 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
10468 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
10469 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
10470 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10471 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
10472 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10473 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
10474 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
10475 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
10476 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
10477 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
10478 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
10479 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
10480 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
10481 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
10482 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
10483 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10484 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
10485 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
10486 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
10487 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
10488 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
10489 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
10490 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
10491 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
10492 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
10493 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
10494 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
10495 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
10496 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
10497 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
10498 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
10499 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
10500 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
10501 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
10502 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
10503 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
10504 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
10505 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
10506 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
10507 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
10508 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
10509 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
10510 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
10511 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
10512 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
10513 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
10514 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
10515 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
10516 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
10517 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
10518 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
10519 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
10520 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
10521 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
10522 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
10523 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
10524 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
10525 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
10526 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
10527 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
10528 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
10529 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10530 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
10531 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
10532 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
10533 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
10534 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
10535 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
10536 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
10537 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
10538 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
10539 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
10540 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
10541 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
10542 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
10543 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
10544 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
10545 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
10546 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
10547 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
10548 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
10549 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
10550 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
10551 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
10552 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
10553 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
10554 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
10555 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
10556 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
10557 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
10558 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
10559 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
10560 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
10561 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
10562 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
10563 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
10564 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
10565 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
10566 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
10567 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
10568 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
10569 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
10570 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
10571 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
10572 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
10573 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
10574 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
10575 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
10576 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
10577 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
10578 	{.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
10579 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
10580 	{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
10581 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
10582 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
10583 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
10584 	{.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
10585 	{}
10586 };
10587 #define ALC225_STANDARD_PINS \
10588 	{0x21, 0x04211020}
10589 
10590 #define ALC256_STANDARD_PINS \
10591 	{0x12, 0x90a60140}, \
10592 	{0x14, 0x90170110}, \
10593 	{0x21, 0x02211020}
10594 
10595 #define ALC282_STANDARD_PINS \
10596 	{0x14, 0x90170110}
10597 
10598 #define ALC290_STANDARD_PINS \
10599 	{0x12, 0x99a30130}
10600 
10601 #define ALC292_STANDARD_PINS \
10602 	{0x14, 0x90170110}, \
10603 	{0x15, 0x0221401f}
10604 
10605 #define ALC295_STANDARD_PINS \
10606 	{0x12, 0xb7a60130}, \
10607 	{0x14, 0x90170110}, \
10608 	{0x21, 0x04211020}
10609 
10610 #define ALC298_STANDARD_PINS \
10611 	{0x12, 0x90a60130}, \
10612 	{0x21, 0x03211020}
10613 
10614 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
10615 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
10616 		{0x14, 0x01014020},
10617 		{0x17, 0x90170110},
10618 		{0x18, 0x02a11030},
10619 		{0x19, 0x0181303F},
10620 		{0x21, 0x0221102f}),
10621 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
10622 		{0x12, 0x90a601c0},
10623 		{0x14, 0x90171120},
10624 		{0x21, 0x02211030}),
10625 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10626 		{0x14, 0x90170110},
10627 		{0x1b, 0x90a70130},
10628 		{0x21, 0x03211020}),
10629 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10630 		{0x1a, 0x90a70130},
10631 		{0x1b, 0x90170110},
10632 		{0x21, 0x03211020}),
10633 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10634 		ALC225_STANDARD_PINS,
10635 		{0x12, 0xb7a60130},
10636 		{0x14, 0x901701a0}),
10637 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10638 		ALC225_STANDARD_PINS,
10639 		{0x12, 0xb7a60130},
10640 		{0x14, 0x901701b0}),
10641 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10642 		ALC225_STANDARD_PINS,
10643 		{0x12, 0xb7a60150},
10644 		{0x14, 0x901701a0}),
10645 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10646 		ALC225_STANDARD_PINS,
10647 		{0x12, 0xb7a60150},
10648 		{0x14, 0x901701b0}),
10649 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10650 		ALC225_STANDARD_PINS,
10651 		{0x12, 0xb7a60130},
10652 		{0x1b, 0x90170110}),
10653 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10654 		{0x1b, 0x01111010},
10655 		{0x1e, 0x01451130},
10656 		{0x21, 0x02211020}),
10657 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
10658 		{0x12, 0x90a60140},
10659 		{0x14, 0x90170110},
10660 		{0x19, 0x02a11030},
10661 		{0x21, 0x02211020}),
10662 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10663 		{0x14, 0x90170110},
10664 		{0x19, 0x02a11030},
10665 		{0x1a, 0x02a11040},
10666 		{0x1b, 0x01014020},
10667 		{0x21, 0x0221101f}),
10668 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10669 		{0x14, 0x90170110},
10670 		{0x19, 0x02a11030},
10671 		{0x1a, 0x02a11040},
10672 		{0x1b, 0x01011020},
10673 		{0x21, 0x0221101f}),
10674 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10675 		{0x14, 0x90170110},
10676 		{0x19, 0x02a11020},
10677 		{0x1a, 0x02a11030},
10678 		{0x21, 0x0221101f}),
10679 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
10680 		{0x21, 0x02211010}),
10681 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10682 		{0x14, 0x90170110},
10683 		{0x19, 0x02a11020},
10684 		{0x21, 0x02211030}),
10685 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
10686 		{0x14, 0x90170110},
10687 		{0x21, 0x02211020}),
10688 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10689 		{0x14, 0x90170130},
10690 		{0x21, 0x02211040}),
10691 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10692 		{0x12, 0x90a60140},
10693 		{0x14, 0x90170110},
10694 		{0x21, 0x02211020}),
10695 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10696 		{0x12, 0x90a60160},
10697 		{0x14, 0x90170120},
10698 		{0x21, 0x02211030}),
10699 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10700 		{0x14, 0x90170110},
10701 		{0x1b, 0x02011020},
10702 		{0x21, 0x0221101f}),
10703 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10704 		{0x14, 0x90170110},
10705 		{0x1b, 0x01011020},
10706 		{0x21, 0x0221101f}),
10707 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10708 		{0x14, 0x90170130},
10709 		{0x1b, 0x01014020},
10710 		{0x21, 0x0221103f}),
10711 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10712 		{0x14, 0x90170130},
10713 		{0x1b, 0x01011020},
10714 		{0x21, 0x0221103f}),
10715 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10716 		{0x14, 0x90170130},
10717 		{0x1b, 0x02011020},
10718 		{0x21, 0x0221103f}),
10719 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10720 		{0x14, 0x90170150},
10721 		{0x1b, 0x02011020},
10722 		{0x21, 0x0221105f}),
10723 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10724 		{0x14, 0x90170110},
10725 		{0x1b, 0x01014020},
10726 		{0x21, 0x0221101f}),
10727 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10728 		{0x12, 0x90a60160},
10729 		{0x14, 0x90170120},
10730 		{0x17, 0x90170140},
10731 		{0x21, 0x0321102f}),
10732 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10733 		{0x12, 0x90a60160},
10734 		{0x14, 0x90170130},
10735 		{0x21, 0x02211040}),
10736 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10737 		{0x12, 0x90a60160},
10738 		{0x14, 0x90170140},
10739 		{0x21, 0x02211050}),
10740 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10741 		{0x12, 0x90a60170},
10742 		{0x14, 0x90170120},
10743 		{0x21, 0x02211030}),
10744 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10745 		{0x12, 0x90a60170},
10746 		{0x14, 0x90170130},
10747 		{0x21, 0x02211040}),
10748 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10749 		{0x12, 0x90a60170},
10750 		{0x14, 0x90171130},
10751 		{0x21, 0x02211040}),
10752 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10753 		{0x12, 0x90a60170},
10754 		{0x14, 0x90170140},
10755 		{0x21, 0x02211050}),
10756 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10757 		{0x12, 0x90a60180},
10758 		{0x14, 0x90170130},
10759 		{0x21, 0x02211040}),
10760 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10761 		{0x12, 0x90a60180},
10762 		{0x14, 0x90170120},
10763 		{0x21, 0x02211030}),
10764 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10765 		{0x1b, 0x01011020},
10766 		{0x21, 0x02211010}),
10767 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10768 		{0x14, 0x90170110},
10769 		{0x1b, 0x90a70130},
10770 		{0x21, 0x04211020}),
10771 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10772 		{0x14, 0x90170110},
10773 		{0x1b, 0x90a70130},
10774 		{0x21, 0x03211020}),
10775 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10776 		{0x12, 0x90a60130},
10777 		{0x14, 0x90170110},
10778 		{0x21, 0x03211020}),
10779 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10780 		{0x12, 0x90a60130},
10781 		{0x14, 0x90170110},
10782 		{0x21, 0x04211020}),
10783 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10784 		{0x1a, 0x90a70130},
10785 		{0x1b, 0x90170110},
10786 		{0x21, 0x03211020}),
10787        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10788 		{0x14, 0x90170110},
10789 		{0x19, 0x02a11020},
10790 		{0x21, 0x0221101f}),
10791        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
10792 		{0x17, 0x90170110},
10793 		{0x19, 0x03a11030},
10794 		{0x21, 0x03211020}),
10795 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10796 		{0x12, 0x90a60130},
10797 		{0x14, 0x90170110},
10798 		{0x15, 0x0421101f},
10799 		{0x1a, 0x04a11020}),
10800 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10801 		{0x12, 0x90a60140},
10802 		{0x14, 0x90170110},
10803 		{0x15, 0x0421101f},
10804 		{0x18, 0x02811030},
10805 		{0x1a, 0x04a1103f},
10806 		{0x1b, 0x02011020}),
10807 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10808 		ALC282_STANDARD_PINS,
10809 		{0x12, 0x99a30130},
10810 		{0x19, 0x03a11020},
10811 		{0x21, 0x0321101f}),
10812 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10813 		ALC282_STANDARD_PINS,
10814 		{0x12, 0x99a30130},
10815 		{0x19, 0x03a11020},
10816 		{0x21, 0x03211040}),
10817 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10818 		ALC282_STANDARD_PINS,
10819 		{0x12, 0x99a30130},
10820 		{0x19, 0x03a11030},
10821 		{0x21, 0x03211020}),
10822 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10823 		ALC282_STANDARD_PINS,
10824 		{0x12, 0x99a30130},
10825 		{0x19, 0x04a11020},
10826 		{0x21, 0x0421101f}),
10827 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
10828 		ALC282_STANDARD_PINS,
10829 		{0x12, 0x90a60140},
10830 		{0x19, 0x04a11030},
10831 		{0x21, 0x04211020}),
10832 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10833 		ALC282_STANDARD_PINS,
10834 		{0x12, 0x90a609c0},
10835 		{0x18, 0x03a11830},
10836 		{0x19, 0x04a19831},
10837 		{0x1a, 0x0481303f},
10838 		{0x1b, 0x04211020},
10839 		{0x21, 0x0321101f}),
10840 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10841 		ALC282_STANDARD_PINS,
10842 		{0x12, 0x90a60940},
10843 		{0x18, 0x03a11830},
10844 		{0x19, 0x04a19831},
10845 		{0x1a, 0x0481303f},
10846 		{0x1b, 0x04211020},
10847 		{0x21, 0x0321101f}),
10848 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10849 		ALC282_STANDARD_PINS,
10850 		{0x12, 0x90a60130},
10851 		{0x21, 0x0321101f}),
10852 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10853 		{0x12, 0x90a60160},
10854 		{0x14, 0x90170120},
10855 		{0x21, 0x02211030}),
10856 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10857 		ALC282_STANDARD_PINS,
10858 		{0x12, 0x90a60130},
10859 		{0x19, 0x03a11020},
10860 		{0x21, 0x0321101f}),
10861 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10862 		{0x12, 0x90a60130},
10863 		{0x14, 0x90170110},
10864 		{0x19, 0x04a11040},
10865 		{0x21, 0x04211020}),
10866 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10867 		{0x14, 0x90170110},
10868 		{0x19, 0x04a11040},
10869 		{0x1d, 0x40600001},
10870 		{0x21, 0x04211020}),
10871 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10872 		{0x14, 0x90170110},
10873 		{0x19, 0x04a11040},
10874 		{0x21, 0x04211020}),
10875 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10876 		{0x14, 0x90170110},
10877 		{0x17, 0x90170111},
10878 		{0x19, 0x03a11030},
10879 		{0x21, 0x03211020}),
10880 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10881 		{0x17, 0x90170110},
10882 		{0x19, 0x03a11030},
10883 		{0x21, 0x03211020}),
10884 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10885 		{0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
10886 		{0x19, 0x04a11040},
10887 		{0x21, 0x04211020}),
10888 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
10889 		{0x12, 0x90a60130},
10890 		{0x17, 0x90170110},
10891 		{0x21, 0x02211020}),
10892 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
10893 		{0x12, 0x90a60120},
10894 		{0x14, 0x90170110},
10895 		{0x21, 0x0321101f}),
10896 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10897 		ALC290_STANDARD_PINS,
10898 		{0x15, 0x04211040},
10899 		{0x18, 0x90170112},
10900 		{0x1a, 0x04a11020}),
10901 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10902 		ALC290_STANDARD_PINS,
10903 		{0x15, 0x04211040},
10904 		{0x18, 0x90170110},
10905 		{0x1a, 0x04a11020}),
10906 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10907 		ALC290_STANDARD_PINS,
10908 		{0x15, 0x0421101f},
10909 		{0x1a, 0x04a11020}),
10910 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10911 		ALC290_STANDARD_PINS,
10912 		{0x15, 0x04211020},
10913 		{0x1a, 0x04a11040}),
10914 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10915 		ALC290_STANDARD_PINS,
10916 		{0x14, 0x90170110},
10917 		{0x15, 0x04211020},
10918 		{0x1a, 0x04a11040}),
10919 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10920 		ALC290_STANDARD_PINS,
10921 		{0x14, 0x90170110},
10922 		{0x15, 0x04211020},
10923 		{0x1a, 0x04a11020}),
10924 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10925 		ALC290_STANDARD_PINS,
10926 		{0x14, 0x90170110},
10927 		{0x15, 0x0421101f},
10928 		{0x1a, 0x04a11020}),
10929 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10930 		ALC292_STANDARD_PINS,
10931 		{0x12, 0x90a60140},
10932 		{0x16, 0x01014020},
10933 		{0x19, 0x01a19030}),
10934 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10935 		ALC292_STANDARD_PINS,
10936 		{0x12, 0x90a60140},
10937 		{0x16, 0x01014020},
10938 		{0x18, 0x02a19031},
10939 		{0x19, 0x01a1903e}),
10940 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
10941 		ALC292_STANDARD_PINS,
10942 		{0x12, 0x90a60140}),
10943 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10944 		ALC292_STANDARD_PINS,
10945 		{0x13, 0x90a60140},
10946 		{0x16, 0x21014020},
10947 		{0x19, 0x21a19030}),
10948 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10949 		ALC292_STANDARD_PINS,
10950 		{0x13, 0x90a60140}),
10951 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
10952 		{0x17, 0x90170110},
10953 		{0x21, 0x04211020}),
10954 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
10955 		{0x14, 0x90170110},
10956 		{0x1b, 0x90a70130},
10957 		{0x21, 0x04211020}),
10958 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10959 		{0x12, 0x90a60130},
10960 		{0x17, 0x90170110},
10961 		{0x21, 0x03211020}),
10962 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10963 		{0x12, 0x90a60130},
10964 		{0x17, 0x90170110},
10965 		{0x21, 0x04211020}),
10966 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10967 		{0x12, 0x90a60130},
10968 		{0x17, 0x90170110},
10969 		{0x21, 0x03211020}),
10970 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10971 		{0x12, 0x90a60120},
10972 		{0x17, 0x90170110},
10973 		{0x21, 0x04211030}),
10974 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10975 		{0x12, 0x90a60130},
10976 		{0x17, 0x90170110},
10977 		{0x21, 0x03211020}),
10978 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10979 		{0x12, 0x90a60130},
10980 		{0x17, 0x90170110},
10981 		{0x21, 0x03211020}),
10982 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10983 		ALC298_STANDARD_PINS,
10984 		{0x17, 0x90170110}),
10985 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10986 		ALC298_STANDARD_PINS,
10987 		{0x17, 0x90170140}),
10988 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10989 		ALC298_STANDARD_PINS,
10990 		{0x17, 0x90170150}),
10991 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
10992 		{0x12, 0xb7a60140},
10993 		{0x13, 0xb7a60150},
10994 		{0x17, 0x90170110},
10995 		{0x1a, 0x03011020},
10996 		{0x21, 0x03211030}),
10997 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
10998 		{0x12, 0xb7a60140},
10999 		{0x17, 0x90170110},
11000 		{0x1a, 0x03a11030},
11001 		{0x21, 0x03211020}),
11002 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11003 		ALC225_STANDARD_PINS,
11004 		{0x12, 0xb7a60130},
11005 		{0x17, 0x90170110}),
11006 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11007 		{0x14, 0x01014010},
11008 		{0x17, 0x90170120},
11009 		{0x18, 0x02a11030},
11010 		{0x19, 0x02a1103f},
11011 		{0x21, 0x0221101f}),
11012 	{}
11013 };
11014 
11015 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11016  * more machines, don't need to match all valid pins, just need to match
11017  * all the pins defined in the tbl. Just because of this reason, it is possible
11018  * that a single machine matches multiple tbls, so there is one limitation:
11019  *   at most one tbl is allowed to define for the same vendor and same codec
11020  */
11021 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11022 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11023 		{0x19, 0x40000000}),
11024 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11025 		{0x19, 0x40000000},
11026 		{0x1b, 0x40000000}),
11027 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11028 		{0x19, 0x40000000},
11029 		{0x1b, 0x40000000}),
11030 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11031 		{0x19, 0x40000000},
11032 		{0x1a, 0x40000000}),
11033 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11034 		{0x19, 0x40000000},
11035 		{0x1a, 0x40000000}),
11036 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
11037 		{0x19, 0x40000000},
11038 		{0x1a, 0x40000000}),
11039 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11040 		{0x19, 0x40000000}),
11041 	{}
11042 };
11043 
alc269_fill_coef(struct hda_codec * codec)11044 static void alc269_fill_coef(struct hda_codec *codec)
11045 {
11046 	struct alc_spec *spec = codec->spec;
11047 	int val;
11048 
11049 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11050 		return;
11051 
11052 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11053 		alc_write_coef_idx(codec, 0xf, 0x960b);
11054 		alc_write_coef_idx(codec, 0xe, 0x8817);
11055 	}
11056 
11057 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11058 		alc_write_coef_idx(codec, 0xf, 0x960b);
11059 		alc_write_coef_idx(codec, 0xe, 0x8814);
11060 	}
11061 
11062 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11063 		/* Power up output pin */
11064 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11065 	}
11066 
11067 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11068 		val = alc_read_coef_idx(codec, 0xd);
11069 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11070 			/* Capless ramp up clock control */
11071 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
11072 		}
11073 		val = alc_read_coef_idx(codec, 0x17);
11074 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11075 			/* Class D power on reset */
11076 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
11077 		}
11078 	}
11079 
11080 	/* HP */
11081 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11082 }
11083 
11084 /*
11085  */
patch_alc269(struct hda_codec * codec)11086 static int patch_alc269(struct hda_codec *codec)
11087 {
11088 	struct alc_spec *spec;
11089 	int err;
11090 
11091 	err = alc_alloc_spec(codec, 0x0b);
11092 	if (err < 0)
11093 		return err;
11094 
11095 	spec = codec->spec;
11096 	spec->gen.shared_mic_vref_pin = 0x18;
11097 	codec->power_save_node = 0;
11098 	spec->en_3kpull_low = true;
11099 
11100 #ifdef CONFIG_PM
11101 	codec->patch_ops.suspend = alc269_suspend;
11102 	codec->patch_ops.resume = alc269_resume;
11103 #endif
11104 	spec->shutup = alc_default_shutup;
11105 	spec->init_hook = alc_default_init;
11106 
11107 	switch (codec->core.vendor_id) {
11108 	case 0x10ec0269:
11109 		spec->codec_variant = ALC269_TYPE_ALC269VA;
11110 		switch (alc_get_coef0(codec) & 0x00f0) {
11111 		case 0x0010:
11112 			if (codec->bus->pci &&
11113 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
11114 			    spec->cdefine.platform_type == 1)
11115 				err = alc_codec_rename(codec, "ALC271X");
11116 			spec->codec_variant = ALC269_TYPE_ALC269VB;
11117 			break;
11118 		case 0x0020:
11119 			if (codec->bus->pci &&
11120 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
11121 			    codec->bus->pci->subsystem_device == 0x21f3)
11122 				err = alc_codec_rename(codec, "ALC3202");
11123 			spec->codec_variant = ALC269_TYPE_ALC269VC;
11124 			break;
11125 		case 0x0030:
11126 			spec->codec_variant = ALC269_TYPE_ALC269VD;
11127 			break;
11128 		default:
11129 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
11130 		}
11131 		if (err < 0)
11132 			goto error;
11133 		spec->shutup = alc269_shutup;
11134 		spec->init_hook = alc269_fill_coef;
11135 		alc269_fill_coef(codec);
11136 		break;
11137 
11138 	case 0x10ec0280:
11139 	case 0x10ec0290:
11140 		spec->codec_variant = ALC269_TYPE_ALC280;
11141 		break;
11142 	case 0x10ec0282:
11143 		spec->codec_variant = ALC269_TYPE_ALC282;
11144 		spec->shutup = alc282_shutup;
11145 		spec->init_hook = alc282_init;
11146 		break;
11147 	case 0x10ec0233:
11148 	case 0x10ec0283:
11149 		spec->codec_variant = ALC269_TYPE_ALC283;
11150 		spec->shutup = alc283_shutup;
11151 		spec->init_hook = alc283_init;
11152 		break;
11153 	case 0x10ec0284:
11154 	case 0x10ec0292:
11155 		spec->codec_variant = ALC269_TYPE_ALC284;
11156 		break;
11157 	case 0x10ec0293:
11158 		spec->codec_variant = ALC269_TYPE_ALC293;
11159 		break;
11160 	case 0x10ec0286:
11161 	case 0x10ec0288:
11162 		spec->codec_variant = ALC269_TYPE_ALC286;
11163 		break;
11164 	case 0x10ec0298:
11165 		spec->codec_variant = ALC269_TYPE_ALC298;
11166 		break;
11167 	case 0x10ec0235:
11168 	case 0x10ec0255:
11169 		spec->codec_variant = ALC269_TYPE_ALC255;
11170 		spec->shutup = alc256_shutup;
11171 		spec->init_hook = alc256_init;
11172 		break;
11173 	case 0x10ec0230:
11174 	case 0x10ec0236:
11175 	case 0x10ec0256:
11176 	case 0x19e58326:
11177 		spec->codec_variant = ALC269_TYPE_ALC256;
11178 		spec->shutup = alc256_shutup;
11179 		spec->init_hook = alc256_init;
11180 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
11181 		if (codec->core.vendor_id == 0x10ec0236 &&
11182 		    codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
11183 			spec->en_3kpull_low = false;
11184 		break;
11185 	case 0x10ec0257:
11186 		spec->codec_variant = ALC269_TYPE_ALC257;
11187 		spec->shutup = alc256_shutup;
11188 		spec->init_hook = alc256_init;
11189 		spec->gen.mixer_nid = 0;
11190 		spec->en_3kpull_low = false;
11191 		break;
11192 	case 0x10ec0215:
11193 	case 0x10ec0245:
11194 	case 0x10ec0285:
11195 	case 0x10ec0289:
11196 		if (alc_get_coef0(codec) & 0x0010)
11197 			spec->codec_variant = ALC269_TYPE_ALC245;
11198 		else
11199 			spec->codec_variant = ALC269_TYPE_ALC215;
11200 		spec->shutup = alc225_shutup;
11201 		spec->init_hook = alc225_init;
11202 		spec->gen.mixer_nid = 0;
11203 		break;
11204 	case 0x10ec0225:
11205 	case 0x10ec0295:
11206 	case 0x10ec0299:
11207 		spec->codec_variant = ALC269_TYPE_ALC225;
11208 		spec->shutup = alc225_shutup;
11209 		spec->init_hook = alc225_init;
11210 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
11211 		break;
11212 	case 0x10ec0287:
11213 		spec->codec_variant = ALC269_TYPE_ALC287;
11214 		spec->shutup = alc225_shutup;
11215 		spec->init_hook = alc225_init;
11216 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
11217 		break;
11218 	case 0x10ec0234:
11219 	case 0x10ec0274:
11220 	case 0x10ec0294:
11221 		spec->codec_variant = ALC269_TYPE_ALC294;
11222 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
11223 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
11224 		spec->init_hook = alc294_init;
11225 		break;
11226 	case 0x10ec0300:
11227 		spec->codec_variant = ALC269_TYPE_ALC300;
11228 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
11229 		break;
11230 	case 0x10ec0623:
11231 		spec->codec_variant = ALC269_TYPE_ALC623;
11232 		break;
11233 	case 0x10ec0700:
11234 	case 0x10ec0701:
11235 	case 0x10ec0703:
11236 	case 0x10ec0711:
11237 		spec->codec_variant = ALC269_TYPE_ALC700;
11238 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
11239 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
11240 		spec->init_hook = alc294_init;
11241 		break;
11242 
11243 	}
11244 
11245 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
11246 		spec->has_alc5505_dsp = 1;
11247 		spec->init_hook = alc5505_dsp_init;
11248 	}
11249 
11250 	alc_pre_init(codec);
11251 
11252 	snd_hda_pick_fixup(codec, alc269_fixup_models,
11253 		       alc269_fixup_tbl, alc269_fixups);
11254 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
11255 	 * the quirk breaks the latter (bko#214101).
11256 	 * Clear the wrong entry.
11257 	 */
11258 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
11259 	    codec->core.vendor_id == 0x10ec0294) {
11260 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
11261 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
11262 	}
11263 
11264 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
11265 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
11266 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
11267 			   alc269_fixups);
11268 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11269 
11270 	alc_auto_parse_customize_define(codec);
11271 
11272 	if (has_cdefine_beep(codec))
11273 		spec->gen.beep_nid = 0x01;
11274 
11275 	/* automatic parse from the BIOS config */
11276 	err = alc269_parse_auto_config(codec);
11277 	if (err < 0)
11278 		goto error;
11279 
11280 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
11281 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
11282 		if (err < 0)
11283 			goto error;
11284 	}
11285 
11286 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11287 
11288 	return 0;
11289 
11290  error:
11291 	alc_free(codec);
11292 	return err;
11293 }
11294 
11295 /*
11296  * ALC861
11297  */
11298 
alc861_parse_auto_config(struct hda_codec * codec)11299 static int alc861_parse_auto_config(struct hda_codec *codec)
11300 {
11301 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11302 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
11303 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
11304 }
11305 
11306 /* Pin config fixes */
11307 enum {
11308 	ALC861_FIXUP_FSC_AMILO_PI1505,
11309 	ALC861_FIXUP_AMP_VREF_0F,
11310 	ALC861_FIXUP_NO_JACK_DETECT,
11311 	ALC861_FIXUP_ASUS_A6RP,
11312 	ALC660_FIXUP_ASUS_W7J,
11313 };
11314 
11315 /* 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)11316 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
11317 			const struct hda_fixup *fix, int action)
11318 {
11319 	struct alc_spec *spec = codec->spec;
11320 	unsigned int val;
11321 
11322 	if (action != HDA_FIXUP_ACT_INIT)
11323 		return;
11324 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
11325 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
11326 		val |= AC_PINCTL_IN_EN;
11327 	val |= AC_PINCTL_VREF_50;
11328 	snd_hda_set_pin_ctl(codec, 0x0f, val);
11329 	spec->gen.keep_vref_in_automute = 1;
11330 }
11331 
11332 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)11333 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
11334 				     const struct hda_fixup *fix, int action)
11335 {
11336 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11337 		codec->no_jack_detect = 1;
11338 }
11339 
11340 static const struct hda_fixup alc861_fixups[] = {
11341 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
11342 		.type = HDA_FIXUP_PINS,
11343 		.v.pins = (const struct hda_pintbl[]) {
11344 			{ 0x0b, 0x0221101f }, /* HP */
11345 			{ 0x0f, 0x90170310 }, /* speaker */
11346 			{ }
11347 		}
11348 	},
11349 	[ALC861_FIXUP_AMP_VREF_0F] = {
11350 		.type = HDA_FIXUP_FUNC,
11351 		.v.func = alc861_fixup_asus_amp_vref_0f,
11352 	},
11353 	[ALC861_FIXUP_NO_JACK_DETECT] = {
11354 		.type = HDA_FIXUP_FUNC,
11355 		.v.func = alc_fixup_no_jack_detect,
11356 	},
11357 	[ALC861_FIXUP_ASUS_A6RP] = {
11358 		.type = HDA_FIXUP_FUNC,
11359 		.v.func = alc861_fixup_asus_amp_vref_0f,
11360 		.chained = true,
11361 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
11362 	},
11363 	[ALC660_FIXUP_ASUS_W7J] = {
11364 		.type = HDA_FIXUP_VERBS,
11365 		.v.verbs = (const struct hda_verb[]) {
11366 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
11367 			 * for enabling outputs
11368 			 */
11369 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11370 			{ }
11371 		},
11372 	}
11373 };
11374 
11375 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
11376 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
11377 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
11378 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
11379 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
11380 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
11381 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
11382 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
11383 	{}
11384 };
11385 
11386 /*
11387  */
patch_alc861(struct hda_codec * codec)11388 static int patch_alc861(struct hda_codec *codec)
11389 {
11390 	struct alc_spec *spec;
11391 	int err;
11392 
11393 	err = alc_alloc_spec(codec, 0x15);
11394 	if (err < 0)
11395 		return err;
11396 
11397 	spec = codec->spec;
11398 	if (has_cdefine_beep(codec))
11399 		spec->gen.beep_nid = 0x23;
11400 
11401 #ifdef CONFIG_PM
11402 	spec->power_hook = alc_power_eapd;
11403 #endif
11404 
11405 	alc_pre_init(codec);
11406 
11407 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
11408 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11409 
11410 	/* automatic parse from the BIOS config */
11411 	err = alc861_parse_auto_config(codec);
11412 	if (err < 0)
11413 		goto error;
11414 
11415 	if (!spec->gen.no_analog) {
11416 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
11417 		if (err < 0)
11418 			goto error;
11419 	}
11420 
11421 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11422 
11423 	return 0;
11424 
11425  error:
11426 	alc_free(codec);
11427 	return err;
11428 }
11429 
11430 /*
11431  * ALC861-VD support
11432  *
11433  * Based on ALC882
11434  *
11435  * In addition, an independent DAC
11436  */
alc861vd_parse_auto_config(struct hda_codec * codec)11437 static int alc861vd_parse_auto_config(struct hda_codec *codec)
11438 {
11439 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
11440 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11441 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
11442 }
11443 
11444 enum {
11445 	ALC660VD_FIX_ASUS_GPIO1,
11446 	ALC861VD_FIX_DALLAS,
11447 };
11448 
11449 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)11450 static void alc861vd_fixup_dallas(struct hda_codec *codec,
11451 				  const struct hda_fixup *fix, int action)
11452 {
11453 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11454 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
11455 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
11456 	}
11457 }
11458 
11459 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11460 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
11461 				      const struct hda_fixup *fix, int action)
11462 {
11463 	struct alc_spec *spec = codec->spec;
11464 
11465 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11466 		spec->gpio_mask |= 0x02;
11467 	alc_fixup_gpio(codec, action, 0x01);
11468 }
11469 
11470 static const struct hda_fixup alc861vd_fixups[] = {
11471 	[ALC660VD_FIX_ASUS_GPIO1] = {
11472 		.type = HDA_FIXUP_FUNC,
11473 		.v.func = alc660vd_fixup_asus_gpio1,
11474 	},
11475 	[ALC861VD_FIX_DALLAS] = {
11476 		.type = HDA_FIXUP_FUNC,
11477 		.v.func = alc861vd_fixup_dallas,
11478 	},
11479 };
11480 
11481 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
11482 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
11483 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
11484 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
11485 	{}
11486 };
11487 
11488 /*
11489  */
patch_alc861vd(struct hda_codec * codec)11490 static int patch_alc861vd(struct hda_codec *codec)
11491 {
11492 	struct alc_spec *spec;
11493 	int err;
11494 
11495 	err = alc_alloc_spec(codec, 0x0b);
11496 	if (err < 0)
11497 		return err;
11498 
11499 	spec = codec->spec;
11500 	if (has_cdefine_beep(codec))
11501 		spec->gen.beep_nid = 0x23;
11502 
11503 	spec->shutup = alc_eapd_shutup;
11504 
11505 	alc_pre_init(codec);
11506 
11507 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
11508 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11509 
11510 	/* automatic parse from the BIOS config */
11511 	err = alc861vd_parse_auto_config(codec);
11512 	if (err < 0)
11513 		goto error;
11514 
11515 	if (!spec->gen.no_analog) {
11516 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11517 		if (err < 0)
11518 			goto error;
11519 	}
11520 
11521 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11522 
11523 	return 0;
11524 
11525  error:
11526 	alc_free(codec);
11527 	return err;
11528 }
11529 
11530 /*
11531  * ALC662 support
11532  *
11533  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11534  * configuration.  Each pin widget can choose any input DACs and a mixer.
11535  * Each ADC is connected from a mixer of all inputs.  This makes possible
11536  * 6-channel independent captures.
11537  *
11538  * In addition, an independent DAC for the multi-playback (not used in this
11539  * driver yet).
11540  */
11541 
11542 /*
11543  * BIOS auto configuration
11544  */
11545 
alc662_parse_auto_config(struct hda_codec * codec)11546 static int alc662_parse_auto_config(struct hda_codec *codec)
11547 {
11548 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11549 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
11550 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11551 	const hda_nid_t *ssids;
11552 
11553 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
11554 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
11555 	    codec->core.vendor_id == 0x10ec0671)
11556 		ssids = alc663_ssids;
11557 	else
11558 		ssids = alc662_ssids;
11559 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
11560 }
11561 
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)11562 static void alc272_fixup_mario(struct hda_codec *codec,
11563 			       const struct hda_fixup *fix, int action)
11564 {
11565 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
11566 		return;
11567 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
11568 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
11569 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
11570 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11571 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
11572 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
11573 }
11574 
11575 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
11576 	{ .channels = 2,
11577 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
11578 	{ .channels = 4,
11579 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
11580 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
11581 	{ }
11582 };
11583 
11584 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)11585 static void alc_fixup_bass_chmap(struct hda_codec *codec,
11586 				    const struct hda_fixup *fix, int action)
11587 {
11588 	if (action == HDA_FIXUP_ACT_BUILD) {
11589 		struct alc_spec *spec = codec->spec;
11590 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
11591 	}
11592 }
11593 
11594 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)11595 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
11596 					  hda_nid_t nid,
11597 					  unsigned int power_state)
11598 {
11599 	struct alc_spec *spec = codec->spec;
11600 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
11601 		return AC_PWRST_D0;
11602 	return power_state;
11603 }
11604 
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11605 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
11606 				   const struct hda_fixup *fix, int action)
11607 {
11608 	struct alc_spec *spec = codec->spec;
11609 
11610 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
11611 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11612 		spec->mute_led_polarity = 1;
11613 		codec->power_filter = gpio_led_power_filter;
11614 	}
11615 }
11616 
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11617 static void alc662_usi_automute_hook(struct hda_codec *codec,
11618 					 struct hda_jack_callback *jack)
11619 {
11620 	struct alc_spec *spec = codec->spec;
11621 	int vref;
11622 	msleep(200);
11623 	snd_hda_gen_hp_automute(codec, jack);
11624 
11625 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
11626 	msleep(100);
11627 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11628 			    vref);
11629 }
11630 
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11631 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
11632 				     const struct hda_fixup *fix, int action)
11633 {
11634 	struct alc_spec *spec = codec->spec;
11635 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11636 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11637 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
11638 	}
11639 }
11640 
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)11641 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
11642 					struct hda_jack_callback *cb)
11643 {
11644 	/* surround speakers at 0x1b already get muted automatically when
11645 	 * headphones are plugged in, but we have to mute/unmute the remaining
11646 	 * channels manually:
11647 	 * 0x15 - front left/front right
11648 	 * 0x18 - front center/ LFE
11649 	 */
11650 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
11651 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
11652 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
11653 	} else {
11654 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
11655 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
11656 	}
11657 }
11658 
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)11659 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
11660 					const struct hda_fixup *fix, int action)
11661 {
11662     /* Pin 0x1b: shared headphones jack and surround speakers */
11663 	if (!is_jack_detectable(codec, 0x1b))
11664 		return;
11665 
11666 	switch (action) {
11667 	case HDA_FIXUP_ACT_PRE_PROBE:
11668 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
11669 				alc662_aspire_ethos_mute_speakers);
11670 		/* subwoofer needs an extra GPIO setting to become audible */
11671 		alc_setup_gpio(codec, 0x02);
11672 		break;
11673 	case HDA_FIXUP_ACT_INIT:
11674 		/* Make sure to start in a correct state, i.e. if
11675 		 * headphones have been plugged in before powering up the system
11676 		 */
11677 		alc662_aspire_ethos_mute_speakers(codec, NULL);
11678 		break;
11679 	}
11680 }
11681 
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)11682 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
11683 					     const struct hda_fixup *fix, int action)
11684 {
11685 	struct alc_spec *spec = codec->spec;
11686 
11687 	static const struct hda_pintbl pincfgs[] = {
11688 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
11689 		{ 0x1b, 0x0181304f },
11690 		{ }
11691 	};
11692 
11693 	switch (action) {
11694 	case HDA_FIXUP_ACT_PRE_PROBE:
11695 		spec->gen.mixer_nid = 0;
11696 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11697 		snd_hda_apply_pincfgs(codec, pincfgs);
11698 		break;
11699 	case HDA_FIXUP_ACT_INIT:
11700 		alc_write_coef_idx(codec, 0x19, 0xa054);
11701 		break;
11702 	}
11703 }
11704 
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11705 static void alc897_hp_automute_hook(struct hda_codec *codec,
11706 					 struct hda_jack_callback *jack)
11707 {
11708 	struct alc_spec *spec = codec->spec;
11709 	int vref;
11710 
11711 	snd_hda_gen_hp_automute(codec, jack);
11712 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
11713 	snd_hda_set_pin_ctl(codec, 0x1b, vref);
11714 }
11715 
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11716 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
11717 				     const struct hda_fixup *fix, int action)
11718 {
11719 	struct alc_spec *spec = codec->spec;
11720 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11721 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11722 		spec->no_shutup_pins = 1;
11723 	}
11724 	if (action == HDA_FIXUP_ACT_PROBE) {
11725 		snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
11726 	}
11727 }
11728 
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)11729 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
11730 				     const struct hda_fixup *fix, int action)
11731 {
11732 	struct alc_spec *spec = codec->spec;
11733 
11734 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11735 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11736 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11737 	}
11738 }
11739 
11740 static const struct coef_fw alc668_coefs[] = {
11741 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
11742 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
11743 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
11744 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
11745 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
11746 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
11747 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
11748 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
11749 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
11750 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
11751 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
11752 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
11753 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
11754 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
11755 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
11756 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
11757 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
11758 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
11759 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
11760 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
11761 	{}
11762 };
11763 
alc668_restore_default_value(struct hda_codec * codec)11764 static void alc668_restore_default_value(struct hda_codec *codec)
11765 {
11766 	alc_process_coef_fw(codec, alc668_coefs);
11767 }
11768 
11769 enum {
11770 	ALC662_FIXUP_ASPIRE,
11771 	ALC662_FIXUP_LED_GPIO1,
11772 	ALC662_FIXUP_IDEAPAD,
11773 	ALC272_FIXUP_MARIO,
11774 	ALC662_FIXUP_CZC_ET26,
11775 	ALC662_FIXUP_CZC_P10T,
11776 	ALC662_FIXUP_SKU_IGNORE,
11777 	ALC662_FIXUP_HP_RP5800,
11778 	ALC662_FIXUP_ASUS_MODE1,
11779 	ALC662_FIXUP_ASUS_MODE2,
11780 	ALC662_FIXUP_ASUS_MODE3,
11781 	ALC662_FIXUP_ASUS_MODE4,
11782 	ALC662_FIXUP_ASUS_MODE5,
11783 	ALC662_FIXUP_ASUS_MODE6,
11784 	ALC662_FIXUP_ASUS_MODE7,
11785 	ALC662_FIXUP_ASUS_MODE8,
11786 	ALC662_FIXUP_NO_JACK_DETECT,
11787 	ALC662_FIXUP_ZOTAC_Z68,
11788 	ALC662_FIXUP_INV_DMIC,
11789 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11790 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
11791 	ALC662_FIXUP_HEADSET_MODE,
11792 	ALC668_FIXUP_HEADSET_MODE,
11793 	ALC662_FIXUP_BASS_MODE4_CHMAP,
11794 	ALC662_FIXUP_BASS_16,
11795 	ALC662_FIXUP_BASS_1A,
11796 	ALC662_FIXUP_BASS_CHMAP,
11797 	ALC668_FIXUP_AUTO_MUTE,
11798 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
11799 	ALC668_FIXUP_DELL_XPS13,
11800 	ALC662_FIXUP_ASUS_Nx50,
11801 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11802 	ALC668_FIXUP_ASUS_Nx51,
11803 	ALC668_FIXUP_MIC_COEF,
11804 	ALC668_FIXUP_ASUS_G751,
11805 	ALC891_FIXUP_HEADSET_MODE,
11806 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11807 	ALC662_FIXUP_ACER_VERITON,
11808 	ALC892_FIXUP_ASROCK_MOBO,
11809 	ALC662_FIXUP_USI_FUNC,
11810 	ALC662_FIXUP_USI_HEADSET_MODE,
11811 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
11812 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
11813 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
11814 	ALC671_FIXUP_HP_HEADSET_MIC2,
11815 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
11816 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
11817 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
11818 	ALC668_FIXUP_HEADSET_MIC,
11819 	ALC668_FIXUP_MIC_DET_COEF,
11820 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
11821 	ALC897_FIXUP_HEADSET_MIC_PIN,
11822 	ALC897_FIXUP_HP_HSMIC_VERB,
11823 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
11824 	ALC897_FIXUP_HEADSET_MIC_PIN2,
11825 	ALC897_FIXUP_UNIS_H3C_X500S,
11826 	ALC897_FIXUP_HEADSET_MIC_PIN3,
11827 };
11828 
11829 static const struct hda_fixup alc662_fixups[] = {
11830 	[ALC662_FIXUP_ASPIRE] = {
11831 		.type = HDA_FIXUP_PINS,
11832 		.v.pins = (const struct hda_pintbl[]) {
11833 			{ 0x15, 0x99130112 }, /* subwoofer */
11834 			{ }
11835 		}
11836 	},
11837 	[ALC662_FIXUP_LED_GPIO1] = {
11838 		.type = HDA_FIXUP_FUNC,
11839 		.v.func = alc662_fixup_led_gpio1,
11840 	},
11841 	[ALC662_FIXUP_IDEAPAD] = {
11842 		.type = HDA_FIXUP_PINS,
11843 		.v.pins = (const struct hda_pintbl[]) {
11844 			{ 0x17, 0x99130112 }, /* subwoofer */
11845 			{ }
11846 		},
11847 		.chained = true,
11848 		.chain_id = ALC662_FIXUP_LED_GPIO1,
11849 	},
11850 	[ALC272_FIXUP_MARIO] = {
11851 		.type = HDA_FIXUP_FUNC,
11852 		.v.func = alc272_fixup_mario,
11853 	},
11854 	[ALC662_FIXUP_CZC_ET26] = {
11855 		.type = HDA_FIXUP_PINS,
11856 		.v.pins = (const struct hda_pintbl[]) {
11857 			{0x12, 0x403cc000},
11858 			{0x14, 0x90170110}, /* speaker */
11859 			{0x15, 0x411111f0},
11860 			{0x16, 0x411111f0},
11861 			{0x18, 0x01a19030}, /* mic */
11862 			{0x19, 0x90a7013f}, /* int-mic */
11863 			{0x1a, 0x01014020},
11864 			{0x1b, 0x0121401f},
11865 			{0x1c, 0x411111f0},
11866 			{0x1d, 0x411111f0},
11867 			{0x1e, 0x40478e35},
11868 			{}
11869 		},
11870 		.chained = true,
11871 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11872 	},
11873 	[ALC662_FIXUP_CZC_P10T] = {
11874 		.type = HDA_FIXUP_VERBS,
11875 		.v.verbs = (const struct hda_verb[]) {
11876 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
11877 			{}
11878 		}
11879 	},
11880 	[ALC662_FIXUP_SKU_IGNORE] = {
11881 		.type = HDA_FIXUP_FUNC,
11882 		.v.func = alc_fixup_sku_ignore,
11883 	},
11884 	[ALC662_FIXUP_HP_RP5800] = {
11885 		.type = HDA_FIXUP_PINS,
11886 		.v.pins = (const struct hda_pintbl[]) {
11887 			{ 0x14, 0x0221201f }, /* HP out */
11888 			{ }
11889 		},
11890 		.chained = true,
11891 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11892 	},
11893 	[ALC662_FIXUP_ASUS_MODE1] = {
11894 		.type = HDA_FIXUP_PINS,
11895 		.v.pins = (const struct hda_pintbl[]) {
11896 			{ 0x14, 0x99130110 }, /* speaker */
11897 			{ 0x18, 0x01a19c20 }, /* mic */
11898 			{ 0x19, 0x99a3092f }, /* int-mic */
11899 			{ 0x21, 0x0121401f }, /* HP out */
11900 			{ }
11901 		},
11902 		.chained = true,
11903 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11904 	},
11905 	[ALC662_FIXUP_ASUS_MODE2] = {
11906 		.type = HDA_FIXUP_PINS,
11907 		.v.pins = (const struct hda_pintbl[]) {
11908 			{ 0x14, 0x99130110 }, /* speaker */
11909 			{ 0x18, 0x01a19820 }, /* mic */
11910 			{ 0x19, 0x99a3092f }, /* int-mic */
11911 			{ 0x1b, 0x0121401f }, /* HP out */
11912 			{ }
11913 		},
11914 		.chained = true,
11915 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11916 	},
11917 	[ALC662_FIXUP_ASUS_MODE3] = {
11918 		.type = HDA_FIXUP_PINS,
11919 		.v.pins = (const struct hda_pintbl[]) {
11920 			{ 0x14, 0x99130110 }, /* speaker */
11921 			{ 0x15, 0x0121441f }, /* HP */
11922 			{ 0x18, 0x01a19840 }, /* mic */
11923 			{ 0x19, 0x99a3094f }, /* int-mic */
11924 			{ 0x21, 0x01211420 }, /* HP2 */
11925 			{ }
11926 		},
11927 		.chained = true,
11928 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11929 	},
11930 	[ALC662_FIXUP_ASUS_MODE4] = {
11931 		.type = HDA_FIXUP_PINS,
11932 		.v.pins = (const struct hda_pintbl[]) {
11933 			{ 0x14, 0x99130110 }, /* speaker */
11934 			{ 0x16, 0x99130111 }, /* speaker */
11935 			{ 0x18, 0x01a19840 }, /* mic */
11936 			{ 0x19, 0x99a3094f }, /* int-mic */
11937 			{ 0x21, 0x0121441f }, /* HP */
11938 			{ }
11939 		},
11940 		.chained = true,
11941 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11942 	},
11943 	[ALC662_FIXUP_ASUS_MODE5] = {
11944 		.type = HDA_FIXUP_PINS,
11945 		.v.pins = (const struct hda_pintbl[]) {
11946 			{ 0x14, 0x99130110 }, /* speaker */
11947 			{ 0x15, 0x0121441f }, /* HP */
11948 			{ 0x16, 0x99130111 }, /* speaker */
11949 			{ 0x18, 0x01a19840 }, /* mic */
11950 			{ 0x19, 0x99a3094f }, /* int-mic */
11951 			{ }
11952 		},
11953 		.chained = true,
11954 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11955 	},
11956 	[ALC662_FIXUP_ASUS_MODE6] = {
11957 		.type = HDA_FIXUP_PINS,
11958 		.v.pins = (const struct hda_pintbl[]) {
11959 			{ 0x14, 0x99130110 }, /* speaker */
11960 			{ 0x15, 0x01211420 }, /* HP2 */
11961 			{ 0x18, 0x01a19840 }, /* mic */
11962 			{ 0x19, 0x99a3094f }, /* int-mic */
11963 			{ 0x1b, 0x0121441f }, /* HP */
11964 			{ }
11965 		},
11966 		.chained = true,
11967 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11968 	},
11969 	[ALC662_FIXUP_ASUS_MODE7] = {
11970 		.type = HDA_FIXUP_PINS,
11971 		.v.pins = (const struct hda_pintbl[]) {
11972 			{ 0x14, 0x99130110 }, /* speaker */
11973 			{ 0x17, 0x99130111 }, /* speaker */
11974 			{ 0x18, 0x01a19840 }, /* mic */
11975 			{ 0x19, 0x99a3094f }, /* int-mic */
11976 			{ 0x1b, 0x01214020 }, /* HP */
11977 			{ 0x21, 0x0121401f }, /* HP */
11978 			{ }
11979 		},
11980 		.chained = true,
11981 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11982 	},
11983 	[ALC662_FIXUP_ASUS_MODE8] = {
11984 		.type = HDA_FIXUP_PINS,
11985 		.v.pins = (const struct hda_pintbl[]) {
11986 			{ 0x14, 0x99130110 }, /* speaker */
11987 			{ 0x12, 0x99a30970 }, /* int-mic */
11988 			{ 0x15, 0x01214020 }, /* HP */
11989 			{ 0x17, 0x99130111 }, /* speaker */
11990 			{ 0x18, 0x01a19840 }, /* mic */
11991 			{ 0x21, 0x0121401f }, /* HP */
11992 			{ }
11993 		},
11994 		.chained = true,
11995 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11996 	},
11997 	[ALC662_FIXUP_NO_JACK_DETECT] = {
11998 		.type = HDA_FIXUP_FUNC,
11999 		.v.func = alc_fixup_no_jack_detect,
12000 	},
12001 	[ALC662_FIXUP_ZOTAC_Z68] = {
12002 		.type = HDA_FIXUP_PINS,
12003 		.v.pins = (const struct hda_pintbl[]) {
12004 			{ 0x1b, 0x02214020 }, /* Front HP */
12005 			{ }
12006 		}
12007 	},
12008 	[ALC662_FIXUP_INV_DMIC] = {
12009 		.type = HDA_FIXUP_FUNC,
12010 		.v.func = alc_fixup_inv_dmic,
12011 	},
12012 	[ALC668_FIXUP_DELL_XPS13] = {
12013 		.type = HDA_FIXUP_FUNC,
12014 		.v.func = alc_fixup_dell_xps13,
12015 		.chained = true,
12016 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12017 	},
12018 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12019 		.type = HDA_FIXUP_FUNC,
12020 		.v.func = alc_fixup_disable_aamix,
12021 		.chained = true,
12022 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12023 	},
12024 	[ALC668_FIXUP_AUTO_MUTE] = {
12025 		.type = HDA_FIXUP_FUNC,
12026 		.v.func = alc_fixup_auto_mute_via_amp,
12027 		.chained = true,
12028 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12029 	},
12030 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12031 		.type = HDA_FIXUP_PINS,
12032 		.v.pins = (const struct hda_pintbl[]) {
12033 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12034 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12035 			{ }
12036 		},
12037 		.chained = true,
12038 		.chain_id = ALC662_FIXUP_HEADSET_MODE
12039 	},
12040 	[ALC662_FIXUP_HEADSET_MODE] = {
12041 		.type = HDA_FIXUP_FUNC,
12042 		.v.func = alc_fixup_headset_mode_alc662,
12043 	},
12044 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12045 		.type = HDA_FIXUP_PINS,
12046 		.v.pins = (const struct hda_pintbl[]) {
12047 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12048 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12049 			{ }
12050 		},
12051 		.chained = true,
12052 		.chain_id = ALC668_FIXUP_HEADSET_MODE
12053 	},
12054 	[ALC668_FIXUP_HEADSET_MODE] = {
12055 		.type = HDA_FIXUP_FUNC,
12056 		.v.func = alc_fixup_headset_mode_alc668,
12057 	},
12058 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12059 		.type = HDA_FIXUP_FUNC,
12060 		.v.func = alc_fixup_bass_chmap,
12061 		.chained = true,
12062 		.chain_id = ALC662_FIXUP_ASUS_MODE4
12063 	},
12064 	[ALC662_FIXUP_BASS_16] = {
12065 		.type = HDA_FIXUP_PINS,
12066 		.v.pins = (const struct hda_pintbl[]) {
12067 			{0x16, 0x80106111}, /* bass speaker */
12068 			{}
12069 		},
12070 		.chained = true,
12071 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12072 	},
12073 	[ALC662_FIXUP_BASS_1A] = {
12074 		.type = HDA_FIXUP_PINS,
12075 		.v.pins = (const struct hda_pintbl[]) {
12076 			{0x1a, 0x80106111}, /* bass speaker */
12077 			{}
12078 		},
12079 		.chained = true,
12080 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12081 	},
12082 	[ALC662_FIXUP_BASS_CHMAP] = {
12083 		.type = HDA_FIXUP_FUNC,
12084 		.v.func = alc_fixup_bass_chmap,
12085 	},
12086 	[ALC662_FIXUP_ASUS_Nx50] = {
12087 		.type = HDA_FIXUP_FUNC,
12088 		.v.func = alc_fixup_auto_mute_via_amp,
12089 		.chained = true,
12090 		.chain_id = ALC662_FIXUP_BASS_1A
12091 	},
12092 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12093 		.type = HDA_FIXUP_FUNC,
12094 		.v.func = alc_fixup_headset_mode_alc668,
12095 		.chain_id = ALC662_FIXUP_BASS_CHMAP
12096 	},
12097 	[ALC668_FIXUP_ASUS_Nx51] = {
12098 		.type = HDA_FIXUP_PINS,
12099 		.v.pins = (const struct hda_pintbl[]) {
12100 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12101 			{ 0x1a, 0x90170151 }, /* bass speaker */
12102 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12103 			{}
12104 		},
12105 		.chained = true,
12106 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12107 	},
12108 	[ALC668_FIXUP_MIC_COEF] = {
12109 		.type = HDA_FIXUP_VERBS,
12110 		.v.verbs = (const struct hda_verb[]) {
12111 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12112 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12113 			{}
12114 		},
12115 	},
12116 	[ALC668_FIXUP_ASUS_G751] = {
12117 		.type = HDA_FIXUP_PINS,
12118 		.v.pins = (const struct hda_pintbl[]) {
12119 			{ 0x16, 0x0421101f }, /* HP */
12120 			{}
12121 		},
12122 		.chained = true,
12123 		.chain_id = ALC668_FIXUP_MIC_COEF
12124 	},
12125 	[ALC891_FIXUP_HEADSET_MODE] = {
12126 		.type = HDA_FIXUP_FUNC,
12127 		.v.func = alc_fixup_headset_mode,
12128 	},
12129 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
12130 		.type = HDA_FIXUP_PINS,
12131 		.v.pins = (const struct hda_pintbl[]) {
12132 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12133 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12134 			{ }
12135 		},
12136 		.chained = true,
12137 		.chain_id = ALC891_FIXUP_HEADSET_MODE
12138 	},
12139 	[ALC662_FIXUP_ACER_VERITON] = {
12140 		.type = HDA_FIXUP_PINS,
12141 		.v.pins = (const struct hda_pintbl[]) {
12142 			{ 0x15, 0x50170120 }, /* no internal speaker */
12143 			{ }
12144 		}
12145 	},
12146 	[ALC892_FIXUP_ASROCK_MOBO] = {
12147 		.type = HDA_FIXUP_PINS,
12148 		.v.pins = (const struct hda_pintbl[]) {
12149 			{ 0x15, 0x40f000f0 }, /* disabled */
12150 			{ 0x16, 0x40f000f0 }, /* disabled */
12151 			{ }
12152 		}
12153 	},
12154 	[ALC662_FIXUP_USI_FUNC] = {
12155 		.type = HDA_FIXUP_FUNC,
12156 		.v.func = alc662_fixup_usi_headset_mic,
12157 	},
12158 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
12159 		.type = HDA_FIXUP_PINS,
12160 		.v.pins = (const struct hda_pintbl[]) {
12161 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
12162 			{ 0x18, 0x01a1903d },
12163 			{ }
12164 		},
12165 		.chained = true,
12166 		.chain_id = ALC662_FIXUP_USI_FUNC
12167 	},
12168 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
12169 		.type = HDA_FIXUP_FUNC,
12170 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
12171 	},
12172 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
12173 		.type = HDA_FIXUP_FUNC,
12174 		.v.func = alc662_fixup_aspire_ethos_hp,
12175 	},
12176 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
12177 		.type = HDA_FIXUP_PINS,
12178 		.v.pins = (const struct hda_pintbl[]) {
12179 			{ 0x15, 0x92130110 }, /* front speakers */
12180 			{ 0x18, 0x99130111 }, /* center/subwoofer */
12181 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
12182 			{ }
12183 		},
12184 		.chained = true,
12185 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
12186 	},
12187 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
12188 		.type = HDA_FIXUP_FUNC,
12189 		.v.func = alc671_fixup_hp_headset_mic2,
12190 	},
12191 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
12192 		.type = HDA_FIXUP_PINS,
12193 		.v.pins = (const struct hda_pintbl[]) {
12194 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
12195 			{ }
12196 		},
12197 		.chained = true,
12198 		.chain_id = ALC662_FIXUP_USI_FUNC
12199 	},
12200 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
12201 		.type = HDA_FIXUP_PINS,
12202 		.v.pins = (const struct hda_pintbl[]) {
12203 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12204 			{ 0x1b, 0x0221144f },
12205 			{ }
12206 		},
12207 		.chained = true,
12208 		.chain_id = ALC662_FIXUP_USI_FUNC
12209 	},
12210 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
12211 		.type = HDA_FIXUP_PINS,
12212 		.v.pins = (const struct hda_pintbl[]) {
12213 			{ 0x1b, 0x04a1112c },
12214 			{ }
12215 		},
12216 		.chained = true,
12217 		.chain_id = ALC668_FIXUP_HEADSET_MIC
12218 	},
12219 	[ALC668_FIXUP_HEADSET_MIC] = {
12220 		.type = HDA_FIXUP_FUNC,
12221 		.v.func = alc269_fixup_headset_mic,
12222 		.chained = true,
12223 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
12224 	},
12225 	[ALC668_FIXUP_MIC_DET_COEF] = {
12226 		.type = HDA_FIXUP_VERBS,
12227 		.v.verbs = (const struct hda_verb[]) {
12228 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
12229 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
12230 			{}
12231 		},
12232 	},
12233 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
12234 		.type = HDA_FIXUP_FUNC,
12235 		.v.func = alc897_fixup_lenovo_headset_mic,
12236 	},
12237 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
12238 		.type = HDA_FIXUP_PINS,
12239 		.v.pins = (const struct hda_pintbl[]) {
12240 			{ 0x1a, 0x03a11050 },
12241 			{ }
12242 		},
12243 		.chained = true,
12244 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
12245 	},
12246 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
12247 		.type = HDA_FIXUP_PINS,
12248 		.v.pins = (const struct hda_pintbl[]) {
12249 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
12250 			{ }
12251 		},
12252 	},
12253 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
12254 		.type = HDA_FIXUP_FUNC,
12255 		.v.func = alc897_fixup_lenovo_headset_mode,
12256 	},
12257 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
12258 		.type = HDA_FIXUP_PINS,
12259 		.v.pins = (const struct hda_pintbl[]) {
12260 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12261 			{ }
12262 		},
12263 		.chained = true,
12264 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
12265 	},
12266 	[ALC897_FIXUP_UNIS_H3C_X500S] = {
12267 		.type = HDA_FIXUP_VERBS,
12268 		.v.verbs = (const struct hda_verb[]) {
12269 			{ 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
12270 			{}
12271 		},
12272 	},
12273 	[ALC897_FIXUP_HEADSET_MIC_PIN3] = {
12274 		.type = HDA_FIXUP_PINS,
12275 		.v.pins = (const struct hda_pintbl[]) {
12276 			{ 0x19, 0x03a11050 }, /* use as headset mic */
12277 			{ }
12278 		},
12279 	},
12280 };
12281 
12282 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
12283 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
12284 	SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
12285 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
12286 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
12287 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
12288 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
12289 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
12290 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
12291 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
12292 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
12293 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
12294 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
12295 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12296 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12297 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
12298 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
12299 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
12300 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12301 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12302 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12303 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12304 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12305 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
12306 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12307 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12308 	SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12309 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
12310 	SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
12311 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
12312 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
12313 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
12314 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
12315 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
12316 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
12317 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
12318 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12319 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
12320 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
12321 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
12322 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
12323 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
12324 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
12325 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12326 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
12327 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
12328 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
12329 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
12330 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
12331 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
12332 	SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
12333 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
12334 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
12335 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
12336 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
12337 	SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12338 	SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12339 	SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
12340 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
12341 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
12342 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
12343 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
12344 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
12345 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
12346 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
12347 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
12348 	SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
12349 
12350 #if 0
12351 	/* Below is a quirk table taken from the old code.
12352 	 * Basically the device should work as is without the fixup table.
12353 	 * If BIOS doesn't give a proper info, enable the corresponding
12354 	 * fixup entry.
12355 	 */
12356 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
12357 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
12358 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
12359 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
12360 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12361 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12362 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12363 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
12364 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
12365 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12366 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
12367 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
12368 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
12369 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
12370 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
12371 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12372 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
12373 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
12374 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12375 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12376 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12377 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12378 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
12379 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
12380 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
12381 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12382 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
12383 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12384 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12385 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
12386 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12387 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12388 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
12389 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
12390 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
12391 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
12392 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
12393 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
12394 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
12395 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12396 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
12397 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
12398 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12399 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
12400 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
12401 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
12402 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
12403 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
12404 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12405 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
12406 #endif
12407 	{}
12408 };
12409 
12410 static const struct hda_model_fixup alc662_fixup_models[] = {
12411 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
12412 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
12413 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
12414 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
12415 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
12416 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
12417 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
12418 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
12419 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
12420 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
12421 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
12422 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
12423 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
12424 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
12425 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
12426 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
12427 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
12428 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
12429 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
12430 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
12431 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
12432 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
12433 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
12434 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
12435 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
12436 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
12437 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
12438 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
12439 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
12440 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
12441 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
12442 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
12443 	{.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
12444 	{}
12445 };
12446 
12447 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
12448 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12449 		{0x17, 0x02211010},
12450 		{0x18, 0x01a19030},
12451 		{0x1a, 0x01813040},
12452 		{0x21, 0x01014020}),
12453 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12454 		{0x16, 0x01813030},
12455 		{0x17, 0x02211010},
12456 		{0x18, 0x01a19040},
12457 		{0x21, 0x01014020}),
12458 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12459 		{0x14, 0x01014010},
12460 		{0x18, 0x01a19020},
12461 		{0x1a, 0x0181302f},
12462 		{0x1b, 0x0221401f}),
12463 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12464 		{0x12, 0x99a30130},
12465 		{0x14, 0x90170110},
12466 		{0x15, 0x0321101f},
12467 		{0x16, 0x03011020}),
12468 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12469 		{0x12, 0x99a30140},
12470 		{0x14, 0x90170110},
12471 		{0x15, 0x0321101f},
12472 		{0x16, 0x03011020}),
12473 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12474 		{0x12, 0x99a30150},
12475 		{0x14, 0x90170110},
12476 		{0x15, 0x0321101f},
12477 		{0x16, 0x03011020}),
12478 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12479 		{0x14, 0x90170110},
12480 		{0x15, 0x0321101f},
12481 		{0x16, 0x03011020}),
12482 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
12483 		{0x12, 0x90a60130},
12484 		{0x14, 0x90170110},
12485 		{0x15, 0x0321101f}),
12486 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12487 		{0x14, 0x01014010},
12488 		{0x17, 0x90170150},
12489 		{0x19, 0x02a11060},
12490 		{0x1b, 0x01813030},
12491 		{0x21, 0x02211020}),
12492 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12493 		{0x14, 0x01014010},
12494 		{0x18, 0x01a19040},
12495 		{0x1b, 0x01813030},
12496 		{0x21, 0x02211020}),
12497 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12498 		{0x14, 0x01014020},
12499 		{0x17, 0x90170110},
12500 		{0x18, 0x01a19050},
12501 		{0x1b, 0x01813040},
12502 		{0x21, 0x02211030}),
12503 	{}
12504 };
12505 
12506 /*
12507  */
patch_alc662(struct hda_codec * codec)12508 static int patch_alc662(struct hda_codec *codec)
12509 {
12510 	struct alc_spec *spec;
12511 	int err;
12512 
12513 	err = alc_alloc_spec(codec, 0x0b);
12514 	if (err < 0)
12515 		return err;
12516 
12517 	spec = codec->spec;
12518 
12519 	spec->shutup = alc_eapd_shutup;
12520 
12521 	/* handle multiple HPs as is */
12522 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
12523 
12524 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
12525 
12526 	switch (codec->core.vendor_id) {
12527 	case 0x10ec0668:
12528 		spec->init_hook = alc668_restore_default_value;
12529 		break;
12530 	}
12531 
12532 	alc_pre_init(codec);
12533 
12534 	snd_hda_pick_fixup(codec, alc662_fixup_models,
12535 		       alc662_fixup_tbl, alc662_fixups);
12536 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
12537 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12538 
12539 	alc_auto_parse_customize_define(codec);
12540 
12541 	if (has_cdefine_beep(codec))
12542 		spec->gen.beep_nid = 0x01;
12543 
12544 	if ((alc_get_coef0(codec) & (1 << 14)) &&
12545 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
12546 	    spec->cdefine.platform_type == 1) {
12547 		err = alc_codec_rename(codec, "ALC272X");
12548 		if (err < 0)
12549 			goto error;
12550 	}
12551 
12552 	/* automatic parse from the BIOS config */
12553 	err = alc662_parse_auto_config(codec);
12554 	if (err < 0)
12555 		goto error;
12556 
12557 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
12558 		switch (codec->core.vendor_id) {
12559 		case 0x10ec0662:
12560 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12561 			break;
12562 		case 0x10ec0272:
12563 		case 0x10ec0663:
12564 		case 0x10ec0665:
12565 		case 0x10ec0668:
12566 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12567 			break;
12568 		case 0x10ec0273:
12569 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
12570 			break;
12571 		}
12572 		if (err < 0)
12573 			goto error;
12574 	}
12575 
12576 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12577 
12578 	return 0;
12579 
12580  error:
12581 	alc_free(codec);
12582 	return err;
12583 }
12584 
12585 /*
12586  * ALC680 support
12587  */
12588 
alc680_parse_auto_config(struct hda_codec * codec)12589 static int alc680_parse_auto_config(struct hda_codec *codec)
12590 {
12591 	return alc_parse_auto_config(codec, NULL, NULL);
12592 }
12593 
12594 /*
12595  */
patch_alc680(struct hda_codec * codec)12596 static int patch_alc680(struct hda_codec *codec)
12597 {
12598 	int err;
12599 
12600 	/* ALC680 has no aa-loopback mixer */
12601 	err = alc_alloc_spec(codec, 0);
12602 	if (err < 0)
12603 		return err;
12604 
12605 	/* automatic parse from the BIOS config */
12606 	err = alc680_parse_auto_config(codec);
12607 	if (err < 0) {
12608 		alc_free(codec);
12609 		return err;
12610 	}
12611 
12612 	return 0;
12613 }
12614 
12615 /*
12616  * patch entries
12617  */
12618 static const struct hda_device_id snd_hda_id_realtek[] = {
12619 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
12620 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
12621 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
12622 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
12623 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
12624 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
12625 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
12626 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
12627 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
12628 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
12629 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
12630 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
12631 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
12632 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
12633 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
12634 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
12635 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
12636 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
12637 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
12638 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
12639 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
12640 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
12641 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
12642 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
12643 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
12644 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
12645 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
12646 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
12647 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
12648 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
12649 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
12650 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
12651 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
12652 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
12653 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
12654 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
12655 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
12656 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
12657 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
12658 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
12659 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
12660 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
12661 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
12662 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
12663 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
12664 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
12665 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
12666 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
12667 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
12668 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
12669 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
12670 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
12671 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
12672 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
12673 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
12674 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
12675 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
12676 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
12677 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
12678 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
12679 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
12680 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
12681 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
12682 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
12683 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
12684 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
12685 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
12686 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
12687 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
12688 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
12689 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
12690 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
12691 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
12692 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
12693 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
12694 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
12695 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
12696 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
12697 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
12698 	{} /* terminator */
12699 };
12700 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
12701 
12702 MODULE_LICENSE("GPL");
12703 MODULE_DESCRIPTION("Realtek HD-audio codec");
12704 
12705 static struct hda_codec_driver realtek_driver = {
12706 	.id = snd_hda_id_realtek,
12707 };
12708 
12709 module_hda_codec_driver(realtek_driver);
12710