xref: /linux/sound/pci/hda/patch_realtek.c (revision 3ef18b236690af5f6427c5b6d8636881116aa73a)
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/acpi.h>
14 #include <linux/cleanup.h>
15 #include <linux/init.h>
16 #include <linux/delay.h>
17 #include <linux/slab.h>
18 #include <linux/pci.h>
19 #include <linux/dmi.h>
20 #include <linux/module.h>
21 #include <linux/i2c.h>
22 #include <linux/input.h>
23 #include <linux/leds.h>
24 #include <linux/ctype.h>
25 #include <linux/spi/spi.h>
26 #include <sound/core.h>
27 #include <sound/jack.h>
28 #include <sound/hda_codec.h>
29 #include "hda_local.h"
30 #include "hda_auto_parser.h"
31 #include "hda_jack.h"
32 #include "hda_generic.h"
33 #include "hda_component.h"
34 
35 /* keep halting ALC5505 DSP, for power saving */
36 #define HALT_REALTEK_ALC5505
37 
38 /* extra amp-initialization sequence types */
39 enum {
40 	ALC_INIT_UNDEFINED,
41 	ALC_INIT_NONE,
42 	ALC_INIT_DEFAULT,
43 };
44 
45 enum {
46 	ALC_HEADSET_MODE_UNKNOWN,
47 	ALC_HEADSET_MODE_UNPLUGGED,
48 	ALC_HEADSET_MODE_HEADSET,
49 	ALC_HEADSET_MODE_MIC,
50 	ALC_HEADSET_MODE_HEADPHONE,
51 };
52 
53 enum {
54 	ALC_HEADSET_TYPE_UNKNOWN,
55 	ALC_HEADSET_TYPE_CTIA,
56 	ALC_HEADSET_TYPE_OMTP,
57 };
58 
59 enum {
60 	ALC_KEY_MICMUTE_INDEX,
61 };
62 
63 struct alc_customize_define {
64 	unsigned int  sku_cfg;
65 	unsigned char port_connectivity;
66 	unsigned char check_sum;
67 	unsigned char customization;
68 	unsigned char external_amp;
69 	unsigned int  enable_pcbeep:1;
70 	unsigned int  platform_type:1;
71 	unsigned int  swap:1;
72 	unsigned int  override:1;
73 	unsigned int  fixup:1; /* Means that this sku is set by driver, not read from hw */
74 };
75 
76 struct alc_coef_led {
77 	unsigned int idx;
78 	unsigned int mask;
79 	unsigned int on;
80 	unsigned int off;
81 };
82 
83 struct alc_spec {
84 	struct hda_gen_spec gen; /* must be at head */
85 
86 	/* codec parameterization */
87 	struct alc_customize_define cdefine;
88 	unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
89 
90 	/* GPIO bits */
91 	unsigned int gpio_mask;
92 	unsigned int gpio_dir;
93 	unsigned int gpio_data;
94 	bool gpio_write_delay;	/* add a delay before writing gpio_data */
95 
96 	/* mute LED for HP laptops, see vref_mute_led_set() */
97 	int mute_led_polarity;
98 	int micmute_led_polarity;
99 	hda_nid_t mute_led_nid;
100 	hda_nid_t cap_mute_led_nid;
101 
102 	unsigned int gpio_mute_led_mask;
103 	unsigned int gpio_mic_led_mask;
104 	struct alc_coef_led mute_led_coef;
105 	struct alc_coef_led mic_led_coef;
106 	struct mutex coef_mutex;
107 
108 	hda_nid_t headset_mic_pin;
109 	hda_nid_t headphone_mic_pin;
110 	int current_headset_mode;
111 	int current_headset_type;
112 
113 	/* hooks */
114 	void (*init_hook)(struct hda_codec *codec);
115 	void (*power_hook)(struct hda_codec *codec);
116 	void (*shutup)(struct hda_codec *codec);
117 
118 	int init_amp;
119 	int codec_variant;	/* flag for other variants */
120 	unsigned int has_alc5505_dsp:1;
121 	unsigned int no_depop_delay:1;
122 	unsigned int done_hp_init:1;
123 	unsigned int no_shutup_pins:1;
124 	unsigned int ultra_low_power:1;
125 	unsigned int has_hs_key:1;
126 	unsigned int no_internal_mic_pin:1;
127 	unsigned int en_3kpull_low:1;
128 	int num_speaker_amps;
129 
130 	/* for PLL fix */
131 	hda_nid_t pll_nid;
132 	unsigned int pll_coef_idx, pll_coef_bit;
133 	unsigned int coef0;
134 	struct input_dev *kb_dev;
135 	u8 alc_mute_keycode_map[1];
136 
137 	/* component binding */
138 	struct hda_component_parent comps;
139 };
140 
141 /*
142  * COEF access helper functions
143  */
144 
coef_mutex_lock(struct hda_codec * codec)145 static void coef_mutex_lock(struct hda_codec *codec)
146 {
147 	struct alc_spec *spec = codec->spec;
148 
149 	snd_hda_power_up_pm(codec);
150 	mutex_lock(&spec->coef_mutex);
151 }
152 
coef_mutex_unlock(struct hda_codec * codec)153 static void coef_mutex_unlock(struct hda_codec *codec)
154 {
155 	struct alc_spec *spec = codec->spec;
156 
157 	mutex_unlock(&spec->coef_mutex);
158 	snd_hda_power_down_pm(codec);
159 }
160 
__alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)161 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
162 				 unsigned int coef_idx)
163 {
164 	unsigned int val;
165 
166 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
167 	val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
168 	return val;
169 }
170 
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)171 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
172 			       unsigned int coef_idx)
173 {
174 	unsigned int val;
175 
176 	coef_mutex_lock(codec);
177 	val = __alc_read_coefex_idx(codec, nid, coef_idx);
178 	coef_mutex_unlock(codec);
179 	return val;
180 }
181 
182 #define alc_read_coef_idx(codec, coef_idx) \
183 	alc_read_coefex_idx(codec, 0x20, coef_idx)
184 
__alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)185 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
186 				   unsigned int coef_idx, unsigned int coef_val)
187 {
188 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
189 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
190 }
191 
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)192 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
193 				 unsigned int coef_idx, unsigned int coef_val)
194 {
195 	coef_mutex_lock(codec);
196 	__alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
197 	coef_mutex_unlock(codec);
198 }
199 
200 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
201 	alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
202 
__alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)203 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
204 				    unsigned int coef_idx, unsigned int mask,
205 				    unsigned int bits_set)
206 {
207 	unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
208 
209 	if (val != -1)
210 		__alc_write_coefex_idx(codec, nid, coef_idx,
211 				       (val & ~mask) | bits_set);
212 }
213 
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)214 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
215 				  unsigned int coef_idx, unsigned int mask,
216 				  unsigned int bits_set)
217 {
218 	coef_mutex_lock(codec);
219 	__alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
220 	coef_mutex_unlock(codec);
221 }
222 
223 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set)	\
224 	alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
225 
226 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)227 static unsigned int alc_get_coef0(struct hda_codec *codec)
228 {
229 	struct alc_spec *spec = codec->spec;
230 
231 	if (!spec->coef0)
232 		spec->coef0 = alc_read_coef_idx(codec, 0);
233 	return spec->coef0;
234 }
235 
236 /* coef writes/updates batch */
237 struct coef_fw {
238 	unsigned char nid;
239 	unsigned char idx;
240 	unsigned short mask;
241 	unsigned short val;
242 };
243 
244 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
245 	{ .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
246 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
247 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
248 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
249 
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)250 static void alc_process_coef_fw(struct hda_codec *codec,
251 				const struct coef_fw *fw)
252 {
253 	coef_mutex_lock(codec);
254 	for (; fw->nid; fw++) {
255 		if (fw->mask == (unsigned short)-1)
256 			__alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
257 		else
258 			__alc_update_coefex_idx(codec, fw->nid, fw->idx,
259 						fw->mask, fw->val);
260 	}
261 	coef_mutex_unlock(codec);
262 }
263 
264 /*
265  * GPIO setup tables, used in initialization
266  */
267 
268 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)269 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
270 {
271 	struct alc_spec *spec = codec->spec;
272 
273 	spec->gpio_mask |= mask;
274 	spec->gpio_dir |= mask;
275 	spec->gpio_data |= mask;
276 }
277 
alc_write_gpio_data(struct hda_codec * codec)278 static void alc_write_gpio_data(struct hda_codec *codec)
279 {
280 	struct alc_spec *spec = codec->spec;
281 
282 	snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
283 			    spec->gpio_data);
284 }
285 
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)286 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
287 				 bool on)
288 {
289 	struct alc_spec *spec = codec->spec;
290 	unsigned int oldval = spec->gpio_data;
291 
292 	if (on)
293 		spec->gpio_data |= mask;
294 	else
295 		spec->gpio_data &= ~mask;
296 	if (oldval != spec->gpio_data)
297 		alc_write_gpio_data(codec);
298 }
299 
alc_write_gpio(struct hda_codec * codec)300 static void alc_write_gpio(struct hda_codec *codec)
301 {
302 	struct alc_spec *spec = codec->spec;
303 
304 	if (!spec->gpio_mask)
305 		return;
306 
307 	snd_hda_codec_write(codec, codec->core.afg, 0,
308 			    AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
309 	snd_hda_codec_write(codec, codec->core.afg, 0,
310 			    AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
311 	if (spec->gpio_write_delay)
312 		msleep(1);
313 	alc_write_gpio_data(codec);
314 }
315 
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)316 static void alc_fixup_gpio(struct hda_codec *codec, int action,
317 			   unsigned int mask)
318 {
319 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
320 		alc_setup_gpio(codec, mask);
321 }
322 
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)323 static void alc_fixup_gpio1(struct hda_codec *codec,
324 			    const struct hda_fixup *fix, int action)
325 {
326 	alc_fixup_gpio(codec, action, 0x01);
327 }
328 
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)329 static void alc_fixup_gpio2(struct hda_codec *codec,
330 			    const struct hda_fixup *fix, int action)
331 {
332 	alc_fixup_gpio(codec, action, 0x02);
333 }
334 
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)335 static void alc_fixup_gpio3(struct hda_codec *codec,
336 			    const struct hda_fixup *fix, int action)
337 {
338 	alc_fixup_gpio(codec, action, 0x03);
339 }
340 
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)341 static void alc_fixup_gpio4(struct hda_codec *codec,
342 			    const struct hda_fixup *fix, int action)
343 {
344 	alc_fixup_gpio(codec, action, 0x04);
345 }
346 
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)347 static void alc_fixup_micmute_led(struct hda_codec *codec,
348 				  const struct hda_fixup *fix, int action)
349 {
350 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
351 		snd_hda_gen_add_micmute_led_cdev(codec, NULL);
352 }
353 
354 /*
355  * Fix hardware PLL issue
356  * On some codecs, the analog PLL gating control must be off while
357  * the default value is 1.
358  */
alc_fix_pll(struct hda_codec * codec)359 static void alc_fix_pll(struct hda_codec *codec)
360 {
361 	struct alc_spec *spec = codec->spec;
362 
363 	if (spec->pll_nid)
364 		alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
365 				      1 << spec->pll_coef_bit, 0);
366 }
367 
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)368 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
369 			     unsigned int coef_idx, unsigned int coef_bit)
370 {
371 	struct alc_spec *spec = codec->spec;
372 	spec->pll_nid = nid;
373 	spec->pll_coef_idx = coef_idx;
374 	spec->pll_coef_bit = coef_bit;
375 	alc_fix_pll(codec);
376 }
377 
378 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)379 static void alc_update_knob_master(struct hda_codec *codec,
380 				   struct hda_jack_callback *jack)
381 {
382 	unsigned int val;
383 	struct snd_kcontrol *kctl;
384 	struct snd_ctl_elem_value *uctl;
385 
386 	kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
387 	if (!kctl)
388 		return;
389 	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
390 	if (!uctl)
391 		return;
392 	val = snd_hda_codec_read(codec, jack->nid, 0,
393 				 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
394 	val &= HDA_AMP_VOLMASK;
395 	uctl->value.integer.value[0] = val;
396 	uctl->value.integer.value[1] = val;
397 	kctl->put(kctl, uctl);
398 	kfree(uctl);
399 }
400 
alc880_unsol_event(struct hda_codec * codec,unsigned int res)401 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
402 {
403 	/* For some reason, the res given from ALC880 is broken.
404 	   Here we adjust it properly. */
405 	snd_hda_jack_unsol_event(codec, res >> 2);
406 }
407 
408 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)409 static void alc_fill_eapd_coef(struct hda_codec *codec)
410 {
411 	int coef;
412 
413 	coef = alc_get_coef0(codec);
414 
415 	switch (codec->core.vendor_id) {
416 	case 0x10ec0262:
417 		alc_update_coef_idx(codec, 0x7, 0, 1<<5);
418 		break;
419 	case 0x10ec0267:
420 	case 0x10ec0268:
421 		alc_update_coef_idx(codec, 0x7, 0, 1<<13);
422 		break;
423 	case 0x10ec0269:
424 		if ((coef & 0x00f0) == 0x0010)
425 			alc_update_coef_idx(codec, 0xd, 0, 1<<14);
426 		if ((coef & 0x00f0) == 0x0020)
427 			alc_update_coef_idx(codec, 0x4, 1<<15, 0);
428 		if ((coef & 0x00f0) == 0x0030)
429 			alc_update_coef_idx(codec, 0x10, 1<<9, 0);
430 		break;
431 	case 0x10ec0280:
432 	case 0x10ec0284:
433 	case 0x10ec0290:
434 	case 0x10ec0292:
435 		alc_update_coef_idx(codec, 0x4, 1<<15, 0);
436 		break;
437 	case 0x10ec0225:
438 	case 0x10ec0295:
439 	case 0x10ec0299:
440 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
441 		fallthrough;
442 	case 0x10ec0215:
443 	case 0x10ec0285:
444 	case 0x10ec0289:
445 		alc_update_coef_idx(codec, 0x36, 1<<13, 0);
446 		fallthrough;
447 	case 0x10ec0230:
448 	case 0x10ec0233:
449 	case 0x10ec0235:
450 	case 0x10ec0236:
451 	case 0x10ec0245:
452 	case 0x10ec0255:
453 	case 0x10ec0256:
454 	case 0x19e58326:
455 	case 0x10ec0257:
456 	case 0x10ec0282:
457 	case 0x10ec0283:
458 	case 0x10ec0286:
459 	case 0x10ec0288:
460 	case 0x10ec0298:
461 	case 0x10ec0300:
462 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
463 		break;
464 	case 0x10ec0275:
465 		alc_update_coef_idx(codec, 0xe, 0, 1<<0);
466 		break;
467 	case 0x10ec0287:
468 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
469 		alc_write_coef_idx(codec, 0x8, 0x4ab7);
470 		break;
471 	case 0x10ec0293:
472 		alc_update_coef_idx(codec, 0xa, 1<<13, 0);
473 		break;
474 	case 0x10ec0234:
475 	case 0x10ec0274:
476 		alc_write_coef_idx(codec, 0x6e, 0x0c25);
477 		fallthrough;
478 	case 0x10ec0294:
479 	case 0x10ec0700:
480 	case 0x10ec0701:
481 	case 0x10ec0703:
482 	case 0x10ec0711:
483 		alc_update_coef_idx(codec, 0x10, 1<<15, 0);
484 		break;
485 	case 0x10ec0662:
486 		if ((coef & 0x00f0) == 0x0030)
487 			alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
488 		break;
489 	case 0x10ec0272:
490 	case 0x10ec0273:
491 	case 0x10ec0663:
492 	case 0x10ec0665:
493 	case 0x10ec0670:
494 	case 0x10ec0671:
495 	case 0x10ec0672:
496 		alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
497 		break;
498 	case 0x10ec0222:
499 	case 0x10ec0623:
500 		alc_update_coef_idx(codec, 0x19, 1<<13, 0);
501 		break;
502 	case 0x10ec0668:
503 		alc_update_coef_idx(codec, 0x7, 3<<13, 0);
504 		break;
505 	case 0x10ec0867:
506 		alc_update_coef_idx(codec, 0x4, 1<<10, 0);
507 		break;
508 	case 0x10ec0888:
509 		if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
510 			alc_update_coef_idx(codec, 0x7, 1<<5, 0);
511 		break;
512 	case 0x10ec0892:
513 	case 0x10ec0897:
514 		alc_update_coef_idx(codec, 0x7, 1<<5, 0);
515 		break;
516 	case 0x10ec0899:
517 	case 0x10ec0900:
518 	case 0x10ec0b00:
519 	case 0x10ec1168:
520 	case 0x10ec1220:
521 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
522 		break;
523 	}
524 }
525 
526 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)527 static void alc888_coef_init(struct hda_codec *codec)
528 {
529 	switch (alc_get_coef0(codec) & 0x00f0) {
530 	/* alc888-VA */
531 	case 0x00:
532 	/* alc888-VB */
533 	case 0x10:
534 		alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
535 		break;
536 	}
537 }
538 
539 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)540 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
541 {
542 	if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
543 		return;
544 	if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
545 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
546 				    on ? 2 : 0);
547 }
548 
549 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)550 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
551 {
552 	/* We currently only handle front, HP */
553 	static const hda_nid_t pins[] = {
554 		0x0f, 0x10, 0x14, 0x15, 0x17, 0
555 	};
556 	const hda_nid_t *p;
557 	for (p = pins; *p; p++)
558 		set_eapd(codec, *p, on);
559 }
560 
561 static int find_ext_mic_pin(struct hda_codec *codec);
562 
alc_headset_mic_no_shutup(struct hda_codec * codec)563 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
564 {
565 	const struct hda_pincfg *pin;
566 	int mic_pin = find_ext_mic_pin(codec);
567 	int i;
568 
569 	/* don't shut up pins when unloading the driver; otherwise it breaks
570 	 * the default pin setup at the next load of the driver
571 	 */
572 	if (codec->bus->shutdown)
573 		return;
574 
575 	snd_array_for_each(&codec->init_pins, i, pin) {
576 		/* use read here for syncing after issuing each verb */
577 		if (pin->nid != mic_pin)
578 			snd_hda_codec_read(codec, pin->nid, 0,
579 					AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
580 	}
581 
582 	codec->pins_shutup = 1;
583 }
584 
alc_shutup_pins(struct hda_codec * codec)585 static void alc_shutup_pins(struct hda_codec *codec)
586 {
587 	struct alc_spec *spec = codec->spec;
588 
589 	switch (codec->core.vendor_id) {
590 	case 0x10ec0236:
591 	case 0x10ec0256:
592 	case 0x10ec0257:
593 	case 0x19e58326:
594 	case 0x10ec0283:
595 	case 0x10ec0285:
596 	case 0x10ec0286:
597 	case 0x10ec0287:
598 	case 0x10ec0288:
599 	case 0x10ec0295:
600 	case 0x10ec0298:
601 		alc_headset_mic_no_shutup(codec);
602 		break;
603 	default:
604 		if (!spec->no_shutup_pins)
605 			snd_hda_shutup_pins(codec);
606 		break;
607 	}
608 }
609 
610 /* generic shutup callback;
611  * just turning off EAPD and a little pause for avoiding pop-noise
612  */
alc_eapd_shutup(struct hda_codec * codec)613 static void alc_eapd_shutup(struct hda_codec *codec)
614 {
615 	struct alc_spec *spec = codec->spec;
616 
617 	alc_auto_setup_eapd(codec, false);
618 	if (!spec->no_depop_delay)
619 		msleep(200);
620 	alc_shutup_pins(codec);
621 }
622 
623 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)624 static void alc_auto_init_amp(struct hda_codec *codec, int type)
625 {
626 	alc_auto_setup_eapd(codec, true);
627 	alc_write_gpio(codec);
628 	switch (type) {
629 	case ALC_INIT_DEFAULT:
630 		switch (codec->core.vendor_id) {
631 		case 0x10ec0260:
632 			alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
633 			break;
634 		case 0x10ec0880:
635 		case 0x10ec0882:
636 		case 0x10ec0883:
637 		case 0x10ec0885:
638 			alc_update_coef_idx(codec, 7, 0, 0x2030);
639 			break;
640 		case 0x10ec0888:
641 			alc888_coef_init(codec);
642 			break;
643 		}
644 		break;
645 	}
646 }
647 
648 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)649 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
650 {
651 	if (spec->gen.autocfg.hp_pins[0])
652 		return spec->gen.autocfg.hp_pins[0];
653 	if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
654 		return spec->gen.autocfg.line_out_pins[0];
655 	return 0;
656 }
657 
658 /*
659  * Realtek SSID verification
660  */
661 
662 /* Could be any non-zero and even value. When used as fixup, tells
663  * the driver to ignore any present sku defines.
664  */
665 #define ALC_FIXUP_SKU_IGNORE (2)
666 
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)667 static void alc_fixup_sku_ignore(struct hda_codec *codec,
668 				 const struct hda_fixup *fix, int action)
669 {
670 	struct alc_spec *spec = codec->spec;
671 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
672 		spec->cdefine.fixup = 1;
673 		spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
674 	}
675 }
676 
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)677 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
678 				    const struct hda_fixup *fix, int action)
679 {
680 	struct alc_spec *spec = codec->spec;
681 
682 	if (action == HDA_FIXUP_ACT_PROBE) {
683 		spec->no_depop_delay = 1;
684 		codec->depop_delay = 0;
685 	}
686 }
687 
alc_auto_parse_customize_define(struct hda_codec * codec)688 static int alc_auto_parse_customize_define(struct hda_codec *codec)
689 {
690 	unsigned int ass, tmp, i;
691 	unsigned nid = 0;
692 	struct alc_spec *spec = codec->spec;
693 
694 	spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
695 
696 	if (spec->cdefine.fixup) {
697 		ass = spec->cdefine.sku_cfg;
698 		if (ass == ALC_FIXUP_SKU_IGNORE)
699 			return -1;
700 		goto do_sku;
701 	}
702 
703 	if (!codec->bus->pci)
704 		return -1;
705 	ass = codec->core.subsystem_id & 0xffff;
706 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
707 		goto do_sku;
708 
709 	nid = 0x1d;
710 	if (codec->core.vendor_id == 0x10ec0260)
711 		nid = 0x17;
712 	ass = snd_hda_codec_get_pincfg(codec, nid);
713 
714 	if (!(ass & 1)) {
715 		codec_info(codec, "%s: SKU not ready 0x%08x\n",
716 			   codec->core.chip_name, ass);
717 		return -1;
718 	}
719 
720 	/* check sum */
721 	tmp = 0;
722 	for (i = 1; i < 16; i++) {
723 		if ((ass >> i) & 1)
724 			tmp++;
725 	}
726 	if (((ass >> 16) & 0xf) != tmp)
727 		return -1;
728 
729 	spec->cdefine.port_connectivity = ass >> 30;
730 	spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
731 	spec->cdefine.check_sum = (ass >> 16) & 0xf;
732 	spec->cdefine.customization = ass >> 8;
733 do_sku:
734 	spec->cdefine.sku_cfg = ass;
735 	spec->cdefine.external_amp = (ass & 0x38) >> 3;
736 	spec->cdefine.platform_type = (ass & 0x4) >> 2;
737 	spec->cdefine.swap = (ass & 0x2) >> 1;
738 	spec->cdefine.override = ass & 0x1;
739 
740 	codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
741 		   nid, spec->cdefine.sku_cfg);
742 	codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
743 		   spec->cdefine.port_connectivity);
744 	codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
745 	codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
746 	codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
747 	codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
748 	codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
749 	codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
750 	codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
751 
752 	return 0;
753 }
754 
755 /* 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)756 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
757 {
758 	int i;
759 	for (i = 0; i < nums; i++)
760 		if (list[i] == nid)
761 			return i;
762 	return -1;
763 }
764 /* 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)765 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
766 {
767 	return find_idx_in_nid_list(nid, list, nums) >= 0;
768 }
769 
770 /* check subsystem ID and set up device-specific initialization;
771  * return 1 if initialized, 0 if invalid SSID
772  */
773 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
774  *	31 ~ 16 :	Manufacture ID
775  *	15 ~ 8	:	SKU ID
776  *	7  ~ 0	:	Assembly ID
777  *	port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
778  */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)779 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
780 {
781 	unsigned int ass, tmp, i;
782 	unsigned nid;
783 	struct alc_spec *spec = codec->spec;
784 
785 	if (spec->cdefine.fixup) {
786 		ass = spec->cdefine.sku_cfg;
787 		if (ass == ALC_FIXUP_SKU_IGNORE)
788 			return 0;
789 		goto do_sku;
790 	}
791 
792 	ass = codec->core.subsystem_id & 0xffff;
793 	if (codec->bus->pci &&
794 	    ass != codec->bus->pci->subsystem_device && (ass & 1))
795 		goto do_sku;
796 
797 	/* invalid SSID, check the special NID pin defcfg instead */
798 	/*
799 	 * 31~30	: port connectivity
800 	 * 29~21	: reserve
801 	 * 20		: PCBEEP input
802 	 * 19~16	: Check sum (15:1)
803 	 * 15~1		: Custom
804 	 * 0		: override
805 	*/
806 	nid = 0x1d;
807 	if (codec->core.vendor_id == 0x10ec0260)
808 		nid = 0x17;
809 	ass = snd_hda_codec_get_pincfg(codec, nid);
810 	codec_dbg(codec,
811 		  "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
812 		   ass, nid);
813 	if (!(ass & 1))
814 		return 0;
815 	if ((ass >> 30) != 1)	/* no physical connection */
816 		return 0;
817 
818 	/* check sum */
819 	tmp = 0;
820 	for (i = 1; i < 16; i++) {
821 		if ((ass >> i) & 1)
822 			tmp++;
823 	}
824 	if (((ass >> 16) & 0xf) != tmp)
825 		return 0;
826 do_sku:
827 	codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
828 		   ass & 0xffff, codec->core.vendor_id);
829 	/*
830 	 * 0 : override
831 	 * 1 :	Swap Jack
832 	 * 2 : 0 --> Desktop, 1 --> Laptop
833 	 * 3~5 : External Amplifier control
834 	 * 7~6 : Reserved
835 	*/
836 	tmp = (ass & 0x38) >> 3;	/* external Amp control */
837 	if (spec->init_amp == ALC_INIT_UNDEFINED) {
838 		switch (tmp) {
839 		case 1:
840 			alc_setup_gpio(codec, 0x01);
841 			break;
842 		case 3:
843 			alc_setup_gpio(codec, 0x02);
844 			break;
845 		case 7:
846 			alc_setup_gpio(codec, 0x04);
847 			break;
848 		case 5:
849 		default:
850 			spec->init_amp = ALC_INIT_DEFAULT;
851 			break;
852 		}
853 	}
854 
855 	/* is laptop or Desktop and enable the function "Mute internal speaker
856 	 * when the external headphone out jack is plugged"
857 	 */
858 	if (!(ass & 0x8000))
859 		return 1;
860 	/*
861 	 * 10~8 : Jack location
862 	 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
863 	 * 14~13: Resvered
864 	 * 15   : 1 --> enable the function "Mute internal speaker
865 	 *	        when the external headphone out jack is plugged"
866 	 */
867 	if (!alc_get_hp_pin(spec)) {
868 		hda_nid_t nid;
869 		tmp = (ass >> 11) & 0x3;	/* HP to chassis */
870 		nid = ports[tmp];
871 		if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
872 				      spec->gen.autocfg.line_outs))
873 			return 1;
874 		spec->gen.autocfg.hp_pins[0] = nid;
875 	}
876 	return 1;
877 }
878 
879 /* Check the validity of ALC subsystem-id
880  * 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)881 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
882 {
883 	if (!alc_subsystem_id(codec, ports)) {
884 		struct alc_spec *spec = codec->spec;
885 		if (spec->init_amp == ALC_INIT_UNDEFINED) {
886 			codec_dbg(codec,
887 				  "realtek: Enable default setup for auto mode as fallback\n");
888 			spec->init_amp = ALC_INIT_DEFAULT;
889 		}
890 	}
891 }
892 
893 /* inverted digital-mic */
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)894 static void alc_fixup_inv_dmic(struct hda_codec *codec,
895 			       const struct hda_fixup *fix, int action)
896 {
897 	struct alc_spec *spec = codec->spec;
898 
899 	spec->gen.inv_dmic_split = 1;
900 }
901 
902 
alc_build_controls(struct hda_codec * codec)903 static int alc_build_controls(struct hda_codec *codec)
904 {
905 	int err;
906 
907 	err = snd_hda_gen_build_controls(codec);
908 	if (err < 0)
909 		return err;
910 
911 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
912 	return 0;
913 }
914 
915 
916 /*
917  * Common callbacks
918  */
919 
alc_pre_init(struct hda_codec * codec)920 static void alc_pre_init(struct hda_codec *codec)
921 {
922 	alc_fill_eapd_coef(codec);
923 }
924 
925 #define is_s3_resume(codec) \
926 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
927 #define is_s4_resume(codec) \
928 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
929 #define is_s4_suspend(codec) \
930 	((codec)->core.dev.power.power_state.event == PM_EVENT_FREEZE)
931 
alc_init(struct hda_codec * codec)932 static int alc_init(struct hda_codec *codec)
933 {
934 	struct alc_spec *spec = codec->spec;
935 
936 	/* hibernation resume needs the full chip initialization */
937 	if (is_s4_resume(codec))
938 		alc_pre_init(codec);
939 
940 	if (spec->init_hook)
941 		spec->init_hook(codec);
942 
943 	spec->gen.skip_verbs = 1; /* applied in below */
944 	snd_hda_gen_init(codec);
945 	alc_fix_pll(codec);
946 	alc_auto_init_amp(codec, spec->init_amp);
947 	snd_hda_apply_verbs(codec); /* apply verbs here after own init */
948 
949 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
950 
951 	return 0;
952 }
953 
954 /* forward declaration */
955 static const struct component_master_ops comp_master_ops;
956 
alc_free(struct hda_codec * codec)957 static void alc_free(struct hda_codec *codec)
958 {
959 	struct alc_spec *spec = codec->spec;
960 
961 	if (spec)
962 		hda_component_manager_free(&spec->comps, &comp_master_ops);
963 
964 	snd_hda_gen_free(codec);
965 }
966 
alc_shutup(struct hda_codec * codec)967 static inline void alc_shutup(struct hda_codec *codec)
968 {
969 	struct alc_spec *spec = codec->spec;
970 
971 	if (!snd_hda_get_bool_hint(codec, "shutup"))
972 		return; /* disabled explicitly by hints */
973 
974 	if (spec && spec->shutup)
975 		spec->shutup(codec);
976 	else
977 		alc_shutup_pins(codec);
978 }
979 
alc_power_eapd(struct hda_codec * codec)980 static void alc_power_eapd(struct hda_codec *codec)
981 {
982 	alc_auto_setup_eapd(codec, false);
983 }
984 
alc_suspend(struct hda_codec * codec)985 static int alc_suspend(struct hda_codec *codec)
986 {
987 	struct alc_spec *spec = codec->spec;
988 	alc_shutup(codec);
989 	if (spec && spec->power_hook)
990 		spec->power_hook(codec);
991 	return 0;
992 }
993 
alc_resume(struct hda_codec * codec)994 static int alc_resume(struct hda_codec *codec)
995 {
996 	struct alc_spec *spec = codec->spec;
997 
998 	if (!spec->no_depop_delay)
999 		msleep(150); /* to avoid pop noise */
1000 	codec->patch_ops.init(codec);
1001 	snd_hda_regmap_sync(codec);
1002 	hda_call_check_power_status(codec, 0x01);
1003 	return 0;
1004 }
1005 
1006 /*
1007  */
1008 static const struct hda_codec_ops alc_patch_ops = {
1009 	.build_controls = alc_build_controls,
1010 	.build_pcms = snd_hda_gen_build_pcms,
1011 	.init = alc_init,
1012 	.free = alc_free,
1013 	.unsol_event = snd_hda_jack_unsol_event,
1014 	.resume = alc_resume,
1015 	.suspend = alc_suspend,
1016 	.check_power_status = snd_hda_gen_check_power_status,
1017 };
1018 
1019 
1020 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1021 
1022 /*
1023  * Rename codecs appropriately from COEF value or subvendor id
1024  */
1025 struct alc_codec_rename_table {
1026 	unsigned int vendor_id;
1027 	unsigned short coef_mask;
1028 	unsigned short coef_bits;
1029 	const char *name;
1030 };
1031 
1032 struct alc_codec_rename_pci_table {
1033 	unsigned int codec_vendor_id;
1034 	unsigned short pci_subvendor;
1035 	unsigned short pci_subdevice;
1036 	const char *name;
1037 };
1038 
1039 static const struct alc_codec_rename_table rename_tbl[] = {
1040 	{ 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1041 	{ 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1042 	{ 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1043 	{ 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1044 	{ 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1045 	{ 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1046 	{ 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1047 	{ 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1048 	{ 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1049 	{ 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1050 	{ 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1051 	{ 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1052 	{ 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1053 	{ 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1054 	{ 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1055 	{ 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1056 	{ 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1057 	{ } /* terminator */
1058 };
1059 
1060 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1061 	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
1062 	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
1063 	{ 0x10ec0283, 0x1028, 0, "ALC3223" },
1064 	{ 0x10ec0288, 0x1028, 0, "ALC3263" },
1065 	{ 0x10ec0292, 0x1028, 0, "ALC3226" },
1066 	{ 0x10ec0293, 0x1028, 0, "ALC3235" },
1067 	{ 0x10ec0255, 0x1028, 0, "ALC3234" },
1068 	{ 0x10ec0668, 0x1028, 0, "ALC3661" },
1069 	{ 0x10ec0275, 0x1028, 0, "ALC3260" },
1070 	{ 0x10ec0899, 0x1028, 0, "ALC3861" },
1071 	{ 0x10ec0298, 0x1028, 0, "ALC3266" },
1072 	{ 0x10ec0236, 0x1028, 0, "ALC3204" },
1073 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
1074 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
1075 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
1076 	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
1077 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
1078 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
1079 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
1080 	{ 0x10ec0233, 0x1043, 0, "ALC3236" },
1081 	{ 0x10ec0280, 0x103c, 0, "ALC3228" },
1082 	{ 0x10ec0282, 0x103c, 0, "ALC3227" },
1083 	{ 0x10ec0286, 0x103c, 0, "ALC3242" },
1084 	{ 0x10ec0290, 0x103c, 0, "ALC3241" },
1085 	{ 0x10ec0668, 0x103c, 0, "ALC3662" },
1086 	{ 0x10ec0283, 0x17aa, 0, "ALC3239" },
1087 	{ 0x10ec0292, 0x17aa, 0, "ALC3232" },
1088 	{ } /* terminator */
1089 };
1090 
alc_codec_rename_from_preset(struct hda_codec * codec)1091 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1092 {
1093 	const struct alc_codec_rename_table *p;
1094 	const struct alc_codec_rename_pci_table *q;
1095 
1096 	for (p = rename_tbl; p->vendor_id; p++) {
1097 		if (p->vendor_id != codec->core.vendor_id)
1098 			continue;
1099 		if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1100 			return alc_codec_rename(codec, p->name);
1101 	}
1102 
1103 	if (!codec->bus->pci)
1104 		return 0;
1105 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1106 		if (q->codec_vendor_id != codec->core.vendor_id)
1107 			continue;
1108 		if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1109 			continue;
1110 		if (!q->pci_subdevice ||
1111 		    q->pci_subdevice == codec->bus->pci->subsystem_device)
1112 			return alc_codec_rename(codec, q->name);
1113 	}
1114 
1115 	return 0;
1116 }
1117 
1118 
1119 /*
1120  * Digital-beep handlers
1121  */
1122 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1123 
1124 /* additional beep mixers; private_value will be overwritten */
1125 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1126 	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1127 	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1128 };
1129 
1130 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1131 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1132 			int idx, int dir)
1133 {
1134 	struct snd_kcontrol_new *knew;
1135 	unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1136 	int i;
1137 
1138 	for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1139 		knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1140 					    &alc_beep_mixer[i]);
1141 		if (!knew)
1142 			return -ENOMEM;
1143 		knew->private_value = beep_amp;
1144 	}
1145 	return 0;
1146 }
1147 
1148 static const struct snd_pci_quirk beep_allow_list[] = {
1149 	SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1150 	SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1151 	SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1152 	SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1153 	SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1154 	SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1155 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1156 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1157 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1158 	/* denylist -- no beep available */
1159 	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1160 	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1161 	{}
1162 };
1163 
has_cdefine_beep(struct hda_codec * codec)1164 static inline int has_cdefine_beep(struct hda_codec *codec)
1165 {
1166 	struct alc_spec *spec = codec->spec;
1167 	const struct snd_pci_quirk *q;
1168 	q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1169 	if (q)
1170 		return q->value;
1171 	return spec->cdefine.enable_pcbeep;
1172 }
1173 #else
1174 #define set_beep_amp(spec, nid, idx, dir)	0
1175 #define has_cdefine_beep(codec)		0
1176 #endif
1177 
1178 /* parse the BIOS configuration and set up the alc_spec */
1179 /* return 1 if successful, 0 if the proper config is not found,
1180  * or a negative error code
1181  */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1182 static int alc_parse_auto_config(struct hda_codec *codec,
1183 				 const hda_nid_t *ignore_nids,
1184 				 const hda_nid_t *ssid_nids)
1185 {
1186 	struct alc_spec *spec = codec->spec;
1187 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1188 	int err;
1189 
1190 	err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1191 				       spec->parse_flags);
1192 	if (err < 0)
1193 		return err;
1194 
1195 	if (ssid_nids)
1196 		alc_ssid_check(codec, ssid_nids);
1197 
1198 	err = snd_hda_gen_parse_auto_config(codec, cfg);
1199 	if (err < 0)
1200 		return err;
1201 
1202 	return 1;
1203 }
1204 
1205 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1206 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1207 {
1208 	struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1209 	int err;
1210 
1211 	if (!spec)
1212 		return -ENOMEM;
1213 	codec->spec = spec;
1214 	snd_hda_gen_spec_init(&spec->gen);
1215 	spec->gen.mixer_nid = mixer_nid;
1216 	spec->gen.own_eapd_ctl = 1;
1217 	codec->single_adc_amp = 1;
1218 	/* FIXME: do we need this for all Realtek codec models? */
1219 	codec->spdif_status_reset = 1;
1220 	codec->forced_resume = 1;
1221 	codec->patch_ops = alc_patch_ops;
1222 	mutex_init(&spec->coef_mutex);
1223 
1224 	err = alc_codec_rename_from_preset(codec);
1225 	if (err < 0) {
1226 		kfree(spec);
1227 		return err;
1228 	}
1229 	return 0;
1230 }
1231 
alc880_parse_auto_config(struct hda_codec * codec)1232 static int alc880_parse_auto_config(struct hda_codec *codec)
1233 {
1234 	static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1235 	static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1236 	return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1237 }
1238 
1239 /*
1240  * ALC880 fix-ups
1241  */
1242 enum {
1243 	ALC880_FIXUP_GPIO1,
1244 	ALC880_FIXUP_GPIO2,
1245 	ALC880_FIXUP_MEDION_RIM,
1246 	ALC880_FIXUP_LG,
1247 	ALC880_FIXUP_LG_LW25,
1248 	ALC880_FIXUP_W810,
1249 	ALC880_FIXUP_EAPD_COEF,
1250 	ALC880_FIXUP_TCL_S700,
1251 	ALC880_FIXUP_VOL_KNOB,
1252 	ALC880_FIXUP_FUJITSU,
1253 	ALC880_FIXUP_F1734,
1254 	ALC880_FIXUP_UNIWILL,
1255 	ALC880_FIXUP_UNIWILL_DIG,
1256 	ALC880_FIXUP_Z71V,
1257 	ALC880_FIXUP_ASUS_W5A,
1258 	ALC880_FIXUP_3ST_BASE,
1259 	ALC880_FIXUP_3ST,
1260 	ALC880_FIXUP_3ST_DIG,
1261 	ALC880_FIXUP_5ST_BASE,
1262 	ALC880_FIXUP_5ST,
1263 	ALC880_FIXUP_5ST_DIG,
1264 	ALC880_FIXUP_6ST_BASE,
1265 	ALC880_FIXUP_6ST,
1266 	ALC880_FIXUP_6ST_DIG,
1267 	ALC880_FIXUP_6ST_AUTOMUTE,
1268 };
1269 
1270 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1271 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1272 				  const struct hda_fixup *fix, int action)
1273 {
1274 	if (action == HDA_FIXUP_ACT_PROBE)
1275 		snd_hda_jack_detect_enable_callback(codec, 0x21,
1276 						    alc_update_knob_master);
1277 }
1278 
1279 static const struct hda_fixup alc880_fixups[] = {
1280 	[ALC880_FIXUP_GPIO1] = {
1281 		.type = HDA_FIXUP_FUNC,
1282 		.v.func = alc_fixup_gpio1,
1283 	},
1284 	[ALC880_FIXUP_GPIO2] = {
1285 		.type = HDA_FIXUP_FUNC,
1286 		.v.func = alc_fixup_gpio2,
1287 	},
1288 	[ALC880_FIXUP_MEDION_RIM] = {
1289 		.type = HDA_FIXUP_VERBS,
1290 		.v.verbs = (const struct hda_verb[]) {
1291 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1292 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1293 			{ }
1294 		},
1295 		.chained = true,
1296 		.chain_id = ALC880_FIXUP_GPIO2,
1297 	},
1298 	[ALC880_FIXUP_LG] = {
1299 		.type = HDA_FIXUP_PINS,
1300 		.v.pins = (const struct hda_pintbl[]) {
1301 			/* disable bogus unused pins */
1302 			{ 0x16, 0x411111f0 },
1303 			{ 0x18, 0x411111f0 },
1304 			{ 0x1a, 0x411111f0 },
1305 			{ }
1306 		}
1307 	},
1308 	[ALC880_FIXUP_LG_LW25] = {
1309 		.type = HDA_FIXUP_PINS,
1310 		.v.pins = (const struct hda_pintbl[]) {
1311 			{ 0x1a, 0x0181344f }, /* line-in */
1312 			{ 0x1b, 0x0321403f }, /* headphone */
1313 			{ }
1314 		}
1315 	},
1316 	[ALC880_FIXUP_W810] = {
1317 		.type = HDA_FIXUP_PINS,
1318 		.v.pins = (const struct hda_pintbl[]) {
1319 			/* disable bogus unused pins */
1320 			{ 0x17, 0x411111f0 },
1321 			{ }
1322 		},
1323 		.chained = true,
1324 		.chain_id = ALC880_FIXUP_GPIO2,
1325 	},
1326 	[ALC880_FIXUP_EAPD_COEF] = {
1327 		.type = HDA_FIXUP_VERBS,
1328 		.v.verbs = (const struct hda_verb[]) {
1329 			/* change to EAPD mode */
1330 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1331 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1332 			{}
1333 		},
1334 	},
1335 	[ALC880_FIXUP_TCL_S700] = {
1336 		.type = HDA_FIXUP_VERBS,
1337 		.v.verbs = (const struct hda_verb[]) {
1338 			/* change to EAPD mode */
1339 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1340 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3070 },
1341 			{}
1342 		},
1343 		.chained = true,
1344 		.chain_id = ALC880_FIXUP_GPIO2,
1345 	},
1346 	[ALC880_FIXUP_VOL_KNOB] = {
1347 		.type = HDA_FIXUP_FUNC,
1348 		.v.func = alc880_fixup_vol_knob,
1349 	},
1350 	[ALC880_FIXUP_FUJITSU] = {
1351 		/* override all pins as BIOS on old Amilo is broken */
1352 		.type = HDA_FIXUP_PINS,
1353 		.v.pins = (const struct hda_pintbl[]) {
1354 			{ 0x14, 0x0121401f }, /* HP */
1355 			{ 0x15, 0x99030120 }, /* speaker */
1356 			{ 0x16, 0x99030130 }, /* bass speaker */
1357 			{ 0x17, 0x411111f0 }, /* N/A */
1358 			{ 0x18, 0x411111f0 }, /* N/A */
1359 			{ 0x19, 0x01a19950 }, /* mic-in */
1360 			{ 0x1a, 0x411111f0 }, /* N/A */
1361 			{ 0x1b, 0x411111f0 }, /* N/A */
1362 			{ 0x1c, 0x411111f0 }, /* N/A */
1363 			{ 0x1d, 0x411111f0 }, /* N/A */
1364 			{ 0x1e, 0x01454140 }, /* SPDIF out */
1365 			{ }
1366 		},
1367 		.chained = true,
1368 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1369 	},
1370 	[ALC880_FIXUP_F1734] = {
1371 		/* almost compatible with FUJITSU, but no bass and SPDIF */
1372 		.type = HDA_FIXUP_PINS,
1373 		.v.pins = (const struct hda_pintbl[]) {
1374 			{ 0x14, 0x0121401f }, /* HP */
1375 			{ 0x15, 0x99030120 }, /* speaker */
1376 			{ 0x16, 0x411111f0 }, /* N/A */
1377 			{ 0x17, 0x411111f0 }, /* N/A */
1378 			{ 0x18, 0x411111f0 }, /* N/A */
1379 			{ 0x19, 0x01a19950 }, /* mic-in */
1380 			{ 0x1a, 0x411111f0 }, /* N/A */
1381 			{ 0x1b, 0x411111f0 }, /* N/A */
1382 			{ 0x1c, 0x411111f0 }, /* N/A */
1383 			{ 0x1d, 0x411111f0 }, /* N/A */
1384 			{ 0x1e, 0x411111f0 }, /* N/A */
1385 			{ }
1386 		},
1387 		.chained = true,
1388 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1389 	},
1390 	[ALC880_FIXUP_UNIWILL] = {
1391 		/* need to fix HP and speaker pins to be parsed correctly */
1392 		.type = HDA_FIXUP_PINS,
1393 		.v.pins = (const struct hda_pintbl[]) {
1394 			{ 0x14, 0x0121411f }, /* HP */
1395 			{ 0x15, 0x99030120 }, /* speaker */
1396 			{ 0x16, 0x99030130 }, /* bass speaker */
1397 			{ }
1398 		},
1399 	},
1400 	[ALC880_FIXUP_UNIWILL_DIG] = {
1401 		.type = HDA_FIXUP_PINS,
1402 		.v.pins = (const struct hda_pintbl[]) {
1403 			/* disable bogus unused pins */
1404 			{ 0x17, 0x411111f0 },
1405 			{ 0x19, 0x411111f0 },
1406 			{ 0x1b, 0x411111f0 },
1407 			{ 0x1f, 0x411111f0 },
1408 			{ }
1409 		}
1410 	},
1411 	[ALC880_FIXUP_Z71V] = {
1412 		.type = HDA_FIXUP_PINS,
1413 		.v.pins = (const struct hda_pintbl[]) {
1414 			/* set up the whole pins as BIOS is utterly broken */
1415 			{ 0x14, 0x99030120 }, /* speaker */
1416 			{ 0x15, 0x0121411f }, /* HP */
1417 			{ 0x16, 0x411111f0 }, /* N/A */
1418 			{ 0x17, 0x411111f0 }, /* N/A */
1419 			{ 0x18, 0x01a19950 }, /* mic-in */
1420 			{ 0x19, 0x411111f0 }, /* N/A */
1421 			{ 0x1a, 0x01813031 }, /* line-in */
1422 			{ 0x1b, 0x411111f0 }, /* N/A */
1423 			{ 0x1c, 0x411111f0 }, /* N/A */
1424 			{ 0x1d, 0x411111f0 }, /* N/A */
1425 			{ 0x1e, 0x0144111e }, /* SPDIF */
1426 			{ }
1427 		}
1428 	},
1429 	[ALC880_FIXUP_ASUS_W5A] = {
1430 		.type = HDA_FIXUP_PINS,
1431 		.v.pins = (const struct hda_pintbl[]) {
1432 			/* set up the whole pins as BIOS is utterly broken */
1433 			{ 0x14, 0x0121411f }, /* HP */
1434 			{ 0x15, 0x411111f0 }, /* N/A */
1435 			{ 0x16, 0x411111f0 }, /* N/A */
1436 			{ 0x17, 0x411111f0 }, /* N/A */
1437 			{ 0x18, 0x90a60160 }, /* mic */
1438 			{ 0x19, 0x411111f0 }, /* N/A */
1439 			{ 0x1a, 0x411111f0 }, /* N/A */
1440 			{ 0x1b, 0x411111f0 }, /* N/A */
1441 			{ 0x1c, 0x411111f0 }, /* N/A */
1442 			{ 0x1d, 0x411111f0 }, /* N/A */
1443 			{ 0x1e, 0xb743111e }, /* SPDIF out */
1444 			{ }
1445 		},
1446 		.chained = true,
1447 		.chain_id = ALC880_FIXUP_GPIO1,
1448 	},
1449 	[ALC880_FIXUP_3ST_BASE] = {
1450 		.type = HDA_FIXUP_PINS,
1451 		.v.pins = (const struct hda_pintbl[]) {
1452 			{ 0x14, 0x01014010 }, /* line-out */
1453 			{ 0x15, 0x411111f0 }, /* N/A */
1454 			{ 0x16, 0x411111f0 }, /* N/A */
1455 			{ 0x17, 0x411111f0 }, /* N/A */
1456 			{ 0x18, 0x01a19c30 }, /* mic-in */
1457 			{ 0x19, 0x0121411f }, /* HP */
1458 			{ 0x1a, 0x01813031 }, /* line-in */
1459 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1460 			{ 0x1c, 0x411111f0 }, /* N/A */
1461 			{ 0x1d, 0x411111f0 }, /* N/A */
1462 			/* 0x1e is filled in below */
1463 			{ 0x1f, 0x411111f0 }, /* N/A */
1464 			{ }
1465 		}
1466 	},
1467 	[ALC880_FIXUP_3ST] = {
1468 		.type = HDA_FIXUP_PINS,
1469 		.v.pins = (const struct hda_pintbl[]) {
1470 			{ 0x1e, 0x411111f0 }, /* N/A */
1471 			{ }
1472 		},
1473 		.chained = true,
1474 		.chain_id = ALC880_FIXUP_3ST_BASE,
1475 	},
1476 	[ALC880_FIXUP_3ST_DIG] = {
1477 		.type = HDA_FIXUP_PINS,
1478 		.v.pins = (const struct hda_pintbl[]) {
1479 			{ 0x1e, 0x0144111e }, /* SPDIF */
1480 			{ }
1481 		},
1482 		.chained = true,
1483 		.chain_id = ALC880_FIXUP_3ST_BASE,
1484 	},
1485 	[ALC880_FIXUP_5ST_BASE] = {
1486 		.type = HDA_FIXUP_PINS,
1487 		.v.pins = (const struct hda_pintbl[]) {
1488 			{ 0x14, 0x01014010 }, /* front */
1489 			{ 0x15, 0x411111f0 }, /* N/A */
1490 			{ 0x16, 0x01011411 }, /* CLFE */
1491 			{ 0x17, 0x01016412 }, /* surr */
1492 			{ 0x18, 0x01a19c30 }, /* mic-in */
1493 			{ 0x19, 0x0121411f }, /* HP */
1494 			{ 0x1a, 0x01813031 }, /* line-in */
1495 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1496 			{ 0x1c, 0x411111f0 }, /* N/A */
1497 			{ 0x1d, 0x411111f0 }, /* N/A */
1498 			/* 0x1e is filled in below */
1499 			{ 0x1f, 0x411111f0 }, /* N/A */
1500 			{ }
1501 		}
1502 	},
1503 	[ALC880_FIXUP_5ST] = {
1504 		.type = HDA_FIXUP_PINS,
1505 		.v.pins = (const struct hda_pintbl[]) {
1506 			{ 0x1e, 0x411111f0 }, /* N/A */
1507 			{ }
1508 		},
1509 		.chained = true,
1510 		.chain_id = ALC880_FIXUP_5ST_BASE,
1511 	},
1512 	[ALC880_FIXUP_5ST_DIG] = {
1513 		.type = HDA_FIXUP_PINS,
1514 		.v.pins = (const struct hda_pintbl[]) {
1515 			{ 0x1e, 0x0144111e }, /* SPDIF */
1516 			{ }
1517 		},
1518 		.chained = true,
1519 		.chain_id = ALC880_FIXUP_5ST_BASE,
1520 	},
1521 	[ALC880_FIXUP_6ST_BASE] = {
1522 		.type = HDA_FIXUP_PINS,
1523 		.v.pins = (const struct hda_pintbl[]) {
1524 			{ 0x14, 0x01014010 }, /* front */
1525 			{ 0x15, 0x01016412 }, /* surr */
1526 			{ 0x16, 0x01011411 }, /* CLFE */
1527 			{ 0x17, 0x01012414 }, /* side */
1528 			{ 0x18, 0x01a19c30 }, /* mic-in */
1529 			{ 0x19, 0x02a19c40 }, /* front-mic */
1530 			{ 0x1a, 0x01813031 }, /* line-in */
1531 			{ 0x1b, 0x0121411f }, /* HP */
1532 			{ 0x1c, 0x411111f0 }, /* N/A */
1533 			{ 0x1d, 0x411111f0 }, /* N/A */
1534 			/* 0x1e is filled in below */
1535 			{ 0x1f, 0x411111f0 }, /* N/A */
1536 			{ }
1537 		}
1538 	},
1539 	[ALC880_FIXUP_6ST] = {
1540 		.type = HDA_FIXUP_PINS,
1541 		.v.pins = (const struct hda_pintbl[]) {
1542 			{ 0x1e, 0x411111f0 }, /* N/A */
1543 			{ }
1544 		},
1545 		.chained = true,
1546 		.chain_id = ALC880_FIXUP_6ST_BASE,
1547 	},
1548 	[ALC880_FIXUP_6ST_DIG] = {
1549 		.type = HDA_FIXUP_PINS,
1550 		.v.pins = (const struct hda_pintbl[]) {
1551 			{ 0x1e, 0x0144111e }, /* SPDIF */
1552 			{ }
1553 		},
1554 		.chained = true,
1555 		.chain_id = ALC880_FIXUP_6ST_BASE,
1556 	},
1557 	[ALC880_FIXUP_6ST_AUTOMUTE] = {
1558 		.type = HDA_FIXUP_PINS,
1559 		.v.pins = (const struct hda_pintbl[]) {
1560 			{ 0x1b, 0x0121401f }, /* HP with jack detect */
1561 			{ }
1562 		},
1563 		.chained_before = true,
1564 		.chain_id = ALC880_FIXUP_6ST_BASE,
1565 	},
1566 };
1567 
1568 static const struct hda_quirk alc880_fixup_tbl[] = {
1569 	SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1570 	SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1571 	SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1572 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1573 	SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1574 	SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1575 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1576 	SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1577 	SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1578 	SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1579 	SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1580 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1581 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1582 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1583 	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1584 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1585 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1586 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1587 	SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1588 	SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1589 	SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1590 	SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1591 	SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1592 
1593 	/* Below is the copied entries from alc880_quirks.c.
1594 	 * It's not quite sure whether BIOS sets the correct pin-config table
1595 	 * on these machines, thus they are kept to be compatible with
1596 	 * the old static quirks.  Once when it's confirmed to work without
1597 	 * these overrides, it'd be better to remove.
1598 	 */
1599 	SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1600 	SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1601 	SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1602 	SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1603 	SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1604 	SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1605 	SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1606 	SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1607 	SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1608 	SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1609 	SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1610 	SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1611 	SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1612 	SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1613 	SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1614 	SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1615 	SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1616 	SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1617 	SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1618 	SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1619 	SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1620 	SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1621 	SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1622 	SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1623 	SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1624 	SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1625 	SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1626 	SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1627 	SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1628 	SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1629 	SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1630 	SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1631 	SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1632 	/* default Intel */
1633 	SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1634 	SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1635 	SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1636 	{}
1637 };
1638 
1639 static const struct hda_model_fixup alc880_fixup_models[] = {
1640 	{.id = ALC880_FIXUP_3ST, .name = "3stack"},
1641 	{.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1642 	{.id = ALC880_FIXUP_5ST, .name = "5stack"},
1643 	{.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1644 	{.id = ALC880_FIXUP_6ST, .name = "6stack"},
1645 	{.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1646 	{.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1647 	{}
1648 };
1649 
1650 
1651 /*
1652  * OK, here we have finally the patch for ALC880
1653  */
patch_alc880(struct hda_codec * codec)1654 static int patch_alc880(struct hda_codec *codec)
1655 {
1656 	struct alc_spec *spec;
1657 	int err;
1658 
1659 	err = alc_alloc_spec(codec, 0x0b);
1660 	if (err < 0)
1661 		return err;
1662 
1663 	spec = codec->spec;
1664 	spec->gen.need_dac_fix = 1;
1665 	spec->gen.beep_nid = 0x01;
1666 
1667 	codec->patch_ops.unsol_event = alc880_unsol_event;
1668 
1669 	alc_pre_init(codec);
1670 
1671 	snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1672 		       alc880_fixups);
1673 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1674 
1675 	/* automatic parse from the BIOS config */
1676 	err = alc880_parse_auto_config(codec);
1677 	if (err < 0)
1678 		goto error;
1679 
1680 	if (!spec->gen.no_analog) {
1681 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1682 		if (err < 0)
1683 			goto error;
1684 	}
1685 
1686 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1687 
1688 	return 0;
1689 
1690  error:
1691 	alc_free(codec);
1692 	return err;
1693 }
1694 
1695 
1696 /*
1697  * ALC260 support
1698  */
alc260_parse_auto_config(struct hda_codec * codec)1699 static int alc260_parse_auto_config(struct hda_codec *codec)
1700 {
1701 	static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1702 	static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1703 	return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1704 }
1705 
1706 /*
1707  * Pin config fixes
1708  */
1709 enum {
1710 	ALC260_FIXUP_HP_DC5750,
1711 	ALC260_FIXUP_HP_PIN_0F,
1712 	ALC260_FIXUP_COEF,
1713 	ALC260_FIXUP_GPIO1,
1714 	ALC260_FIXUP_GPIO1_TOGGLE,
1715 	ALC260_FIXUP_REPLACER,
1716 	ALC260_FIXUP_HP_B1900,
1717 	ALC260_FIXUP_KN1,
1718 	ALC260_FIXUP_FSC_S7020,
1719 	ALC260_FIXUP_FSC_S7020_JWSE,
1720 	ALC260_FIXUP_VAIO_PINS,
1721 };
1722 
alc260_gpio1_automute(struct hda_codec * codec)1723 static void alc260_gpio1_automute(struct hda_codec *codec)
1724 {
1725 	struct alc_spec *spec = codec->spec;
1726 
1727 	alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1728 }
1729 
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1730 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1731 				      const struct hda_fixup *fix, int action)
1732 {
1733 	struct alc_spec *spec = codec->spec;
1734 	if (action == HDA_FIXUP_ACT_PROBE) {
1735 		/* although the machine has only one output pin, we need to
1736 		 * toggle GPIO1 according to the jack state
1737 		 */
1738 		spec->gen.automute_hook = alc260_gpio1_automute;
1739 		spec->gen.detect_hp = 1;
1740 		spec->gen.automute_speaker = 1;
1741 		spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1742 		snd_hda_jack_detect_enable_callback(codec, 0x0f,
1743 						    snd_hda_gen_hp_automute);
1744 		alc_setup_gpio(codec, 0x01);
1745 	}
1746 }
1747 
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1748 static void alc260_fixup_kn1(struct hda_codec *codec,
1749 			     const struct hda_fixup *fix, int action)
1750 {
1751 	struct alc_spec *spec = codec->spec;
1752 	static const struct hda_pintbl pincfgs[] = {
1753 		{ 0x0f, 0x02214000 }, /* HP/speaker */
1754 		{ 0x12, 0x90a60160 }, /* int mic */
1755 		{ 0x13, 0x02a19000 }, /* ext mic */
1756 		{ 0x18, 0x01446000 }, /* SPDIF out */
1757 		/* disable bogus I/O pins */
1758 		{ 0x10, 0x411111f0 },
1759 		{ 0x11, 0x411111f0 },
1760 		{ 0x14, 0x411111f0 },
1761 		{ 0x15, 0x411111f0 },
1762 		{ 0x16, 0x411111f0 },
1763 		{ 0x17, 0x411111f0 },
1764 		{ 0x19, 0x411111f0 },
1765 		{ }
1766 	};
1767 
1768 	switch (action) {
1769 	case HDA_FIXUP_ACT_PRE_PROBE:
1770 		snd_hda_apply_pincfgs(codec, pincfgs);
1771 		spec->init_amp = ALC_INIT_NONE;
1772 		break;
1773 	}
1774 }
1775 
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1776 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1777 				   const struct hda_fixup *fix, int action)
1778 {
1779 	struct alc_spec *spec = codec->spec;
1780 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
1781 		spec->init_amp = ALC_INIT_NONE;
1782 }
1783 
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1784 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1785 				   const struct hda_fixup *fix, int action)
1786 {
1787 	struct alc_spec *spec = codec->spec;
1788 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1789 		spec->gen.add_jack_modes = 1;
1790 		spec->gen.hp_mic = 1;
1791 	}
1792 }
1793 
1794 static const struct hda_fixup alc260_fixups[] = {
1795 	[ALC260_FIXUP_HP_DC5750] = {
1796 		.type = HDA_FIXUP_PINS,
1797 		.v.pins = (const struct hda_pintbl[]) {
1798 			{ 0x11, 0x90130110 }, /* speaker */
1799 			{ }
1800 		}
1801 	},
1802 	[ALC260_FIXUP_HP_PIN_0F] = {
1803 		.type = HDA_FIXUP_PINS,
1804 		.v.pins = (const struct hda_pintbl[]) {
1805 			{ 0x0f, 0x01214000 }, /* HP */
1806 			{ }
1807 		}
1808 	},
1809 	[ALC260_FIXUP_COEF] = {
1810 		.type = HDA_FIXUP_VERBS,
1811 		.v.verbs = (const struct hda_verb[]) {
1812 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1813 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3040 },
1814 			{ }
1815 		},
1816 	},
1817 	[ALC260_FIXUP_GPIO1] = {
1818 		.type = HDA_FIXUP_FUNC,
1819 		.v.func = alc_fixup_gpio1,
1820 	},
1821 	[ALC260_FIXUP_GPIO1_TOGGLE] = {
1822 		.type = HDA_FIXUP_FUNC,
1823 		.v.func = alc260_fixup_gpio1_toggle,
1824 		.chained = true,
1825 		.chain_id = ALC260_FIXUP_HP_PIN_0F,
1826 	},
1827 	[ALC260_FIXUP_REPLACER] = {
1828 		.type = HDA_FIXUP_VERBS,
1829 		.v.verbs = (const struct hda_verb[]) {
1830 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1831 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3050 },
1832 			{ }
1833 		},
1834 		.chained = true,
1835 		.chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1836 	},
1837 	[ALC260_FIXUP_HP_B1900] = {
1838 		.type = HDA_FIXUP_FUNC,
1839 		.v.func = alc260_fixup_gpio1_toggle,
1840 		.chained = true,
1841 		.chain_id = ALC260_FIXUP_COEF,
1842 	},
1843 	[ALC260_FIXUP_KN1] = {
1844 		.type = HDA_FIXUP_FUNC,
1845 		.v.func = alc260_fixup_kn1,
1846 	},
1847 	[ALC260_FIXUP_FSC_S7020] = {
1848 		.type = HDA_FIXUP_FUNC,
1849 		.v.func = alc260_fixup_fsc_s7020,
1850 	},
1851 	[ALC260_FIXUP_FSC_S7020_JWSE] = {
1852 		.type = HDA_FIXUP_FUNC,
1853 		.v.func = alc260_fixup_fsc_s7020_jwse,
1854 		.chained = true,
1855 		.chain_id = ALC260_FIXUP_FSC_S7020,
1856 	},
1857 	[ALC260_FIXUP_VAIO_PINS] = {
1858 		.type = HDA_FIXUP_PINS,
1859 		.v.pins = (const struct hda_pintbl[]) {
1860 			/* Pin configs are missing completely on some VAIOs */
1861 			{ 0x0f, 0x01211020 },
1862 			{ 0x10, 0x0001003f },
1863 			{ 0x11, 0x411111f0 },
1864 			{ 0x12, 0x01a15930 },
1865 			{ 0x13, 0x411111f0 },
1866 			{ 0x14, 0x411111f0 },
1867 			{ 0x15, 0x411111f0 },
1868 			{ 0x16, 0x411111f0 },
1869 			{ 0x17, 0x411111f0 },
1870 			{ 0x18, 0x411111f0 },
1871 			{ 0x19, 0x411111f0 },
1872 			{ }
1873 		}
1874 	},
1875 };
1876 
1877 static const struct hda_quirk alc260_fixup_tbl[] = {
1878 	SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1879 	SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1880 	SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1881 	SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1882 	SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1883 	SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1884 	SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1885 	SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1886 	SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1887 	SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1888 	SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1889 	SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1890 	{}
1891 };
1892 
1893 static const struct hda_model_fixup alc260_fixup_models[] = {
1894 	{.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1895 	{.id = ALC260_FIXUP_COEF, .name = "coef"},
1896 	{.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1897 	{.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1898 	{}
1899 };
1900 
1901 /*
1902  */
patch_alc260(struct hda_codec * codec)1903 static int patch_alc260(struct hda_codec *codec)
1904 {
1905 	struct alc_spec *spec;
1906 	int err;
1907 
1908 	err = alc_alloc_spec(codec, 0x07);
1909 	if (err < 0)
1910 		return err;
1911 
1912 	spec = codec->spec;
1913 	/* as quite a few machines require HP amp for speaker outputs,
1914 	 * it's easier to enable it unconditionally; even if it's unneeded,
1915 	 * it's almost harmless.
1916 	 */
1917 	spec->gen.prefer_hp_amp = 1;
1918 	spec->gen.beep_nid = 0x01;
1919 
1920 	spec->shutup = alc_eapd_shutup;
1921 
1922 	alc_pre_init(codec);
1923 
1924 	snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1925 			   alc260_fixups);
1926 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1927 
1928 	/* automatic parse from the BIOS config */
1929 	err = alc260_parse_auto_config(codec);
1930 	if (err < 0)
1931 		goto error;
1932 
1933 	if (!spec->gen.no_analog) {
1934 		err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1935 		if (err < 0)
1936 			goto error;
1937 	}
1938 
1939 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1940 
1941 	return 0;
1942 
1943  error:
1944 	alc_free(codec);
1945 	return err;
1946 }
1947 
1948 
1949 /*
1950  * ALC882/883/885/888/889 support
1951  *
1952  * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1953  * configuration.  Each pin widget can choose any input DACs and a mixer.
1954  * Each ADC is connected from a mixer of all inputs.  This makes possible
1955  * 6-channel independent captures.
1956  *
1957  * In addition, an independent DAC for the multi-playback (not used in this
1958  * driver yet).
1959  */
1960 
1961 /*
1962  * Pin config fixes
1963  */
1964 enum {
1965 	ALC882_FIXUP_ABIT_AW9D_MAX,
1966 	ALC882_FIXUP_LENOVO_Y530,
1967 	ALC882_FIXUP_PB_M5210,
1968 	ALC882_FIXUP_ACER_ASPIRE_7736,
1969 	ALC882_FIXUP_ASUS_W90V,
1970 	ALC889_FIXUP_CD,
1971 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1972 	ALC889_FIXUP_VAIO_TT,
1973 	ALC888_FIXUP_EEE1601,
1974 	ALC886_FIXUP_EAPD,
1975 	ALC882_FIXUP_EAPD,
1976 	ALC883_FIXUP_EAPD,
1977 	ALC883_FIXUP_ACER_EAPD,
1978 	ALC882_FIXUP_GPIO1,
1979 	ALC882_FIXUP_GPIO2,
1980 	ALC882_FIXUP_GPIO3,
1981 	ALC889_FIXUP_COEF,
1982 	ALC882_FIXUP_ASUS_W2JC,
1983 	ALC882_FIXUP_ACER_ASPIRE_4930G,
1984 	ALC882_FIXUP_ACER_ASPIRE_8930G,
1985 	ALC882_FIXUP_ASPIRE_8930G_VERBS,
1986 	ALC885_FIXUP_MACPRO_GPIO,
1987 	ALC889_FIXUP_DAC_ROUTE,
1988 	ALC889_FIXUP_MBP_VREF,
1989 	ALC889_FIXUP_IMAC91_VREF,
1990 	ALC889_FIXUP_MBA11_VREF,
1991 	ALC889_FIXUP_MBA21_VREF,
1992 	ALC889_FIXUP_MP11_VREF,
1993 	ALC889_FIXUP_MP41_VREF,
1994 	ALC882_FIXUP_INV_DMIC,
1995 	ALC882_FIXUP_NO_PRIMARY_HP,
1996 	ALC887_FIXUP_ASUS_BASS,
1997 	ALC887_FIXUP_BASS_CHMAP,
1998 	ALC1220_FIXUP_GB_DUAL_CODECS,
1999 	ALC1220_FIXUP_GB_X570,
2000 	ALC1220_FIXUP_CLEVO_P950,
2001 	ALC1220_FIXUP_CLEVO_PB51ED,
2002 	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
2003 	ALC887_FIXUP_ASUS_AUDIO,
2004 	ALC887_FIXUP_ASUS_HMIC,
2005 	ALCS1200A_FIXUP_MIC_VREF,
2006 	ALC888VD_FIXUP_MIC_100VREF,
2007 };
2008 
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)2009 static void alc889_fixup_coef(struct hda_codec *codec,
2010 			      const struct hda_fixup *fix, int action)
2011 {
2012 	if (action != HDA_FIXUP_ACT_INIT)
2013 		return;
2014 	alc_update_coef_idx(codec, 7, 0, 0x2030);
2015 }
2016 
2017 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2018 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2019 				     const struct hda_fixup *fix, int action)
2020 {
2021 	struct alc_spec *spec = codec->spec;
2022 
2023 	spec->gpio_write_delay = true;
2024 	alc_fixup_gpio3(codec, fix, action);
2025 }
2026 
2027 /* Fix the connection of some pins for ALC889:
2028  * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2029  * work correctly (bko#42740)
2030  */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2031 static void alc889_fixup_dac_route(struct hda_codec *codec,
2032 				   const struct hda_fixup *fix, int action)
2033 {
2034 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2035 		/* fake the connections during parsing the tree */
2036 		static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2037 		static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2038 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2039 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2040 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2041 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2042 	} else if (action == HDA_FIXUP_ACT_PROBE) {
2043 		/* restore the connections */
2044 		static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2045 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2046 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2047 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2048 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2049 	}
2050 }
2051 
2052 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2053 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2054 				  const struct hda_fixup *fix, int action)
2055 {
2056 	static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2057 	struct alc_spec *spec = codec->spec;
2058 	int i;
2059 
2060 	if (action != HDA_FIXUP_ACT_INIT)
2061 		return;
2062 	for (i = 0; i < ARRAY_SIZE(nids); i++) {
2063 		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2064 		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2065 			continue;
2066 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2067 		val |= AC_PINCTL_VREF_80;
2068 		snd_hda_set_pin_ctl(codec, nids[i], val);
2069 		spec->gen.keep_vref_in_automute = 1;
2070 		break;
2071 	}
2072 }
2073 
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2074 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2075 				  const hda_nid_t *nids, int num_nids)
2076 {
2077 	struct alc_spec *spec = codec->spec;
2078 	int i;
2079 
2080 	for (i = 0; i < num_nids; i++) {
2081 		unsigned int val;
2082 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2083 		val |= AC_PINCTL_VREF_50;
2084 		snd_hda_set_pin_ctl(codec, nids[i], val);
2085 	}
2086 	spec->gen.keep_vref_in_automute = 1;
2087 }
2088 
2089 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2090 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2091 				     const struct hda_fixup *fix, int action)
2092 {
2093 	static const hda_nid_t nids[] = { 0x18, 0x1a };
2094 
2095 	if (action == HDA_FIXUP_ACT_INIT)
2096 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2097 }
2098 
2099 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2100 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2101 				    const struct hda_fixup *fix, int action)
2102 {
2103 	static const hda_nid_t nids[] = { 0x18 };
2104 
2105 	if (action == HDA_FIXUP_ACT_INIT)
2106 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2107 }
2108 
2109 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2110 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2111 				    const struct hda_fixup *fix, int action)
2112 {
2113 	static const hda_nid_t nids[] = { 0x18, 0x19 };
2114 
2115 	if (action == HDA_FIXUP_ACT_INIT)
2116 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2117 }
2118 
2119 /* Don't take HP output as primary
2120  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2121  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2122  */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2123 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2124 				       const struct hda_fixup *fix, int action)
2125 {
2126 	struct alc_spec *spec = codec->spec;
2127 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2128 		spec->gen.no_primary_hp = 1;
2129 		spec->gen.no_multi_io = 1;
2130 	}
2131 }
2132 
2133 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2134 				 const struct hda_fixup *fix, int action);
2135 
2136 /* For dual-codec configuration, we need to disable some features to avoid
2137  * conflicts of kctls and PCM streams
2138  */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2139 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2140 				  const struct hda_fixup *fix, int action)
2141 {
2142 	struct alc_spec *spec = codec->spec;
2143 
2144 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2145 		return;
2146 	/* disable vmaster */
2147 	spec->gen.suppress_vmaster = 1;
2148 	/* auto-mute and auto-mic switch don't work with multiple codecs */
2149 	spec->gen.suppress_auto_mute = 1;
2150 	spec->gen.suppress_auto_mic = 1;
2151 	/* disable aamix as well */
2152 	spec->gen.mixer_nid = 0;
2153 	/* add location prefix to avoid conflicts */
2154 	codec->force_pin_prefix = 1;
2155 }
2156 
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2157 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2158 		       const char *newname)
2159 {
2160 	struct snd_kcontrol *kctl;
2161 
2162 	kctl = snd_hda_find_mixer_ctl(codec, oldname);
2163 	if (kctl)
2164 		snd_ctl_rename(codec->card, kctl, newname);
2165 }
2166 
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2167 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2168 					 const struct hda_fixup *fix,
2169 					 int action)
2170 {
2171 	alc_fixup_dual_codecs(codec, fix, action);
2172 	switch (action) {
2173 	case HDA_FIXUP_ACT_PRE_PROBE:
2174 		/* override card longname to provide a unique UCM profile */
2175 		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2176 		break;
2177 	case HDA_FIXUP_ACT_BUILD:
2178 		/* rename Capture controls depending on the codec */
2179 		rename_ctl(codec, "Capture Volume",
2180 			   codec->addr == 0 ?
2181 			   "Rear-Panel Capture Volume" :
2182 			   "Front-Panel Capture Volume");
2183 		rename_ctl(codec, "Capture Switch",
2184 			   codec->addr == 0 ?
2185 			   "Rear-Panel Capture Switch" :
2186 			   "Front-Panel Capture Switch");
2187 		break;
2188 	}
2189 }
2190 
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2191 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2192 				     const struct hda_fixup *fix,
2193 				     int action)
2194 {
2195 	static const hda_nid_t conn1[] = { 0x0c };
2196 	static const struct coef_fw gb_x570_coefs[] = {
2197 		WRITE_COEF(0x07, 0x03c0),
2198 		WRITE_COEF(0x1a, 0x01c1),
2199 		WRITE_COEF(0x1b, 0x0202),
2200 		WRITE_COEF(0x43, 0x3005),
2201 		{}
2202 	};
2203 
2204 	switch (action) {
2205 	case HDA_FIXUP_ACT_PRE_PROBE:
2206 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2207 		snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2208 		break;
2209 	case HDA_FIXUP_ACT_INIT:
2210 		alc_process_coef_fw(codec, gb_x570_coefs);
2211 		break;
2212 	}
2213 }
2214 
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2215 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2216 				     const struct hda_fixup *fix,
2217 				     int action)
2218 {
2219 	static const hda_nid_t conn1[] = { 0x0c };
2220 
2221 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2222 		return;
2223 
2224 	alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2225 	/* We therefore want to make sure 0x14 (front headphone) and
2226 	 * 0x1b (speakers) use the stereo DAC 0x02
2227 	 */
2228 	snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2229 	snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2230 }
2231 
2232 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2233 				const struct hda_fixup *fix, int action);
2234 
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2235 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2236 				     const struct hda_fixup *fix,
2237 				     int action)
2238 {
2239 	alc1220_fixup_clevo_p950(codec, fix, action);
2240 	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2241 }
2242 
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2243 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2244 					 struct hda_jack_callback *jack)
2245 {
2246 	struct alc_spec *spec = codec->spec;
2247 	unsigned int vref;
2248 
2249 	snd_hda_gen_hp_automute(codec, jack);
2250 
2251 	if (spec->gen.hp_jack_present)
2252 		vref = AC_PINCTL_VREF_80;
2253 	else
2254 		vref = AC_PINCTL_VREF_HIZ;
2255 	snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2256 }
2257 
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2258 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2259 				     const struct hda_fixup *fix, int action)
2260 {
2261 	struct alc_spec *spec = codec->spec;
2262 	if (action != HDA_FIXUP_ACT_PROBE)
2263 		return;
2264 	snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2265 	spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2266 }
2267 
2268 static const struct hda_fixup alc882_fixups[] = {
2269 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
2270 		.type = HDA_FIXUP_PINS,
2271 		.v.pins = (const struct hda_pintbl[]) {
2272 			{ 0x15, 0x01080104 }, /* side */
2273 			{ 0x16, 0x01011012 }, /* rear */
2274 			{ 0x17, 0x01016011 }, /* clfe */
2275 			{ }
2276 		}
2277 	},
2278 	[ALC882_FIXUP_LENOVO_Y530] = {
2279 		.type = HDA_FIXUP_PINS,
2280 		.v.pins = (const struct hda_pintbl[]) {
2281 			{ 0x15, 0x99130112 }, /* rear int speakers */
2282 			{ 0x16, 0x99130111 }, /* subwoofer */
2283 			{ }
2284 		}
2285 	},
2286 	[ALC882_FIXUP_PB_M5210] = {
2287 		.type = HDA_FIXUP_PINCTLS,
2288 		.v.pins = (const struct hda_pintbl[]) {
2289 			{ 0x19, PIN_VREF50 },
2290 			{}
2291 		}
2292 	},
2293 	[ALC882_FIXUP_ACER_ASPIRE_7736] = {
2294 		.type = HDA_FIXUP_FUNC,
2295 		.v.func = alc_fixup_sku_ignore,
2296 	},
2297 	[ALC882_FIXUP_ASUS_W90V] = {
2298 		.type = HDA_FIXUP_PINS,
2299 		.v.pins = (const struct hda_pintbl[]) {
2300 			{ 0x16, 0x99130110 }, /* fix sequence for CLFE */
2301 			{ }
2302 		}
2303 	},
2304 	[ALC889_FIXUP_CD] = {
2305 		.type = HDA_FIXUP_PINS,
2306 		.v.pins = (const struct hda_pintbl[]) {
2307 			{ 0x1c, 0x993301f0 }, /* CD */
2308 			{ }
2309 		}
2310 	},
2311 	[ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2312 		.type = HDA_FIXUP_PINS,
2313 		.v.pins = (const struct hda_pintbl[]) {
2314 			{ 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2315 			{ }
2316 		},
2317 		.chained = true,
2318 		.chain_id = ALC889_FIXUP_CD,
2319 	},
2320 	[ALC889_FIXUP_VAIO_TT] = {
2321 		.type = HDA_FIXUP_PINS,
2322 		.v.pins = (const struct hda_pintbl[]) {
2323 			{ 0x17, 0x90170111 }, /* hidden surround speaker */
2324 			{ }
2325 		}
2326 	},
2327 	[ALC888_FIXUP_EEE1601] = {
2328 		.type = HDA_FIXUP_VERBS,
2329 		.v.verbs = (const struct hda_verb[]) {
2330 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2331 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x0838 },
2332 			{ }
2333 		}
2334 	},
2335 	[ALC886_FIXUP_EAPD] = {
2336 		.type = HDA_FIXUP_VERBS,
2337 		.v.verbs = (const struct hda_verb[]) {
2338 			/* change to EAPD mode */
2339 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2340 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2341 			{ }
2342 		}
2343 	},
2344 	[ALC882_FIXUP_EAPD] = {
2345 		.type = HDA_FIXUP_VERBS,
2346 		.v.verbs = (const struct hda_verb[]) {
2347 			/* change to EAPD mode */
2348 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2349 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2350 			{ }
2351 		}
2352 	},
2353 	[ALC883_FIXUP_EAPD] = {
2354 		.type = HDA_FIXUP_VERBS,
2355 		.v.verbs = (const struct hda_verb[]) {
2356 			/* change to EAPD mode */
2357 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2358 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2359 			{ }
2360 		}
2361 	},
2362 	[ALC883_FIXUP_ACER_EAPD] = {
2363 		.type = HDA_FIXUP_VERBS,
2364 		.v.verbs = (const struct hda_verb[]) {
2365 			/* eanable EAPD on Acer laptops */
2366 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2367 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2368 			{ }
2369 		}
2370 	},
2371 	[ALC882_FIXUP_GPIO1] = {
2372 		.type = HDA_FIXUP_FUNC,
2373 		.v.func = alc_fixup_gpio1,
2374 	},
2375 	[ALC882_FIXUP_GPIO2] = {
2376 		.type = HDA_FIXUP_FUNC,
2377 		.v.func = alc_fixup_gpio2,
2378 	},
2379 	[ALC882_FIXUP_GPIO3] = {
2380 		.type = HDA_FIXUP_FUNC,
2381 		.v.func = alc_fixup_gpio3,
2382 	},
2383 	[ALC882_FIXUP_ASUS_W2JC] = {
2384 		.type = HDA_FIXUP_FUNC,
2385 		.v.func = alc_fixup_gpio1,
2386 		.chained = true,
2387 		.chain_id = ALC882_FIXUP_EAPD,
2388 	},
2389 	[ALC889_FIXUP_COEF] = {
2390 		.type = HDA_FIXUP_FUNC,
2391 		.v.func = alc889_fixup_coef,
2392 	},
2393 	[ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2394 		.type = HDA_FIXUP_PINS,
2395 		.v.pins = (const struct hda_pintbl[]) {
2396 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2397 			{ 0x17, 0x99130112 }, /* surround speaker */
2398 			{ }
2399 		},
2400 		.chained = true,
2401 		.chain_id = ALC882_FIXUP_GPIO1,
2402 	},
2403 	[ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2404 		.type = HDA_FIXUP_PINS,
2405 		.v.pins = (const struct hda_pintbl[]) {
2406 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2407 			{ 0x1b, 0x99130112 }, /* surround speaker */
2408 			{ }
2409 		},
2410 		.chained = true,
2411 		.chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2412 	},
2413 	[ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2414 		/* additional init verbs for Acer Aspire 8930G */
2415 		.type = HDA_FIXUP_VERBS,
2416 		.v.verbs = (const struct hda_verb[]) {
2417 			/* Enable all DACs */
2418 			/* DAC DISABLE/MUTE 1? */
2419 			/*  setting bits 1-5 disables DAC nids 0x02-0x06
2420 			 *  apparently. Init=0x38 */
2421 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2422 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2423 			/* DAC DISABLE/MUTE 2? */
2424 			/*  some bit here disables the other DACs.
2425 			 *  Init=0x4900 */
2426 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2427 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2428 			/* DMIC fix
2429 			 * This laptop has a stereo digital microphone.
2430 			 * The mics are only 1cm apart which makes the stereo
2431 			 * useless. However, either the mic or the ALC889
2432 			 * makes the signal become a difference/sum signal
2433 			 * instead of standard stereo, which is annoying.
2434 			 * So instead we flip this bit which makes the
2435 			 * codec replicate the sum signal to both channels,
2436 			 * turning it into a normal mono mic.
2437 			 */
2438 			/* DMIC_CONTROL? Init value = 0x0001 */
2439 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2440 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2441 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2442 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2443 			{ }
2444 		},
2445 		.chained = true,
2446 		.chain_id = ALC882_FIXUP_GPIO1,
2447 	},
2448 	[ALC885_FIXUP_MACPRO_GPIO] = {
2449 		.type = HDA_FIXUP_FUNC,
2450 		.v.func = alc885_fixup_macpro_gpio,
2451 	},
2452 	[ALC889_FIXUP_DAC_ROUTE] = {
2453 		.type = HDA_FIXUP_FUNC,
2454 		.v.func = alc889_fixup_dac_route,
2455 	},
2456 	[ALC889_FIXUP_MBP_VREF] = {
2457 		.type = HDA_FIXUP_FUNC,
2458 		.v.func = alc889_fixup_mbp_vref,
2459 		.chained = true,
2460 		.chain_id = ALC882_FIXUP_GPIO1,
2461 	},
2462 	[ALC889_FIXUP_IMAC91_VREF] = {
2463 		.type = HDA_FIXUP_FUNC,
2464 		.v.func = alc889_fixup_imac91_vref,
2465 		.chained = true,
2466 		.chain_id = ALC882_FIXUP_GPIO1,
2467 	},
2468 	[ALC889_FIXUP_MBA11_VREF] = {
2469 		.type = HDA_FIXUP_FUNC,
2470 		.v.func = alc889_fixup_mba11_vref,
2471 		.chained = true,
2472 		.chain_id = ALC889_FIXUP_MBP_VREF,
2473 	},
2474 	[ALC889_FIXUP_MBA21_VREF] = {
2475 		.type = HDA_FIXUP_FUNC,
2476 		.v.func = alc889_fixup_mba21_vref,
2477 		.chained = true,
2478 		.chain_id = ALC889_FIXUP_MBP_VREF,
2479 	},
2480 	[ALC889_FIXUP_MP11_VREF] = {
2481 		.type = HDA_FIXUP_FUNC,
2482 		.v.func = alc889_fixup_mba11_vref,
2483 		.chained = true,
2484 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2485 	},
2486 	[ALC889_FIXUP_MP41_VREF] = {
2487 		.type = HDA_FIXUP_FUNC,
2488 		.v.func = alc889_fixup_mbp_vref,
2489 		.chained = true,
2490 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2491 	},
2492 	[ALC882_FIXUP_INV_DMIC] = {
2493 		.type = HDA_FIXUP_FUNC,
2494 		.v.func = alc_fixup_inv_dmic,
2495 	},
2496 	[ALC882_FIXUP_NO_PRIMARY_HP] = {
2497 		.type = HDA_FIXUP_FUNC,
2498 		.v.func = alc882_fixup_no_primary_hp,
2499 	},
2500 	[ALC887_FIXUP_ASUS_BASS] = {
2501 		.type = HDA_FIXUP_PINS,
2502 		.v.pins = (const struct hda_pintbl[]) {
2503 			{0x16, 0x99130130}, /* bass speaker */
2504 			{}
2505 		},
2506 		.chained = true,
2507 		.chain_id = ALC887_FIXUP_BASS_CHMAP,
2508 	},
2509 	[ALC887_FIXUP_BASS_CHMAP] = {
2510 		.type = HDA_FIXUP_FUNC,
2511 		.v.func = alc_fixup_bass_chmap,
2512 	},
2513 	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
2514 		.type = HDA_FIXUP_FUNC,
2515 		.v.func = alc1220_fixup_gb_dual_codecs,
2516 	},
2517 	[ALC1220_FIXUP_GB_X570] = {
2518 		.type = HDA_FIXUP_FUNC,
2519 		.v.func = alc1220_fixup_gb_x570,
2520 	},
2521 	[ALC1220_FIXUP_CLEVO_P950] = {
2522 		.type = HDA_FIXUP_FUNC,
2523 		.v.func = alc1220_fixup_clevo_p950,
2524 	},
2525 	[ALC1220_FIXUP_CLEVO_PB51ED] = {
2526 		.type = HDA_FIXUP_FUNC,
2527 		.v.func = alc1220_fixup_clevo_pb51ed,
2528 	},
2529 	[ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2530 		.type = HDA_FIXUP_PINS,
2531 		.v.pins = (const struct hda_pintbl[]) {
2532 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2533 			{}
2534 		},
2535 		.chained = true,
2536 		.chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2537 	},
2538 	[ALC887_FIXUP_ASUS_AUDIO] = {
2539 		.type = HDA_FIXUP_PINS,
2540 		.v.pins = (const struct hda_pintbl[]) {
2541 			{ 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2542 			{ 0x19, 0x22219420 },
2543 			{}
2544 		},
2545 	},
2546 	[ALC887_FIXUP_ASUS_HMIC] = {
2547 		.type = HDA_FIXUP_FUNC,
2548 		.v.func = alc887_fixup_asus_jack,
2549 		.chained = true,
2550 		.chain_id = ALC887_FIXUP_ASUS_AUDIO,
2551 	},
2552 	[ALCS1200A_FIXUP_MIC_VREF] = {
2553 		.type = HDA_FIXUP_PINCTLS,
2554 		.v.pins = (const struct hda_pintbl[]) {
2555 			{ 0x18, PIN_VREF50 }, /* rear mic */
2556 			{ 0x19, PIN_VREF50 }, /* front mic */
2557 			{}
2558 		}
2559 	},
2560 	[ALC888VD_FIXUP_MIC_100VREF] = {
2561 		.type = HDA_FIXUP_PINCTLS,
2562 		.v.pins = (const struct hda_pintbl[]) {
2563 			{ 0x18, PIN_VREF100 }, /* headset mic */
2564 			{}
2565 		}
2566 	},
2567 };
2568 
2569 static const struct hda_quirk alc882_fixup_tbl[] = {
2570 	SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2571 	SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2572 	SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2573 	SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2574 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2575 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2576 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2577 	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2578 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2579 	SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2580 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2581 	SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2582 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2583 	SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2584 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2585 	SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2586 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2587 	SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2588 	SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2589 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2590 	SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2591 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2592 	SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2593 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2594 	SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2595 	SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2596 	SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2597 	SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2598 	SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2599 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2600 	SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2601 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2602 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2603 	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2604 	SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2605 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2606 	SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2607 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2608 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2609 	SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2610 
2611 	/* All Apple entries are in codec SSIDs */
2612 	SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2613 	SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2614 	SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2615 	SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2616 	SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2617 	SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2618 	SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2619 	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2620 	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2621 	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2622 	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2623 	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2624 	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2625 	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2626 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2627 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2628 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2629 	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2630 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2631 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2632 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2633 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2634 
2635 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2636 	SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2637 	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2638 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2639 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2640 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2641 	SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2642 	SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2643 	SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2644 	SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2645 	SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2646 	SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2647 	SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2648 	SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2649 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2650 	SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2651 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2652 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2653 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2654 	SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2655 	SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2656 	SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 	SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 	SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 	SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 	SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2661 	SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2662 	SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2663 	SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2664 	SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2665 	SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2666 	SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2667 	SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2668 	SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2669 	SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2670 	SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2671 	SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2672 	SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2673 	SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2674 	SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2675 	SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2676 	SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2677 	SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2678 	SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2679 	SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2680 	SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2681 	SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2682 	SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2683 	SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2684 	SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2685 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2686 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2687 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2688 	SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2689 	{}
2690 };
2691 
2692 static const struct hda_model_fixup alc882_fixup_models[] = {
2693 	{.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2694 	{.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2695 	{.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2696 	{.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2697 	{.id = ALC889_FIXUP_CD, .name = "cd"},
2698 	{.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2699 	{.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2700 	{.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2701 	{.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2702 	{.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2703 	{.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2704 	{.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2705 	{.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2706 	{.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2707 	{.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2708 	{.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2709 	{.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2710 	{.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2711 	{.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2712 	{.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2713 	{.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2714 	{.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2715 	{.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2716 	{.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2717 	{.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2718 	{.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2719 	{.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2720 	{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2721 	{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2722 	{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2723 	{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2724 	{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2725 	{}
2726 };
2727 
2728 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2729 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2730 		{0x14, 0x01014010},
2731 		{0x15, 0x01011012},
2732 		{0x16, 0x01016011},
2733 		{0x18, 0x01a19040},
2734 		{0x19, 0x02a19050},
2735 		{0x1a, 0x0181304f},
2736 		{0x1b, 0x0221401f},
2737 		{0x1e, 0x01456130}),
2738 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2739 		{0x14, 0x01015010},
2740 		{0x15, 0x01011012},
2741 		{0x16, 0x01011011},
2742 		{0x18, 0x01a11040},
2743 		{0x19, 0x02a19050},
2744 		{0x1a, 0x0181104f},
2745 		{0x1b, 0x0221401f},
2746 		{0x1e, 0x01451130}),
2747 	{}
2748 };
2749 
2750 /*
2751  * BIOS auto configuration
2752  */
2753 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2754 static int alc882_parse_auto_config(struct hda_codec *codec)
2755 {
2756 	static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2757 	static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2758 	return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2759 }
2760 
2761 /*
2762  */
patch_alc882(struct hda_codec * codec)2763 static int patch_alc882(struct hda_codec *codec)
2764 {
2765 	struct alc_spec *spec;
2766 	int err;
2767 
2768 	err = alc_alloc_spec(codec, 0x0b);
2769 	if (err < 0)
2770 		return err;
2771 
2772 	spec = codec->spec;
2773 
2774 	switch (codec->core.vendor_id) {
2775 	case 0x10ec0882:
2776 	case 0x10ec0885:
2777 	case 0x10ec0900:
2778 	case 0x10ec0b00:
2779 	case 0x10ec1220:
2780 		break;
2781 	default:
2782 		/* ALC883 and variants */
2783 		alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2784 		break;
2785 	}
2786 
2787 	alc_pre_init(codec);
2788 
2789 	snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2790 		       alc882_fixups);
2791 	snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2792 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2793 
2794 	alc_auto_parse_customize_define(codec);
2795 
2796 	if (has_cdefine_beep(codec))
2797 		spec->gen.beep_nid = 0x01;
2798 
2799 	/* automatic parse from the BIOS config */
2800 	err = alc882_parse_auto_config(codec);
2801 	if (err < 0)
2802 		goto error;
2803 
2804 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2805 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2806 		if (err < 0)
2807 			goto error;
2808 	}
2809 
2810 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2811 
2812 	return 0;
2813 
2814  error:
2815 	alc_free(codec);
2816 	return err;
2817 }
2818 
2819 
2820 /*
2821  * ALC262 support
2822  */
alc262_parse_auto_config(struct hda_codec * codec)2823 static int alc262_parse_auto_config(struct hda_codec *codec)
2824 {
2825 	static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2826 	static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2827 	return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2828 }
2829 
2830 /*
2831  * Pin config fixes
2832  */
2833 enum {
2834 	ALC262_FIXUP_FSC_H270,
2835 	ALC262_FIXUP_FSC_S7110,
2836 	ALC262_FIXUP_HP_Z200,
2837 	ALC262_FIXUP_TYAN,
2838 	ALC262_FIXUP_LENOVO_3000,
2839 	ALC262_FIXUP_BENQ,
2840 	ALC262_FIXUP_BENQ_T31,
2841 	ALC262_FIXUP_INV_DMIC,
2842 	ALC262_FIXUP_INTEL_BAYLEYBAY,
2843 };
2844 
2845 static const struct hda_fixup alc262_fixups[] = {
2846 	[ALC262_FIXUP_FSC_H270] = {
2847 		.type = HDA_FIXUP_PINS,
2848 		.v.pins = (const struct hda_pintbl[]) {
2849 			{ 0x14, 0x99130110 }, /* speaker */
2850 			{ 0x15, 0x0221142f }, /* front HP */
2851 			{ 0x1b, 0x0121141f }, /* rear HP */
2852 			{ }
2853 		}
2854 	},
2855 	[ALC262_FIXUP_FSC_S7110] = {
2856 		.type = HDA_FIXUP_PINS,
2857 		.v.pins = (const struct hda_pintbl[]) {
2858 			{ 0x15, 0x90170110 }, /* speaker */
2859 			{ }
2860 		},
2861 		.chained = true,
2862 		.chain_id = ALC262_FIXUP_BENQ,
2863 	},
2864 	[ALC262_FIXUP_HP_Z200] = {
2865 		.type = HDA_FIXUP_PINS,
2866 		.v.pins = (const struct hda_pintbl[]) {
2867 			{ 0x16, 0x99130120 }, /* internal speaker */
2868 			{ }
2869 		}
2870 	},
2871 	[ALC262_FIXUP_TYAN] = {
2872 		.type = HDA_FIXUP_PINS,
2873 		.v.pins = (const struct hda_pintbl[]) {
2874 			{ 0x14, 0x1993e1f0 }, /* int AUX */
2875 			{ }
2876 		}
2877 	},
2878 	[ALC262_FIXUP_LENOVO_3000] = {
2879 		.type = HDA_FIXUP_PINCTLS,
2880 		.v.pins = (const struct hda_pintbl[]) {
2881 			{ 0x19, PIN_VREF50 },
2882 			{}
2883 		},
2884 		.chained = true,
2885 		.chain_id = ALC262_FIXUP_BENQ,
2886 	},
2887 	[ALC262_FIXUP_BENQ] = {
2888 		.type = HDA_FIXUP_VERBS,
2889 		.v.verbs = (const struct hda_verb[]) {
2890 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2891 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2892 			{}
2893 		}
2894 	},
2895 	[ALC262_FIXUP_BENQ_T31] = {
2896 		.type = HDA_FIXUP_VERBS,
2897 		.v.verbs = (const struct hda_verb[]) {
2898 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2899 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2900 			{}
2901 		}
2902 	},
2903 	[ALC262_FIXUP_INV_DMIC] = {
2904 		.type = HDA_FIXUP_FUNC,
2905 		.v.func = alc_fixup_inv_dmic,
2906 	},
2907 	[ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2908 		.type = HDA_FIXUP_FUNC,
2909 		.v.func = alc_fixup_no_depop_delay,
2910 	},
2911 };
2912 
2913 static const struct hda_quirk alc262_fixup_tbl[] = {
2914 	SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2915 	SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2916 	SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2917 	SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2918 	SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2919 	SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2920 	SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2921 	SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2922 	SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2923 	SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2924 	{}
2925 };
2926 
2927 static const struct hda_model_fixup alc262_fixup_models[] = {
2928 	{.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2929 	{.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2930 	{.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2931 	{.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2932 	{.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2933 	{.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2934 	{.id = ALC262_FIXUP_BENQ, .name = "benq"},
2935 	{.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2936 	{.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2937 	{}
2938 };
2939 
2940 /*
2941  */
patch_alc262(struct hda_codec * codec)2942 static int patch_alc262(struct hda_codec *codec)
2943 {
2944 	struct alc_spec *spec;
2945 	int err;
2946 
2947 	err = alc_alloc_spec(codec, 0x0b);
2948 	if (err < 0)
2949 		return err;
2950 
2951 	spec = codec->spec;
2952 	spec->gen.shared_mic_vref_pin = 0x18;
2953 
2954 	spec->shutup = alc_eapd_shutup;
2955 
2956 #if 0
2957 	/* pshou 07/11/05  set a zero PCM sample to DAC when FIFO is
2958 	 * under-run
2959 	 */
2960 	alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2961 #endif
2962 	alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2963 
2964 	alc_pre_init(codec);
2965 
2966 	snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2967 		       alc262_fixups);
2968 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2969 
2970 	alc_auto_parse_customize_define(codec);
2971 
2972 	if (has_cdefine_beep(codec))
2973 		spec->gen.beep_nid = 0x01;
2974 
2975 	/* automatic parse from the BIOS config */
2976 	err = alc262_parse_auto_config(codec);
2977 	if (err < 0)
2978 		goto error;
2979 
2980 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2981 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2982 		if (err < 0)
2983 			goto error;
2984 	}
2985 
2986 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2987 
2988 	return 0;
2989 
2990  error:
2991 	alc_free(codec);
2992 	return err;
2993 }
2994 
2995 /*
2996  *  ALC268
2997  */
2998 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)2999 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
3000 				  struct snd_ctl_elem_value *ucontrol)
3001 {
3002 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3003 	unsigned long pval;
3004 	int err;
3005 
3006 	mutex_lock(&codec->control_mutex);
3007 	pval = kcontrol->private_value;
3008 	kcontrol->private_value = (pval & ~0xff) | 0x0f;
3009 	err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3010 	if (err >= 0) {
3011 		kcontrol->private_value = (pval & ~0xff) | 0x10;
3012 		err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3013 	}
3014 	kcontrol->private_value = pval;
3015 	mutex_unlock(&codec->control_mutex);
3016 	return err;
3017 }
3018 
3019 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3020 	HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3021 	{
3022 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3023 		.name = "Beep Playback Switch",
3024 		.subdevice = HDA_SUBDEV_AMP_FLAG,
3025 		.info = snd_hda_mixer_amp_switch_info,
3026 		.get = snd_hda_mixer_amp_switch_get,
3027 		.put = alc268_beep_switch_put,
3028 		.private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3029 	},
3030 };
3031 
3032 /* set PCBEEP vol = 0, mute connections */
3033 static const struct hda_verb alc268_beep_init_verbs[] = {
3034 	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3035 	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3036 	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3037 	{ }
3038 };
3039 
3040 enum {
3041 	ALC268_FIXUP_INV_DMIC,
3042 	ALC268_FIXUP_HP_EAPD,
3043 	ALC268_FIXUP_SPDIF,
3044 };
3045 
3046 static const struct hda_fixup alc268_fixups[] = {
3047 	[ALC268_FIXUP_INV_DMIC] = {
3048 		.type = HDA_FIXUP_FUNC,
3049 		.v.func = alc_fixup_inv_dmic,
3050 	},
3051 	[ALC268_FIXUP_HP_EAPD] = {
3052 		.type = HDA_FIXUP_VERBS,
3053 		.v.verbs = (const struct hda_verb[]) {
3054 			{0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3055 			{}
3056 		}
3057 	},
3058 	[ALC268_FIXUP_SPDIF] = {
3059 		.type = HDA_FIXUP_PINS,
3060 		.v.pins = (const struct hda_pintbl[]) {
3061 			{ 0x1e, 0x014b1180 }, /* enable SPDIF out */
3062 			{}
3063 		}
3064 	},
3065 };
3066 
3067 static const struct hda_model_fixup alc268_fixup_models[] = {
3068 	{.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3069 	{.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3070 	{.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3071 	{}
3072 };
3073 
3074 static const struct hda_quirk alc268_fixup_tbl[] = {
3075 	SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3076 	SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3077 	/* below is codec SSID since multiple Toshiba laptops have the
3078 	 * same PCI SSID 1179:ff00
3079 	 */
3080 	SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3081 	{}
3082 };
3083 
3084 /*
3085  * BIOS auto configuration
3086  */
alc268_parse_auto_config(struct hda_codec * codec)3087 static int alc268_parse_auto_config(struct hda_codec *codec)
3088 {
3089 	static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3090 	return alc_parse_auto_config(codec, NULL, alc268_ssids);
3091 }
3092 
3093 /*
3094  */
patch_alc268(struct hda_codec * codec)3095 static int patch_alc268(struct hda_codec *codec)
3096 {
3097 	struct alc_spec *spec;
3098 	int i, err;
3099 
3100 	/* ALC268 has no aa-loopback mixer */
3101 	err = alc_alloc_spec(codec, 0);
3102 	if (err < 0)
3103 		return err;
3104 
3105 	spec = codec->spec;
3106 	if (has_cdefine_beep(codec))
3107 		spec->gen.beep_nid = 0x01;
3108 
3109 	spec->shutup = alc_eapd_shutup;
3110 
3111 	alc_pre_init(codec);
3112 
3113 	snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3114 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3115 
3116 	/* automatic parse from the BIOS config */
3117 	err = alc268_parse_auto_config(codec);
3118 	if (err < 0)
3119 		goto error;
3120 
3121 	if (err > 0 && !spec->gen.no_analog &&
3122 	    spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3123 		for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3124 			if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3125 						  &alc268_beep_mixer[i])) {
3126 				err = -ENOMEM;
3127 				goto error;
3128 			}
3129 		}
3130 		snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3131 		if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3132 			/* override the amp caps for beep generator */
3133 			snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3134 					  (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3135 					  (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3136 					  (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3137 					  (0 << AC_AMPCAP_MUTE_SHIFT));
3138 	}
3139 
3140 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3141 
3142 	return 0;
3143 
3144  error:
3145 	alc_free(codec);
3146 	return err;
3147 }
3148 
3149 /*
3150  * ALC269
3151  */
3152 
3153 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3154 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3155 };
3156 
3157 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3158 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3159 };
3160 
3161 /* different alc269-variants */
3162 enum {
3163 	ALC269_TYPE_ALC269VA,
3164 	ALC269_TYPE_ALC269VB,
3165 	ALC269_TYPE_ALC269VC,
3166 	ALC269_TYPE_ALC269VD,
3167 	ALC269_TYPE_ALC280,
3168 	ALC269_TYPE_ALC282,
3169 	ALC269_TYPE_ALC283,
3170 	ALC269_TYPE_ALC284,
3171 	ALC269_TYPE_ALC293,
3172 	ALC269_TYPE_ALC286,
3173 	ALC269_TYPE_ALC298,
3174 	ALC269_TYPE_ALC255,
3175 	ALC269_TYPE_ALC256,
3176 	ALC269_TYPE_ALC257,
3177 	ALC269_TYPE_ALC215,
3178 	ALC269_TYPE_ALC225,
3179 	ALC269_TYPE_ALC245,
3180 	ALC269_TYPE_ALC287,
3181 	ALC269_TYPE_ALC294,
3182 	ALC269_TYPE_ALC300,
3183 	ALC269_TYPE_ALC623,
3184 	ALC269_TYPE_ALC700,
3185 };
3186 
3187 /*
3188  * BIOS auto configuration
3189  */
alc269_parse_auto_config(struct hda_codec * codec)3190 static int alc269_parse_auto_config(struct hda_codec *codec)
3191 {
3192 	static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3193 	static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3194 	static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3195 	struct alc_spec *spec = codec->spec;
3196 	const hda_nid_t *ssids;
3197 
3198 	switch (spec->codec_variant) {
3199 	case ALC269_TYPE_ALC269VA:
3200 	case ALC269_TYPE_ALC269VC:
3201 	case ALC269_TYPE_ALC280:
3202 	case ALC269_TYPE_ALC284:
3203 	case ALC269_TYPE_ALC293:
3204 		ssids = alc269va_ssids;
3205 		break;
3206 	case ALC269_TYPE_ALC269VB:
3207 	case ALC269_TYPE_ALC269VD:
3208 	case ALC269_TYPE_ALC282:
3209 	case ALC269_TYPE_ALC283:
3210 	case ALC269_TYPE_ALC286:
3211 	case ALC269_TYPE_ALC298:
3212 	case ALC269_TYPE_ALC255:
3213 	case ALC269_TYPE_ALC256:
3214 	case ALC269_TYPE_ALC257:
3215 	case ALC269_TYPE_ALC215:
3216 	case ALC269_TYPE_ALC225:
3217 	case ALC269_TYPE_ALC245:
3218 	case ALC269_TYPE_ALC287:
3219 	case ALC269_TYPE_ALC294:
3220 	case ALC269_TYPE_ALC300:
3221 	case ALC269_TYPE_ALC623:
3222 	case ALC269_TYPE_ALC700:
3223 		ssids = alc269_ssids;
3224 		break;
3225 	default:
3226 		ssids = alc269_ssids;
3227 		break;
3228 	}
3229 
3230 	return alc_parse_auto_config(codec, alc269_ignore, ssids);
3231 }
3232 
3233 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3234 	{ SND_JACK_BTN_0, KEY_PLAYPAUSE },
3235 	{ SND_JACK_BTN_1, KEY_VOICECOMMAND },
3236 	{ SND_JACK_BTN_2, KEY_VOLUMEUP },
3237 	{ SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3238 	{}
3239 };
3240 
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3241 static void alc_headset_btn_callback(struct hda_codec *codec,
3242 				     struct hda_jack_callback *jack)
3243 {
3244 	int report = 0;
3245 
3246 	if (jack->unsol_res & (7 << 13))
3247 		report |= SND_JACK_BTN_0;
3248 
3249 	if (jack->unsol_res  & (1 << 16 | 3 << 8))
3250 		report |= SND_JACK_BTN_1;
3251 
3252 	/* Volume up key */
3253 	if (jack->unsol_res & (7 << 23))
3254 		report |= SND_JACK_BTN_2;
3255 
3256 	/* Volume down key */
3257 	if (jack->unsol_res & (7 << 10))
3258 		report |= SND_JACK_BTN_3;
3259 
3260 	snd_hda_jack_set_button_state(codec, jack->nid, report);
3261 }
3262 
alc_disable_headset_jack_key(struct hda_codec * codec)3263 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3264 {
3265 	struct alc_spec *spec = codec->spec;
3266 
3267 	if (!spec->has_hs_key)
3268 		return;
3269 
3270 	switch (codec->core.vendor_id) {
3271 	case 0x10ec0215:
3272 	case 0x10ec0225:
3273 	case 0x10ec0285:
3274 	case 0x10ec0287:
3275 	case 0x10ec0295:
3276 	case 0x10ec0289:
3277 	case 0x10ec0299:
3278 		alc_write_coef_idx(codec, 0x48, 0x0);
3279 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3280 		alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3281 		break;
3282 	case 0x10ec0230:
3283 	case 0x10ec0236:
3284 	case 0x10ec0256:
3285 	case 0x10ec0257:
3286 	case 0x19e58326:
3287 		alc_write_coef_idx(codec, 0x48, 0x0);
3288 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3289 		break;
3290 	}
3291 }
3292 
alc_enable_headset_jack_key(struct hda_codec * codec)3293 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3294 {
3295 	struct alc_spec *spec = codec->spec;
3296 
3297 	if (!spec->has_hs_key)
3298 		return;
3299 
3300 	switch (codec->core.vendor_id) {
3301 	case 0x10ec0215:
3302 	case 0x10ec0225:
3303 	case 0x10ec0285:
3304 	case 0x10ec0287:
3305 	case 0x10ec0295:
3306 	case 0x10ec0289:
3307 	case 0x10ec0299:
3308 		alc_write_coef_idx(codec, 0x48, 0xd011);
3309 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3310 		alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3311 		break;
3312 	case 0x10ec0230:
3313 	case 0x10ec0236:
3314 	case 0x10ec0256:
3315 	case 0x10ec0257:
3316 	case 0x19e58326:
3317 		alc_write_coef_idx(codec, 0x48, 0xd011);
3318 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3319 		break;
3320 	}
3321 }
3322 
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3323 static void alc_fixup_headset_jack(struct hda_codec *codec,
3324 				    const struct hda_fixup *fix, int action)
3325 {
3326 	struct alc_spec *spec = codec->spec;
3327 	hda_nid_t hp_pin;
3328 
3329 	switch (action) {
3330 	case HDA_FIXUP_ACT_PRE_PROBE:
3331 		spec->has_hs_key = 1;
3332 		snd_hda_jack_detect_enable_callback(codec, 0x55,
3333 						    alc_headset_btn_callback);
3334 		break;
3335 	case HDA_FIXUP_ACT_BUILD:
3336 		hp_pin = alc_get_hp_pin(spec);
3337 		if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3338 							alc_headset_btn_keymap,
3339 							hp_pin))
3340 			snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3341 					      false, SND_JACK_HEADSET,
3342 					      alc_headset_btn_keymap);
3343 
3344 		alc_enable_headset_jack_key(codec);
3345 		break;
3346 	}
3347 }
3348 
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3349 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3350 {
3351 	alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3352 }
3353 
alc269_shutup(struct hda_codec * codec)3354 static void alc269_shutup(struct hda_codec *codec)
3355 {
3356 	struct alc_spec *spec = codec->spec;
3357 
3358 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3359 		alc269vb_toggle_power_output(codec, 0);
3360 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3361 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3362 		msleep(150);
3363 	}
3364 	alc_shutup_pins(codec);
3365 }
3366 
3367 static const struct coef_fw alc282_coefs[] = {
3368 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3369 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3370 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3371 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3372 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3373 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3374 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3375 	WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3376 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3377 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3378 	WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3379 	UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3380 	WRITE_COEF(0x34, 0xa0c0), /* ANC */
3381 	UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3382 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3383 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3384 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3385 	WRITE_COEF(0x63, 0x2902), /* PLL */
3386 	WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3387 	WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3388 	WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3389 	WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3390 	UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3391 	WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3392 	UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3393 	WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3394 	WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3395 	UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3396 	WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3397 	{}
3398 };
3399 
alc282_restore_default_value(struct hda_codec * codec)3400 static void alc282_restore_default_value(struct hda_codec *codec)
3401 {
3402 	alc_process_coef_fw(codec, alc282_coefs);
3403 }
3404 
alc282_init(struct hda_codec * codec)3405 static void alc282_init(struct hda_codec *codec)
3406 {
3407 	struct alc_spec *spec = codec->spec;
3408 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3409 	bool hp_pin_sense;
3410 	int coef78;
3411 
3412 	alc282_restore_default_value(codec);
3413 
3414 	if (!hp_pin)
3415 		return;
3416 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3417 	coef78 = alc_read_coef_idx(codec, 0x78);
3418 
3419 	/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3420 	/* Headphone capless set to high power mode */
3421 	alc_write_coef_idx(codec, 0x78, 0x9004);
3422 
3423 	if (hp_pin_sense)
3424 		msleep(2);
3425 
3426 	snd_hda_codec_write(codec, hp_pin, 0,
3427 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3428 
3429 	if (hp_pin_sense)
3430 		msleep(85);
3431 
3432 	snd_hda_codec_write(codec, hp_pin, 0,
3433 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3434 
3435 	if (hp_pin_sense)
3436 		msleep(100);
3437 
3438 	/* Headphone capless set to normal mode */
3439 	alc_write_coef_idx(codec, 0x78, coef78);
3440 }
3441 
alc282_shutup(struct hda_codec * codec)3442 static void alc282_shutup(struct hda_codec *codec)
3443 {
3444 	struct alc_spec *spec = codec->spec;
3445 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3446 	bool hp_pin_sense;
3447 	int coef78;
3448 
3449 	if (!hp_pin) {
3450 		alc269_shutup(codec);
3451 		return;
3452 	}
3453 
3454 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3455 	coef78 = alc_read_coef_idx(codec, 0x78);
3456 	alc_write_coef_idx(codec, 0x78, 0x9004);
3457 
3458 	if (hp_pin_sense)
3459 		msleep(2);
3460 
3461 	snd_hda_codec_write(codec, hp_pin, 0,
3462 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3463 
3464 	if (hp_pin_sense)
3465 		msleep(85);
3466 
3467 	if (!spec->no_shutup_pins)
3468 		snd_hda_codec_write(codec, hp_pin, 0,
3469 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3470 
3471 	if (hp_pin_sense)
3472 		msleep(100);
3473 
3474 	alc_auto_setup_eapd(codec, false);
3475 	alc_shutup_pins(codec);
3476 	alc_write_coef_idx(codec, 0x78, coef78);
3477 }
3478 
3479 static const struct coef_fw alc283_coefs[] = {
3480 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3481 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3482 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3483 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3484 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3485 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3486 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3487 	WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3488 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3489 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3490 	WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3491 	UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3492 	WRITE_COEF(0x22, 0xa0c0), /* ANC */
3493 	UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3494 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3495 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3496 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3497 	WRITE_COEF(0x2e, 0x2902), /* PLL */
3498 	WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3499 	WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3500 	WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3501 	WRITE_COEF(0x36, 0x0), /* capless control 5 */
3502 	UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3503 	WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3504 	UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3505 	WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3506 	WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3507 	UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3508 	WRITE_COEF(0x49, 0x0), /* test mode */
3509 	UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3510 	UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3511 	WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3512 	UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3513 	{}
3514 };
3515 
alc283_restore_default_value(struct hda_codec * codec)3516 static void alc283_restore_default_value(struct hda_codec *codec)
3517 {
3518 	alc_process_coef_fw(codec, alc283_coefs);
3519 }
3520 
alc283_init(struct hda_codec * codec)3521 static void alc283_init(struct hda_codec *codec)
3522 {
3523 	struct alc_spec *spec = codec->spec;
3524 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3525 	bool hp_pin_sense;
3526 
3527 	alc283_restore_default_value(codec);
3528 
3529 	if (!hp_pin)
3530 		return;
3531 
3532 	msleep(30);
3533 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3534 
3535 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3536 	/* Headphone capless set to high power mode */
3537 	alc_write_coef_idx(codec, 0x43, 0x9004);
3538 
3539 	snd_hda_codec_write(codec, hp_pin, 0,
3540 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3541 
3542 	if (hp_pin_sense)
3543 		msleep(85);
3544 
3545 	snd_hda_codec_write(codec, hp_pin, 0,
3546 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3547 
3548 	if (hp_pin_sense)
3549 		msleep(85);
3550 	/* Index 0x46 Combo jack auto switch control 2 */
3551 	/* 3k pull low control for Headset jack. */
3552 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3553 	/* Headphone capless set to normal mode */
3554 	alc_write_coef_idx(codec, 0x43, 0x9614);
3555 }
3556 
alc283_shutup(struct hda_codec * codec)3557 static void alc283_shutup(struct hda_codec *codec)
3558 {
3559 	struct alc_spec *spec = codec->spec;
3560 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3561 	bool hp_pin_sense;
3562 
3563 	if (!hp_pin) {
3564 		alc269_shutup(codec);
3565 		return;
3566 	}
3567 
3568 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3569 
3570 	alc_write_coef_idx(codec, 0x43, 0x9004);
3571 
3572 	/*depop hp during suspend*/
3573 	alc_write_coef_idx(codec, 0x06, 0x2100);
3574 
3575 	snd_hda_codec_write(codec, hp_pin, 0,
3576 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3577 
3578 	if (hp_pin_sense)
3579 		msleep(100);
3580 
3581 	if (!spec->no_shutup_pins)
3582 		snd_hda_codec_write(codec, hp_pin, 0,
3583 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3584 
3585 	alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3586 
3587 	if (hp_pin_sense)
3588 		msleep(100);
3589 	alc_auto_setup_eapd(codec, false);
3590 	alc_shutup_pins(codec);
3591 	alc_write_coef_idx(codec, 0x43, 0x9614);
3592 }
3593 
alc256_init(struct hda_codec * codec)3594 static void alc256_init(struct hda_codec *codec)
3595 {
3596 	struct alc_spec *spec = codec->spec;
3597 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3598 	bool hp_pin_sense;
3599 
3600 	if (spec->ultra_low_power) {
3601 		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3602 		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3603 		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3604 		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3605 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3606 		msleep(30);
3607 	}
3608 
3609 	if (!hp_pin)
3610 		hp_pin = 0x21;
3611 
3612 	msleep(30);
3613 
3614 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3615 
3616 	if (hp_pin_sense) {
3617 		msleep(2);
3618 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3619 
3620 		snd_hda_codec_write(codec, hp_pin, 0,
3621 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3622 
3623 		msleep(75);
3624 
3625 		snd_hda_codec_write(codec, hp_pin, 0,
3626 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3627 
3628 		msleep(75);
3629 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3630 	}
3631 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3632 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3633 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3634 	/*
3635 	 * Expose headphone mic (or possibly Line In on some machines) instead
3636 	 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3637 	 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3638 	 * this register.
3639 	 */
3640 	alc_write_coef_idx(codec, 0x36, 0x5757);
3641 }
3642 
alc256_shutup(struct hda_codec * codec)3643 static void alc256_shutup(struct hda_codec *codec)
3644 {
3645 	struct alc_spec *spec = codec->spec;
3646 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3647 	bool hp_pin_sense;
3648 
3649 	if (!hp_pin)
3650 		hp_pin = 0x21;
3651 
3652 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3653 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3654 
3655 	if (hp_pin_sense) {
3656 		msleep(2);
3657 
3658 		snd_hda_codec_write(codec, hp_pin, 0,
3659 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3660 
3661 		msleep(75);
3662 
3663 	/* 3k pull low control for Headset jack. */
3664 	/* NOTE: call this before clearing the pin, otherwise codec stalls */
3665 	/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3666 	 * when booting with headset plugged. So skip setting it for the codec alc257
3667 	 */
3668 		if (spec->en_3kpull_low)
3669 			alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3670 
3671 		if (!spec->no_shutup_pins)
3672 			snd_hda_codec_write(codec, hp_pin, 0,
3673 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3674 
3675 		msleep(75);
3676 	}
3677 
3678 	alc_auto_setup_eapd(codec, false);
3679 	alc_shutup_pins(codec);
3680 	if (spec->ultra_low_power) {
3681 		msleep(50);
3682 		alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3683 		alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3684 		alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3685 		alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3686 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3687 		msleep(30);
3688 	}
3689 }
3690 
alc285_hp_init(struct hda_codec * codec)3691 static void alc285_hp_init(struct hda_codec *codec)
3692 {
3693 	struct alc_spec *spec = codec->spec;
3694 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3695 	int i, val;
3696 	int coef38, coef0d, coef36;
3697 
3698 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3699 	alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3700 	coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3701 	coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3702 	coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3703 	alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3704 	alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3705 
3706 	alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3707 
3708 	if (hp_pin)
3709 		snd_hda_codec_write(codec, hp_pin, 0,
3710 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3711 
3712 	msleep(130);
3713 	alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3714 	alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3715 
3716 	if (hp_pin)
3717 		snd_hda_codec_write(codec, hp_pin, 0,
3718 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3719 	msleep(10);
3720 	alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3721 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3722 	alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3723 	alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3724 
3725 	alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3726 	val = alc_read_coefex_idx(codec, 0x58, 0x00);
3727 	for (i = 0; i < 20 && val & 0x8000; i++) {
3728 		msleep(50);
3729 		val = alc_read_coefex_idx(codec, 0x58, 0x00);
3730 	} /* Wait for depop procedure finish  */
3731 
3732 	alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3733 	alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3734 	alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3735 	alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3736 
3737 	msleep(50);
3738 	alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3739 }
3740 
alc225_init(struct hda_codec * codec)3741 static void alc225_init(struct hda_codec *codec)
3742 {
3743 	struct alc_spec *spec = codec->spec;
3744 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3745 	bool hp1_pin_sense, hp2_pin_sense;
3746 
3747 	if (spec->ultra_low_power) {
3748 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3749 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3750 		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3751 		msleep(30);
3752 	}
3753 
3754 	if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3755 		spec->codec_variant != ALC269_TYPE_ALC245)
3756 		/* required only at boot or S3 and S4 resume time */
3757 		if (!spec->done_hp_init ||
3758 			is_s3_resume(codec) ||
3759 			is_s4_resume(codec)) {
3760 			alc285_hp_init(codec);
3761 			spec->done_hp_init = true;
3762 		}
3763 
3764 	if (!hp_pin)
3765 		hp_pin = 0x21;
3766 	msleep(30);
3767 
3768 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3769 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3770 
3771 	if (hp1_pin_sense || hp2_pin_sense) {
3772 		msleep(2);
3773 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3774 
3775 		if (hp1_pin_sense)
3776 			snd_hda_codec_write(codec, hp_pin, 0,
3777 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3778 		if (hp2_pin_sense)
3779 			snd_hda_codec_write(codec, 0x16, 0,
3780 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3781 		msleep(75);
3782 
3783 		if (hp1_pin_sense)
3784 			snd_hda_codec_write(codec, hp_pin, 0,
3785 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3786 		if (hp2_pin_sense)
3787 			snd_hda_codec_write(codec, 0x16, 0,
3788 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3789 
3790 		msleep(75);
3791 		alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3792 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3793 	}
3794 }
3795 
alc225_shutup(struct hda_codec * codec)3796 static void alc225_shutup(struct hda_codec *codec)
3797 {
3798 	struct alc_spec *spec = codec->spec;
3799 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3800 	bool hp1_pin_sense, hp2_pin_sense;
3801 
3802 	if (!hp_pin)
3803 		hp_pin = 0x21;
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 		alc_disable_headset_jack_key(codec);
3810 		/* 3k pull low control for Headset jack. */
3811 		alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3812 		msleep(2);
3813 
3814 		if (hp1_pin_sense)
3815 			snd_hda_codec_write(codec, hp_pin, 0,
3816 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3817 		if (hp2_pin_sense)
3818 			snd_hda_codec_write(codec, 0x16, 0,
3819 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3820 
3821 		msleep(75);
3822 
3823 		if (hp1_pin_sense)
3824 			snd_hda_codec_write(codec, hp_pin, 0,
3825 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3826 		if (hp2_pin_sense)
3827 			snd_hda_codec_write(codec, 0x16, 0,
3828 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3829 
3830 		msleep(75);
3831 		alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3832 		alc_enable_headset_jack_key(codec);
3833 	}
3834 	alc_auto_setup_eapd(codec, false);
3835 	alc_shutup_pins(codec);
3836 	if (spec->ultra_low_power) {
3837 		msleep(50);
3838 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3839 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3840 		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3841 		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3842 		msleep(30);
3843 	}
3844 }
3845 
alc222_init(struct hda_codec * codec)3846 static void alc222_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 hp1_pin_sense, hp2_pin_sense;
3851 
3852 	if (!hp_pin)
3853 		return;
3854 
3855 	msleep(30);
3856 
3857 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3858 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3859 
3860 	if (hp1_pin_sense || hp2_pin_sense) {
3861 		msleep(2);
3862 
3863 		if (hp1_pin_sense)
3864 			snd_hda_codec_write(codec, hp_pin, 0,
3865 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3866 		if (hp2_pin_sense)
3867 			snd_hda_codec_write(codec, 0x14, 0,
3868 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3869 		msleep(75);
3870 
3871 		if (hp1_pin_sense)
3872 			snd_hda_codec_write(codec, hp_pin, 0,
3873 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3874 		if (hp2_pin_sense)
3875 			snd_hda_codec_write(codec, 0x14, 0,
3876 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3877 
3878 		msleep(75);
3879 	}
3880 }
3881 
alc222_shutup(struct hda_codec * codec)3882 static void alc222_shutup(struct hda_codec *codec)
3883 {
3884 	struct alc_spec *spec = codec->spec;
3885 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3886 	bool hp1_pin_sense, hp2_pin_sense;
3887 
3888 	if (!hp_pin)
3889 		hp_pin = 0x21;
3890 
3891 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3892 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3893 
3894 	if (hp1_pin_sense || hp2_pin_sense) {
3895 		msleep(2);
3896 
3897 		if (hp1_pin_sense)
3898 			snd_hda_codec_write(codec, hp_pin, 0,
3899 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3900 		if (hp2_pin_sense)
3901 			snd_hda_codec_write(codec, 0x14, 0,
3902 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3903 
3904 		msleep(75);
3905 
3906 		if (hp1_pin_sense)
3907 			snd_hda_codec_write(codec, hp_pin, 0,
3908 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3909 		if (hp2_pin_sense)
3910 			snd_hda_codec_write(codec, 0x14, 0,
3911 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3912 
3913 		msleep(75);
3914 	}
3915 	alc_auto_setup_eapd(codec, false);
3916 	alc_shutup_pins(codec);
3917 }
3918 
alc_default_init(struct hda_codec * codec)3919 static void alc_default_init(struct hda_codec *codec)
3920 {
3921 	struct alc_spec *spec = codec->spec;
3922 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3923 	bool hp_pin_sense;
3924 
3925 	if (!hp_pin)
3926 		return;
3927 
3928 	msleep(30);
3929 
3930 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3931 
3932 	if (hp_pin_sense) {
3933 		msleep(2);
3934 
3935 		snd_hda_codec_write(codec, hp_pin, 0,
3936 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3937 
3938 		msleep(75);
3939 
3940 		snd_hda_codec_write(codec, hp_pin, 0,
3941 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3942 		msleep(75);
3943 	}
3944 }
3945 
alc_default_shutup(struct hda_codec * codec)3946 static void alc_default_shutup(struct hda_codec *codec)
3947 {
3948 	struct alc_spec *spec = codec->spec;
3949 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3950 	bool hp_pin_sense;
3951 
3952 	if (!hp_pin) {
3953 		alc269_shutup(codec);
3954 		return;
3955 	}
3956 
3957 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3958 
3959 	if (hp_pin_sense) {
3960 		msleep(2);
3961 
3962 		snd_hda_codec_write(codec, hp_pin, 0,
3963 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3964 
3965 		msleep(75);
3966 
3967 		if (!spec->no_shutup_pins)
3968 			snd_hda_codec_write(codec, hp_pin, 0,
3969 					    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3970 
3971 		msleep(75);
3972 	}
3973 	alc_auto_setup_eapd(codec, false);
3974 	alc_shutup_pins(codec);
3975 }
3976 
alc294_hp_init(struct hda_codec * codec)3977 static void alc294_hp_init(struct hda_codec *codec)
3978 {
3979 	struct alc_spec *spec = codec->spec;
3980 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3981 	int i, val;
3982 
3983 	if (!hp_pin)
3984 		return;
3985 
3986 	snd_hda_codec_write(codec, hp_pin, 0,
3987 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3988 
3989 	msleep(100);
3990 
3991 	if (!spec->no_shutup_pins)
3992 		snd_hda_codec_write(codec, hp_pin, 0,
3993 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3994 
3995 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3996 	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3997 
3998 	/* Wait for depop procedure finish  */
3999 	val = alc_read_coefex_idx(codec, 0x58, 0x01);
4000 	for (i = 0; i < 20 && val & 0x0080; i++) {
4001 		msleep(50);
4002 		val = alc_read_coefex_idx(codec, 0x58, 0x01);
4003 	}
4004 	/* Set HP depop to auto mode */
4005 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
4006 	msleep(50);
4007 }
4008 
alc294_init(struct hda_codec * codec)4009 static void alc294_init(struct hda_codec *codec)
4010 {
4011 	struct alc_spec *spec = codec->spec;
4012 
4013 	/* required only at boot or S4 resume time */
4014 	if (!spec->done_hp_init ||
4015 	    codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
4016 		alc294_hp_init(codec);
4017 		spec->done_hp_init = true;
4018 	}
4019 	alc_default_init(codec);
4020 }
4021 
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)4022 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
4023 			     unsigned int val)
4024 {
4025 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
4026 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
4027 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
4028 }
4029 
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)4030 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
4031 {
4032 	unsigned int val;
4033 
4034 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
4035 	val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
4036 		& 0xffff;
4037 	val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
4038 		<< 16;
4039 	return val;
4040 }
4041 
alc5505_dsp_halt(struct hda_codec * codec)4042 static void alc5505_dsp_halt(struct hda_codec *codec)
4043 {
4044 	unsigned int val;
4045 
4046 	alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
4047 	alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
4048 	alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
4049 	alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
4050 	alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
4051 	alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
4052 	alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
4053 	val = alc5505_coef_get(codec, 0x6220);
4054 	alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
4055 }
4056 
alc5505_dsp_back_from_halt(struct hda_codec * codec)4057 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
4058 {
4059 	alc5505_coef_set(codec, 0x61b8, 0x04133302);
4060 	alc5505_coef_set(codec, 0x61b0, 0x00005b16);
4061 	alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
4062 	alc5505_coef_set(codec, 0x6230, 0xf80d4011);
4063 	alc5505_coef_set(codec, 0x6220, 0x2002010f);
4064 	alc5505_coef_set(codec, 0x880c, 0x00000004);
4065 }
4066 
alc5505_dsp_init(struct hda_codec * codec)4067 static void alc5505_dsp_init(struct hda_codec *codec)
4068 {
4069 	unsigned int val;
4070 
4071 	alc5505_dsp_halt(codec);
4072 	alc5505_dsp_back_from_halt(codec);
4073 	alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
4074 	alc5505_coef_set(codec, 0x61b0, 0x5b16);
4075 	alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
4076 	alc5505_coef_set(codec, 0x61b4, 0x04132b02);
4077 	alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
4078 	alc5505_coef_set(codec, 0x61b8, 0x041f3302);
4079 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
4080 	alc5505_coef_set(codec, 0x61b8, 0x041b3302);
4081 	alc5505_coef_set(codec, 0x61b8, 0x04173302);
4082 	alc5505_coef_set(codec, 0x61b8, 0x04163302);
4083 	alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4084 	alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4085 	alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4086 
4087 	val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4088 	if (val <= 3)
4089 		alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4090 	else
4091 		alc5505_coef_set(codec, 0x6220, 0x6002018f);
4092 
4093 	alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4094 	alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4095 	alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4096 	alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4097 	alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4098 	alc5505_coef_set(codec, 0x880c, 0x00000003);
4099 	alc5505_coef_set(codec, 0x880c, 0x00000010);
4100 
4101 #ifdef HALT_REALTEK_ALC5505
4102 	alc5505_dsp_halt(codec);
4103 #endif
4104 }
4105 
4106 #ifdef HALT_REALTEK_ALC5505
4107 #define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
4108 #define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
4109 #else
4110 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
4111 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
4112 #endif
4113 
alc269_suspend(struct hda_codec * codec)4114 static int alc269_suspend(struct hda_codec *codec)
4115 {
4116 	struct alc_spec *spec = codec->spec;
4117 
4118 	if (spec->has_alc5505_dsp)
4119 		alc5505_dsp_suspend(codec);
4120 
4121 	return alc_suspend(codec);
4122 }
4123 
alc269_resume(struct hda_codec * codec)4124 static int alc269_resume(struct hda_codec *codec)
4125 {
4126 	struct alc_spec *spec = codec->spec;
4127 
4128 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4129 		alc269vb_toggle_power_output(codec, 0);
4130 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4131 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
4132 		msleep(150);
4133 	}
4134 
4135 	codec->patch_ops.init(codec);
4136 
4137 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4138 		alc269vb_toggle_power_output(codec, 1);
4139 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4140 			(alc_get_coef0(codec) & 0x00ff) == 0x017) {
4141 		msleep(200);
4142 	}
4143 
4144 	snd_hda_regmap_sync(codec);
4145 	hda_call_check_power_status(codec, 0x01);
4146 
4147 	/* on some machine, the BIOS will clear the codec gpio data when enter
4148 	 * suspend, and won't restore the data after resume, so we restore it
4149 	 * in the driver.
4150 	 */
4151 	if (spec->gpio_data)
4152 		alc_write_gpio_data(codec);
4153 
4154 	if (spec->has_alc5505_dsp)
4155 		alc5505_dsp_resume(codec);
4156 
4157 	return 0;
4158 }
4159 
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4160 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4161 						 const struct hda_fixup *fix, int action)
4162 {
4163 	struct alc_spec *spec = codec->spec;
4164 
4165 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4166 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4167 }
4168 
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4169 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4170 						 const struct hda_fixup *fix,
4171 						 int action)
4172 {
4173 	unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4174 	unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4175 
4176 	if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4177 		snd_hda_codec_set_pincfg(codec, 0x19,
4178 			(cfg_headphone & ~AC_DEFCFG_DEVICE) |
4179 			(AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4180 }
4181 
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4182 static void alc269_fixup_hweq(struct hda_codec *codec,
4183 			       const struct hda_fixup *fix, int action)
4184 {
4185 	if (action == HDA_FIXUP_ACT_INIT)
4186 		alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4187 }
4188 
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4189 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4190 				       const struct hda_fixup *fix, int action)
4191 {
4192 	struct alc_spec *spec = codec->spec;
4193 
4194 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4195 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4196 }
4197 
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4198 static void alc271_fixup_dmic(struct hda_codec *codec,
4199 			      const struct hda_fixup *fix, int action)
4200 {
4201 	static const struct hda_verb verbs[] = {
4202 		{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4203 		{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4204 		{}
4205 	};
4206 	unsigned int cfg;
4207 
4208 	if (strcmp(codec->core.chip_name, "ALC271X") &&
4209 	    strcmp(codec->core.chip_name, "ALC269VB"))
4210 		return;
4211 	cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4212 	if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4213 		snd_hda_sequence_write(codec, verbs);
4214 }
4215 
4216 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4217 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4218 					  const struct hda_fixup *fix,
4219 					  int action)
4220 {
4221 	if (action == HDA_FIXUP_ACT_INIT)
4222 		alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4223 }
4224 
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4225 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4226 				 const struct hda_fixup *fix, int action)
4227 {
4228 	struct alc_spec *spec = codec->spec;
4229 
4230 	if (action != HDA_FIXUP_ACT_PROBE)
4231 		return;
4232 
4233 	/* Due to a hardware problem on Lenovo Ideadpad, we need to
4234 	 * fix the sample rate of analog I/O to 44.1kHz
4235 	 */
4236 	spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4237 	spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4238 }
4239 
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4240 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4241 				     const struct hda_fixup *fix, int action)
4242 {
4243 	/* The digital-mic unit sends PDM (differential signal) instead of
4244 	 * the standard PCM, thus you can't record a valid mono stream as is.
4245 	 * Below is a workaround specific to ALC269 to control the dmic
4246 	 * signal source as mono.
4247 	 */
4248 	if (action == HDA_FIXUP_ACT_INIT)
4249 		alc_update_coef_idx(codec, 0x07, 0, 0x80);
4250 }
4251 
alc269_quanta_automute(struct hda_codec * codec)4252 static void alc269_quanta_automute(struct hda_codec *codec)
4253 {
4254 	snd_hda_gen_update_outputs(codec);
4255 
4256 	alc_write_coef_idx(codec, 0x0c, 0x680);
4257 	alc_write_coef_idx(codec, 0x0c, 0x480);
4258 }
4259 
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4260 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4261 				     const struct hda_fixup *fix, int action)
4262 {
4263 	struct alc_spec *spec = codec->spec;
4264 	if (action != HDA_FIXUP_ACT_PROBE)
4265 		return;
4266 	spec->gen.automute_hook = alc269_quanta_automute;
4267 }
4268 
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4269 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4270 					 struct hda_jack_callback *jack)
4271 {
4272 	struct alc_spec *spec = codec->spec;
4273 	int vref;
4274 	msleep(200);
4275 	snd_hda_gen_hp_automute(codec, jack);
4276 
4277 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4278 	msleep(100);
4279 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4280 			    vref);
4281 	msleep(500);
4282 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4283 			    vref);
4284 }
4285 
4286 /*
4287  * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4288  */
4289 struct hda_alc298_mbxinit {
4290 	unsigned char value_0x23;
4291 	unsigned char value_0x25;
4292 };
4293 
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4294 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4295 					 const struct hda_alc298_mbxinit *initval,
4296 					 bool first)
4297 {
4298 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4299 	alc_write_coef_idx(codec, 0x26, 0xb000);
4300 
4301 	if (first)
4302 		snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4303 
4304 	snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4305 	alc_write_coef_idx(codec, 0x26, 0xf000);
4306 	alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4307 
4308 	if (initval->value_0x23 != 0x1e)
4309 		alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4310 
4311 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4312 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4313 }
4314 
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4315 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4316 					   const struct hda_fixup *fix,
4317 					   int action)
4318 {
4319 	/* Initialization magic */
4320 	static const struct hda_alc298_mbxinit dac_init[] = {
4321 		{0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4322 		{0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4323 		{0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4324 		{0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4325 		{0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4326 		{0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4327 		{0x2f, 0x00},
4328 		{0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4329 		{0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4330 		{0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4331 		{}
4332 	};
4333 	const struct hda_alc298_mbxinit *seq;
4334 
4335 	if (action != HDA_FIXUP_ACT_INIT)
4336 		return;
4337 
4338 	/* Start */
4339 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4340 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4341 	alc_write_coef_idx(codec, 0x26, 0xf000);
4342 	alc_write_coef_idx(codec, 0x22, 0x31);
4343 	alc_write_coef_idx(codec, 0x23, 0x0b);
4344 	alc_write_coef_idx(codec, 0x25, 0x00);
4345 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4346 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4347 
4348 	for (seq = dac_init; seq->value_0x23; seq++)
4349 		alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4350 }
4351 
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4352 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4353 				     const struct hda_fixup *fix, int action)
4354 {
4355 	struct alc_spec *spec = codec->spec;
4356 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4357 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4358 		spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4359 	}
4360 }
4361 
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4362 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4363 				bool polarity, bool on)
4364 {
4365 	unsigned int pinval;
4366 
4367 	if (!pin)
4368 		return;
4369 	if (polarity)
4370 		on = !on;
4371 	pinval = snd_hda_codec_get_pin_target(codec, pin);
4372 	pinval &= ~AC_PINCTL_VREFEN;
4373 	pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4374 	/* temporarily power up/down for setting VREF */
4375 	snd_hda_power_up_pm(codec);
4376 	snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4377 	snd_hda_power_down_pm(codec);
4378 }
4379 
4380 /* 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)4381 static int vref_mute_led_set(struct led_classdev *led_cdev,
4382 			     enum led_brightness brightness)
4383 {
4384 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4385 	struct alc_spec *spec = codec->spec;
4386 
4387 	alc_update_vref_led(codec, spec->mute_led_nid,
4388 			    spec->mute_led_polarity, brightness);
4389 	return 0;
4390 }
4391 
4392 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4393 static unsigned int led_power_filter(struct hda_codec *codec,
4394 						  hda_nid_t nid,
4395 						  unsigned int power_state)
4396 {
4397 	struct alc_spec *spec = codec->spec;
4398 
4399 	if (power_state != AC_PWRST_D3 || nid == 0 ||
4400 	    (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4401 		return power_state;
4402 
4403 	/* Set pin ctl again, it might have just been set to 0 */
4404 	snd_hda_set_pin_ctl(codec, nid,
4405 			    snd_hda_codec_get_pin_target(codec, nid));
4406 
4407 	return snd_hda_gen_path_power_filter(codec, nid, power_state);
4408 }
4409 
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4410 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4411 				     const struct hda_fixup *fix, int action)
4412 {
4413 	struct alc_spec *spec = codec->spec;
4414 	const struct dmi_device *dev = NULL;
4415 
4416 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4417 		return;
4418 
4419 	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4420 		int pol, pin;
4421 		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4422 			continue;
4423 		if (pin < 0x0a || pin >= 0x10)
4424 			break;
4425 		spec->mute_led_polarity = pol;
4426 		spec->mute_led_nid = pin - 0x0a + 0x18;
4427 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4428 		codec->power_filter = led_power_filter;
4429 		codec_dbg(codec,
4430 			  "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4431 			   spec->mute_led_polarity);
4432 		break;
4433 	}
4434 }
4435 
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4436 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4437 					  const struct hda_fixup *fix,
4438 					  int action, hda_nid_t pin)
4439 {
4440 	struct alc_spec *spec = codec->spec;
4441 
4442 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4443 		spec->mute_led_polarity = 0;
4444 		spec->mute_led_nid = pin;
4445 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4446 		codec->power_filter = led_power_filter;
4447 	}
4448 }
4449 
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4450 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4451 				const struct hda_fixup *fix, int action)
4452 {
4453 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4454 }
4455 
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4456 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4457 				const struct hda_fixup *fix, int action)
4458 {
4459 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4460 }
4461 
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4462 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4463 				const struct hda_fixup *fix, int action)
4464 {
4465 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4466 }
4467 
4468 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4469 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4470 				int polarity, bool enabled)
4471 {
4472 	if (polarity)
4473 		enabled = !enabled;
4474 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4475 }
4476 
4477 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4478 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4479 			     enum led_brightness brightness)
4480 {
4481 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4482 	struct alc_spec *spec = codec->spec;
4483 
4484 	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4485 			    spec->mute_led_polarity, !brightness);
4486 	return 0;
4487 }
4488 
4489 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4490 static int micmute_led_set(struct led_classdev *led_cdev,
4491 			   enum led_brightness brightness)
4492 {
4493 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4494 	struct alc_spec *spec = codec->spec;
4495 
4496 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4497 			    spec->micmute_led_polarity, !brightness);
4498 	return 0;
4499 }
4500 
4501 /* 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)4502 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4503 				  int action,
4504 				  unsigned int mute_mask,
4505 				  unsigned int micmute_mask)
4506 {
4507 	struct alc_spec *spec = codec->spec;
4508 
4509 	alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4510 
4511 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4512 		return;
4513 	if (mute_mask) {
4514 		spec->gpio_mute_led_mask = mute_mask;
4515 		snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4516 	}
4517 	if (micmute_mask) {
4518 		spec->gpio_mic_led_mask = micmute_mask;
4519 		snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4520 	}
4521 }
4522 
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4523 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4524 				const struct hda_fixup *fix, int action)
4525 {
4526 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4527 }
4528 
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4529 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4530 				const struct hda_fixup *fix, int action)
4531 {
4532 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4533 }
4534 
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4535 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4536 				const struct hda_fixup *fix, int action)
4537 {
4538 	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4539 }
4540 
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4541 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4542 				const struct hda_fixup *fix, int action)
4543 {
4544 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4545 }
4546 
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4547 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4548 				const struct hda_fixup *fix, int action)
4549 {
4550 	alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4551 }
4552 
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4553 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4554 				const struct hda_fixup *fix, int action)
4555 {
4556 	struct alc_spec *spec = codec->spec;
4557 
4558 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4559 		spec->micmute_led_polarity = 1;
4560 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4561 }
4562 
4563 /* 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)4564 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4565 				enum led_brightness brightness)
4566 {
4567 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4568 	struct alc_spec *spec = codec->spec;
4569 
4570 	alc_update_vref_led(codec, spec->cap_mute_led_nid,
4571 			    spec->micmute_led_polarity, brightness);
4572 	return 0;
4573 }
4574 
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4575 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4576 				const struct hda_fixup *fix, int action)
4577 {
4578 	struct alc_spec *spec = codec->spec;
4579 
4580 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4581 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4582 		/* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4583 		 * enable headphone amp
4584 		 */
4585 		spec->gpio_mask |= 0x10;
4586 		spec->gpio_dir |= 0x10;
4587 		spec->cap_mute_led_nid = 0x18;
4588 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4589 		codec->power_filter = led_power_filter;
4590 	}
4591 }
4592 
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4593 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4594 				   const struct hda_fixup *fix, int action)
4595 {
4596 	struct alc_spec *spec = codec->spec;
4597 
4598 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4599 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4600 		spec->cap_mute_led_nid = 0x18;
4601 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4602 		codec->power_filter = led_power_filter;
4603 	}
4604 }
4605 
4606 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4607  * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4608  */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4609 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4610 				     const struct hda_fixup *fix, int action)
4611 {
4612 	struct alc_spec *spec = codec->spec;
4613 
4614 	switch (action) {
4615 	case HDA_FIXUP_ACT_PRE_PROBE:
4616 		spec->gpio_mask |= 0x01;
4617 		spec->gpio_dir |= 0x01;
4618 		break;
4619 	case HDA_FIXUP_ACT_INIT:
4620 		/* need to toggle GPIO to enable the amp */
4621 		alc_update_gpio_data(codec, 0x01, true);
4622 		msleep(100);
4623 		alc_update_gpio_data(codec, 0x01, false);
4624 		break;
4625 	}
4626 }
4627 
4628 /* 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)4629 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4630 				    struct hda_codec *codec,
4631 				    struct snd_pcm_substream *substream,
4632 				    int action)
4633 {
4634 	switch (action) {
4635 	case HDA_GEN_PCM_ACT_PREPARE:
4636 		alc_update_gpio_data(codec, 0x04, true);
4637 		break;
4638 	case HDA_GEN_PCM_ACT_CLEANUP:
4639 		alc_update_gpio_data(codec, 0x04, false);
4640 		break;
4641 	}
4642 }
4643 
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4644 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4645 				      const struct hda_fixup *fix,
4646 				      int action)
4647 {
4648 	struct alc_spec *spec = codec->spec;
4649 
4650 	if (action == HDA_FIXUP_ACT_PROBE) {
4651 		spec->gpio_mask |= 0x04;
4652 		spec->gpio_dir |= 0x04;
4653 		spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4654 	}
4655 }
4656 
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4657 static void alc_update_coef_led(struct hda_codec *codec,
4658 				struct alc_coef_led *led,
4659 				bool polarity, bool on)
4660 {
4661 	if (polarity)
4662 		on = !on;
4663 	/* temporarily power up/down for setting COEF bit */
4664 	alc_update_coef_idx(codec, led->idx, led->mask,
4665 			    on ? led->on : led->off);
4666 }
4667 
4668 /* 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)4669 static int coef_mute_led_set(struct led_classdev *led_cdev,
4670 			     enum led_brightness brightness)
4671 {
4672 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4673 	struct alc_spec *spec = codec->spec;
4674 
4675 	alc_update_coef_led(codec, &spec->mute_led_coef,
4676 			    spec->mute_led_polarity, brightness);
4677 	return 0;
4678 }
4679 
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4680 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4681 					  const struct hda_fixup *fix,
4682 					  int action)
4683 {
4684 	struct alc_spec *spec = codec->spec;
4685 
4686 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4687 		spec->mute_led_polarity = 0;
4688 		spec->mute_led_coef.idx = 0x0b;
4689 		spec->mute_led_coef.mask = 1 << 3;
4690 		spec->mute_led_coef.on = 1 << 3;
4691 		spec->mute_led_coef.off = 0;
4692 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4693 	}
4694 }
4695 
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4696 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4697 					  const struct hda_fixup *fix,
4698 					  int action)
4699 {
4700 	struct alc_spec *spec = codec->spec;
4701 
4702 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4703 		spec->mute_led_polarity = 0;
4704 		spec->mute_led_coef.idx = 0x34;
4705 		spec->mute_led_coef.mask = 1 << 5;
4706 		spec->mute_led_coef.on = 0;
4707 		spec->mute_led_coef.off = 1 << 5;
4708 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4709 	}
4710 }
4711 
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4712 static void alc236_fixup_hp_mute_led_coefbit2(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->mute_led_polarity = 0;
4719 		spec->mute_led_coef.idx = 0x07;
4720 		spec->mute_led_coef.mask = 1;
4721 		spec->mute_led_coef.on = 1;
4722 		spec->mute_led_coef.off = 0;
4723 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4724 	}
4725 }
4726 
alc245_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4727 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4728 					  const struct hda_fixup *fix,
4729 					  int action)
4730 {
4731 	struct alc_spec *spec = codec->spec;
4732 
4733 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4734 		spec->mute_led_polarity = 0;
4735 		spec->mute_led_coef.idx = 0x0b;
4736 		spec->mute_led_coef.mask = 3 << 2;
4737 		spec->mute_led_coef.on = 2 << 2;
4738 		spec->mute_led_coef.off = 1 << 2;
4739 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4740 	}
4741 }
4742 
4743 /* 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)4744 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4745 				enum led_brightness brightness)
4746 {
4747 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4748 	struct alc_spec *spec = codec->spec;
4749 
4750 	alc_update_coef_led(codec, &spec->mic_led_coef,
4751 			    spec->micmute_led_polarity, brightness);
4752 	return 0;
4753 }
4754 
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4755 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4756 				const struct hda_fixup *fix, int action)
4757 {
4758 	struct alc_spec *spec = codec->spec;
4759 
4760 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4761 		spec->mic_led_coef.idx = 0x19;
4762 		spec->mic_led_coef.mask = 1 << 13;
4763 		spec->mic_led_coef.on = 1 << 13;
4764 		spec->mic_led_coef.off = 0;
4765 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4766 	}
4767 }
4768 
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4769 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4770 				const struct hda_fixup *fix, int action)
4771 {
4772 	struct alc_spec *spec = codec->spec;
4773 
4774 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4775 		spec->micmute_led_polarity = 1;
4776 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4777 }
4778 
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4779 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4780 				const struct hda_fixup *fix, int action)
4781 {
4782 	struct alc_spec *spec = codec->spec;
4783 
4784 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4785 		spec->mic_led_coef.idx = 0x35;
4786 		spec->mic_led_coef.mask = 3 << 2;
4787 		spec->mic_led_coef.on = 2 << 2;
4788 		spec->mic_led_coef.off = 1 << 2;
4789 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4790 	}
4791 }
4792 
alc295_fixup_hp_mute_led_coefbit11(struct hda_codec * codec,const struct hda_fixup * fix,int action)4793 static void alc295_fixup_hp_mute_led_coefbit11(struct hda_codec *codec,
4794 				const struct hda_fixup *fix, int action)
4795 {
4796 	struct alc_spec *spec = codec->spec;
4797 
4798 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4799 		spec->mute_led_polarity = 0;
4800 		spec->mute_led_coef.idx = 0xb;
4801 		spec->mute_led_coef.mask = 3 << 3;
4802 		spec->mute_led_coef.on = 1 << 3;
4803 		spec->mute_led_coef.off = 1 << 4;
4804 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4805 	}
4806 }
4807 
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4808 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4809 				const struct hda_fixup *fix, int action)
4810 {
4811 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4812 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4813 }
4814 
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4815 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4816 				const struct hda_fixup *fix, int action)
4817 {
4818 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4819 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4820 }
4821 
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4822 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4823 				const struct hda_fixup *fix, int action)
4824 {
4825 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4826 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4827 }
4828 
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4829 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4830 				const struct hda_fixup *fix, int action)
4831 {
4832 	struct alc_spec *spec = codec->spec;
4833 
4834 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4835 		spec->cap_mute_led_nid = 0x1a;
4836 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4837 		codec->power_filter = led_power_filter;
4838 	}
4839 }
4840 
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4841 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4842 				const struct hda_fixup *fix, int action)
4843 {
4844 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4845 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4846 }
4847 
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4848 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4849 						  const unsigned short coefs[2])
4850 {
4851 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4852 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4853 	alc_write_coef_idx(codec, 0x26, 0xb011);
4854 }
4855 
4856 struct alc298_samsung_amp_desc {
4857 	unsigned char nid;
4858 	unsigned short init_seq[2][2];
4859 };
4860 
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4861 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4862 				     const struct hda_fixup *fix, int action)
4863 {
4864 	int i, j;
4865 	static const unsigned short init_seq[][2] = {
4866 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4867 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4868 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4869 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4870 	};
4871 	static const struct alc298_samsung_amp_desc amps[] = {
4872 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4873 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4874 	};
4875 
4876 	if (action != HDA_FIXUP_ACT_INIT)
4877 		return;
4878 
4879 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4880 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4881 
4882 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4883 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4884 
4885 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4886 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4887 	}
4888 }
4889 
4890 struct alc298_samsung_v2_amp_desc {
4891 	unsigned short nid;
4892 	int init_seq_size;
4893 	unsigned short init_seq[18][2];
4894 };
4895 
4896 static const struct alc298_samsung_v2_amp_desc
4897 alc298_samsung_v2_amp_desc_tbl[] = {
4898 	{ 0x38, 18, {
4899 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4900 		{ 0x201b, 0x0001 }, { 0x201d, 0x0001 }, { 0x201f, 0x00fe },
4901 		{ 0x2021, 0x0000 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4902 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4903 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x2399, 0x0003 },
4904 		{ 0x23a4, 0x00b5 }, { 0x23a5, 0x0001 }, { 0x23ba, 0x0094 }
4905 	}},
4906 	{ 0x39, 18, {
4907 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4908 		{ 0x201b, 0x0002 }, { 0x201d, 0x0002 }, { 0x201f, 0x00fd },
4909 		{ 0x2021, 0x0001 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4910 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4911 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x2399, 0x0003 },
4912 		{ 0x23a4, 0x00b5 }, { 0x23a5, 0x0001 }, { 0x23ba, 0x0094 }
4913 	}},
4914 	{ 0x3c, 15, {
4915 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4916 		{ 0x201b, 0x0001 }, { 0x201d, 0x0001 }, { 0x201f, 0x00fe },
4917 		{ 0x2021, 0x0000 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4918 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4919 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x23ba, 0x008d }
4920 	}},
4921 	{ 0x3d, 15, {
4922 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4923 		{ 0x201b, 0x0002 }, { 0x201d, 0x0002 }, { 0x201f, 0x00fd },
4924 		{ 0x2021, 0x0001 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4925 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4926 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x23ba, 0x008d }
4927 	}}
4928 };
4929 
alc298_samsung_v2_enable_amps(struct hda_codec * codec)4930 static void alc298_samsung_v2_enable_amps(struct hda_codec *codec)
4931 {
4932 	struct alc_spec *spec = codec->spec;
4933 	static const unsigned short enable_seq[][2] = {
4934 		{ 0x203a, 0x0081 }, { 0x23ff, 0x0001 },
4935 	};
4936 	int i, j;
4937 
4938 	for (i = 0; i < spec->num_speaker_amps; i++) {
4939 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4940 		for (j = 0; j < ARRAY_SIZE(enable_seq); j++)
4941 			alc298_samsung_write_coef_pack(codec, enable_seq[j]);
4942 		codec_dbg(codec, "alc298_samsung_v2: Enabled speaker amp 0x%02x\n",
4943 				alc298_samsung_v2_amp_desc_tbl[i].nid);
4944 	}
4945 }
4946 
alc298_samsung_v2_disable_amps(struct hda_codec * codec)4947 static void alc298_samsung_v2_disable_amps(struct hda_codec *codec)
4948 {
4949 	struct alc_spec *spec = codec->spec;
4950 	static const unsigned short disable_seq[][2] = {
4951 		{ 0x23ff, 0x0000 }, { 0x203a, 0x0080 },
4952 	};
4953 	int i, j;
4954 
4955 	for (i = 0; i < spec->num_speaker_amps; i++) {
4956 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4957 		for (j = 0; j < ARRAY_SIZE(disable_seq); j++)
4958 			alc298_samsung_write_coef_pack(codec, disable_seq[j]);
4959 		codec_dbg(codec, "alc298_samsung_v2: Disabled speaker amp 0x%02x\n",
4960 				alc298_samsung_v2_amp_desc_tbl[i].nid);
4961 	}
4962 }
4963 
alc298_samsung_v2_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)4964 static void alc298_samsung_v2_playback_hook(struct hda_pcm_stream *hinfo,
4965 				struct hda_codec *codec,
4966 				struct snd_pcm_substream *substream,
4967 				int action)
4968 {
4969 	/* Dynamically enable/disable speaker amps before and after playback */
4970 	if (action == HDA_GEN_PCM_ACT_OPEN)
4971 		alc298_samsung_v2_enable_amps(codec);
4972 	if (action == HDA_GEN_PCM_ACT_CLOSE)
4973 		alc298_samsung_v2_disable_amps(codec);
4974 }
4975 
alc298_samsung_v2_init_amps(struct hda_codec * codec,int num_speaker_amps)4976 static void alc298_samsung_v2_init_amps(struct hda_codec *codec,
4977 				int num_speaker_amps)
4978 {
4979 	struct alc_spec *spec = codec->spec;
4980 	int i, j;
4981 
4982 	/* Set spec's num_speaker_amps before doing anything else */
4983 	spec->num_speaker_amps = num_speaker_amps;
4984 
4985 	/* Disable speaker amps before init to prevent any physical damage */
4986 	alc298_samsung_v2_disable_amps(codec);
4987 
4988 	/* Initialize the speaker amps */
4989 	for (i = 0; i < spec->num_speaker_amps; i++) {
4990 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4991 		for (j = 0; j < alc298_samsung_v2_amp_desc_tbl[i].init_seq_size; j++) {
4992 			alc298_samsung_write_coef_pack(codec,
4993 					alc298_samsung_v2_amp_desc_tbl[i].init_seq[j]);
4994 		}
4995 		alc_write_coef_idx(codec, 0x89, 0x0);
4996 		codec_dbg(codec, "alc298_samsung_v2: Initialized speaker amp 0x%02x\n",
4997 				alc298_samsung_v2_amp_desc_tbl[i].nid);
4998 	}
4999 
5000 	/* register hook to enable speaker amps only when they are needed */
5001 	spec->gen.pcm_playback_hook = alc298_samsung_v2_playback_hook;
5002 }
5003 
alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec * codec,const struct hda_fixup * fix,int action)5004 static void alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec *codec,
5005 				const struct hda_fixup *fix, int action)
5006 {
5007 	if (action == HDA_FIXUP_ACT_PROBE)
5008 		alc298_samsung_v2_init_amps(codec, 2);
5009 }
5010 
alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec * codec,const struct hda_fixup * fix,int action)5011 static void alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec *codec,
5012 				const struct hda_fixup *fix, int action)
5013 {
5014 	if (action == HDA_FIXUP_ACT_PROBE)
5015 		alc298_samsung_v2_init_amps(codec, 4);
5016 }
5017 
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)5018 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
5019 				   struct hda_jack_callback *event)
5020 {
5021 	struct alc_spec *spec = codec->spec;
5022 
5023 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
5024 	   send both key on and key off event for every interrupt. */
5025 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
5026 	input_sync(spec->kb_dev);
5027 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
5028 	input_sync(spec->kb_dev);
5029 }
5030 
alc_register_micmute_input_device(struct hda_codec * codec)5031 static int alc_register_micmute_input_device(struct hda_codec *codec)
5032 {
5033 	struct alc_spec *spec = codec->spec;
5034 	int i;
5035 
5036 	spec->kb_dev = input_allocate_device();
5037 	if (!spec->kb_dev) {
5038 		codec_err(codec, "Out of memory (input_allocate_device)\n");
5039 		return -ENOMEM;
5040 	}
5041 
5042 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
5043 
5044 	spec->kb_dev->name = "Microphone Mute Button";
5045 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
5046 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
5047 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
5048 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
5049 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
5050 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
5051 
5052 	if (input_register_device(spec->kb_dev)) {
5053 		codec_err(codec, "input_register_device failed\n");
5054 		input_free_device(spec->kb_dev);
5055 		spec->kb_dev = NULL;
5056 		return -ENOMEM;
5057 	}
5058 
5059 	return 0;
5060 }
5061 
5062 /* GPIO1 = set according to SKU external amp
5063  * GPIO2 = mic mute hotkey
5064  * GPIO3 = mute LED
5065  * GPIO4 = mic mute LED
5066  */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)5067 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
5068 					     const struct hda_fixup *fix, int action)
5069 {
5070 	struct alc_spec *spec = codec->spec;
5071 
5072 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
5073 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5074 		spec->init_amp = ALC_INIT_DEFAULT;
5075 		if (alc_register_micmute_input_device(codec) != 0)
5076 			return;
5077 
5078 		spec->gpio_mask |= 0x06;
5079 		spec->gpio_dir |= 0x02;
5080 		spec->gpio_data |= 0x02;
5081 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
5082 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
5083 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
5084 						    gpio2_mic_hotkey_event);
5085 		return;
5086 	}
5087 
5088 	if (!spec->kb_dev)
5089 		return;
5090 
5091 	switch (action) {
5092 	case HDA_FIXUP_ACT_FREE:
5093 		input_unregister_device(spec->kb_dev);
5094 		spec->kb_dev = NULL;
5095 	}
5096 }
5097 
5098 /* Line2 = mic mute hotkey
5099  * GPIO2 = mic mute LED
5100  */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)5101 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
5102 					     const struct hda_fixup *fix, int action)
5103 {
5104 	struct alc_spec *spec = codec->spec;
5105 
5106 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
5107 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5108 		spec->init_amp = ALC_INIT_DEFAULT;
5109 		if (alc_register_micmute_input_device(codec) != 0)
5110 			return;
5111 
5112 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
5113 						    gpio2_mic_hotkey_event);
5114 		return;
5115 	}
5116 
5117 	if (!spec->kb_dev)
5118 		return;
5119 
5120 	switch (action) {
5121 	case HDA_FIXUP_ACT_FREE:
5122 		input_unregister_device(spec->kb_dev);
5123 		spec->kb_dev = NULL;
5124 	}
5125 }
5126 
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)5127 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
5128 				const struct hda_fixup *fix, int action)
5129 {
5130 	struct alc_spec *spec = codec->spec;
5131 
5132 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
5133 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5134 		spec->cap_mute_led_nid = 0x18;
5135 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
5136 	}
5137 }
5138 
alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)5139 static void alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec *codec,
5140 				const struct hda_fixup *fix, int action)
5141 {
5142 	struct alc_spec *spec = codec->spec;
5143 
5144 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
5145 		spec->micmute_led_polarity = 1;
5146 	alc233_fixup_lenovo_line2_mic_hotkey(codec, fix, action);
5147 }
5148 
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)5149 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
5150 {
5151 	if (delay <= 0)
5152 		delay = 75;
5153 	snd_hda_codec_write(codec, 0x21, 0,
5154 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5155 	msleep(delay);
5156 	snd_hda_codec_write(codec, 0x21, 0,
5157 		    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5158 	msleep(delay);
5159 }
5160 
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)5161 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
5162 {
5163 	if (delay <= 0)
5164 		delay = 75;
5165 	snd_hda_codec_write(codec, 0x21, 0,
5166 		    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5167 	msleep(delay);
5168 	snd_hda_codec_write(codec, 0x21, 0,
5169 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5170 	msleep(delay);
5171 }
5172 
5173 static const struct coef_fw alc225_pre_hsmode[] = {
5174 	UPDATE_COEF(0x4a, 1<<8, 0),
5175 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
5176 	UPDATE_COEF(0x63, 3<<14, 3<<14),
5177 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
5178 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
5179 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
5180 	UPDATE_COEF(0x4a, 3<<10, 0),
5181 	{}
5182 };
5183 
alc_headset_mode_unplugged(struct hda_codec * codec)5184 static void alc_headset_mode_unplugged(struct hda_codec *codec)
5185 {
5186 	struct alc_spec *spec = codec->spec;
5187 	static const struct coef_fw coef0255[] = {
5188 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
5189 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5190 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5191 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5192 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
5193 		{}
5194 	};
5195 	static const struct coef_fw coef0256[] = {
5196 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
5197 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5198 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5199 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
5200 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5201 		{}
5202 	};
5203 	static const struct coef_fw coef0233[] = {
5204 		WRITE_COEF(0x1b, 0x0c0b),
5205 		WRITE_COEF(0x45, 0xc429),
5206 		UPDATE_COEF(0x35, 0x4000, 0),
5207 		WRITE_COEF(0x06, 0x2104),
5208 		WRITE_COEF(0x1a, 0x0001),
5209 		WRITE_COEF(0x26, 0x0004),
5210 		WRITE_COEF(0x32, 0x42a3),
5211 		{}
5212 	};
5213 	static const struct coef_fw coef0288[] = {
5214 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5215 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5216 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5217 		UPDATE_COEF(0x66, 0x0008, 0),
5218 		UPDATE_COEF(0x67, 0x2000, 0),
5219 		{}
5220 	};
5221 	static const struct coef_fw coef0298[] = {
5222 		UPDATE_COEF(0x19, 0x1300, 0x0300),
5223 		{}
5224 	};
5225 	static const struct coef_fw coef0292[] = {
5226 		WRITE_COEF(0x76, 0x000e),
5227 		WRITE_COEF(0x6c, 0x2400),
5228 		WRITE_COEF(0x18, 0x7308),
5229 		WRITE_COEF(0x6b, 0xc429),
5230 		{}
5231 	};
5232 	static const struct coef_fw coef0293[] = {
5233 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5234 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5235 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5236 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5237 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5238 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5239 		{}
5240 	};
5241 	static const struct coef_fw coef0668[] = {
5242 		WRITE_COEF(0x15, 0x0d40),
5243 		WRITE_COEF(0xb7, 0x802b),
5244 		{}
5245 	};
5246 	static const struct coef_fw coef0225[] = {
5247 		UPDATE_COEF(0x63, 3<<14, 0),
5248 		{}
5249 	};
5250 	static const struct coef_fw coef0274[] = {
5251 		UPDATE_COEF(0x4a, 0x0100, 0),
5252 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5253 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
5254 		UPDATE_COEF(0x4a, 0x0010, 0),
5255 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5256 		WRITE_COEF(0x45, 0x5289),
5257 		UPDATE_COEF(0x4a, 0x0c00, 0),
5258 		{}
5259 	};
5260 
5261 	if (spec->no_internal_mic_pin) {
5262 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5263 		return;
5264 	}
5265 
5266 	switch (codec->core.vendor_id) {
5267 	case 0x10ec0255:
5268 		alc_process_coef_fw(codec, coef0255);
5269 		break;
5270 	case 0x10ec0230:
5271 	case 0x10ec0236:
5272 	case 0x10ec0256:
5273 	case 0x19e58326:
5274 		alc_hp_mute_disable(codec, 75);
5275 		alc_process_coef_fw(codec, coef0256);
5276 		break;
5277 	case 0x10ec0234:
5278 	case 0x10ec0274:
5279 	case 0x10ec0294:
5280 		alc_process_coef_fw(codec, coef0274);
5281 		break;
5282 	case 0x10ec0233:
5283 	case 0x10ec0283:
5284 		alc_process_coef_fw(codec, coef0233);
5285 		break;
5286 	case 0x10ec0286:
5287 	case 0x10ec0288:
5288 		alc_process_coef_fw(codec, coef0288);
5289 		break;
5290 	case 0x10ec0298:
5291 		alc_process_coef_fw(codec, coef0298);
5292 		alc_process_coef_fw(codec, coef0288);
5293 		break;
5294 	case 0x10ec0292:
5295 		alc_process_coef_fw(codec, coef0292);
5296 		break;
5297 	case 0x10ec0293:
5298 		alc_process_coef_fw(codec, coef0293);
5299 		break;
5300 	case 0x10ec0668:
5301 		alc_process_coef_fw(codec, coef0668);
5302 		break;
5303 	case 0x10ec0215:
5304 	case 0x10ec0225:
5305 	case 0x10ec0285:
5306 	case 0x10ec0295:
5307 	case 0x10ec0289:
5308 	case 0x10ec0299:
5309 		alc_hp_mute_disable(codec, 75);
5310 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5311 		alc_process_coef_fw(codec, coef0225);
5312 		break;
5313 	case 0x10ec0867:
5314 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5315 		break;
5316 	}
5317 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5318 }
5319 
5320 
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5321 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5322 				    hda_nid_t mic_pin)
5323 {
5324 	static const struct coef_fw coef0255[] = {
5325 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5326 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5327 		{}
5328 	};
5329 	static const struct coef_fw coef0256[] = {
5330 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5331 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5332 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5333 		{}
5334 	};
5335 	static const struct coef_fw coef0233[] = {
5336 		UPDATE_COEF(0x35, 0, 1<<14),
5337 		WRITE_COEF(0x06, 0x2100),
5338 		WRITE_COEF(0x1a, 0x0021),
5339 		WRITE_COEF(0x26, 0x008c),
5340 		{}
5341 	};
5342 	static const struct coef_fw coef0288[] = {
5343 		UPDATE_COEF(0x4f, 0x00c0, 0),
5344 		UPDATE_COEF(0x50, 0x2000, 0),
5345 		UPDATE_COEF(0x56, 0x0006, 0),
5346 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5347 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5348 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5349 		{}
5350 	};
5351 	static const struct coef_fw coef0292[] = {
5352 		WRITE_COEF(0x19, 0xa208),
5353 		WRITE_COEF(0x2e, 0xacf0),
5354 		{}
5355 	};
5356 	static const struct coef_fw coef0293[] = {
5357 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5358 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5359 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5360 		{}
5361 	};
5362 	static const struct coef_fw coef0688[] = {
5363 		WRITE_COEF(0xb7, 0x802b),
5364 		WRITE_COEF(0xb5, 0x1040),
5365 		UPDATE_COEF(0xc3, 0, 1<<12),
5366 		{}
5367 	};
5368 	static const struct coef_fw coef0225[] = {
5369 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5370 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5371 		UPDATE_COEF(0x63, 3<<14, 0),
5372 		{}
5373 	};
5374 	static const struct coef_fw coef0274[] = {
5375 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5376 		UPDATE_COEF(0x4a, 0x0010, 0),
5377 		UPDATE_COEF(0x6b, 0xf000, 0),
5378 		{}
5379 	};
5380 
5381 	switch (codec->core.vendor_id) {
5382 	case 0x10ec0255:
5383 		alc_write_coef_idx(codec, 0x45, 0xc489);
5384 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5385 		alc_process_coef_fw(codec, coef0255);
5386 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5387 		break;
5388 	case 0x10ec0230:
5389 	case 0x10ec0236:
5390 	case 0x10ec0256:
5391 	case 0x19e58326:
5392 		alc_write_coef_idx(codec, 0x45, 0xc489);
5393 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5394 		alc_process_coef_fw(codec, coef0256);
5395 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5396 		break;
5397 	case 0x10ec0234:
5398 	case 0x10ec0274:
5399 	case 0x10ec0294:
5400 		alc_write_coef_idx(codec, 0x45, 0x4689);
5401 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5402 		alc_process_coef_fw(codec, coef0274);
5403 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5404 		break;
5405 	case 0x10ec0233:
5406 	case 0x10ec0283:
5407 		alc_write_coef_idx(codec, 0x45, 0xc429);
5408 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5409 		alc_process_coef_fw(codec, coef0233);
5410 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5411 		break;
5412 	case 0x10ec0286:
5413 	case 0x10ec0288:
5414 	case 0x10ec0298:
5415 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5416 		alc_process_coef_fw(codec, coef0288);
5417 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5418 		break;
5419 	case 0x10ec0292:
5420 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5421 		alc_process_coef_fw(codec, coef0292);
5422 		break;
5423 	case 0x10ec0293:
5424 		/* Set to TRS mode */
5425 		alc_write_coef_idx(codec, 0x45, 0xc429);
5426 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5427 		alc_process_coef_fw(codec, coef0293);
5428 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5429 		break;
5430 	case 0x10ec0867:
5431 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5432 		fallthrough;
5433 	case 0x10ec0221:
5434 	case 0x10ec0662:
5435 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5436 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5437 		break;
5438 	case 0x10ec0668:
5439 		alc_write_coef_idx(codec, 0x11, 0x0001);
5440 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5441 		alc_process_coef_fw(codec, coef0688);
5442 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5443 		break;
5444 	case 0x10ec0215:
5445 	case 0x10ec0225:
5446 	case 0x10ec0285:
5447 	case 0x10ec0295:
5448 	case 0x10ec0289:
5449 	case 0x10ec0299:
5450 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5451 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5452 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5453 		alc_process_coef_fw(codec, coef0225);
5454 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5455 		break;
5456 	}
5457 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5458 }
5459 
alc_headset_mode_default(struct hda_codec * codec)5460 static void alc_headset_mode_default(struct hda_codec *codec)
5461 {
5462 	static const struct coef_fw coef0225[] = {
5463 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5464 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5465 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5466 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5467 		UPDATE_COEF(0x63, 3<<14, 0),
5468 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5469 		{}
5470 	};
5471 	static const struct coef_fw coef0255[] = {
5472 		WRITE_COEF(0x45, 0xc089),
5473 		WRITE_COEF(0x45, 0xc489),
5474 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5475 		WRITE_COEF(0x49, 0x0049),
5476 		{}
5477 	};
5478 	static const struct coef_fw coef0256[] = {
5479 		WRITE_COEF(0x45, 0xc489),
5480 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5481 		WRITE_COEF(0x49, 0x0049),
5482 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5483 		WRITE_COEF(0x06, 0x6100),
5484 		{}
5485 	};
5486 	static const struct coef_fw coef0233[] = {
5487 		WRITE_COEF(0x06, 0x2100),
5488 		WRITE_COEF(0x32, 0x4ea3),
5489 		{}
5490 	};
5491 	static const struct coef_fw coef0288[] = {
5492 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5493 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5494 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5495 		UPDATE_COEF(0x66, 0x0008, 0),
5496 		UPDATE_COEF(0x67, 0x2000, 0),
5497 		{}
5498 	};
5499 	static const struct coef_fw coef0292[] = {
5500 		WRITE_COEF(0x76, 0x000e),
5501 		WRITE_COEF(0x6c, 0x2400),
5502 		WRITE_COEF(0x6b, 0xc429),
5503 		WRITE_COEF(0x18, 0x7308),
5504 		{}
5505 	};
5506 	static const struct coef_fw coef0293[] = {
5507 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5508 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5509 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5510 		{}
5511 	};
5512 	static const struct coef_fw coef0688[] = {
5513 		WRITE_COEF(0x11, 0x0041),
5514 		WRITE_COEF(0x15, 0x0d40),
5515 		WRITE_COEF(0xb7, 0x802b),
5516 		{}
5517 	};
5518 	static const struct coef_fw coef0274[] = {
5519 		WRITE_COEF(0x45, 0x4289),
5520 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5521 		UPDATE_COEF(0x6b, 0x0f00, 0),
5522 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5523 		{}
5524 	};
5525 
5526 	switch (codec->core.vendor_id) {
5527 	case 0x10ec0215:
5528 	case 0x10ec0225:
5529 	case 0x10ec0285:
5530 	case 0x10ec0295:
5531 	case 0x10ec0289:
5532 	case 0x10ec0299:
5533 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5534 		alc_process_coef_fw(codec, coef0225);
5535 		alc_hp_enable_unmute(codec, 75);
5536 		break;
5537 	case 0x10ec0255:
5538 		alc_process_coef_fw(codec, coef0255);
5539 		break;
5540 	case 0x10ec0230:
5541 	case 0x10ec0236:
5542 	case 0x10ec0256:
5543 	case 0x19e58326:
5544 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5545 		alc_write_coef_idx(codec, 0x45, 0xc089);
5546 		msleep(50);
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_process_coef_fw(codec, coef0274);
5554 		break;
5555 	case 0x10ec0233:
5556 	case 0x10ec0283:
5557 		alc_process_coef_fw(codec, coef0233);
5558 		break;
5559 	case 0x10ec0286:
5560 	case 0x10ec0288:
5561 	case 0x10ec0298:
5562 		alc_process_coef_fw(codec, coef0288);
5563 		break;
5564 	case 0x10ec0292:
5565 		alc_process_coef_fw(codec, coef0292);
5566 		break;
5567 	case 0x10ec0293:
5568 		alc_process_coef_fw(codec, coef0293);
5569 		break;
5570 	case 0x10ec0668:
5571 		alc_process_coef_fw(codec, coef0688);
5572 		break;
5573 	case 0x10ec0867:
5574 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5575 		break;
5576 	}
5577 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5578 }
5579 
5580 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5581 static void alc_headset_mode_ctia(struct hda_codec *codec)
5582 {
5583 	int val;
5584 
5585 	static const struct coef_fw coef0255[] = {
5586 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5587 		WRITE_COEF(0x1b, 0x0c2b),
5588 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5589 		{}
5590 	};
5591 	static const struct coef_fw coef0256[] = {
5592 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5593 		WRITE_COEF(0x1b, 0x0e6b),
5594 		{}
5595 	};
5596 	static const struct coef_fw coef0233[] = {
5597 		WRITE_COEF(0x45, 0xd429),
5598 		WRITE_COEF(0x1b, 0x0c2b),
5599 		WRITE_COEF(0x32, 0x4ea3),
5600 		{}
5601 	};
5602 	static const struct coef_fw coef0288[] = {
5603 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5604 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5605 		UPDATE_COEF(0x66, 0x0008, 0),
5606 		UPDATE_COEF(0x67, 0x2000, 0),
5607 		{}
5608 	};
5609 	static const struct coef_fw coef0292[] = {
5610 		WRITE_COEF(0x6b, 0xd429),
5611 		WRITE_COEF(0x76, 0x0008),
5612 		WRITE_COEF(0x18, 0x7388),
5613 		{}
5614 	};
5615 	static const struct coef_fw coef0293[] = {
5616 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5617 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5618 		{}
5619 	};
5620 	static const struct coef_fw coef0688[] = {
5621 		WRITE_COEF(0x11, 0x0001),
5622 		WRITE_COEF(0x15, 0x0d60),
5623 		WRITE_COEF(0xc3, 0x0000),
5624 		{}
5625 	};
5626 	static const struct coef_fw coef0225_1[] = {
5627 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5628 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5629 		{}
5630 	};
5631 	static const struct coef_fw coef0225_2[] = {
5632 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5633 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5634 		{}
5635 	};
5636 
5637 	switch (codec->core.vendor_id) {
5638 	case 0x10ec0255:
5639 		alc_process_coef_fw(codec, coef0255);
5640 		break;
5641 	case 0x10ec0230:
5642 	case 0x10ec0236:
5643 	case 0x10ec0256:
5644 	case 0x19e58326:
5645 		alc_process_coef_fw(codec, coef0256);
5646 		alc_hp_enable_unmute(codec, 75);
5647 		break;
5648 	case 0x10ec0234:
5649 	case 0x10ec0274:
5650 	case 0x10ec0294:
5651 		alc_write_coef_idx(codec, 0x45, 0xd689);
5652 		break;
5653 	case 0x10ec0233:
5654 	case 0x10ec0283:
5655 		alc_process_coef_fw(codec, coef0233);
5656 		break;
5657 	case 0x10ec0298:
5658 		val = alc_read_coef_idx(codec, 0x50);
5659 		if (val & (1 << 12)) {
5660 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5661 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5662 			msleep(300);
5663 		} else {
5664 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5665 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5666 			msleep(300);
5667 		}
5668 		break;
5669 	case 0x10ec0286:
5670 	case 0x10ec0288:
5671 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5672 		msleep(300);
5673 		alc_process_coef_fw(codec, coef0288);
5674 		break;
5675 	case 0x10ec0292:
5676 		alc_process_coef_fw(codec, coef0292);
5677 		break;
5678 	case 0x10ec0293:
5679 		alc_process_coef_fw(codec, coef0293);
5680 		break;
5681 	case 0x10ec0668:
5682 		alc_process_coef_fw(codec, coef0688);
5683 		break;
5684 	case 0x10ec0215:
5685 	case 0x10ec0225:
5686 	case 0x10ec0285:
5687 	case 0x10ec0295:
5688 	case 0x10ec0289:
5689 	case 0x10ec0299:
5690 		val = alc_read_coef_idx(codec, 0x45);
5691 		if (val & (1 << 9))
5692 			alc_process_coef_fw(codec, coef0225_2);
5693 		else
5694 			alc_process_coef_fw(codec, coef0225_1);
5695 		alc_hp_enable_unmute(codec, 75);
5696 		break;
5697 	case 0x10ec0867:
5698 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5699 		break;
5700 	}
5701 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5702 }
5703 
5704 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5705 static void alc_headset_mode_omtp(struct hda_codec *codec)
5706 {
5707 	static const struct coef_fw coef0255[] = {
5708 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5709 		WRITE_COEF(0x1b, 0x0c2b),
5710 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5711 		{}
5712 	};
5713 	static const struct coef_fw coef0256[] = {
5714 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5715 		WRITE_COEF(0x1b, 0x0e6b),
5716 		{}
5717 	};
5718 	static const struct coef_fw coef0233[] = {
5719 		WRITE_COEF(0x45, 0xe429),
5720 		WRITE_COEF(0x1b, 0x0c2b),
5721 		WRITE_COEF(0x32, 0x4ea3),
5722 		{}
5723 	};
5724 	static const struct coef_fw coef0288[] = {
5725 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5726 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5727 		UPDATE_COEF(0x66, 0x0008, 0),
5728 		UPDATE_COEF(0x67, 0x2000, 0),
5729 		{}
5730 	};
5731 	static const struct coef_fw coef0292[] = {
5732 		WRITE_COEF(0x6b, 0xe429),
5733 		WRITE_COEF(0x76, 0x0008),
5734 		WRITE_COEF(0x18, 0x7388),
5735 		{}
5736 	};
5737 	static const struct coef_fw coef0293[] = {
5738 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5739 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5740 		{}
5741 	};
5742 	static const struct coef_fw coef0688[] = {
5743 		WRITE_COEF(0x11, 0x0001),
5744 		WRITE_COEF(0x15, 0x0d50),
5745 		WRITE_COEF(0xc3, 0x0000),
5746 		{}
5747 	};
5748 	static const struct coef_fw coef0225[] = {
5749 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5750 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5751 		{}
5752 	};
5753 
5754 	switch (codec->core.vendor_id) {
5755 	case 0x10ec0255:
5756 		alc_process_coef_fw(codec, coef0255);
5757 		break;
5758 	case 0x10ec0230:
5759 	case 0x10ec0236:
5760 	case 0x10ec0256:
5761 	case 0x19e58326:
5762 		alc_process_coef_fw(codec, coef0256);
5763 		alc_hp_enable_unmute(codec, 75);
5764 		break;
5765 	case 0x10ec0234:
5766 	case 0x10ec0274:
5767 	case 0x10ec0294:
5768 		alc_write_coef_idx(codec, 0x45, 0xe689);
5769 		break;
5770 	case 0x10ec0233:
5771 	case 0x10ec0283:
5772 		alc_process_coef_fw(codec, coef0233);
5773 		break;
5774 	case 0x10ec0298:
5775 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5776 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5777 		msleep(300);
5778 		break;
5779 	case 0x10ec0286:
5780 	case 0x10ec0288:
5781 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5782 		msleep(300);
5783 		alc_process_coef_fw(codec, coef0288);
5784 		break;
5785 	case 0x10ec0292:
5786 		alc_process_coef_fw(codec, coef0292);
5787 		break;
5788 	case 0x10ec0293:
5789 		alc_process_coef_fw(codec, coef0293);
5790 		break;
5791 	case 0x10ec0668:
5792 		alc_process_coef_fw(codec, coef0688);
5793 		break;
5794 	case 0x10ec0215:
5795 	case 0x10ec0225:
5796 	case 0x10ec0285:
5797 	case 0x10ec0295:
5798 	case 0x10ec0289:
5799 	case 0x10ec0299:
5800 		alc_process_coef_fw(codec, coef0225);
5801 		alc_hp_enable_unmute(codec, 75);
5802 		break;
5803 	}
5804 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5805 }
5806 
alc_determine_headset_type(struct hda_codec * codec)5807 static void alc_determine_headset_type(struct hda_codec *codec)
5808 {
5809 	int val;
5810 	bool is_ctia = false;
5811 	struct alc_spec *spec = codec->spec;
5812 	static const struct coef_fw coef0255[] = {
5813 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5814 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5815  conteol) */
5816 		{}
5817 	};
5818 	static const struct coef_fw coef0288[] = {
5819 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5820 		{}
5821 	};
5822 	static const struct coef_fw coef0298[] = {
5823 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5824 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5825 		UPDATE_COEF(0x66, 0x0008, 0),
5826 		UPDATE_COEF(0x67, 0x2000, 0),
5827 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5828 		{}
5829 	};
5830 	static const struct coef_fw coef0293[] = {
5831 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5832 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5833 		{}
5834 	};
5835 	static const struct coef_fw coef0688[] = {
5836 		WRITE_COEF(0x11, 0x0001),
5837 		WRITE_COEF(0xb7, 0x802b),
5838 		WRITE_COEF(0x15, 0x0d60),
5839 		WRITE_COEF(0xc3, 0x0c00),
5840 		{}
5841 	};
5842 	static const struct coef_fw coef0274[] = {
5843 		UPDATE_COEF(0x4a, 0x0010, 0),
5844 		UPDATE_COEF(0x4a, 0x8000, 0),
5845 		WRITE_COEF(0x45, 0xd289),
5846 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5847 		{}
5848 	};
5849 
5850 	if (spec->no_internal_mic_pin) {
5851 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5852 		return;
5853 	}
5854 
5855 	switch (codec->core.vendor_id) {
5856 	case 0x10ec0255:
5857 		alc_process_coef_fw(codec, coef0255);
5858 		msleep(300);
5859 		val = alc_read_coef_idx(codec, 0x46);
5860 		is_ctia = (val & 0x0070) == 0x0070;
5861 		break;
5862 	case 0x10ec0230:
5863 	case 0x10ec0236:
5864 	case 0x10ec0256:
5865 	case 0x19e58326:
5866 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5867 		alc_write_coef_idx(codec, 0x06, 0x6104);
5868 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5869 
5870 		alc_process_coef_fw(codec, coef0255);
5871 		msleep(300);
5872 		val = alc_read_coef_idx(codec, 0x46);
5873 		is_ctia = (val & 0x0070) == 0x0070;
5874 		if (!is_ctia) {
5875 			alc_write_coef_idx(codec, 0x45, 0xe089);
5876 			msleep(100);
5877 			val = alc_read_coef_idx(codec, 0x46);
5878 			if ((val & 0x0070) == 0x0070)
5879 				is_ctia = false;
5880 			else
5881 				is_ctia = true;
5882 		}
5883 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5884 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5885 		break;
5886 	case 0x10ec0234:
5887 	case 0x10ec0274:
5888 	case 0x10ec0294:
5889 		alc_process_coef_fw(codec, coef0274);
5890 		msleep(850);
5891 		val = alc_read_coef_idx(codec, 0x46);
5892 		is_ctia = (val & 0x00f0) == 0x00f0;
5893 		break;
5894 	case 0x10ec0233:
5895 	case 0x10ec0283:
5896 		alc_write_coef_idx(codec, 0x45, 0xd029);
5897 		msleep(300);
5898 		val = alc_read_coef_idx(codec, 0x46);
5899 		is_ctia = (val & 0x0070) == 0x0070;
5900 		break;
5901 	case 0x10ec0298:
5902 		snd_hda_codec_write(codec, 0x21, 0,
5903 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5904 		msleep(100);
5905 		snd_hda_codec_write(codec, 0x21, 0,
5906 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5907 		msleep(200);
5908 
5909 		val = alc_read_coef_idx(codec, 0x50);
5910 		if (val & (1 << 12)) {
5911 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5912 			alc_process_coef_fw(codec, coef0288);
5913 			msleep(350);
5914 			val = alc_read_coef_idx(codec, 0x50);
5915 			is_ctia = (val & 0x0070) == 0x0070;
5916 		} else {
5917 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5918 			alc_process_coef_fw(codec, coef0288);
5919 			msleep(350);
5920 			val = alc_read_coef_idx(codec, 0x50);
5921 			is_ctia = (val & 0x0070) == 0x0070;
5922 		}
5923 		alc_process_coef_fw(codec, coef0298);
5924 		snd_hda_codec_write(codec, 0x21, 0,
5925 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5926 		msleep(75);
5927 		snd_hda_codec_write(codec, 0x21, 0,
5928 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5929 		break;
5930 	case 0x10ec0286:
5931 	case 0x10ec0288:
5932 		alc_process_coef_fw(codec, coef0288);
5933 		msleep(350);
5934 		val = alc_read_coef_idx(codec, 0x50);
5935 		is_ctia = (val & 0x0070) == 0x0070;
5936 		break;
5937 	case 0x10ec0292:
5938 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5939 		msleep(300);
5940 		val = alc_read_coef_idx(codec, 0x6c);
5941 		is_ctia = (val & 0x001c) == 0x001c;
5942 		break;
5943 	case 0x10ec0293:
5944 		alc_process_coef_fw(codec, coef0293);
5945 		msleep(300);
5946 		val = alc_read_coef_idx(codec, 0x46);
5947 		is_ctia = (val & 0x0070) == 0x0070;
5948 		break;
5949 	case 0x10ec0668:
5950 		alc_process_coef_fw(codec, coef0688);
5951 		msleep(300);
5952 		val = alc_read_coef_idx(codec, 0xbe);
5953 		is_ctia = (val & 0x1c02) == 0x1c02;
5954 		break;
5955 	case 0x10ec0215:
5956 	case 0x10ec0225:
5957 	case 0x10ec0285:
5958 	case 0x10ec0295:
5959 	case 0x10ec0289:
5960 	case 0x10ec0299:
5961 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5962 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5963 		val = alc_read_coef_idx(codec, 0x45);
5964 		if (val & (1 << 9)) {
5965 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5966 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5967 			msleep(800);
5968 			val = alc_read_coef_idx(codec, 0x46);
5969 			is_ctia = (val & 0x00f0) == 0x00f0;
5970 		} else {
5971 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5972 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5973 			msleep(800);
5974 			val = alc_read_coef_idx(codec, 0x46);
5975 			is_ctia = (val & 0x00f0) == 0x00f0;
5976 		}
5977 		if (!is_ctia) {
5978 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5979 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5980 			msleep(100);
5981 			val = alc_read_coef_idx(codec, 0x46);
5982 			if ((val & 0x00f0) == 0x00f0)
5983 				is_ctia = false;
5984 			else
5985 				is_ctia = true;
5986 		}
5987 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5988 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5989 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5990 		break;
5991 	case 0x10ec0867:
5992 		is_ctia = true;
5993 		break;
5994 	}
5995 
5996 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5997 		  str_yes_no(is_ctia));
5998 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5999 }
6000 
alc_update_headset_mode(struct hda_codec * codec)6001 static void alc_update_headset_mode(struct hda_codec *codec)
6002 {
6003 	struct alc_spec *spec = codec->spec;
6004 
6005 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
6006 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
6007 
6008 	int new_headset_mode;
6009 
6010 	if (!snd_hda_jack_detect(codec, hp_pin))
6011 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
6012 	else if (mux_pin == spec->headset_mic_pin)
6013 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
6014 	else if (mux_pin == spec->headphone_mic_pin)
6015 		new_headset_mode = ALC_HEADSET_MODE_MIC;
6016 	else
6017 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
6018 
6019 	if (new_headset_mode == spec->current_headset_mode) {
6020 		snd_hda_gen_update_outputs(codec);
6021 		return;
6022 	}
6023 
6024 	switch (new_headset_mode) {
6025 	case ALC_HEADSET_MODE_UNPLUGGED:
6026 		alc_headset_mode_unplugged(codec);
6027 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
6028 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
6029 		spec->gen.hp_jack_present = false;
6030 		break;
6031 	case ALC_HEADSET_MODE_HEADSET:
6032 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
6033 			alc_determine_headset_type(codec);
6034 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
6035 			alc_headset_mode_ctia(codec);
6036 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
6037 			alc_headset_mode_omtp(codec);
6038 		spec->gen.hp_jack_present = true;
6039 		break;
6040 	case ALC_HEADSET_MODE_MIC:
6041 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
6042 		spec->gen.hp_jack_present = false;
6043 		break;
6044 	case ALC_HEADSET_MODE_HEADPHONE:
6045 		alc_headset_mode_default(codec);
6046 		spec->gen.hp_jack_present = true;
6047 		break;
6048 	}
6049 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
6050 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
6051 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
6052 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
6053 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
6054 						  PIN_VREFHIZ);
6055 	}
6056 	spec->current_headset_mode = new_headset_mode;
6057 
6058 	snd_hda_gen_update_outputs(codec);
6059 }
6060 
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)6061 static void alc_update_headset_mode_hook(struct hda_codec *codec,
6062 					 struct snd_kcontrol *kcontrol,
6063 					 struct snd_ctl_elem_value *ucontrol)
6064 {
6065 	alc_update_headset_mode(codec);
6066 }
6067 
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)6068 static void alc_update_headset_jack_cb(struct hda_codec *codec,
6069 				       struct hda_jack_callback *jack)
6070 {
6071 	snd_hda_gen_hp_automute(codec, jack);
6072 	alc_update_headset_mode(codec);
6073 }
6074 
alc_probe_headset_mode(struct hda_codec * codec)6075 static void alc_probe_headset_mode(struct hda_codec *codec)
6076 {
6077 	int i;
6078 	struct alc_spec *spec = codec->spec;
6079 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6080 
6081 	/* Find mic pins */
6082 	for (i = 0; i < cfg->num_inputs; i++) {
6083 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
6084 			spec->headset_mic_pin = cfg->inputs[i].pin;
6085 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
6086 			spec->headphone_mic_pin = cfg->inputs[i].pin;
6087 	}
6088 
6089 	WARN_ON(spec->gen.cap_sync_hook);
6090 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
6091 	spec->gen.automute_hook = alc_update_headset_mode;
6092 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
6093 }
6094 
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)6095 static void alc_fixup_headset_mode(struct hda_codec *codec,
6096 				const struct hda_fixup *fix, int action)
6097 {
6098 	struct alc_spec *spec = codec->spec;
6099 
6100 	switch (action) {
6101 	case HDA_FIXUP_ACT_PRE_PROBE:
6102 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
6103 		break;
6104 	case HDA_FIXUP_ACT_PROBE:
6105 		alc_probe_headset_mode(codec);
6106 		break;
6107 	case HDA_FIXUP_ACT_INIT:
6108 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
6109 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
6110 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
6111 		}
6112 		alc_update_headset_mode(codec);
6113 		break;
6114 	}
6115 }
6116 
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6117 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
6118 				const struct hda_fixup *fix, int action)
6119 {
6120 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6121 		struct alc_spec *spec = codec->spec;
6122 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6123 	}
6124 	else
6125 		alc_fixup_headset_mode(codec, fix, action);
6126 }
6127 
alc255_set_default_jack_type(struct hda_codec * codec)6128 static void alc255_set_default_jack_type(struct hda_codec *codec)
6129 {
6130 	/* Set to iphone type */
6131 	static const struct coef_fw alc255fw[] = {
6132 		WRITE_COEF(0x1b, 0x880b),
6133 		WRITE_COEF(0x45, 0xd089),
6134 		WRITE_COEF(0x1b, 0x080b),
6135 		WRITE_COEF(0x46, 0x0004),
6136 		WRITE_COEF(0x1b, 0x0c0b),
6137 		{}
6138 	};
6139 	static const struct coef_fw alc256fw[] = {
6140 		WRITE_COEF(0x1b, 0x884b),
6141 		WRITE_COEF(0x45, 0xd089),
6142 		WRITE_COEF(0x1b, 0x084b),
6143 		WRITE_COEF(0x46, 0x0004),
6144 		WRITE_COEF(0x1b, 0x0c4b),
6145 		{}
6146 	};
6147 	switch (codec->core.vendor_id) {
6148 	case 0x10ec0255:
6149 		alc_process_coef_fw(codec, alc255fw);
6150 		break;
6151 	case 0x10ec0230:
6152 	case 0x10ec0236:
6153 	case 0x10ec0256:
6154 	case 0x19e58326:
6155 		alc_process_coef_fw(codec, alc256fw);
6156 		break;
6157 	}
6158 	msleep(30);
6159 }
6160 
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)6161 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
6162 				const struct hda_fixup *fix, int action)
6163 {
6164 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6165 		alc255_set_default_jack_type(codec);
6166 	}
6167 	alc_fixup_headset_mode(codec, fix, action);
6168 }
6169 
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6170 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
6171 				const struct hda_fixup *fix, int action)
6172 {
6173 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6174 		struct alc_spec *spec = codec->spec;
6175 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6176 		alc255_set_default_jack_type(codec);
6177 	}
6178 	else
6179 		alc_fixup_headset_mode(codec, fix, action);
6180 }
6181 
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)6182 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
6183 				       struct hda_jack_callback *jack)
6184 {
6185 	struct alc_spec *spec = codec->spec;
6186 
6187 	alc_update_headset_jack_cb(codec, jack);
6188 	/* Headset Mic enable or disable, only for Dell Dino */
6189 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
6190 }
6191 
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)6192 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
6193 				const struct hda_fixup *fix, int action)
6194 {
6195 	alc_fixup_headset_mode(codec, fix, action);
6196 	if (action == HDA_FIXUP_ACT_PROBE) {
6197 		struct alc_spec *spec = codec->spec;
6198 		/* toggled via hp_automute_hook */
6199 		spec->gpio_mask |= 0x40;
6200 		spec->gpio_dir |= 0x40;
6201 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
6202 	}
6203 }
6204 
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6205 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
6206 					const struct hda_fixup *fix, int action)
6207 {
6208 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6209 		struct alc_spec *spec = codec->spec;
6210 		spec->gen.auto_mute_via_amp = 1;
6211 	}
6212 }
6213 
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)6214 static void alc_fixup_no_shutup(struct hda_codec *codec,
6215 				const struct hda_fixup *fix, int action)
6216 {
6217 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6218 		struct alc_spec *spec = codec->spec;
6219 		spec->no_shutup_pins = 1;
6220 	}
6221 }
6222 
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)6223 static void alc_fixup_disable_aamix(struct hda_codec *codec,
6224 				    const struct hda_fixup *fix, int action)
6225 {
6226 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6227 		struct alc_spec *spec = codec->spec;
6228 		/* Disable AA-loopback as it causes white noise */
6229 		spec->gen.mixer_nid = 0;
6230 	}
6231 }
6232 
6233 /* 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)6234 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6235 				  const struct hda_fixup *fix, int action)
6236 {
6237 	static const struct hda_pintbl pincfgs[] = {
6238 		{ 0x16, 0x21211010 }, /* dock headphone */
6239 		{ 0x19, 0x21a11010 }, /* dock mic */
6240 		{ }
6241 	};
6242 	struct alc_spec *spec = codec->spec;
6243 
6244 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6245 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6246 		codec->power_save_node = 0; /* avoid click noises */
6247 		snd_hda_apply_pincfgs(codec, pincfgs);
6248 	}
6249 }
6250 
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6251 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6252 				  const struct hda_fixup *fix, int action)
6253 {
6254 	static const struct hda_pintbl pincfgs[] = {
6255 		{ 0x17, 0x21211010 }, /* dock headphone */
6256 		{ 0x19, 0x21a11010 }, /* dock mic */
6257 		{ }
6258 	};
6259 	struct alc_spec *spec = codec->spec;
6260 
6261 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6262 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6263 		snd_hda_apply_pincfgs(codec, pincfgs);
6264 	} else if (action == HDA_FIXUP_ACT_INIT) {
6265 		/* Enable DOCK device */
6266 		snd_hda_codec_write(codec, 0x17, 0,
6267 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6268 		/* Enable DOCK device */
6269 		snd_hda_codec_write(codec, 0x19, 0,
6270 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6271 	}
6272 }
6273 
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6274 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6275 				  const struct hda_fixup *fix, int action)
6276 {
6277 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6278 	 * the speaker output becomes too low by some reason on Thinkpads with
6279 	 * ALC298 codec
6280 	 */
6281 	static const hda_nid_t preferred_pairs[] = {
6282 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6283 		0
6284 	};
6285 	struct alc_spec *spec = codec->spec;
6286 
6287 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6288 		spec->gen.preferred_dacs = preferred_pairs;
6289 }
6290 
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6291 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6292 				   const struct hda_fixup *fix, int action)
6293 {
6294 	static const hda_nid_t preferred_pairs[] = {
6295 		0x17, 0x02, 0x21, 0x03, 0
6296 	};
6297 	struct alc_spec *spec = codec->spec;
6298 
6299 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6300 		spec->gen.preferred_dacs = preferred_pairs;
6301 }
6302 
alc_shutup_dell_xps13(struct hda_codec * codec)6303 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6304 {
6305 	struct alc_spec *spec = codec->spec;
6306 	int hp_pin = alc_get_hp_pin(spec);
6307 
6308 	/* Prevent pop noises when headphones are plugged in */
6309 	snd_hda_codec_write(codec, hp_pin, 0,
6310 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6311 	msleep(20);
6312 }
6313 
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6314 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6315 				const struct hda_fixup *fix, int action)
6316 {
6317 	struct alc_spec *spec = codec->spec;
6318 	struct hda_input_mux *imux = &spec->gen.input_mux;
6319 	int i;
6320 
6321 	switch (action) {
6322 	case HDA_FIXUP_ACT_PRE_PROBE:
6323 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6324 		 * it causes a click noise at start up
6325 		 */
6326 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6327 		spec->shutup = alc_shutup_dell_xps13;
6328 		break;
6329 	case HDA_FIXUP_ACT_PROBE:
6330 		/* Make the internal mic the default input source. */
6331 		for (i = 0; i < imux->num_items; i++) {
6332 			if (spec->gen.imux_pins[i] == 0x12) {
6333 				spec->gen.cur_mux[0] = i;
6334 				break;
6335 			}
6336 		}
6337 		break;
6338 	}
6339 }
6340 
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6341 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6342 				const struct hda_fixup *fix, int action)
6343 {
6344 	struct alc_spec *spec = codec->spec;
6345 
6346 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6347 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6348 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6349 
6350 		/* Disable boost for mic-in permanently. (This code is only called
6351 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6352 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6353 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6354 	} else
6355 		alc_fixup_headset_mode(codec, fix, action);
6356 }
6357 
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6358 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6359 				const struct hda_fixup *fix, int action)
6360 {
6361 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6362 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6363 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6364 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6365 	}
6366 	alc_fixup_headset_mode(codec, fix, action);
6367 }
6368 
6369 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6370 static int find_ext_mic_pin(struct hda_codec *codec)
6371 {
6372 	struct alc_spec *spec = codec->spec;
6373 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6374 	hda_nid_t nid;
6375 	unsigned int defcfg;
6376 	int i;
6377 
6378 	for (i = 0; i < cfg->num_inputs; i++) {
6379 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6380 			continue;
6381 		nid = cfg->inputs[i].pin;
6382 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6383 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6384 			continue;
6385 		return nid;
6386 	}
6387 
6388 	return 0;
6389 }
6390 
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6391 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6392 				    const struct hda_fixup *fix,
6393 				    int action)
6394 {
6395 	struct alc_spec *spec = codec->spec;
6396 
6397 	if (action == HDA_FIXUP_ACT_PROBE) {
6398 		int mic_pin = find_ext_mic_pin(codec);
6399 		int hp_pin = alc_get_hp_pin(spec);
6400 
6401 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6402 			return;
6403 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6404 	}
6405 }
6406 
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6407 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6408 					     const struct hda_fixup *fix,
6409 					     int action)
6410 {
6411 	struct alc_spec *spec = codec->spec;
6412 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6413 	int i;
6414 
6415 	/* The mic boosts on level 2 and 3 are too noisy
6416 	   on the internal mic input.
6417 	   Therefore limit the boost to 0 or 1. */
6418 
6419 	if (action != HDA_FIXUP_ACT_PROBE)
6420 		return;
6421 
6422 	for (i = 0; i < cfg->num_inputs; i++) {
6423 		hda_nid_t nid = cfg->inputs[i].pin;
6424 		unsigned int defcfg;
6425 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6426 			continue;
6427 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6428 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6429 			continue;
6430 
6431 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6432 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6433 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6434 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6435 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6436 	}
6437 }
6438 
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6439 static void alc283_hp_automute_hook(struct hda_codec *codec,
6440 				    struct hda_jack_callback *jack)
6441 {
6442 	struct alc_spec *spec = codec->spec;
6443 	int vref;
6444 
6445 	msleep(200);
6446 	snd_hda_gen_hp_automute(codec, jack);
6447 
6448 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6449 
6450 	msleep(600);
6451 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6452 			    vref);
6453 }
6454 
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6455 static void alc283_fixup_chromebook(struct hda_codec *codec,
6456 				    const struct hda_fixup *fix, int action)
6457 {
6458 	struct alc_spec *spec = codec->spec;
6459 
6460 	switch (action) {
6461 	case HDA_FIXUP_ACT_PRE_PROBE:
6462 		snd_hda_override_wcaps(codec, 0x03, 0);
6463 		/* Disable AA-loopback as it causes white noise */
6464 		spec->gen.mixer_nid = 0;
6465 		break;
6466 	case HDA_FIXUP_ACT_INIT:
6467 		/* MIC2-VREF control */
6468 		/* Set to manual mode */
6469 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6470 		/* Enable Line1 input control by verb */
6471 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6472 		break;
6473 	}
6474 }
6475 
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6476 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6477 				    const struct hda_fixup *fix, int action)
6478 {
6479 	struct alc_spec *spec = codec->spec;
6480 
6481 	switch (action) {
6482 	case HDA_FIXUP_ACT_PRE_PROBE:
6483 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6484 		break;
6485 	case HDA_FIXUP_ACT_INIT:
6486 		/* MIC2-VREF control */
6487 		/* Set to manual mode */
6488 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6489 		break;
6490 	}
6491 }
6492 
6493 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6494 static void asus_tx300_automute(struct hda_codec *codec)
6495 {
6496 	struct alc_spec *spec = codec->spec;
6497 	snd_hda_gen_update_outputs(codec);
6498 	if (snd_hda_jack_detect(codec, 0x1b))
6499 		spec->gen.mute_bits |= (1ULL << 0x14);
6500 }
6501 
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6502 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6503 				    const struct hda_fixup *fix, int action)
6504 {
6505 	struct alc_spec *spec = codec->spec;
6506 	static const struct hda_pintbl dock_pins[] = {
6507 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6508 		{}
6509 	};
6510 
6511 	switch (action) {
6512 	case HDA_FIXUP_ACT_PRE_PROBE:
6513 		spec->init_amp = ALC_INIT_DEFAULT;
6514 		/* TX300 needs to set up GPIO2 for the speaker amp */
6515 		alc_setup_gpio(codec, 0x04);
6516 		snd_hda_apply_pincfgs(codec, dock_pins);
6517 		spec->gen.auto_mute_via_amp = 1;
6518 		spec->gen.automute_hook = asus_tx300_automute;
6519 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6520 						    snd_hda_gen_hp_automute);
6521 		break;
6522 	case HDA_FIXUP_ACT_PROBE:
6523 		spec->init_amp = ALC_INIT_DEFAULT;
6524 		break;
6525 	case HDA_FIXUP_ACT_BUILD:
6526 		/* this is a bit tricky; give more sane names for the main
6527 		 * (tablet) speaker and the dock speaker, respectively
6528 		 */
6529 		rename_ctl(codec, "Speaker Playback Switch",
6530 			   "Dock Speaker Playback Switch");
6531 		rename_ctl(codec, "Bass Speaker Playback Switch",
6532 			   "Speaker Playback Switch");
6533 		break;
6534 	}
6535 }
6536 
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6537 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6538 				       const struct hda_fixup *fix, int action)
6539 {
6540 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6541 		/* DAC node 0x03 is giving mono output. We therefore want to
6542 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6543 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6544 		static const hda_nid_t conn1[] = { 0x0c };
6545 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6546 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6547 	}
6548 }
6549 
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6550 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6551 					const struct hda_fixup *fix, int action)
6552 {
6553 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6554 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6555 		   we can't adjust the speaker's volume since this node does not has
6556 		   Amp-out capability. we change the speaker's route to:
6557 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6558 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6559 		   speaker's volume now. */
6560 
6561 		static const hda_nid_t conn1[] = { 0x0c };
6562 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6563 	}
6564 }
6565 
6566 /* 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)6567 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6568 				      const struct hda_fixup *fix, int action)
6569 {
6570 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6571 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6572 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6573 	}
6574 }
6575 
6576 /* 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)6577 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6578 					  const struct hda_fixup *fix, int action)
6579 {
6580 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6581 		static const hda_nid_t conn[] = { 0x02 };
6582 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6583 	}
6584 }
6585 
6586 /* disable DAC3 (0x06) selection on NID 0x15 - share Speaker/Bass Speaker DAC 0x03 */
alc294_fixup_bass_speaker_15(struct hda_codec * codec,const struct hda_fixup * fix,int action)6587 static void alc294_fixup_bass_speaker_15(struct hda_codec *codec,
6588 					 const struct hda_fixup *fix, int action)
6589 {
6590 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6591 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6592 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
6593 	}
6594 }
6595 
6596 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6597 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6598 					  struct hda_jack_callback *jack)
6599 {
6600 	struct alc_spec *spec = codec->spec;
6601 
6602 	snd_hda_gen_hp_automute(codec, jack);
6603 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6604 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6605 			    !spec->gen.hp_jack_present);
6606 }
6607 
6608 /* Manage GPIOs for HP EliteBook Folio 9480m.
6609  *
6610  * GPIO4 is the headphone amplifier power control
6611  * GPIO3 is the audio output mute indicator LED
6612  */
6613 
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6614 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6615 				  const struct hda_fixup *fix,
6616 				  int action)
6617 {
6618 	struct alc_spec *spec = codec->spec;
6619 
6620 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6621 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6622 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6623 		spec->gpio_mask |= 0x10;
6624 		spec->gpio_dir |= 0x10;
6625 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6626 	}
6627 }
6628 
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6629 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6630 				   const struct hda_fixup *fix,
6631 				   int action)
6632 {
6633 	struct alc_spec *spec = codec->spec;
6634 
6635 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6636 		spec->gpio_mask |= 0x04;
6637 		spec->gpio_dir |= 0x04;
6638 		/* set data bit low */
6639 	}
6640 }
6641 
6642 /* Quirk for Thinkpad X1 7th and 8th Gen
6643  * The following fixed routing needed
6644  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6645  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6646  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6647  */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6648 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6649 					  const struct hda_fixup *fix, int action)
6650 {
6651 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6652 	static const hda_nid_t preferred_pairs[] = {
6653 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6654 	};
6655 	struct alc_spec *spec = codec->spec;
6656 
6657 	switch (action) {
6658 	case HDA_FIXUP_ACT_PRE_PROBE:
6659 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6660 		spec->gen.preferred_dacs = preferred_pairs;
6661 		break;
6662 	case HDA_FIXUP_ACT_BUILD:
6663 		/* The generic parser creates somewhat unintuitive volume ctls
6664 		 * with the fixed routing above, and the shared DAC2 may be
6665 		 * confusing for PA.
6666 		 * Rename those to unique names so that PA doesn't touch them
6667 		 * and use only Master volume.
6668 		 */
6669 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6670 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6671 		break;
6672 	}
6673 }
6674 
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6675 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6676 					 const struct hda_fixup *fix,
6677 					 int action)
6678 {
6679 	alc_fixup_dual_codecs(codec, fix, action);
6680 	switch (action) {
6681 	case HDA_FIXUP_ACT_PRE_PROBE:
6682 		/* override card longname to provide a unique UCM profile */
6683 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6684 		break;
6685 	case HDA_FIXUP_ACT_BUILD:
6686 		/* rename Capture controls depending on the codec */
6687 		rename_ctl(codec, "Capture Volume",
6688 			   codec->addr == 0 ?
6689 			   "Rear-Panel Capture Volume" :
6690 			   "Front-Panel Capture Volume");
6691 		rename_ctl(codec, "Capture Switch",
6692 			   codec->addr == 0 ?
6693 			   "Rear-Panel Capture Switch" :
6694 			   "Front-Panel Capture Switch");
6695 		break;
6696 	}
6697 }
6698 
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6699 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6700 				      const struct hda_fixup *fix, int action)
6701 {
6702 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6703 		return;
6704 
6705 	codec->power_save_node = 1;
6706 }
6707 
6708 /* 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)6709 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6710 				    const struct hda_fixup *fix, int action)
6711 {
6712 	struct alc_spec *spec = codec->spec;
6713 	static const hda_nid_t preferred_pairs[] = {
6714 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6715 		0
6716 	};
6717 
6718 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6719 		return;
6720 
6721 	spec->gen.preferred_dacs = preferred_pairs;
6722 	spec->gen.auto_mute_via_amp = 1;
6723 	codec->power_save_node = 0;
6724 }
6725 
6726 /* 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)6727 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6728 				    const struct hda_fixup *fix, int action)
6729 {
6730 	static const hda_nid_t preferred_pairs[] = {
6731 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6732 	};
6733 	struct alc_spec *spec = codec->spec;
6734 
6735 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6736 		spec->gen.preferred_dacs = preferred_pairs;
6737 }
6738 
6739 /* 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)6740 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6741 			      const struct hda_fixup *fix, int action)
6742 {
6743 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6744 		return;
6745 
6746 	snd_hda_override_wcaps(codec, 0x03, 0);
6747 }
6748 
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6749 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6750 {
6751 	switch (codec->core.vendor_id) {
6752 	case 0x10ec0274:
6753 	case 0x10ec0294:
6754 	case 0x10ec0225:
6755 	case 0x10ec0295:
6756 	case 0x10ec0299:
6757 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6758 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6759 		break;
6760 	case 0x10ec0230:
6761 	case 0x10ec0235:
6762 	case 0x10ec0236:
6763 	case 0x10ec0255:
6764 	case 0x10ec0256:
6765 	case 0x10ec0257:
6766 	case 0x19e58326:
6767 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6768 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6769 		break;
6770 	}
6771 }
6772 
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6773 static void alc295_fixup_chromebook(struct hda_codec *codec,
6774 				    const struct hda_fixup *fix, int action)
6775 {
6776 	struct alc_spec *spec = codec->spec;
6777 
6778 	switch (action) {
6779 	case HDA_FIXUP_ACT_PRE_PROBE:
6780 		spec->ultra_low_power = true;
6781 		break;
6782 	case HDA_FIXUP_ACT_INIT:
6783 		alc_combo_jack_hp_jd_restart(codec);
6784 		break;
6785 	}
6786 }
6787 
alc256_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6788 static void alc256_fixup_chromebook(struct hda_codec *codec,
6789 				    const struct hda_fixup *fix, int action)
6790 {
6791 	struct alc_spec *spec = codec->spec;
6792 
6793 	switch (action) {
6794 	case HDA_FIXUP_ACT_PRE_PROBE:
6795 		spec->gen.suppress_auto_mute = 1;
6796 		spec->gen.suppress_auto_mic = 1;
6797 		spec->en_3kpull_low = false;
6798 		break;
6799 	}
6800 }
6801 
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6802 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6803 				  const struct hda_fixup *fix, int action)
6804 {
6805 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6806 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6807 }
6808 
6809 
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6810 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6811 					struct hda_jack_callback *cb)
6812 {
6813 	/* The Windows driver sets the codec up in a very different way where
6814 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6815 	 */
6816 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6817 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6818 	else
6819 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6820 }
6821 
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6822 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6823 					const struct hda_fixup *fix, int action)
6824 {
6825 	/* Pin 0x21: headphones/headset mic */
6826 	if (!is_jack_detectable(codec, 0x21))
6827 		return;
6828 
6829 	switch (action) {
6830 	case HDA_FIXUP_ACT_PRE_PROBE:
6831 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6832 				alc294_gx502_toggle_output);
6833 		break;
6834 	case HDA_FIXUP_ACT_INIT:
6835 		/* Make sure to start in a correct state, i.e. if
6836 		 * headphones have been plugged in before powering up the system
6837 		 */
6838 		alc294_gx502_toggle_output(codec, NULL);
6839 		break;
6840 	}
6841 }
6842 
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6843 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6844 				       struct hda_jack_callback *cb)
6845 {
6846 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6847 	 * responsible from changes between speakers and headphones
6848 	 */
6849 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6850 		alc_write_coef_idx(codec, 0x10, 0x8420);
6851 	else
6852 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6853 }
6854 
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6855 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6856 				  const struct hda_fixup *fix, int action)
6857 {
6858 	if (!is_jack_detectable(codec, 0x21))
6859 		return;
6860 
6861 	switch (action) {
6862 	case HDA_FIXUP_ACT_PRE_PROBE:
6863 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6864 				alc294_gu502_toggle_output);
6865 		break;
6866 	case HDA_FIXUP_ACT_INIT:
6867 		alc294_gu502_toggle_output(codec, NULL);
6868 		break;
6869 	}
6870 }
6871 
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6872 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6873 			      const struct hda_fixup *fix, int action)
6874 {
6875 	if (action != HDA_FIXUP_ACT_INIT)
6876 		return;
6877 
6878 	msleep(100);
6879 	alc_write_coef_idx(codec, 0x65, 0x0);
6880 }
6881 
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6882 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6883 				    const struct hda_fixup *fix, int action)
6884 {
6885 	switch (action) {
6886 	case HDA_FIXUP_ACT_INIT:
6887 		alc_combo_jack_hp_jd_restart(codec);
6888 		break;
6889 	}
6890 }
6891 
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6892 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6893 				    const struct hda_fixup *fix, int action)
6894 {
6895 	struct alc_spec *spec = codec->spec;
6896 
6897 	switch (action) {
6898 	case HDA_FIXUP_ACT_PRE_PROBE:
6899 		/* Mic RING SLEEVE swap for combo jack */
6900 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6901 		spec->no_internal_mic_pin = true;
6902 		break;
6903 	case HDA_FIXUP_ACT_INIT:
6904 		alc_combo_jack_hp_jd_restart(codec);
6905 		break;
6906 	}
6907 }
6908 
6909 /* GPIO1 = amplifier on/off
6910  * GPIO3 = mic mute LED
6911  */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6912 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6913 					  const struct hda_fixup *fix, int action)
6914 {
6915 	static const hda_nid_t conn[] = { 0x02 };
6916 
6917 	struct alc_spec *spec = codec->spec;
6918 	static const struct hda_pintbl pincfgs[] = {
6919 		{ 0x14, 0x90170110 },  /* front/high speakers */
6920 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6921 		{ }
6922 	};
6923 
6924 	//enable micmute led
6925 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6926 
6927 	switch (action) {
6928 	case HDA_FIXUP_ACT_PRE_PROBE:
6929 		spec->micmute_led_polarity = 1;
6930 		/* needed for amp of back speakers */
6931 		spec->gpio_mask |= 0x01;
6932 		spec->gpio_dir |= 0x01;
6933 		snd_hda_apply_pincfgs(codec, pincfgs);
6934 		/* share DAC to have unified volume control */
6935 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6936 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6937 		break;
6938 	case HDA_FIXUP_ACT_INIT:
6939 		/* need to toggle GPIO to enable the amp of back speakers */
6940 		alc_update_gpio_data(codec, 0x01, true);
6941 		msleep(100);
6942 		alc_update_gpio_data(codec, 0x01, false);
6943 		break;
6944 	}
6945 }
6946 
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6947 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6948 					  const struct hda_fixup *fix, int action)
6949 {
6950 	static const hda_nid_t conn[] = { 0x02 };
6951 	static const struct hda_pintbl pincfgs[] = {
6952 		{ 0x14, 0x90170110 },  /* rear speaker */
6953 		{ }
6954 	};
6955 
6956 	switch (action) {
6957 	case HDA_FIXUP_ACT_PRE_PROBE:
6958 		snd_hda_apply_pincfgs(codec, pincfgs);
6959 		/* force front speaker to DAC1 */
6960 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6961 		break;
6962 	}
6963 }
6964 
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6965 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6966 				      const struct hda_fixup *fix,
6967 				      int action)
6968 {
6969 	static const struct coef_fw coefs[] = {
6970 		WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6971 		WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6972 		WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6973 		WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6974 		WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6975 		WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6976 		WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6977 		WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6978 		WRITE_COEF(0x6e, 0x1005), { }
6979 	};
6980 
6981 	static const struct hda_pintbl pincfgs[] = {
6982 		{ 0x12, 0xb7a60130 },  /* Internal microphone*/
6983 		{ 0x14, 0x90170150 },  /* B&O soundbar speakers */
6984 		{ 0x17, 0x90170153 },  /* Side speakers */
6985 		{ 0x19, 0x03a11040 },  /* Headset microphone */
6986 		{ }
6987 	};
6988 
6989 	switch (action) {
6990 	case HDA_FIXUP_ACT_PRE_PROBE:
6991 		snd_hda_apply_pincfgs(codec, pincfgs);
6992 
6993 		/* Fixes volume control problem for side speakers */
6994 		alc295_fixup_disable_dac3(codec, fix, action);
6995 
6996 		/* Fixes no sound from headset speaker */
6997 		snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
6998 
6999 		/* Auto-enable headset mic when plugged */
7000 		snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
7001 
7002 		/* Headset mic volume enhancement */
7003 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
7004 		break;
7005 	case HDA_FIXUP_ACT_INIT:
7006 		alc_process_coef_fw(codec, coefs);
7007 		break;
7008 	case HDA_FIXUP_ACT_BUILD:
7009 		rename_ctl(codec, "Bass Speaker Playback Volume",
7010 			   "B&O-Tuned Playback Volume");
7011 		rename_ctl(codec, "Front Playback Switch",
7012 			   "B&O Soundbar Playback Switch");
7013 		rename_ctl(codec, "Bass Speaker Playback Switch",
7014 			   "Side Speaker Playback Switch");
7015 		break;
7016 	}
7017 }
7018 
7019 /* for hda_fixup_thinkpad_acpi() */
7020 #include "thinkpad_helper.c"
7021 
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)7022 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
7023 				    const struct hda_fixup *fix, int action)
7024 {
7025 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
7026 	hda_fixup_thinkpad_acpi(codec, fix, action);
7027 }
7028 
7029 /* for hda_fixup_ideapad_acpi() */
7030 #include "ideapad_hotkey_led_helper.c"
7031 
alc_fixup_ideapad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)7032 static void alc_fixup_ideapad_acpi(struct hda_codec *codec,
7033 				   const struct hda_fixup *fix, int action)
7034 {
7035 	hda_fixup_ideapad_acpi(codec, fix, action);
7036 }
7037 
7038 /* 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)7039 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
7040 						  const struct hda_fixup *fix,
7041 						  int action)
7042 {
7043 	struct alc_spec *spec = codec->spec;
7044 
7045 	switch (action) {
7046 	case HDA_FIXUP_ACT_PRE_PROBE:
7047 		spec->gen.suppress_auto_mute = 1;
7048 		break;
7049 	}
7050 }
7051 
comp_acpi_device_notify(acpi_handle handle,u32 event,void * data)7052 static void comp_acpi_device_notify(acpi_handle handle, u32 event, void *data)
7053 {
7054 	struct hda_codec *cdc = data;
7055 	struct alc_spec *spec = cdc->spec;
7056 
7057 	codec_info(cdc, "ACPI Notification %d\n", event);
7058 
7059 	hda_component_acpi_device_notify(&spec->comps, handle, event, data);
7060 }
7061 
comp_bind(struct device * dev)7062 static int comp_bind(struct device *dev)
7063 {
7064 	struct hda_codec *cdc = dev_to_hda_codec(dev);
7065 	struct alc_spec *spec = cdc->spec;
7066 	int ret;
7067 
7068 	ret = hda_component_manager_bind(cdc, &spec->comps);
7069 	if (ret)
7070 		return ret;
7071 
7072 	return hda_component_manager_bind_acpi_notifications(cdc,
7073 							     &spec->comps,
7074 							     comp_acpi_device_notify, cdc);
7075 }
7076 
comp_unbind(struct device * dev)7077 static void comp_unbind(struct device *dev)
7078 {
7079 	struct hda_codec *cdc = dev_to_hda_codec(dev);
7080 	struct alc_spec *spec = cdc->spec;
7081 
7082 	hda_component_manager_unbind_acpi_notifications(cdc, &spec->comps, comp_acpi_device_notify);
7083 	hda_component_manager_unbind(cdc, &spec->comps);
7084 }
7085 
7086 static const struct component_master_ops comp_master_ops = {
7087 	.bind = comp_bind,
7088 	.unbind = comp_unbind,
7089 };
7090 
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)7091 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
7092 				       struct snd_pcm_substream *sub, int action)
7093 {
7094 	struct alc_spec *spec = cdc->spec;
7095 
7096 	hda_component_manager_playback_hook(&spec->comps, action);
7097 }
7098 
comp_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,const char * match_str,int count)7099 static void comp_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
7100 			       const char *hid, const char *match_str, int count)
7101 {
7102 	struct alc_spec *spec = cdc->spec;
7103 	int ret;
7104 
7105 	switch (action) {
7106 	case HDA_FIXUP_ACT_PRE_PROBE:
7107 		ret = hda_component_manager_init(cdc, &spec->comps, count, bus, hid,
7108 						 match_str, &comp_master_ops);
7109 		if (ret)
7110 			return;
7111 
7112 		spec->gen.pcm_playback_hook = comp_generic_playback_hook;
7113 		break;
7114 	case HDA_FIXUP_ACT_FREE:
7115 		hda_component_manager_free(&spec->comps, &comp_master_ops);
7116 		break;
7117 	}
7118 }
7119 
find_cirrus_companion_amps(struct hda_codec * cdc)7120 static void find_cirrus_companion_amps(struct hda_codec *cdc)
7121 {
7122 	struct device *dev = hda_codec_dev(cdc);
7123 	struct acpi_device *adev;
7124 	struct fwnode_handle *fwnode __free(fwnode_handle) = NULL;
7125 	const char *bus = NULL;
7126 	static const struct {
7127 		const char *hid;
7128 		const char *name;
7129 	} acpi_ids[] = {{ "CSC3554", "cs35l54-hda" },
7130 			{ "CSC3556", "cs35l56-hda" },
7131 			{ "CSC3557", "cs35l57-hda" }};
7132 	char *match;
7133 	int i, count = 0, count_devindex = 0;
7134 
7135 	for (i = 0; i < ARRAY_SIZE(acpi_ids); ++i) {
7136 		adev = acpi_dev_get_first_match_dev(acpi_ids[i].hid, NULL, -1);
7137 		if (adev)
7138 			break;
7139 	}
7140 	if (!adev) {
7141 		codec_dbg(cdc, "Did not find ACPI entry for a Cirrus Amp\n");
7142 		return;
7143 	}
7144 
7145 	count = i2c_acpi_client_count(adev);
7146 	if (count > 0) {
7147 		bus = "i2c";
7148 	} else {
7149 		count = acpi_spi_count_resources(adev);
7150 		if (count > 0)
7151 			bus = "spi";
7152 	}
7153 
7154 	fwnode = fwnode_handle_get(acpi_fwnode_handle(adev));
7155 	acpi_dev_put(adev);
7156 
7157 	if (!bus) {
7158 		codec_err(cdc, "Did not find any buses for %s\n", acpi_ids[i].hid);
7159 		return;
7160 	}
7161 
7162 	if (!fwnode) {
7163 		codec_err(cdc, "Could not get fwnode for %s\n", acpi_ids[i].hid);
7164 		return;
7165 	}
7166 
7167 	/*
7168 	 * When available the cirrus,dev-index property is an accurate
7169 	 * count of the amps in a system and is used in preference to
7170 	 * the count of bus devices that can contain additional address
7171 	 * alias entries.
7172 	 */
7173 	count_devindex = fwnode_property_count_u32(fwnode, "cirrus,dev-index");
7174 	if (count_devindex > 0)
7175 		count = count_devindex;
7176 
7177 	match = devm_kasprintf(dev, GFP_KERNEL, "-%%s:00-%s.%%d", acpi_ids[i].name);
7178 	if (!match)
7179 		return;
7180 	codec_info(cdc, "Found %d %s on %s (%s)\n", count, acpi_ids[i].hid, bus, match);
7181 	comp_generic_fixup(cdc, HDA_FIXUP_ACT_PRE_PROBE, bus, acpi_ids[i].hid, match, count);
7182 }
7183 
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7184 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7185 {
7186 	comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
7187 }
7188 
cs35l41_fixup_i2c_four(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7189 static void cs35l41_fixup_i2c_four(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7190 {
7191 	comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
7192 }
7193 
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)7194 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7195 {
7196 	comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
7197 }
7198 
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)7199 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7200 {
7201 	comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
7202 }
7203 
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7204 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7205 						 int action)
7206 {
7207 	comp_generic_fixup(cdc, action, "i2c", "CLSA0100", "-%s:00-cs35l41-hda.%d", 2);
7208 }
7209 
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7210 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7211 						 int action)
7212 {
7213 	comp_generic_fixup(cdc, action, "i2c", "CLSA0101", "-%s:00-cs35l41-hda.%d", 2);
7214 }
7215 
alc285_fixup_asus_ga403u(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7216 static void alc285_fixup_asus_ga403u(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7217 {
7218 	/*
7219 	 * The same SSID has been re-used in different hardware, they have
7220 	 * different codecs and the newer GA403U has a ALC285.
7221 	 */
7222 	if (cdc->core.vendor_id != 0x10ec0285)
7223 		alc_fixup_inv_dmic(cdc, fix, action);
7224 }
7225 
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7226 static void tas2781_fixup_i2c(struct hda_codec *cdc,
7227 	const struct hda_fixup *fix, int action)
7228 {
7229 	comp_generic_fixup(cdc, action, "i2c", "TIAS2781", "-%s:00", 1);
7230 }
7231 
tas2781_fixup_spi(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7232 static void tas2781_fixup_spi(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7233 {
7234 	comp_generic_fixup(cdc, action, "spi", "TXNW2781", "-%s:00-tas2781-hda.%d", 2);
7235 }
7236 
yoga7_14arb7_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7237 static void yoga7_14arb7_fixup_i2c(struct hda_codec *cdc,
7238 	const struct hda_fixup *fix, int action)
7239 {
7240 	comp_generic_fixup(cdc, action, "i2c", "INT8866", "-%s:00", 1);
7241 }
7242 
alc256_fixup_acer_sfg16_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)7243 static void alc256_fixup_acer_sfg16_micmute_led(struct hda_codec *codec,
7244 	const struct hda_fixup *fix, int action)
7245 {
7246 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
7247 }
7248 
7249 
7250 /* for alc295_fixup_hp_top_speakers */
7251 #include "hp_x360_helper.c"
7252 
7253 /* for alc285_fixup_ideapad_s740_coef() */
7254 #include "ideapad_s740_helper.c"
7255 
7256 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
7257 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
7258 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
7259 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
7260 	{}
7261 };
7262 
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)7263 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
7264 					   const struct hda_fixup *fix,
7265 					   int action)
7266 {
7267 	/*
7268 	 * A certain other OS sets these coeffs to different values. On at least
7269 	 * one TongFang barebone these settings might survive even a cold
7270 	 * reboot. So to restore a clean slate the values are explicitly reset
7271 	 * to default here. Without this, the external microphone is always in a
7272 	 * plugged-in state, while the internal microphone is always in an
7273 	 * unplugged state, breaking the ability to use the internal microphone.
7274 	 */
7275 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7276 }
7277 
7278 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7279 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7280 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7281 	WRITE_COEF(0x49, 0x0149),
7282 	{}
7283 };
7284 
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7285 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7286 				       const struct hda_fixup *fix,
7287 				       int action)
7288 {
7289 	/*
7290 	 * The audio jack input and output is not detected on the ASRock NUC Box
7291 	 * 1100 series when cold booting without this fix. Warm rebooting from a
7292 	 * certain other OS makes the audio functional, as COEF settings are
7293 	 * preserved in this case. This fix sets these altered COEF values as
7294 	 * the default.
7295 	 */
7296 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7297 }
7298 
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7299 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7300 						    const struct hda_fixup *fix,
7301 						    int action)
7302 {
7303 	/*
7304 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7305 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7306 	 * needs an additional quirk for sound working after suspend and resume.
7307 	 */
7308 	if (codec->core.vendor_id == 0x10ec0256) {
7309 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7310 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7311 	} else {
7312 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7313 	}
7314 }
7315 
alc256_decrease_headphone_amp_val(struct hda_codec * codec,const struct hda_fixup * fix,int action)7316 static void alc256_decrease_headphone_amp_val(struct hda_codec *codec,
7317 					      const struct hda_fixup *fix, int action)
7318 {
7319 	u32 caps;
7320 	u8 nsteps, offs;
7321 
7322 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7323 		return;
7324 
7325 	caps = query_amp_caps(codec, 0x3, HDA_OUTPUT);
7326 	nsteps = ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) - 10;
7327 	offs = ((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT) - 10;
7328 	caps &= ~AC_AMPCAP_NUM_STEPS & ~AC_AMPCAP_OFFSET;
7329 	caps |= (nsteps << AC_AMPCAP_NUM_STEPS_SHIFT) | (offs << AC_AMPCAP_OFFSET_SHIFT);
7330 
7331 	if (snd_hda_override_amp_caps(codec, 0x3, HDA_OUTPUT, caps))
7332 		codec_warn(codec, "failed to override amp caps for NID 0x3\n");
7333 }
7334 
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7335 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7336 						  const struct hda_fixup *fix,
7337 						  int action)
7338 {
7339 	struct alc_spec *spec = codec->spec;
7340 	struct hda_input_mux *imux = &spec->gen.input_mux;
7341 	int i;
7342 
7343 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
7344 
7345 	switch (action) {
7346 	case HDA_FIXUP_ACT_PRE_PROBE:
7347 		/**
7348 		 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7349 		 * to Hi-Z to avoid pop noises at startup and when plugging and
7350 		 * unplugging headphones.
7351 		 */
7352 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7353 		snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7354 		break;
7355 	case HDA_FIXUP_ACT_PROBE:
7356 		/**
7357 		 * Make the internal mic (0x12) the default input source to
7358 		 * prevent pop noises on cold boot.
7359 		 */
7360 		for (i = 0; i < imux->num_items; i++) {
7361 			if (spec->gen.imux_pins[i] == 0x12) {
7362 				spec->gen.cur_mux[0] = i;
7363 				break;
7364 			}
7365 		}
7366 		break;
7367 	}
7368 }
7369 
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7370 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7371 					  const struct hda_fixup *fix, int action)
7372 {
7373 	/*
7374 	 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7375 	 * unconnected.
7376 	 */
7377 	static const struct hda_pintbl pincfgs[] = {
7378 		{ 0x17, 0x90170121 },
7379 		{ }
7380 	};
7381 	/*
7382 	 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7383 	 * DAC 0x02 and 0x03 would be fine.
7384 	 */
7385 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7386 	/*
7387 	 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7388 	 * Headphones (0x21) are connected to DAC 0x03.
7389 	 */
7390 	static const hda_nid_t preferred_pairs[] = {
7391 		0x14, 0x02,
7392 		0x17, 0x02,
7393 		0x21, 0x03,
7394 		0
7395 	};
7396 	struct alc_spec *spec = codec->spec;
7397 
7398 	switch (action) {
7399 	case HDA_FIXUP_ACT_PRE_PROBE:
7400 		snd_hda_apply_pincfgs(codec, pincfgs);
7401 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7402 		spec->gen.preferred_dacs = preferred_pairs;
7403 		break;
7404 	}
7405 }
7406 
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7407 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7408 					  const struct hda_fixup *fix, int action)
7409 {
7410 	static const struct hda_pintbl pincfgs[] = {
7411 		{ 0x14, 0x90170151 },
7412 		{ 0x17, 0x90170150 },
7413 		{ }
7414 	};
7415 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7416 	static const hda_nid_t preferred_pairs[] = {
7417 		0x14, 0x02,
7418 		0x17, 0x03,
7419 		0x21, 0x02,
7420 		0
7421 	};
7422 	struct alc_spec *spec = codec->spec;
7423 
7424 	alc_fixup_no_shutup(codec, fix, action);
7425 
7426 	switch (action) {
7427 	case HDA_FIXUP_ACT_PRE_PROBE:
7428 		snd_hda_apply_pincfgs(codec, pincfgs);
7429 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7430 		spec->gen.preferred_dacs = preferred_pairs;
7431 		break;
7432 	}
7433 }
7434 
7435 /* 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)7436 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7437 				    const struct hda_fixup *fix, int action)
7438 {
7439 	struct alc_spec *spec = codec->spec;
7440 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7441 	static const hda_nid_t preferred_pairs[] = {
7442 		0x17, 0x02, 0x21, 0x03, 0
7443 	};
7444 
7445 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7446 		return;
7447 
7448 	snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7449 	spec->gen.preferred_dacs = preferred_pairs;
7450 	spec->gen.auto_mute_via_amp = 1;
7451 	if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7452 		snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7453 					0x0); /* Make sure 0x14 was disable */
7454 	}
7455 }
7456 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7457 static void alc_fixup_headset_mic(struct hda_codec *codec,
7458 				   const struct hda_fixup *fix, int action)
7459 {
7460 	struct alc_spec *spec = codec->spec;
7461 	static const struct hda_pintbl pincfgs[] = {
7462 		{ 0x19, 0x03a1103c },
7463 		{ }
7464 	};
7465 
7466 	switch (action) {
7467 	case HDA_FIXUP_ACT_PRE_PROBE:
7468 		snd_hda_apply_pincfgs(codec, pincfgs);
7469 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7470 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7471 		break;
7472 	}
7473 }
7474 
alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec * codec,const struct hda_fixup * fix,int action)7475 static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec,
7476 					  const struct hda_fixup *fix, int action)
7477 {
7478 	/*
7479 	 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
7480 	 * unconnected.
7481 	 * The Pin Complex 0x17 for the bass speakers has the lowest association
7482 	 * and sequence values so shift it up a bit to squeeze 0x14 in.
7483 	 */
7484 	static const struct hda_pintbl pincfgs[] = {
7485 		{ 0x14, 0x90170110 }, // top/treble
7486 		{ 0x17, 0x90170111 }, // bottom/bass
7487 		{ }
7488 	};
7489 
7490 	/*
7491 	 * Force DAC 0x02 for the bass speakers 0x17.
7492 	 */
7493 	static const hda_nid_t conn[] = { 0x02 };
7494 
7495 	switch (action) {
7496 	case HDA_FIXUP_ACT_PRE_PROBE:
7497 		snd_hda_apply_pincfgs(codec, pincfgs);
7498 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7499 		break;
7500 	}
7501 
7502 	cs35l41_fixup_i2c_two(codec, fix, action);
7503 	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7504 	alc245_fixup_hp_gpio_led(codec, fix, action);
7505 }
7506 
7507 /* some changes for Spectre x360 16, 2024 model */
alc245_fixup_hp_spectre_x360_16_aa0xxx(struct hda_codec * codec,const struct hda_fixup * fix,int action)7508 static void alc245_fixup_hp_spectre_x360_16_aa0xxx(struct hda_codec *codec,
7509 					  const struct hda_fixup *fix, int action)
7510 {
7511 	/*
7512 	 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
7513 	 * unconnected.
7514 	 * The Pin Complex 0x17 for the bass speakers has the lowest association
7515 	 * and sequence values so shift it up a bit to squeeze 0x14 in.
7516 	 */
7517 	struct alc_spec *spec = codec->spec;
7518 	static const struct hda_pintbl pincfgs[] = {
7519 		{ 0x14, 0x90170110 }, // top/treble
7520 		{ 0x17, 0x90170111 }, // bottom/bass
7521 		{ }
7522 	};
7523 
7524 	/*
7525 	 * Force DAC 0x02 for the bass speakers 0x17.
7526 	 */
7527 	static const hda_nid_t conn[] = { 0x02 };
7528 
7529 	switch (action) {
7530 	case HDA_FIXUP_ACT_PRE_PROBE:
7531 		/* needed for amp of back speakers */
7532 		spec->gpio_mask |= 0x01;
7533 		spec->gpio_dir |= 0x01;
7534 		snd_hda_apply_pincfgs(codec, pincfgs);
7535 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7536 		break;
7537 	case HDA_FIXUP_ACT_INIT:
7538 		/* need to toggle GPIO to enable the amp of back speakers */
7539 		alc_update_gpio_data(codec, 0x01, true);
7540 		msleep(100);
7541 		alc_update_gpio_data(codec, 0x01, false);
7542 		break;
7543 	}
7544 
7545 	cs35l41_fixup_i2c_two(codec, fix, action);
7546 	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7547 	alc245_fixup_hp_gpio_led(codec, fix, action);
7548 }
7549 
7550 /*
7551  * ALC287 PCM hooks
7552  */
alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)7553 static void alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream *hinfo,
7554 				   struct hda_codec *codec,
7555 				   struct snd_pcm_substream *substream,
7556 				   int action)
7557 {
7558 	switch (action) {
7559 	case HDA_GEN_PCM_ACT_OPEN:
7560 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x954f); /* write gpio3 to high */
7561 		break;
7562 	case HDA_GEN_PCM_ACT_CLOSE:
7563 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7564 		break;
7565 	}
7566 }
7567 
alc287_s4_power_gpio3_default(struct hda_codec * codec)7568 static void alc287_s4_power_gpio3_default(struct hda_codec *codec)
7569 {
7570 	if (is_s4_suspend(codec)) {
7571 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7572 	}
7573 }
7574 
alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec * codec,const struct hda_fixup * fix,int action)7575 static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec,
7576 			       const struct hda_fixup *fix, int action)
7577 {
7578 	struct alc_spec *spec = codec->spec;
7579 	static const struct coef_fw coefs[] = {
7580 		WRITE_COEF(0x24, 0x0013), WRITE_COEF(0x25, 0x0000), WRITE_COEF(0x26, 0xC300),
7581 		WRITE_COEF(0x28, 0x0001), WRITE_COEF(0x29, 0xb023),
7582 		WRITE_COEF(0x24, 0x0013), WRITE_COEF(0x25, 0x0000), WRITE_COEF(0x26, 0xC301),
7583 		WRITE_COEF(0x28, 0x0001), WRITE_COEF(0x29, 0xb023),
7584 	};
7585 
7586 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7587 		return;
7588 	alc_update_coef_idx(codec, 0x10, 1<<11, 1<<11);
7589 	alc_process_coef_fw(codec, coefs);
7590 	spec->power_hook = alc287_s4_power_gpio3_default;
7591 	spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook;
7592 }
7593 
7594 /*
7595  * Clear COEF 0x0d (PCBEEP passthrough) bit 0x40 where BIOS sets it wrongly
7596  * at PM resume
7597  */
alc283_fixup_dell_hp_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7598 static void alc283_fixup_dell_hp_resume(struct hda_codec *codec,
7599 					const struct hda_fixup *fix, int action)
7600 {
7601 	if (action == HDA_FIXUP_ACT_INIT)
7602 		alc_write_coef_idx(codec, 0xd, 0x2800);
7603 }
7604 
7605 enum {
7606 	ALC269_FIXUP_GPIO2,
7607 	ALC269_FIXUP_SONY_VAIO,
7608 	ALC275_FIXUP_SONY_VAIO_GPIO2,
7609 	ALC269_FIXUP_DELL_M101Z,
7610 	ALC269_FIXUP_SKU_IGNORE,
7611 	ALC269_FIXUP_ASUS_G73JW,
7612 	ALC269_FIXUP_ASUS_N7601ZM_PINS,
7613 	ALC269_FIXUP_ASUS_N7601ZM,
7614 	ALC269_FIXUP_LENOVO_EAPD,
7615 	ALC275_FIXUP_SONY_HWEQ,
7616 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
7617 	ALC271_FIXUP_DMIC,
7618 	ALC269_FIXUP_PCM_44K,
7619 	ALC269_FIXUP_STEREO_DMIC,
7620 	ALC269_FIXUP_HEADSET_MIC,
7621 	ALC269_FIXUP_QUANTA_MUTE,
7622 	ALC269_FIXUP_LIFEBOOK,
7623 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
7624 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
7625 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7626 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7627 	ALC269_FIXUP_AMIC,
7628 	ALC269_FIXUP_DMIC,
7629 	ALC269VB_FIXUP_AMIC,
7630 	ALC269VB_FIXUP_DMIC,
7631 	ALC269_FIXUP_HP_MUTE_LED,
7632 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
7633 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
7634 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
7635 	ALC269_FIXUP_HP_GPIO_LED,
7636 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
7637 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
7638 	ALC269_FIXUP_INV_DMIC,
7639 	ALC269_FIXUP_LENOVO_DOCK,
7640 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7641 	ALC269_FIXUP_NO_SHUTUP,
7642 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7643 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7644 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7645 	ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7646 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7647 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7648 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7649 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7650 	ALC269_FIXUP_HEADSET_MODE,
7651 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7652 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7653 	ALC269_FIXUP_ASUS_X101_FUNC,
7654 	ALC269_FIXUP_ASUS_X101_VERB,
7655 	ALC269_FIXUP_ASUS_X101,
7656 	ALC271_FIXUP_AMIC_MIC2,
7657 	ALC271_FIXUP_HP_GATE_MIC_JACK,
7658 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7659 	ALC269_FIXUP_ACER_AC700,
7660 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7661 	ALC269VB_FIXUP_ASUS_ZENBOOK,
7662 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7663 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7664 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7665 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
7666 	ALC283_FIXUP_CHROME_BOOK,
7667 	ALC283_FIXUP_SENSE_COMBO_JACK,
7668 	ALC282_FIXUP_ASUS_TX300,
7669 	ALC283_FIXUP_INT_MIC,
7670 	ALC290_FIXUP_MONO_SPEAKERS,
7671 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7672 	ALC290_FIXUP_SUBWOOFER,
7673 	ALC290_FIXUP_SUBWOOFER_HSJACK,
7674 	ALC295_FIXUP_HP_MUTE_LED_COEFBIT11,
7675 	ALC269_FIXUP_THINKPAD_ACPI,
7676 	ALC269_FIXUP_LENOVO_XPAD_ACPI,
7677 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7678 	ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
7679 	ALC269VC_FIXUP_INFINIX_Y4_MAX,
7680 	ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7681 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7682 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7683 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7684 	ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7685 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7686 	ALC255_FIXUP_HEADSET_MODE,
7687 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7688 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7689 	ALC292_FIXUP_TPT440_DOCK,
7690 	ALC292_FIXUP_TPT440,
7691 	ALC283_FIXUP_HEADSET_MIC,
7692 	ALC255_FIXUP_MIC_MUTE_LED,
7693 	ALC282_FIXUP_ASPIRE_V5_PINS,
7694 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
7695 	ALC280_FIXUP_HP_GPIO4,
7696 	ALC286_FIXUP_HP_GPIO_LED,
7697 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7698 	ALC280_FIXUP_HP_DOCK_PINS,
7699 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7700 	ALC280_FIXUP_HP_9480M,
7701 	ALC245_FIXUP_HP_X360_AMP,
7702 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7703 	ALC285_FIXUP_HP_ENVY_X360,
7704 	ALC288_FIXUP_DELL_HEADSET_MODE,
7705 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7706 	ALC288_FIXUP_DELL_XPS_13,
7707 	ALC288_FIXUP_DISABLE_AAMIX,
7708 	ALC292_FIXUP_DELL_E7X_AAMIX,
7709 	ALC292_FIXUP_DELL_E7X,
7710 	ALC292_FIXUP_DISABLE_AAMIX,
7711 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7712 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7713 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7714 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7715 	ALC275_FIXUP_DELL_XPS,
7716 	ALC293_FIXUP_LENOVO_SPK_NOISE,
7717 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7718 	ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED,
7719 	ALC255_FIXUP_DELL_SPK_NOISE,
7720 	ALC225_FIXUP_DISABLE_MIC_VREF,
7721 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7722 	ALC295_FIXUP_DISABLE_DAC3,
7723 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
7724 	ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7725 	ALC285_FIXUP_ASUS_HEADSET_MIC,
7726 	ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7727 	ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7728 	ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7729 	ALC280_FIXUP_HP_HEADSET_MIC,
7730 	ALC221_FIXUP_HP_FRONT_MIC,
7731 	ALC292_FIXUP_TPT460,
7732 	ALC298_FIXUP_SPK_VOLUME,
7733 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
7734 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7735 	ALC269_FIXUP_ATIV_BOOK_8,
7736 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7737 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7738 	ALC256_FIXUP_ASUS_HEADSET_MODE,
7739 	ALC256_FIXUP_ASUS_MIC,
7740 	ALC256_FIXUP_ASUS_AIO_GPIO2,
7741 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7742 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7743 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
7744 	ALC233_FIXUP_ACER_HEADSET_MIC,
7745 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
7746 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7747 	ALC225_FIXUP_S3_POP_NOISE,
7748 	ALC700_FIXUP_INTEL_REFERENCE,
7749 	ALC274_FIXUP_DELL_BIND_DACS,
7750 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7751 	ALC298_FIXUP_TPT470_DOCK_FIX,
7752 	ALC298_FIXUP_TPT470_DOCK,
7753 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7754 	ALC255_FIXUP_DELL_HEADSET_MIC,
7755 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7756 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
7757 	ALC295_FIXUP_HP_X360,
7758 	ALC221_FIXUP_HP_HEADSET_MIC,
7759 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7760 	ALC295_FIXUP_HP_AUTO_MUTE,
7761 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7762 	ALC294_FIXUP_ASUS_MIC,
7763 	ALC294_FIXUP_ASUS_HEADSET_MIC,
7764 	ALC294_FIXUP_ASUS_SPK,
7765 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7766 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7767 	ALC255_FIXUP_ACER_HEADSET_MIC,
7768 	ALC295_FIXUP_CHROME_BOOK,
7769 	ALC225_FIXUP_HEADSET_JACK,
7770 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7771 	ALC225_FIXUP_WYSE_AUTO_MUTE,
7772 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7773 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7774 	ALC256_FIXUP_ASUS_HEADSET_MIC,
7775 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7776 	ALC255_FIXUP_PREDATOR_SUBWOOFER,
7777 	ALC299_FIXUP_PREDATOR_SPK,
7778 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7779 	ALC289_FIXUP_DELL_SPK1,
7780 	ALC289_FIXUP_DELL_SPK2,
7781 	ALC289_FIXUP_DUAL_SPK,
7782 	ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7783 	ALC294_FIXUP_SPK2_TO_DAC1,
7784 	ALC294_FIXUP_ASUS_DUAL_SPK,
7785 	ALC285_FIXUP_THINKPAD_X1_GEN7,
7786 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7787 	ALC294_FIXUP_ASUS_ALLY,
7788 	ALC294_FIXUP_ASUS_ALLY_PINS,
7789 	ALC294_FIXUP_ASUS_ALLY_VERBS,
7790 	ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7791 	ALC294_FIXUP_ASUS_HPE,
7792 	ALC294_FIXUP_ASUS_COEF_1B,
7793 	ALC294_FIXUP_ASUS_GX502_HP,
7794 	ALC294_FIXUP_ASUS_GX502_PINS,
7795 	ALC294_FIXUP_ASUS_GX502_VERBS,
7796 	ALC294_FIXUP_ASUS_GU502_HP,
7797 	ALC294_FIXUP_ASUS_GU502_PINS,
7798 	ALC294_FIXUP_ASUS_GU502_VERBS,
7799 	ALC294_FIXUP_ASUS_G513_PINS,
7800 	ALC285_FIXUP_ASUS_G533Z_PINS,
7801 	ALC285_FIXUP_HP_GPIO_LED,
7802 	ALC285_FIXUP_HP_MUTE_LED,
7803 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7804 	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7805 	ALC236_FIXUP_HP_GPIO_LED,
7806 	ALC236_FIXUP_HP_MUTE_LED,
7807 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7808 	ALC236_FIXUP_LENOVO_INV_DMIC,
7809 	ALC298_FIXUP_SAMSUNG_AMP,
7810 	ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS,
7811 	ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS,
7812 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7813 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7814 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7815 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7816 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
7817 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7818 	ALC289_FIXUP_ASUS_GA401,
7819 	ALC289_FIXUP_ASUS_GA502,
7820 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7821 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
7822 	ALC269_FIXUP_CZC_B20,
7823 	ALC269_FIXUP_CZC_TMI,
7824 	ALC269_FIXUP_CZC_L101,
7825 	ALC269_FIXUP_LEMOTE_A1802,
7826 	ALC269_FIXUP_LEMOTE_A190X,
7827 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
7828 	ALC233_FIXUP_INTEL_NUC8_DMIC,
7829 	ALC233_FIXUP_INTEL_NUC8_BOOST,
7830 	ALC256_FIXUP_INTEL_NUC10,
7831 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7832 	ALC274_FIXUP_HP_MIC,
7833 	ALC274_FIXUP_HP_HEADSET_MIC,
7834 	ALC274_FIXUP_HP_ENVY_GPIO,
7835 	ALC274_FIXUP_ASUS_ZEN_AIO_27,
7836 	ALC256_FIXUP_ASUS_HPE,
7837 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7838 	ALC287_FIXUP_HP_GPIO_LED,
7839 	ALC256_FIXUP_HP_HEADSET_MIC,
7840 	ALC245_FIXUP_HP_GPIO_LED,
7841 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7842 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7843 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7844 	ALC256_FIXUP_ACER_HEADSET_MIC,
7845 	ALC285_FIXUP_IDEAPAD_S740_COEF,
7846 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7847 	ALC295_FIXUP_ASUS_DACS,
7848 	ALC295_FIXUP_HP_OMEN,
7849 	ALC285_FIXUP_HP_SPECTRE_X360,
7850 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7851 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7852 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7853 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7854 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7855 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7856 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7857 	ALC298_FIXUP_LENOVO_C940_DUET7,
7858 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
7859 	ALC256_FIXUP_SET_COEF_DEFAULTS,
7860 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7861 	ALC233_FIXUP_NO_AUDIO_JACK,
7862 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7863 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7864 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7865 	ALC287_FIXUP_LEGION_16ACHG6,
7866 	ALC287_FIXUP_CS35L41_I2C_2,
7867 	ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7868 	ALC287_FIXUP_CS35L41_I2C_4,
7869 	ALC245_FIXUP_CS35L41_SPI_2,
7870 	ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7871 	ALC245_FIXUP_CS35L41_SPI_4,
7872 	ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7873 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7874 	ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7875 	ALC287_FIXUP_LEGION_16ITHG6,
7876 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7877 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7878 	ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7879 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7880 	ALC236_FIXUP_DELL_DUAL_CODECS,
7881 	ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7882 	ALC287_FIXUP_TAS2781_I2C,
7883 	ALC245_FIXUP_TAS2781_SPI_2,
7884 	ALC287_FIXUP_YOGA7_14ARB7_I2C,
7885 	ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7886 	ALC245_FIXUP_HP_X360_MUTE_LEDS,
7887 	ALC287_FIXUP_THINKPAD_I2S_SPK,
7888 	ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7889 	ALC2XX_FIXUP_HEADSET_MIC,
7890 	ALC289_FIXUP_DELL_CS35L41_SPI_2,
7891 	ALC294_FIXUP_CS35L41_I2C_2,
7892 	ALC256_FIXUP_ACER_SFG16_MICMUTE_LED,
7893 	ALC256_FIXUP_HEADPHONE_AMP_VOL,
7894 	ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX,
7895 	ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX,
7896 	ALC285_FIXUP_ASUS_GA403U,
7897 	ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC,
7898 	ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1,
7899 	ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
7900 	ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1,
7901 	ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318,
7902 	ALC256_FIXUP_CHROME_BOOK,
7903 	ALC245_FIXUP_CLEVO_NOISY_MIC,
7904 	ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE,
7905 	ALC233_FIXUP_MEDION_MTL_SPK,
7906 	ALC294_FIXUP_BASS_SPEAKER_15,
7907 	ALC283_FIXUP_DELL_HP_RESUME,
7908 };
7909 
7910 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7911  * both have the very same PCI SSID, and we need to apply different fixups
7912  * depending on the codec ID
7913  */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)7914 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7915 					   const struct hda_fixup *fix,
7916 					   int action)
7917 {
7918 	int id;
7919 
7920 	if (codec->core.vendor_id == 0x10ec0298)
7921 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7922 	else
7923 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7924 	__snd_hda_apply_fixup(codec, id, action, 0);
7925 }
7926 
7927 static const struct hda_fixup alc269_fixups[] = {
7928 	[ALC269_FIXUP_GPIO2] = {
7929 		.type = HDA_FIXUP_FUNC,
7930 		.v.func = alc_fixup_gpio2,
7931 	},
7932 	[ALC269_FIXUP_SONY_VAIO] = {
7933 		.type = HDA_FIXUP_PINCTLS,
7934 		.v.pins = (const struct hda_pintbl[]) {
7935 			{0x19, PIN_VREFGRD},
7936 			{}
7937 		}
7938 	},
7939 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7940 		.type = HDA_FIXUP_FUNC,
7941 		.v.func = alc275_fixup_gpio4_off,
7942 		.chained = true,
7943 		.chain_id = ALC269_FIXUP_SONY_VAIO
7944 	},
7945 	[ALC269_FIXUP_DELL_M101Z] = {
7946 		.type = HDA_FIXUP_VERBS,
7947 		.v.verbs = (const struct hda_verb[]) {
7948 			/* Enables internal speaker */
7949 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
7950 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7951 			{}
7952 		}
7953 	},
7954 	[ALC269_FIXUP_SKU_IGNORE] = {
7955 		.type = HDA_FIXUP_FUNC,
7956 		.v.func = alc_fixup_sku_ignore,
7957 	},
7958 	[ALC269_FIXUP_ASUS_G73JW] = {
7959 		.type = HDA_FIXUP_PINS,
7960 		.v.pins = (const struct hda_pintbl[]) {
7961 			{ 0x17, 0x99130111 }, /* subwoofer */
7962 			{ }
7963 		}
7964 	},
7965 	[ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7966 		.type = HDA_FIXUP_PINS,
7967 		.v.pins = (const struct hda_pintbl[]) {
7968 			{ 0x19, 0x03A11050 },
7969 			{ 0x1a, 0x03A11C30 },
7970 			{ 0x21, 0x03211420 },
7971 			{ }
7972 		}
7973 	},
7974 	[ALC269_FIXUP_ASUS_N7601ZM] = {
7975 		.type = HDA_FIXUP_VERBS,
7976 		.v.verbs = (const struct hda_verb[]) {
7977 			{0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7978 			{0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7979 			{0x20, AC_VERB_SET_COEF_INDEX, 0x10},
7980 			{0x20, AC_VERB_SET_PROC_COEF, 0x8420},
7981 			{0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
7982 			{0x20, AC_VERB_SET_PROC_COEF, 0x7774},
7983 			{ }
7984 		},
7985 		.chained = true,
7986 		.chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
7987 	},
7988 	[ALC269_FIXUP_LENOVO_EAPD] = {
7989 		.type = HDA_FIXUP_VERBS,
7990 		.v.verbs = (const struct hda_verb[]) {
7991 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7992 			{}
7993 		}
7994 	},
7995 	[ALC275_FIXUP_SONY_HWEQ] = {
7996 		.type = HDA_FIXUP_FUNC,
7997 		.v.func = alc269_fixup_hweq,
7998 		.chained = true,
7999 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
8000 	},
8001 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
8002 		.type = HDA_FIXUP_FUNC,
8003 		.v.func = alc_fixup_disable_aamix,
8004 		.chained = true,
8005 		.chain_id = ALC269_FIXUP_SONY_VAIO
8006 	},
8007 	[ALC271_FIXUP_DMIC] = {
8008 		.type = HDA_FIXUP_FUNC,
8009 		.v.func = alc271_fixup_dmic,
8010 	},
8011 	[ALC269_FIXUP_PCM_44K] = {
8012 		.type = HDA_FIXUP_FUNC,
8013 		.v.func = alc269_fixup_pcm_44k,
8014 		.chained = true,
8015 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
8016 	},
8017 	[ALC269_FIXUP_STEREO_DMIC] = {
8018 		.type = HDA_FIXUP_FUNC,
8019 		.v.func = alc269_fixup_stereo_dmic,
8020 	},
8021 	[ALC269_FIXUP_HEADSET_MIC] = {
8022 		.type = HDA_FIXUP_FUNC,
8023 		.v.func = alc269_fixup_headset_mic,
8024 	},
8025 	[ALC269_FIXUP_QUANTA_MUTE] = {
8026 		.type = HDA_FIXUP_FUNC,
8027 		.v.func = alc269_fixup_quanta_mute,
8028 	},
8029 	[ALC269_FIXUP_LIFEBOOK] = {
8030 		.type = HDA_FIXUP_PINS,
8031 		.v.pins = (const struct hda_pintbl[]) {
8032 			{ 0x1a, 0x2101103f }, /* dock line-out */
8033 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
8034 			{ }
8035 		},
8036 		.chained = true,
8037 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
8038 	},
8039 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
8040 		.type = HDA_FIXUP_PINS,
8041 		.v.pins = (const struct hda_pintbl[]) {
8042 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
8043 			{ }
8044 		},
8045 	},
8046 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
8047 		.type = HDA_FIXUP_PINS,
8048 		.v.pins = (const struct hda_pintbl[]) {
8049 			{ 0x21, 0x0221102f }, /* HP out */
8050 			{ }
8051 		},
8052 	},
8053 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
8054 		.type = HDA_FIXUP_FUNC,
8055 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
8056 	},
8057 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
8058 		.type = HDA_FIXUP_FUNC,
8059 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
8060 	},
8061 	[ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13] = {
8062 		.type = HDA_FIXUP_PINS,
8063 		.v.pins = (const struct hda_pintbl[]) {
8064 			{ 0x14, 0x90170151 }, /* use as internal speaker (LFE) */
8065 			{ 0x1b, 0x90170152 }, /* use as internal speaker (back) */
8066 			{ }
8067 		},
8068 		.chained = true,
8069 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8070 	},
8071 	[ALC269VC_FIXUP_INFINIX_Y4_MAX] = {
8072 		.type = HDA_FIXUP_PINS,
8073 		.v.pins = (const struct hda_pintbl[]) {
8074 			{ 0x1b, 0x90170150 }, /* use as internal speaker */
8075 			{ }
8076 		},
8077 		.chained = true,
8078 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8079 	},
8080 	[ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
8081 		.type = HDA_FIXUP_PINS,
8082 		.v.pins = (const struct hda_pintbl[]) {
8083 			{ 0x18, 0x03a19020 }, /* headset mic */
8084 			{ 0x1b, 0x90170150 }, /* speaker */
8085 			{ }
8086 		},
8087 	},
8088 	[ALC269_FIXUP_AMIC] = {
8089 		.type = HDA_FIXUP_PINS,
8090 		.v.pins = (const struct hda_pintbl[]) {
8091 			{ 0x14, 0x99130110 }, /* speaker */
8092 			{ 0x15, 0x0121401f }, /* HP out */
8093 			{ 0x18, 0x01a19c20 }, /* mic */
8094 			{ 0x19, 0x99a3092f }, /* int-mic */
8095 			{ }
8096 		},
8097 	},
8098 	[ALC269_FIXUP_DMIC] = {
8099 		.type = HDA_FIXUP_PINS,
8100 		.v.pins = (const struct hda_pintbl[]) {
8101 			{ 0x12, 0x99a3092f }, /* int-mic */
8102 			{ 0x14, 0x99130110 }, /* speaker */
8103 			{ 0x15, 0x0121401f }, /* HP out */
8104 			{ 0x18, 0x01a19c20 }, /* mic */
8105 			{ }
8106 		},
8107 	},
8108 	[ALC269VB_FIXUP_AMIC] = {
8109 		.type = HDA_FIXUP_PINS,
8110 		.v.pins = (const struct hda_pintbl[]) {
8111 			{ 0x14, 0x99130110 }, /* speaker */
8112 			{ 0x18, 0x01a19c20 }, /* mic */
8113 			{ 0x19, 0x99a3092f }, /* int-mic */
8114 			{ 0x21, 0x0121401f }, /* HP out */
8115 			{ }
8116 		},
8117 	},
8118 	[ALC269VB_FIXUP_DMIC] = {
8119 		.type = HDA_FIXUP_PINS,
8120 		.v.pins = (const struct hda_pintbl[]) {
8121 			{ 0x12, 0x99a3092f }, /* int-mic */
8122 			{ 0x14, 0x99130110 }, /* speaker */
8123 			{ 0x18, 0x01a19c20 }, /* mic */
8124 			{ 0x21, 0x0121401f }, /* HP out */
8125 			{ }
8126 		},
8127 	},
8128 	[ALC269_FIXUP_HP_MUTE_LED] = {
8129 		.type = HDA_FIXUP_FUNC,
8130 		.v.func = alc269_fixup_hp_mute_led,
8131 	},
8132 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
8133 		.type = HDA_FIXUP_FUNC,
8134 		.v.func = alc269_fixup_hp_mute_led_mic1,
8135 	},
8136 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
8137 		.type = HDA_FIXUP_FUNC,
8138 		.v.func = alc269_fixup_hp_mute_led_mic2,
8139 	},
8140 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
8141 		.type = HDA_FIXUP_FUNC,
8142 		.v.func = alc269_fixup_hp_mute_led_mic3,
8143 		.chained = true,
8144 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
8145 	},
8146 	[ALC269_FIXUP_HP_GPIO_LED] = {
8147 		.type = HDA_FIXUP_FUNC,
8148 		.v.func = alc269_fixup_hp_gpio_led,
8149 	},
8150 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
8151 		.type = HDA_FIXUP_FUNC,
8152 		.v.func = alc269_fixup_hp_gpio_mic1_led,
8153 	},
8154 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
8155 		.type = HDA_FIXUP_FUNC,
8156 		.v.func = alc269_fixup_hp_line1_mic1_led,
8157 	},
8158 	[ALC269_FIXUP_INV_DMIC] = {
8159 		.type = HDA_FIXUP_FUNC,
8160 		.v.func = alc_fixup_inv_dmic,
8161 	},
8162 	[ALC269_FIXUP_NO_SHUTUP] = {
8163 		.type = HDA_FIXUP_FUNC,
8164 		.v.func = alc_fixup_no_shutup,
8165 	},
8166 	[ALC269_FIXUP_LENOVO_DOCK] = {
8167 		.type = HDA_FIXUP_PINS,
8168 		.v.pins = (const struct hda_pintbl[]) {
8169 			{ 0x19, 0x23a11040 }, /* dock mic */
8170 			{ 0x1b, 0x2121103f }, /* dock headphone */
8171 			{ }
8172 		},
8173 		.chained = true,
8174 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
8175 	},
8176 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
8177 		.type = HDA_FIXUP_FUNC,
8178 		.v.func = alc269_fixup_limit_int_mic_boost,
8179 		.chained = true,
8180 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
8181 	},
8182 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
8183 		.type = HDA_FIXUP_FUNC,
8184 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
8185 		.chained = true,
8186 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8187 	},
8188 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8189 		.type = HDA_FIXUP_PINS,
8190 		.v.pins = (const struct hda_pintbl[]) {
8191 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8192 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8193 			{ }
8194 		},
8195 		.chained = true,
8196 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8197 	},
8198 	[ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8199 		.type = HDA_FIXUP_FUNC,
8200 		.v.func = alc269_fixup_limit_int_mic_boost,
8201 		.chained = true,
8202 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8203 	},
8204 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8205 		.type = HDA_FIXUP_PINS,
8206 		.v.pins = (const struct hda_pintbl[]) {
8207 			{ 0x16, 0x21014020 }, /* dock line out */
8208 			{ 0x19, 0x21a19030 }, /* dock mic */
8209 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8210 			{ }
8211 		},
8212 		.chained = true,
8213 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8214 	},
8215 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
8216 		.type = HDA_FIXUP_PINS,
8217 		.v.pins = (const struct hda_pintbl[]) {
8218 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8219 			{ }
8220 		},
8221 		.chained = true,
8222 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8223 	},
8224 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
8225 		.type = HDA_FIXUP_PINS,
8226 		.v.pins = (const struct hda_pintbl[]) {
8227 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8228 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8229 			{ }
8230 		},
8231 		.chained = true,
8232 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8233 	},
8234 	[ALC269_FIXUP_HEADSET_MODE] = {
8235 		.type = HDA_FIXUP_FUNC,
8236 		.v.func = alc_fixup_headset_mode,
8237 		.chained = true,
8238 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8239 	},
8240 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8241 		.type = HDA_FIXUP_FUNC,
8242 		.v.func = alc_fixup_headset_mode_no_hp_mic,
8243 	},
8244 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
8245 		.type = HDA_FIXUP_PINS,
8246 		.v.pins = (const struct hda_pintbl[]) {
8247 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
8248 			{ }
8249 		},
8250 		.chained = true,
8251 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8252 	},
8253 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
8254 		.type = HDA_FIXUP_PINS,
8255 		.v.pins = (const struct hda_pintbl[]) {
8256 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8257 			{ }
8258 		},
8259 		.chained = true,
8260 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8261 	},
8262 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8263 		.type = HDA_FIXUP_PINS,
8264 		.v.pins = (const struct hda_pintbl[]) {
8265 			{0x12, 0x90a60130},
8266 			{0x13, 0x40000000},
8267 			{0x14, 0x90170110},
8268 			{0x18, 0x411111f0},
8269 			{0x19, 0x04a11040},
8270 			{0x1a, 0x411111f0},
8271 			{0x1b, 0x90170112},
8272 			{0x1d, 0x40759a05},
8273 			{0x1e, 0x411111f0},
8274 			{0x21, 0x04211020},
8275 			{ }
8276 		},
8277 		.chained = true,
8278 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8279 	},
8280 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
8281 		.type = HDA_FIXUP_FUNC,
8282 		.v.func = alc298_fixup_huawei_mbx_stereo,
8283 		.chained = true,
8284 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8285 	},
8286 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
8287 		.type = HDA_FIXUP_FUNC,
8288 		.v.func = alc269_fixup_x101_headset_mic,
8289 	},
8290 	[ALC269_FIXUP_ASUS_X101_VERB] = {
8291 		.type = HDA_FIXUP_VERBS,
8292 		.v.verbs = (const struct hda_verb[]) {
8293 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
8294 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8295 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
8296 			{ }
8297 		},
8298 		.chained = true,
8299 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
8300 	},
8301 	[ALC269_FIXUP_ASUS_X101] = {
8302 		.type = HDA_FIXUP_PINS,
8303 		.v.pins = (const struct hda_pintbl[]) {
8304 			{ 0x18, 0x04a1182c }, /* Headset mic */
8305 			{ }
8306 		},
8307 		.chained = true,
8308 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
8309 	},
8310 	[ALC271_FIXUP_AMIC_MIC2] = {
8311 		.type = HDA_FIXUP_PINS,
8312 		.v.pins = (const struct hda_pintbl[]) {
8313 			{ 0x14, 0x99130110 }, /* speaker */
8314 			{ 0x19, 0x01a19c20 }, /* mic */
8315 			{ 0x1b, 0x99a7012f }, /* int-mic */
8316 			{ 0x21, 0x0121401f }, /* HP out */
8317 			{ }
8318 		},
8319 	},
8320 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
8321 		.type = HDA_FIXUP_FUNC,
8322 		.v.func = alc271_hp_gate_mic_jack,
8323 		.chained = true,
8324 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
8325 	},
8326 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
8327 		.type = HDA_FIXUP_FUNC,
8328 		.v.func = alc269_fixup_limit_int_mic_boost,
8329 		.chained = true,
8330 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
8331 	},
8332 	[ALC269_FIXUP_ACER_AC700] = {
8333 		.type = HDA_FIXUP_PINS,
8334 		.v.pins = (const struct hda_pintbl[]) {
8335 			{ 0x12, 0x99a3092f }, /* int-mic */
8336 			{ 0x14, 0x99130110 }, /* speaker */
8337 			{ 0x18, 0x03a11c20 }, /* mic */
8338 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
8339 			{ 0x21, 0x0321101f }, /* HP out */
8340 			{ }
8341 		},
8342 		.chained = true,
8343 		.chain_id = ALC271_FIXUP_DMIC,
8344 	},
8345 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
8346 		.type = HDA_FIXUP_FUNC,
8347 		.v.func = alc269_fixup_limit_int_mic_boost,
8348 		.chained = true,
8349 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8350 	},
8351 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
8352 		.type = HDA_FIXUP_FUNC,
8353 		.v.func = alc269_fixup_limit_int_mic_boost,
8354 		.chained = true,
8355 		.chain_id = ALC269VB_FIXUP_DMIC,
8356 	},
8357 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
8358 		.type = HDA_FIXUP_VERBS,
8359 		.v.verbs = (const struct hda_verb[]) {
8360 			/* class-D output amp +5dB */
8361 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
8362 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
8363 			{}
8364 		},
8365 		.chained = true,
8366 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
8367 	},
8368 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8369 		.type = HDA_FIXUP_PINS,
8370 		.v.pins = (const struct hda_pintbl[]) {
8371 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
8372 			{ }
8373 		},
8374 		.chained = true,
8375 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8376 	},
8377 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
8378 		.type = HDA_FIXUP_FUNC,
8379 		.v.func = alc269_fixup_limit_int_mic_boost,
8380 		.chained = true,
8381 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
8382 	},
8383 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
8384 		.type = HDA_FIXUP_PINS,
8385 		.v.pins = (const struct hda_pintbl[]) {
8386 			{ 0x12, 0x99a3092f }, /* int-mic */
8387 			{ 0x18, 0x03a11d20 }, /* mic */
8388 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
8389 			{ }
8390 		},
8391 	},
8392 	[ALC283_FIXUP_CHROME_BOOK] = {
8393 		.type = HDA_FIXUP_FUNC,
8394 		.v.func = alc283_fixup_chromebook,
8395 	},
8396 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
8397 		.type = HDA_FIXUP_FUNC,
8398 		.v.func = alc283_fixup_sense_combo_jack,
8399 		.chained = true,
8400 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
8401 	},
8402 	[ALC282_FIXUP_ASUS_TX300] = {
8403 		.type = HDA_FIXUP_FUNC,
8404 		.v.func = alc282_fixup_asus_tx300,
8405 	},
8406 	[ALC283_FIXUP_INT_MIC] = {
8407 		.type = HDA_FIXUP_VERBS,
8408 		.v.verbs = (const struct hda_verb[]) {
8409 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
8410 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
8411 			{ }
8412 		},
8413 		.chained = true,
8414 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8415 	},
8416 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
8417 		.type = HDA_FIXUP_PINS,
8418 		.v.pins = (const struct hda_pintbl[]) {
8419 			{ 0x17, 0x90170112 }, /* subwoofer */
8420 			{ }
8421 		},
8422 		.chained = true,
8423 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
8424 	},
8425 	[ALC290_FIXUP_SUBWOOFER] = {
8426 		.type = HDA_FIXUP_PINS,
8427 		.v.pins = (const struct hda_pintbl[]) {
8428 			{ 0x17, 0x90170112 }, /* subwoofer */
8429 			{ }
8430 		},
8431 		.chained = true,
8432 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
8433 	},
8434 	[ALC290_FIXUP_MONO_SPEAKERS] = {
8435 		.type = HDA_FIXUP_FUNC,
8436 		.v.func = alc290_fixup_mono_speakers,
8437 	},
8438 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8439 		.type = HDA_FIXUP_FUNC,
8440 		.v.func = alc290_fixup_mono_speakers,
8441 		.chained = true,
8442 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8443 	},
8444 	[ALC269_FIXUP_THINKPAD_ACPI] = {
8445 		.type = HDA_FIXUP_FUNC,
8446 		.v.func = alc_fixup_thinkpad_acpi,
8447 		.chained = true,
8448 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
8449 	},
8450 	[ALC269_FIXUP_LENOVO_XPAD_ACPI] = {
8451 		.type = HDA_FIXUP_FUNC,
8452 		.v.func = alc_fixup_ideapad_acpi,
8453 		.chained = true,
8454 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8455 	},
8456 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8457 		.type = HDA_FIXUP_FUNC,
8458 		.v.func = alc_fixup_inv_dmic,
8459 		.chained = true,
8460 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8461 	},
8462 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8463 		.type = HDA_FIXUP_PINS,
8464 		.v.pins = (const struct hda_pintbl[]) {
8465 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8466 			{ }
8467 		},
8468 		.chained = true,
8469 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8470 	},
8471 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8472 		.type = HDA_FIXUP_PINS,
8473 		.v.pins = (const struct hda_pintbl[]) {
8474 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8475 			{ }
8476 		},
8477 		.chained = true,
8478 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8479 	},
8480 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8481 		.type = HDA_FIXUP_PINS,
8482 		.v.pins = (const struct hda_pintbl[]) {
8483 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8484 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8485 			{ }
8486 		},
8487 		.chained = true,
8488 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8489 	},
8490 	[ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8491 		.type = HDA_FIXUP_FUNC,
8492 		.v.func = alc269_fixup_limit_int_mic_boost,
8493 		.chained = true,
8494 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8495 	},
8496 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8497 		.type = HDA_FIXUP_PINS,
8498 		.v.pins = (const struct hda_pintbl[]) {
8499 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8500 			{ }
8501 		},
8502 		.chained = true,
8503 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8504 	},
8505 	[ALC255_FIXUP_HEADSET_MODE] = {
8506 		.type = HDA_FIXUP_FUNC,
8507 		.v.func = alc_fixup_headset_mode_alc255,
8508 		.chained = true,
8509 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8510 	},
8511 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8512 		.type = HDA_FIXUP_FUNC,
8513 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8514 	},
8515 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8516 		.type = HDA_FIXUP_PINS,
8517 		.v.pins = (const struct hda_pintbl[]) {
8518 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8519 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8520 			{ }
8521 		},
8522 		.chained = true,
8523 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8524 	},
8525 	[ALC292_FIXUP_TPT440_DOCK] = {
8526 		.type = HDA_FIXUP_FUNC,
8527 		.v.func = alc_fixup_tpt440_dock,
8528 		.chained = true,
8529 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8530 	},
8531 	[ALC292_FIXUP_TPT440] = {
8532 		.type = HDA_FIXUP_FUNC,
8533 		.v.func = alc_fixup_disable_aamix,
8534 		.chained = true,
8535 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
8536 	},
8537 	[ALC283_FIXUP_HEADSET_MIC] = {
8538 		.type = HDA_FIXUP_PINS,
8539 		.v.pins = (const struct hda_pintbl[]) {
8540 			{ 0x19, 0x04a110f0 },
8541 			{ },
8542 		},
8543 	},
8544 	[ALC255_FIXUP_MIC_MUTE_LED] = {
8545 		.type = HDA_FIXUP_FUNC,
8546 		.v.func = alc_fixup_micmute_led,
8547 	},
8548 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
8549 		.type = HDA_FIXUP_PINS,
8550 		.v.pins = (const struct hda_pintbl[]) {
8551 			{ 0x12, 0x90a60130 },
8552 			{ 0x14, 0x90170110 },
8553 			{ 0x17, 0x40000008 },
8554 			{ 0x18, 0x411111f0 },
8555 			{ 0x19, 0x01a1913c },
8556 			{ 0x1a, 0x411111f0 },
8557 			{ 0x1b, 0x411111f0 },
8558 			{ 0x1d, 0x40f89b2d },
8559 			{ 0x1e, 0x411111f0 },
8560 			{ 0x21, 0x0321101f },
8561 			{ },
8562 		},
8563 	},
8564 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8565 		.type = HDA_FIXUP_FUNC,
8566 		.v.func = alc269vb_fixup_aspire_e1_coef,
8567 	},
8568 	[ALC280_FIXUP_HP_GPIO4] = {
8569 		.type = HDA_FIXUP_FUNC,
8570 		.v.func = alc280_fixup_hp_gpio4,
8571 	},
8572 	[ALC286_FIXUP_HP_GPIO_LED] = {
8573 		.type = HDA_FIXUP_FUNC,
8574 		.v.func = alc286_fixup_hp_gpio_led,
8575 	},
8576 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8577 		.type = HDA_FIXUP_FUNC,
8578 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8579 	},
8580 	[ALC280_FIXUP_HP_DOCK_PINS] = {
8581 		.type = HDA_FIXUP_PINS,
8582 		.v.pins = (const struct hda_pintbl[]) {
8583 			{ 0x1b, 0x21011020 }, /* line-out */
8584 			{ 0x1a, 0x01a1903c }, /* headset mic */
8585 			{ 0x18, 0x2181103f }, /* line-in */
8586 			{ },
8587 		},
8588 		.chained = true,
8589 		.chain_id = ALC280_FIXUP_HP_GPIO4
8590 	},
8591 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8592 		.type = HDA_FIXUP_PINS,
8593 		.v.pins = (const struct hda_pintbl[]) {
8594 			{ 0x1b, 0x21011020 }, /* line-out */
8595 			{ 0x18, 0x2181103f }, /* line-in */
8596 			{ },
8597 		},
8598 		.chained = true,
8599 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8600 	},
8601 	[ALC280_FIXUP_HP_9480M] = {
8602 		.type = HDA_FIXUP_FUNC,
8603 		.v.func = alc280_fixup_hp_9480m,
8604 	},
8605 	[ALC245_FIXUP_HP_X360_AMP] = {
8606 		.type = HDA_FIXUP_FUNC,
8607 		.v.func = alc245_fixup_hp_x360_amp,
8608 		.chained = true,
8609 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
8610 	},
8611 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
8612 		.type = HDA_FIXUP_FUNC,
8613 		.v.func = alc_fixup_headset_mode_dell_alc288,
8614 		.chained = true,
8615 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8616 	},
8617 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8618 		.type = HDA_FIXUP_PINS,
8619 		.v.pins = (const struct hda_pintbl[]) {
8620 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8621 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8622 			{ }
8623 		},
8624 		.chained = true,
8625 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8626 	},
8627 	[ALC288_FIXUP_DISABLE_AAMIX] = {
8628 		.type = HDA_FIXUP_FUNC,
8629 		.v.func = alc_fixup_disable_aamix,
8630 		.chained = true,
8631 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8632 	},
8633 	[ALC288_FIXUP_DELL_XPS_13] = {
8634 		.type = HDA_FIXUP_FUNC,
8635 		.v.func = alc_fixup_dell_xps13,
8636 		.chained = true,
8637 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
8638 	},
8639 	[ALC292_FIXUP_DISABLE_AAMIX] = {
8640 		.type = HDA_FIXUP_FUNC,
8641 		.v.func = alc_fixup_disable_aamix,
8642 		.chained = true,
8643 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8644 	},
8645 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8646 		.type = HDA_FIXUP_FUNC,
8647 		.v.func = alc_fixup_disable_aamix,
8648 		.chained = true,
8649 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8650 	},
8651 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
8652 		.type = HDA_FIXUP_FUNC,
8653 		.v.func = alc_fixup_dell_xps13,
8654 		.chained = true,
8655 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
8656 	},
8657 	[ALC292_FIXUP_DELL_E7X] = {
8658 		.type = HDA_FIXUP_FUNC,
8659 		.v.func = alc_fixup_micmute_led,
8660 		/* micmute fixup must be applied at last */
8661 		.chained_before = true,
8662 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8663 	},
8664 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8665 		.type = HDA_FIXUP_PINS,
8666 		.v.pins = (const struct hda_pintbl[]) {
8667 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8668 			{ }
8669 		},
8670 		.chained_before = true,
8671 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8672 	},
8673 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8674 		.type = HDA_FIXUP_PINS,
8675 		.v.pins = (const struct hda_pintbl[]) {
8676 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8677 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8678 			{ }
8679 		},
8680 		.chained = true,
8681 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8682 	},
8683 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8684 		.type = HDA_FIXUP_PINS,
8685 		.v.pins = (const struct hda_pintbl[]) {
8686 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8687 			{ }
8688 		},
8689 		.chained = true,
8690 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8691 	},
8692 	[ALC275_FIXUP_DELL_XPS] = {
8693 		.type = HDA_FIXUP_VERBS,
8694 		.v.verbs = (const struct hda_verb[]) {
8695 			/* Enables internal speaker */
8696 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8697 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8698 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8699 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8700 			{}
8701 		}
8702 	},
8703 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8704 		.type = HDA_FIXUP_FUNC,
8705 		.v.func = alc_fixup_disable_aamix,
8706 		.chained = true,
8707 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8708 	},
8709 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8710 		.type = HDA_FIXUP_FUNC,
8711 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8712 	},
8713 	[ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED] = {
8714 		.type = HDA_FIXUP_FUNC,
8715 		.v.func = alc233_fixup_lenovo_low_en_micmute_led,
8716 	},
8717 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8718 		.type = HDA_FIXUP_FUNC,
8719 		.v.func = alc_fixup_inv_dmic,
8720 		.chained = true,
8721 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8722 	},
8723 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8724 		.type = HDA_FIXUP_FUNC,
8725 		.v.func = alc269_fixup_limit_int_mic_boost
8726 	},
8727 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
8728 		.type = HDA_FIXUP_FUNC,
8729 		.v.func = alc_fixup_disable_aamix,
8730 		.chained = true,
8731 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8732 	},
8733 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
8734 		.type = HDA_FIXUP_FUNC,
8735 		.v.func = alc_fixup_disable_mic_vref,
8736 		.chained = true,
8737 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8738 	},
8739 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8740 		.type = HDA_FIXUP_VERBS,
8741 		.v.verbs = (const struct hda_verb[]) {
8742 			/* Disable pass-through path for FRONT 14h */
8743 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8744 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8745 			{}
8746 		},
8747 		.chained = true,
8748 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8749 	},
8750 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
8751 		.type = HDA_FIXUP_FUNC,
8752 		.v.func = alc_fixup_disable_aamix,
8753 		.chained = true,
8754 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
8755 	},
8756 	[ALC221_FIXUP_HP_FRONT_MIC] = {
8757 		.type = HDA_FIXUP_PINS,
8758 		.v.pins = (const struct hda_pintbl[]) {
8759 			{ 0x19, 0x02a19020 }, /* Front Mic */
8760 			{ }
8761 		},
8762 	},
8763 	[ALC292_FIXUP_TPT460] = {
8764 		.type = HDA_FIXUP_FUNC,
8765 		.v.func = alc_fixup_tpt440_dock,
8766 		.chained = true,
8767 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8768 	},
8769 	[ALC298_FIXUP_SPK_VOLUME] = {
8770 		.type = HDA_FIXUP_FUNC,
8771 		.v.func = alc298_fixup_speaker_volume,
8772 		.chained = true,
8773 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8774 	},
8775 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8776 		.type = HDA_FIXUP_FUNC,
8777 		.v.func = alc298_fixup_speaker_volume,
8778 	},
8779 	[ALC295_FIXUP_DISABLE_DAC3] = {
8780 		.type = HDA_FIXUP_FUNC,
8781 		.v.func = alc295_fixup_disable_dac3,
8782 	},
8783 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8784 		.type = HDA_FIXUP_FUNC,
8785 		.v.func = alc285_fixup_speaker2_to_dac1,
8786 		.chained = true,
8787 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8788 	},
8789 	[ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8790 		.type = HDA_FIXUP_FUNC,
8791 		.v.func = alc285_fixup_speaker2_to_dac1,
8792 		.chained = true,
8793 		.chain_id = ALC245_FIXUP_CS35L41_SPI_2
8794 	},
8795 	[ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8796 		.type = HDA_FIXUP_PINS,
8797 		.v.pins = (const struct hda_pintbl[]) {
8798 			{ 0x19, 0x03a11050 },
8799 			{ 0x1b, 0x03a11c30 },
8800 			{ }
8801 		},
8802 		.chained = true,
8803 		.chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8804 	},
8805 	[ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8806 		.type = HDA_FIXUP_PINS,
8807 		.v.pins = (const struct hda_pintbl[]) {
8808 			{ 0x14, 0x90170120 },
8809 			{ }
8810 		},
8811 		.chained = true,
8812 		.chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8813 	},
8814 	[ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8815 		.type = HDA_FIXUP_FUNC,
8816 		.v.func = alc285_fixup_speaker2_to_dac1,
8817 		.chained = true,
8818 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2
8819 	},
8820 	[ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8821 		.type = HDA_FIXUP_PINS,
8822 		.v.pins = (const struct hda_pintbl[]) {
8823 			{ 0x19, 0x03a11050 },
8824 			{ 0x1b, 0x03a11c30 },
8825 			{ }
8826 		},
8827 		.chained = true,
8828 		.chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8829 	},
8830 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8831 		.type = HDA_FIXUP_PINS,
8832 		.v.pins = (const struct hda_pintbl[]) {
8833 			{ 0x1b, 0x90170151 },
8834 			{ }
8835 		},
8836 		.chained = true,
8837 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8838 	},
8839 	[ALC269_FIXUP_ATIV_BOOK_8] = {
8840 		.type = HDA_FIXUP_FUNC,
8841 		.v.func = alc_fixup_auto_mute_via_amp,
8842 		.chained = true,
8843 		.chain_id = ALC269_FIXUP_NO_SHUTUP
8844 	},
8845 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8846 		.type = HDA_FIXUP_PINS,
8847 		.v.pins = (const struct hda_pintbl[]) {
8848 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8849 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8850 			{ }
8851 		},
8852 		.chained = true,
8853 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8854 	},
8855 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8856 		.type = HDA_FIXUP_PINS,
8857 		.v.pins = (const struct hda_pintbl[]) {
8858 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8859 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8860 			{ }
8861 		},
8862 		.chained = true,
8863 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8864 	},
8865 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8866 		.type = HDA_FIXUP_FUNC,
8867 		.v.func = alc_fixup_headset_mode,
8868 	},
8869 	[ALC256_FIXUP_ASUS_MIC] = {
8870 		.type = HDA_FIXUP_PINS,
8871 		.v.pins = (const struct hda_pintbl[]) {
8872 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8873 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8874 			{ }
8875 		},
8876 		.chained = true,
8877 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8878 	},
8879 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8880 		.type = HDA_FIXUP_FUNC,
8881 		/* Set up GPIO2 for the speaker amp */
8882 		.v.func = alc_fixup_gpio4,
8883 	},
8884 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8885 		.type = HDA_FIXUP_PINS,
8886 		.v.pins = (const struct hda_pintbl[]) {
8887 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8888 			{ }
8889 		},
8890 		.chained = true,
8891 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8892 	},
8893 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8894 		.type = HDA_FIXUP_VERBS,
8895 		.v.verbs = (const struct hda_verb[]) {
8896 			/* Enables internal speaker */
8897 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8898 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8899 			{}
8900 		},
8901 		.chained = true,
8902 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8903 	},
8904 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8905 		.type = HDA_FIXUP_FUNC,
8906 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8907 		.chained = true,
8908 		.chain_id = ALC269_FIXUP_GPIO2
8909 	},
8910 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
8911 		.type = HDA_FIXUP_VERBS,
8912 		.v.verbs = (const struct hda_verb[]) {
8913 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8914 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8915 			{ }
8916 		},
8917 		.chained = true,
8918 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8919 	},
8920 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8921 		.type = HDA_FIXUP_PINS,
8922 		.v.pins = (const struct hda_pintbl[]) {
8923 			/* Change the mic location from front to right, otherwise there are
8924 			   two front mics with the same name, pulseaudio can't handle them.
8925 			   This is just a temporary workaround, after applying this fixup,
8926 			   there will be one "Front Mic" and one "Mic" in this machine.
8927 			 */
8928 			{ 0x1a, 0x04a19040 },
8929 			{ }
8930 		},
8931 	},
8932 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8933 		.type = HDA_FIXUP_PINS,
8934 		.v.pins = (const struct hda_pintbl[]) {
8935 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
8936 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8937 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8938 			{ 0x1b, 0x02011020 },
8939 			{ }
8940 		},
8941 		.chained = true,
8942 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
8943 	},
8944 	[ALC225_FIXUP_S3_POP_NOISE] = {
8945 		.type = HDA_FIXUP_FUNC,
8946 		.v.func = alc225_fixup_s3_pop_noise,
8947 		.chained = true,
8948 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8949 	},
8950 	[ALC700_FIXUP_INTEL_REFERENCE] = {
8951 		.type = HDA_FIXUP_VERBS,
8952 		.v.verbs = (const struct hda_verb[]) {
8953 			/* Enables internal speaker */
8954 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8955 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8956 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8957 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8958 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8959 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8960 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8961 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8962 			{}
8963 		}
8964 	},
8965 	[ALC274_FIXUP_DELL_BIND_DACS] = {
8966 		.type = HDA_FIXUP_FUNC,
8967 		.v.func = alc274_fixup_bind_dacs,
8968 		.chained = true,
8969 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8970 	},
8971 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8972 		.type = HDA_FIXUP_PINS,
8973 		.v.pins = (const struct hda_pintbl[]) {
8974 			{ 0x1b, 0x0401102f },
8975 			{ }
8976 		},
8977 		.chained = true,
8978 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
8979 	},
8980 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
8981 		.type = HDA_FIXUP_FUNC,
8982 		.v.func = alc_fixup_tpt470_dock,
8983 		.chained = true,
8984 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8985 	},
8986 	[ALC298_FIXUP_TPT470_DOCK] = {
8987 		.type = HDA_FIXUP_FUNC,
8988 		.v.func = alc_fixup_tpt470_dacs,
8989 		.chained = true,
8990 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8991 	},
8992 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8993 		.type = HDA_FIXUP_PINS,
8994 		.v.pins = (const struct hda_pintbl[]) {
8995 			{ 0x14, 0x0201101f },
8996 			{ }
8997 		},
8998 		.chained = true,
8999 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9000 	},
9001 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
9002 		.type = HDA_FIXUP_PINS,
9003 		.v.pins = (const struct hda_pintbl[]) {
9004 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9005 			{ }
9006 		},
9007 		.chained = true,
9008 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9009 	},
9010 	[ALC295_FIXUP_HP_X360] = {
9011 		.type = HDA_FIXUP_FUNC,
9012 		.v.func = alc295_fixup_hp_top_speakers,
9013 		.chained = true,
9014 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
9015 	},
9016 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
9017 		.type = HDA_FIXUP_PINS,
9018 		.v.pins = (const struct hda_pintbl[]) {
9019 			{ 0x19, 0x0181313f},
9020 			{ }
9021 		},
9022 		.chained = true,
9023 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9024 	},
9025 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
9026 		.type = HDA_FIXUP_FUNC,
9027 		.v.func = alc285_fixup_invalidate_dacs,
9028 		.chained = true,
9029 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9030 	},
9031 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
9032 		.type = HDA_FIXUP_FUNC,
9033 		.v.func = alc_fixup_auto_mute_via_amp,
9034 	},
9035 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
9036 		.type = HDA_FIXUP_PINS,
9037 		.v.pins = (const struct hda_pintbl[]) {
9038 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9039 			{ }
9040 		},
9041 		.chained = true,
9042 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9043 	},
9044 	[ALC294_FIXUP_ASUS_MIC] = {
9045 		.type = HDA_FIXUP_PINS,
9046 		.v.pins = (const struct hda_pintbl[]) {
9047 			{ 0x13, 0x90a60160 }, /* use as internal mic */
9048 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
9049 			{ }
9050 		},
9051 		.chained = true,
9052 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9053 	},
9054 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
9055 		.type = HDA_FIXUP_PINS,
9056 		.v.pins = (const struct hda_pintbl[]) {
9057 			{ 0x19, 0x01a1103c }, /* use as headset mic */
9058 			{ }
9059 		},
9060 		.chained = true,
9061 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9062 	},
9063 	[ALC294_FIXUP_ASUS_SPK] = {
9064 		.type = HDA_FIXUP_VERBS,
9065 		.v.verbs = (const struct hda_verb[]) {
9066 			/* Set EAPD high */
9067 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
9068 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
9069 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9070 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
9071 			{ }
9072 		},
9073 		.chained = true,
9074 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9075 	},
9076 	[ALC295_FIXUP_CHROME_BOOK] = {
9077 		.type = HDA_FIXUP_FUNC,
9078 		.v.func = alc295_fixup_chromebook,
9079 		.chained = true,
9080 		.chain_id = ALC225_FIXUP_HEADSET_JACK
9081 	},
9082 	[ALC225_FIXUP_HEADSET_JACK] = {
9083 		.type = HDA_FIXUP_FUNC,
9084 		.v.func = alc_fixup_headset_jack,
9085 	},
9086 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9087 		.type = HDA_FIXUP_PINS,
9088 		.v.pins = (const struct hda_pintbl[]) {
9089 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9090 			{ }
9091 		},
9092 		.chained = true,
9093 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9094 	},
9095 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
9096 		.type = HDA_FIXUP_VERBS,
9097 		.v.verbs = (const struct hda_verb[]) {
9098 			/* Disable PCBEEP-IN passthrough */
9099 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
9100 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
9101 			{ }
9102 		},
9103 		.chained = true,
9104 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
9105 	},
9106 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
9107 		.type = HDA_FIXUP_PINS,
9108 		.v.pins = (const struct hda_pintbl[]) {
9109 			{ 0x19, 0x03a11130 },
9110 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
9111 			{ }
9112 		},
9113 		.chained = true,
9114 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
9115 	},
9116 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
9117 		.type = HDA_FIXUP_PINS,
9118 		.v.pins = (const struct hda_pintbl[]) {
9119 			{ 0x16, 0x01011020 }, /* Rear Line out */
9120 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
9121 			{ }
9122 		},
9123 		.chained = true,
9124 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
9125 	},
9126 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
9127 		.type = HDA_FIXUP_FUNC,
9128 		.v.func = alc_fixup_auto_mute_via_amp,
9129 		.chained = true,
9130 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
9131 	},
9132 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
9133 		.type = HDA_FIXUP_FUNC,
9134 		.v.func = alc_fixup_disable_mic_vref,
9135 		.chained = true,
9136 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9137 	},
9138 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
9139 		.type = HDA_FIXUP_VERBS,
9140 		.v.verbs = (const struct hda_verb[]) {
9141 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
9142 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
9143 			{ }
9144 		},
9145 		.chained = true,
9146 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
9147 	},
9148 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
9149 		.type = HDA_FIXUP_PINS,
9150 		.v.pins = (const struct hda_pintbl[]) {
9151 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9152 			{ }
9153 		},
9154 		.chained = true,
9155 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9156 	},
9157 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9158 		.type = HDA_FIXUP_PINS,
9159 		.v.pins = (const struct hda_pintbl[]) {
9160 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
9161 			{ }
9162 		},
9163 		.chained = true,
9164 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9165 	},
9166 	[ALC255_FIXUP_PREDATOR_SUBWOOFER] = {
9167 		.type = HDA_FIXUP_PINS,
9168 		.v.pins = (const struct hda_pintbl[]) {
9169 			{ 0x17, 0x90170151 }, /* use as internal speaker (LFE) */
9170 			{ 0x1b, 0x90170152 } /* use as internal speaker (back) */
9171 		}
9172 	},
9173 	[ALC299_FIXUP_PREDATOR_SPK] = {
9174 		.type = HDA_FIXUP_PINS,
9175 		.v.pins = (const struct hda_pintbl[]) {
9176 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
9177 			{ }
9178 		}
9179 	},
9180 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
9181 		.type = HDA_FIXUP_PINS,
9182 		.v.pins = (const struct hda_pintbl[]) {
9183 			{ 0x19, 0x04a11040 },
9184 			{ 0x21, 0x04211020 },
9185 			{ }
9186 		},
9187 		.chained = true,
9188 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9189 	},
9190 	[ALC289_FIXUP_DELL_SPK1] = {
9191 		.type = HDA_FIXUP_PINS,
9192 		.v.pins = (const struct hda_pintbl[]) {
9193 			{ 0x14, 0x90170140 },
9194 			{ }
9195 		},
9196 		.chained = true,
9197 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
9198 	},
9199 	[ALC289_FIXUP_DELL_SPK2] = {
9200 		.type = HDA_FIXUP_PINS,
9201 		.v.pins = (const struct hda_pintbl[]) {
9202 			{ 0x17, 0x90170130 }, /* bass spk */
9203 			{ }
9204 		},
9205 		.chained = true,
9206 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
9207 	},
9208 	[ALC289_FIXUP_DUAL_SPK] = {
9209 		.type = HDA_FIXUP_FUNC,
9210 		.v.func = alc285_fixup_speaker2_to_dac1,
9211 		.chained = true,
9212 		.chain_id = ALC289_FIXUP_DELL_SPK2
9213 	},
9214 	[ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
9215 		.type = HDA_FIXUP_FUNC,
9216 		.v.func = alc285_fixup_speaker2_to_dac1,
9217 		.chained = true,
9218 		.chain_id = ALC289_FIXUP_DELL_SPK1
9219 	},
9220 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
9221 		.type = HDA_FIXUP_FUNC,
9222 		.v.func = alc285_fixup_speaker2_to_dac1,
9223 		.chained = true,
9224 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9225 	},
9226 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
9227 		.type = HDA_FIXUP_FUNC,
9228 		/* The GPIO must be pulled to initialize the AMP */
9229 		.v.func = alc_fixup_gpio4,
9230 		.chained = true,
9231 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
9232 	},
9233 	[ALC294_FIXUP_ASUS_ALLY] = {
9234 		.type = HDA_FIXUP_FUNC,
9235 		.v.func = cs35l41_fixup_i2c_two,
9236 		.chained = true,
9237 		.chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
9238 	},
9239 	[ALC294_FIXUP_ASUS_ALLY_PINS] = {
9240 		.type = HDA_FIXUP_PINS,
9241 		.v.pins = (const struct hda_pintbl[]) {
9242 			{ 0x19, 0x03a11050 },
9243 			{ 0x1a, 0x03a11c30 },
9244 			{ 0x21, 0x03211420 },
9245 			{ }
9246 		},
9247 		.chained = true,
9248 		.chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
9249 	},
9250 	[ALC294_FIXUP_ASUS_ALLY_VERBS] = {
9251 		.type = HDA_FIXUP_VERBS,
9252 		.v.verbs = (const struct hda_verb[]) {
9253 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9254 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9255 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
9256 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
9257 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
9258 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
9259 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
9260 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
9261 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
9262 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
9263 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
9264 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
9265 			{ }
9266 		},
9267 		.chained = true,
9268 		.chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
9269 	},
9270 	[ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
9271 		.type = HDA_FIXUP_FUNC,
9272 		.v.func = alc285_fixup_speaker2_to_dac1,
9273 	},
9274 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
9275 		.type = HDA_FIXUP_FUNC,
9276 		.v.func = alc285_fixup_thinkpad_x1_gen7,
9277 		.chained = true,
9278 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9279 	},
9280 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
9281 		.type = HDA_FIXUP_FUNC,
9282 		.v.func = alc_fixup_headset_jack,
9283 		.chained = true,
9284 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
9285 	},
9286 	[ALC294_FIXUP_ASUS_HPE] = {
9287 		.type = HDA_FIXUP_VERBS,
9288 		.v.verbs = (const struct hda_verb[]) {
9289 			/* Set EAPD high */
9290 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9291 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
9292 			{ }
9293 		},
9294 		.chained = true,
9295 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9296 	},
9297 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
9298 		.type = HDA_FIXUP_PINS,
9299 		.v.pins = (const struct hda_pintbl[]) {
9300 			{ 0x19, 0x03a11050 }, /* front HP mic */
9301 			{ 0x1a, 0x01a11830 }, /* rear external mic */
9302 			{ 0x21, 0x03211020 }, /* front HP out */
9303 			{ }
9304 		},
9305 		.chained = true,
9306 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
9307 	},
9308 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
9309 		.type = HDA_FIXUP_VERBS,
9310 		.v.verbs = (const struct hda_verb[]) {
9311 			/* set 0x15 to HP-OUT ctrl */
9312 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9313 			/* unmute the 0x15 amp */
9314 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
9315 			{ }
9316 		},
9317 		.chained = true,
9318 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
9319 	},
9320 	[ALC294_FIXUP_ASUS_GX502_HP] = {
9321 		.type = HDA_FIXUP_FUNC,
9322 		.v.func = alc294_fixup_gx502_hp,
9323 	},
9324 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
9325 		.type = HDA_FIXUP_PINS,
9326 		.v.pins = (const struct hda_pintbl[]) {
9327 			{ 0x19, 0x01a11050 }, /* rear HP mic */
9328 			{ 0x1a, 0x01a11830 }, /* rear external mic */
9329 			{ 0x21, 0x012110f0 }, /* rear HP out */
9330 			{ }
9331 		},
9332 		.chained = true,
9333 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
9334 	},
9335 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
9336 		.type = HDA_FIXUP_VERBS,
9337 		.v.verbs = (const struct hda_verb[]) {
9338 			/* set 0x15 to HP-OUT ctrl */
9339 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9340 			/* unmute the 0x15 amp */
9341 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
9342 			/* set 0x1b to HP-OUT */
9343 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9344 			{ }
9345 		},
9346 		.chained = true,
9347 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
9348 	},
9349 	[ALC294_FIXUP_ASUS_GU502_HP] = {
9350 		.type = HDA_FIXUP_FUNC,
9351 		.v.func = alc294_fixup_gu502_hp,
9352 	},
9353 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
9354 		.type = HDA_FIXUP_PINS,
9355 		.v.pins = (const struct hda_pintbl[]) {
9356 				{ 0x19, 0x03a11050 }, /* front HP mic */
9357 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
9358 				{ 0x21, 0x03211420 }, /* front HP out */
9359 				{ }
9360 		},
9361 	},
9362 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
9363 		.type = HDA_FIXUP_PINS,
9364 		.v.pins = (const struct hda_pintbl[]) {
9365 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
9366 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
9367 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
9368 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
9369 			{ 0x21, 0x03211420 },
9370 			{ }
9371 		},
9372 	},
9373 	[ALC294_FIXUP_ASUS_COEF_1B] = {
9374 		.type = HDA_FIXUP_VERBS,
9375 		.v.verbs = (const struct hda_verb[]) {
9376 			/* Set bit 10 to correct noisy output after reboot from
9377 			 * Windows 10 (due to pop noise reduction?)
9378 			 */
9379 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
9380 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
9381 			{ }
9382 		},
9383 		.chained = true,
9384 		.chain_id = ALC289_FIXUP_ASUS_GA401,
9385 	},
9386 	[ALC285_FIXUP_HP_GPIO_LED] = {
9387 		.type = HDA_FIXUP_FUNC,
9388 		.v.func = alc285_fixup_hp_gpio_led,
9389 	},
9390 	[ALC285_FIXUP_HP_MUTE_LED] = {
9391 		.type = HDA_FIXUP_FUNC,
9392 		.v.func = alc285_fixup_hp_mute_led,
9393 	},
9394 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
9395 		.type = HDA_FIXUP_FUNC,
9396 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
9397 	},
9398 	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
9399 	    .type = HDA_FIXUP_FUNC,
9400 	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
9401 	},
9402 	[ALC236_FIXUP_HP_GPIO_LED] = {
9403 		.type = HDA_FIXUP_FUNC,
9404 		.v.func = alc236_fixup_hp_gpio_led,
9405 	},
9406 	[ALC236_FIXUP_HP_MUTE_LED] = {
9407 		.type = HDA_FIXUP_FUNC,
9408 		.v.func = alc236_fixup_hp_mute_led,
9409 	},
9410 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
9411 		.type = HDA_FIXUP_FUNC,
9412 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
9413 	},
9414 	[ALC236_FIXUP_LENOVO_INV_DMIC] = {
9415 		.type = HDA_FIXUP_FUNC,
9416 		.v.func = alc_fixup_inv_dmic,
9417 		.chained = true,
9418 		.chain_id = ALC283_FIXUP_INT_MIC,
9419 	},
9420 	[ALC295_FIXUP_HP_MUTE_LED_COEFBIT11] = {
9421 		.type = HDA_FIXUP_FUNC,
9422 		.v.func = alc295_fixup_hp_mute_led_coefbit11,
9423 	},
9424 	[ALC298_FIXUP_SAMSUNG_AMP] = {
9425 		.type = HDA_FIXUP_FUNC,
9426 		.v.func = alc298_fixup_samsung_amp,
9427 		.chained = true,
9428 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
9429 	},
9430 	[ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS] = {
9431 		.type = HDA_FIXUP_FUNC,
9432 		.v.func = alc298_fixup_samsung_amp_v2_2_amps
9433 	},
9434 	[ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS] = {
9435 		.type = HDA_FIXUP_FUNC,
9436 		.v.func = alc298_fixup_samsung_amp_v2_4_amps
9437 	},
9438 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9439 		.type = HDA_FIXUP_VERBS,
9440 		.v.verbs = (const struct hda_verb[]) {
9441 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
9442 			{ }
9443 		},
9444 	},
9445 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9446 		.type = HDA_FIXUP_VERBS,
9447 		.v.verbs = (const struct hda_verb[]) {
9448 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
9449 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
9450 			{ }
9451 		},
9452 	},
9453 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9454 		.type = HDA_FIXUP_PINS,
9455 		.v.pins = (const struct hda_pintbl[]) {
9456 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9457 			{ }
9458 		},
9459 		.chained = true,
9460 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9461 	},
9462 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
9463 		.type = HDA_FIXUP_PINS,
9464 		.v.pins = (const struct hda_pintbl[]) {
9465 			{ 0x14, 0x90100120 }, /* use as internal speaker */
9466 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
9467 			{ 0x1a, 0x01011020 }, /* use as line out */
9468 			{ },
9469 		},
9470 		.chained = true,
9471 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9472 	},
9473 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9474 		.type = HDA_FIXUP_PINS,
9475 		.v.pins = (const struct hda_pintbl[]) {
9476 			{ 0x18, 0x02a11030 }, /* use as headset mic */
9477 			{ }
9478 		},
9479 		.chained = true,
9480 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9481 	},
9482 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9483 		.type = HDA_FIXUP_PINS,
9484 		.v.pins = (const struct hda_pintbl[]) {
9485 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9486 			{ }
9487 		},
9488 		.chained = true,
9489 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9490 	},
9491 	[ALC289_FIXUP_ASUS_GA401] = {
9492 		.type = HDA_FIXUP_FUNC,
9493 		.v.func = alc289_fixup_asus_ga401,
9494 		.chained = true,
9495 		.chain_id = ALC289_FIXUP_ASUS_GA502,
9496 	},
9497 	[ALC289_FIXUP_ASUS_GA502] = {
9498 		.type = HDA_FIXUP_PINS,
9499 		.v.pins = (const struct hda_pintbl[]) {
9500 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9501 			{ }
9502 		},
9503 	},
9504 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9505 		.type = HDA_FIXUP_PINS,
9506 		.v.pins = (const struct hda_pintbl[]) {
9507 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9508 			{ }
9509 		},
9510 		.chained = true,
9511 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9512 	},
9513 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9514 		.type = HDA_FIXUP_FUNC,
9515 		.v.func = alc285_fixup_hp_gpio_amp_init,
9516 		.chained = true,
9517 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
9518 	},
9519 	[ALC269_FIXUP_CZC_B20] = {
9520 		.type = HDA_FIXUP_PINS,
9521 		.v.pins = (const struct hda_pintbl[]) {
9522 			{ 0x12, 0x411111f0 },
9523 			{ 0x14, 0x90170110 }, /* speaker */
9524 			{ 0x15, 0x032f1020 }, /* HP out */
9525 			{ 0x17, 0x411111f0 },
9526 			{ 0x18, 0x03ab1040 }, /* mic */
9527 			{ 0x19, 0xb7a7013f },
9528 			{ 0x1a, 0x0181305f },
9529 			{ 0x1b, 0x411111f0 },
9530 			{ 0x1d, 0x411111f0 },
9531 			{ 0x1e, 0x411111f0 },
9532 			{ }
9533 		},
9534 		.chain_id = ALC269_FIXUP_DMIC,
9535 	},
9536 	[ALC269_FIXUP_CZC_TMI] = {
9537 		.type = HDA_FIXUP_PINS,
9538 		.v.pins = (const struct hda_pintbl[]) {
9539 			{ 0x12, 0x4000c000 },
9540 			{ 0x14, 0x90170110 }, /* speaker */
9541 			{ 0x15, 0x0421401f }, /* HP out */
9542 			{ 0x17, 0x411111f0 },
9543 			{ 0x18, 0x04a19020 }, /* mic */
9544 			{ 0x19, 0x411111f0 },
9545 			{ 0x1a, 0x411111f0 },
9546 			{ 0x1b, 0x411111f0 },
9547 			{ 0x1d, 0x40448505 },
9548 			{ 0x1e, 0x411111f0 },
9549 			{ 0x20, 0x8000ffff },
9550 			{ }
9551 		},
9552 		.chain_id = ALC269_FIXUP_DMIC,
9553 	},
9554 	[ALC269_FIXUP_CZC_L101] = {
9555 		.type = HDA_FIXUP_PINS,
9556 		.v.pins = (const struct hda_pintbl[]) {
9557 			{ 0x12, 0x40000000 },
9558 			{ 0x14, 0x01014010 }, /* speaker */
9559 			{ 0x15, 0x411111f0 }, /* HP out */
9560 			{ 0x16, 0x411111f0 },
9561 			{ 0x18, 0x01a19020 }, /* mic */
9562 			{ 0x19, 0x02a19021 },
9563 			{ 0x1a, 0x0181302f },
9564 			{ 0x1b, 0x0221401f },
9565 			{ 0x1c, 0x411111f0 },
9566 			{ 0x1d, 0x4044c601 },
9567 			{ 0x1e, 0x411111f0 },
9568 			{ }
9569 		},
9570 		.chain_id = ALC269_FIXUP_DMIC,
9571 	},
9572 	[ALC269_FIXUP_LEMOTE_A1802] = {
9573 		.type = HDA_FIXUP_PINS,
9574 		.v.pins = (const struct hda_pintbl[]) {
9575 			{ 0x12, 0x40000000 },
9576 			{ 0x14, 0x90170110 }, /* speaker */
9577 			{ 0x17, 0x411111f0 },
9578 			{ 0x18, 0x03a19040 }, /* mic1 */
9579 			{ 0x19, 0x90a70130 }, /* mic2 */
9580 			{ 0x1a, 0x411111f0 },
9581 			{ 0x1b, 0x411111f0 },
9582 			{ 0x1d, 0x40489d2d },
9583 			{ 0x1e, 0x411111f0 },
9584 			{ 0x20, 0x0003ffff },
9585 			{ 0x21, 0x03214020 },
9586 			{ }
9587 		},
9588 		.chain_id = ALC269_FIXUP_DMIC,
9589 	},
9590 	[ALC269_FIXUP_LEMOTE_A190X] = {
9591 		.type = HDA_FIXUP_PINS,
9592 		.v.pins = (const struct hda_pintbl[]) {
9593 			{ 0x14, 0x99130110 }, /* speaker */
9594 			{ 0x15, 0x0121401f }, /* HP out */
9595 			{ 0x18, 0x01a19c20 }, /* rear  mic */
9596 			{ 0x19, 0x99a3092f }, /* front mic */
9597 			{ 0x1b, 0x0201401f }, /* front lineout */
9598 			{ }
9599 		},
9600 		.chain_id = ALC269_FIXUP_DMIC,
9601 	},
9602 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9603 		.type = HDA_FIXUP_PINS,
9604 		.v.pins = (const struct hda_pintbl[]) {
9605 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9606 			{ }
9607 		},
9608 		.chained = true,
9609 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9610 	},
9611 	[ALC256_FIXUP_INTEL_NUC10] = {
9612 		.type = HDA_FIXUP_PINS,
9613 		.v.pins = (const struct hda_pintbl[]) {
9614 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9615 			{ }
9616 		},
9617 		.chained = true,
9618 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9619 	},
9620 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9621 		.type = HDA_FIXUP_VERBS,
9622 		.v.verbs = (const struct hda_verb[]) {
9623 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9624 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9625 			{ }
9626 		},
9627 		.chained = true,
9628 		.chain_id = ALC289_FIXUP_ASUS_GA502
9629 	},
9630 	[ALC274_FIXUP_HP_MIC] = {
9631 		.type = HDA_FIXUP_VERBS,
9632 		.v.verbs = (const struct hda_verb[]) {
9633 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9634 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9635 			{ }
9636 		},
9637 	},
9638 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
9639 		.type = HDA_FIXUP_FUNC,
9640 		.v.func = alc274_fixup_hp_headset_mic,
9641 		.chained = true,
9642 		.chain_id = ALC274_FIXUP_HP_MIC
9643 	},
9644 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
9645 		.type = HDA_FIXUP_FUNC,
9646 		.v.func = alc274_fixup_hp_envy_gpio,
9647 	},
9648 	[ALC274_FIXUP_ASUS_ZEN_AIO_27] = {
9649 		.type = HDA_FIXUP_VERBS,
9650 		.v.verbs = (const struct hda_verb[]) {
9651 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x10 },
9652 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc420 },
9653 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
9654 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
9655 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
9656 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0249 },
9657 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
9658 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x202b },
9659 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x62 },
9660 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa007 },
9661 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
9662 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5060 },
9663 			{}
9664 		},
9665 		.chained = true,
9666 		.chain_id = ALC2XX_FIXUP_HEADSET_MIC,
9667 	},
9668 	[ALC256_FIXUP_ASUS_HPE] = {
9669 		.type = HDA_FIXUP_VERBS,
9670 		.v.verbs = (const struct hda_verb[]) {
9671 			/* Set EAPD high */
9672 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9673 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9674 			{ }
9675 		},
9676 		.chained = true,
9677 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9678 	},
9679 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9680 		.type = HDA_FIXUP_FUNC,
9681 		.v.func = alc_fixup_headset_jack,
9682 		.chained = true,
9683 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9684 	},
9685 	[ALC287_FIXUP_HP_GPIO_LED] = {
9686 		.type = HDA_FIXUP_FUNC,
9687 		.v.func = alc287_fixup_hp_gpio_led,
9688 	},
9689 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
9690 		.type = HDA_FIXUP_FUNC,
9691 		.v.func = alc274_fixup_hp_headset_mic,
9692 	},
9693 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9694 		.type = HDA_FIXUP_FUNC,
9695 		.v.func = alc_fixup_no_int_mic,
9696 		.chained = true,
9697 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9698 	},
9699 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9700 		.type = HDA_FIXUP_PINS,
9701 		.v.pins = (const struct hda_pintbl[]) {
9702 			{ 0x1b, 0x411111f0 },
9703 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9704 			{ },
9705 		},
9706 		.chained = true,
9707 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9708 	},
9709 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9710 		.type = HDA_FIXUP_FUNC,
9711 		.v.func = alc269_fixup_limit_int_mic_boost,
9712 		.chained = true,
9713 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9714 	},
9715 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
9716 		.type = HDA_FIXUP_PINS,
9717 		.v.pins = (const struct hda_pintbl[]) {
9718 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9719 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
9720 			{ }
9721 		},
9722 		.chained = true,
9723 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9724 	},
9725 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9726 		.type = HDA_FIXUP_FUNC,
9727 		.v.func = alc285_fixup_ideapad_s740_coef,
9728 		.chained = true,
9729 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9730 	},
9731 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9732 		.type = HDA_FIXUP_FUNC,
9733 		.v.func = alc269_fixup_limit_int_mic_boost,
9734 		.chained = true,
9735 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9736 	},
9737 	[ALC295_FIXUP_ASUS_DACS] = {
9738 		.type = HDA_FIXUP_FUNC,
9739 		.v.func = alc295_fixup_asus_dacs,
9740 	},
9741 	[ALC295_FIXUP_HP_OMEN] = {
9742 		.type = HDA_FIXUP_PINS,
9743 		.v.pins = (const struct hda_pintbl[]) {
9744 			{ 0x12, 0xb7a60130 },
9745 			{ 0x13, 0x40000000 },
9746 			{ 0x14, 0x411111f0 },
9747 			{ 0x16, 0x411111f0 },
9748 			{ 0x17, 0x90170110 },
9749 			{ 0x18, 0x411111f0 },
9750 			{ 0x19, 0x02a11030 },
9751 			{ 0x1a, 0x411111f0 },
9752 			{ 0x1b, 0x04a19030 },
9753 			{ 0x1d, 0x40600001 },
9754 			{ 0x1e, 0x411111f0 },
9755 			{ 0x21, 0x03211020 },
9756 			{}
9757 		},
9758 		.chained = true,
9759 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9760 	},
9761 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
9762 		.type = HDA_FIXUP_FUNC,
9763 		.v.func = alc285_fixup_hp_spectre_x360,
9764 	},
9765 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9766 		.type = HDA_FIXUP_FUNC,
9767 		.v.func = alc285_fixup_hp_spectre_x360_eb1
9768 	},
9769 	[ALC285_FIXUP_HP_ENVY_X360] = {
9770 		.type = HDA_FIXUP_FUNC,
9771 		.v.func = alc285_fixup_hp_envy_x360,
9772 		.chained = true,
9773 		.chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9774 	},
9775 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9776 		.type = HDA_FIXUP_FUNC,
9777 		.v.func = alc285_fixup_ideapad_s740_coef,
9778 		.chained = true,
9779 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9780 	},
9781 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9782 		.type = HDA_FIXUP_FUNC,
9783 		.v.func = alc_fixup_no_shutup,
9784 		.chained = true,
9785 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
9786 	},
9787 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9788 		.type = HDA_FIXUP_PINS,
9789 		.v.pins = (const struct hda_pintbl[]) {
9790 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9791 			{ }
9792 		},
9793 		.chained = true,
9794 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9795 	},
9796 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9797 		.type = HDA_FIXUP_FUNC,
9798 		.v.func = alc269_fixup_limit_int_mic_boost,
9799 		.chained = true,
9800 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9801 	},
9802 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9803 		.type = HDA_FIXUP_FUNC,
9804 		.v.func = alc285_fixup_ideapad_s740_coef,
9805 		.chained = true,
9806 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9807 	},
9808 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9809 		.type = HDA_FIXUP_FUNC,
9810 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9811 		.chained = true,
9812 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9813 	},
9814 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9815 		.type = HDA_FIXUP_VERBS,
9816 		//.v.verbs = legion_15imhg05_coefs,
9817 		.v.verbs = (const struct hda_verb[]) {
9818 			 // set left speaker Legion 7i.
9819 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9820 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9821 
9822 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9823 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9824 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9825 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9826 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9827 
9828 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9829 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9830 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9831 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9832 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9833 
9834 			 // set right speaker Legion 7i.
9835 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9836 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9837 
9838 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9839 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9840 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9841 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9842 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9843 
9844 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9845 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9846 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9847 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9848 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9849 			 {}
9850 		},
9851 		.chained = true,
9852 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9853 	},
9854 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9855 		.type = HDA_FIXUP_FUNC,
9856 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9857 		.chained = true,
9858 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9859 	},
9860 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9861 		.type = HDA_FIXUP_VERBS,
9862 		.v.verbs = (const struct hda_verb[]) {
9863 			 // set left speaker Yoga 7i.
9864 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9865 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9866 
9867 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9868 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9869 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9870 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9871 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9872 
9873 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9874 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9875 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9876 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9877 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9878 
9879 			 // set right speaker Yoga 7i.
9880 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9881 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9882 
9883 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9884 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9885 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9886 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9887 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9888 
9889 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9890 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9891 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9892 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9893 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9894 			 {}
9895 		},
9896 		.chained = true,
9897 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9898 	},
9899 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
9900 		.type = HDA_FIXUP_FUNC,
9901 		.v.func = alc298_fixup_lenovo_c940_duet7,
9902 	},
9903 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9904 		.type = HDA_FIXUP_VERBS,
9905 		.v.verbs = (const struct hda_verb[]) {
9906 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9907 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9908 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9909 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9910 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9911 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9912 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9913 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9914 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9915 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9916 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9917 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9918 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9919 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9920 			{}
9921 		},
9922 		.chained = true,
9923 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9924 	},
9925 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9926 		.type = HDA_FIXUP_FUNC,
9927 		.v.func = alc256_fixup_set_coef_defaults,
9928 	},
9929 	[ALC245_FIXUP_HP_GPIO_LED] = {
9930 		.type = HDA_FIXUP_FUNC,
9931 		.v.func = alc245_fixup_hp_gpio_led,
9932 	},
9933 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9934 		.type = HDA_FIXUP_PINS,
9935 		.v.pins = (const struct hda_pintbl[]) {
9936 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9937 			{ }
9938 		},
9939 		.chained = true,
9940 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9941 	},
9942 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
9943 		.type = HDA_FIXUP_FUNC,
9944 		.v.func = alc233_fixup_no_audio_jack,
9945 	},
9946 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9947 		.type = HDA_FIXUP_FUNC,
9948 		.v.func = alc256_fixup_mic_no_presence_and_resume,
9949 		.chained = true,
9950 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9951 	},
9952 	[ALC287_FIXUP_LEGION_16ACHG6] = {
9953 		.type = HDA_FIXUP_FUNC,
9954 		.v.func = alc287_fixup_legion_16achg6_speakers,
9955 	},
9956 	[ALC287_FIXUP_CS35L41_I2C_2] = {
9957 		.type = HDA_FIXUP_FUNC,
9958 		.v.func = cs35l41_fixup_i2c_two,
9959 	},
9960 	[ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9961 		.type = HDA_FIXUP_FUNC,
9962 		.v.func = cs35l41_fixup_i2c_two,
9963 		.chained = true,
9964 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9965 	},
9966 	[ALC287_FIXUP_CS35L41_I2C_4] = {
9967 		.type = HDA_FIXUP_FUNC,
9968 		.v.func = cs35l41_fixup_i2c_four,
9969 	},
9970 	[ALC245_FIXUP_CS35L41_SPI_2] = {
9971 		.type = HDA_FIXUP_FUNC,
9972 		.v.func = cs35l41_fixup_spi_two,
9973 	},
9974 	[ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9975 		.type = HDA_FIXUP_FUNC,
9976 		.v.func = cs35l41_fixup_spi_two,
9977 		.chained = true,
9978 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9979 	},
9980 	[ALC245_FIXUP_CS35L41_SPI_4] = {
9981 		.type = HDA_FIXUP_FUNC,
9982 		.v.func = cs35l41_fixup_spi_four,
9983 	},
9984 	[ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9985 		.type = HDA_FIXUP_FUNC,
9986 		.v.func = cs35l41_fixup_spi_four,
9987 		.chained = true,
9988 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9989 	},
9990 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9991 		.type = HDA_FIXUP_VERBS,
9992 		.v.verbs = (const struct hda_verb[]) {
9993 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9994 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9995 			 { }
9996 		},
9997 		.chained = true,
9998 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9999 	},
10000 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
10001 		.type = HDA_FIXUP_FUNC,
10002 		.v.func = alc_fixup_dell4_mic_no_presence_quiet,
10003 		.chained = true,
10004 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10005 	},
10006 	[ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
10007 		.type = HDA_FIXUP_PINS,
10008 		.v.pins = (const struct hda_pintbl[]) {
10009 			{ 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
10010 			{ }
10011 		},
10012 		.chained = true,
10013 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
10014 	},
10015 	[ALC287_FIXUP_LEGION_16ITHG6] = {
10016 		.type = HDA_FIXUP_FUNC,
10017 		.v.func = alc287_fixup_legion_16ithg6_speakers,
10018 	},
10019 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
10020 		.type = HDA_FIXUP_VERBS,
10021 		.v.verbs = (const struct hda_verb[]) {
10022 			// enable left speaker
10023 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10024 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
10025 
10026 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10027 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
10028 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10029 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
10030 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10031 
10032 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10033 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
10034 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10035 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
10036 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10037 
10038 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10039 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
10040 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10041 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
10042 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10043 
10044 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10045 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10046 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10047 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10048 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10049 
10050 			// enable right speaker
10051 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10052 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
10053 
10054 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10055 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
10056 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10057 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
10058 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10059 
10060 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10061 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
10062 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10063 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
10064 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10065 
10066 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10067 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
10068 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10069 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
10070 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10071 
10072 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10073 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10074 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10075 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10076 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10077 
10078 			{ },
10079 		},
10080 	},
10081 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
10082 		.type = HDA_FIXUP_FUNC,
10083 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
10084 		.chained = true,
10085 		.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
10086 	},
10087 	[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
10088 		.type = HDA_FIXUP_FUNC,
10089 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
10090 		.chained = true,
10091 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2,
10092 	},
10093 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
10094 		.type = HDA_FIXUP_FUNC,
10095 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
10096 		.chained = true,
10097 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10098 	},
10099 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
10100 		.type = HDA_FIXUP_PINS,
10101 		.v.func = alc1220_fixup_gb_dual_codecs,
10102 		.chained = true,
10103 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10104 	},
10105 	[ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
10106 		.type = HDA_FIXUP_FUNC,
10107 		.v.func = cs35l41_fixup_i2c_two,
10108 		.chained = true,
10109 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10110 	},
10111 	[ALC287_FIXUP_TAS2781_I2C] = {
10112 		.type = HDA_FIXUP_FUNC,
10113 		.v.func = tas2781_fixup_i2c,
10114 		.chained = true,
10115 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10116 	},
10117 	[ALC245_FIXUP_TAS2781_SPI_2] = {
10118 		.type = HDA_FIXUP_FUNC,
10119 		.v.func = tas2781_fixup_spi,
10120 		.chained = true,
10121 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
10122 	},
10123 	[ALC287_FIXUP_YOGA7_14ARB7_I2C] = {
10124 		.type = HDA_FIXUP_FUNC,
10125 		.v.func = yoga7_14arb7_fixup_i2c,
10126 		.chained = true,
10127 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10128 	},
10129 	[ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
10130 		.type = HDA_FIXUP_FUNC,
10131 		.v.func = alc245_fixup_hp_mute_led_coefbit,
10132 	},
10133 	[ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
10134 		.type = HDA_FIXUP_FUNC,
10135 		.v.func = alc245_fixup_hp_mute_led_coefbit,
10136 		.chained = true,
10137 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
10138 	},
10139 	[ALC287_FIXUP_THINKPAD_I2S_SPK] = {
10140 		.type = HDA_FIXUP_FUNC,
10141 		.v.func = alc287_fixup_bind_dacs,
10142 		.chained = true,
10143 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10144 	},
10145 	[ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
10146 		.type = HDA_FIXUP_FUNC,
10147 		.v.func = alc287_fixup_bind_dacs,
10148 		.chained = true,
10149 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
10150 	},
10151 	[ALC2XX_FIXUP_HEADSET_MIC] = {
10152 		.type = HDA_FIXUP_FUNC,
10153 		.v.func = alc_fixup_headset_mic,
10154 	},
10155 	[ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
10156 		.type = HDA_FIXUP_FUNC,
10157 		.v.func = cs35l41_fixup_spi_two,
10158 		.chained = true,
10159 		.chain_id = ALC289_FIXUP_DUAL_SPK
10160 	},
10161 	[ALC294_FIXUP_CS35L41_I2C_2] = {
10162 		.type = HDA_FIXUP_FUNC,
10163 		.v.func = cs35l41_fixup_i2c_two,
10164 	},
10165 	[ALC256_FIXUP_ACER_SFG16_MICMUTE_LED] = {
10166 		.type = HDA_FIXUP_FUNC,
10167 		.v.func = alc256_fixup_acer_sfg16_micmute_led,
10168 	},
10169 	[ALC256_FIXUP_HEADPHONE_AMP_VOL] = {
10170 		.type = HDA_FIXUP_FUNC,
10171 		.v.func = alc256_decrease_headphone_amp_val,
10172 	},
10173 	[ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX] = {
10174 		.type = HDA_FIXUP_FUNC,
10175 		.v.func = alc245_fixup_hp_spectre_x360_eu0xxx,
10176 	},
10177 	[ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX] = {
10178 		.type = HDA_FIXUP_FUNC,
10179 		.v.func = alc245_fixup_hp_spectre_x360_16_aa0xxx,
10180 	},
10181 	[ALC285_FIXUP_ASUS_GA403U] = {
10182 		.type = HDA_FIXUP_FUNC,
10183 		.v.func = alc285_fixup_asus_ga403u,
10184 	},
10185 	[ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC] = {
10186 		.type = HDA_FIXUP_PINS,
10187 		.v.pins = (const struct hda_pintbl[]) {
10188 			{ 0x19, 0x03a11050 },
10189 			{ 0x1b, 0x03a11c30 },
10190 			{ }
10191 		},
10192 		.chained = true,
10193 		.chain_id = ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1
10194 	},
10195 	[ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1] = {
10196 		.type = HDA_FIXUP_FUNC,
10197 		.v.func = alc285_fixup_speaker2_to_dac1,
10198 		.chained = true,
10199 		.chain_id = ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
10200 	},
10201 	[ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC] = {
10202 		.type = HDA_FIXUP_PINS,
10203 		.v.pins = (const struct hda_pintbl[]) {
10204 			{ 0x19, 0x03a11050 },
10205 			{ 0x1b, 0x03a11c30 },
10206 			{ }
10207 		},
10208 	},
10209 	[ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1] = {
10210 		.type = HDA_FIXUP_FUNC,
10211 		.v.func = alc285_fixup_speaker2_to_dac1,
10212 		.chained = true,
10213 		.chain_id = ALC285_FIXUP_ASUS_GA403U,
10214 	},
10215 	[ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318] = {
10216 		.type = HDA_FIXUP_FUNC,
10217 		.v.func = alc287_fixup_lenovo_thinkpad_with_alc1318,
10218 		.chained = true,
10219 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
10220 	},
10221 	[ALC256_FIXUP_CHROME_BOOK] = {
10222 		.type = HDA_FIXUP_FUNC,
10223 		.v.func = alc256_fixup_chromebook,
10224 		.chained = true,
10225 		.chain_id = ALC225_FIXUP_HEADSET_JACK
10226 	},
10227 	[ALC245_FIXUP_CLEVO_NOISY_MIC] = {
10228 		.type = HDA_FIXUP_FUNC,
10229 		.v.func = alc269_fixup_limit_int_mic_boost,
10230 		.chained = true,
10231 		.chain_id = ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
10232 	},
10233 	[ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE] = {
10234 		.type = HDA_FIXUP_PINS,
10235 		.v.pins = (const struct hda_pintbl[]) {
10236 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10237 			{ 0x1b, 0x20a11040 }, /* dock mic */
10238 			{ }
10239 		},
10240 		.chained = true,
10241 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
10242 	},
10243 	[ALC233_FIXUP_MEDION_MTL_SPK] = {
10244 		.type = HDA_FIXUP_PINS,
10245 		.v.pins = (const struct hda_pintbl[]) {
10246 			{ 0x1b, 0x90170110 },
10247 			{ }
10248 		},
10249 	},
10250 	[ALC294_FIXUP_BASS_SPEAKER_15] = {
10251 		.type = HDA_FIXUP_FUNC,
10252 		.v.func = alc294_fixup_bass_speaker_15,
10253 	},
10254 	[ALC283_FIXUP_DELL_HP_RESUME] = {
10255 		.type = HDA_FIXUP_FUNC,
10256 		.v.func = alc283_fixup_dell_hp_resume,
10257 	},
10258 };
10259 
10260 static const struct hda_quirk alc269_fixup_tbl[] = {
10261 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
10262 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
10263 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
10264 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
10265 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10266 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
10267 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
10268 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10269 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10270 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
10271 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10272 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
10273 	SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10274 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
10275 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
10276 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
10277 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
10278 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10279 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10280 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10281 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
10282 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
10283 	SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10284 	SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10285 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
10286 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10287 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
10288 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
10289 	SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10290 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10291 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10292 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10293 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
10294 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10295 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10296 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10297 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
10298 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
10299 	SND_PCI_QUIRK(0x1025, 0x1360, "Acer Aspire A115", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10300 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10301 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10302 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10303 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
10304 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10305 	SND_PCI_QUIRK(0x1025, 0x159c, "Acer Nitro 5 AN515-58", ALC2XX_FIXUP_HEADSET_MIC),
10306 	SND_PCI_QUIRK(0x1025, 0x169a, "Acer Swift SFG16", ALC256_FIXUP_ACER_SFG16_MICMUTE_LED),
10307 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
10308 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
10309 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
10310 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
10311 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
10312 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
10313 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
10314 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
10315 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10316 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10317 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10318 	SND_PCI_QUIRK(0x1028, 0x0604, "Dell Venue 11 Pro 7130", ALC283_FIXUP_DELL_HP_RESUME),
10319 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
10320 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
10321 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
10322 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
10323 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
10324 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10325 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10326 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
10327 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
10328 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
10329 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
10330 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10331 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10332 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10333 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10334 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10335 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10336 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10337 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
10338 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
10339 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
10340 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
10341 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
10342 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
10343 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
10344 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
10345 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10346 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10347 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
10348 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
10349 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
10350 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
10351 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
10352 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10353 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
10354 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
10355 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
10356 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
10357 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
10358 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
10359 	SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
10360 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
10361 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
10362 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
10363 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10364 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10365 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
10366 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
10367 	SND_PCI_QUIRK(0x1028, 0x0b27, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
10368 	SND_PCI_QUIRK(0x1028, 0x0b28, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
10369 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10370 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10371 	SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10372 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10373 	SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10374 	SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10375 	SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10376 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
10377 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
10378 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
10379 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
10380 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
10381 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
10382 	SND_PCI_QUIRK(0x1028, 0x0c28, "Dell Inspiron 16 Plus 7630", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10383 	SND_PCI_QUIRK(0x1028, 0x0c4d, "Dell", ALC287_FIXUP_CS35L41_I2C_4),
10384 	SND_PCI_QUIRK(0x1028, 0x0c94, "Dell Polaris 3 metal", ALC287_FIXUP_TAS2781_I2C),
10385 	SND_PCI_QUIRK(0x1028, 0x0c96, "Dell Polaris 2in1", ALC287_FIXUP_TAS2781_I2C),
10386 	SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10387 	SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10388 	SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10389 	SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10390 	SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10391 	SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10392 	SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10393 	SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10394 	SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10395 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10396 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10397 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
10398 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
10399 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
10400 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10401 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10402 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10403 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10404 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
10405 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10406 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10407 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10408 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10409 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10410 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10411 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10412 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10413 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10414 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10415 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10416 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10417 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10418 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
10419 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
10420 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10421 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10422 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10423 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10424 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10425 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10426 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10427 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10428 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
10429 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10430 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
10431 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10432 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
10433 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10434 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10435 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10436 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10437 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10438 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10439 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10440 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10441 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10442 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10443 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10444 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10445 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10446 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10447 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
10448 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10449 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10450 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10451 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10452 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10453 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10454 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
10455 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10456 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10457 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
10458 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
10459 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
10460 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
10461 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
10462 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10463 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10464 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10465 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10466 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10467 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10468 	SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10469 	SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10470 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
10471 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10472 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
10473 	SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10474 	SND_PCI_QUIRK(0x103c, 0x85c6, "HP Pavilion x360 Convertible 14-dy1xxx", ALC295_FIXUP_HP_MUTE_LED_COEFBIT11),
10475 	SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
10476 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10477 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10478 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10479 	SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10480 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
10481 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10482 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10483 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
10484 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10485 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10486 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
10487 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
10488 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
10489 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10490 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10491 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10492 	SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
10493 	SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10494 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
10495 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10496 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
10497 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10498 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
10499 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10500 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10501 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10502 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10503 	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10504 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
10505 	SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10506 	SND_PCI_QUIRK(0x103c, 0x87df, "HP ProBook 430 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10507 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10508 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10509 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10510 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10511 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
10512 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
10513 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10514 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10515 	SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10516 	SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10517 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10518 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10519 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10520 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10521 	SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10522 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10523 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10524 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10525 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10526 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10527 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10528 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10529 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10530 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10531 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10532 	SND_PCI_QUIRK(0x103c, 0x887c, "HP Laptop 14s-fq1xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10533 	SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10534 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
10535 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
10536 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
10537 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10538 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
10539 	SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
10540 	SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
10541 	SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10542 	SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
10543 	SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10544 	SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10545 	SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10546 	SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10547 	SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10548 	SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10549 	SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10550 	SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
10551 	SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
10552 	SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10553 	SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10554 	SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10555 	SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
10556 	SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10557 	SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
10558 	SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
10559 	SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
10560 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
10561 	SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
10562 	SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
10563 	SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10564 	SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10565 	SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10566 	SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10567 	SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10568 	SND_PCI_QUIRK(0x103c, 0x89e7, "HP Elite x2 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10569 	SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
10570 	SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10571 	SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10572 	SND_PCI_QUIRK(0x103c, 0x8a28, "HP Envy 13", ALC287_FIXUP_CS35L41_I2C_2),
10573 	SND_PCI_QUIRK(0x103c, 0x8a29, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10574 	SND_PCI_QUIRK(0x103c, 0x8a2a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10575 	SND_PCI_QUIRK(0x103c, 0x8a2b, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10576 	SND_PCI_QUIRK(0x103c, 0x8a2c, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10577 	SND_PCI_QUIRK(0x103c, 0x8a2d, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10578 	SND_PCI_QUIRK(0x103c, 0x8a2e, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10579 	SND_PCI_QUIRK(0x103c, 0x8a30, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10580 	SND_PCI_QUIRK(0x103c, 0x8a31, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10581 	SND_PCI_QUIRK(0x103c, 0x8a6e, "HP EDNA 360", ALC287_FIXUP_CS35L41_I2C_4),
10582 	SND_PCI_QUIRK(0x103c, 0x8a74, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10583 	SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10584 	SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
10585 	SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
10586 	SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
10587 	SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
10588 	SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
10589 	SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10590 	SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10591 	SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10592 	SND_PCI_QUIRK(0x103c, 0x8ad8, "HP 800 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10593 	SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10594 	SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10595 	SND_PCI_QUIRK(0x103c, 0x8b3a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10596 	SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
10597 	SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10598 	SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10599 	SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10600 	SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10601 	SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10602 	SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10603 	SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10604 	SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10605 	SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10606 	SND_PCI_QUIRK(0x103c, 0x8b5f, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10607 	SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10608 	SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10609 	SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10610 	SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10611 	SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10612 	SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10613 	SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
10614 	SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10615 	SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10616 	SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
10617 	SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10618 	SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
10619 	SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10620 	SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10621 	SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10622 	SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10623 	SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10624 	SND_PCI_QUIRK(0x103c, 0x8bb3, "HP Slim OMEN", ALC287_FIXUP_CS35L41_I2C_2),
10625 	SND_PCI_QUIRK(0x103c, 0x8bb4, "HP Slim OMEN", ALC287_FIXUP_CS35L41_I2C_2),
10626 	SND_PCI_QUIRK(0x103c, 0x8bdd, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10627 	SND_PCI_QUIRK(0x103c, 0x8bde, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10628 	SND_PCI_QUIRK(0x103c, 0x8bdf, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10629 	SND_PCI_QUIRK(0x103c, 0x8be0, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10630 	SND_PCI_QUIRK(0x103c, 0x8be1, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10631 	SND_PCI_QUIRK(0x103c, 0x8be2, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10632 	SND_PCI_QUIRK(0x103c, 0x8be3, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10633 	SND_PCI_QUIRK(0x103c, 0x8be5, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10634 	SND_PCI_QUIRK(0x103c, 0x8be6, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10635 	SND_PCI_QUIRK(0x103c, 0x8be7, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10636 	SND_PCI_QUIRK(0x103c, 0x8be8, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10637 	SND_PCI_QUIRK(0x103c, 0x8be9, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10638 	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10639 	SND_PCI_QUIRK(0x103c, 0x8c15, "HP Spectre x360 2-in-1 Laptop 14-eu0xxx", ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX),
10640 	SND_PCI_QUIRK(0x103c, 0x8c16, "HP Spectre x360 2-in-1 Laptop 16-aa0xxx", ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX),
10641 	SND_PCI_QUIRK(0x103c, 0x8c17, "HP Spectre 16", ALC287_FIXUP_CS35L41_I2C_2),
10642 	SND_PCI_QUIRK(0x103c, 0x8c21, "HP Pavilion Plus Laptop 14-ey0XXX", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10643 	SND_PCI_QUIRK(0x103c, 0x8c30, "HP Victus 15-fb1xxx", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10644 	SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10645 	SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10646 	SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10647 	SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10648 	SND_PCI_QUIRK(0x103c, 0x8c4d, "HP Omen", ALC287_FIXUP_CS35L41_I2C_2),
10649 	SND_PCI_QUIRK(0x103c, 0x8c4e, "HP Omen", ALC287_FIXUP_CS35L41_I2C_2),
10650 	SND_PCI_QUIRK(0x103c, 0x8c4f, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10651 	SND_PCI_QUIRK(0x103c, 0x8c50, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10652 	SND_PCI_QUIRK(0x103c, 0x8c51, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10653 	SND_PCI_QUIRK(0x103c, 0x8c52, "HP EliteBook 1040 G11", ALC285_FIXUP_HP_GPIO_LED),
10654 	SND_PCI_QUIRK(0x103c, 0x8c53, "HP Elite x360 1040 2-in-1 G11", ALC285_FIXUP_HP_GPIO_LED),
10655 	SND_PCI_QUIRK(0x103c, 0x8c66, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10656 	SND_PCI_QUIRK(0x103c, 0x8c67, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10657 	SND_PCI_QUIRK(0x103c, 0x8c68, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10658 	SND_PCI_QUIRK(0x103c, 0x8c6a, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10659 	SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10660 	SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10661 	SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10662 	SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10663 	SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10664 	SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10665 	SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10666 	SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10667 	SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10668 	SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10669 	SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10670 	SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10671 	SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10672 	SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10673 	SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10674 	SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10675 	SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10676 	SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10677 	SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10678 	SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10679 	SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10680 	SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10681 	SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10682 	SND_PCI_QUIRK(0x103c, 0x8caf, "HP Elite mt645 G8 Mobile Thin Client", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10683 	SND_PCI_QUIRK(0x103c, 0x8cbd, "HP Pavilion Aero Laptop 13-bg0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10684 	SND_PCI_QUIRK(0x103c, 0x8cdd, "HP Spectre", ALC287_FIXUP_CS35L41_I2C_2),
10685 	SND_PCI_QUIRK(0x103c, 0x8cde, "HP Spectre", ALC287_FIXUP_CS35L41_I2C_2),
10686 	SND_PCI_QUIRK(0x103c, 0x8cdf, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10687 	SND_PCI_QUIRK(0x103c, 0x8ce0, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10688 	SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10689 	SND_PCI_QUIRK(0x103c, 0x8d01, "HP ZBook Power 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10690 	SND_PCI_QUIRK(0x103c, 0x8d84, "HP EliteBook X G1i", ALC285_FIXUP_HP_GPIO_LED),
10691 	SND_PCI_QUIRK(0x103c, 0x8d91, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10692 	SND_PCI_QUIRK(0x103c, 0x8d92, "HP ZBook Firefly 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10693 	SND_PCI_QUIRK(0x103c, 0x8de8, "HP Gemtree", ALC245_FIXUP_TAS2781_SPI_2),
10694 	SND_PCI_QUIRK(0x103c, 0x8de9, "HP Gemtree", ALC245_FIXUP_TAS2781_SPI_2),
10695 	SND_PCI_QUIRK(0x103c, 0x8e18, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10696 	SND_PCI_QUIRK(0x103c, 0x8e19, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10697 	SND_PCI_QUIRK(0x103c, 0x8e1a, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10698 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10699 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10700 	SND_PCI_QUIRK(0x1043, 0x1054, "ASUS G614FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2),
10701 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10702 	SND_PCI_QUIRK(0x1043, 0x1074, "ASUS G614PH/PM/PP", ALC287_FIXUP_CS35L41_I2C_2),
10703 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10704 	SND_PCI_QUIRK(0x1043, 0x10a4, "ASUS TP3407SA", ALC287_FIXUP_TAS2781_I2C),
10705 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10706 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10707 	SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10708 	SND_PCI_QUIRK(0x1043, 0x1154, "ASUS TP3607SH", ALC287_FIXUP_TAS2781_I2C),
10709 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10710 	SND_PCI_QUIRK(0x1043, 0x1194, "ASUS UM3406KA", ALC287_FIXUP_CS35L41_I2C_2),
10711 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10712 	SND_PCI_QUIRK(0x1043, 0x1204, "ASUS Strix G615JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C),
10713 	SND_PCI_QUIRK(0x1043, 0x1214, "ASUS Strix G615LH_LM_LP", ALC287_FIXUP_TAS2781_I2C),
10714 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10715 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10716 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10717 	SND_PCI_QUIRK(0x1043, 0x1294, "ASUS B3405CVA", ALC245_FIXUP_CS35L41_SPI_2),
10718 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10719 	SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10720 	SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10721 	SND_PCI_QUIRK(0x1043, 0x12b4, "ASUS B3405CCA / P3405CCA", ALC245_FIXUP_CS35L41_SPI_2),
10722 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10723 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10724 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10725 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10726 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10727 	SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVV", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10728 	SND_PCI_QUIRK(0x1043, 0x1460, "Asus VivoBook 15", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10729 	SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X/GA402N", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10730 	SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604VI/VC/VE/VG/VJ/VQ/VU/VV/VY/VZ", ALC285_FIXUP_ASUS_HEADSET_MIC),
10731 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603VQ/VU/VV/VJ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10732 	SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601VV/VU/VJ/VQ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10733 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G614JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10734 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS G513PI/PU/PV", ALC287_FIXUP_CS35L41_I2C_2),
10735 	SND_PCI_QUIRK(0x1043, 0x1503, "ASUS G733PY/PZ/PZV/PYV", ALC287_FIXUP_CS35L41_I2C_2),
10736 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10737 	SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA/XJ/XQ/XU/XV/XI", ALC287_FIXUP_CS35L41_I2C_2),
10738 	SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301VV/VQ/VU/VJ/VA/VC/VE/VVC/VQC/VUC/VJC/VEC/VCC", ALC285_FIXUP_ASUS_HEADSET_MIC),
10739 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10740 	SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZI/ZJ/ZQ/ZU/ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10741 	SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10742 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10743 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10744 	SND_PCI_QUIRK(0x1043, 0x16d3, "ASUS UX5304VA", ALC245_FIXUP_CS35L41_SPI_2),
10745 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10746 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS UX7602VI/BZ", ALC245_FIXUP_CS35L41_SPI_2),
10747 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10748 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10749 	SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally NR2301L/X", ALC294_FIXUP_ASUS_ALLY),
10750 	SND_PCI_QUIRK(0x1043, 0x1863, "ASUS UX6404VI/VV", ALC245_FIXUP_CS35L41_SPI_2),
10751 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10752 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10753 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10754 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10755 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10756 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10757 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10758 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10759 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10760 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10761 	SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10762 	SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10763 	SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10764 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10765 	SND_PCI_QUIRK(0x1043, 0x1b13, "ASUS U41SV/GA403U", ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC),
10766 	SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10767 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10768 	SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10769 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10770 	SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10771 	SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10772 	SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10773 	SND_PCI_QUIRK(0x1043, 0x1c63, "ASUS GU605M", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10774 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10775 	SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JU/JV/JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10776 	SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JY/JZ/JI/JG", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10777 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10778 	SND_PCI_QUIRK(0x1043, 0x1ccf, "ASUS G814JU/JV/JI", ALC245_FIXUP_CS35L41_SPI_2),
10779 	SND_PCI_QUIRK(0x1043, 0x1cdf, "ASUS G814JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10780 	SND_PCI_QUIRK(0x1043, 0x1cef, "ASUS G834JY/JZ/JI/JG", ALC285_FIXUP_ASUS_HEADSET_MIC),
10781 	SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS G713PI/PU/PV/PVN", ALC287_FIXUP_CS35L41_I2C_2),
10782 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10783 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10784 	SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10785 	SND_PCI_QUIRK(0x1043, 0x1df3, "ASUS UM5606WA", ALC294_FIXUP_BASS_SPEAKER_15),
10786 	SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10787 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10788 	SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10789 	SND_PCI_QUIRK(0x1043, 0x1e1f, "ASUS Vivobook 15 X1504VAP", ALC2XX_FIXUP_HEADSET_MIC),
10790 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10791 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10792 	SND_PCI_QUIRK(0x1043, 0x1e63, "ASUS H7606W", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10793 	SND_PCI_QUIRK(0x1043, 0x1e83, "ASUS GA605W", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10794 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10795 	SND_PCI_QUIRK(0x1043, 0x1eb3, "ASUS Ally RCLA72", ALC287_FIXUP_TAS2781_I2C),
10796 	SND_PCI_QUIRK(0x1043, 0x1ed3, "ASUS HN7306W", ALC287_FIXUP_CS35L41_I2C_2),
10797 	SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10798 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10799 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10800 	SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10801 	SND_PCI_QUIRK(0x1043, 0x1f1f, "ASUS H7604JI/JV/J3D", ALC245_FIXUP_CS35L41_SPI_2),
10802 	SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10803 	SND_PCI_QUIRK(0x1043, 0x1f63, "ASUS P5405CSA", ALC245_FIXUP_CS35L41_SPI_2),
10804 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10805 	SND_PCI_QUIRK(0x1043, 0x1fb3, "ASUS ROG Flow Z13 GZ302EA", ALC287_FIXUP_CS35L41_I2C_2),
10806 	SND_PCI_QUIRK(0x1043, 0x3011, "ASUS B5605CVA", ALC245_FIXUP_CS35L41_SPI_2),
10807 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10808 	SND_PCI_QUIRK(0x1043, 0x3061, "ASUS B3405CCA", ALC245_FIXUP_CS35L41_SPI_2),
10809 	SND_PCI_QUIRK(0x1043, 0x3071, "ASUS B5405CCA", ALC245_FIXUP_CS35L41_SPI_2),
10810 	SND_PCI_QUIRK(0x1043, 0x30c1, "ASUS B3605CCA / P3605CCA", ALC245_FIXUP_CS35L41_SPI_2),
10811 	SND_PCI_QUIRK(0x1043, 0x30d1, "ASUS B5405CCA", ALC245_FIXUP_CS35L41_SPI_2),
10812 	SND_PCI_QUIRK(0x1043, 0x30e1, "ASUS B5605CCA", ALC245_FIXUP_CS35L41_SPI_2),
10813 	SND_PCI_QUIRK(0x1043, 0x31d0, "ASUS Zen AIO 27 Z272SD_A272SD", ALC274_FIXUP_ASUS_ZEN_AIO_27),
10814 	SND_PCI_QUIRK(0x1043, 0x31e1, "ASUS B5605CCA", ALC245_FIXUP_CS35L41_SPI_2),
10815 	SND_PCI_QUIRK(0x1043, 0x31f1, "ASUS B3605CCA", ALC245_FIXUP_CS35L41_SPI_2),
10816 	SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10817 	SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10818 	SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10819 	SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10820 	SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10821 	SND_PCI_QUIRK(0x1043, 0x3d78, "ASUS GA603KH", ALC287_FIXUP_CS35L41_I2C_2),
10822 	SND_PCI_QUIRK(0x1043, 0x3d88, "ASUS GA603KM", ALC287_FIXUP_CS35L41_I2C_2),
10823 	SND_PCI_QUIRK(0x1043, 0x3e00, "ASUS G814FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2),
10824 	SND_PCI_QUIRK(0x1043, 0x3e20, "ASUS G814PH/PM/PP", ALC287_FIXUP_CS35L41_I2C_2),
10825 	SND_PCI_QUIRK(0x1043, 0x3e30, "ASUS TP3607SA", ALC287_FIXUP_TAS2781_I2C),
10826 	SND_PCI_QUIRK(0x1043, 0x3ee0, "ASUS Strix G815_JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C),
10827 	SND_PCI_QUIRK(0x1043, 0x3ef0, "ASUS Strix G635LR_LW_LX", ALC287_FIXUP_TAS2781_I2C),
10828 	SND_PCI_QUIRK(0x1043, 0x3f00, "ASUS Strix G815LH_LM_LP", ALC287_FIXUP_TAS2781_I2C),
10829 	SND_PCI_QUIRK(0x1043, 0x3f10, "ASUS Strix G835LR_LW_LX", ALC287_FIXUP_TAS2781_I2C),
10830 	SND_PCI_QUIRK(0x1043, 0x3f20, "ASUS Strix G615LR_LW", ALC287_FIXUP_TAS2781_I2C),
10831 	SND_PCI_QUIRK(0x1043, 0x3f30, "ASUS Strix G815LR_LW", ALC287_FIXUP_TAS2781_I2C),
10832 	SND_PCI_QUIRK(0x1043, 0x3fd0, "ASUS B3605CVA", ALC245_FIXUP_CS35L41_SPI_2),
10833 	SND_PCI_QUIRK(0x1043, 0x3ff0, "ASUS B5405CVA", ALC245_FIXUP_CS35L41_SPI_2),
10834 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10835 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10836 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10837 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10838 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10839 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10840 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10841 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10842 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10843 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10844 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10845 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10846 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10847 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10848 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10849 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10850 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10851 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10852 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10853 	SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10854 	SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10855 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10856 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10857 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10858 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10859 	SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10860 	SND_PCI_QUIRK(0x10ec, 0x12f6, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10861 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10862 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10863 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10864 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10865 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10866 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10867 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10868 	SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10869 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10870 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10871 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10872 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10873 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10874 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10875 	SND_PCI_QUIRK(0x144d, 0xca06, "Samsung Galaxy Book3 360 (NP730QFG)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10876 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10877 	SND_PCI_QUIRK(0x144d, 0xc870, "Samsung Galaxy Book2 Pro (NP950XED)", ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS),
10878 	SND_PCI_QUIRK(0x144d, 0xc872, "Samsung Galaxy Book2 Pro (NP950XEE)", ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS),
10879 	SND_PCI_QUIRK(0x144d, 0xc886, "Samsung Galaxy Book3 Pro (NP964XFG)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10880 	SND_PCI_QUIRK(0x144d, 0xc1ca, "Samsung Galaxy Book3 Pro 360 (NP960QFG)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10881 	SND_PCI_QUIRK(0x144d, 0xc1cc, "Samsung Galaxy Book3 Ultra (NT960XFH)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10882 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10883 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10884 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10885 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10886 	SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10887 	SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10888 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10889 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10890 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10891 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10892 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10893 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10894 	SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10895 	SND_PCI_QUIRK(0x1558, 0x28c1, "Clevo V370VND", ALC2XX_FIXUP_HEADSET_MIC),
10896 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10897 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10898 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10899 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10900 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10901 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10902 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10903 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10904 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10905 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10906 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10907 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10908 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10909 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10910 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10911 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10912 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10913 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10914 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10915 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10916 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10917 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10918 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10919 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10920 	SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10921 	SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10922 	SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10923 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10924 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10925 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10926 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10927 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10928 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10929 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10930 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10931 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10932 	SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10933 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10934 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10935 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10936 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10937 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10938 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10939 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10940 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10941 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10942 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10943 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10944 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10945 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10946 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10947 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10948 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
10949 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10950 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10951 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10952 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10953 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10954 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10955 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10956 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10957 	SND_PCI_QUIRK(0x1558, 0xa554, "VAIO VJFH52", ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE),
10958 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10959 	SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10960 	SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10961 	SND_PCI_QUIRK(0x1558, 0xa741, "Clevo V54x_6x_TNE", ALC245_FIXUP_CLEVO_NOISY_MIC),
10962 	SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC245_FIXUP_CLEVO_NOISY_MIC),
10963 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10964 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10965 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10966 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10967 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10968 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10969 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
10970 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10971 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
10972 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
10973 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
10974 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
10975 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
10976 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
10977 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
10978 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
10979 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
10980 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
10981 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
10982 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
10983 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
10984 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
10985 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
10986 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10987 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10988 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10989 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
10990 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
10991 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10992 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10993 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10994 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
10995 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
10996 	SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
10997 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
10998 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10999 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11000 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
11001 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11002 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11003 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11004 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11005 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
11006 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
11007 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
11008 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
11009 	SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11010 	SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11011 	SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11012 	SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11013 	SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11014 	SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11015 	SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11016 	SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11017 	SND_PCI_QUIRK(0x17aa, 0x231e, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
11018 	SND_PCI_QUIRK(0x17aa, 0x231f, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
11019 	SND_PCI_QUIRK(0x17aa, 0x2326, "Hera2", ALC287_FIXUP_TAS2781_I2C),
11020 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
11021 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
11022 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11023 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11024 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11025 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11026 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11027 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11028 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11029 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11030 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
11031 	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
11032 	SND_PCI_QUIRK(0x17aa, 0x3384, "ThinkCentre M90a PRO", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11033 	SND_PCI_QUIRK(0x17aa, 0x3386, "ThinkCentre M90a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11034 	SND_PCI_QUIRK(0x17aa, 0x3387, "ThinkCentre M70a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11035 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11036 	HDA_CODEC_QUIRK(0x17aa, 0x3802, "DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11037 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8", ALC287_FIXUP_TAS2781_I2C),
11038 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
11039 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
11040 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
11041 	HDA_CODEC_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
11042 	SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11043 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
11044 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
11045 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11046 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
11047 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
11048 	SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
11049 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11050 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11051 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11052 	SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
11053 	SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
11054 	SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
11055 	SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11056 	HDA_CODEC_QUIRK(0x17aa, 0x386e, "Legion Y9000X 2022 IAH7", ALC287_FIXUP_CS35L41_I2C_2),
11057 	SND_PCI_QUIRK(0x17aa, 0x386e, "Yoga Pro 7 14ARP8", ALC285_FIXUP_SPEAKER2_TO_DAC1),
11058 	HDA_CODEC_QUIRK(0x17aa, 0x38a8, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C), /* this must match before PCI SSID 17aa:386f below */
11059 	SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7i 16IAX7", ALC287_FIXUP_CS35L41_I2C_2),
11060 	SND_PCI_QUIRK(0x17aa, 0x3870, "Lenovo Yoga 7 14ARB7", ALC287_FIXUP_YOGA7_14ARB7_I2C),
11061 	SND_PCI_QUIRK(0x17aa, 0x3877, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
11062 	SND_PCI_QUIRK(0x17aa, 0x3878, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
11063 	SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
11064 	SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
11065 	SND_PCI_QUIRK(0x17aa, 0x387f, "Yoga S780-16 pro dual LX", ALC287_FIXUP_TAS2781_I2C),
11066 	SND_PCI_QUIRK(0x17aa, 0x3880, "Yoga S780-16 pro dual YC", ALC287_FIXUP_TAS2781_I2C),
11067 	SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
11068 	SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11069 	SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11070 	SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
11071 	SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11072 	SND_PCI_QUIRK(0x17aa, 0x38a5, "Y580P AMD dual", ALC287_FIXUP_TAS2781_I2C),
11073 	SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
11074 	SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
11075 	SND_PCI_QUIRK(0x17aa, 0x38a9, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11076 	SND_PCI_QUIRK(0x17aa, 0x38ab, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11077 	SND_PCI_QUIRK(0x17aa, 0x38b4, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
11078 	SND_PCI_QUIRK(0x17aa, 0x38b5, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
11079 	SND_PCI_QUIRK(0x17aa, 0x38b6, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
11080 	SND_PCI_QUIRK(0x17aa, 0x38b7, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
11081 	SND_PCI_QUIRK(0x17aa, 0x38b8, "Yoga S780-14.5 proX AMD YC Dual", ALC287_FIXUP_TAS2781_I2C),
11082 	SND_PCI_QUIRK(0x17aa, 0x38b9, "Yoga S780-14.5 proX AMD LX Dual", ALC287_FIXUP_TAS2781_I2C),
11083 	SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
11084 	SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
11085 	SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
11086 	SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
11087 	SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
11088 	SND_PCI_QUIRK(0x17aa, 0x38c7, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
11089 	SND_PCI_QUIRK(0x17aa, 0x38c8, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
11090 	SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11091 	SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
11092 	SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
11093 	SND_PCI_QUIRK(0x17aa, 0x38d3, "Yoga S990-16 Pro IMH YC Dual", ALC287_FIXUP_TAS2781_I2C),
11094 	SND_PCI_QUIRK(0x17aa, 0x38d4, "Yoga S990-16 Pro IMH VECO Dual", ALC287_FIXUP_TAS2781_I2C),
11095 	SND_PCI_QUIRK(0x17aa, 0x38d5, "Yoga S990-16 Pro IMH YC Quad", ALC287_FIXUP_TAS2781_I2C),
11096 	SND_PCI_QUIRK(0x17aa, 0x38d6, "Yoga S990-16 Pro IMH VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11097 	SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
11098 	SND_PCI_QUIRK(0x17aa, 0x38df, "Yoga Y990 Intel YC Dual", ALC287_FIXUP_TAS2781_I2C),
11099 	SND_PCI_QUIRK(0x17aa, 0x38e0, "Yoga Y990 Intel VECO Dual", ALC287_FIXUP_TAS2781_I2C),
11100 	SND_PCI_QUIRK(0x17aa, 0x38f8, "Yoga Book 9i", ALC287_FIXUP_TAS2781_I2C),
11101 	SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11102 	SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11103 	SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11104 	SND_PCI_QUIRK(0x17aa, 0x38fd, "ThinkBook plus Gen5 Hybrid", ALC287_FIXUP_TAS2781_I2C),
11105 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11106 	SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
11107 	SND_PCI_QUIRK(0x17aa, 0x391f, "Yoga S990-16 pro Quad YC Quad", ALC287_FIXUP_TAS2781_I2C),
11108 	SND_PCI_QUIRK(0x17aa, 0x3920, "Yoga S990-16 pro Quad VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11109 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
11110 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11111 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
11112 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11113 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
11114 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
11115 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11116 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
11117 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
11118 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
11119 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
11120 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
11121 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
11122 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
11123 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
11124 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11125 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11126 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11127 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
11128 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11129 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11130 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11131 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
11132 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
11133 	SND_PCI_QUIRK(0x1849, 0x0269, "Positivo Master C6400", ALC269VB_FIXUP_ASUS_ZENBOOK),
11134 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
11135 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
11136 	SND_PCI_QUIRK(0x1854, 0x0440, "LG CQ6", ALC256_FIXUP_HEADPHONE_AMP_VOL),
11137 	SND_PCI_QUIRK(0x1854, 0x0441, "LG CQ6 AIO", ALC256_FIXUP_HEADPHONE_AMP_VOL),
11138 	SND_PCI_QUIRK(0x1854, 0x0488, "LG gram 16 (16Z90R)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11139 	SND_PCI_QUIRK(0x1854, 0x048a, "LG gram 17 (17ZD90R)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11140 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
11141 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
11142 	SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
11143 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
11144 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
11145 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
11146 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
11147 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
11148 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
11149 	SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11150 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
11151 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
11152 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
11153 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
11154 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11155 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11156 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11157 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
11158 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
11159 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
11160 	SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
11161 	SND_PCI_QUIRK(0x1d05, 0x1409, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
11162 	SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
11163 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
11164 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
11165 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
11166 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
11167 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
11168 	SND_PCI_QUIRK(0x1f66, 0x0105, "Ayaneo Portable Game Player", ALC287_FIXUP_CS35L41_I2C_2),
11169 	SND_PCI_QUIRK(0x2014, 0x800a, "Positivo ARN50", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11170 	SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11171 	SND_PCI_QUIRK(0x2782, 0x0228, "Infinix ZERO BOOK 13", ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13),
11172 	SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
11173 	SND_PCI_QUIRK(0x2782, 0x1701, "Infinix Y4 Max", ALC269VC_FIXUP_INFINIX_Y4_MAX),
11174 	SND_PCI_QUIRK(0x2782, 0x1705, "MEDION E15433", ALC269VC_FIXUP_INFINIX_Y4_MAX),
11175 	SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
11176 	SND_PCI_QUIRK(0x2782, 0x4900, "MEDION E15443", ALC233_FIXUP_MEDION_MTL_SPK),
11177 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
11178 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
11179 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
11180 	SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
11181 	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11182 	SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11183 	SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11184 	SND_PCI_QUIRK(0xf111, 0x000c, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11185 
11186 #if 0
11187 	/* Below is a quirk table taken from the old code.
11188 	 * Basically the device should work as is without the fixup table.
11189 	 * If BIOS doesn't give a proper info, enable the corresponding
11190 	 * fixup entry.
11191 	 */
11192 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
11193 		      ALC269_FIXUP_AMIC),
11194 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
11195 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
11196 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
11197 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
11198 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
11199 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
11200 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
11201 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
11202 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
11203 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
11204 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
11205 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
11206 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
11207 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
11208 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
11209 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
11210 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
11211 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
11212 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
11213 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
11214 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
11215 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
11216 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
11217 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
11218 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
11219 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
11220 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
11221 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
11222 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
11223 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
11224 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
11225 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
11226 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
11227 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
11228 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
11229 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
11230 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
11231 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
11232 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
11233 #endif
11234 	{}
11235 };
11236 
11237 static const struct hda_quirk alc269_fixup_vendor_tbl[] = {
11238 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
11239 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
11240 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
11241 	SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo XPAD", ALC269_FIXUP_LENOVO_XPAD_ACPI),
11242 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
11243 	{}
11244 };
11245 
11246 static const struct hda_model_fixup alc269_fixup_models[] = {
11247 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
11248 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
11249 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
11250 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
11251 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
11252 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
11253 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
11254 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
11255 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
11256 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
11257 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11258 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
11259 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
11260 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
11261 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
11262 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
11263 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
11264 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
11265 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
11266 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
11267 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
11268 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
11269 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
11270 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
11271 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
11272 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
11273 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
11274 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
11275 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
11276 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
11277 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
11278 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
11279 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
11280 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
11281 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
11282 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
11283 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
11284 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
11285 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
11286 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
11287 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
11288 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
11289 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
11290 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
11291 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
11292 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
11293 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
11294 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
11295 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
11296 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
11297 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
11298 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
11299 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
11300 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
11301 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
11302 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
11303 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
11304 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
11305 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
11306 	{.id = ALC269_FIXUP_LENOVO_XPAD_ACPI, .name = "lenovo-xpad-led"},
11307 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
11308 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
11309 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
11310 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
11311 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
11312 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
11313 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
11314 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
11315 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
11316 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
11317 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
11318 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11319 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
11320 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
11321 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
11322 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
11323 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
11324 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
11325 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
11326 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
11327 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
11328 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
11329 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
11330 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
11331 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
11332 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
11333 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
11334 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
11335 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
11336 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
11337 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
11338 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
11339 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
11340 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
11341 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
11342 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
11343 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
11344 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
11345 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
11346 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
11347 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
11348 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
11349 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
11350 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
11351 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
11352 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
11353 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
11354 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
11355 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
11356 	{.id = ALC256_FIXUP_CHROME_BOOK, .name = "alc-2024y-chromebook"},
11357 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
11358 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
11359 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
11360 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
11361 	{.id = ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS, .name = "alc298-samsung-amp-v2-2-amps"},
11362 	{.id = ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS, .name = "alc298-samsung-amp-v2-4-amps"},
11363 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
11364 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
11365 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
11366 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
11367 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
11368 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
11369 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
11370 	{.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
11371 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
11372 	{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
11373 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
11374 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
11375 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
11376 	{.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
11377 	{.id = ALC2XX_FIXUP_HEADSET_MIC, .name = "alc2xx-fixup-headset-mic"},
11378 	{}
11379 };
11380 #define ALC225_STANDARD_PINS \
11381 	{0x21, 0x04211020}
11382 
11383 #define ALC256_STANDARD_PINS \
11384 	{0x12, 0x90a60140}, \
11385 	{0x14, 0x90170110}, \
11386 	{0x21, 0x02211020}
11387 
11388 #define ALC282_STANDARD_PINS \
11389 	{0x14, 0x90170110}
11390 
11391 #define ALC290_STANDARD_PINS \
11392 	{0x12, 0x99a30130}
11393 
11394 #define ALC292_STANDARD_PINS \
11395 	{0x14, 0x90170110}, \
11396 	{0x15, 0x0221401f}
11397 
11398 #define ALC295_STANDARD_PINS \
11399 	{0x12, 0xb7a60130}, \
11400 	{0x14, 0x90170110}, \
11401 	{0x21, 0x04211020}
11402 
11403 #define ALC298_STANDARD_PINS \
11404 	{0x12, 0x90a60130}, \
11405 	{0x21, 0x03211020}
11406 
11407 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
11408 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
11409 		{0x14, 0x01014020},
11410 		{0x17, 0x90170110},
11411 		{0x18, 0x02a11030},
11412 		{0x19, 0x0181303F},
11413 		{0x21, 0x0221102f}),
11414 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
11415 		{0x12, 0x90a601c0},
11416 		{0x14, 0x90171120},
11417 		{0x21, 0x02211030}),
11418 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
11419 		{0x14, 0x90170110},
11420 		{0x1b, 0x90a70130},
11421 		{0x21, 0x03211020}),
11422 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
11423 		{0x1a, 0x90a70130},
11424 		{0x1b, 0x90170110},
11425 		{0x21, 0x03211020}),
11426 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11427 		ALC225_STANDARD_PINS,
11428 		{0x12, 0xb7a60130},
11429 		{0x14, 0x901701a0}),
11430 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11431 		ALC225_STANDARD_PINS,
11432 		{0x12, 0xb7a60130},
11433 		{0x14, 0x901701b0}),
11434 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11435 		ALC225_STANDARD_PINS,
11436 		{0x12, 0xb7a60150},
11437 		{0x14, 0x901701a0}),
11438 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11439 		ALC225_STANDARD_PINS,
11440 		{0x12, 0xb7a60150},
11441 		{0x14, 0x901701b0}),
11442 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11443 		ALC225_STANDARD_PINS,
11444 		{0x12, 0xb7a60130},
11445 		{0x1b, 0x90170110}),
11446 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11447 		{0x1b, 0x01111010},
11448 		{0x1e, 0x01451130},
11449 		{0x21, 0x02211020}),
11450 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
11451 		{0x12, 0x90a60140},
11452 		{0x14, 0x90170110},
11453 		{0x19, 0x02a11030},
11454 		{0x21, 0x02211020}),
11455 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11456 		{0x14, 0x90170110},
11457 		{0x19, 0x02a11030},
11458 		{0x1a, 0x02a11040},
11459 		{0x1b, 0x01014020},
11460 		{0x21, 0x0221101f}),
11461 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11462 		{0x14, 0x90170110},
11463 		{0x19, 0x02a11030},
11464 		{0x1a, 0x02a11040},
11465 		{0x1b, 0x01011020},
11466 		{0x21, 0x0221101f}),
11467 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11468 		{0x14, 0x90170110},
11469 		{0x19, 0x02a11020},
11470 		{0x1a, 0x02a11030},
11471 		{0x21, 0x0221101f}),
11472 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
11473 		{0x21, 0x02211010}),
11474 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
11475 		{0x14, 0x90170110},
11476 		{0x19, 0x02a11020},
11477 		{0x21, 0x02211030}),
11478 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
11479 		{0x14, 0x90170110},
11480 		{0x21, 0x02211020}),
11481 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11482 		{0x14, 0x90170130},
11483 		{0x21, 0x02211040}),
11484 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11485 		{0x12, 0x90a60140},
11486 		{0x14, 0x90170110},
11487 		{0x21, 0x02211020}),
11488 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11489 		{0x12, 0x90a60160},
11490 		{0x14, 0x90170120},
11491 		{0x21, 0x02211030}),
11492 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11493 		{0x14, 0x90170110},
11494 		{0x1b, 0x02011020},
11495 		{0x21, 0x0221101f}),
11496 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11497 		{0x14, 0x90170110},
11498 		{0x1b, 0x01011020},
11499 		{0x21, 0x0221101f}),
11500 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11501 		{0x14, 0x90170130},
11502 		{0x1b, 0x01014020},
11503 		{0x21, 0x0221103f}),
11504 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11505 		{0x14, 0x90170130},
11506 		{0x1b, 0x01011020},
11507 		{0x21, 0x0221103f}),
11508 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11509 		{0x14, 0x90170130},
11510 		{0x1b, 0x02011020},
11511 		{0x21, 0x0221103f}),
11512 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11513 		{0x14, 0x90170150},
11514 		{0x1b, 0x02011020},
11515 		{0x21, 0x0221105f}),
11516 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11517 		{0x14, 0x90170110},
11518 		{0x1b, 0x01014020},
11519 		{0x21, 0x0221101f}),
11520 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11521 		{0x12, 0x90a60160},
11522 		{0x14, 0x90170120},
11523 		{0x17, 0x90170140},
11524 		{0x21, 0x0321102f}),
11525 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11526 		{0x12, 0x90a60160},
11527 		{0x14, 0x90170130},
11528 		{0x21, 0x02211040}),
11529 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11530 		{0x12, 0x90a60160},
11531 		{0x14, 0x90170140},
11532 		{0x21, 0x02211050}),
11533 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11534 		{0x12, 0x90a60170},
11535 		{0x14, 0x90170120},
11536 		{0x21, 0x02211030}),
11537 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11538 		{0x12, 0x90a60170},
11539 		{0x14, 0x90170130},
11540 		{0x21, 0x02211040}),
11541 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11542 		{0x12, 0x90a60170},
11543 		{0x14, 0x90171130},
11544 		{0x21, 0x02211040}),
11545 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11546 		{0x12, 0x90a60170},
11547 		{0x14, 0x90170140},
11548 		{0x21, 0x02211050}),
11549 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11550 		{0x12, 0x90a60180},
11551 		{0x14, 0x90170130},
11552 		{0x21, 0x02211040}),
11553 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11554 		{0x12, 0x90a60180},
11555 		{0x14, 0x90170120},
11556 		{0x21, 0x02211030}),
11557 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11558 		{0x1b, 0x01011020},
11559 		{0x21, 0x02211010}),
11560 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
11561 		{0x14, 0x90170110},
11562 		{0x1b, 0x90a70130},
11563 		{0x21, 0x04211020}),
11564 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
11565 		{0x14, 0x90170110},
11566 		{0x1b, 0x90a70130},
11567 		{0x21, 0x03211020}),
11568 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11569 		{0x12, 0x90a60130},
11570 		{0x14, 0x90170110},
11571 		{0x21, 0x03211020}),
11572 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11573 		{0x12, 0x90a60130},
11574 		{0x14, 0x90170110},
11575 		{0x21, 0x04211020}),
11576 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11577 		{0x1a, 0x90a70130},
11578 		{0x1b, 0x90170110},
11579 		{0x21, 0x03211020}),
11580        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
11581 		{0x14, 0x90170110},
11582 		{0x19, 0x02a11020},
11583 		{0x21, 0x0221101f}),
11584        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
11585 		{0x17, 0x90170110},
11586 		{0x19, 0x03a11030},
11587 		{0x21, 0x03211020}),
11588 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
11589 		{0x12, 0x90a60130},
11590 		{0x14, 0x90170110},
11591 		{0x15, 0x0421101f},
11592 		{0x1a, 0x04a11020}),
11593 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
11594 		{0x12, 0x90a60140},
11595 		{0x14, 0x90170110},
11596 		{0x15, 0x0421101f},
11597 		{0x18, 0x02811030},
11598 		{0x1a, 0x04a1103f},
11599 		{0x1b, 0x02011020}),
11600 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11601 		ALC282_STANDARD_PINS,
11602 		{0x12, 0x99a30130},
11603 		{0x19, 0x03a11020},
11604 		{0x21, 0x0321101f}),
11605 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11606 		ALC282_STANDARD_PINS,
11607 		{0x12, 0x99a30130},
11608 		{0x19, 0x03a11020},
11609 		{0x21, 0x03211040}),
11610 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11611 		ALC282_STANDARD_PINS,
11612 		{0x12, 0x99a30130},
11613 		{0x19, 0x03a11030},
11614 		{0x21, 0x03211020}),
11615 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11616 		ALC282_STANDARD_PINS,
11617 		{0x12, 0x99a30130},
11618 		{0x19, 0x04a11020},
11619 		{0x21, 0x0421101f}),
11620 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
11621 		ALC282_STANDARD_PINS,
11622 		{0x12, 0x90a60140},
11623 		{0x19, 0x04a11030},
11624 		{0x21, 0x04211020}),
11625 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11626 		ALC282_STANDARD_PINS,
11627 		{0x12, 0x90a609c0},
11628 		{0x18, 0x03a11830},
11629 		{0x19, 0x04a19831},
11630 		{0x1a, 0x0481303f},
11631 		{0x1b, 0x04211020},
11632 		{0x21, 0x0321101f}),
11633 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11634 		ALC282_STANDARD_PINS,
11635 		{0x12, 0x90a60940},
11636 		{0x18, 0x03a11830},
11637 		{0x19, 0x04a19831},
11638 		{0x1a, 0x0481303f},
11639 		{0x1b, 0x04211020},
11640 		{0x21, 0x0321101f}),
11641 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11642 		ALC282_STANDARD_PINS,
11643 		{0x12, 0x90a60130},
11644 		{0x21, 0x0321101f}),
11645 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11646 		{0x12, 0x90a60160},
11647 		{0x14, 0x90170120},
11648 		{0x21, 0x02211030}),
11649 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11650 		ALC282_STANDARD_PINS,
11651 		{0x12, 0x90a60130},
11652 		{0x19, 0x03a11020},
11653 		{0x21, 0x0321101f}),
11654 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11655 		{0x12, 0x90a60130},
11656 		{0x14, 0x90170110},
11657 		{0x19, 0x04a11040},
11658 		{0x21, 0x04211020}),
11659 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11660 		{0x14, 0x90170110},
11661 		{0x19, 0x04a11040},
11662 		{0x1d, 0x40600001},
11663 		{0x21, 0x04211020}),
11664 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
11665 		{0x14, 0x90170110},
11666 		{0x19, 0x04a11040},
11667 		{0x21, 0x04211020}),
11668 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
11669 		{0x14, 0x90170110},
11670 		{0x17, 0x90170111},
11671 		{0x19, 0x03a11030},
11672 		{0x21, 0x03211020}),
11673 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11674 		{0x17, 0x90170110},
11675 		{0x19, 0x03a11030},
11676 		{0x21, 0x03211020}),
11677 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11678 		{0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
11679 		{0x19, 0x04a11040},
11680 		{0x21, 0x04211020}),
11681 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
11682 		{0x12, 0x90a60130},
11683 		{0x17, 0x90170110},
11684 		{0x21, 0x02211020}),
11685 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
11686 		{0x12, 0x90a60120},
11687 		{0x14, 0x90170110},
11688 		{0x21, 0x0321101f}),
11689 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11690 		ALC290_STANDARD_PINS,
11691 		{0x15, 0x04211040},
11692 		{0x18, 0x90170112},
11693 		{0x1a, 0x04a11020}),
11694 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11695 		ALC290_STANDARD_PINS,
11696 		{0x15, 0x04211040},
11697 		{0x18, 0x90170110},
11698 		{0x1a, 0x04a11020}),
11699 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11700 		ALC290_STANDARD_PINS,
11701 		{0x15, 0x0421101f},
11702 		{0x1a, 0x04a11020}),
11703 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11704 		ALC290_STANDARD_PINS,
11705 		{0x15, 0x04211020},
11706 		{0x1a, 0x04a11040}),
11707 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11708 		ALC290_STANDARD_PINS,
11709 		{0x14, 0x90170110},
11710 		{0x15, 0x04211020},
11711 		{0x1a, 0x04a11040}),
11712 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11713 		ALC290_STANDARD_PINS,
11714 		{0x14, 0x90170110},
11715 		{0x15, 0x04211020},
11716 		{0x1a, 0x04a11020}),
11717 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11718 		ALC290_STANDARD_PINS,
11719 		{0x14, 0x90170110},
11720 		{0x15, 0x0421101f},
11721 		{0x1a, 0x04a11020}),
11722 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11723 		ALC292_STANDARD_PINS,
11724 		{0x12, 0x90a60140},
11725 		{0x16, 0x01014020},
11726 		{0x19, 0x01a19030}),
11727 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11728 		ALC292_STANDARD_PINS,
11729 		{0x12, 0x90a60140},
11730 		{0x16, 0x01014020},
11731 		{0x18, 0x02a19031},
11732 		{0x19, 0x01a1903e}),
11733 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
11734 		ALC292_STANDARD_PINS,
11735 		{0x12, 0x90a60140}),
11736 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11737 		ALC292_STANDARD_PINS,
11738 		{0x13, 0x90a60140},
11739 		{0x16, 0x21014020},
11740 		{0x19, 0x21a19030}),
11741 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11742 		ALC292_STANDARD_PINS,
11743 		{0x13, 0x90a60140}),
11744 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
11745 		{0x17, 0x90170110},
11746 		{0x21, 0x04211020}),
11747 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
11748 		{0x14, 0x90170110},
11749 		{0x1b, 0x90a70130},
11750 		{0x21, 0x04211020}),
11751 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11752 		{0x12, 0x90a60130},
11753 		{0x17, 0x90170110},
11754 		{0x21, 0x03211020}),
11755 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11756 		{0x12, 0x90a60130},
11757 		{0x17, 0x90170110},
11758 		{0x21, 0x04211020}),
11759 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11760 		{0x12, 0x90a60130},
11761 		{0x17, 0x90170110},
11762 		{0x21, 0x03211020}),
11763 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11764 		{0x12, 0x90a60120},
11765 		{0x17, 0x90170110},
11766 		{0x21, 0x04211030}),
11767 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11768 		{0x12, 0x90a60130},
11769 		{0x17, 0x90170110},
11770 		{0x21, 0x03211020}),
11771 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11772 		{0x12, 0x90a60130},
11773 		{0x17, 0x90170110},
11774 		{0x21, 0x03211020}),
11775 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11776 		ALC298_STANDARD_PINS,
11777 		{0x17, 0x90170110}),
11778 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11779 		ALC298_STANDARD_PINS,
11780 		{0x17, 0x90170140}),
11781 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11782 		ALC298_STANDARD_PINS,
11783 		{0x17, 0x90170150}),
11784 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11785 		{0x12, 0xb7a60140},
11786 		{0x13, 0xb7a60150},
11787 		{0x17, 0x90170110},
11788 		{0x1a, 0x03011020},
11789 		{0x21, 0x03211030}),
11790 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11791 		{0x12, 0xb7a60140},
11792 		{0x17, 0x90170110},
11793 		{0x1a, 0x03a11030},
11794 		{0x21, 0x03211020}),
11795 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11796 		ALC225_STANDARD_PINS,
11797 		{0x12, 0xb7a60130},
11798 		{0x17, 0x90170110}),
11799 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11800 		{0x14, 0x01014010},
11801 		{0x17, 0x90170120},
11802 		{0x18, 0x02a11030},
11803 		{0x19, 0x02a1103f},
11804 		{0x21, 0x0221101f}),
11805 	{}
11806 };
11807 
11808 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11809  * more machines, don't need to match all valid pins, just need to match
11810  * all the pins defined in the tbl. Just because of this reason, it is possible
11811  * that a single machine matches multiple tbls, so there is one limitation:
11812  *   at most one tbl is allowed to define for the same vendor and same codec
11813  */
11814 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11815 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11816 		{0x19, 0x40000000}),
11817 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11818 		{0x19, 0x40000000},
11819 		{0x1b, 0x40000000}),
11820 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
11821 		{0x19, 0x40000000},
11822 		{0x1b, 0x40000000}),
11823 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11824 		{0x19, 0x40000000},
11825 		{0x1a, 0x40000000}),
11826 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11827 		{0x19, 0x40000000},
11828 		{0x1a, 0x40000000}),
11829 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11830 		{0x19, 0x40000000},
11831 		{0x1a, 0x40000000}),
11832 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11833 		{0x19, 0x40000000}),
11834 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1558, "Clevo", ALC2XX_FIXUP_HEADSET_MIC,
11835 		{0x19, 0x40000000}),
11836 	{}
11837 };
11838 
alc269_fill_coef(struct hda_codec * codec)11839 static void alc269_fill_coef(struct hda_codec *codec)
11840 {
11841 	struct alc_spec *spec = codec->spec;
11842 	int val;
11843 
11844 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11845 		return;
11846 
11847 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11848 		alc_write_coef_idx(codec, 0xf, 0x960b);
11849 		alc_write_coef_idx(codec, 0xe, 0x8817);
11850 	}
11851 
11852 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11853 		alc_write_coef_idx(codec, 0xf, 0x960b);
11854 		alc_write_coef_idx(codec, 0xe, 0x8814);
11855 	}
11856 
11857 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11858 		/* Power up output pin */
11859 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11860 	}
11861 
11862 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11863 		val = alc_read_coef_idx(codec, 0xd);
11864 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11865 			/* Capless ramp up clock control */
11866 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
11867 		}
11868 		val = alc_read_coef_idx(codec, 0x17);
11869 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11870 			/* Class D power on reset */
11871 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
11872 		}
11873 	}
11874 
11875 	/* HP */
11876 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11877 }
11878 
11879 /*
11880  */
patch_alc269(struct hda_codec * codec)11881 static int patch_alc269(struct hda_codec *codec)
11882 {
11883 	struct alc_spec *spec;
11884 	int err;
11885 
11886 	err = alc_alloc_spec(codec, 0x0b);
11887 	if (err < 0)
11888 		return err;
11889 
11890 	spec = codec->spec;
11891 	spec->gen.shared_mic_vref_pin = 0x18;
11892 	codec->power_save_node = 0;
11893 	spec->en_3kpull_low = true;
11894 
11895 	codec->patch_ops.suspend = alc269_suspend;
11896 	codec->patch_ops.resume = alc269_resume;
11897 	spec->shutup = alc_default_shutup;
11898 	spec->init_hook = alc_default_init;
11899 
11900 	switch (codec->core.vendor_id) {
11901 	case 0x10ec0269:
11902 		spec->codec_variant = ALC269_TYPE_ALC269VA;
11903 		switch (alc_get_coef0(codec) & 0x00f0) {
11904 		case 0x0010:
11905 			if (codec->bus->pci &&
11906 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
11907 			    spec->cdefine.platform_type == 1)
11908 				err = alc_codec_rename(codec, "ALC271X");
11909 			spec->codec_variant = ALC269_TYPE_ALC269VB;
11910 			break;
11911 		case 0x0020:
11912 			if (codec->bus->pci &&
11913 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
11914 			    codec->bus->pci->subsystem_device == 0x21f3)
11915 				err = alc_codec_rename(codec, "ALC3202");
11916 			spec->codec_variant = ALC269_TYPE_ALC269VC;
11917 			break;
11918 		case 0x0030:
11919 			spec->codec_variant = ALC269_TYPE_ALC269VD;
11920 			break;
11921 		default:
11922 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
11923 		}
11924 		if (err < 0)
11925 			goto error;
11926 		spec->shutup = alc269_shutup;
11927 		spec->init_hook = alc269_fill_coef;
11928 		alc269_fill_coef(codec);
11929 		break;
11930 
11931 	case 0x10ec0280:
11932 	case 0x10ec0290:
11933 		spec->codec_variant = ALC269_TYPE_ALC280;
11934 		break;
11935 	case 0x10ec0282:
11936 		spec->codec_variant = ALC269_TYPE_ALC282;
11937 		spec->shutup = alc282_shutup;
11938 		spec->init_hook = alc282_init;
11939 		break;
11940 	case 0x10ec0233:
11941 	case 0x10ec0283:
11942 		spec->codec_variant = ALC269_TYPE_ALC283;
11943 		spec->shutup = alc283_shutup;
11944 		spec->init_hook = alc283_init;
11945 		break;
11946 	case 0x10ec0284:
11947 	case 0x10ec0292:
11948 		spec->codec_variant = ALC269_TYPE_ALC284;
11949 		break;
11950 	case 0x10ec0293:
11951 		spec->codec_variant = ALC269_TYPE_ALC293;
11952 		break;
11953 	case 0x10ec0286:
11954 	case 0x10ec0288:
11955 		spec->codec_variant = ALC269_TYPE_ALC286;
11956 		break;
11957 	case 0x10ec0298:
11958 		spec->codec_variant = ALC269_TYPE_ALC298;
11959 		break;
11960 	case 0x10ec0235:
11961 	case 0x10ec0255:
11962 		spec->codec_variant = ALC269_TYPE_ALC255;
11963 		spec->shutup = alc256_shutup;
11964 		spec->init_hook = alc256_init;
11965 		break;
11966 	case 0x10ec0230:
11967 	case 0x10ec0236:
11968 	case 0x10ec0256:
11969 	case 0x19e58326:
11970 		spec->codec_variant = ALC269_TYPE_ALC256;
11971 		spec->shutup = alc256_shutup;
11972 		spec->init_hook = alc256_init;
11973 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
11974 		if (codec->core.vendor_id == 0x10ec0236 &&
11975 		    codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
11976 			spec->en_3kpull_low = false;
11977 		break;
11978 	case 0x10ec0257:
11979 		spec->codec_variant = ALC269_TYPE_ALC257;
11980 		spec->shutup = alc256_shutup;
11981 		spec->init_hook = alc256_init;
11982 		spec->gen.mixer_nid = 0;
11983 		spec->en_3kpull_low = false;
11984 		break;
11985 	case 0x10ec0215:
11986 	case 0x10ec0245:
11987 	case 0x10ec0285:
11988 	case 0x10ec0289:
11989 		if (alc_get_coef0(codec) & 0x0010)
11990 			spec->codec_variant = ALC269_TYPE_ALC245;
11991 		else
11992 			spec->codec_variant = ALC269_TYPE_ALC215;
11993 		spec->shutup = alc225_shutup;
11994 		spec->init_hook = alc225_init;
11995 		spec->gen.mixer_nid = 0;
11996 		break;
11997 	case 0x10ec0225:
11998 	case 0x10ec0295:
11999 	case 0x10ec0299:
12000 		spec->codec_variant = ALC269_TYPE_ALC225;
12001 		spec->shutup = alc225_shutup;
12002 		spec->init_hook = alc225_init;
12003 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
12004 		break;
12005 	case 0x10ec0287:
12006 		spec->codec_variant = ALC269_TYPE_ALC287;
12007 		spec->shutup = alc225_shutup;
12008 		spec->init_hook = alc225_init;
12009 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
12010 		break;
12011 	case 0x10ec0234:
12012 	case 0x10ec0274:
12013 	case 0x10ec0294:
12014 		spec->codec_variant = ALC269_TYPE_ALC294;
12015 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
12016 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
12017 		spec->init_hook = alc294_init;
12018 		break;
12019 	case 0x10ec0300:
12020 		spec->codec_variant = ALC269_TYPE_ALC300;
12021 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
12022 		break;
12023 	case 0x10ec0222:
12024 	case 0x10ec0623:
12025 		spec->codec_variant = ALC269_TYPE_ALC623;
12026 		spec->shutup = alc222_shutup;
12027 		spec->init_hook = alc222_init;
12028 		break;
12029 	case 0x10ec0700:
12030 	case 0x10ec0701:
12031 	case 0x10ec0703:
12032 	case 0x10ec0711:
12033 		spec->codec_variant = ALC269_TYPE_ALC700;
12034 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
12035 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
12036 		spec->init_hook = alc294_init;
12037 		break;
12038 
12039 	}
12040 
12041 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
12042 		spec->has_alc5505_dsp = 1;
12043 		spec->init_hook = alc5505_dsp_init;
12044 	}
12045 
12046 	alc_pre_init(codec);
12047 
12048 	snd_hda_pick_fixup(codec, alc269_fixup_models,
12049 		       alc269_fixup_tbl, alc269_fixups);
12050 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
12051 	 * the quirk breaks the latter (bko#214101).
12052 	 * Clear the wrong entry.
12053 	 */
12054 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
12055 	    codec->core.vendor_id == 0x10ec0294) {
12056 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
12057 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
12058 	}
12059 
12060 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
12061 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
12062 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
12063 			   alc269_fixups);
12064 
12065 	/*
12066 	 * Check whether ACPI describes companion amplifiers that require
12067 	 * component binding
12068 	 */
12069 	find_cirrus_companion_amps(codec);
12070 
12071 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12072 
12073 	alc_auto_parse_customize_define(codec);
12074 
12075 	if (has_cdefine_beep(codec))
12076 		spec->gen.beep_nid = 0x01;
12077 
12078 	/* automatic parse from the BIOS config */
12079 	err = alc269_parse_auto_config(codec);
12080 	if (err < 0)
12081 		goto error;
12082 
12083 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
12084 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
12085 		if (err < 0)
12086 			goto error;
12087 	}
12088 
12089 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12090 
12091 	return 0;
12092 
12093  error:
12094 	alc_free(codec);
12095 	return err;
12096 }
12097 
12098 /*
12099  * ALC861
12100  */
12101 
alc861_parse_auto_config(struct hda_codec * codec)12102 static int alc861_parse_auto_config(struct hda_codec *codec)
12103 {
12104 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
12105 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
12106 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
12107 }
12108 
12109 /* Pin config fixes */
12110 enum {
12111 	ALC861_FIXUP_FSC_AMILO_PI1505,
12112 	ALC861_FIXUP_AMP_VREF_0F,
12113 	ALC861_FIXUP_NO_JACK_DETECT,
12114 	ALC861_FIXUP_ASUS_A6RP,
12115 	ALC660_FIXUP_ASUS_W7J,
12116 };
12117 
12118 /* 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)12119 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
12120 			const struct hda_fixup *fix, int action)
12121 {
12122 	struct alc_spec *spec = codec->spec;
12123 	unsigned int val;
12124 
12125 	if (action != HDA_FIXUP_ACT_INIT)
12126 		return;
12127 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
12128 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
12129 		val |= AC_PINCTL_IN_EN;
12130 	val |= AC_PINCTL_VREF_50;
12131 	snd_hda_set_pin_ctl(codec, 0x0f, val);
12132 	spec->gen.keep_vref_in_automute = 1;
12133 }
12134 
12135 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)12136 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
12137 				     const struct hda_fixup *fix, int action)
12138 {
12139 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
12140 		codec->no_jack_detect = 1;
12141 }
12142 
12143 static const struct hda_fixup alc861_fixups[] = {
12144 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
12145 		.type = HDA_FIXUP_PINS,
12146 		.v.pins = (const struct hda_pintbl[]) {
12147 			{ 0x0b, 0x0221101f }, /* HP */
12148 			{ 0x0f, 0x90170310 }, /* speaker */
12149 			{ }
12150 		}
12151 	},
12152 	[ALC861_FIXUP_AMP_VREF_0F] = {
12153 		.type = HDA_FIXUP_FUNC,
12154 		.v.func = alc861_fixup_asus_amp_vref_0f,
12155 	},
12156 	[ALC861_FIXUP_NO_JACK_DETECT] = {
12157 		.type = HDA_FIXUP_FUNC,
12158 		.v.func = alc_fixup_no_jack_detect,
12159 	},
12160 	[ALC861_FIXUP_ASUS_A6RP] = {
12161 		.type = HDA_FIXUP_FUNC,
12162 		.v.func = alc861_fixup_asus_amp_vref_0f,
12163 		.chained = true,
12164 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
12165 	},
12166 	[ALC660_FIXUP_ASUS_W7J] = {
12167 		.type = HDA_FIXUP_VERBS,
12168 		.v.verbs = (const struct hda_verb[]) {
12169 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
12170 			 * for enabling outputs
12171 			 */
12172 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12173 			{ }
12174 		},
12175 	}
12176 };
12177 
12178 static const struct hda_quirk alc861_fixup_tbl[] = {
12179 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
12180 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
12181 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
12182 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
12183 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
12184 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
12185 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
12186 	{}
12187 };
12188 
12189 /*
12190  */
patch_alc861(struct hda_codec * codec)12191 static int patch_alc861(struct hda_codec *codec)
12192 {
12193 	struct alc_spec *spec;
12194 	int err;
12195 
12196 	err = alc_alloc_spec(codec, 0x15);
12197 	if (err < 0)
12198 		return err;
12199 
12200 	spec = codec->spec;
12201 	if (has_cdefine_beep(codec))
12202 		spec->gen.beep_nid = 0x23;
12203 
12204 	spec->power_hook = alc_power_eapd;
12205 
12206 	alc_pre_init(codec);
12207 
12208 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
12209 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12210 
12211 	/* automatic parse from the BIOS config */
12212 	err = alc861_parse_auto_config(codec);
12213 	if (err < 0)
12214 		goto error;
12215 
12216 	if (!spec->gen.no_analog) {
12217 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
12218 		if (err < 0)
12219 			goto error;
12220 	}
12221 
12222 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12223 
12224 	return 0;
12225 
12226  error:
12227 	alc_free(codec);
12228 	return err;
12229 }
12230 
12231 /*
12232  * ALC861-VD support
12233  *
12234  * Based on ALC882
12235  *
12236  * In addition, an independent DAC
12237  */
alc861vd_parse_auto_config(struct hda_codec * codec)12238 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12239 {
12240 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12241 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
12242 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
12243 }
12244 
12245 enum {
12246 	ALC660VD_FIX_ASUS_GPIO1,
12247 	ALC861VD_FIX_DALLAS,
12248 };
12249 
12250 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)12251 static void alc861vd_fixup_dallas(struct hda_codec *codec,
12252 				  const struct hda_fixup *fix, int action)
12253 {
12254 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12255 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
12256 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
12257 	}
12258 }
12259 
12260 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)12261 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
12262 				      const struct hda_fixup *fix, int action)
12263 {
12264 	struct alc_spec *spec = codec->spec;
12265 
12266 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
12267 		spec->gpio_mask |= 0x02;
12268 	alc_fixup_gpio(codec, action, 0x01);
12269 }
12270 
12271 static const struct hda_fixup alc861vd_fixups[] = {
12272 	[ALC660VD_FIX_ASUS_GPIO1] = {
12273 		.type = HDA_FIXUP_FUNC,
12274 		.v.func = alc660vd_fixup_asus_gpio1,
12275 	},
12276 	[ALC861VD_FIX_DALLAS] = {
12277 		.type = HDA_FIXUP_FUNC,
12278 		.v.func = alc861vd_fixup_dallas,
12279 	},
12280 };
12281 
12282 static const struct hda_quirk alc861vd_fixup_tbl[] = {
12283 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
12284 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
12285 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
12286 	{}
12287 };
12288 
12289 /*
12290  */
patch_alc861vd(struct hda_codec * codec)12291 static int patch_alc861vd(struct hda_codec *codec)
12292 {
12293 	struct alc_spec *spec;
12294 	int err;
12295 
12296 	err = alc_alloc_spec(codec, 0x0b);
12297 	if (err < 0)
12298 		return err;
12299 
12300 	spec = codec->spec;
12301 	if (has_cdefine_beep(codec))
12302 		spec->gen.beep_nid = 0x23;
12303 
12304 	spec->shutup = alc_eapd_shutup;
12305 
12306 	alc_pre_init(codec);
12307 
12308 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
12309 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12310 
12311 	/* automatic parse from the BIOS config */
12312 	err = alc861vd_parse_auto_config(codec);
12313 	if (err < 0)
12314 		goto error;
12315 
12316 	if (!spec->gen.no_analog) {
12317 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12318 		if (err < 0)
12319 			goto error;
12320 	}
12321 
12322 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12323 
12324 	return 0;
12325 
12326  error:
12327 	alc_free(codec);
12328 	return err;
12329 }
12330 
12331 /*
12332  * ALC662 support
12333  *
12334  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12335  * configuration.  Each pin widget can choose any input DACs and a mixer.
12336  * Each ADC is connected from a mixer of all inputs.  This makes possible
12337  * 6-channel independent captures.
12338  *
12339  * In addition, an independent DAC for the multi-playback (not used in this
12340  * driver yet).
12341  */
12342 
12343 /*
12344  * BIOS auto configuration
12345  */
12346 
alc662_parse_auto_config(struct hda_codec * codec)12347 static int alc662_parse_auto_config(struct hda_codec *codec)
12348 {
12349 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
12350 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
12351 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
12352 	const hda_nid_t *ssids;
12353 
12354 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
12355 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
12356 	    codec->core.vendor_id == 0x10ec0671)
12357 		ssids = alc663_ssids;
12358 	else
12359 		ssids = alc662_ssids;
12360 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
12361 }
12362 
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)12363 static void alc272_fixup_mario(struct hda_codec *codec,
12364 			       const struct hda_fixup *fix, int action)
12365 {
12366 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
12367 		return;
12368 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
12369 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
12370 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
12371 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12372 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
12373 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
12374 }
12375 
12376 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
12377 	{ .channels = 2,
12378 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
12379 	{ .channels = 4,
12380 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
12381 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
12382 	{ }
12383 };
12384 
12385 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)12386 static void alc_fixup_bass_chmap(struct hda_codec *codec,
12387 				    const struct hda_fixup *fix, int action)
12388 {
12389 	if (action == HDA_FIXUP_ACT_BUILD) {
12390 		struct alc_spec *spec = codec->spec;
12391 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
12392 	}
12393 }
12394 
12395 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)12396 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
12397 					  hda_nid_t nid,
12398 					  unsigned int power_state)
12399 {
12400 	struct alc_spec *spec = codec->spec;
12401 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
12402 		return AC_PWRST_D0;
12403 	return power_state;
12404 }
12405 
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)12406 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
12407 				   const struct hda_fixup *fix, int action)
12408 {
12409 	struct alc_spec *spec = codec->spec;
12410 
12411 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
12412 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12413 		spec->mute_led_polarity = 1;
12414 		codec->power_filter = gpio_led_power_filter;
12415 	}
12416 }
12417 
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)12418 static void alc662_usi_automute_hook(struct hda_codec *codec,
12419 					 struct hda_jack_callback *jack)
12420 {
12421 	struct alc_spec *spec = codec->spec;
12422 	int vref;
12423 	msleep(200);
12424 	snd_hda_gen_hp_automute(codec, jack);
12425 
12426 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
12427 	msleep(100);
12428 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
12429 			    vref);
12430 }
12431 
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)12432 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
12433 				     const struct hda_fixup *fix, int action)
12434 {
12435 	struct alc_spec *spec = codec->spec;
12436 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12437 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12438 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
12439 	}
12440 }
12441 
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)12442 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
12443 					struct hda_jack_callback *cb)
12444 {
12445 	/* surround speakers at 0x1b already get muted automatically when
12446 	 * headphones are plugged in, but we have to mute/unmute the remaining
12447 	 * channels manually:
12448 	 * 0x15 - front left/front right
12449 	 * 0x18 - front center/ LFE
12450 	 */
12451 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
12452 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
12453 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
12454 	} else {
12455 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
12456 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
12457 	}
12458 }
12459 
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)12460 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
12461 					const struct hda_fixup *fix, int action)
12462 {
12463     /* Pin 0x1b: shared headphones jack and surround speakers */
12464 	if (!is_jack_detectable(codec, 0x1b))
12465 		return;
12466 
12467 	switch (action) {
12468 	case HDA_FIXUP_ACT_PRE_PROBE:
12469 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
12470 				alc662_aspire_ethos_mute_speakers);
12471 		/* subwoofer needs an extra GPIO setting to become audible */
12472 		alc_setup_gpio(codec, 0x02);
12473 		break;
12474 	case HDA_FIXUP_ACT_INIT:
12475 		/* Make sure to start in a correct state, i.e. if
12476 		 * headphones have been plugged in before powering up the system
12477 		 */
12478 		alc662_aspire_ethos_mute_speakers(codec, NULL);
12479 		break;
12480 	}
12481 }
12482 
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)12483 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
12484 					     const struct hda_fixup *fix, int action)
12485 {
12486 	struct alc_spec *spec = codec->spec;
12487 
12488 	static const struct hda_pintbl pincfgs[] = {
12489 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
12490 		{ 0x1b, 0x0181304f },
12491 		{ }
12492 	};
12493 
12494 	switch (action) {
12495 	case HDA_FIXUP_ACT_PRE_PROBE:
12496 		spec->gen.mixer_nid = 0;
12497 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12498 		snd_hda_apply_pincfgs(codec, pincfgs);
12499 		break;
12500 	case HDA_FIXUP_ACT_INIT:
12501 		alc_write_coef_idx(codec, 0x19, 0xa054);
12502 		break;
12503 	}
12504 }
12505 
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)12506 static void alc897_hp_automute_hook(struct hda_codec *codec,
12507 					 struct hda_jack_callback *jack)
12508 {
12509 	struct alc_spec *spec = codec->spec;
12510 	int vref;
12511 
12512 	snd_hda_gen_hp_automute(codec, jack);
12513 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
12514 	snd_hda_set_pin_ctl(codec, 0x1b, vref);
12515 }
12516 
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)12517 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
12518 				     const struct hda_fixup *fix, int action)
12519 {
12520 	struct alc_spec *spec = codec->spec;
12521 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12522 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
12523 		spec->no_shutup_pins = 1;
12524 	}
12525 	if (action == HDA_FIXUP_ACT_PROBE) {
12526 		snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
12527 	}
12528 }
12529 
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)12530 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
12531 				     const struct hda_fixup *fix, int action)
12532 {
12533 	struct alc_spec *spec = codec->spec;
12534 
12535 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12536 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12537 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
12538 	}
12539 }
12540 
12541 static const struct coef_fw alc668_coefs[] = {
12542 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
12543 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
12544 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
12545 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
12546 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
12547 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
12548 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
12549 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
12550 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
12551 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
12552 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
12553 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
12554 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
12555 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
12556 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
12557 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
12558 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
12559 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
12560 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
12561 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
12562 	{}
12563 };
12564 
alc668_restore_default_value(struct hda_codec * codec)12565 static void alc668_restore_default_value(struct hda_codec *codec)
12566 {
12567 	alc_process_coef_fw(codec, alc668_coefs);
12568 }
12569 
12570 enum {
12571 	ALC662_FIXUP_ASPIRE,
12572 	ALC662_FIXUP_LED_GPIO1,
12573 	ALC662_FIXUP_IDEAPAD,
12574 	ALC272_FIXUP_MARIO,
12575 	ALC662_FIXUP_CZC_ET26,
12576 	ALC662_FIXUP_CZC_P10T,
12577 	ALC662_FIXUP_SKU_IGNORE,
12578 	ALC662_FIXUP_HP_RP5800,
12579 	ALC662_FIXUP_ASUS_MODE1,
12580 	ALC662_FIXUP_ASUS_MODE2,
12581 	ALC662_FIXUP_ASUS_MODE3,
12582 	ALC662_FIXUP_ASUS_MODE4,
12583 	ALC662_FIXUP_ASUS_MODE5,
12584 	ALC662_FIXUP_ASUS_MODE6,
12585 	ALC662_FIXUP_ASUS_MODE7,
12586 	ALC662_FIXUP_ASUS_MODE8,
12587 	ALC662_FIXUP_NO_JACK_DETECT,
12588 	ALC662_FIXUP_ZOTAC_Z68,
12589 	ALC662_FIXUP_INV_DMIC,
12590 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12591 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
12592 	ALC662_FIXUP_HEADSET_MODE,
12593 	ALC668_FIXUP_HEADSET_MODE,
12594 	ALC662_FIXUP_BASS_MODE4_CHMAP,
12595 	ALC662_FIXUP_BASS_16,
12596 	ALC662_FIXUP_BASS_1A,
12597 	ALC662_FIXUP_BASS_CHMAP,
12598 	ALC668_FIXUP_AUTO_MUTE,
12599 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
12600 	ALC668_FIXUP_DELL_XPS13,
12601 	ALC662_FIXUP_ASUS_Nx50,
12602 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12603 	ALC668_FIXUP_ASUS_Nx51,
12604 	ALC668_FIXUP_MIC_COEF,
12605 	ALC668_FIXUP_ASUS_G751,
12606 	ALC891_FIXUP_HEADSET_MODE,
12607 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12608 	ALC662_FIXUP_ACER_VERITON,
12609 	ALC892_FIXUP_ASROCK_MOBO,
12610 	ALC662_FIXUP_USI_FUNC,
12611 	ALC662_FIXUP_USI_HEADSET_MODE,
12612 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
12613 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
12614 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
12615 	ALC671_FIXUP_HP_HEADSET_MIC2,
12616 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
12617 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
12618 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
12619 	ALC668_FIXUP_HEADSET_MIC,
12620 	ALC668_FIXUP_MIC_DET_COEF,
12621 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
12622 	ALC897_FIXUP_HEADSET_MIC_PIN,
12623 	ALC897_FIXUP_HP_HSMIC_VERB,
12624 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
12625 	ALC897_FIXUP_HEADSET_MIC_PIN2,
12626 	ALC897_FIXUP_UNIS_H3C_X500S,
12627 	ALC897_FIXUP_HEADSET_MIC_PIN3,
12628 };
12629 
12630 static const struct hda_fixup alc662_fixups[] = {
12631 	[ALC662_FIXUP_ASPIRE] = {
12632 		.type = HDA_FIXUP_PINS,
12633 		.v.pins = (const struct hda_pintbl[]) {
12634 			{ 0x15, 0x99130112 }, /* subwoofer */
12635 			{ }
12636 		}
12637 	},
12638 	[ALC662_FIXUP_LED_GPIO1] = {
12639 		.type = HDA_FIXUP_FUNC,
12640 		.v.func = alc662_fixup_led_gpio1,
12641 	},
12642 	[ALC662_FIXUP_IDEAPAD] = {
12643 		.type = HDA_FIXUP_PINS,
12644 		.v.pins = (const struct hda_pintbl[]) {
12645 			{ 0x17, 0x99130112 }, /* subwoofer */
12646 			{ }
12647 		},
12648 		.chained = true,
12649 		.chain_id = ALC662_FIXUP_LED_GPIO1,
12650 	},
12651 	[ALC272_FIXUP_MARIO] = {
12652 		.type = HDA_FIXUP_FUNC,
12653 		.v.func = alc272_fixup_mario,
12654 	},
12655 	[ALC662_FIXUP_CZC_ET26] = {
12656 		.type = HDA_FIXUP_PINS,
12657 		.v.pins = (const struct hda_pintbl[]) {
12658 			{0x12, 0x403cc000},
12659 			{0x14, 0x90170110}, /* speaker */
12660 			{0x15, 0x411111f0},
12661 			{0x16, 0x411111f0},
12662 			{0x18, 0x01a19030}, /* mic */
12663 			{0x19, 0x90a7013f}, /* int-mic */
12664 			{0x1a, 0x01014020},
12665 			{0x1b, 0x0121401f},
12666 			{0x1c, 0x411111f0},
12667 			{0x1d, 0x411111f0},
12668 			{0x1e, 0x40478e35},
12669 			{}
12670 		},
12671 		.chained = true,
12672 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12673 	},
12674 	[ALC662_FIXUP_CZC_P10T] = {
12675 		.type = HDA_FIXUP_VERBS,
12676 		.v.verbs = (const struct hda_verb[]) {
12677 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
12678 			{}
12679 		}
12680 	},
12681 	[ALC662_FIXUP_SKU_IGNORE] = {
12682 		.type = HDA_FIXUP_FUNC,
12683 		.v.func = alc_fixup_sku_ignore,
12684 	},
12685 	[ALC662_FIXUP_HP_RP5800] = {
12686 		.type = HDA_FIXUP_PINS,
12687 		.v.pins = (const struct hda_pintbl[]) {
12688 			{ 0x14, 0x0221201f }, /* HP out */
12689 			{ }
12690 		},
12691 		.chained = true,
12692 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12693 	},
12694 	[ALC662_FIXUP_ASUS_MODE1] = {
12695 		.type = HDA_FIXUP_PINS,
12696 		.v.pins = (const struct hda_pintbl[]) {
12697 			{ 0x14, 0x99130110 }, /* speaker */
12698 			{ 0x18, 0x01a19c20 }, /* mic */
12699 			{ 0x19, 0x99a3092f }, /* int-mic */
12700 			{ 0x21, 0x0121401f }, /* HP out */
12701 			{ }
12702 		},
12703 		.chained = true,
12704 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12705 	},
12706 	[ALC662_FIXUP_ASUS_MODE2] = {
12707 		.type = HDA_FIXUP_PINS,
12708 		.v.pins = (const struct hda_pintbl[]) {
12709 			{ 0x14, 0x99130110 }, /* speaker */
12710 			{ 0x18, 0x01a19820 }, /* mic */
12711 			{ 0x19, 0x99a3092f }, /* int-mic */
12712 			{ 0x1b, 0x0121401f }, /* HP out */
12713 			{ }
12714 		},
12715 		.chained = true,
12716 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12717 	},
12718 	[ALC662_FIXUP_ASUS_MODE3] = {
12719 		.type = HDA_FIXUP_PINS,
12720 		.v.pins = (const struct hda_pintbl[]) {
12721 			{ 0x14, 0x99130110 }, /* speaker */
12722 			{ 0x15, 0x0121441f }, /* HP */
12723 			{ 0x18, 0x01a19840 }, /* mic */
12724 			{ 0x19, 0x99a3094f }, /* int-mic */
12725 			{ 0x21, 0x01211420 }, /* HP2 */
12726 			{ }
12727 		},
12728 		.chained = true,
12729 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12730 	},
12731 	[ALC662_FIXUP_ASUS_MODE4] = {
12732 		.type = HDA_FIXUP_PINS,
12733 		.v.pins = (const struct hda_pintbl[]) {
12734 			{ 0x14, 0x99130110 }, /* speaker */
12735 			{ 0x16, 0x99130111 }, /* speaker */
12736 			{ 0x18, 0x01a19840 }, /* mic */
12737 			{ 0x19, 0x99a3094f }, /* int-mic */
12738 			{ 0x21, 0x0121441f }, /* HP */
12739 			{ }
12740 		},
12741 		.chained = true,
12742 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12743 	},
12744 	[ALC662_FIXUP_ASUS_MODE5] = {
12745 		.type = HDA_FIXUP_PINS,
12746 		.v.pins = (const struct hda_pintbl[]) {
12747 			{ 0x14, 0x99130110 }, /* speaker */
12748 			{ 0x15, 0x0121441f }, /* HP */
12749 			{ 0x16, 0x99130111 }, /* speaker */
12750 			{ 0x18, 0x01a19840 }, /* mic */
12751 			{ 0x19, 0x99a3094f }, /* int-mic */
12752 			{ }
12753 		},
12754 		.chained = true,
12755 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12756 	},
12757 	[ALC662_FIXUP_ASUS_MODE6] = {
12758 		.type = HDA_FIXUP_PINS,
12759 		.v.pins = (const struct hda_pintbl[]) {
12760 			{ 0x14, 0x99130110 }, /* speaker */
12761 			{ 0x15, 0x01211420 }, /* HP2 */
12762 			{ 0x18, 0x01a19840 }, /* mic */
12763 			{ 0x19, 0x99a3094f }, /* int-mic */
12764 			{ 0x1b, 0x0121441f }, /* HP */
12765 			{ }
12766 		},
12767 		.chained = true,
12768 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12769 	},
12770 	[ALC662_FIXUP_ASUS_MODE7] = {
12771 		.type = HDA_FIXUP_PINS,
12772 		.v.pins = (const struct hda_pintbl[]) {
12773 			{ 0x14, 0x99130110 }, /* speaker */
12774 			{ 0x17, 0x99130111 }, /* speaker */
12775 			{ 0x18, 0x01a19840 }, /* mic */
12776 			{ 0x19, 0x99a3094f }, /* int-mic */
12777 			{ 0x1b, 0x01214020 }, /* HP */
12778 			{ 0x21, 0x0121401f }, /* HP */
12779 			{ }
12780 		},
12781 		.chained = true,
12782 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12783 	},
12784 	[ALC662_FIXUP_ASUS_MODE8] = {
12785 		.type = HDA_FIXUP_PINS,
12786 		.v.pins = (const struct hda_pintbl[]) {
12787 			{ 0x14, 0x99130110 }, /* speaker */
12788 			{ 0x12, 0x99a30970 }, /* int-mic */
12789 			{ 0x15, 0x01214020 }, /* HP */
12790 			{ 0x17, 0x99130111 }, /* speaker */
12791 			{ 0x18, 0x01a19840 }, /* mic */
12792 			{ 0x21, 0x0121401f }, /* HP */
12793 			{ }
12794 		},
12795 		.chained = true,
12796 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12797 	},
12798 	[ALC662_FIXUP_NO_JACK_DETECT] = {
12799 		.type = HDA_FIXUP_FUNC,
12800 		.v.func = alc_fixup_no_jack_detect,
12801 	},
12802 	[ALC662_FIXUP_ZOTAC_Z68] = {
12803 		.type = HDA_FIXUP_PINS,
12804 		.v.pins = (const struct hda_pintbl[]) {
12805 			{ 0x1b, 0x02214020 }, /* Front HP */
12806 			{ }
12807 		}
12808 	},
12809 	[ALC662_FIXUP_INV_DMIC] = {
12810 		.type = HDA_FIXUP_FUNC,
12811 		.v.func = alc_fixup_inv_dmic,
12812 	},
12813 	[ALC668_FIXUP_DELL_XPS13] = {
12814 		.type = HDA_FIXUP_FUNC,
12815 		.v.func = alc_fixup_dell_xps13,
12816 		.chained = true,
12817 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12818 	},
12819 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12820 		.type = HDA_FIXUP_FUNC,
12821 		.v.func = alc_fixup_disable_aamix,
12822 		.chained = true,
12823 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12824 	},
12825 	[ALC668_FIXUP_AUTO_MUTE] = {
12826 		.type = HDA_FIXUP_FUNC,
12827 		.v.func = alc_fixup_auto_mute_via_amp,
12828 		.chained = true,
12829 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12830 	},
12831 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12832 		.type = HDA_FIXUP_PINS,
12833 		.v.pins = (const struct hda_pintbl[]) {
12834 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12835 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12836 			{ }
12837 		},
12838 		.chained = true,
12839 		.chain_id = ALC662_FIXUP_HEADSET_MODE
12840 	},
12841 	[ALC662_FIXUP_HEADSET_MODE] = {
12842 		.type = HDA_FIXUP_FUNC,
12843 		.v.func = alc_fixup_headset_mode_alc662,
12844 	},
12845 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12846 		.type = HDA_FIXUP_PINS,
12847 		.v.pins = (const struct hda_pintbl[]) {
12848 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12849 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12850 			{ }
12851 		},
12852 		.chained = true,
12853 		.chain_id = ALC668_FIXUP_HEADSET_MODE
12854 	},
12855 	[ALC668_FIXUP_HEADSET_MODE] = {
12856 		.type = HDA_FIXUP_FUNC,
12857 		.v.func = alc_fixup_headset_mode_alc668,
12858 	},
12859 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12860 		.type = HDA_FIXUP_FUNC,
12861 		.v.func = alc_fixup_bass_chmap,
12862 		.chained = true,
12863 		.chain_id = ALC662_FIXUP_ASUS_MODE4
12864 	},
12865 	[ALC662_FIXUP_BASS_16] = {
12866 		.type = HDA_FIXUP_PINS,
12867 		.v.pins = (const struct hda_pintbl[]) {
12868 			{0x16, 0x80106111}, /* bass speaker */
12869 			{}
12870 		},
12871 		.chained = true,
12872 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12873 	},
12874 	[ALC662_FIXUP_BASS_1A] = {
12875 		.type = HDA_FIXUP_PINS,
12876 		.v.pins = (const struct hda_pintbl[]) {
12877 			{0x1a, 0x80106111}, /* bass speaker */
12878 			{}
12879 		},
12880 		.chained = true,
12881 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12882 	},
12883 	[ALC662_FIXUP_BASS_CHMAP] = {
12884 		.type = HDA_FIXUP_FUNC,
12885 		.v.func = alc_fixup_bass_chmap,
12886 	},
12887 	[ALC662_FIXUP_ASUS_Nx50] = {
12888 		.type = HDA_FIXUP_FUNC,
12889 		.v.func = alc_fixup_auto_mute_via_amp,
12890 		.chained = true,
12891 		.chain_id = ALC662_FIXUP_BASS_1A
12892 	},
12893 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12894 		.type = HDA_FIXUP_FUNC,
12895 		.v.func = alc_fixup_headset_mode_alc668,
12896 		.chain_id = ALC662_FIXUP_BASS_CHMAP
12897 	},
12898 	[ALC668_FIXUP_ASUS_Nx51] = {
12899 		.type = HDA_FIXUP_PINS,
12900 		.v.pins = (const struct hda_pintbl[]) {
12901 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12902 			{ 0x1a, 0x90170151 }, /* bass speaker */
12903 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12904 			{}
12905 		},
12906 		.chained = true,
12907 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12908 	},
12909 	[ALC668_FIXUP_MIC_COEF] = {
12910 		.type = HDA_FIXUP_VERBS,
12911 		.v.verbs = (const struct hda_verb[]) {
12912 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12913 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12914 			{}
12915 		},
12916 	},
12917 	[ALC668_FIXUP_ASUS_G751] = {
12918 		.type = HDA_FIXUP_PINS,
12919 		.v.pins = (const struct hda_pintbl[]) {
12920 			{ 0x16, 0x0421101f }, /* HP */
12921 			{}
12922 		},
12923 		.chained = true,
12924 		.chain_id = ALC668_FIXUP_MIC_COEF
12925 	},
12926 	[ALC891_FIXUP_HEADSET_MODE] = {
12927 		.type = HDA_FIXUP_FUNC,
12928 		.v.func = alc_fixup_headset_mode,
12929 	},
12930 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
12931 		.type = HDA_FIXUP_PINS,
12932 		.v.pins = (const struct hda_pintbl[]) {
12933 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12934 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12935 			{ }
12936 		},
12937 		.chained = true,
12938 		.chain_id = ALC891_FIXUP_HEADSET_MODE
12939 	},
12940 	[ALC662_FIXUP_ACER_VERITON] = {
12941 		.type = HDA_FIXUP_PINS,
12942 		.v.pins = (const struct hda_pintbl[]) {
12943 			{ 0x15, 0x50170120 }, /* no internal speaker */
12944 			{ }
12945 		}
12946 	},
12947 	[ALC892_FIXUP_ASROCK_MOBO] = {
12948 		.type = HDA_FIXUP_PINS,
12949 		.v.pins = (const struct hda_pintbl[]) {
12950 			{ 0x15, 0x40f000f0 }, /* disabled */
12951 			{ 0x16, 0x40f000f0 }, /* disabled */
12952 			{ }
12953 		}
12954 	},
12955 	[ALC662_FIXUP_USI_FUNC] = {
12956 		.type = HDA_FIXUP_FUNC,
12957 		.v.func = alc662_fixup_usi_headset_mic,
12958 	},
12959 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
12960 		.type = HDA_FIXUP_PINS,
12961 		.v.pins = (const struct hda_pintbl[]) {
12962 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
12963 			{ 0x18, 0x01a1903d },
12964 			{ }
12965 		},
12966 		.chained = true,
12967 		.chain_id = ALC662_FIXUP_USI_FUNC
12968 	},
12969 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
12970 		.type = HDA_FIXUP_FUNC,
12971 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
12972 	},
12973 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
12974 		.type = HDA_FIXUP_FUNC,
12975 		.v.func = alc662_fixup_aspire_ethos_hp,
12976 	},
12977 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
12978 		.type = HDA_FIXUP_PINS,
12979 		.v.pins = (const struct hda_pintbl[]) {
12980 			{ 0x15, 0x92130110 }, /* front speakers */
12981 			{ 0x18, 0x99130111 }, /* center/subwoofer */
12982 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
12983 			{ }
12984 		},
12985 		.chained = true,
12986 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
12987 	},
12988 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
12989 		.type = HDA_FIXUP_FUNC,
12990 		.v.func = alc671_fixup_hp_headset_mic2,
12991 	},
12992 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
12993 		.type = HDA_FIXUP_PINS,
12994 		.v.pins = (const struct hda_pintbl[]) {
12995 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
12996 			{ }
12997 		},
12998 		.chained = true,
12999 		.chain_id = ALC662_FIXUP_USI_FUNC
13000 	},
13001 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
13002 		.type = HDA_FIXUP_PINS,
13003 		.v.pins = (const struct hda_pintbl[]) {
13004 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
13005 			{ 0x1b, 0x0221144f },
13006 			{ }
13007 		},
13008 		.chained = true,
13009 		.chain_id = ALC662_FIXUP_USI_FUNC
13010 	},
13011 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
13012 		.type = HDA_FIXUP_PINS,
13013 		.v.pins = (const struct hda_pintbl[]) {
13014 			{ 0x1b, 0x04a1112c },
13015 			{ }
13016 		},
13017 		.chained = true,
13018 		.chain_id = ALC668_FIXUP_HEADSET_MIC
13019 	},
13020 	[ALC668_FIXUP_HEADSET_MIC] = {
13021 		.type = HDA_FIXUP_FUNC,
13022 		.v.func = alc269_fixup_headset_mic,
13023 		.chained = true,
13024 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
13025 	},
13026 	[ALC668_FIXUP_MIC_DET_COEF] = {
13027 		.type = HDA_FIXUP_VERBS,
13028 		.v.verbs = (const struct hda_verb[]) {
13029 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
13030 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
13031 			{}
13032 		},
13033 	},
13034 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
13035 		.type = HDA_FIXUP_FUNC,
13036 		.v.func = alc897_fixup_lenovo_headset_mic,
13037 	},
13038 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
13039 		.type = HDA_FIXUP_PINS,
13040 		.v.pins = (const struct hda_pintbl[]) {
13041 			{ 0x1a, 0x03a11050 },
13042 			{ }
13043 		},
13044 		.chained = true,
13045 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
13046 	},
13047 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
13048 		.type = HDA_FIXUP_PINS,
13049 		.v.pins = (const struct hda_pintbl[]) {
13050 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
13051 			{ }
13052 		},
13053 	},
13054 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
13055 		.type = HDA_FIXUP_FUNC,
13056 		.v.func = alc897_fixup_lenovo_headset_mode,
13057 	},
13058 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
13059 		.type = HDA_FIXUP_PINS,
13060 		.v.pins = (const struct hda_pintbl[]) {
13061 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
13062 			{ }
13063 		},
13064 		.chained = true,
13065 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
13066 	},
13067 	[ALC897_FIXUP_UNIS_H3C_X500S] = {
13068 		.type = HDA_FIXUP_VERBS,
13069 		.v.verbs = (const struct hda_verb[]) {
13070 			{ 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
13071 			{}
13072 		},
13073 	},
13074 	[ALC897_FIXUP_HEADSET_MIC_PIN3] = {
13075 		.type = HDA_FIXUP_PINS,
13076 		.v.pins = (const struct hda_pintbl[]) {
13077 			{ 0x19, 0x03a11050 }, /* use as headset mic */
13078 			{ }
13079 		},
13080 	},
13081 };
13082 
13083 static const struct hda_quirk alc662_fixup_tbl[] = {
13084 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
13085 	SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
13086 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
13087 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
13088 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
13089 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
13090 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
13091 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
13092 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
13093 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
13094 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
13095 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
13096 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13097 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13098 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
13099 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
13100 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
13101 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13102 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13103 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13104 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13105 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13106 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
13107 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13108 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13109 	SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13110 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
13111 	SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
13112 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
13113 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
13114 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
13115 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
13116 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
13117 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
13118 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
13119 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
13120 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
13121 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
13122 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
13123 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
13124 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
13125 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
13126 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
13127 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
13128 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
13129 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
13130 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
13131 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
13132 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
13133 	SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
13134 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
13135 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
13136 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
13137 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
13138 	SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
13139 	SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
13140 	SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
13141 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
13142 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
13143 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
13144 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
13145 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
13146 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
13147 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
13148 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
13149 	SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
13150 
13151 #if 0
13152 	/* Below is a quirk table taken from the old code.
13153 	 * Basically the device should work as is without the fixup table.
13154 	 * If BIOS doesn't give a proper info, enable the corresponding
13155 	 * fixup entry.
13156 	 */
13157 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
13158 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
13159 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
13160 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
13161 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13162 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13163 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13164 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
13165 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
13166 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13167 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
13168 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
13169 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
13170 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
13171 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
13172 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13173 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
13174 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
13175 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13176 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13177 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13178 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13179 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
13180 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
13181 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
13182 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13183 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
13184 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13185 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13186 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
13187 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13188 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13189 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
13190 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
13191 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
13192 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
13193 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
13194 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
13195 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
13196 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13197 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
13198 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
13199 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13200 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
13201 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
13202 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
13203 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
13204 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
13205 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13206 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
13207 #endif
13208 	{}
13209 };
13210 
13211 static const struct hda_model_fixup alc662_fixup_models[] = {
13212 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
13213 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
13214 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
13215 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
13216 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
13217 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
13218 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
13219 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
13220 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
13221 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
13222 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
13223 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
13224 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
13225 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
13226 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
13227 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
13228 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
13229 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
13230 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
13231 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
13232 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
13233 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
13234 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
13235 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
13236 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
13237 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
13238 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
13239 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
13240 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
13241 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
13242 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
13243 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
13244 	{.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
13245 	{}
13246 };
13247 
13248 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
13249 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
13250 		{0x17, 0x02211010},
13251 		{0x18, 0x01a19030},
13252 		{0x1a, 0x01813040},
13253 		{0x21, 0x01014020}),
13254 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
13255 		{0x16, 0x01813030},
13256 		{0x17, 0x02211010},
13257 		{0x18, 0x01a19040},
13258 		{0x21, 0x01014020}),
13259 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
13260 		{0x14, 0x01014010},
13261 		{0x18, 0x01a19020},
13262 		{0x1a, 0x0181302f},
13263 		{0x1b, 0x0221401f}),
13264 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13265 		{0x12, 0x99a30130},
13266 		{0x14, 0x90170110},
13267 		{0x15, 0x0321101f},
13268 		{0x16, 0x03011020}),
13269 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13270 		{0x12, 0x99a30140},
13271 		{0x14, 0x90170110},
13272 		{0x15, 0x0321101f},
13273 		{0x16, 0x03011020}),
13274 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13275 		{0x12, 0x99a30150},
13276 		{0x14, 0x90170110},
13277 		{0x15, 0x0321101f},
13278 		{0x16, 0x03011020}),
13279 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13280 		{0x14, 0x90170110},
13281 		{0x15, 0x0321101f},
13282 		{0x16, 0x03011020}),
13283 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
13284 		{0x12, 0x90a60130},
13285 		{0x14, 0x90170110},
13286 		{0x15, 0x0321101f}),
13287 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13288 		{0x14, 0x01014010},
13289 		{0x17, 0x90170150},
13290 		{0x19, 0x02a11060},
13291 		{0x1b, 0x01813030},
13292 		{0x21, 0x02211020}),
13293 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13294 		{0x14, 0x01014010},
13295 		{0x18, 0x01a19040},
13296 		{0x1b, 0x01813030},
13297 		{0x21, 0x02211020}),
13298 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13299 		{0x14, 0x01014020},
13300 		{0x17, 0x90170110},
13301 		{0x18, 0x01a19050},
13302 		{0x1b, 0x01813040},
13303 		{0x21, 0x02211030}),
13304 	{}
13305 };
13306 
13307 /*
13308  */
patch_alc662(struct hda_codec * codec)13309 static int patch_alc662(struct hda_codec *codec)
13310 {
13311 	struct alc_spec *spec;
13312 	int err;
13313 
13314 	err = alc_alloc_spec(codec, 0x0b);
13315 	if (err < 0)
13316 		return err;
13317 
13318 	spec = codec->spec;
13319 
13320 	spec->shutup = alc_eapd_shutup;
13321 
13322 	/* handle multiple HPs as is */
13323 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
13324 
13325 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
13326 
13327 	switch (codec->core.vendor_id) {
13328 	case 0x10ec0668:
13329 		spec->init_hook = alc668_restore_default_value;
13330 		break;
13331 	}
13332 
13333 	alc_pre_init(codec);
13334 
13335 	snd_hda_pick_fixup(codec, alc662_fixup_models,
13336 		       alc662_fixup_tbl, alc662_fixups);
13337 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
13338 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
13339 
13340 	alc_auto_parse_customize_define(codec);
13341 
13342 	if (has_cdefine_beep(codec))
13343 		spec->gen.beep_nid = 0x01;
13344 
13345 	if ((alc_get_coef0(codec) & (1 << 14)) &&
13346 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
13347 	    spec->cdefine.platform_type == 1) {
13348 		err = alc_codec_rename(codec, "ALC272X");
13349 		if (err < 0)
13350 			goto error;
13351 	}
13352 
13353 	/* automatic parse from the BIOS config */
13354 	err = alc662_parse_auto_config(codec);
13355 	if (err < 0)
13356 		goto error;
13357 
13358 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
13359 		switch (codec->core.vendor_id) {
13360 		case 0x10ec0662:
13361 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13362 			break;
13363 		case 0x10ec0272:
13364 		case 0x10ec0663:
13365 		case 0x10ec0665:
13366 		case 0x10ec0668:
13367 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13368 			break;
13369 		case 0x10ec0273:
13370 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
13371 			break;
13372 		}
13373 		if (err < 0)
13374 			goto error;
13375 	}
13376 
13377 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
13378 
13379 	return 0;
13380 
13381  error:
13382 	alc_free(codec);
13383 	return err;
13384 }
13385 
13386 /*
13387  * ALC680 support
13388  */
13389 
alc680_parse_auto_config(struct hda_codec * codec)13390 static int alc680_parse_auto_config(struct hda_codec *codec)
13391 {
13392 	return alc_parse_auto_config(codec, NULL, NULL);
13393 }
13394 
13395 /*
13396  */
patch_alc680(struct hda_codec * codec)13397 static int patch_alc680(struct hda_codec *codec)
13398 {
13399 	int err;
13400 
13401 	/* ALC680 has no aa-loopback mixer */
13402 	err = alc_alloc_spec(codec, 0);
13403 	if (err < 0)
13404 		return err;
13405 
13406 	/* automatic parse from the BIOS config */
13407 	err = alc680_parse_auto_config(codec);
13408 	if (err < 0) {
13409 		alc_free(codec);
13410 		return err;
13411 	}
13412 
13413 	return 0;
13414 }
13415 
13416 /*
13417  * patch entries
13418  */
13419 static const struct hda_device_id snd_hda_id_realtek[] = {
13420 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
13421 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
13422 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
13423 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
13424 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
13425 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
13426 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
13427 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
13428 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
13429 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
13430 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
13431 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
13432 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
13433 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
13434 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
13435 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
13436 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
13437 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
13438 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
13439 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
13440 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
13441 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
13442 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
13443 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
13444 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
13445 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
13446 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
13447 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
13448 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
13449 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
13450 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
13451 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
13452 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
13453 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
13454 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
13455 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
13456 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
13457 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
13458 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
13459 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
13460 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
13461 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
13462 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
13463 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
13464 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
13465 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
13466 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
13467 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
13468 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
13469 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
13470 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
13471 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
13472 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
13473 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
13474 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
13475 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
13476 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
13477 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
13478 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
13479 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
13480 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
13481 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
13482 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
13483 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
13484 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
13485 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
13486 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
13487 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
13488 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
13489 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
13490 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
13491 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
13492 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
13493 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
13494 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
13495 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
13496 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
13497 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
13498 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
13499 	{} /* terminator */
13500 };
13501 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
13502 
13503 MODULE_LICENSE("GPL");
13504 MODULE_DESCRIPTION("Realtek HD-audio codec");
13505 MODULE_IMPORT_NS("SND_HDA_SCODEC_COMPONENT");
13506 
13507 static struct hda_codec_driver realtek_driver = {
13508 	.id = snd_hda_id_realtek,
13509 };
13510 
13511 module_hda_codec_driver(realtek_driver);
13512