xref: /openbmc/linux/sound/pci/hda/patch_realtek.c (revision 0d3d2236)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Universal Interface for Intel High Definition Audio Codec
4  *
5  * HD audio interface patch for Realtek ALC codecs
6  *
7  * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8  *                    PeiSen Hou <pshou@realtek.com.tw>
9  *                    Takashi Iwai <tiwai@suse.de>
10  *                    Jonathan Woithe <jwoithe@just42.net>
11  */
12 
13 #include <linux/init.h>
14 #include <linux/delay.h>
15 #include <linux/slab.h>
16 #include <linux/pci.h>
17 #include <linux/dmi.h>
18 #include <linux/module.h>
19 #include <linux/input.h>
20 #include <linux/leds.h>
21 #include <linux/ctype.h>
22 #include <sound/core.h>
23 #include <sound/jack.h>
24 #include <sound/hda_codec.h>
25 #include "hda_local.h"
26 #include "hda_auto_parser.h"
27 #include "hda_jack.h"
28 #include "hda_generic.h"
29 #include "hda_component.h"
30 
31 /* keep halting ALC5505 DSP, for power saving */
32 #define HALT_REALTEK_ALC5505
33 
34 /* extra amp-initialization sequence types */
35 enum {
36 	ALC_INIT_UNDEFINED,
37 	ALC_INIT_NONE,
38 	ALC_INIT_DEFAULT,
39 };
40 
41 enum {
42 	ALC_HEADSET_MODE_UNKNOWN,
43 	ALC_HEADSET_MODE_UNPLUGGED,
44 	ALC_HEADSET_MODE_HEADSET,
45 	ALC_HEADSET_MODE_MIC,
46 	ALC_HEADSET_MODE_HEADPHONE,
47 };
48 
49 enum {
50 	ALC_HEADSET_TYPE_UNKNOWN,
51 	ALC_HEADSET_TYPE_CTIA,
52 	ALC_HEADSET_TYPE_OMTP,
53 };
54 
55 enum {
56 	ALC_KEY_MICMUTE_INDEX,
57 };
58 
59 struct alc_customize_define {
60 	unsigned int  sku_cfg;
61 	unsigned char port_connectivity;
62 	unsigned char check_sum;
63 	unsigned char customization;
64 	unsigned char external_amp;
65 	unsigned int  enable_pcbeep:1;
66 	unsigned int  platform_type:1;
67 	unsigned int  swap:1;
68 	unsigned int  override:1;
69 	unsigned int  fixup:1; /* Means that this sku is set by driver, not read from hw */
70 };
71 
72 struct alc_coef_led {
73 	unsigned int idx;
74 	unsigned int mask;
75 	unsigned int on;
76 	unsigned int off;
77 };
78 
79 struct alc_spec {
80 	struct hda_gen_spec gen; /* must be at head */
81 
82 	/* codec parameterization */
83 	struct alc_customize_define cdefine;
84 	unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
85 
86 	/* GPIO bits */
87 	unsigned int gpio_mask;
88 	unsigned int gpio_dir;
89 	unsigned int gpio_data;
90 	bool gpio_write_delay;	/* add a delay before writing gpio_data */
91 
92 	/* mute LED for HP laptops, see vref_mute_led_set() */
93 	int mute_led_polarity;
94 	int micmute_led_polarity;
95 	hda_nid_t mute_led_nid;
96 	hda_nid_t cap_mute_led_nid;
97 
98 	unsigned int gpio_mute_led_mask;
99 	unsigned int gpio_mic_led_mask;
100 	struct alc_coef_led mute_led_coef;
101 	struct alc_coef_led mic_led_coef;
102 	struct mutex coef_mutex;
103 
104 	hda_nid_t headset_mic_pin;
105 	hda_nid_t headphone_mic_pin;
106 	int current_headset_mode;
107 	int current_headset_type;
108 
109 	/* hooks */
110 	void (*init_hook)(struct hda_codec *codec);
111 #ifdef CONFIG_PM
112 	void (*power_hook)(struct hda_codec *codec);
113 #endif
114 	void (*shutup)(struct hda_codec *codec);
115 
116 	int init_amp;
117 	int codec_variant;	/* flag for other variants */
118 	unsigned int has_alc5505_dsp:1;
119 	unsigned int no_depop_delay:1;
120 	unsigned int done_hp_init:1;
121 	unsigned int no_shutup_pins:1;
122 	unsigned int ultra_low_power:1;
123 	unsigned int has_hs_key:1;
124 	unsigned int no_internal_mic_pin:1;
125 	unsigned int en_3kpull_low:1;
126 
127 	/* for PLL fix */
128 	hda_nid_t pll_nid;
129 	unsigned int pll_coef_idx, pll_coef_bit;
130 	unsigned int coef0;
131 	struct input_dev *kb_dev;
132 	u8 alc_mute_keycode_map[1];
133 
134 	/* component binding */
135 	struct component_match *match;
136 	struct hda_component comps[HDA_MAX_COMPONENTS];
137 };
138 
139 /*
140  * COEF access helper functions
141  */
142 
coef_mutex_lock(struct hda_codec * codec)143 static void coef_mutex_lock(struct hda_codec *codec)
144 {
145 	struct alc_spec *spec = codec->spec;
146 
147 	snd_hda_power_up_pm(codec);
148 	mutex_lock(&spec->coef_mutex);
149 }
150 
coef_mutex_unlock(struct hda_codec * codec)151 static void coef_mutex_unlock(struct hda_codec *codec)
152 {
153 	struct alc_spec *spec = codec->spec;
154 
155 	mutex_unlock(&spec->coef_mutex);
156 	snd_hda_power_down_pm(codec);
157 }
158 
__alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)159 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 				 unsigned int coef_idx)
161 {
162 	unsigned int val;
163 
164 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
165 	val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
166 	return val;
167 }
168 
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)169 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
170 			       unsigned int coef_idx)
171 {
172 	unsigned int val;
173 
174 	coef_mutex_lock(codec);
175 	val = __alc_read_coefex_idx(codec, nid, coef_idx);
176 	coef_mutex_unlock(codec);
177 	return val;
178 }
179 
180 #define alc_read_coef_idx(codec, coef_idx) \
181 	alc_read_coefex_idx(codec, 0x20, coef_idx)
182 
__alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)183 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
184 				   unsigned int coef_idx, unsigned int coef_val)
185 {
186 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
187 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
188 }
189 
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)190 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
191 				 unsigned int coef_idx, unsigned int coef_val)
192 {
193 	coef_mutex_lock(codec);
194 	__alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
195 	coef_mutex_unlock(codec);
196 }
197 
198 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
199 	alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
200 
__alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)201 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
202 				    unsigned int coef_idx, unsigned int mask,
203 				    unsigned int bits_set)
204 {
205 	unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
206 
207 	if (val != -1)
208 		__alc_write_coefex_idx(codec, nid, coef_idx,
209 				       (val & ~mask) | bits_set);
210 }
211 
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)212 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
213 				  unsigned int coef_idx, unsigned int mask,
214 				  unsigned int bits_set)
215 {
216 	coef_mutex_lock(codec);
217 	__alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
218 	coef_mutex_unlock(codec);
219 }
220 
221 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set)	\
222 	alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
223 
224 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)225 static unsigned int alc_get_coef0(struct hda_codec *codec)
226 {
227 	struct alc_spec *spec = codec->spec;
228 
229 	if (!spec->coef0)
230 		spec->coef0 = alc_read_coef_idx(codec, 0);
231 	return spec->coef0;
232 }
233 
234 /* coef writes/updates batch */
235 struct coef_fw {
236 	unsigned char nid;
237 	unsigned char idx;
238 	unsigned short mask;
239 	unsigned short val;
240 };
241 
242 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
243 	{ .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
244 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
245 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
246 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
247 
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)248 static void alc_process_coef_fw(struct hda_codec *codec,
249 				const struct coef_fw *fw)
250 {
251 	coef_mutex_lock(codec);
252 	for (; fw->nid; fw++) {
253 		if (fw->mask == (unsigned short)-1)
254 			__alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
255 		else
256 			__alc_update_coefex_idx(codec, fw->nid, fw->idx,
257 						fw->mask, fw->val);
258 	}
259 	coef_mutex_unlock(codec);
260 }
261 
262 /*
263  * GPIO setup tables, used in initialization
264  */
265 
266 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)267 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
268 {
269 	struct alc_spec *spec = codec->spec;
270 
271 	spec->gpio_mask |= mask;
272 	spec->gpio_dir |= mask;
273 	spec->gpio_data |= mask;
274 }
275 
alc_write_gpio_data(struct hda_codec * codec)276 static void alc_write_gpio_data(struct hda_codec *codec)
277 {
278 	struct alc_spec *spec = codec->spec;
279 
280 	snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
281 			    spec->gpio_data);
282 }
283 
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)284 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
285 				 bool on)
286 {
287 	struct alc_spec *spec = codec->spec;
288 	unsigned int oldval = spec->gpio_data;
289 
290 	if (on)
291 		spec->gpio_data |= mask;
292 	else
293 		spec->gpio_data &= ~mask;
294 	if (oldval != spec->gpio_data)
295 		alc_write_gpio_data(codec);
296 }
297 
alc_write_gpio(struct hda_codec * codec)298 static void alc_write_gpio(struct hda_codec *codec)
299 {
300 	struct alc_spec *spec = codec->spec;
301 
302 	if (!spec->gpio_mask)
303 		return;
304 
305 	snd_hda_codec_write(codec, codec->core.afg, 0,
306 			    AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
307 	snd_hda_codec_write(codec, codec->core.afg, 0,
308 			    AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
309 	if (spec->gpio_write_delay)
310 		msleep(1);
311 	alc_write_gpio_data(codec);
312 }
313 
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)314 static void alc_fixup_gpio(struct hda_codec *codec, int action,
315 			   unsigned int mask)
316 {
317 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
318 		alc_setup_gpio(codec, mask);
319 }
320 
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)321 static void alc_fixup_gpio1(struct hda_codec *codec,
322 			    const struct hda_fixup *fix, int action)
323 {
324 	alc_fixup_gpio(codec, action, 0x01);
325 }
326 
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)327 static void alc_fixup_gpio2(struct hda_codec *codec,
328 			    const struct hda_fixup *fix, int action)
329 {
330 	alc_fixup_gpio(codec, action, 0x02);
331 }
332 
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)333 static void alc_fixup_gpio3(struct hda_codec *codec,
334 			    const struct hda_fixup *fix, int action)
335 {
336 	alc_fixup_gpio(codec, action, 0x03);
337 }
338 
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)339 static void alc_fixup_gpio4(struct hda_codec *codec,
340 			    const struct hda_fixup *fix, int action)
341 {
342 	alc_fixup_gpio(codec, action, 0x04);
343 }
344 
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)345 static void alc_fixup_micmute_led(struct hda_codec *codec,
346 				  const struct hda_fixup *fix, int action)
347 {
348 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
349 		snd_hda_gen_add_micmute_led_cdev(codec, NULL);
350 }
351 
352 /*
353  * Fix hardware PLL issue
354  * On some codecs, the analog PLL gating control must be off while
355  * the default value is 1.
356  */
alc_fix_pll(struct hda_codec * codec)357 static void alc_fix_pll(struct hda_codec *codec)
358 {
359 	struct alc_spec *spec = codec->spec;
360 
361 	if (spec->pll_nid)
362 		alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
363 				      1 << spec->pll_coef_bit, 0);
364 }
365 
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)366 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
367 			     unsigned int coef_idx, unsigned int coef_bit)
368 {
369 	struct alc_spec *spec = codec->spec;
370 	spec->pll_nid = nid;
371 	spec->pll_coef_idx = coef_idx;
372 	spec->pll_coef_bit = coef_bit;
373 	alc_fix_pll(codec);
374 }
375 
376 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)377 static void alc_update_knob_master(struct hda_codec *codec,
378 				   struct hda_jack_callback *jack)
379 {
380 	unsigned int val;
381 	struct snd_kcontrol *kctl;
382 	struct snd_ctl_elem_value *uctl;
383 
384 	kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
385 	if (!kctl)
386 		return;
387 	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
388 	if (!uctl)
389 		return;
390 	val = snd_hda_codec_read(codec, jack->nid, 0,
391 				 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
392 	val &= HDA_AMP_VOLMASK;
393 	uctl->value.integer.value[0] = val;
394 	uctl->value.integer.value[1] = val;
395 	kctl->put(kctl, uctl);
396 	kfree(uctl);
397 }
398 
alc880_unsol_event(struct hda_codec * codec,unsigned int res)399 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
400 {
401 	/* For some reason, the res given from ALC880 is broken.
402 	   Here we adjust it properly. */
403 	snd_hda_jack_unsol_event(codec, res >> 2);
404 }
405 
406 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)407 static void alc_fill_eapd_coef(struct hda_codec *codec)
408 {
409 	int coef;
410 
411 	coef = alc_get_coef0(codec);
412 
413 	switch (codec->core.vendor_id) {
414 	case 0x10ec0262:
415 		alc_update_coef_idx(codec, 0x7, 0, 1<<5);
416 		break;
417 	case 0x10ec0267:
418 	case 0x10ec0268:
419 		alc_update_coef_idx(codec, 0x7, 0, 1<<13);
420 		break;
421 	case 0x10ec0269:
422 		if ((coef & 0x00f0) == 0x0010)
423 			alc_update_coef_idx(codec, 0xd, 0, 1<<14);
424 		if ((coef & 0x00f0) == 0x0020)
425 			alc_update_coef_idx(codec, 0x4, 1<<15, 0);
426 		if ((coef & 0x00f0) == 0x0030)
427 			alc_update_coef_idx(codec, 0x10, 1<<9, 0);
428 		break;
429 	case 0x10ec0280:
430 	case 0x10ec0284:
431 	case 0x10ec0290:
432 	case 0x10ec0292:
433 		alc_update_coef_idx(codec, 0x4, 1<<15, 0);
434 		break;
435 	case 0x10ec0225:
436 	case 0x10ec0295:
437 	case 0x10ec0299:
438 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
439 		fallthrough;
440 	case 0x10ec0215:
441 	case 0x10ec0285:
442 	case 0x10ec0289:
443 		alc_update_coef_idx(codec, 0x36, 1<<13, 0);
444 		fallthrough;
445 	case 0x10ec0230:
446 	case 0x10ec0233:
447 	case 0x10ec0235:
448 	case 0x10ec0236:
449 	case 0x10ec0245:
450 	case 0x10ec0255:
451 	case 0x10ec0256:
452 	case 0x19e58326:
453 	case 0x10ec0257:
454 	case 0x10ec0282:
455 	case 0x10ec0283:
456 	case 0x10ec0286:
457 	case 0x10ec0288:
458 	case 0x10ec0298:
459 	case 0x10ec0300:
460 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
461 		break;
462 	case 0x10ec0275:
463 		alc_update_coef_idx(codec, 0xe, 0, 1<<0);
464 		break;
465 	case 0x10ec0287:
466 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
467 		alc_write_coef_idx(codec, 0x8, 0x4ab7);
468 		break;
469 	case 0x10ec0293:
470 		alc_update_coef_idx(codec, 0xa, 1<<13, 0);
471 		break;
472 	case 0x10ec0234:
473 	case 0x10ec0274:
474 	case 0x10ec0294:
475 	case 0x10ec0700:
476 	case 0x10ec0701:
477 	case 0x10ec0703:
478 	case 0x10ec0711:
479 		alc_update_coef_idx(codec, 0x10, 1<<15, 0);
480 		break;
481 	case 0x10ec0662:
482 		if ((coef & 0x00f0) == 0x0030)
483 			alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
484 		break;
485 	case 0x10ec0272:
486 	case 0x10ec0273:
487 	case 0x10ec0663:
488 	case 0x10ec0665:
489 	case 0x10ec0670:
490 	case 0x10ec0671:
491 	case 0x10ec0672:
492 		alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
493 		break;
494 	case 0x10ec0222:
495 	case 0x10ec0623:
496 		alc_update_coef_idx(codec, 0x19, 1<<13, 0);
497 		break;
498 	case 0x10ec0668:
499 		alc_update_coef_idx(codec, 0x7, 3<<13, 0);
500 		break;
501 	case 0x10ec0867:
502 		alc_update_coef_idx(codec, 0x4, 1<<10, 0);
503 		break;
504 	case 0x10ec0888:
505 		if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
506 			alc_update_coef_idx(codec, 0x7, 1<<5, 0);
507 		break;
508 	case 0x10ec0892:
509 	case 0x10ec0897:
510 		alc_update_coef_idx(codec, 0x7, 1<<5, 0);
511 		break;
512 	case 0x10ec0899:
513 	case 0x10ec0900:
514 	case 0x10ec0b00:
515 	case 0x10ec1168:
516 	case 0x10ec1220:
517 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
518 		break;
519 	}
520 }
521 
522 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)523 static void alc888_coef_init(struct hda_codec *codec)
524 {
525 	switch (alc_get_coef0(codec) & 0x00f0) {
526 	/* alc888-VA */
527 	case 0x00:
528 	/* alc888-VB */
529 	case 0x10:
530 		alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
531 		break;
532 	}
533 }
534 
535 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)536 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
537 {
538 	if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
539 		return;
540 	if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
541 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
542 				    on ? 2 : 0);
543 }
544 
545 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)546 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
547 {
548 	/* We currently only handle front, HP */
549 	static const hda_nid_t pins[] = {
550 		0x0f, 0x10, 0x14, 0x15, 0x17, 0
551 	};
552 	const hda_nid_t *p;
553 	for (p = pins; *p; p++)
554 		set_eapd(codec, *p, on);
555 }
556 
557 static int find_ext_mic_pin(struct hda_codec *codec);
558 
alc_headset_mic_no_shutup(struct hda_codec * codec)559 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
560 {
561 	const struct hda_pincfg *pin;
562 	int mic_pin = find_ext_mic_pin(codec);
563 	int i;
564 
565 	/* don't shut up pins when unloading the driver; otherwise it breaks
566 	 * the default pin setup at the next load of the driver
567 	 */
568 	if (codec->bus->shutdown)
569 		return;
570 
571 	snd_array_for_each(&codec->init_pins, i, pin) {
572 		/* use read here for syncing after issuing each verb */
573 		if (pin->nid != mic_pin)
574 			snd_hda_codec_read(codec, pin->nid, 0,
575 					AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
576 	}
577 
578 	codec->pins_shutup = 1;
579 }
580 
alc_shutup_pins(struct hda_codec * codec)581 static void alc_shutup_pins(struct hda_codec *codec)
582 {
583 	struct alc_spec *spec = codec->spec;
584 
585 	switch (codec->core.vendor_id) {
586 	case 0x10ec0236:
587 	case 0x10ec0256:
588 	case 0x10ec0257:
589 	case 0x19e58326:
590 	case 0x10ec0283:
591 	case 0x10ec0285:
592 	case 0x10ec0286:
593 	case 0x10ec0287:
594 	case 0x10ec0288:
595 	case 0x10ec0295:
596 	case 0x10ec0298:
597 		alc_headset_mic_no_shutup(codec);
598 		break;
599 	default:
600 		if (!spec->no_shutup_pins)
601 			snd_hda_shutup_pins(codec);
602 		break;
603 	}
604 }
605 
606 /* generic shutup callback;
607  * just turning off EAPD and a little pause for avoiding pop-noise
608  */
alc_eapd_shutup(struct hda_codec * codec)609 static void alc_eapd_shutup(struct hda_codec *codec)
610 {
611 	struct alc_spec *spec = codec->spec;
612 
613 	alc_auto_setup_eapd(codec, false);
614 	if (!spec->no_depop_delay)
615 		msleep(200);
616 	alc_shutup_pins(codec);
617 }
618 
619 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)620 static void alc_auto_init_amp(struct hda_codec *codec, int type)
621 {
622 	alc_auto_setup_eapd(codec, true);
623 	alc_write_gpio(codec);
624 	switch (type) {
625 	case ALC_INIT_DEFAULT:
626 		switch (codec->core.vendor_id) {
627 		case 0x10ec0260:
628 			alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
629 			break;
630 		case 0x10ec0880:
631 		case 0x10ec0882:
632 		case 0x10ec0883:
633 		case 0x10ec0885:
634 			alc_update_coef_idx(codec, 7, 0, 0x2030);
635 			break;
636 		case 0x10ec0888:
637 			alc888_coef_init(codec);
638 			break;
639 		}
640 		break;
641 	}
642 }
643 
644 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)645 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
646 {
647 	if (spec->gen.autocfg.hp_pins[0])
648 		return spec->gen.autocfg.hp_pins[0];
649 	if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
650 		return spec->gen.autocfg.line_out_pins[0];
651 	return 0;
652 }
653 
654 /*
655  * Realtek SSID verification
656  */
657 
658 /* Could be any non-zero and even value. When used as fixup, tells
659  * the driver to ignore any present sku defines.
660  */
661 #define ALC_FIXUP_SKU_IGNORE (2)
662 
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)663 static void alc_fixup_sku_ignore(struct hda_codec *codec,
664 				 const struct hda_fixup *fix, int action)
665 {
666 	struct alc_spec *spec = codec->spec;
667 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
668 		spec->cdefine.fixup = 1;
669 		spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
670 	}
671 }
672 
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)673 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
674 				    const struct hda_fixup *fix, int action)
675 {
676 	struct alc_spec *spec = codec->spec;
677 
678 	if (action == HDA_FIXUP_ACT_PROBE) {
679 		spec->no_depop_delay = 1;
680 		codec->depop_delay = 0;
681 	}
682 }
683 
alc_auto_parse_customize_define(struct hda_codec * codec)684 static int alc_auto_parse_customize_define(struct hda_codec *codec)
685 {
686 	unsigned int ass, tmp, i;
687 	unsigned nid = 0;
688 	struct alc_spec *spec = codec->spec;
689 
690 	spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
691 
692 	if (spec->cdefine.fixup) {
693 		ass = spec->cdefine.sku_cfg;
694 		if (ass == ALC_FIXUP_SKU_IGNORE)
695 			return -1;
696 		goto do_sku;
697 	}
698 
699 	if (!codec->bus->pci)
700 		return -1;
701 	ass = codec->core.subsystem_id & 0xffff;
702 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
703 		goto do_sku;
704 
705 	nid = 0x1d;
706 	if (codec->core.vendor_id == 0x10ec0260)
707 		nid = 0x17;
708 	ass = snd_hda_codec_get_pincfg(codec, nid);
709 
710 	if (!(ass & 1)) {
711 		codec_info(codec, "%s: SKU not ready 0x%08x\n",
712 			   codec->core.chip_name, ass);
713 		return -1;
714 	}
715 
716 	/* check sum */
717 	tmp = 0;
718 	for (i = 1; i < 16; i++) {
719 		if ((ass >> i) & 1)
720 			tmp++;
721 	}
722 	if (((ass >> 16) & 0xf) != tmp)
723 		return -1;
724 
725 	spec->cdefine.port_connectivity = ass >> 30;
726 	spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
727 	spec->cdefine.check_sum = (ass >> 16) & 0xf;
728 	spec->cdefine.customization = ass >> 8;
729 do_sku:
730 	spec->cdefine.sku_cfg = ass;
731 	spec->cdefine.external_amp = (ass & 0x38) >> 3;
732 	spec->cdefine.platform_type = (ass & 0x4) >> 2;
733 	spec->cdefine.swap = (ass & 0x2) >> 1;
734 	spec->cdefine.override = ass & 0x1;
735 
736 	codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
737 		   nid, spec->cdefine.sku_cfg);
738 	codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
739 		   spec->cdefine.port_connectivity);
740 	codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
741 	codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
742 	codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
743 	codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
744 	codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
745 	codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
746 	codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
747 
748 	return 0;
749 }
750 
751 /* 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)752 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
753 {
754 	int i;
755 	for (i = 0; i < nums; i++)
756 		if (list[i] == nid)
757 			return i;
758 	return -1;
759 }
760 /* 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)761 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
762 {
763 	return find_idx_in_nid_list(nid, list, nums) >= 0;
764 }
765 
766 /* check subsystem ID and set up device-specific initialization;
767  * return 1 if initialized, 0 if invalid SSID
768  */
769 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
770  *	31 ~ 16 :	Manufacture ID
771  *	15 ~ 8	:	SKU ID
772  *	7  ~ 0	:	Assembly ID
773  *	port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
774  */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)775 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
776 {
777 	unsigned int ass, tmp, i;
778 	unsigned nid;
779 	struct alc_spec *spec = codec->spec;
780 
781 	if (spec->cdefine.fixup) {
782 		ass = spec->cdefine.sku_cfg;
783 		if (ass == ALC_FIXUP_SKU_IGNORE)
784 			return 0;
785 		goto do_sku;
786 	}
787 
788 	ass = codec->core.subsystem_id & 0xffff;
789 	if (codec->bus->pci &&
790 	    ass != codec->bus->pci->subsystem_device && (ass & 1))
791 		goto do_sku;
792 
793 	/* invalid SSID, check the special NID pin defcfg instead */
794 	/*
795 	 * 31~30	: port connectivity
796 	 * 29~21	: reserve
797 	 * 20		: PCBEEP input
798 	 * 19~16	: Check sum (15:1)
799 	 * 15~1		: Custom
800 	 * 0		: override
801 	*/
802 	nid = 0x1d;
803 	if (codec->core.vendor_id == 0x10ec0260)
804 		nid = 0x17;
805 	ass = snd_hda_codec_get_pincfg(codec, nid);
806 	codec_dbg(codec,
807 		  "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
808 		   ass, nid);
809 	if (!(ass & 1))
810 		return 0;
811 	if ((ass >> 30) != 1)	/* no physical connection */
812 		return 0;
813 
814 	/* check sum */
815 	tmp = 0;
816 	for (i = 1; i < 16; i++) {
817 		if ((ass >> i) & 1)
818 			tmp++;
819 	}
820 	if (((ass >> 16) & 0xf) != tmp)
821 		return 0;
822 do_sku:
823 	codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
824 		   ass & 0xffff, codec->core.vendor_id);
825 	/*
826 	 * 0 : override
827 	 * 1 :	Swap Jack
828 	 * 2 : 0 --> Desktop, 1 --> Laptop
829 	 * 3~5 : External Amplifier control
830 	 * 7~6 : Reserved
831 	*/
832 	tmp = (ass & 0x38) >> 3;	/* external Amp control */
833 	if (spec->init_amp == ALC_INIT_UNDEFINED) {
834 		switch (tmp) {
835 		case 1:
836 			alc_setup_gpio(codec, 0x01);
837 			break;
838 		case 3:
839 			alc_setup_gpio(codec, 0x02);
840 			break;
841 		case 7:
842 			alc_setup_gpio(codec, 0x04);
843 			break;
844 		case 5:
845 		default:
846 			spec->init_amp = ALC_INIT_DEFAULT;
847 			break;
848 		}
849 	}
850 
851 	/* is laptop or Desktop and enable the function "Mute internal speaker
852 	 * when the external headphone out jack is plugged"
853 	 */
854 	if (!(ass & 0x8000))
855 		return 1;
856 	/*
857 	 * 10~8 : Jack location
858 	 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
859 	 * 14~13: Resvered
860 	 * 15   : 1 --> enable the function "Mute internal speaker
861 	 *	        when the external headphone out jack is plugged"
862 	 */
863 	if (!alc_get_hp_pin(spec)) {
864 		hda_nid_t nid;
865 		tmp = (ass >> 11) & 0x3;	/* HP to chassis */
866 		nid = ports[tmp];
867 		if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
868 				      spec->gen.autocfg.line_outs))
869 			return 1;
870 		spec->gen.autocfg.hp_pins[0] = nid;
871 	}
872 	return 1;
873 }
874 
875 /* Check the validity of ALC subsystem-id
876  * 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)877 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
878 {
879 	if (!alc_subsystem_id(codec, ports)) {
880 		struct alc_spec *spec = codec->spec;
881 		if (spec->init_amp == ALC_INIT_UNDEFINED) {
882 			codec_dbg(codec,
883 				  "realtek: Enable default setup for auto mode as fallback\n");
884 			spec->init_amp = ALC_INIT_DEFAULT;
885 		}
886 	}
887 }
888 
889 /*
890  */
891 
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)892 static void alc_fixup_inv_dmic(struct hda_codec *codec,
893 			       const struct hda_fixup *fix, int action)
894 {
895 	struct alc_spec *spec = codec->spec;
896 
897 	spec->gen.inv_dmic_split = 1;
898 }
899 
900 
alc_build_controls(struct hda_codec * codec)901 static int alc_build_controls(struct hda_codec *codec)
902 {
903 	int err;
904 
905 	err = snd_hda_gen_build_controls(codec);
906 	if (err < 0)
907 		return err;
908 
909 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
910 	return 0;
911 }
912 
913 
914 /*
915  * Common callbacks
916  */
917 
alc_pre_init(struct hda_codec * codec)918 static void alc_pre_init(struct hda_codec *codec)
919 {
920 	alc_fill_eapd_coef(codec);
921 }
922 
923 #define is_s3_resume(codec) \
924 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
925 #define is_s4_resume(codec) \
926 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
927 
alc_init(struct hda_codec * codec)928 static int alc_init(struct hda_codec *codec)
929 {
930 	struct alc_spec *spec = codec->spec;
931 
932 	/* hibernation resume needs the full chip initialization */
933 	if (is_s4_resume(codec))
934 		alc_pre_init(codec);
935 
936 	if (spec->init_hook)
937 		spec->init_hook(codec);
938 
939 	spec->gen.skip_verbs = 1; /* applied in below */
940 	snd_hda_gen_init(codec);
941 	alc_fix_pll(codec);
942 	alc_auto_init_amp(codec, spec->init_amp);
943 	snd_hda_apply_verbs(codec); /* apply verbs here after own init */
944 
945 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
946 
947 	return 0;
948 }
949 
950 #define alc_free	snd_hda_gen_free
951 
952 #ifdef CONFIG_PM
alc_shutup(struct hda_codec * codec)953 static inline void alc_shutup(struct hda_codec *codec)
954 {
955 	struct alc_spec *spec = codec->spec;
956 
957 	if (!snd_hda_get_bool_hint(codec, "shutup"))
958 		return; /* disabled explicitly by hints */
959 
960 	if (spec && spec->shutup)
961 		spec->shutup(codec);
962 	else
963 		alc_shutup_pins(codec);
964 }
965 
alc_power_eapd(struct hda_codec * codec)966 static void alc_power_eapd(struct hda_codec *codec)
967 {
968 	alc_auto_setup_eapd(codec, false);
969 }
970 
alc_suspend(struct hda_codec * codec)971 static int alc_suspend(struct hda_codec *codec)
972 {
973 	struct alc_spec *spec = codec->spec;
974 	alc_shutup(codec);
975 	if (spec && spec->power_hook)
976 		spec->power_hook(codec);
977 	return 0;
978 }
979 
alc_resume(struct hda_codec * codec)980 static int alc_resume(struct hda_codec *codec)
981 {
982 	struct alc_spec *spec = codec->spec;
983 
984 	if (!spec->no_depop_delay)
985 		msleep(150); /* to avoid pop noise */
986 	codec->patch_ops.init(codec);
987 	snd_hda_regmap_sync(codec);
988 	hda_call_check_power_status(codec, 0x01);
989 	return 0;
990 }
991 #endif
992 
993 /*
994  */
995 static const struct hda_codec_ops alc_patch_ops = {
996 	.build_controls = alc_build_controls,
997 	.build_pcms = snd_hda_gen_build_pcms,
998 	.init = alc_init,
999 	.free = alc_free,
1000 	.unsol_event = snd_hda_jack_unsol_event,
1001 #ifdef CONFIG_PM
1002 	.resume = alc_resume,
1003 	.suspend = alc_suspend,
1004 	.check_power_status = snd_hda_gen_check_power_status,
1005 #endif
1006 };
1007 
1008 
1009 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1010 
1011 /*
1012  * Rename codecs appropriately from COEF value or subvendor id
1013  */
1014 struct alc_codec_rename_table {
1015 	unsigned int vendor_id;
1016 	unsigned short coef_mask;
1017 	unsigned short coef_bits;
1018 	const char *name;
1019 };
1020 
1021 struct alc_codec_rename_pci_table {
1022 	unsigned int codec_vendor_id;
1023 	unsigned short pci_subvendor;
1024 	unsigned short pci_subdevice;
1025 	const char *name;
1026 };
1027 
1028 static const struct alc_codec_rename_table rename_tbl[] = {
1029 	{ 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1030 	{ 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1031 	{ 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1032 	{ 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1033 	{ 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1034 	{ 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1035 	{ 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1036 	{ 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1037 	{ 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1038 	{ 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1039 	{ 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1040 	{ 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1041 	{ 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1042 	{ 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1043 	{ 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1044 	{ 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1045 	{ 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1046 	{ } /* terminator */
1047 };
1048 
1049 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1050 	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
1051 	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
1052 	{ 0x10ec0283, 0x1028, 0, "ALC3223" },
1053 	{ 0x10ec0288, 0x1028, 0, "ALC3263" },
1054 	{ 0x10ec0292, 0x1028, 0, "ALC3226" },
1055 	{ 0x10ec0293, 0x1028, 0, "ALC3235" },
1056 	{ 0x10ec0255, 0x1028, 0, "ALC3234" },
1057 	{ 0x10ec0668, 0x1028, 0, "ALC3661" },
1058 	{ 0x10ec0275, 0x1028, 0, "ALC3260" },
1059 	{ 0x10ec0899, 0x1028, 0, "ALC3861" },
1060 	{ 0x10ec0298, 0x1028, 0, "ALC3266" },
1061 	{ 0x10ec0236, 0x1028, 0, "ALC3204" },
1062 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
1063 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
1064 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
1065 	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
1066 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
1067 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
1068 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
1069 	{ 0x10ec0233, 0x1043, 0, "ALC3236" },
1070 	{ 0x10ec0280, 0x103c, 0, "ALC3228" },
1071 	{ 0x10ec0282, 0x103c, 0, "ALC3227" },
1072 	{ 0x10ec0286, 0x103c, 0, "ALC3242" },
1073 	{ 0x10ec0290, 0x103c, 0, "ALC3241" },
1074 	{ 0x10ec0668, 0x103c, 0, "ALC3662" },
1075 	{ 0x10ec0283, 0x17aa, 0, "ALC3239" },
1076 	{ 0x10ec0292, 0x17aa, 0, "ALC3232" },
1077 	{ } /* terminator */
1078 };
1079 
alc_codec_rename_from_preset(struct hda_codec * codec)1080 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1081 {
1082 	const struct alc_codec_rename_table *p;
1083 	const struct alc_codec_rename_pci_table *q;
1084 
1085 	for (p = rename_tbl; p->vendor_id; p++) {
1086 		if (p->vendor_id != codec->core.vendor_id)
1087 			continue;
1088 		if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1089 			return alc_codec_rename(codec, p->name);
1090 	}
1091 
1092 	if (!codec->bus->pci)
1093 		return 0;
1094 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1095 		if (q->codec_vendor_id != codec->core.vendor_id)
1096 			continue;
1097 		if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1098 			continue;
1099 		if (!q->pci_subdevice ||
1100 		    q->pci_subdevice == codec->bus->pci->subsystem_device)
1101 			return alc_codec_rename(codec, q->name);
1102 	}
1103 
1104 	return 0;
1105 }
1106 
1107 
1108 /*
1109  * Digital-beep handlers
1110  */
1111 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1112 
1113 /* additional beep mixers; private_value will be overwritten */
1114 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1115 	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1116 	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1117 };
1118 
1119 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1120 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1121 			int idx, int dir)
1122 {
1123 	struct snd_kcontrol_new *knew;
1124 	unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1125 	int i;
1126 
1127 	for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1128 		knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1129 					    &alc_beep_mixer[i]);
1130 		if (!knew)
1131 			return -ENOMEM;
1132 		knew->private_value = beep_amp;
1133 	}
1134 	return 0;
1135 }
1136 
1137 static const struct snd_pci_quirk beep_allow_list[] = {
1138 	SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1139 	SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1140 	SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1141 	SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1142 	SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1143 	SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1144 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1145 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1146 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1147 	/* denylist -- no beep available */
1148 	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1149 	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1150 	{}
1151 };
1152 
has_cdefine_beep(struct hda_codec * codec)1153 static inline int has_cdefine_beep(struct hda_codec *codec)
1154 {
1155 	struct alc_spec *spec = codec->spec;
1156 	const struct snd_pci_quirk *q;
1157 	q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1158 	if (q)
1159 		return q->value;
1160 	return spec->cdefine.enable_pcbeep;
1161 }
1162 #else
1163 #define set_beep_amp(spec, nid, idx, dir)	0
1164 #define has_cdefine_beep(codec)		0
1165 #endif
1166 
1167 /* parse the BIOS configuration and set up the alc_spec */
1168 /* return 1 if successful, 0 if the proper config is not found,
1169  * or a negative error code
1170  */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1171 static int alc_parse_auto_config(struct hda_codec *codec,
1172 				 const hda_nid_t *ignore_nids,
1173 				 const hda_nid_t *ssid_nids)
1174 {
1175 	struct alc_spec *spec = codec->spec;
1176 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1177 	int err;
1178 
1179 	err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1180 				       spec->parse_flags);
1181 	if (err < 0)
1182 		return err;
1183 
1184 	if (ssid_nids)
1185 		alc_ssid_check(codec, ssid_nids);
1186 
1187 	err = snd_hda_gen_parse_auto_config(codec, cfg);
1188 	if (err < 0)
1189 		return err;
1190 
1191 	return 1;
1192 }
1193 
1194 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1195 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1196 {
1197 	struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1198 	int err;
1199 
1200 	if (!spec)
1201 		return -ENOMEM;
1202 	codec->spec = spec;
1203 	snd_hda_gen_spec_init(&spec->gen);
1204 	spec->gen.mixer_nid = mixer_nid;
1205 	spec->gen.own_eapd_ctl = 1;
1206 	codec->single_adc_amp = 1;
1207 	/* FIXME: do we need this for all Realtek codec models? */
1208 	codec->spdif_status_reset = 1;
1209 	codec->forced_resume = 1;
1210 	codec->patch_ops = alc_patch_ops;
1211 	mutex_init(&spec->coef_mutex);
1212 
1213 	err = alc_codec_rename_from_preset(codec);
1214 	if (err < 0) {
1215 		kfree(spec);
1216 		return err;
1217 	}
1218 	return 0;
1219 }
1220 
alc880_parse_auto_config(struct hda_codec * codec)1221 static int alc880_parse_auto_config(struct hda_codec *codec)
1222 {
1223 	static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1224 	static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1225 	return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1226 }
1227 
1228 /*
1229  * ALC880 fix-ups
1230  */
1231 enum {
1232 	ALC880_FIXUP_GPIO1,
1233 	ALC880_FIXUP_GPIO2,
1234 	ALC880_FIXUP_MEDION_RIM,
1235 	ALC880_FIXUP_LG,
1236 	ALC880_FIXUP_LG_LW25,
1237 	ALC880_FIXUP_W810,
1238 	ALC880_FIXUP_EAPD_COEF,
1239 	ALC880_FIXUP_TCL_S700,
1240 	ALC880_FIXUP_VOL_KNOB,
1241 	ALC880_FIXUP_FUJITSU,
1242 	ALC880_FIXUP_F1734,
1243 	ALC880_FIXUP_UNIWILL,
1244 	ALC880_FIXUP_UNIWILL_DIG,
1245 	ALC880_FIXUP_Z71V,
1246 	ALC880_FIXUP_ASUS_W5A,
1247 	ALC880_FIXUP_3ST_BASE,
1248 	ALC880_FIXUP_3ST,
1249 	ALC880_FIXUP_3ST_DIG,
1250 	ALC880_FIXUP_5ST_BASE,
1251 	ALC880_FIXUP_5ST,
1252 	ALC880_FIXUP_5ST_DIG,
1253 	ALC880_FIXUP_6ST_BASE,
1254 	ALC880_FIXUP_6ST,
1255 	ALC880_FIXUP_6ST_DIG,
1256 	ALC880_FIXUP_6ST_AUTOMUTE,
1257 };
1258 
1259 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1260 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1261 				  const struct hda_fixup *fix, int action)
1262 {
1263 	if (action == HDA_FIXUP_ACT_PROBE)
1264 		snd_hda_jack_detect_enable_callback(codec, 0x21,
1265 						    alc_update_knob_master);
1266 }
1267 
1268 static const struct hda_fixup alc880_fixups[] = {
1269 	[ALC880_FIXUP_GPIO1] = {
1270 		.type = HDA_FIXUP_FUNC,
1271 		.v.func = alc_fixup_gpio1,
1272 	},
1273 	[ALC880_FIXUP_GPIO2] = {
1274 		.type = HDA_FIXUP_FUNC,
1275 		.v.func = alc_fixup_gpio2,
1276 	},
1277 	[ALC880_FIXUP_MEDION_RIM] = {
1278 		.type = HDA_FIXUP_VERBS,
1279 		.v.verbs = (const struct hda_verb[]) {
1280 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1281 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1282 			{ }
1283 		},
1284 		.chained = true,
1285 		.chain_id = ALC880_FIXUP_GPIO2,
1286 	},
1287 	[ALC880_FIXUP_LG] = {
1288 		.type = HDA_FIXUP_PINS,
1289 		.v.pins = (const struct hda_pintbl[]) {
1290 			/* disable bogus unused pins */
1291 			{ 0x16, 0x411111f0 },
1292 			{ 0x18, 0x411111f0 },
1293 			{ 0x1a, 0x411111f0 },
1294 			{ }
1295 		}
1296 	},
1297 	[ALC880_FIXUP_LG_LW25] = {
1298 		.type = HDA_FIXUP_PINS,
1299 		.v.pins = (const struct hda_pintbl[]) {
1300 			{ 0x1a, 0x0181344f }, /* line-in */
1301 			{ 0x1b, 0x0321403f }, /* headphone */
1302 			{ }
1303 		}
1304 	},
1305 	[ALC880_FIXUP_W810] = {
1306 		.type = HDA_FIXUP_PINS,
1307 		.v.pins = (const struct hda_pintbl[]) {
1308 			/* disable bogus unused pins */
1309 			{ 0x17, 0x411111f0 },
1310 			{ }
1311 		},
1312 		.chained = true,
1313 		.chain_id = ALC880_FIXUP_GPIO2,
1314 	},
1315 	[ALC880_FIXUP_EAPD_COEF] = {
1316 		.type = HDA_FIXUP_VERBS,
1317 		.v.verbs = (const struct hda_verb[]) {
1318 			/* change to EAPD mode */
1319 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1320 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1321 			{}
1322 		},
1323 	},
1324 	[ALC880_FIXUP_TCL_S700] = {
1325 		.type = HDA_FIXUP_VERBS,
1326 		.v.verbs = (const struct hda_verb[]) {
1327 			/* change to EAPD mode */
1328 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1329 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3070 },
1330 			{}
1331 		},
1332 		.chained = true,
1333 		.chain_id = ALC880_FIXUP_GPIO2,
1334 	},
1335 	[ALC880_FIXUP_VOL_KNOB] = {
1336 		.type = HDA_FIXUP_FUNC,
1337 		.v.func = alc880_fixup_vol_knob,
1338 	},
1339 	[ALC880_FIXUP_FUJITSU] = {
1340 		/* override all pins as BIOS on old Amilo is broken */
1341 		.type = HDA_FIXUP_PINS,
1342 		.v.pins = (const struct hda_pintbl[]) {
1343 			{ 0x14, 0x0121401f }, /* HP */
1344 			{ 0x15, 0x99030120 }, /* speaker */
1345 			{ 0x16, 0x99030130 }, /* bass speaker */
1346 			{ 0x17, 0x411111f0 }, /* N/A */
1347 			{ 0x18, 0x411111f0 }, /* N/A */
1348 			{ 0x19, 0x01a19950 }, /* mic-in */
1349 			{ 0x1a, 0x411111f0 }, /* N/A */
1350 			{ 0x1b, 0x411111f0 }, /* N/A */
1351 			{ 0x1c, 0x411111f0 }, /* N/A */
1352 			{ 0x1d, 0x411111f0 }, /* N/A */
1353 			{ 0x1e, 0x01454140 }, /* SPDIF out */
1354 			{ }
1355 		},
1356 		.chained = true,
1357 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1358 	},
1359 	[ALC880_FIXUP_F1734] = {
1360 		/* almost compatible with FUJITSU, but no bass and SPDIF */
1361 		.type = HDA_FIXUP_PINS,
1362 		.v.pins = (const struct hda_pintbl[]) {
1363 			{ 0x14, 0x0121401f }, /* HP */
1364 			{ 0x15, 0x99030120 }, /* speaker */
1365 			{ 0x16, 0x411111f0 }, /* N/A */
1366 			{ 0x17, 0x411111f0 }, /* N/A */
1367 			{ 0x18, 0x411111f0 }, /* N/A */
1368 			{ 0x19, 0x01a19950 }, /* mic-in */
1369 			{ 0x1a, 0x411111f0 }, /* N/A */
1370 			{ 0x1b, 0x411111f0 }, /* N/A */
1371 			{ 0x1c, 0x411111f0 }, /* N/A */
1372 			{ 0x1d, 0x411111f0 }, /* N/A */
1373 			{ 0x1e, 0x411111f0 }, /* N/A */
1374 			{ }
1375 		},
1376 		.chained = true,
1377 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1378 	},
1379 	[ALC880_FIXUP_UNIWILL] = {
1380 		/* need to fix HP and speaker pins to be parsed correctly */
1381 		.type = HDA_FIXUP_PINS,
1382 		.v.pins = (const struct hda_pintbl[]) {
1383 			{ 0x14, 0x0121411f }, /* HP */
1384 			{ 0x15, 0x99030120 }, /* speaker */
1385 			{ 0x16, 0x99030130 }, /* bass speaker */
1386 			{ }
1387 		},
1388 	},
1389 	[ALC880_FIXUP_UNIWILL_DIG] = {
1390 		.type = HDA_FIXUP_PINS,
1391 		.v.pins = (const struct hda_pintbl[]) {
1392 			/* disable bogus unused pins */
1393 			{ 0x17, 0x411111f0 },
1394 			{ 0x19, 0x411111f0 },
1395 			{ 0x1b, 0x411111f0 },
1396 			{ 0x1f, 0x411111f0 },
1397 			{ }
1398 		}
1399 	},
1400 	[ALC880_FIXUP_Z71V] = {
1401 		.type = HDA_FIXUP_PINS,
1402 		.v.pins = (const struct hda_pintbl[]) {
1403 			/* set up the whole pins as BIOS is utterly broken */
1404 			{ 0x14, 0x99030120 }, /* speaker */
1405 			{ 0x15, 0x0121411f }, /* HP */
1406 			{ 0x16, 0x411111f0 }, /* N/A */
1407 			{ 0x17, 0x411111f0 }, /* N/A */
1408 			{ 0x18, 0x01a19950 }, /* mic-in */
1409 			{ 0x19, 0x411111f0 }, /* N/A */
1410 			{ 0x1a, 0x01813031 }, /* line-in */
1411 			{ 0x1b, 0x411111f0 }, /* N/A */
1412 			{ 0x1c, 0x411111f0 }, /* N/A */
1413 			{ 0x1d, 0x411111f0 }, /* N/A */
1414 			{ 0x1e, 0x0144111e }, /* SPDIF */
1415 			{ }
1416 		}
1417 	},
1418 	[ALC880_FIXUP_ASUS_W5A] = {
1419 		.type = HDA_FIXUP_PINS,
1420 		.v.pins = (const struct hda_pintbl[]) {
1421 			/* set up the whole pins as BIOS is utterly broken */
1422 			{ 0x14, 0x0121411f }, /* HP */
1423 			{ 0x15, 0x411111f0 }, /* N/A */
1424 			{ 0x16, 0x411111f0 }, /* N/A */
1425 			{ 0x17, 0x411111f0 }, /* N/A */
1426 			{ 0x18, 0x90a60160 }, /* mic */
1427 			{ 0x19, 0x411111f0 }, /* N/A */
1428 			{ 0x1a, 0x411111f0 }, /* N/A */
1429 			{ 0x1b, 0x411111f0 }, /* N/A */
1430 			{ 0x1c, 0x411111f0 }, /* N/A */
1431 			{ 0x1d, 0x411111f0 }, /* N/A */
1432 			{ 0x1e, 0xb743111e }, /* SPDIF out */
1433 			{ }
1434 		},
1435 		.chained = true,
1436 		.chain_id = ALC880_FIXUP_GPIO1,
1437 	},
1438 	[ALC880_FIXUP_3ST_BASE] = {
1439 		.type = HDA_FIXUP_PINS,
1440 		.v.pins = (const struct hda_pintbl[]) {
1441 			{ 0x14, 0x01014010 }, /* line-out */
1442 			{ 0x15, 0x411111f0 }, /* N/A */
1443 			{ 0x16, 0x411111f0 }, /* N/A */
1444 			{ 0x17, 0x411111f0 }, /* N/A */
1445 			{ 0x18, 0x01a19c30 }, /* mic-in */
1446 			{ 0x19, 0x0121411f }, /* HP */
1447 			{ 0x1a, 0x01813031 }, /* line-in */
1448 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1449 			{ 0x1c, 0x411111f0 }, /* N/A */
1450 			{ 0x1d, 0x411111f0 }, /* N/A */
1451 			/* 0x1e is filled in below */
1452 			{ 0x1f, 0x411111f0 }, /* N/A */
1453 			{ }
1454 		}
1455 	},
1456 	[ALC880_FIXUP_3ST] = {
1457 		.type = HDA_FIXUP_PINS,
1458 		.v.pins = (const struct hda_pintbl[]) {
1459 			{ 0x1e, 0x411111f0 }, /* N/A */
1460 			{ }
1461 		},
1462 		.chained = true,
1463 		.chain_id = ALC880_FIXUP_3ST_BASE,
1464 	},
1465 	[ALC880_FIXUP_3ST_DIG] = {
1466 		.type = HDA_FIXUP_PINS,
1467 		.v.pins = (const struct hda_pintbl[]) {
1468 			{ 0x1e, 0x0144111e }, /* SPDIF */
1469 			{ }
1470 		},
1471 		.chained = true,
1472 		.chain_id = ALC880_FIXUP_3ST_BASE,
1473 	},
1474 	[ALC880_FIXUP_5ST_BASE] = {
1475 		.type = HDA_FIXUP_PINS,
1476 		.v.pins = (const struct hda_pintbl[]) {
1477 			{ 0x14, 0x01014010 }, /* front */
1478 			{ 0x15, 0x411111f0 }, /* N/A */
1479 			{ 0x16, 0x01011411 }, /* CLFE */
1480 			{ 0x17, 0x01016412 }, /* surr */
1481 			{ 0x18, 0x01a19c30 }, /* mic-in */
1482 			{ 0x19, 0x0121411f }, /* HP */
1483 			{ 0x1a, 0x01813031 }, /* line-in */
1484 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1485 			{ 0x1c, 0x411111f0 }, /* N/A */
1486 			{ 0x1d, 0x411111f0 }, /* N/A */
1487 			/* 0x1e is filled in below */
1488 			{ 0x1f, 0x411111f0 }, /* N/A */
1489 			{ }
1490 		}
1491 	},
1492 	[ALC880_FIXUP_5ST] = {
1493 		.type = HDA_FIXUP_PINS,
1494 		.v.pins = (const struct hda_pintbl[]) {
1495 			{ 0x1e, 0x411111f0 }, /* N/A */
1496 			{ }
1497 		},
1498 		.chained = true,
1499 		.chain_id = ALC880_FIXUP_5ST_BASE,
1500 	},
1501 	[ALC880_FIXUP_5ST_DIG] = {
1502 		.type = HDA_FIXUP_PINS,
1503 		.v.pins = (const struct hda_pintbl[]) {
1504 			{ 0x1e, 0x0144111e }, /* SPDIF */
1505 			{ }
1506 		},
1507 		.chained = true,
1508 		.chain_id = ALC880_FIXUP_5ST_BASE,
1509 	},
1510 	[ALC880_FIXUP_6ST_BASE] = {
1511 		.type = HDA_FIXUP_PINS,
1512 		.v.pins = (const struct hda_pintbl[]) {
1513 			{ 0x14, 0x01014010 }, /* front */
1514 			{ 0x15, 0x01016412 }, /* surr */
1515 			{ 0x16, 0x01011411 }, /* CLFE */
1516 			{ 0x17, 0x01012414 }, /* side */
1517 			{ 0x18, 0x01a19c30 }, /* mic-in */
1518 			{ 0x19, 0x02a19c40 }, /* front-mic */
1519 			{ 0x1a, 0x01813031 }, /* line-in */
1520 			{ 0x1b, 0x0121411f }, /* HP */
1521 			{ 0x1c, 0x411111f0 }, /* N/A */
1522 			{ 0x1d, 0x411111f0 }, /* N/A */
1523 			/* 0x1e is filled in below */
1524 			{ 0x1f, 0x411111f0 }, /* N/A */
1525 			{ }
1526 		}
1527 	},
1528 	[ALC880_FIXUP_6ST] = {
1529 		.type = HDA_FIXUP_PINS,
1530 		.v.pins = (const struct hda_pintbl[]) {
1531 			{ 0x1e, 0x411111f0 }, /* N/A */
1532 			{ }
1533 		},
1534 		.chained = true,
1535 		.chain_id = ALC880_FIXUP_6ST_BASE,
1536 	},
1537 	[ALC880_FIXUP_6ST_DIG] = {
1538 		.type = HDA_FIXUP_PINS,
1539 		.v.pins = (const struct hda_pintbl[]) {
1540 			{ 0x1e, 0x0144111e }, /* SPDIF */
1541 			{ }
1542 		},
1543 		.chained = true,
1544 		.chain_id = ALC880_FIXUP_6ST_BASE,
1545 	},
1546 	[ALC880_FIXUP_6ST_AUTOMUTE] = {
1547 		.type = HDA_FIXUP_PINS,
1548 		.v.pins = (const struct hda_pintbl[]) {
1549 			{ 0x1b, 0x0121401f }, /* HP with jack detect */
1550 			{ }
1551 		},
1552 		.chained_before = true,
1553 		.chain_id = ALC880_FIXUP_6ST_BASE,
1554 	},
1555 };
1556 
1557 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1558 	SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1559 	SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1560 	SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1561 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1562 	SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1563 	SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1564 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1565 	SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1566 	SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1567 	SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1568 	SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1569 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1570 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1571 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1572 	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1573 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1574 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1575 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1576 	SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1577 	SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1578 	SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1579 	SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1580 	SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1581 
1582 	/* Below is the copied entries from alc880_quirks.c.
1583 	 * It's not quite sure whether BIOS sets the correct pin-config table
1584 	 * on these machines, thus they are kept to be compatible with
1585 	 * the old static quirks.  Once when it's confirmed to work without
1586 	 * these overrides, it'd be better to remove.
1587 	 */
1588 	SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1589 	SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1590 	SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1591 	SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1592 	SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1593 	SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1594 	SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1595 	SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1596 	SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1597 	SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1598 	SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1599 	SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1600 	SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1601 	SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1602 	SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1603 	SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1604 	SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1605 	SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1606 	SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1607 	SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1608 	SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1609 	SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1610 	SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1611 	SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1612 	SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1613 	SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1614 	SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1615 	SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1616 	SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1617 	SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1618 	SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1619 	SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1620 	SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1621 	/* default Intel */
1622 	SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1623 	SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1624 	SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1625 	{}
1626 };
1627 
1628 static const struct hda_model_fixup alc880_fixup_models[] = {
1629 	{.id = ALC880_FIXUP_3ST, .name = "3stack"},
1630 	{.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1631 	{.id = ALC880_FIXUP_5ST, .name = "5stack"},
1632 	{.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1633 	{.id = ALC880_FIXUP_6ST, .name = "6stack"},
1634 	{.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1635 	{.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1636 	{}
1637 };
1638 
1639 
1640 /*
1641  * OK, here we have finally the patch for ALC880
1642  */
patch_alc880(struct hda_codec * codec)1643 static int patch_alc880(struct hda_codec *codec)
1644 {
1645 	struct alc_spec *spec;
1646 	int err;
1647 
1648 	err = alc_alloc_spec(codec, 0x0b);
1649 	if (err < 0)
1650 		return err;
1651 
1652 	spec = codec->spec;
1653 	spec->gen.need_dac_fix = 1;
1654 	spec->gen.beep_nid = 0x01;
1655 
1656 	codec->patch_ops.unsol_event = alc880_unsol_event;
1657 
1658 	alc_pre_init(codec);
1659 
1660 	snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1661 		       alc880_fixups);
1662 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1663 
1664 	/* automatic parse from the BIOS config */
1665 	err = alc880_parse_auto_config(codec);
1666 	if (err < 0)
1667 		goto error;
1668 
1669 	if (!spec->gen.no_analog) {
1670 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1671 		if (err < 0)
1672 			goto error;
1673 	}
1674 
1675 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1676 
1677 	return 0;
1678 
1679  error:
1680 	alc_free(codec);
1681 	return err;
1682 }
1683 
1684 
1685 /*
1686  * ALC260 support
1687  */
alc260_parse_auto_config(struct hda_codec * codec)1688 static int alc260_parse_auto_config(struct hda_codec *codec)
1689 {
1690 	static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1691 	static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1692 	return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1693 }
1694 
1695 /*
1696  * Pin config fixes
1697  */
1698 enum {
1699 	ALC260_FIXUP_HP_DC5750,
1700 	ALC260_FIXUP_HP_PIN_0F,
1701 	ALC260_FIXUP_COEF,
1702 	ALC260_FIXUP_GPIO1,
1703 	ALC260_FIXUP_GPIO1_TOGGLE,
1704 	ALC260_FIXUP_REPLACER,
1705 	ALC260_FIXUP_HP_B1900,
1706 	ALC260_FIXUP_KN1,
1707 	ALC260_FIXUP_FSC_S7020,
1708 	ALC260_FIXUP_FSC_S7020_JWSE,
1709 	ALC260_FIXUP_VAIO_PINS,
1710 };
1711 
alc260_gpio1_automute(struct hda_codec * codec)1712 static void alc260_gpio1_automute(struct hda_codec *codec)
1713 {
1714 	struct alc_spec *spec = codec->spec;
1715 
1716 	alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1717 }
1718 
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1719 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1720 				      const struct hda_fixup *fix, int action)
1721 {
1722 	struct alc_spec *spec = codec->spec;
1723 	if (action == HDA_FIXUP_ACT_PROBE) {
1724 		/* although the machine has only one output pin, we need to
1725 		 * toggle GPIO1 according to the jack state
1726 		 */
1727 		spec->gen.automute_hook = alc260_gpio1_automute;
1728 		spec->gen.detect_hp = 1;
1729 		spec->gen.automute_speaker = 1;
1730 		spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1731 		snd_hda_jack_detect_enable_callback(codec, 0x0f,
1732 						    snd_hda_gen_hp_automute);
1733 		alc_setup_gpio(codec, 0x01);
1734 	}
1735 }
1736 
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1737 static void alc260_fixup_kn1(struct hda_codec *codec,
1738 			     const struct hda_fixup *fix, int action)
1739 {
1740 	struct alc_spec *spec = codec->spec;
1741 	static const struct hda_pintbl pincfgs[] = {
1742 		{ 0x0f, 0x02214000 }, /* HP/speaker */
1743 		{ 0x12, 0x90a60160 }, /* int mic */
1744 		{ 0x13, 0x02a19000 }, /* ext mic */
1745 		{ 0x18, 0x01446000 }, /* SPDIF out */
1746 		/* disable bogus I/O pins */
1747 		{ 0x10, 0x411111f0 },
1748 		{ 0x11, 0x411111f0 },
1749 		{ 0x14, 0x411111f0 },
1750 		{ 0x15, 0x411111f0 },
1751 		{ 0x16, 0x411111f0 },
1752 		{ 0x17, 0x411111f0 },
1753 		{ 0x19, 0x411111f0 },
1754 		{ }
1755 	};
1756 
1757 	switch (action) {
1758 	case HDA_FIXUP_ACT_PRE_PROBE:
1759 		snd_hda_apply_pincfgs(codec, pincfgs);
1760 		spec->init_amp = ALC_INIT_NONE;
1761 		break;
1762 	}
1763 }
1764 
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1765 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1766 				   const struct hda_fixup *fix, int action)
1767 {
1768 	struct alc_spec *spec = codec->spec;
1769 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
1770 		spec->init_amp = ALC_INIT_NONE;
1771 }
1772 
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1773 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1774 				   const struct hda_fixup *fix, int action)
1775 {
1776 	struct alc_spec *spec = codec->spec;
1777 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1778 		spec->gen.add_jack_modes = 1;
1779 		spec->gen.hp_mic = 1;
1780 	}
1781 }
1782 
1783 static const struct hda_fixup alc260_fixups[] = {
1784 	[ALC260_FIXUP_HP_DC5750] = {
1785 		.type = HDA_FIXUP_PINS,
1786 		.v.pins = (const struct hda_pintbl[]) {
1787 			{ 0x11, 0x90130110 }, /* speaker */
1788 			{ }
1789 		}
1790 	},
1791 	[ALC260_FIXUP_HP_PIN_0F] = {
1792 		.type = HDA_FIXUP_PINS,
1793 		.v.pins = (const struct hda_pintbl[]) {
1794 			{ 0x0f, 0x01214000 }, /* HP */
1795 			{ }
1796 		}
1797 	},
1798 	[ALC260_FIXUP_COEF] = {
1799 		.type = HDA_FIXUP_VERBS,
1800 		.v.verbs = (const struct hda_verb[]) {
1801 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1802 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3040 },
1803 			{ }
1804 		},
1805 	},
1806 	[ALC260_FIXUP_GPIO1] = {
1807 		.type = HDA_FIXUP_FUNC,
1808 		.v.func = alc_fixup_gpio1,
1809 	},
1810 	[ALC260_FIXUP_GPIO1_TOGGLE] = {
1811 		.type = HDA_FIXUP_FUNC,
1812 		.v.func = alc260_fixup_gpio1_toggle,
1813 		.chained = true,
1814 		.chain_id = ALC260_FIXUP_HP_PIN_0F,
1815 	},
1816 	[ALC260_FIXUP_REPLACER] = {
1817 		.type = HDA_FIXUP_VERBS,
1818 		.v.verbs = (const struct hda_verb[]) {
1819 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1820 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3050 },
1821 			{ }
1822 		},
1823 		.chained = true,
1824 		.chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1825 	},
1826 	[ALC260_FIXUP_HP_B1900] = {
1827 		.type = HDA_FIXUP_FUNC,
1828 		.v.func = alc260_fixup_gpio1_toggle,
1829 		.chained = true,
1830 		.chain_id = ALC260_FIXUP_COEF,
1831 	},
1832 	[ALC260_FIXUP_KN1] = {
1833 		.type = HDA_FIXUP_FUNC,
1834 		.v.func = alc260_fixup_kn1,
1835 	},
1836 	[ALC260_FIXUP_FSC_S7020] = {
1837 		.type = HDA_FIXUP_FUNC,
1838 		.v.func = alc260_fixup_fsc_s7020,
1839 	},
1840 	[ALC260_FIXUP_FSC_S7020_JWSE] = {
1841 		.type = HDA_FIXUP_FUNC,
1842 		.v.func = alc260_fixup_fsc_s7020_jwse,
1843 		.chained = true,
1844 		.chain_id = ALC260_FIXUP_FSC_S7020,
1845 	},
1846 	[ALC260_FIXUP_VAIO_PINS] = {
1847 		.type = HDA_FIXUP_PINS,
1848 		.v.pins = (const struct hda_pintbl[]) {
1849 			/* Pin configs are missing completely on some VAIOs */
1850 			{ 0x0f, 0x01211020 },
1851 			{ 0x10, 0x0001003f },
1852 			{ 0x11, 0x411111f0 },
1853 			{ 0x12, 0x01a15930 },
1854 			{ 0x13, 0x411111f0 },
1855 			{ 0x14, 0x411111f0 },
1856 			{ 0x15, 0x411111f0 },
1857 			{ 0x16, 0x411111f0 },
1858 			{ 0x17, 0x411111f0 },
1859 			{ 0x18, 0x411111f0 },
1860 			{ 0x19, 0x411111f0 },
1861 			{ }
1862 		}
1863 	},
1864 };
1865 
1866 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1867 	SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1868 	SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1869 	SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1870 	SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1871 	SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1872 	SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1873 	SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1874 	SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1875 	SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1876 	SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1877 	SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1878 	SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1879 	{}
1880 };
1881 
1882 static const struct hda_model_fixup alc260_fixup_models[] = {
1883 	{.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1884 	{.id = ALC260_FIXUP_COEF, .name = "coef"},
1885 	{.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1886 	{.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1887 	{}
1888 };
1889 
1890 /*
1891  */
patch_alc260(struct hda_codec * codec)1892 static int patch_alc260(struct hda_codec *codec)
1893 {
1894 	struct alc_spec *spec;
1895 	int err;
1896 
1897 	err = alc_alloc_spec(codec, 0x07);
1898 	if (err < 0)
1899 		return err;
1900 
1901 	spec = codec->spec;
1902 	/* as quite a few machines require HP amp for speaker outputs,
1903 	 * it's easier to enable it unconditionally; even if it's unneeded,
1904 	 * it's almost harmless.
1905 	 */
1906 	spec->gen.prefer_hp_amp = 1;
1907 	spec->gen.beep_nid = 0x01;
1908 
1909 	spec->shutup = alc_eapd_shutup;
1910 
1911 	alc_pre_init(codec);
1912 
1913 	snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1914 			   alc260_fixups);
1915 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1916 
1917 	/* automatic parse from the BIOS config */
1918 	err = alc260_parse_auto_config(codec);
1919 	if (err < 0)
1920 		goto error;
1921 
1922 	if (!spec->gen.no_analog) {
1923 		err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1924 		if (err < 0)
1925 			goto error;
1926 	}
1927 
1928 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1929 
1930 	return 0;
1931 
1932  error:
1933 	alc_free(codec);
1934 	return err;
1935 }
1936 
1937 
1938 /*
1939  * ALC882/883/885/888/889 support
1940  *
1941  * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1942  * configuration.  Each pin widget can choose any input DACs and a mixer.
1943  * Each ADC is connected from a mixer of all inputs.  This makes possible
1944  * 6-channel independent captures.
1945  *
1946  * In addition, an independent DAC for the multi-playback (not used in this
1947  * driver yet).
1948  */
1949 
1950 /*
1951  * Pin config fixes
1952  */
1953 enum {
1954 	ALC882_FIXUP_ABIT_AW9D_MAX,
1955 	ALC882_FIXUP_LENOVO_Y530,
1956 	ALC882_FIXUP_PB_M5210,
1957 	ALC882_FIXUP_ACER_ASPIRE_7736,
1958 	ALC882_FIXUP_ASUS_W90V,
1959 	ALC889_FIXUP_CD,
1960 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1961 	ALC889_FIXUP_VAIO_TT,
1962 	ALC888_FIXUP_EEE1601,
1963 	ALC886_FIXUP_EAPD,
1964 	ALC882_FIXUP_EAPD,
1965 	ALC883_FIXUP_EAPD,
1966 	ALC883_FIXUP_ACER_EAPD,
1967 	ALC882_FIXUP_GPIO1,
1968 	ALC882_FIXUP_GPIO2,
1969 	ALC882_FIXUP_GPIO3,
1970 	ALC889_FIXUP_COEF,
1971 	ALC882_FIXUP_ASUS_W2JC,
1972 	ALC882_FIXUP_ACER_ASPIRE_4930G,
1973 	ALC882_FIXUP_ACER_ASPIRE_8930G,
1974 	ALC882_FIXUP_ASPIRE_8930G_VERBS,
1975 	ALC885_FIXUP_MACPRO_GPIO,
1976 	ALC889_FIXUP_DAC_ROUTE,
1977 	ALC889_FIXUP_MBP_VREF,
1978 	ALC889_FIXUP_IMAC91_VREF,
1979 	ALC889_FIXUP_MBA11_VREF,
1980 	ALC889_FIXUP_MBA21_VREF,
1981 	ALC889_FIXUP_MP11_VREF,
1982 	ALC889_FIXUP_MP41_VREF,
1983 	ALC882_FIXUP_INV_DMIC,
1984 	ALC882_FIXUP_NO_PRIMARY_HP,
1985 	ALC887_FIXUP_ASUS_BASS,
1986 	ALC887_FIXUP_BASS_CHMAP,
1987 	ALC1220_FIXUP_GB_DUAL_CODECS,
1988 	ALC1220_FIXUP_GB_X570,
1989 	ALC1220_FIXUP_CLEVO_P950,
1990 	ALC1220_FIXUP_CLEVO_PB51ED,
1991 	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1992 	ALC887_FIXUP_ASUS_AUDIO,
1993 	ALC887_FIXUP_ASUS_HMIC,
1994 	ALCS1200A_FIXUP_MIC_VREF,
1995 	ALC888VD_FIXUP_MIC_100VREF,
1996 };
1997 
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)1998 static void alc889_fixup_coef(struct hda_codec *codec,
1999 			      const struct hda_fixup *fix, int action)
2000 {
2001 	if (action != HDA_FIXUP_ACT_INIT)
2002 		return;
2003 	alc_update_coef_idx(codec, 7, 0, 0x2030);
2004 }
2005 
2006 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2007 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2008 				     const struct hda_fixup *fix, int action)
2009 {
2010 	struct alc_spec *spec = codec->spec;
2011 
2012 	spec->gpio_write_delay = true;
2013 	alc_fixup_gpio3(codec, fix, action);
2014 }
2015 
2016 /* Fix the connection of some pins for ALC889:
2017  * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2018  * work correctly (bko#42740)
2019  */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2020 static void alc889_fixup_dac_route(struct hda_codec *codec,
2021 				   const struct hda_fixup *fix, int action)
2022 {
2023 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2024 		/* fake the connections during parsing the tree */
2025 		static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2026 		static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2027 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2028 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2029 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2030 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2031 	} else if (action == HDA_FIXUP_ACT_PROBE) {
2032 		/* restore the connections */
2033 		static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2034 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2035 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2036 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2037 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2038 	}
2039 }
2040 
2041 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2042 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2043 				  const struct hda_fixup *fix, int action)
2044 {
2045 	static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2046 	struct alc_spec *spec = codec->spec;
2047 	int i;
2048 
2049 	if (action != HDA_FIXUP_ACT_INIT)
2050 		return;
2051 	for (i = 0; i < ARRAY_SIZE(nids); i++) {
2052 		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2053 		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2054 			continue;
2055 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2056 		val |= AC_PINCTL_VREF_80;
2057 		snd_hda_set_pin_ctl(codec, nids[i], val);
2058 		spec->gen.keep_vref_in_automute = 1;
2059 		break;
2060 	}
2061 }
2062 
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2063 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2064 				  const hda_nid_t *nids, int num_nids)
2065 {
2066 	struct alc_spec *spec = codec->spec;
2067 	int i;
2068 
2069 	for (i = 0; i < num_nids; i++) {
2070 		unsigned int val;
2071 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2072 		val |= AC_PINCTL_VREF_50;
2073 		snd_hda_set_pin_ctl(codec, nids[i], val);
2074 	}
2075 	spec->gen.keep_vref_in_automute = 1;
2076 }
2077 
2078 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2079 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2080 				     const struct hda_fixup *fix, int action)
2081 {
2082 	static const hda_nid_t nids[] = { 0x18, 0x1a };
2083 
2084 	if (action == HDA_FIXUP_ACT_INIT)
2085 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2086 }
2087 
2088 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2089 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2090 				    const struct hda_fixup *fix, int action)
2091 {
2092 	static const hda_nid_t nids[] = { 0x18 };
2093 
2094 	if (action == HDA_FIXUP_ACT_INIT)
2095 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2096 }
2097 
2098 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2099 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2100 				    const struct hda_fixup *fix, int action)
2101 {
2102 	static const hda_nid_t nids[] = { 0x18, 0x19 };
2103 
2104 	if (action == HDA_FIXUP_ACT_INIT)
2105 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2106 }
2107 
2108 /* Don't take HP output as primary
2109  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2110  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2111  */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2112 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2113 				       const struct hda_fixup *fix, int action)
2114 {
2115 	struct alc_spec *spec = codec->spec;
2116 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2117 		spec->gen.no_primary_hp = 1;
2118 		spec->gen.no_multi_io = 1;
2119 	}
2120 }
2121 
2122 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2123 				 const struct hda_fixup *fix, int action);
2124 
2125 /* For dual-codec configuration, we need to disable some features to avoid
2126  * conflicts of kctls and PCM streams
2127  */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2128 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2129 				  const struct hda_fixup *fix, int action)
2130 {
2131 	struct alc_spec *spec = codec->spec;
2132 
2133 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2134 		return;
2135 	/* disable vmaster */
2136 	spec->gen.suppress_vmaster = 1;
2137 	/* auto-mute and auto-mic switch don't work with multiple codecs */
2138 	spec->gen.suppress_auto_mute = 1;
2139 	spec->gen.suppress_auto_mic = 1;
2140 	/* disable aamix as well */
2141 	spec->gen.mixer_nid = 0;
2142 	/* add location prefix to avoid conflicts */
2143 	codec->force_pin_prefix = 1;
2144 }
2145 
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2146 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2147 		       const char *newname)
2148 {
2149 	struct snd_kcontrol *kctl;
2150 
2151 	kctl = snd_hda_find_mixer_ctl(codec, oldname);
2152 	if (kctl)
2153 		snd_ctl_rename(codec->card, kctl, newname);
2154 }
2155 
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2156 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2157 					 const struct hda_fixup *fix,
2158 					 int action)
2159 {
2160 	alc_fixup_dual_codecs(codec, fix, action);
2161 	switch (action) {
2162 	case HDA_FIXUP_ACT_PRE_PROBE:
2163 		/* override card longname to provide a unique UCM profile */
2164 		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2165 		break;
2166 	case HDA_FIXUP_ACT_BUILD:
2167 		/* rename Capture controls depending on the codec */
2168 		rename_ctl(codec, "Capture Volume",
2169 			   codec->addr == 0 ?
2170 			   "Rear-Panel Capture Volume" :
2171 			   "Front-Panel Capture Volume");
2172 		rename_ctl(codec, "Capture Switch",
2173 			   codec->addr == 0 ?
2174 			   "Rear-Panel Capture Switch" :
2175 			   "Front-Panel Capture Switch");
2176 		break;
2177 	}
2178 }
2179 
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2180 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2181 				     const struct hda_fixup *fix,
2182 				     int action)
2183 {
2184 	static const hda_nid_t conn1[] = { 0x0c };
2185 	static const struct coef_fw gb_x570_coefs[] = {
2186 		WRITE_COEF(0x07, 0x03c0),
2187 		WRITE_COEF(0x1a, 0x01c1),
2188 		WRITE_COEF(0x1b, 0x0202),
2189 		WRITE_COEF(0x43, 0x3005),
2190 		{}
2191 	};
2192 
2193 	switch (action) {
2194 	case HDA_FIXUP_ACT_PRE_PROBE:
2195 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2196 		snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2197 		break;
2198 	case HDA_FIXUP_ACT_INIT:
2199 		alc_process_coef_fw(codec, gb_x570_coefs);
2200 		break;
2201 	}
2202 }
2203 
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2204 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2205 				     const struct hda_fixup *fix,
2206 				     int action)
2207 {
2208 	static const hda_nid_t conn1[] = { 0x0c };
2209 
2210 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2211 		return;
2212 
2213 	alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2214 	/* We therefore want to make sure 0x14 (front headphone) and
2215 	 * 0x1b (speakers) use the stereo DAC 0x02
2216 	 */
2217 	snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2218 	snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2219 }
2220 
2221 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2222 				const struct hda_fixup *fix, int action);
2223 
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2224 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2225 				     const struct hda_fixup *fix,
2226 				     int action)
2227 {
2228 	alc1220_fixup_clevo_p950(codec, fix, action);
2229 	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2230 }
2231 
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2232 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2233 					 struct hda_jack_callback *jack)
2234 {
2235 	struct alc_spec *spec = codec->spec;
2236 	unsigned int vref;
2237 
2238 	snd_hda_gen_hp_automute(codec, jack);
2239 
2240 	if (spec->gen.hp_jack_present)
2241 		vref = AC_PINCTL_VREF_80;
2242 	else
2243 		vref = AC_PINCTL_VREF_HIZ;
2244 	snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2245 }
2246 
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2247 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2248 				     const struct hda_fixup *fix, int action)
2249 {
2250 	struct alc_spec *spec = codec->spec;
2251 	if (action != HDA_FIXUP_ACT_PROBE)
2252 		return;
2253 	snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2254 	spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2255 }
2256 
2257 static const struct hda_fixup alc882_fixups[] = {
2258 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
2259 		.type = HDA_FIXUP_PINS,
2260 		.v.pins = (const struct hda_pintbl[]) {
2261 			{ 0x15, 0x01080104 }, /* side */
2262 			{ 0x16, 0x01011012 }, /* rear */
2263 			{ 0x17, 0x01016011 }, /* clfe */
2264 			{ }
2265 		}
2266 	},
2267 	[ALC882_FIXUP_LENOVO_Y530] = {
2268 		.type = HDA_FIXUP_PINS,
2269 		.v.pins = (const struct hda_pintbl[]) {
2270 			{ 0x15, 0x99130112 }, /* rear int speakers */
2271 			{ 0x16, 0x99130111 }, /* subwoofer */
2272 			{ }
2273 		}
2274 	},
2275 	[ALC882_FIXUP_PB_M5210] = {
2276 		.type = HDA_FIXUP_PINCTLS,
2277 		.v.pins = (const struct hda_pintbl[]) {
2278 			{ 0x19, PIN_VREF50 },
2279 			{}
2280 		}
2281 	},
2282 	[ALC882_FIXUP_ACER_ASPIRE_7736] = {
2283 		.type = HDA_FIXUP_FUNC,
2284 		.v.func = alc_fixup_sku_ignore,
2285 	},
2286 	[ALC882_FIXUP_ASUS_W90V] = {
2287 		.type = HDA_FIXUP_PINS,
2288 		.v.pins = (const struct hda_pintbl[]) {
2289 			{ 0x16, 0x99130110 }, /* fix sequence for CLFE */
2290 			{ }
2291 		}
2292 	},
2293 	[ALC889_FIXUP_CD] = {
2294 		.type = HDA_FIXUP_PINS,
2295 		.v.pins = (const struct hda_pintbl[]) {
2296 			{ 0x1c, 0x993301f0 }, /* CD */
2297 			{ }
2298 		}
2299 	},
2300 	[ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2301 		.type = HDA_FIXUP_PINS,
2302 		.v.pins = (const struct hda_pintbl[]) {
2303 			{ 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2304 			{ }
2305 		},
2306 		.chained = true,
2307 		.chain_id = ALC889_FIXUP_CD,
2308 	},
2309 	[ALC889_FIXUP_VAIO_TT] = {
2310 		.type = HDA_FIXUP_PINS,
2311 		.v.pins = (const struct hda_pintbl[]) {
2312 			{ 0x17, 0x90170111 }, /* hidden surround speaker */
2313 			{ }
2314 		}
2315 	},
2316 	[ALC888_FIXUP_EEE1601] = {
2317 		.type = HDA_FIXUP_VERBS,
2318 		.v.verbs = (const struct hda_verb[]) {
2319 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2320 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x0838 },
2321 			{ }
2322 		}
2323 	},
2324 	[ALC886_FIXUP_EAPD] = {
2325 		.type = HDA_FIXUP_VERBS,
2326 		.v.verbs = (const struct hda_verb[]) {
2327 			/* change to EAPD mode */
2328 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2329 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2330 			{ }
2331 		}
2332 	},
2333 	[ALC882_FIXUP_EAPD] = {
2334 		.type = HDA_FIXUP_VERBS,
2335 		.v.verbs = (const struct hda_verb[]) {
2336 			/* change to EAPD mode */
2337 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2338 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2339 			{ }
2340 		}
2341 	},
2342 	[ALC883_FIXUP_EAPD] = {
2343 		.type = HDA_FIXUP_VERBS,
2344 		.v.verbs = (const struct hda_verb[]) {
2345 			/* change to EAPD mode */
2346 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2347 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2348 			{ }
2349 		}
2350 	},
2351 	[ALC883_FIXUP_ACER_EAPD] = {
2352 		.type = HDA_FIXUP_VERBS,
2353 		.v.verbs = (const struct hda_verb[]) {
2354 			/* eanable EAPD on Acer laptops */
2355 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2356 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2357 			{ }
2358 		}
2359 	},
2360 	[ALC882_FIXUP_GPIO1] = {
2361 		.type = HDA_FIXUP_FUNC,
2362 		.v.func = alc_fixup_gpio1,
2363 	},
2364 	[ALC882_FIXUP_GPIO2] = {
2365 		.type = HDA_FIXUP_FUNC,
2366 		.v.func = alc_fixup_gpio2,
2367 	},
2368 	[ALC882_FIXUP_GPIO3] = {
2369 		.type = HDA_FIXUP_FUNC,
2370 		.v.func = alc_fixup_gpio3,
2371 	},
2372 	[ALC882_FIXUP_ASUS_W2JC] = {
2373 		.type = HDA_FIXUP_FUNC,
2374 		.v.func = alc_fixup_gpio1,
2375 		.chained = true,
2376 		.chain_id = ALC882_FIXUP_EAPD,
2377 	},
2378 	[ALC889_FIXUP_COEF] = {
2379 		.type = HDA_FIXUP_FUNC,
2380 		.v.func = alc889_fixup_coef,
2381 	},
2382 	[ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2383 		.type = HDA_FIXUP_PINS,
2384 		.v.pins = (const struct hda_pintbl[]) {
2385 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2386 			{ 0x17, 0x99130112 }, /* surround speaker */
2387 			{ }
2388 		},
2389 		.chained = true,
2390 		.chain_id = ALC882_FIXUP_GPIO1,
2391 	},
2392 	[ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2393 		.type = HDA_FIXUP_PINS,
2394 		.v.pins = (const struct hda_pintbl[]) {
2395 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2396 			{ 0x1b, 0x99130112 }, /* surround speaker */
2397 			{ }
2398 		},
2399 		.chained = true,
2400 		.chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2401 	},
2402 	[ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2403 		/* additional init verbs for Acer Aspire 8930G */
2404 		.type = HDA_FIXUP_VERBS,
2405 		.v.verbs = (const struct hda_verb[]) {
2406 			/* Enable all DACs */
2407 			/* DAC DISABLE/MUTE 1? */
2408 			/*  setting bits 1-5 disables DAC nids 0x02-0x06
2409 			 *  apparently. Init=0x38 */
2410 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2411 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2412 			/* DAC DISABLE/MUTE 2? */
2413 			/*  some bit here disables the other DACs.
2414 			 *  Init=0x4900 */
2415 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2416 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2417 			/* DMIC fix
2418 			 * This laptop has a stereo digital microphone.
2419 			 * The mics are only 1cm apart which makes the stereo
2420 			 * useless. However, either the mic or the ALC889
2421 			 * makes the signal become a difference/sum signal
2422 			 * instead of standard stereo, which is annoying.
2423 			 * So instead we flip this bit which makes the
2424 			 * codec replicate the sum signal to both channels,
2425 			 * turning it into a normal mono mic.
2426 			 */
2427 			/* DMIC_CONTROL? Init value = 0x0001 */
2428 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2429 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2430 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2431 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2432 			{ }
2433 		},
2434 		.chained = true,
2435 		.chain_id = ALC882_FIXUP_GPIO1,
2436 	},
2437 	[ALC885_FIXUP_MACPRO_GPIO] = {
2438 		.type = HDA_FIXUP_FUNC,
2439 		.v.func = alc885_fixup_macpro_gpio,
2440 	},
2441 	[ALC889_FIXUP_DAC_ROUTE] = {
2442 		.type = HDA_FIXUP_FUNC,
2443 		.v.func = alc889_fixup_dac_route,
2444 	},
2445 	[ALC889_FIXUP_MBP_VREF] = {
2446 		.type = HDA_FIXUP_FUNC,
2447 		.v.func = alc889_fixup_mbp_vref,
2448 		.chained = true,
2449 		.chain_id = ALC882_FIXUP_GPIO1,
2450 	},
2451 	[ALC889_FIXUP_IMAC91_VREF] = {
2452 		.type = HDA_FIXUP_FUNC,
2453 		.v.func = alc889_fixup_imac91_vref,
2454 		.chained = true,
2455 		.chain_id = ALC882_FIXUP_GPIO1,
2456 	},
2457 	[ALC889_FIXUP_MBA11_VREF] = {
2458 		.type = HDA_FIXUP_FUNC,
2459 		.v.func = alc889_fixup_mba11_vref,
2460 		.chained = true,
2461 		.chain_id = ALC889_FIXUP_MBP_VREF,
2462 	},
2463 	[ALC889_FIXUP_MBA21_VREF] = {
2464 		.type = HDA_FIXUP_FUNC,
2465 		.v.func = alc889_fixup_mba21_vref,
2466 		.chained = true,
2467 		.chain_id = ALC889_FIXUP_MBP_VREF,
2468 	},
2469 	[ALC889_FIXUP_MP11_VREF] = {
2470 		.type = HDA_FIXUP_FUNC,
2471 		.v.func = alc889_fixup_mba11_vref,
2472 		.chained = true,
2473 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2474 	},
2475 	[ALC889_FIXUP_MP41_VREF] = {
2476 		.type = HDA_FIXUP_FUNC,
2477 		.v.func = alc889_fixup_mbp_vref,
2478 		.chained = true,
2479 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2480 	},
2481 	[ALC882_FIXUP_INV_DMIC] = {
2482 		.type = HDA_FIXUP_FUNC,
2483 		.v.func = alc_fixup_inv_dmic,
2484 	},
2485 	[ALC882_FIXUP_NO_PRIMARY_HP] = {
2486 		.type = HDA_FIXUP_FUNC,
2487 		.v.func = alc882_fixup_no_primary_hp,
2488 	},
2489 	[ALC887_FIXUP_ASUS_BASS] = {
2490 		.type = HDA_FIXUP_PINS,
2491 		.v.pins = (const struct hda_pintbl[]) {
2492 			{0x16, 0x99130130}, /* bass speaker */
2493 			{}
2494 		},
2495 		.chained = true,
2496 		.chain_id = ALC887_FIXUP_BASS_CHMAP,
2497 	},
2498 	[ALC887_FIXUP_BASS_CHMAP] = {
2499 		.type = HDA_FIXUP_FUNC,
2500 		.v.func = alc_fixup_bass_chmap,
2501 	},
2502 	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
2503 		.type = HDA_FIXUP_FUNC,
2504 		.v.func = alc1220_fixup_gb_dual_codecs,
2505 	},
2506 	[ALC1220_FIXUP_GB_X570] = {
2507 		.type = HDA_FIXUP_FUNC,
2508 		.v.func = alc1220_fixup_gb_x570,
2509 	},
2510 	[ALC1220_FIXUP_CLEVO_P950] = {
2511 		.type = HDA_FIXUP_FUNC,
2512 		.v.func = alc1220_fixup_clevo_p950,
2513 	},
2514 	[ALC1220_FIXUP_CLEVO_PB51ED] = {
2515 		.type = HDA_FIXUP_FUNC,
2516 		.v.func = alc1220_fixup_clevo_pb51ed,
2517 	},
2518 	[ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2519 		.type = HDA_FIXUP_PINS,
2520 		.v.pins = (const struct hda_pintbl[]) {
2521 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2522 			{}
2523 		},
2524 		.chained = true,
2525 		.chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2526 	},
2527 	[ALC887_FIXUP_ASUS_AUDIO] = {
2528 		.type = HDA_FIXUP_PINS,
2529 		.v.pins = (const struct hda_pintbl[]) {
2530 			{ 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2531 			{ 0x19, 0x22219420 },
2532 			{}
2533 		},
2534 	},
2535 	[ALC887_FIXUP_ASUS_HMIC] = {
2536 		.type = HDA_FIXUP_FUNC,
2537 		.v.func = alc887_fixup_asus_jack,
2538 		.chained = true,
2539 		.chain_id = ALC887_FIXUP_ASUS_AUDIO,
2540 	},
2541 	[ALCS1200A_FIXUP_MIC_VREF] = {
2542 		.type = HDA_FIXUP_PINCTLS,
2543 		.v.pins = (const struct hda_pintbl[]) {
2544 			{ 0x18, PIN_VREF50 }, /* rear mic */
2545 			{ 0x19, PIN_VREF50 }, /* front mic */
2546 			{}
2547 		}
2548 	},
2549 	[ALC888VD_FIXUP_MIC_100VREF] = {
2550 		.type = HDA_FIXUP_PINCTLS,
2551 		.v.pins = (const struct hda_pintbl[]) {
2552 			{ 0x18, PIN_VREF100 }, /* headset mic */
2553 			{}
2554 		}
2555 	},
2556 };
2557 
2558 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2559 	SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2560 	SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2561 	SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2562 	SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2563 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2564 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2565 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2566 	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2567 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2568 	SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2569 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2570 	SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2571 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2572 	SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2573 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2574 	SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2575 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2576 	SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2577 	SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2578 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2579 	SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2580 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2581 	SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2582 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2583 	SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2584 	SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2585 	SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2586 	SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2587 	SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2588 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2589 	SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2590 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2591 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2592 	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2593 	SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2594 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2595 	SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2596 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2597 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2598 	SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2599 
2600 	/* All Apple entries are in codec SSIDs */
2601 	SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2602 	SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2603 	SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2604 	SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2605 	SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2606 	SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2607 	SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2608 	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2609 	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2610 	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2611 	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2612 	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2613 	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2614 	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2615 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2616 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2617 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2618 	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2619 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2620 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2621 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2622 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2623 
2624 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2625 	SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2626 	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2627 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2628 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2629 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2630 	SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2631 	SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2632 	SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2633 	SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2634 	SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2635 	SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2636 	SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2637 	SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2638 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2639 	SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2640 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2641 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2642 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2643 	SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2644 	SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2645 	SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2646 	SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2647 	SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2648 	SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2649 	SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2650 	SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2651 	SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2652 	SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2653 	SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2654 	SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2655 	SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2656 	SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 	SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 	SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 	SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 	SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2661 	SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2662 	SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2663 	SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2664 	SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2665 	SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2666 	SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2667 	SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2668 	SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2669 	SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2670 	SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2671 	SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2672 	SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2673 	SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2674 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2675 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2676 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2677 	SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2678 	{}
2679 };
2680 
2681 static const struct hda_model_fixup alc882_fixup_models[] = {
2682 	{.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2683 	{.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2684 	{.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2685 	{.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2686 	{.id = ALC889_FIXUP_CD, .name = "cd"},
2687 	{.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2688 	{.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2689 	{.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2690 	{.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2691 	{.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2692 	{.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2693 	{.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2694 	{.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2695 	{.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2696 	{.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2697 	{.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2698 	{.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2699 	{.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2700 	{.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2701 	{.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2702 	{.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2703 	{.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2704 	{.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2705 	{.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2706 	{.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2707 	{.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2708 	{.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2709 	{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2710 	{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2711 	{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2712 	{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2713 	{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2714 	{}
2715 };
2716 
2717 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2718 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2719 		{0x14, 0x01014010},
2720 		{0x15, 0x01011012},
2721 		{0x16, 0x01016011},
2722 		{0x18, 0x01a19040},
2723 		{0x19, 0x02a19050},
2724 		{0x1a, 0x0181304f},
2725 		{0x1b, 0x0221401f},
2726 		{0x1e, 0x01456130}),
2727 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2728 		{0x14, 0x01015010},
2729 		{0x15, 0x01011012},
2730 		{0x16, 0x01011011},
2731 		{0x18, 0x01a11040},
2732 		{0x19, 0x02a19050},
2733 		{0x1a, 0x0181104f},
2734 		{0x1b, 0x0221401f},
2735 		{0x1e, 0x01451130}),
2736 	{}
2737 };
2738 
2739 /*
2740  * BIOS auto configuration
2741  */
2742 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2743 static int alc882_parse_auto_config(struct hda_codec *codec)
2744 {
2745 	static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2746 	static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2747 	return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2748 }
2749 
2750 /*
2751  */
patch_alc882(struct hda_codec * codec)2752 static int patch_alc882(struct hda_codec *codec)
2753 {
2754 	struct alc_spec *spec;
2755 	int err;
2756 
2757 	err = alc_alloc_spec(codec, 0x0b);
2758 	if (err < 0)
2759 		return err;
2760 
2761 	spec = codec->spec;
2762 
2763 	switch (codec->core.vendor_id) {
2764 	case 0x10ec0882:
2765 	case 0x10ec0885:
2766 	case 0x10ec0900:
2767 	case 0x10ec0b00:
2768 	case 0x10ec1220:
2769 		break;
2770 	default:
2771 		/* ALC883 and variants */
2772 		alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2773 		break;
2774 	}
2775 
2776 	alc_pre_init(codec);
2777 
2778 	snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2779 		       alc882_fixups);
2780 	snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2781 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2782 
2783 	alc_auto_parse_customize_define(codec);
2784 
2785 	if (has_cdefine_beep(codec))
2786 		spec->gen.beep_nid = 0x01;
2787 
2788 	/* automatic parse from the BIOS config */
2789 	err = alc882_parse_auto_config(codec);
2790 	if (err < 0)
2791 		goto error;
2792 
2793 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2794 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2795 		if (err < 0)
2796 			goto error;
2797 	}
2798 
2799 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2800 
2801 	return 0;
2802 
2803  error:
2804 	alc_free(codec);
2805 	return err;
2806 }
2807 
2808 
2809 /*
2810  * ALC262 support
2811  */
alc262_parse_auto_config(struct hda_codec * codec)2812 static int alc262_parse_auto_config(struct hda_codec *codec)
2813 {
2814 	static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2815 	static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2816 	return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2817 }
2818 
2819 /*
2820  * Pin config fixes
2821  */
2822 enum {
2823 	ALC262_FIXUP_FSC_H270,
2824 	ALC262_FIXUP_FSC_S7110,
2825 	ALC262_FIXUP_HP_Z200,
2826 	ALC262_FIXUP_TYAN,
2827 	ALC262_FIXUP_LENOVO_3000,
2828 	ALC262_FIXUP_BENQ,
2829 	ALC262_FIXUP_BENQ_T31,
2830 	ALC262_FIXUP_INV_DMIC,
2831 	ALC262_FIXUP_INTEL_BAYLEYBAY,
2832 };
2833 
2834 static const struct hda_fixup alc262_fixups[] = {
2835 	[ALC262_FIXUP_FSC_H270] = {
2836 		.type = HDA_FIXUP_PINS,
2837 		.v.pins = (const struct hda_pintbl[]) {
2838 			{ 0x14, 0x99130110 }, /* speaker */
2839 			{ 0x15, 0x0221142f }, /* front HP */
2840 			{ 0x1b, 0x0121141f }, /* rear HP */
2841 			{ }
2842 		}
2843 	},
2844 	[ALC262_FIXUP_FSC_S7110] = {
2845 		.type = HDA_FIXUP_PINS,
2846 		.v.pins = (const struct hda_pintbl[]) {
2847 			{ 0x15, 0x90170110 }, /* speaker */
2848 			{ }
2849 		},
2850 		.chained = true,
2851 		.chain_id = ALC262_FIXUP_BENQ,
2852 	},
2853 	[ALC262_FIXUP_HP_Z200] = {
2854 		.type = HDA_FIXUP_PINS,
2855 		.v.pins = (const struct hda_pintbl[]) {
2856 			{ 0x16, 0x99130120 }, /* internal speaker */
2857 			{ }
2858 		}
2859 	},
2860 	[ALC262_FIXUP_TYAN] = {
2861 		.type = HDA_FIXUP_PINS,
2862 		.v.pins = (const struct hda_pintbl[]) {
2863 			{ 0x14, 0x1993e1f0 }, /* int AUX */
2864 			{ }
2865 		}
2866 	},
2867 	[ALC262_FIXUP_LENOVO_3000] = {
2868 		.type = HDA_FIXUP_PINCTLS,
2869 		.v.pins = (const struct hda_pintbl[]) {
2870 			{ 0x19, PIN_VREF50 },
2871 			{}
2872 		},
2873 		.chained = true,
2874 		.chain_id = ALC262_FIXUP_BENQ,
2875 	},
2876 	[ALC262_FIXUP_BENQ] = {
2877 		.type = HDA_FIXUP_VERBS,
2878 		.v.verbs = (const struct hda_verb[]) {
2879 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2880 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2881 			{}
2882 		}
2883 	},
2884 	[ALC262_FIXUP_BENQ_T31] = {
2885 		.type = HDA_FIXUP_VERBS,
2886 		.v.verbs = (const struct hda_verb[]) {
2887 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2888 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2889 			{}
2890 		}
2891 	},
2892 	[ALC262_FIXUP_INV_DMIC] = {
2893 		.type = HDA_FIXUP_FUNC,
2894 		.v.func = alc_fixup_inv_dmic,
2895 	},
2896 	[ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2897 		.type = HDA_FIXUP_FUNC,
2898 		.v.func = alc_fixup_no_depop_delay,
2899 	},
2900 };
2901 
2902 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2903 	SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2904 	SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2905 	SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2906 	SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2907 	SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2908 	SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2909 	SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2910 	SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2911 	SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2912 	SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2913 	{}
2914 };
2915 
2916 static const struct hda_model_fixup alc262_fixup_models[] = {
2917 	{.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2918 	{.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2919 	{.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2920 	{.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2921 	{.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2922 	{.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2923 	{.id = ALC262_FIXUP_BENQ, .name = "benq"},
2924 	{.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2925 	{.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2926 	{}
2927 };
2928 
2929 /*
2930  */
patch_alc262(struct hda_codec * codec)2931 static int patch_alc262(struct hda_codec *codec)
2932 {
2933 	struct alc_spec *spec;
2934 	int err;
2935 
2936 	err = alc_alloc_spec(codec, 0x0b);
2937 	if (err < 0)
2938 		return err;
2939 
2940 	spec = codec->spec;
2941 	spec->gen.shared_mic_vref_pin = 0x18;
2942 
2943 	spec->shutup = alc_eapd_shutup;
2944 
2945 #if 0
2946 	/* pshou 07/11/05  set a zero PCM sample to DAC when FIFO is
2947 	 * under-run
2948 	 */
2949 	alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2950 #endif
2951 	alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2952 
2953 	alc_pre_init(codec);
2954 
2955 	snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2956 		       alc262_fixups);
2957 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2958 
2959 	alc_auto_parse_customize_define(codec);
2960 
2961 	if (has_cdefine_beep(codec))
2962 		spec->gen.beep_nid = 0x01;
2963 
2964 	/* automatic parse from the BIOS config */
2965 	err = alc262_parse_auto_config(codec);
2966 	if (err < 0)
2967 		goto error;
2968 
2969 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2970 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2971 		if (err < 0)
2972 			goto error;
2973 	}
2974 
2975 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2976 
2977 	return 0;
2978 
2979  error:
2980 	alc_free(codec);
2981 	return err;
2982 }
2983 
2984 /*
2985  *  ALC268
2986  */
2987 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)2988 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2989 				  struct snd_ctl_elem_value *ucontrol)
2990 {
2991 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2992 	unsigned long pval;
2993 	int err;
2994 
2995 	mutex_lock(&codec->control_mutex);
2996 	pval = kcontrol->private_value;
2997 	kcontrol->private_value = (pval & ~0xff) | 0x0f;
2998 	err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2999 	if (err >= 0) {
3000 		kcontrol->private_value = (pval & ~0xff) | 0x10;
3001 		err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3002 	}
3003 	kcontrol->private_value = pval;
3004 	mutex_unlock(&codec->control_mutex);
3005 	return err;
3006 }
3007 
3008 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3009 	HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3010 	{
3011 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3012 		.name = "Beep Playback Switch",
3013 		.subdevice = HDA_SUBDEV_AMP_FLAG,
3014 		.info = snd_hda_mixer_amp_switch_info,
3015 		.get = snd_hda_mixer_amp_switch_get,
3016 		.put = alc268_beep_switch_put,
3017 		.private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3018 	},
3019 };
3020 
3021 /* set PCBEEP vol = 0, mute connections */
3022 static const struct hda_verb alc268_beep_init_verbs[] = {
3023 	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3024 	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3025 	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3026 	{ }
3027 };
3028 
3029 enum {
3030 	ALC268_FIXUP_INV_DMIC,
3031 	ALC268_FIXUP_HP_EAPD,
3032 	ALC268_FIXUP_SPDIF,
3033 };
3034 
3035 static const struct hda_fixup alc268_fixups[] = {
3036 	[ALC268_FIXUP_INV_DMIC] = {
3037 		.type = HDA_FIXUP_FUNC,
3038 		.v.func = alc_fixup_inv_dmic,
3039 	},
3040 	[ALC268_FIXUP_HP_EAPD] = {
3041 		.type = HDA_FIXUP_VERBS,
3042 		.v.verbs = (const struct hda_verb[]) {
3043 			{0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3044 			{}
3045 		}
3046 	},
3047 	[ALC268_FIXUP_SPDIF] = {
3048 		.type = HDA_FIXUP_PINS,
3049 		.v.pins = (const struct hda_pintbl[]) {
3050 			{ 0x1e, 0x014b1180 }, /* enable SPDIF out */
3051 			{}
3052 		}
3053 	},
3054 };
3055 
3056 static const struct hda_model_fixup alc268_fixup_models[] = {
3057 	{.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3058 	{.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3059 	{.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3060 	{}
3061 };
3062 
3063 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
3064 	SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3065 	SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3066 	/* below is codec SSID since multiple Toshiba laptops have the
3067 	 * same PCI SSID 1179:ff00
3068 	 */
3069 	SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3070 	{}
3071 };
3072 
3073 /*
3074  * BIOS auto configuration
3075  */
alc268_parse_auto_config(struct hda_codec * codec)3076 static int alc268_parse_auto_config(struct hda_codec *codec)
3077 {
3078 	static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3079 	return alc_parse_auto_config(codec, NULL, alc268_ssids);
3080 }
3081 
3082 /*
3083  */
patch_alc268(struct hda_codec * codec)3084 static int patch_alc268(struct hda_codec *codec)
3085 {
3086 	struct alc_spec *spec;
3087 	int i, err;
3088 
3089 	/* ALC268 has no aa-loopback mixer */
3090 	err = alc_alloc_spec(codec, 0);
3091 	if (err < 0)
3092 		return err;
3093 
3094 	spec = codec->spec;
3095 	if (has_cdefine_beep(codec))
3096 		spec->gen.beep_nid = 0x01;
3097 
3098 	spec->shutup = alc_eapd_shutup;
3099 
3100 	alc_pre_init(codec);
3101 
3102 	snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3103 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3104 
3105 	/* automatic parse from the BIOS config */
3106 	err = alc268_parse_auto_config(codec);
3107 	if (err < 0)
3108 		goto error;
3109 
3110 	if (err > 0 && !spec->gen.no_analog &&
3111 	    spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3112 		for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3113 			if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3114 						  &alc268_beep_mixer[i])) {
3115 				err = -ENOMEM;
3116 				goto error;
3117 			}
3118 		}
3119 		snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3120 		if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3121 			/* override the amp caps for beep generator */
3122 			snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3123 					  (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3124 					  (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3125 					  (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3126 					  (0 << AC_AMPCAP_MUTE_SHIFT));
3127 	}
3128 
3129 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3130 
3131 	return 0;
3132 
3133  error:
3134 	alc_free(codec);
3135 	return err;
3136 }
3137 
3138 /*
3139  * ALC269
3140  */
3141 
3142 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3143 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3144 };
3145 
3146 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3147 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3148 };
3149 
3150 /* different alc269-variants */
3151 enum {
3152 	ALC269_TYPE_ALC269VA,
3153 	ALC269_TYPE_ALC269VB,
3154 	ALC269_TYPE_ALC269VC,
3155 	ALC269_TYPE_ALC269VD,
3156 	ALC269_TYPE_ALC280,
3157 	ALC269_TYPE_ALC282,
3158 	ALC269_TYPE_ALC283,
3159 	ALC269_TYPE_ALC284,
3160 	ALC269_TYPE_ALC293,
3161 	ALC269_TYPE_ALC286,
3162 	ALC269_TYPE_ALC298,
3163 	ALC269_TYPE_ALC255,
3164 	ALC269_TYPE_ALC256,
3165 	ALC269_TYPE_ALC257,
3166 	ALC269_TYPE_ALC215,
3167 	ALC269_TYPE_ALC225,
3168 	ALC269_TYPE_ALC245,
3169 	ALC269_TYPE_ALC287,
3170 	ALC269_TYPE_ALC294,
3171 	ALC269_TYPE_ALC300,
3172 	ALC269_TYPE_ALC623,
3173 	ALC269_TYPE_ALC700,
3174 };
3175 
3176 /*
3177  * BIOS auto configuration
3178  */
alc269_parse_auto_config(struct hda_codec * codec)3179 static int alc269_parse_auto_config(struct hda_codec *codec)
3180 {
3181 	static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3182 	static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3183 	static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3184 	struct alc_spec *spec = codec->spec;
3185 	const hda_nid_t *ssids;
3186 
3187 	switch (spec->codec_variant) {
3188 	case ALC269_TYPE_ALC269VA:
3189 	case ALC269_TYPE_ALC269VC:
3190 	case ALC269_TYPE_ALC280:
3191 	case ALC269_TYPE_ALC284:
3192 	case ALC269_TYPE_ALC293:
3193 		ssids = alc269va_ssids;
3194 		break;
3195 	case ALC269_TYPE_ALC269VB:
3196 	case ALC269_TYPE_ALC269VD:
3197 	case ALC269_TYPE_ALC282:
3198 	case ALC269_TYPE_ALC283:
3199 	case ALC269_TYPE_ALC286:
3200 	case ALC269_TYPE_ALC298:
3201 	case ALC269_TYPE_ALC255:
3202 	case ALC269_TYPE_ALC256:
3203 	case ALC269_TYPE_ALC257:
3204 	case ALC269_TYPE_ALC215:
3205 	case ALC269_TYPE_ALC225:
3206 	case ALC269_TYPE_ALC245:
3207 	case ALC269_TYPE_ALC287:
3208 	case ALC269_TYPE_ALC294:
3209 	case ALC269_TYPE_ALC300:
3210 	case ALC269_TYPE_ALC623:
3211 	case ALC269_TYPE_ALC700:
3212 		ssids = alc269_ssids;
3213 		break;
3214 	default:
3215 		ssids = alc269_ssids;
3216 		break;
3217 	}
3218 
3219 	return alc_parse_auto_config(codec, alc269_ignore, ssids);
3220 }
3221 
3222 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3223 	{ SND_JACK_BTN_0, KEY_PLAYPAUSE },
3224 	{ SND_JACK_BTN_1, KEY_VOICECOMMAND },
3225 	{ SND_JACK_BTN_2, KEY_VOLUMEUP },
3226 	{ SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3227 	{}
3228 };
3229 
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3230 static void alc_headset_btn_callback(struct hda_codec *codec,
3231 				     struct hda_jack_callback *jack)
3232 {
3233 	int report = 0;
3234 
3235 	if (jack->unsol_res & (7 << 13))
3236 		report |= SND_JACK_BTN_0;
3237 
3238 	if (jack->unsol_res  & (1 << 16 | 3 << 8))
3239 		report |= SND_JACK_BTN_1;
3240 
3241 	/* Volume up key */
3242 	if (jack->unsol_res & (7 << 23))
3243 		report |= SND_JACK_BTN_2;
3244 
3245 	/* Volume down key */
3246 	if (jack->unsol_res & (7 << 10))
3247 		report |= SND_JACK_BTN_3;
3248 
3249 	snd_hda_jack_set_button_state(codec, jack->nid, report);
3250 }
3251 
alc_disable_headset_jack_key(struct hda_codec * codec)3252 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3253 {
3254 	struct alc_spec *spec = codec->spec;
3255 
3256 	if (!spec->has_hs_key)
3257 		return;
3258 
3259 	switch (codec->core.vendor_id) {
3260 	case 0x10ec0215:
3261 	case 0x10ec0225:
3262 	case 0x10ec0285:
3263 	case 0x10ec0287:
3264 	case 0x10ec0295:
3265 	case 0x10ec0289:
3266 	case 0x10ec0299:
3267 		alc_write_coef_idx(codec, 0x48, 0x0);
3268 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3269 		alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3270 		break;
3271 	case 0x10ec0230:
3272 	case 0x10ec0236:
3273 	case 0x10ec0256:
3274 	case 0x10ec0257:
3275 	case 0x19e58326:
3276 		alc_write_coef_idx(codec, 0x48, 0x0);
3277 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3278 		break;
3279 	}
3280 }
3281 
alc_enable_headset_jack_key(struct hda_codec * codec)3282 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3283 {
3284 	struct alc_spec *spec = codec->spec;
3285 
3286 	if (!spec->has_hs_key)
3287 		return;
3288 
3289 	switch (codec->core.vendor_id) {
3290 	case 0x10ec0215:
3291 	case 0x10ec0225:
3292 	case 0x10ec0285:
3293 	case 0x10ec0287:
3294 	case 0x10ec0295:
3295 	case 0x10ec0289:
3296 	case 0x10ec0299:
3297 		alc_write_coef_idx(codec, 0x48, 0xd011);
3298 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3299 		alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3300 		break;
3301 	case 0x10ec0230:
3302 	case 0x10ec0236:
3303 	case 0x10ec0256:
3304 	case 0x10ec0257:
3305 	case 0x19e58326:
3306 		alc_write_coef_idx(codec, 0x48, 0xd011);
3307 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3308 		break;
3309 	}
3310 }
3311 
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3312 static void alc_fixup_headset_jack(struct hda_codec *codec,
3313 				    const struct hda_fixup *fix, int action)
3314 {
3315 	struct alc_spec *spec = codec->spec;
3316 	hda_nid_t hp_pin;
3317 
3318 	switch (action) {
3319 	case HDA_FIXUP_ACT_PRE_PROBE:
3320 		spec->has_hs_key = 1;
3321 		snd_hda_jack_detect_enable_callback(codec, 0x55,
3322 						    alc_headset_btn_callback);
3323 		break;
3324 	case HDA_FIXUP_ACT_BUILD:
3325 		hp_pin = alc_get_hp_pin(spec);
3326 		if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3327 							alc_headset_btn_keymap,
3328 							hp_pin))
3329 			snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3330 					      false, SND_JACK_HEADSET,
3331 					      alc_headset_btn_keymap);
3332 
3333 		alc_enable_headset_jack_key(codec);
3334 		break;
3335 	}
3336 }
3337 
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3338 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3339 {
3340 	alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3341 }
3342 
alc269_shutup(struct hda_codec * codec)3343 static void alc269_shutup(struct hda_codec *codec)
3344 {
3345 	struct alc_spec *spec = codec->spec;
3346 
3347 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3348 		alc269vb_toggle_power_output(codec, 0);
3349 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3350 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3351 		msleep(150);
3352 	}
3353 	alc_shutup_pins(codec);
3354 }
3355 
3356 static const struct coef_fw alc282_coefs[] = {
3357 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3358 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3359 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3360 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3361 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3362 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3363 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3364 	WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3365 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3366 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3367 	WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3368 	UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3369 	WRITE_COEF(0x34, 0xa0c0), /* ANC */
3370 	UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3371 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3372 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3373 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3374 	WRITE_COEF(0x63, 0x2902), /* PLL */
3375 	WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3376 	WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3377 	WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3378 	WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3379 	UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3380 	WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3381 	UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3382 	WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3383 	WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3384 	UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3385 	WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3386 	{}
3387 };
3388 
alc282_restore_default_value(struct hda_codec * codec)3389 static void alc282_restore_default_value(struct hda_codec *codec)
3390 {
3391 	alc_process_coef_fw(codec, alc282_coefs);
3392 }
3393 
alc282_init(struct hda_codec * codec)3394 static void alc282_init(struct hda_codec *codec)
3395 {
3396 	struct alc_spec *spec = codec->spec;
3397 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3398 	bool hp_pin_sense;
3399 	int coef78;
3400 
3401 	alc282_restore_default_value(codec);
3402 
3403 	if (!hp_pin)
3404 		return;
3405 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3406 	coef78 = alc_read_coef_idx(codec, 0x78);
3407 
3408 	/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3409 	/* Headphone capless set to high power mode */
3410 	alc_write_coef_idx(codec, 0x78, 0x9004);
3411 
3412 	if (hp_pin_sense)
3413 		msleep(2);
3414 
3415 	snd_hda_codec_write(codec, hp_pin, 0,
3416 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3417 
3418 	if (hp_pin_sense)
3419 		msleep(85);
3420 
3421 	snd_hda_codec_write(codec, hp_pin, 0,
3422 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3423 
3424 	if (hp_pin_sense)
3425 		msleep(100);
3426 
3427 	/* Headphone capless set to normal mode */
3428 	alc_write_coef_idx(codec, 0x78, coef78);
3429 }
3430 
alc282_shutup(struct hda_codec * codec)3431 static void alc282_shutup(struct hda_codec *codec)
3432 {
3433 	struct alc_spec *spec = codec->spec;
3434 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3435 	bool hp_pin_sense;
3436 	int coef78;
3437 
3438 	if (!hp_pin) {
3439 		alc269_shutup(codec);
3440 		return;
3441 	}
3442 
3443 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3444 	coef78 = alc_read_coef_idx(codec, 0x78);
3445 	alc_write_coef_idx(codec, 0x78, 0x9004);
3446 
3447 	if (hp_pin_sense)
3448 		msleep(2);
3449 
3450 	snd_hda_codec_write(codec, hp_pin, 0,
3451 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3452 
3453 	if (hp_pin_sense)
3454 		msleep(85);
3455 
3456 	if (!spec->no_shutup_pins)
3457 		snd_hda_codec_write(codec, hp_pin, 0,
3458 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3459 
3460 	if (hp_pin_sense)
3461 		msleep(100);
3462 
3463 	alc_auto_setup_eapd(codec, false);
3464 	alc_shutup_pins(codec);
3465 	alc_write_coef_idx(codec, 0x78, coef78);
3466 }
3467 
3468 static const struct coef_fw alc283_coefs[] = {
3469 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3470 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3471 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3472 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3473 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3474 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3475 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3476 	WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3477 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3478 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3479 	WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3480 	UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3481 	WRITE_COEF(0x22, 0xa0c0), /* ANC */
3482 	UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3483 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3484 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3485 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3486 	WRITE_COEF(0x2e, 0x2902), /* PLL */
3487 	WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3488 	WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3489 	WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3490 	WRITE_COEF(0x36, 0x0), /* capless control 5 */
3491 	UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3492 	WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3493 	UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3494 	WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3495 	WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3496 	UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3497 	WRITE_COEF(0x49, 0x0), /* test mode */
3498 	UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3499 	UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3500 	WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3501 	UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3502 	{}
3503 };
3504 
alc283_restore_default_value(struct hda_codec * codec)3505 static void alc283_restore_default_value(struct hda_codec *codec)
3506 {
3507 	alc_process_coef_fw(codec, alc283_coefs);
3508 }
3509 
alc283_init(struct hda_codec * codec)3510 static void alc283_init(struct hda_codec *codec)
3511 {
3512 	struct alc_spec *spec = codec->spec;
3513 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3514 	bool hp_pin_sense;
3515 
3516 	alc283_restore_default_value(codec);
3517 
3518 	if (!hp_pin)
3519 		return;
3520 
3521 	msleep(30);
3522 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3523 
3524 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3525 	/* Headphone capless set to high power mode */
3526 	alc_write_coef_idx(codec, 0x43, 0x9004);
3527 
3528 	snd_hda_codec_write(codec, hp_pin, 0,
3529 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3530 
3531 	if (hp_pin_sense)
3532 		msleep(85);
3533 
3534 	snd_hda_codec_write(codec, hp_pin, 0,
3535 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3536 
3537 	if (hp_pin_sense)
3538 		msleep(85);
3539 	/* Index 0x46 Combo jack auto switch control 2 */
3540 	/* 3k pull low control for Headset jack. */
3541 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3542 	/* Headphone capless set to normal mode */
3543 	alc_write_coef_idx(codec, 0x43, 0x9614);
3544 }
3545 
alc283_shutup(struct hda_codec * codec)3546 static void alc283_shutup(struct hda_codec *codec)
3547 {
3548 	struct alc_spec *spec = codec->spec;
3549 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3550 	bool hp_pin_sense;
3551 
3552 	if (!hp_pin) {
3553 		alc269_shutup(codec);
3554 		return;
3555 	}
3556 
3557 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3558 
3559 	alc_write_coef_idx(codec, 0x43, 0x9004);
3560 
3561 	/*depop hp during suspend*/
3562 	alc_write_coef_idx(codec, 0x06, 0x2100);
3563 
3564 	snd_hda_codec_write(codec, hp_pin, 0,
3565 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3566 
3567 	if (hp_pin_sense)
3568 		msleep(100);
3569 
3570 	if (!spec->no_shutup_pins)
3571 		snd_hda_codec_write(codec, hp_pin, 0,
3572 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3573 
3574 	alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3575 
3576 	if (hp_pin_sense)
3577 		msleep(100);
3578 	alc_auto_setup_eapd(codec, false);
3579 	alc_shutup_pins(codec);
3580 	alc_write_coef_idx(codec, 0x43, 0x9614);
3581 }
3582 
alc256_init(struct hda_codec * codec)3583 static void alc256_init(struct hda_codec *codec)
3584 {
3585 	struct alc_spec *spec = codec->spec;
3586 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3587 	bool hp_pin_sense;
3588 
3589 	if (spec->ultra_low_power) {
3590 		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3591 		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3592 		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3593 		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3594 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3595 		msleep(30);
3596 	}
3597 
3598 	if (!hp_pin)
3599 		hp_pin = 0x21;
3600 
3601 	msleep(30);
3602 
3603 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3604 
3605 	if (hp_pin_sense)
3606 		msleep(2);
3607 
3608 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3609 
3610 	snd_hda_codec_write(codec, hp_pin, 0,
3611 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3612 
3613 	if (hp_pin_sense || spec->ultra_low_power)
3614 		msleep(85);
3615 
3616 	snd_hda_codec_write(codec, hp_pin, 0,
3617 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3618 
3619 	if (hp_pin_sense || spec->ultra_low_power)
3620 		msleep(100);
3621 
3622 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3623 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3624 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3625 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3626 	/*
3627 	 * Expose headphone mic (or possibly Line In on some machines) instead
3628 	 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3629 	 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3630 	 * this register.
3631 	 */
3632 	alc_write_coef_idx(codec, 0x36, 0x5757);
3633 }
3634 
alc256_shutup(struct hda_codec * codec)3635 static void alc256_shutup(struct hda_codec *codec)
3636 {
3637 	struct alc_spec *spec = codec->spec;
3638 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3639 	bool hp_pin_sense;
3640 
3641 	if (!hp_pin)
3642 		hp_pin = 0x21;
3643 
3644 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3645 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3646 
3647 	if (hp_pin_sense)
3648 		msleep(2);
3649 
3650 	snd_hda_codec_write(codec, hp_pin, 0,
3651 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3652 
3653 	if (hp_pin_sense || spec->ultra_low_power)
3654 		msleep(85);
3655 
3656 	/* 3k pull low control for Headset jack. */
3657 	/* NOTE: call this before clearing the pin, otherwise codec stalls */
3658 	/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3659 	 * when booting with headset plugged. So skip setting it for the codec alc257
3660 	 */
3661 	if (spec->en_3kpull_low)
3662 		alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3663 
3664 	if (!spec->no_shutup_pins)
3665 		snd_hda_codec_write(codec, hp_pin, 0,
3666 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3667 
3668 	if (hp_pin_sense || spec->ultra_low_power)
3669 		msleep(100);
3670 
3671 	alc_auto_setup_eapd(codec, false);
3672 	alc_shutup_pins(codec);
3673 	if (spec->ultra_low_power) {
3674 		msleep(50);
3675 		alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3676 		alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3677 		alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3678 		alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3679 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3680 		msleep(30);
3681 	}
3682 }
3683 
alc285_hp_init(struct hda_codec * codec)3684 static void alc285_hp_init(struct hda_codec *codec)
3685 {
3686 	struct alc_spec *spec = codec->spec;
3687 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3688 	int i, val;
3689 	int coef38, coef0d, coef36;
3690 
3691 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3692 	alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3693 	coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3694 	coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3695 	coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3696 	alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3697 	alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3698 
3699 	alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3700 
3701 	if (hp_pin)
3702 		snd_hda_codec_write(codec, hp_pin, 0,
3703 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3704 
3705 	msleep(130);
3706 	alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3707 	alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3708 
3709 	if (hp_pin)
3710 		snd_hda_codec_write(codec, hp_pin, 0,
3711 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3712 	msleep(10);
3713 	alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3714 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3715 	alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3716 	alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3717 
3718 	alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3719 	val = alc_read_coefex_idx(codec, 0x58, 0x00);
3720 	for (i = 0; i < 20 && val & 0x8000; i++) {
3721 		msleep(50);
3722 		val = alc_read_coefex_idx(codec, 0x58, 0x00);
3723 	} /* Wait for depop procedure finish  */
3724 
3725 	alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3726 	alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3727 	alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3728 	alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3729 
3730 	msleep(50);
3731 	alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3732 }
3733 
alc225_init(struct hda_codec * codec)3734 static void alc225_init(struct hda_codec *codec)
3735 {
3736 	struct alc_spec *spec = codec->spec;
3737 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3738 	bool hp1_pin_sense, hp2_pin_sense;
3739 
3740 	if (spec->ultra_low_power) {
3741 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3742 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3743 		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3744 		msleep(30);
3745 	}
3746 
3747 	if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3748 		spec->codec_variant != ALC269_TYPE_ALC245)
3749 		/* required only at boot or S3 and S4 resume time */
3750 		if (!spec->done_hp_init ||
3751 			is_s3_resume(codec) ||
3752 			is_s4_resume(codec)) {
3753 			alc285_hp_init(codec);
3754 			spec->done_hp_init = true;
3755 		}
3756 
3757 	if (!hp_pin)
3758 		hp_pin = 0x21;
3759 	msleep(30);
3760 
3761 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3762 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3763 
3764 	if (hp1_pin_sense || hp2_pin_sense)
3765 		msleep(2);
3766 
3767 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3768 
3769 	if (hp1_pin_sense || spec->ultra_low_power)
3770 		snd_hda_codec_write(codec, hp_pin, 0,
3771 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3772 	if (hp2_pin_sense)
3773 		snd_hda_codec_write(codec, 0x16, 0,
3774 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3775 
3776 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3777 		msleep(85);
3778 
3779 	if (hp1_pin_sense || spec->ultra_low_power)
3780 		snd_hda_codec_write(codec, hp_pin, 0,
3781 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3782 	if (hp2_pin_sense)
3783 		snd_hda_codec_write(codec, 0x16, 0,
3784 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3785 
3786 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3787 		msleep(100);
3788 
3789 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3790 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3791 }
3792 
alc225_shutup(struct hda_codec * codec)3793 static void alc225_shutup(struct hda_codec *codec)
3794 {
3795 	struct alc_spec *spec = codec->spec;
3796 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3797 	bool hp1_pin_sense, hp2_pin_sense;
3798 
3799 	if (!hp_pin)
3800 		hp_pin = 0x21;
3801 
3802 	alc_disable_headset_jack_key(codec);
3803 	/* 3k pull low control for Headset jack. */
3804 	alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3805 
3806 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3807 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3808 
3809 	if (hp1_pin_sense || hp2_pin_sense)
3810 		msleep(2);
3811 
3812 	if (hp1_pin_sense || spec->ultra_low_power)
3813 		snd_hda_codec_write(codec, hp_pin, 0,
3814 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3815 	if (hp2_pin_sense)
3816 		snd_hda_codec_write(codec, 0x16, 0,
3817 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3818 
3819 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3820 		msleep(85);
3821 
3822 	if (hp1_pin_sense || spec->ultra_low_power)
3823 		snd_hda_codec_write(codec, hp_pin, 0,
3824 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3825 	if (hp2_pin_sense)
3826 		snd_hda_codec_write(codec, 0x16, 0,
3827 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3828 
3829 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3830 		msleep(100);
3831 
3832 	alc_auto_setup_eapd(codec, false);
3833 	alc_shutup_pins(codec);
3834 	if (spec->ultra_low_power) {
3835 		msleep(50);
3836 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3837 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3838 		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3839 		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3840 		msleep(30);
3841 	}
3842 
3843 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3844 	alc_enable_headset_jack_key(codec);
3845 }
3846 
alc_default_init(struct hda_codec * codec)3847 static void alc_default_init(struct hda_codec *codec)
3848 {
3849 	struct alc_spec *spec = codec->spec;
3850 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3851 	bool hp_pin_sense;
3852 
3853 	if (!hp_pin)
3854 		return;
3855 
3856 	msleep(30);
3857 
3858 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3859 
3860 	if (hp_pin_sense)
3861 		msleep(2);
3862 
3863 	snd_hda_codec_write(codec, hp_pin, 0,
3864 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3865 
3866 	if (hp_pin_sense)
3867 		msleep(85);
3868 
3869 	snd_hda_codec_write(codec, hp_pin, 0,
3870 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3871 
3872 	if (hp_pin_sense)
3873 		msleep(100);
3874 }
3875 
alc_default_shutup(struct hda_codec * codec)3876 static void alc_default_shutup(struct hda_codec *codec)
3877 {
3878 	struct alc_spec *spec = codec->spec;
3879 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3880 	bool hp_pin_sense;
3881 
3882 	if (!hp_pin) {
3883 		alc269_shutup(codec);
3884 		return;
3885 	}
3886 
3887 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3888 
3889 	if (hp_pin_sense)
3890 		msleep(2);
3891 
3892 	snd_hda_codec_write(codec, hp_pin, 0,
3893 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3894 
3895 	if (hp_pin_sense)
3896 		msleep(85);
3897 
3898 	if (!spec->no_shutup_pins)
3899 		snd_hda_codec_write(codec, hp_pin, 0,
3900 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3901 
3902 	if (hp_pin_sense)
3903 		msleep(100);
3904 
3905 	alc_auto_setup_eapd(codec, false);
3906 	alc_shutup_pins(codec);
3907 }
3908 
alc294_hp_init(struct hda_codec * codec)3909 static void alc294_hp_init(struct hda_codec *codec)
3910 {
3911 	struct alc_spec *spec = codec->spec;
3912 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3913 	int i, val;
3914 
3915 	if (!hp_pin)
3916 		return;
3917 
3918 	snd_hda_codec_write(codec, hp_pin, 0,
3919 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3920 
3921 	msleep(100);
3922 
3923 	if (!spec->no_shutup_pins)
3924 		snd_hda_codec_write(codec, hp_pin, 0,
3925 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3926 
3927 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3928 	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3929 
3930 	/* Wait for depop procedure finish  */
3931 	val = alc_read_coefex_idx(codec, 0x58, 0x01);
3932 	for (i = 0; i < 20 && val & 0x0080; i++) {
3933 		msleep(50);
3934 		val = alc_read_coefex_idx(codec, 0x58, 0x01);
3935 	}
3936 	/* Set HP depop to auto mode */
3937 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3938 	msleep(50);
3939 }
3940 
alc294_init(struct hda_codec * codec)3941 static void alc294_init(struct hda_codec *codec)
3942 {
3943 	struct alc_spec *spec = codec->spec;
3944 
3945 	/* required only at boot or S4 resume time */
3946 	if (!spec->done_hp_init ||
3947 	    codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3948 		alc294_hp_init(codec);
3949 		spec->done_hp_init = true;
3950 	}
3951 	alc_default_init(codec);
3952 }
3953 
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)3954 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3955 			     unsigned int val)
3956 {
3957 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3958 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3959 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3960 }
3961 
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)3962 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3963 {
3964 	unsigned int val;
3965 
3966 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3967 	val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3968 		& 0xffff;
3969 	val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3970 		<< 16;
3971 	return val;
3972 }
3973 
alc5505_dsp_halt(struct hda_codec * codec)3974 static void alc5505_dsp_halt(struct hda_codec *codec)
3975 {
3976 	unsigned int val;
3977 
3978 	alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3979 	alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3980 	alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3981 	alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3982 	alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3983 	alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3984 	alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3985 	val = alc5505_coef_get(codec, 0x6220);
3986 	alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3987 }
3988 
alc5505_dsp_back_from_halt(struct hda_codec * codec)3989 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3990 {
3991 	alc5505_coef_set(codec, 0x61b8, 0x04133302);
3992 	alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3993 	alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3994 	alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3995 	alc5505_coef_set(codec, 0x6220, 0x2002010f);
3996 	alc5505_coef_set(codec, 0x880c, 0x00000004);
3997 }
3998 
alc5505_dsp_init(struct hda_codec * codec)3999 static void alc5505_dsp_init(struct hda_codec *codec)
4000 {
4001 	unsigned int val;
4002 
4003 	alc5505_dsp_halt(codec);
4004 	alc5505_dsp_back_from_halt(codec);
4005 	alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
4006 	alc5505_coef_set(codec, 0x61b0, 0x5b16);
4007 	alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
4008 	alc5505_coef_set(codec, 0x61b4, 0x04132b02);
4009 	alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
4010 	alc5505_coef_set(codec, 0x61b8, 0x041f3302);
4011 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
4012 	alc5505_coef_set(codec, 0x61b8, 0x041b3302);
4013 	alc5505_coef_set(codec, 0x61b8, 0x04173302);
4014 	alc5505_coef_set(codec, 0x61b8, 0x04163302);
4015 	alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4016 	alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4017 	alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4018 
4019 	val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4020 	if (val <= 3)
4021 		alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4022 	else
4023 		alc5505_coef_set(codec, 0x6220, 0x6002018f);
4024 
4025 	alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4026 	alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4027 	alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4028 	alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4029 	alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4030 	alc5505_coef_set(codec, 0x880c, 0x00000003);
4031 	alc5505_coef_set(codec, 0x880c, 0x00000010);
4032 
4033 #ifdef HALT_REALTEK_ALC5505
4034 	alc5505_dsp_halt(codec);
4035 #endif
4036 }
4037 
4038 #ifdef HALT_REALTEK_ALC5505
4039 #define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
4040 #define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
4041 #else
4042 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
4043 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
4044 #endif
4045 
4046 #ifdef CONFIG_PM
alc269_suspend(struct hda_codec * codec)4047 static int alc269_suspend(struct hda_codec *codec)
4048 {
4049 	struct alc_spec *spec = codec->spec;
4050 
4051 	if (spec->has_alc5505_dsp)
4052 		alc5505_dsp_suspend(codec);
4053 
4054 	return alc_suspend(codec);
4055 }
4056 
alc269_resume(struct hda_codec * codec)4057 static int alc269_resume(struct hda_codec *codec)
4058 {
4059 	struct alc_spec *spec = codec->spec;
4060 
4061 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4062 		alc269vb_toggle_power_output(codec, 0);
4063 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4064 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
4065 		msleep(150);
4066 	}
4067 
4068 	codec->patch_ops.init(codec);
4069 
4070 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4071 		alc269vb_toggle_power_output(codec, 1);
4072 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4073 			(alc_get_coef0(codec) & 0x00ff) == 0x017) {
4074 		msleep(200);
4075 	}
4076 
4077 	snd_hda_regmap_sync(codec);
4078 	hda_call_check_power_status(codec, 0x01);
4079 
4080 	/* on some machine, the BIOS will clear the codec gpio data when enter
4081 	 * suspend, and won't restore the data after resume, so we restore it
4082 	 * in the driver.
4083 	 */
4084 	if (spec->gpio_data)
4085 		alc_write_gpio_data(codec);
4086 
4087 	if (spec->has_alc5505_dsp)
4088 		alc5505_dsp_resume(codec);
4089 
4090 	return 0;
4091 }
4092 #endif /* CONFIG_PM */
4093 
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4094 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4095 						 const struct hda_fixup *fix, int action)
4096 {
4097 	struct alc_spec *spec = codec->spec;
4098 
4099 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4100 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4101 }
4102 
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4103 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4104 						 const struct hda_fixup *fix,
4105 						 int action)
4106 {
4107 	unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4108 	unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4109 
4110 	if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4111 		snd_hda_codec_set_pincfg(codec, 0x19,
4112 			(cfg_headphone & ~AC_DEFCFG_DEVICE) |
4113 			(AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4114 }
4115 
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4116 static void alc269_fixup_hweq(struct hda_codec *codec,
4117 			       const struct hda_fixup *fix, int action)
4118 {
4119 	if (action == HDA_FIXUP_ACT_INIT)
4120 		alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4121 }
4122 
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4123 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4124 				       const struct hda_fixup *fix, int action)
4125 {
4126 	struct alc_spec *spec = codec->spec;
4127 
4128 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4129 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4130 }
4131 
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4132 static void alc271_fixup_dmic(struct hda_codec *codec,
4133 			      const struct hda_fixup *fix, int action)
4134 {
4135 	static const struct hda_verb verbs[] = {
4136 		{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4137 		{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4138 		{}
4139 	};
4140 	unsigned int cfg;
4141 
4142 	if (strcmp(codec->core.chip_name, "ALC271X") &&
4143 	    strcmp(codec->core.chip_name, "ALC269VB"))
4144 		return;
4145 	cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4146 	if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4147 		snd_hda_sequence_write(codec, verbs);
4148 }
4149 
4150 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4151 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4152 					  const struct hda_fixup *fix,
4153 					  int action)
4154 {
4155 	if (action == HDA_FIXUP_ACT_INIT)
4156 		alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4157 }
4158 
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4159 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4160 				 const struct hda_fixup *fix, int action)
4161 {
4162 	struct alc_spec *spec = codec->spec;
4163 
4164 	if (action != HDA_FIXUP_ACT_PROBE)
4165 		return;
4166 
4167 	/* Due to a hardware problem on Lenovo Ideadpad, we need to
4168 	 * fix the sample rate of analog I/O to 44.1kHz
4169 	 */
4170 	spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4171 	spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4172 }
4173 
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4174 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4175 				     const struct hda_fixup *fix, int action)
4176 {
4177 	/* The digital-mic unit sends PDM (differential signal) instead of
4178 	 * the standard PCM, thus you can't record a valid mono stream as is.
4179 	 * Below is a workaround specific to ALC269 to control the dmic
4180 	 * signal source as mono.
4181 	 */
4182 	if (action == HDA_FIXUP_ACT_INIT)
4183 		alc_update_coef_idx(codec, 0x07, 0, 0x80);
4184 }
4185 
alc269_quanta_automute(struct hda_codec * codec)4186 static void alc269_quanta_automute(struct hda_codec *codec)
4187 {
4188 	snd_hda_gen_update_outputs(codec);
4189 
4190 	alc_write_coef_idx(codec, 0x0c, 0x680);
4191 	alc_write_coef_idx(codec, 0x0c, 0x480);
4192 }
4193 
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4194 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4195 				     const struct hda_fixup *fix, int action)
4196 {
4197 	struct alc_spec *spec = codec->spec;
4198 	if (action != HDA_FIXUP_ACT_PROBE)
4199 		return;
4200 	spec->gen.automute_hook = alc269_quanta_automute;
4201 }
4202 
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4203 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4204 					 struct hda_jack_callback *jack)
4205 {
4206 	struct alc_spec *spec = codec->spec;
4207 	int vref;
4208 	msleep(200);
4209 	snd_hda_gen_hp_automute(codec, jack);
4210 
4211 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4212 	msleep(100);
4213 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4214 			    vref);
4215 	msleep(500);
4216 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4217 			    vref);
4218 }
4219 
4220 /*
4221  * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4222  */
4223 struct hda_alc298_mbxinit {
4224 	unsigned char value_0x23;
4225 	unsigned char value_0x25;
4226 };
4227 
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4228 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4229 					 const struct hda_alc298_mbxinit *initval,
4230 					 bool first)
4231 {
4232 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4233 	alc_write_coef_idx(codec, 0x26, 0xb000);
4234 
4235 	if (first)
4236 		snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4237 
4238 	snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4239 	alc_write_coef_idx(codec, 0x26, 0xf000);
4240 	alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4241 
4242 	if (initval->value_0x23 != 0x1e)
4243 		alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4244 
4245 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4246 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4247 }
4248 
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4249 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4250 					   const struct hda_fixup *fix,
4251 					   int action)
4252 {
4253 	/* Initialization magic */
4254 	static const struct hda_alc298_mbxinit dac_init[] = {
4255 		{0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4256 		{0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4257 		{0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4258 		{0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4259 		{0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4260 		{0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4261 		{0x2f, 0x00},
4262 		{0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4263 		{0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4264 		{0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4265 		{}
4266 	};
4267 	const struct hda_alc298_mbxinit *seq;
4268 
4269 	if (action != HDA_FIXUP_ACT_INIT)
4270 		return;
4271 
4272 	/* Start */
4273 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4274 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4275 	alc_write_coef_idx(codec, 0x26, 0xf000);
4276 	alc_write_coef_idx(codec, 0x22, 0x31);
4277 	alc_write_coef_idx(codec, 0x23, 0x0b);
4278 	alc_write_coef_idx(codec, 0x25, 0x00);
4279 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4280 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4281 
4282 	for (seq = dac_init; seq->value_0x23; seq++)
4283 		alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4284 }
4285 
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4286 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4287 				     const struct hda_fixup *fix, int action)
4288 {
4289 	struct alc_spec *spec = codec->spec;
4290 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4291 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4292 		spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4293 	}
4294 }
4295 
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4296 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4297 				bool polarity, bool on)
4298 {
4299 	unsigned int pinval;
4300 
4301 	if (!pin)
4302 		return;
4303 	if (polarity)
4304 		on = !on;
4305 	pinval = snd_hda_codec_get_pin_target(codec, pin);
4306 	pinval &= ~AC_PINCTL_VREFEN;
4307 	pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4308 	/* temporarily power up/down for setting VREF */
4309 	snd_hda_power_up_pm(codec);
4310 	snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4311 	snd_hda_power_down_pm(codec);
4312 }
4313 
4314 /* 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)4315 static int vref_mute_led_set(struct led_classdev *led_cdev,
4316 			     enum led_brightness brightness)
4317 {
4318 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4319 	struct alc_spec *spec = codec->spec;
4320 
4321 	alc_update_vref_led(codec, spec->mute_led_nid,
4322 			    spec->mute_led_polarity, brightness);
4323 	return 0;
4324 }
4325 
4326 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4327 static unsigned int led_power_filter(struct hda_codec *codec,
4328 						  hda_nid_t nid,
4329 						  unsigned int power_state)
4330 {
4331 	struct alc_spec *spec = codec->spec;
4332 
4333 	if (power_state != AC_PWRST_D3 || nid == 0 ||
4334 	    (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4335 		return power_state;
4336 
4337 	/* Set pin ctl again, it might have just been set to 0 */
4338 	snd_hda_set_pin_ctl(codec, nid,
4339 			    snd_hda_codec_get_pin_target(codec, nid));
4340 
4341 	return snd_hda_gen_path_power_filter(codec, nid, power_state);
4342 }
4343 
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4344 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4345 				     const struct hda_fixup *fix, int action)
4346 {
4347 	struct alc_spec *spec = codec->spec;
4348 	const struct dmi_device *dev = NULL;
4349 
4350 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4351 		return;
4352 
4353 	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4354 		int pol, pin;
4355 		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4356 			continue;
4357 		if (pin < 0x0a || pin >= 0x10)
4358 			break;
4359 		spec->mute_led_polarity = pol;
4360 		spec->mute_led_nid = pin - 0x0a + 0x18;
4361 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4362 		codec->power_filter = led_power_filter;
4363 		codec_dbg(codec,
4364 			  "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4365 			   spec->mute_led_polarity);
4366 		break;
4367 	}
4368 }
4369 
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4370 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4371 					  const struct hda_fixup *fix,
4372 					  int action, hda_nid_t pin)
4373 {
4374 	struct alc_spec *spec = codec->spec;
4375 
4376 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4377 		spec->mute_led_polarity = 0;
4378 		spec->mute_led_nid = pin;
4379 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4380 		codec->power_filter = led_power_filter;
4381 	}
4382 }
4383 
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4384 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4385 				const struct hda_fixup *fix, int action)
4386 {
4387 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4388 }
4389 
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4390 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4391 				const struct hda_fixup *fix, int action)
4392 {
4393 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4394 }
4395 
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4396 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4397 				const struct hda_fixup *fix, int action)
4398 {
4399 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4400 }
4401 
4402 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4403 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4404 				int polarity, bool enabled)
4405 {
4406 	if (polarity)
4407 		enabled = !enabled;
4408 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4409 }
4410 
4411 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4412 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4413 			     enum led_brightness brightness)
4414 {
4415 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4416 	struct alc_spec *spec = codec->spec;
4417 
4418 	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4419 			    spec->mute_led_polarity, !brightness);
4420 	return 0;
4421 }
4422 
4423 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4424 static int micmute_led_set(struct led_classdev *led_cdev,
4425 			   enum led_brightness brightness)
4426 {
4427 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4428 	struct alc_spec *spec = codec->spec;
4429 
4430 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4431 			    spec->micmute_led_polarity, !brightness);
4432 	return 0;
4433 }
4434 
4435 /* 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)4436 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4437 				  int action,
4438 				  unsigned int mute_mask,
4439 				  unsigned int micmute_mask)
4440 {
4441 	struct alc_spec *spec = codec->spec;
4442 
4443 	alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4444 
4445 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4446 		return;
4447 	if (mute_mask) {
4448 		spec->gpio_mute_led_mask = mute_mask;
4449 		snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4450 	}
4451 	if (micmute_mask) {
4452 		spec->gpio_mic_led_mask = micmute_mask;
4453 		snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4454 	}
4455 }
4456 
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4457 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4458 				const struct hda_fixup *fix, int action)
4459 {
4460 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4461 }
4462 
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4463 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4464 				const struct hda_fixup *fix, int action)
4465 {
4466 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4467 }
4468 
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4469 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4470 				const struct hda_fixup *fix, int action)
4471 {
4472 	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4473 }
4474 
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4475 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4476 				const struct hda_fixup *fix, int action)
4477 {
4478 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4479 }
4480 
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4481 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4482 				const struct hda_fixup *fix, int action)
4483 {
4484 	alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4485 }
4486 
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4487 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4488 				const struct hda_fixup *fix, int action)
4489 {
4490 	struct alc_spec *spec = codec->spec;
4491 
4492 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4493 		spec->micmute_led_polarity = 1;
4494 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4495 }
4496 
4497 /* 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)4498 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4499 				enum led_brightness brightness)
4500 {
4501 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4502 	struct alc_spec *spec = codec->spec;
4503 
4504 	alc_update_vref_led(codec, spec->cap_mute_led_nid,
4505 			    spec->micmute_led_polarity, brightness);
4506 	return 0;
4507 }
4508 
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4509 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4510 				const struct hda_fixup *fix, int action)
4511 {
4512 	struct alc_spec *spec = codec->spec;
4513 
4514 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4515 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4516 		/* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4517 		 * enable headphone amp
4518 		 */
4519 		spec->gpio_mask |= 0x10;
4520 		spec->gpio_dir |= 0x10;
4521 		spec->cap_mute_led_nid = 0x18;
4522 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4523 		codec->power_filter = led_power_filter;
4524 	}
4525 }
4526 
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4527 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4528 				   const struct hda_fixup *fix, int action)
4529 {
4530 	struct alc_spec *spec = codec->spec;
4531 
4532 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4533 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4534 		spec->cap_mute_led_nid = 0x18;
4535 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4536 		codec->power_filter = led_power_filter;
4537 	}
4538 }
4539 
4540 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4541  * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4542  */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4543 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4544 				     const struct hda_fixup *fix, int action)
4545 {
4546 	struct alc_spec *spec = codec->spec;
4547 
4548 	switch (action) {
4549 	case HDA_FIXUP_ACT_PRE_PROBE:
4550 		spec->gpio_mask |= 0x01;
4551 		spec->gpio_dir |= 0x01;
4552 		break;
4553 	case HDA_FIXUP_ACT_INIT:
4554 		/* need to toggle GPIO to enable the amp */
4555 		alc_update_gpio_data(codec, 0x01, true);
4556 		msleep(100);
4557 		alc_update_gpio_data(codec, 0x01, false);
4558 		break;
4559 	}
4560 }
4561 
4562 /* 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)4563 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4564 				    struct hda_codec *codec,
4565 				    struct snd_pcm_substream *substream,
4566 				    int action)
4567 {
4568 	switch (action) {
4569 	case HDA_GEN_PCM_ACT_PREPARE:
4570 		alc_update_gpio_data(codec, 0x04, true);
4571 		break;
4572 	case HDA_GEN_PCM_ACT_CLEANUP:
4573 		alc_update_gpio_data(codec, 0x04, false);
4574 		break;
4575 	}
4576 }
4577 
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4578 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4579 				      const struct hda_fixup *fix,
4580 				      int action)
4581 {
4582 	struct alc_spec *spec = codec->spec;
4583 
4584 	if (action == HDA_FIXUP_ACT_PROBE) {
4585 		spec->gpio_mask |= 0x04;
4586 		spec->gpio_dir |= 0x04;
4587 		spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4588 	}
4589 }
4590 
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4591 static void alc_update_coef_led(struct hda_codec *codec,
4592 				struct alc_coef_led *led,
4593 				bool polarity, bool on)
4594 {
4595 	if (polarity)
4596 		on = !on;
4597 	/* temporarily power up/down for setting COEF bit */
4598 	alc_update_coef_idx(codec, led->idx, led->mask,
4599 			    on ? led->on : led->off);
4600 }
4601 
4602 /* 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)4603 static int coef_mute_led_set(struct led_classdev *led_cdev,
4604 			     enum led_brightness brightness)
4605 {
4606 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4607 	struct alc_spec *spec = codec->spec;
4608 
4609 	alc_update_coef_led(codec, &spec->mute_led_coef,
4610 			    spec->mute_led_polarity, brightness);
4611 	return 0;
4612 }
4613 
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4614 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4615 					  const struct hda_fixup *fix,
4616 					  int action)
4617 {
4618 	struct alc_spec *spec = codec->spec;
4619 
4620 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4621 		spec->mute_led_polarity = 0;
4622 		spec->mute_led_coef.idx = 0x0b;
4623 		spec->mute_led_coef.mask = 1 << 3;
4624 		spec->mute_led_coef.on = 1 << 3;
4625 		spec->mute_led_coef.off = 0;
4626 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4627 	}
4628 }
4629 
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4630 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4631 					  const struct hda_fixup *fix,
4632 					  int action)
4633 {
4634 	struct alc_spec *spec = codec->spec;
4635 
4636 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4637 		spec->mute_led_polarity = 0;
4638 		spec->mute_led_coef.idx = 0x34;
4639 		spec->mute_led_coef.mask = 1 << 5;
4640 		spec->mute_led_coef.on = 0;
4641 		spec->mute_led_coef.off = 1 << 5;
4642 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4643 	}
4644 }
4645 
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4646 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4647 					  const struct hda_fixup *fix, int action)
4648 {
4649 	struct alc_spec *spec = codec->spec;
4650 
4651 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4652 		spec->mute_led_polarity = 0;
4653 		spec->mute_led_coef.idx = 0x07;
4654 		spec->mute_led_coef.mask = 1;
4655 		spec->mute_led_coef.on = 1;
4656 		spec->mute_led_coef.off = 0;
4657 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4658 	}
4659 }
4660 
alc245_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4661 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4662 					  const struct hda_fixup *fix,
4663 					  int action)
4664 {
4665 	struct alc_spec *spec = codec->spec;
4666 
4667 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4668 		spec->mute_led_polarity = 0;
4669 		spec->mute_led_coef.idx = 0x0b;
4670 		spec->mute_led_coef.mask = 3 << 2;
4671 		spec->mute_led_coef.on = 2 << 2;
4672 		spec->mute_led_coef.off = 1 << 2;
4673 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4674 	}
4675 }
4676 
4677 /* 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)4678 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4679 				enum led_brightness brightness)
4680 {
4681 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4682 	struct alc_spec *spec = codec->spec;
4683 
4684 	alc_update_coef_led(codec, &spec->mic_led_coef,
4685 			    spec->micmute_led_polarity, brightness);
4686 	return 0;
4687 }
4688 
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4689 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4690 				const struct hda_fixup *fix, int action)
4691 {
4692 	struct alc_spec *spec = codec->spec;
4693 
4694 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4695 		spec->mic_led_coef.idx = 0x19;
4696 		spec->mic_led_coef.mask = 1 << 13;
4697 		spec->mic_led_coef.on = 1 << 13;
4698 		spec->mic_led_coef.off = 0;
4699 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4700 	}
4701 }
4702 
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4703 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4704 				const struct hda_fixup *fix, int action)
4705 {
4706 	struct alc_spec *spec = codec->spec;
4707 
4708 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4709 		spec->micmute_led_polarity = 1;
4710 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4711 }
4712 
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4713 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4714 				const struct hda_fixup *fix, int action)
4715 {
4716 	struct alc_spec *spec = codec->spec;
4717 
4718 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4719 		spec->mic_led_coef.idx = 0x35;
4720 		spec->mic_led_coef.mask = 3 << 2;
4721 		spec->mic_led_coef.on = 2 << 2;
4722 		spec->mic_led_coef.off = 1 << 2;
4723 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4724 	}
4725 }
4726 
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4727 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4728 				const struct hda_fixup *fix, int action)
4729 {
4730 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4731 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4732 }
4733 
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4734 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4735 				const struct hda_fixup *fix, int action)
4736 {
4737 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4738 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4739 }
4740 
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4741 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4742 				const struct hda_fixup *fix, int action)
4743 {
4744 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4745 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4746 }
4747 
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4748 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4749 				const struct hda_fixup *fix, int action)
4750 {
4751 	struct alc_spec *spec = codec->spec;
4752 
4753 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4754 		spec->cap_mute_led_nid = 0x1a;
4755 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4756 		codec->power_filter = led_power_filter;
4757 	}
4758 }
4759 
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4760 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4761 				const struct hda_fixup *fix, int action)
4762 {
4763 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4764 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4765 }
4766 
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4767 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4768 						  const unsigned short coefs[2])
4769 {
4770 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4771 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4772 	alc_write_coef_idx(codec, 0x26, 0xb011);
4773 }
4774 
4775 struct alc298_samsung_amp_desc {
4776 	unsigned char nid;
4777 	unsigned short init_seq[2][2];
4778 };
4779 
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4780 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4781 				     const struct hda_fixup *fix, int action)
4782 {
4783 	int i, j;
4784 	static const unsigned short init_seq[][2] = {
4785 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4786 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4787 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4788 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4789 	};
4790 	static const struct alc298_samsung_amp_desc amps[] = {
4791 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4792 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4793 	};
4794 
4795 	if (action != HDA_FIXUP_ACT_INIT)
4796 		return;
4797 
4798 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4799 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4800 
4801 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4802 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4803 
4804 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4805 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4806 	}
4807 }
4808 
4809 #if IS_REACHABLE(CONFIG_INPUT)
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)4810 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4811 				   struct hda_jack_callback *event)
4812 {
4813 	struct alc_spec *spec = codec->spec;
4814 
4815 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4816 	   send both key on and key off event for every interrupt. */
4817 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4818 	input_sync(spec->kb_dev);
4819 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4820 	input_sync(spec->kb_dev);
4821 }
4822 
alc_register_micmute_input_device(struct hda_codec * codec)4823 static int alc_register_micmute_input_device(struct hda_codec *codec)
4824 {
4825 	struct alc_spec *spec = codec->spec;
4826 	int i;
4827 
4828 	spec->kb_dev = input_allocate_device();
4829 	if (!spec->kb_dev) {
4830 		codec_err(codec, "Out of memory (input_allocate_device)\n");
4831 		return -ENOMEM;
4832 	}
4833 
4834 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4835 
4836 	spec->kb_dev->name = "Microphone Mute Button";
4837 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4838 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4839 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4840 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4841 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4842 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4843 
4844 	if (input_register_device(spec->kb_dev)) {
4845 		codec_err(codec, "input_register_device failed\n");
4846 		input_free_device(spec->kb_dev);
4847 		spec->kb_dev = NULL;
4848 		return -ENOMEM;
4849 	}
4850 
4851 	return 0;
4852 }
4853 
4854 /* GPIO1 = set according to SKU external amp
4855  * GPIO2 = mic mute hotkey
4856  * GPIO3 = mute LED
4857  * GPIO4 = mic mute LED
4858  */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4859 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4860 					     const struct hda_fixup *fix, int action)
4861 {
4862 	struct alc_spec *spec = codec->spec;
4863 
4864 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4865 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4866 		spec->init_amp = ALC_INIT_DEFAULT;
4867 		if (alc_register_micmute_input_device(codec) != 0)
4868 			return;
4869 
4870 		spec->gpio_mask |= 0x06;
4871 		spec->gpio_dir |= 0x02;
4872 		spec->gpio_data |= 0x02;
4873 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4874 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4875 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4876 						    gpio2_mic_hotkey_event);
4877 		return;
4878 	}
4879 
4880 	if (!spec->kb_dev)
4881 		return;
4882 
4883 	switch (action) {
4884 	case HDA_FIXUP_ACT_FREE:
4885 		input_unregister_device(spec->kb_dev);
4886 		spec->kb_dev = NULL;
4887 	}
4888 }
4889 
4890 /* Line2 = mic mute hotkey
4891  * GPIO2 = mic mute LED
4892  */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4893 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4894 					     const struct hda_fixup *fix, int action)
4895 {
4896 	struct alc_spec *spec = codec->spec;
4897 
4898 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4899 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4900 		spec->init_amp = ALC_INIT_DEFAULT;
4901 		if (alc_register_micmute_input_device(codec) != 0)
4902 			return;
4903 
4904 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
4905 						    gpio2_mic_hotkey_event);
4906 		return;
4907 	}
4908 
4909 	if (!spec->kb_dev)
4910 		return;
4911 
4912 	switch (action) {
4913 	case HDA_FIXUP_ACT_FREE:
4914 		input_unregister_device(spec->kb_dev);
4915 		spec->kb_dev = NULL;
4916 	}
4917 }
4918 #else /* INPUT */
4919 #define alc280_fixup_hp_gpio2_mic_hotkey	NULL
4920 #define alc233_fixup_lenovo_line2_mic_hotkey	NULL
4921 #endif /* INPUT */
4922 
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4923 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4924 				const struct hda_fixup *fix, int action)
4925 {
4926 	struct alc_spec *spec = codec->spec;
4927 
4928 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4929 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4930 		spec->cap_mute_led_nid = 0x18;
4931 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4932 	}
4933 }
4934 
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)4935 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
4936 {
4937 	if (delay <= 0)
4938 		delay = 75;
4939 	snd_hda_codec_write(codec, 0x21, 0,
4940 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4941 	msleep(delay);
4942 	snd_hda_codec_write(codec, 0x21, 0,
4943 		    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4944 	msleep(delay);
4945 }
4946 
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)4947 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
4948 {
4949 	if (delay <= 0)
4950 		delay = 75;
4951 	snd_hda_codec_write(codec, 0x21, 0,
4952 		    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4953 	msleep(delay);
4954 	snd_hda_codec_write(codec, 0x21, 0,
4955 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4956 	msleep(delay);
4957 }
4958 
4959 static const struct coef_fw alc225_pre_hsmode[] = {
4960 	UPDATE_COEF(0x4a, 1<<8, 0),
4961 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4962 	UPDATE_COEF(0x63, 3<<14, 3<<14),
4963 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
4964 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
4965 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4966 	UPDATE_COEF(0x4a, 3<<10, 0),
4967 	{}
4968 };
4969 
alc_headset_mode_unplugged(struct hda_codec * codec)4970 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4971 {
4972 	struct alc_spec *spec = codec->spec;
4973 	static const struct coef_fw coef0255[] = {
4974 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4975 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4976 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4977 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4978 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4979 		{}
4980 	};
4981 	static const struct coef_fw coef0256[] = {
4982 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4983 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4984 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4985 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4986 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4987 		{}
4988 	};
4989 	static const struct coef_fw coef0233[] = {
4990 		WRITE_COEF(0x1b, 0x0c0b),
4991 		WRITE_COEF(0x45, 0xc429),
4992 		UPDATE_COEF(0x35, 0x4000, 0),
4993 		WRITE_COEF(0x06, 0x2104),
4994 		WRITE_COEF(0x1a, 0x0001),
4995 		WRITE_COEF(0x26, 0x0004),
4996 		WRITE_COEF(0x32, 0x42a3),
4997 		{}
4998 	};
4999 	static const struct coef_fw coef0288[] = {
5000 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5001 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5002 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5003 		UPDATE_COEF(0x66, 0x0008, 0),
5004 		UPDATE_COEF(0x67, 0x2000, 0),
5005 		{}
5006 	};
5007 	static const struct coef_fw coef0298[] = {
5008 		UPDATE_COEF(0x19, 0x1300, 0x0300),
5009 		{}
5010 	};
5011 	static const struct coef_fw coef0292[] = {
5012 		WRITE_COEF(0x76, 0x000e),
5013 		WRITE_COEF(0x6c, 0x2400),
5014 		WRITE_COEF(0x18, 0x7308),
5015 		WRITE_COEF(0x6b, 0xc429),
5016 		{}
5017 	};
5018 	static const struct coef_fw coef0293[] = {
5019 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5020 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5021 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5022 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5023 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5024 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5025 		{}
5026 	};
5027 	static const struct coef_fw coef0668[] = {
5028 		WRITE_COEF(0x15, 0x0d40),
5029 		WRITE_COEF(0xb7, 0x802b),
5030 		{}
5031 	};
5032 	static const struct coef_fw coef0225[] = {
5033 		UPDATE_COEF(0x63, 3<<14, 0),
5034 		{}
5035 	};
5036 	static const struct coef_fw coef0274[] = {
5037 		UPDATE_COEF(0x4a, 0x0100, 0),
5038 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5039 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
5040 		UPDATE_COEF(0x4a, 0x0010, 0),
5041 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5042 		WRITE_COEF(0x45, 0x5289),
5043 		UPDATE_COEF(0x4a, 0x0c00, 0),
5044 		{}
5045 	};
5046 
5047 	if (spec->no_internal_mic_pin) {
5048 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5049 		return;
5050 	}
5051 
5052 	switch (codec->core.vendor_id) {
5053 	case 0x10ec0255:
5054 		alc_process_coef_fw(codec, coef0255);
5055 		break;
5056 	case 0x10ec0230:
5057 	case 0x10ec0236:
5058 	case 0x10ec0256:
5059 	case 0x19e58326:
5060 		alc_hp_mute_disable(codec, 75);
5061 		alc_process_coef_fw(codec, coef0256);
5062 		break;
5063 	case 0x10ec0234:
5064 	case 0x10ec0274:
5065 	case 0x10ec0294:
5066 		alc_process_coef_fw(codec, coef0274);
5067 		break;
5068 	case 0x10ec0233:
5069 	case 0x10ec0283:
5070 		alc_process_coef_fw(codec, coef0233);
5071 		break;
5072 	case 0x10ec0286:
5073 	case 0x10ec0288:
5074 		alc_process_coef_fw(codec, coef0288);
5075 		break;
5076 	case 0x10ec0298:
5077 		alc_process_coef_fw(codec, coef0298);
5078 		alc_process_coef_fw(codec, coef0288);
5079 		break;
5080 	case 0x10ec0292:
5081 		alc_process_coef_fw(codec, coef0292);
5082 		break;
5083 	case 0x10ec0293:
5084 		alc_process_coef_fw(codec, coef0293);
5085 		break;
5086 	case 0x10ec0668:
5087 		alc_process_coef_fw(codec, coef0668);
5088 		break;
5089 	case 0x10ec0215:
5090 	case 0x10ec0225:
5091 	case 0x10ec0285:
5092 	case 0x10ec0295:
5093 	case 0x10ec0289:
5094 	case 0x10ec0299:
5095 		alc_hp_mute_disable(codec, 75);
5096 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5097 		alc_process_coef_fw(codec, coef0225);
5098 		break;
5099 	case 0x10ec0867:
5100 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5101 		break;
5102 	}
5103 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5104 }
5105 
5106 
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5107 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5108 				    hda_nid_t mic_pin)
5109 {
5110 	static const struct coef_fw coef0255[] = {
5111 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5112 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5113 		{}
5114 	};
5115 	static const struct coef_fw coef0256[] = {
5116 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5117 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5118 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5119 		{}
5120 	};
5121 	static const struct coef_fw coef0233[] = {
5122 		UPDATE_COEF(0x35, 0, 1<<14),
5123 		WRITE_COEF(0x06, 0x2100),
5124 		WRITE_COEF(0x1a, 0x0021),
5125 		WRITE_COEF(0x26, 0x008c),
5126 		{}
5127 	};
5128 	static const struct coef_fw coef0288[] = {
5129 		UPDATE_COEF(0x4f, 0x00c0, 0),
5130 		UPDATE_COEF(0x50, 0x2000, 0),
5131 		UPDATE_COEF(0x56, 0x0006, 0),
5132 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5133 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5134 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5135 		{}
5136 	};
5137 	static const struct coef_fw coef0292[] = {
5138 		WRITE_COEF(0x19, 0xa208),
5139 		WRITE_COEF(0x2e, 0xacf0),
5140 		{}
5141 	};
5142 	static const struct coef_fw coef0293[] = {
5143 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5144 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5145 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5146 		{}
5147 	};
5148 	static const struct coef_fw coef0688[] = {
5149 		WRITE_COEF(0xb7, 0x802b),
5150 		WRITE_COEF(0xb5, 0x1040),
5151 		UPDATE_COEF(0xc3, 0, 1<<12),
5152 		{}
5153 	};
5154 	static const struct coef_fw coef0225[] = {
5155 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5156 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5157 		UPDATE_COEF(0x63, 3<<14, 0),
5158 		{}
5159 	};
5160 	static const struct coef_fw coef0274[] = {
5161 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5162 		UPDATE_COEF(0x4a, 0x0010, 0),
5163 		UPDATE_COEF(0x6b, 0xf000, 0),
5164 		{}
5165 	};
5166 
5167 	switch (codec->core.vendor_id) {
5168 	case 0x10ec0255:
5169 		alc_write_coef_idx(codec, 0x45, 0xc489);
5170 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5171 		alc_process_coef_fw(codec, coef0255);
5172 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5173 		break;
5174 	case 0x10ec0230:
5175 	case 0x10ec0236:
5176 	case 0x10ec0256:
5177 	case 0x19e58326:
5178 		alc_write_coef_idx(codec, 0x45, 0xc489);
5179 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5180 		alc_process_coef_fw(codec, coef0256);
5181 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5182 		break;
5183 	case 0x10ec0234:
5184 	case 0x10ec0274:
5185 	case 0x10ec0294:
5186 		alc_write_coef_idx(codec, 0x45, 0x4689);
5187 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5188 		alc_process_coef_fw(codec, coef0274);
5189 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5190 		break;
5191 	case 0x10ec0233:
5192 	case 0x10ec0283:
5193 		alc_write_coef_idx(codec, 0x45, 0xc429);
5194 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5195 		alc_process_coef_fw(codec, coef0233);
5196 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5197 		break;
5198 	case 0x10ec0286:
5199 	case 0x10ec0288:
5200 	case 0x10ec0298:
5201 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5202 		alc_process_coef_fw(codec, coef0288);
5203 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5204 		break;
5205 	case 0x10ec0292:
5206 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5207 		alc_process_coef_fw(codec, coef0292);
5208 		break;
5209 	case 0x10ec0293:
5210 		/* Set to TRS mode */
5211 		alc_write_coef_idx(codec, 0x45, 0xc429);
5212 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5213 		alc_process_coef_fw(codec, coef0293);
5214 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5215 		break;
5216 	case 0x10ec0867:
5217 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5218 		fallthrough;
5219 	case 0x10ec0221:
5220 	case 0x10ec0662:
5221 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5222 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5223 		break;
5224 	case 0x10ec0668:
5225 		alc_write_coef_idx(codec, 0x11, 0x0001);
5226 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5227 		alc_process_coef_fw(codec, coef0688);
5228 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5229 		break;
5230 	case 0x10ec0215:
5231 	case 0x10ec0225:
5232 	case 0x10ec0285:
5233 	case 0x10ec0295:
5234 	case 0x10ec0289:
5235 	case 0x10ec0299:
5236 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5237 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5238 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5239 		alc_process_coef_fw(codec, coef0225);
5240 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5241 		break;
5242 	}
5243 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5244 }
5245 
alc_headset_mode_default(struct hda_codec * codec)5246 static void alc_headset_mode_default(struct hda_codec *codec)
5247 {
5248 	static const struct coef_fw coef0225[] = {
5249 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5250 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5251 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5252 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5253 		UPDATE_COEF(0x63, 3<<14, 0),
5254 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5255 		{}
5256 	};
5257 	static const struct coef_fw coef0255[] = {
5258 		WRITE_COEF(0x45, 0xc089),
5259 		WRITE_COEF(0x45, 0xc489),
5260 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5261 		WRITE_COEF(0x49, 0x0049),
5262 		{}
5263 	};
5264 	static const struct coef_fw coef0256[] = {
5265 		WRITE_COEF(0x45, 0xc489),
5266 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5267 		WRITE_COEF(0x49, 0x0049),
5268 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5269 		WRITE_COEF(0x06, 0x6100),
5270 		{}
5271 	};
5272 	static const struct coef_fw coef0233[] = {
5273 		WRITE_COEF(0x06, 0x2100),
5274 		WRITE_COEF(0x32, 0x4ea3),
5275 		{}
5276 	};
5277 	static const struct coef_fw coef0288[] = {
5278 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5279 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5280 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5281 		UPDATE_COEF(0x66, 0x0008, 0),
5282 		UPDATE_COEF(0x67, 0x2000, 0),
5283 		{}
5284 	};
5285 	static const struct coef_fw coef0292[] = {
5286 		WRITE_COEF(0x76, 0x000e),
5287 		WRITE_COEF(0x6c, 0x2400),
5288 		WRITE_COEF(0x6b, 0xc429),
5289 		WRITE_COEF(0x18, 0x7308),
5290 		{}
5291 	};
5292 	static const struct coef_fw coef0293[] = {
5293 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5294 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5295 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5296 		{}
5297 	};
5298 	static const struct coef_fw coef0688[] = {
5299 		WRITE_COEF(0x11, 0x0041),
5300 		WRITE_COEF(0x15, 0x0d40),
5301 		WRITE_COEF(0xb7, 0x802b),
5302 		{}
5303 	};
5304 	static const struct coef_fw coef0274[] = {
5305 		WRITE_COEF(0x45, 0x4289),
5306 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5307 		UPDATE_COEF(0x6b, 0x0f00, 0),
5308 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5309 		{}
5310 	};
5311 
5312 	switch (codec->core.vendor_id) {
5313 	case 0x10ec0215:
5314 	case 0x10ec0225:
5315 	case 0x10ec0285:
5316 	case 0x10ec0295:
5317 	case 0x10ec0289:
5318 	case 0x10ec0299:
5319 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5320 		alc_process_coef_fw(codec, coef0225);
5321 		alc_hp_enable_unmute(codec, 75);
5322 		break;
5323 	case 0x10ec0255:
5324 		alc_process_coef_fw(codec, coef0255);
5325 		break;
5326 	case 0x10ec0230:
5327 	case 0x10ec0236:
5328 	case 0x10ec0256:
5329 	case 0x19e58326:
5330 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5331 		alc_write_coef_idx(codec, 0x45, 0xc089);
5332 		msleep(50);
5333 		alc_process_coef_fw(codec, coef0256);
5334 		alc_hp_enable_unmute(codec, 75);
5335 		break;
5336 	case 0x10ec0234:
5337 	case 0x10ec0274:
5338 	case 0x10ec0294:
5339 		alc_process_coef_fw(codec, coef0274);
5340 		break;
5341 	case 0x10ec0233:
5342 	case 0x10ec0283:
5343 		alc_process_coef_fw(codec, coef0233);
5344 		break;
5345 	case 0x10ec0286:
5346 	case 0x10ec0288:
5347 	case 0x10ec0298:
5348 		alc_process_coef_fw(codec, coef0288);
5349 		break;
5350 	case 0x10ec0292:
5351 		alc_process_coef_fw(codec, coef0292);
5352 		break;
5353 	case 0x10ec0293:
5354 		alc_process_coef_fw(codec, coef0293);
5355 		break;
5356 	case 0x10ec0668:
5357 		alc_process_coef_fw(codec, coef0688);
5358 		break;
5359 	case 0x10ec0867:
5360 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5361 		break;
5362 	}
5363 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5364 }
5365 
5366 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5367 static void alc_headset_mode_ctia(struct hda_codec *codec)
5368 {
5369 	int val;
5370 
5371 	static const struct coef_fw coef0255[] = {
5372 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5373 		WRITE_COEF(0x1b, 0x0c2b),
5374 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5375 		{}
5376 	};
5377 	static const struct coef_fw coef0256[] = {
5378 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5379 		WRITE_COEF(0x1b, 0x0e6b),
5380 		{}
5381 	};
5382 	static const struct coef_fw coef0233[] = {
5383 		WRITE_COEF(0x45, 0xd429),
5384 		WRITE_COEF(0x1b, 0x0c2b),
5385 		WRITE_COEF(0x32, 0x4ea3),
5386 		{}
5387 	};
5388 	static const struct coef_fw coef0288[] = {
5389 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5390 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5391 		UPDATE_COEF(0x66, 0x0008, 0),
5392 		UPDATE_COEF(0x67, 0x2000, 0),
5393 		{}
5394 	};
5395 	static const struct coef_fw coef0292[] = {
5396 		WRITE_COEF(0x6b, 0xd429),
5397 		WRITE_COEF(0x76, 0x0008),
5398 		WRITE_COEF(0x18, 0x7388),
5399 		{}
5400 	};
5401 	static const struct coef_fw coef0293[] = {
5402 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5403 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5404 		{}
5405 	};
5406 	static const struct coef_fw coef0688[] = {
5407 		WRITE_COEF(0x11, 0x0001),
5408 		WRITE_COEF(0x15, 0x0d60),
5409 		WRITE_COEF(0xc3, 0x0000),
5410 		{}
5411 	};
5412 	static const struct coef_fw coef0225_1[] = {
5413 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5414 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5415 		{}
5416 	};
5417 	static const struct coef_fw coef0225_2[] = {
5418 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5419 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5420 		{}
5421 	};
5422 
5423 	switch (codec->core.vendor_id) {
5424 	case 0x10ec0255:
5425 		alc_process_coef_fw(codec, coef0255);
5426 		break;
5427 	case 0x10ec0230:
5428 	case 0x10ec0236:
5429 	case 0x10ec0256:
5430 	case 0x19e58326:
5431 		alc_process_coef_fw(codec, coef0256);
5432 		alc_hp_enable_unmute(codec, 75);
5433 		break;
5434 	case 0x10ec0234:
5435 	case 0x10ec0274:
5436 	case 0x10ec0294:
5437 		alc_write_coef_idx(codec, 0x45, 0xd689);
5438 		break;
5439 	case 0x10ec0233:
5440 	case 0x10ec0283:
5441 		alc_process_coef_fw(codec, coef0233);
5442 		break;
5443 	case 0x10ec0298:
5444 		val = alc_read_coef_idx(codec, 0x50);
5445 		if (val & (1 << 12)) {
5446 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5447 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5448 			msleep(300);
5449 		} else {
5450 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5451 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5452 			msleep(300);
5453 		}
5454 		break;
5455 	case 0x10ec0286:
5456 	case 0x10ec0288:
5457 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5458 		msleep(300);
5459 		alc_process_coef_fw(codec, coef0288);
5460 		break;
5461 	case 0x10ec0292:
5462 		alc_process_coef_fw(codec, coef0292);
5463 		break;
5464 	case 0x10ec0293:
5465 		alc_process_coef_fw(codec, coef0293);
5466 		break;
5467 	case 0x10ec0668:
5468 		alc_process_coef_fw(codec, coef0688);
5469 		break;
5470 	case 0x10ec0215:
5471 	case 0x10ec0225:
5472 	case 0x10ec0285:
5473 	case 0x10ec0295:
5474 	case 0x10ec0289:
5475 	case 0x10ec0299:
5476 		val = alc_read_coef_idx(codec, 0x45);
5477 		if (val & (1 << 9))
5478 			alc_process_coef_fw(codec, coef0225_2);
5479 		else
5480 			alc_process_coef_fw(codec, coef0225_1);
5481 		alc_hp_enable_unmute(codec, 75);
5482 		break;
5483 	case 0x10ec0867:
5484 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5485 		break;
5486 	}
5487 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5488 }
5489 
5490 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5491 static void alc_headset_mode_omtp(struct hda_codec *codec)
5492 {
5493 	static const struct coef_fw coef0255[] = {
5494 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5495 		WRITE_COEF(0x1b, 0x0c2b),
5496 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5497 		{}
5498 	};
5499 	static const struct coef_fw coef0256[] = {
5500 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5501 		WRITE_COEF(0x1b, 0x0e6b),
5502 		{}
5503 	};
5504 	static const struct coef_fw coef0233[] = {
5505 		WRITE_COEF(0x45, 0xe429),
5506 		WRITE_COEF(0x1b, 0x0c2b),
5507 		WRITE_COEF(0x32, 0x4ea3),
5508 		{}
5509 	};
5510 	static const struct coef_fw coef0288[] = {
5511 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5512 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5513 		UPDATE_COEF(0x66, 0x0008, 0),
5514 		UPDATE_COEF(0x67, 0x2000, 0),
5515 		{}
5516 	};
5517 	static const struct coef_fw coef0292[] = {
5518 		WRITE_COEF(0x6b, 0xe429),
5519 		WRITE_COEF(0x76, 0x0008),
5520 		WRITE_COEF(0x18, 0x7388),
5521 		{}
5522 	};
5523 	static const struct coef_fw coef0293[] = {
5524 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5525 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5526 		{}
5527 	};
5528 	static const struct coef_fw coef0688[] = {
5529 		WRITE_COEF(0x11, 0x0001),
5530 		WRITE_COEF(0x15, 0x0d50),
5531 		WRITE_COEF(0xc3, 0x0000),
5532 		{}
5533 	};
5534 	static const struct coef_fw coef0225[] = {
5535 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5536 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5537 		{}
5538 	};
5539 
5540 	switch (codec->core.vendor_id) {
5541 	case 0x10ec0255:
5542 		alc_process_coef_fw(codec, coef0255);
5543 		break;
5544 	case 0x10ec0230:
5545 	case 0x10ec0236:
5546 	case 0x10ec0256:
5547 	case 0x19e58326:
5548 		alc_process_coef_fw(codec, coef0256);
5549 		alc_hp_enable_unmute(codec, 75);
5550 		break;
5551 	case 0x10ec0234:
5552 	case 0x10ec0274:
5553 	case 0x10ec0294:
5554 		alc_write_coef_idx(codec, 0x45, 0xe689);
5555 		break;
5556 	case 0x10ec0233:
5557 	case 0x10ec0283:
5558 		alc_process_coef_fw(codec, coef0233);
5559 		break;
5560 	case 0x10ec0298:
5561 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5562 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5563 		msleep(300);
5564 		break;
5565 	case 0x10ec0286:
5566 	case 0x10ec0288:
5567 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5568 		msleep(300);
5569 		alc_process_coef_fw(codec, coef0288);
5570 		break;
5571 	case 0x10ec0292:
5572 		alc_process_coef_fw(codec, coef0292);
5573 		break;
5574 	case 0x10ec0293:
5575 		alc_process_coef_fw(codec, coef0293);
5576 		break;
5577 	case 0x10ec0668:
5578 		alc_process_coef_fw(codec, coef0688);
5579 		break;
5580 	case 0x10ec0215:
5581 	case 0x10ec0225:
5582 	case 0x10ec0285:
5583 	case 0x10ec0295:
5584 	case 0x10ec0289:
5585 	case 0x10ec0299:
5586 		alc_process_coef_fw(codec, coef0225);
5587 		alc_hp_enable_unmute(codec, 75);
5588 		break;
5589 	}
5590 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5591 }
5592 
alc_determine_headset_type(struct hda_codec * codec)5593 static void alc_determine_headset_type(struct hda_codec *codec)
5594 {
5595 	int val;
5596 	bool is_ctia = false;
5597 	struct alc_spec *spec = codec->spec;
5598 	static const struct coef_fw coef0255[] = {
5599 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5600 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5601  conteol) */
5602 		{}
5603 	};
5604 	static const struct coef_fw coef0288[] = {
5605 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5606 		{}
5607 	};
5608 	static const struct coef_fw coef0298[] = {
5609 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5610 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5611 		UPDATE_COEF(0x66, 0x0008, 0),
5612 		UPDATE_COEF(0x67, 0x2000, 0),
5613 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5614 		{}
5615 	};
5616 	static const struct coef_fw coef0293[] = {
5617 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5618 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5619 		{}
5620 	};
5621 	static const struct coef_fw coef0688[] = {
5622 		WRITE_COEF(0x11, 0x0001),
5623 		WRITE_COEF(0xb7, 0x802b),
5624 		WRITE_COEF(0x15, 0x0d60),
5625 		WRITE_COEF(0xc3, 0x0c00),
5626 		{}
5627 	};
5628 	static const struct coef_fw coef0274[] = {
5629 		UPDATE_COEF(0x4a, 0x0010, 0),
5630 		UPDATE_COEF(0x4a, 0x8000, 0),
5631 		WRITE_COEF(0x45, 0xd289),
5632 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5633 		{}
5634 	};
5635 
5636 	if (spec->no_internal_mic_pin) {
5637 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5638 		return;
5639 	}
5640 
5641 	switch (codec->core.vendor_id) {
5642 	case 0x10ec0255:
5643 		alc_process_coef_fw(codec, coef0255);
5644 		msleep(300);
5645 		val = alc_read_coef_idx(codec, 0x46);
5646 		is_ctia = (val & 0x0070) == 0x0070;
5647 		break;
5648 	case 0x10ec0230:
5649 	case 0x10ec0236:
5650 	case 0x10ec0256:
5651 	case 0x19e58326:
5652 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5653 		alc_write_coef_idx(codec, 0x06, 0x6104);
5654 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5655 
5656 		alc_process_coef_fw(codec, coef0255);
5657 		msleep(300);
5658 		val = alc_read_coef_idx(codec, 0x46);
5659 		is_ctia = (val & 0x0070) == 0x0070;
5660 		if (!is_ctia) {
5661 			alc_write_coef_idx(codec, 0x45, 0xe089);
5662 			msleep(100);
5663 			val = alc_read_coef_idx(codec, 0x46);
5664 			if ((val & 0x0070) == 0x0070)
5665 				is_ctia = false;
5666 			else
5667 				is_ctia = true;
5668 		}
5669 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5670 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5671 		break;
5672 	case 0x10ec0234:
5673 	case 0x10ec0274:
5674 	case 0x10ec0294:
5675 		alc_process_coef_fw(codec, coef0274);
5676 		msleep(850);
5677 		val = alc_read_coef_idx(codec, 0x46);
5678 		is_ctia = (val & 0x00f0) == 0x00f0;
5679 		break;
5680 	case 0x10ec0233:
5681 	case 0x10ec0283:
5682 		alc_write_coef_idx(codec, 0x45, 0xd029);
5683 		msleep(300);
5684 		val = alc_read_coef_idx(codec, 0x46);
5685 		is_ctia = (val & 0x0070) == 0x0070;
5686 		break;
5687 	case 0x10ec0298:
5688 		snd_hda_codec_write(codec, 0x21, 0,
5689 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5690 		msleep(100);
5691 		snd_hda_codec_write(codec, 0x21, 0,
5692 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5693 		msleep(200);
5694 
5695 		val = alc_read_coef_idx(codec, 0x50);
5696 		if (val & (1 << 12)) {
5697 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5698 			alc_process_coef_fw(codec, coef0288);
5699 			msleep(350);
5700 			val = alc_read_coef_idx(codec, 0x50);
5701 			is_ctia = (val & 0x0070) == 0x0070;
5702 		} else {
5703 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5704 			alc_process_coef_fw(codec, coef0288);
5705 			msleep(350);
5706 			val = alc_read_coef_idx(codec, 0x50);
5707 			is_ctia = (val & 0x0070) == 0x0070;
5708 		}
5709 		alc_process_coef_fw(codec, coef0298);
5710 		snd_hda_codec_write(codec, 0x21, 0,
5711 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5712 		msleep(75);
5713 		snd_hda_codec_write(codec, 0x21, 0,
5714 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5715 		break;
5716 	case 0x10ec0286:
5717 	case 0x10ec0288:
5718 		alc_process_coef_fw(codec, coef0288);
5719 		msleep(350);
5720 		val = alc_read_coef_idx(codec, 0x50);
5721 		is_ctia = (val & 0x0070) == 0x0070;
5722 		break;
5723 	case 0x10ec0292:
5724 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5725 		msleep(300);
5726 		val = alc_read_coef_idx(codec, 0x6c);
5727 		is_ctia = (val & 0x001c) == 0x001c;
5728 		break;
5729 	case 0x10ec0293:
5730 		alc_process_coef_fw(codec, coef0293);
5731 		msleep(300);
5732 		val = alc_read_coef_idx(codec, 0x46);
5733 		is_ctia = (val & 0x0070) == 0x0070;
5734 		break;
5735 	case 0x10ec0668:
5736 		alc_process_coef_fw(codec, coef0688);
5737 		msleep(300);
5738 		val = alc_read_coef_idx(codec, 0xbe);
5739 		is_ctia = (val & 0x1c02) == 0x1c02;
5740 		break;
5741 	case 0x10ec0215:
5742 	case 0x10ec0225:
5743 	case 0x10ec0285:
5744 	case 0x10ec0295:
5745 	case 0x10ec0289:
5746 	case 0x10ec0299:
5747 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5748 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5749 		val = alc_read_coef_idx(codec, 0x45);
5750 		if (val & (1 << 9)) {
5751 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5752 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5753 			msleep(800);
5754 			val = alc_read_coef_idx(codec, 0x46);
5755 			is_ctia = (val & 0x00f0) == 0x00f0;
5756 		} else {
5757 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5758 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5759 			msleep(800);
5760 			val = alc_read_coef_idx(codec, 0x46);
5761 			is_ctia = (val & 0x00f0) == 0x00f0;
5762 		}
5763 		if (!is_ctia) {
5764 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5765 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5766 			msleep(100);
5767 			val = alc_read_coef_idx(codec, 0x46);
5768 			if ((val & 0x00f0) == 0x00f0)
5769 				is_ctia = false;
5770 			else
5771 				is_ctia = true;
5772 		}
5773 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5774 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5775 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5776 		break;
5777 	case 0x10ec0867:
5778 		is_ctia = true;
5779 		break;
5780 	}
5781 
5782 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5783 		    is_ctia ? "yes" : "no");
5784 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5785 }
5786 
alc_update_headset_mode(struct hda_codec * codec)5787 static void alc_update_headset_mode(struct hda_codec *codec)
5788 {
5789 	struct alc_spec *spec = codec->spec;
5790 
5791 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5792 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
5793 
5794 	int new_headset_mode;
5795 
5796 	if (!snd_hda_jack_detect(codec, hp_pin))
5797 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5798 	else if (mux_pin == spec->headset_mic_pin)
5799 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5800 	else if (mux_pin == spec->headphone_mic_pin)
5801 		new_headset_mode = ALC_HEADSET_MODE_MIC;
5802 	else
5803 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5804 
5805 	if (new_headset_mode == spec->current_headset_mode) {
5806 		snd_hda_gen_update_outputs(codec);
5807 		return;
5808 	}
5809 
5810 	switch (new_headset_mode) {
5811 	case ALC_HEADSET_MODE_UNPLUGGED:
5812 		alc_headset_mode_unplugged(codec);
5813 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5814 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5815 		spec->gen.hp_jack_present = false;
5816 		break;
5817 	case ALC_HEADSET_MODE_HEADSET:
5818 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5819 			alc_determine_headset_type(codec);
5820 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5821 			alc_headset_mode_ctia(codec);
5822 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5823 			alc_headset_mode_omtp(codec);
5824 		spec->gen.hp_jack_present = true;
5825 		break;
5826 	case ALC_HEADSET_MODE_MIC:
5827 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5828 		spec->gen.hp_jack_present = false;
5829 		break;
5830 	case ALC_HEADSET_MODE_HEADPHONE:
5831 		alc_headset_mode_default(codec);
5832 		spec->gen.hp_jack_present = true;
5833 		break;
5834 	}
5835 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5836 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
5837 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5838 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5839 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5840 						  PIN_VREFHIZ);
5841 	}
5842 	spec->current_headset_mode = new_headset_mode;
5843 
5844 	snd_hda_gen_update_outputs(codec);
5845 }
5846 
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)5847 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5848 					 struct snd_kcontrol *kcontrol,
5849 					 struct snd_ctl_elem_value *ucontrol)
5850 {
5851 	alc_update_headset_mode(codec);
5852 }
5853 
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5854 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5855 				       struct hda_jack_callback *jack)
5856 {
5857 	snd_hda_gen_hp_automute(codec, jack);
5858 	alc_update_headset_mode(codec);
5859 }
5860 
alc_probe_headset_mode(struct hda_codec * codec)5861 static void alc_probe_headset_mode(struct hda_codec *codec)
5862 {
5863 	int i;
5864 	struct alc_spec *spec = codec->spec;
5865 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5866 
5867 	/* Find mic pins */
5868 	for (i = 0; i < cfg->num_inputs; i++) {
5869 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5870 			spec->headset_mic_pin = cfg->inputs[i].pin;
5871 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5872 			spec->headphone_mic_pin = cfg->inputs[i].pin;
5873 	}
5874 
5875 	WARN_ON(spec->gen.cap_sync_hook);
5876 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5877 	spec->gen.automute_hook = alc_update_headset_mode;
5878 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5879 }
5880 
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)5881 static void alc_fixup_headset_mode(struct hda_codec *codec,
5882 				const struct hda_fixup *fix, int action)
5883 {
5884 	struct alc_spec *spec = codec->spec;
5885 
5886 	switch (action) {
5887 	case HDA_FIXUP_ACT_PRE_PROBE:
5888 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5889 		break;
5890 	case HDA_FIXUP_ACT_PROBE:
5891 		alc_probe_headset_mode(codec);
5892 		break;
5893 	case HDA_FIXUP_ACT_INIT:
5894 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
5895 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5896 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5897 		}
5898 		alc_update_headset_mode(codec);
5899 		break;
5900 	}
5901 }
5902 
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5903 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5904 				const struct hda_fixup *fix, int action)
5905 {
5906 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5907 		struct alc_spec *spec = codec->spec;
5908 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5909 	}
5910 	else
5911 		alc_fixup_headset_mode(codec, fix, action);
5912 }
5913 
alc255_set_default_jack_type(struct hda_codec * codec)5914 static void alc255_set_default_jack_type(struct hda_codec *codec)
5915 {
5916 	/* Set to iphone type */
5917 	static const struct coef_fw alc255fw[] = {
5918 		WRITE_COEF(0x1b, 0x880b),
5919 		WRITE_COEF(0x45, 0xd089),
5920 		WRITE_COEF(0x1b, 0x080b),
5921 		WRITE_COEF(0x46, 0x0004),
5922 		WRITE_COEF(0x1b, 0x0c0b),
5923 		{}
5924 	};
5925 	static const struct coef_fw alc256fw[] = {
5926 		WRITE_COEF(0x1b, 0x884b),
5927 		WRITE_COEF(0x45, 0xd089),
5928 		WRITE_COEF(0x1b, 0x084b),
5929 		WRITE_COEF(0x46, 0x0004),
5930 		WRITE_COEF(0x1b, 0x0c4b),
5931 		{}
5932 	};
5933 	switch (codec->core.vendor_id) {
5934 	case 0x10ec0255:
5935 		alc_process_coef_fw(codec, alc255fw);
5936 		break;
5937 	case 0x10ec0230:
5938 	case 0x10ec0236:
5939 	case 0x10ec0256:
5940 	case 0x19e58326:
5941 		alc_process_coef_fw(codec, alc256fw);
5942 		break;
5943 	}
5944 	msleep(30);
5945 }
5946 
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)5947 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5948 				const struct hda_fixup *fix, int action)
5949 {
5950 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5951 		alc255_set_default_jack_type(codec);
5952 	}
5953 	alc_fixup_headset_mode(codec, fix, action);
5954 }
5955 
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5956 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5957 				const struct hda_fixup *fix, int action)
5958 {
5959 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5960 		struct alc_spec *spec = codec->spec;
5961 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5962 		alc255_set_default_jack_type(codec);
5963 	}
5964 	else
5965 		alc_fixup_headset_mode(codec, fix, action);
5966 }
5967 
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5968 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5969 				       struct hda_jack_callback *jack)
5970 {
5971 	struct alc_spec *spec = codec->spec;
5972 
5973 	alc_update_headset_jack_cb(codec, jack);
5974 	/* Headset Mic enable or disable, only for Dell Dino */
5975 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5976 }
5977 
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)5978 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5979 				const struct hda_fixup *fix, int action)
5980 {
5981 	alc_fixup_headset_mode(codec, fix, action);
5982 	if (action == HDA_FIXUP_ACT_PROBE) {
5983 		struct alc_spec *spec = codec->spec;
5984 		/* toggled via hp_automute_hook */
5985 		spec->gpio_mask |= 0x40;
5986 		spec->gpio_dir |= 0x40;
5987 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5988 	}
5989 }
5990 
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)5991 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5992 					const struct hda_fixup *fix, int action)
5993 {
5994 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5995 		struct alc_spec *spec = codec->spec;
5996 		spec->gen.auto_mute_via_amp = 1;
5997 	}
5998 }
5999 
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)6000 static void alc_fixup_no_shutup(struct hda_codec *codec,
6001 				const struct hda_fixup *fix, int action)
6002 {
6003 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6004 		struct alc_spec *spec = codec->spec;
6005 		spec->no_shutup_pins = 1;
6006 	}
6007 }
6008 
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)6009 static void alc_fixup_disable_aamix(struct hda_codec *codec,
6010 				    const struct hda_fixup *fix, int action)
6011 {
6012 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6013 		struct alc_spec *spec = codec->spec;
6014 		/* Disable AA-loopback as it causes white noise */
6015 		spec->gen.mixer_nid = 0;
6016 	}
6017 }
6018 
6019 /* 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)6020 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6021 				  const struct hda_fixup *fix, int action)
6022 {
6023 	static const struct hda_pintbl pincfgs[] = {
6024 		{ 0x16, 0x21211010 }, /* dock headphone */
6025 		{ 0x19, 0x21a11010 }, /* dock mic */
6026 		{ }
6027 	};
6028 	struct alc_spec *spec = codec->spec;
6029 
6030 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6031 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6032 		codec->power_save_node = 0; /* avoid click noises */
6033 		snd_hda_apply_pincfgs(codec, pincfgs);
6034 	}
6035 }
6036 
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6037 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6038 				  const struct hda_fixup *fix, int action)
6039 {
6040 	static const struct hda_pintbl pincfgs[] = {
6041 		{ 0x17, 0x21211010 }, /* dock headphone */
6042 		{ 0x19, 0x21a11010 }, /* dock mic */
6043 		{ }
6044 	};
6045 	struct alc_spec *spec = codec->spec;
6046 
6047 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6048 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6049 		snd_hda_apply_pincfgs(codec, pincfgs);
6050 	} else if (action == HDA_FIXUP_ACT_INIT) {
6051 		/* Enable DOCK device */
6052 		snd_hda_codec_write(codec, 0x17, 0,
6053 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6054 		/* Enable DOCK device */
6055 		snd_hda_codec_write(codec, 0x19, 0,
6056 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6057 	}
6058 }
6059 
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6060 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6061 				  const struct hda_fixup *fix, int action)
6062 {
6063 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6064 	 * the speaker output becomes too low by some reason on Thinkpads with
6065 	 * ALC298 codec
6066 	 */
6067 	static const hda_nid_t preferred_pairs[] = {
6068 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6069 		0
6070 	};
6071 	struct alc_spec *spec = codec->spec;
6072 
6073 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6074 		spec->gen.preferred_dacs = preferred_pairs;
6075 }
6076 
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6077 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6078 				   const struct hda_fixup *fix, int action)
6079 {
6080 	static const hda_nid_t preferred_pairs[] = {
6081 		0x17, 0x02, 0x21, 0x03, 0
6082 	};
6083 	struct alc_spec *spec = codec->spec;
6084 
6085 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6086 		spec->gen.preferred_dacs = preferred_pairs;
6087 }
6088 
alc_shutup_dell_xps13(struct hda_codec * codec)6089 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6090 {
6091 	struct alc_spec *spec = codec->spec;
6092 	int hp_pin = alc_get_hp_pin(spec);
6093 
6094 	/* Prevent pop noises when headphones are plugged in */
6095 	snd_hda_codec_write(codec, hp_pin, 0,
6096 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6097 	msleep(20);
6098 }
6099 
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6100 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6101 				const struct hda_fixup *fix, int action)
6102 {
6103 	struct alc_spec *spec = codec->spec;
6104 	struct hda_input_mux *imux = &spec->gen.input_mux;
6105 	int i;
6106 
6107 	switch (action) {
6108 	case HDA_FIXUP_ACT_PRE_PROBE:
6109 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6110 		 * it causes a click noise at start up
6111 		 */
6112 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6113 		spec->shutup = alc_shutup_dell_xps13;
6114 		break;
6115 	case HDA_FIXUP_ACT_PROBE:
6116 		/* Make the internal mic the default input source. */
6117 		for (i = 0; i < imux->num_items; i++) {
6118 			if (spec->gen.imux_pins[i] == 0x12) {
6119 				spec->gen.cur_mux[0] = i;
6120 				break;
6121 			}
6122 		}
6123 		break;
6124 	}
6125 }
6126 
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6127 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6128 				const struct hda_fixup *fix, int action)
6129 {
6130 	struct alc_spec *spec = codec->spec;
6131 
6132 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6133 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6134 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6135 
6136 		/* Disable boost for mic-in permanently. (This code is only called
6137 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6138 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6139 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6140 	} else
6141 		alc_fixup_headset_mode(codec, fix, action);
6142 }
6143 
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6144 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6145 				const struct hda_fixup *fix, int action)
6146 {
6147 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6148 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6149 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6150 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6151 	}
6152 	alc_fixup_headset_mode(codec, fix, action);
6153 }
6154 
6155 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6156 static int find_ext_mic_pin(struct hda_codec *codec)
6157 {
6158 	struct alc_spec *spec = codec->spec;
6159 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6160 	hda_nid_t nid;
6161 	unsigned int defcfg;
6162 	int i;
6163 
6164 	for (i = 0; i < cfg->num_inputs; i++) {
6165 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6166 			continue;
6167 		nid = cfg->inputs[i].pin;
6168 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6169 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6170 			continue;
6171 		return nid;
6172 	}
6173 
6174 	return 0;
6175 }
6176 
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6177 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6178 				    const struct hda_fixup *fix,
6179 				    int action)
6180 {
6181 	struct alc_spec *spec = codec->spec;
6182 
6183 	if (action == HDA_FIXUP_ACT_PROBE) {
6184 		int mic_pin = find_ext_mic_pin(codec);
6185 		int hp_pin = alc_get_hp_pin(spec);
6186 
6187 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6188 			return;
6189 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6190 	}
6191 }
6192 
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6193 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6194 					     const struct hda_fixup *fix,
6195 					     int action)
6196 {
6197 	struct alc_spec *spec = codec->spec;
6198 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6199 	int i;
6200 
6201 	/* The mic boosts on level 2 and 3 are too noisy
6202 	   on the internal mic input.
6203 	   Therefore limit the boost to 0 or 1. */
6204 
6205 	if (action != HDA_FIXUP_ACT_PROBE)
6206 		return;
6207 
6208 	for (i = 0; i < cfg->num_inputs; i++) {
6209 		hda_nid_t nid = cfg->inputs[i].pin;
6210 		unsigned int defcfg;
6211 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6212 			continue;
6213 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6214 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6215 			continue;
6216 
6217 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6218 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6219 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6220 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6221 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6222 	}
6223 }
6224 
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6225 static void alc283_hp_automute_hook(struct hda_codec *codec,
6226 				    struct hda_jack_callback *jack)
6227 {
6228 	struct alc_spec *spec = codec->spec;
6229 	int vref;
6230 
6231 	msleep(200);
6232 	snd_hda_gen_hp_automute(codec, jack);
6233 
6234 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6235 
6236 	msleep(600);
6237 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6238 			    vref);
6239 }
6240 
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6241 static void alc283_fixup_chromebook(struct hda_codec *codec,
6242 				    const struct hda_fixup *fix, int action)
6243 {
6244 	struct alc_spec *spec = codec->spec;
6245 
6246 	switch (action) {
6247 	case HDA_FIXUP_ACT_PRE_PROBE:
6248 		snd_hda_override_wcaps(codec, 0x03, 0);
6249 		/* Disable AA-loopback as it causes white noise */
6250 		spec->gen.mixer_nid = 0;
6251 		break;
6252 	case HDA_FIXUP_ACT_INIT:
6253 		/* MIC2-VREF control */
6254 		/* Set to manual mode */
6255 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6256 		/* Enable Line1 input control by verb */
6257 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6258 		break;
6259 	}
6260 }
6261 
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6262 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6263 				    const struct hda_fixup *fix, int action)
6264 {
6265 	struct alc_spec *spec = codec->spec;
6266 
6267 	switch (action) {
6268 	case HDA_FIXUP_ACT_PRE_PROBE:
6269 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6270 		break;
6271 	case HDA_FIXUP_ACT_INIT:
6272 		/* MIC2-VREF control */
6273 		/* Set to manual mode */
6274 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6275 		break;
6276 	}
6277 }
6278 
6279 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6280 static void asus_tx300_automute(struct hda_codec *codec)
6281 {
6282 	struct alc_spec *spec = codec->spec;
6283 	snd_hda_gen_update_outputs(codec);
6284 	if (snd_hda_jack_detect(codec, 0x1b))
6285 		spec->gen.mute_bits |= (1ULL << 0x14);
6286 }
6287 
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6288 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6289 				    const struct hda_fixup *fix, int action)
6290 {
6291 	struct alc_spec *spec = codec->spec;
6292 	static const struct hda_pintbl dock_pins[] = {
6293 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6294 		{}
6295 	};
6296 
6297 	switch (action) {
6298 	case HDA_FIXUP_ACT_PRE_PROBE:
6299 		spec->init_amp = ALC_INIT_DEFAULT;
6300 		/* TX300 needs to set up GPIO2 for the speaker amp */
6301 		alc_setup_gpio(codec, 0x04);
6302 		snd_hda_apply_pincfgs(codec, dock_pins);
6303 		spec->gen.auto_mute_via_amp = 1;
6304 		spec->gen.automute_hook = asus_tx300_automute;
6305 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6306 						    snd_hda_gen_hp_automute);
6307 		break;
6308 	case HDA_FIXUP_ACT_PROBE:
6309 		spec->init_amp = ALC_INIT_DEFAULT;
6310 		break;
6311 	case HDA_FIXUP_ACT_BUILD:
6312 		/* this is a bit tricky; give more sane names for the main
6313 		 * (tablet) speaker and the dock speaker, respectively
6314 		 */
6315 		rename_ctl(codec, "Speaker Playback Switch",
6316 			   "Dock Speaker Playback Switch");
6317 		rename_ctl(codec, "Bass Speaker Playback Switch",
6318 			   "Speaker Playback Switch");
6319 		break;
6320 	}
6321 }
6322 
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6323 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6324 				       const struct hda_fixup *fix, int action)
6325 {
6326 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6327 		/* DAC node 0x03 is giving mono output. We therefore want to
6328 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6329 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6330 		static const hda_nid_t conn1[] = { 0x0c };
6331 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6332 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6333 	}
6334 }
6335 
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6336 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6337 					const struct hda_fixup *fix, int action)
6338 {
6339 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6340 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6341 		   we can't adjust the speaker's volume since this node does not has
6342 		   Amp-out capability. we change the speaker's route to:
6343 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6344 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6345 		   speaker's volume now. */
6346 
6347 		static const hda_nid_t conn1[] = { 0x0c };
6348 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6349 	}
6350 }
6351 
6352 /* 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)6353 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6354 				      const struct hda_fixup *fix, int action)
6355 {
6356 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6357 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6358 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6359 	}
6360 }
6361 
6362 /* 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)6363 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6364 					  const struct hda_fixup *fix, int action)
6365 {
6366 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6367 		static const hda_nid_t conn[] = { 0x02 };
6368 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6369 	}
6370 }
6371 
6372 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6373 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6374 					  struct hda_jack_callback *jack)
6375 {
6376 	struct alc_spec *spec = codec->spec;
6377 
6378 	snd_hda_gen_hp_automute(codec, jack);
6379 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6380 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6381 			    !spec->gen.hp_jack_present);
6382 }
6383 
6384 /* Manage GPIOs for HP EliteBook Folio 9480m.
6385  *
6386  * GPIO4 is the headphone amplifier power control
6387  * GPIO3 is the audio output mute indicator LED
6388  */
6389 
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6390 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6391 				  const struct hda_fixup *fix,
6392 				  int action)
6393 {
6394 	struct alc_spec *spec = codec->spec;
6395 
6396 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6397 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6398 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6399 		spec->gpio_mask |= 0x10;
6400 		spec->gpio_dir |= 0x10;
6401 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6402 	}
6403 }
6404 
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6405 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6406 				   const struct hda_fixup *fix,
6407 				   int action)
6408 {
6409 	struct alc_spec *spec = codec->spec;
6410 
6411 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6412 		spec->gpio_mask |= 0x04;
6413 		spec->gpio_dir |= 0x04;
6414 		/* set data bit low */
6415 	}
6416 }
6417 
6418 /* Quirk for Thinkpad X1 7th and 8th Gen
6419  * The following fixed routing needed
6420  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6421  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6422  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6423  */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6424 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6425 					  const struct hda_fixup *fix, int action)
6426 {
6427 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6428 	static const hda_nid_t preferred_pairs[] = {
6429 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6430 	};
6431 	struct alc_spec *spec = codec->spec;
6432 
6433 	switch (action) {
6434 	case HDA_FIXUP_ACT_PRE_PROBE:
6435 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6436 		spec->gen.preferred_dacs = preferred_pairs;
6437 		break;
6438 	case HDA_FIXUP_ACT_BUILD:
6439 		/* The generic parser creates somewhat unintuitive volume ctls
6440 		 * with the fixed routing above, and the shared DAC2 may be
6441 		 * confusing for PA.
6442 		 * Rename those to unique names so that PA doesn't touch them
6443 		 * and use only Master volume.
6444 		 */
6445 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6446 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6447 		break;
6448 	}
6449 }
6450 
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6451 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6452 					 const struct hda_fixup *fix,
6453 					 int action)
6454 {
6455 	alc_fixup_dual_codecs(codec, fix, action);
6456 	switch (action) {
6457 	case HDA_FIXUP_ACT_PRE_PROBE:
6458 		/* override card longname to provide a unique UCM profile */
6459 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6460 		break;
6461 	case HDA_FIXUP_ACT_BUILD:
6462 		/* rename Capture controls depending on the codec */
6463 		rename_ctl(codec, "Capture Volume",
6464 			   codec->addr == 0 ?
6465 			   "Rear-Panel Capture Volume" :
6466 			   "Front-Panel Capture Volume");
6467 		rename_ctl(codec, "Capture Switch",
6468 			   codec->addr == 0 ?
6469 			   "Rear-Panel Capture Switch" :
6470 			   "Front-Panel Capture Switch");
6471 		break;
6472 	}
6473 }
6474 
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6475 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6476 				      const struct hda_fixup *fix, int action)
6477 {
6478 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6479 		return;
6480 
6481 	codec->power_save_node = 1;
6482 }
6483 
6484 /* 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)6485 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6486 				    const struct hda_fixup *fix, int action)
6487 {
6488 	struct alc_spec *spec = codec->spec;
6489 	static const hda_nid_t preferred_pairs[] = {
6490 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6491 		0
6492 	};
6493 
6494 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6495 		return;
6496 
6497 	spec->gen.preferred_dacs = preferred_pairs;
6498 	spec->gen.auto_mute_via_amp = 1;
6499 	codec->power_save_node = 0;
6500 }
6501 
6502 /* 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)6503 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6504 				    const struct hda_fixup *fix, int action)
6505 {
6506 	static const hda_nid_t preferred_pairs[] = {
6507 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6508 	};
6509 	struct alc_spec *spec = codec->spec;
6510 
6511 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6512 		spec->gen.preferred_dacs = preferred_pairs;
6513 		spec->gen.obey_preferred_dacs = 1;
6514 	}
6515 }
6516 
6517 /* 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)6518 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6519 			      const struct hda_fixup *fix, int action)
6520 {
6521 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6522 		return;
6523 
6524 	snd_hda_override_wcaps(codec, 0x03, 0);
6525 }
6526 
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6527 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6528 {
6529 	switch (codec->core.vendor_id) {
6530 	case 0x10ec0274:
6531 	case 0x10ec0294:
6532 	case 0x10ec0225:
6533 	case 0x10ec0295:
6534 	case 0x10ec0299:
6535 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6536 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6537 		break;
6538 	case 0x10ec0230:
6539 	case 0x10ec0235:
6540 	case 0x10ec0236:
6541 	case 0x10ec0255:
6542 	case 0x10ec0256:
6543 	case 0x10ec0257:
6544 	case 0x19e58326:
6545 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6546 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6547 		break;
6548 	}
6549 }
6550 
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6551 static void alc295_fixup_chromebook(struct hda_codec *codec,
6552 				    const struct hda_fixup *fix, int action)
6553 {
6554 	struct alc_spec *spec = codec->spec;
6555 
6556 	switch (action) {
6557 	case HDA_FIXUP_ACT_PRE_PROBE:
6558 		spec->ultra_low_power = true;
6559 		break;
6560 	case HDA_FIXUP_ACT_INIT:
6561 		alc_combo_jack_hp_jd_restart(codec);
6562 		break;
6563 	}
6564 }
6565 
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6566 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6567 				  const struct hda_fixup *fix, int action)
6568 {
6569 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6570 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6571 }
6572 
6573 
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6574 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6575 					struct hda_jack_callback *cb)
6576 {
6577 	/* The Windows driver sets the codec up in a very different way where
6578 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6579 	 */
6580 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6581 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6582 	else
6583 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6584 }
6585 
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6586 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6587 					const struct hda_fixup *fix, int action)
6588 {
6589 	/* Pin 0x21: headphones/headset mic */
6590 	if (!is_jack_detectable(codec, 0x21))
6591 		return;
6592 
6593 	switch (action) {
6594 	case HDA_FIXUP_ACT_PRE_PROBE:
6595 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6596 				alc294_gx502_toggle_output);
6597 		break;
6598 	case HDA_FIXUP_ACT_INIT:
6599 		/* Make sure to start in a correct state, i.e. if
6600 		 * headphones have been plugged in before powering up the system
6601 		 */
6602 		alc294_gx502_toggle_output(codec, NULL);
6603 		break;
6604 	}
6605 }
6606 
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6607 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6608 				       struct hda_jack_callback *cb)
6609 {
6610 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6611 	 * responsible from changes between speakers and headphones
6612 	 */
6613 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6614 		alc_write_coef_idx(codec, 0x10, 0x8420);
6615 	else
6616 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6617 }
6618 
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6619 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6620 				  const struct hda_fixup *fix, int action)
6621 {
6622 	if (!is_jack_detectable(codec, 0x21))
6623 		return;
6624 
6625 	switch (action) {
6626 	case HDA_FIXUP_ACT_PRE_PROBE:
6627 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6628 				alc294_gu502_toggle_output);
6629 		break;
6630 	case HDA_FIXUP_ACT_INIT:
6631 		alc294_gu502_toggle_output(codec, NULL);
6632 		break;
6633 	}
6634 }
6635 
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6636 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6637 			      const struct hda_fixup *fix, int action)
6638 {
6639 	if (action != HDA_FIXUP_ACT_INIT)
6640 		return;
6641 
6642 	msleep(100);
6643 	alc_write_coef_idx(codec, 0x65, 0x0);
6644 }
6645 
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6646 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6647 				    const struct hda_fixup *fix, int action)
6648 {
6649 	switch (action) {
6650 	case HDA_FIXUP_ACT_INIT:
6651 		alc_combo_jack_hp_jd_restart(codec);
6652 		break;
6653 	}
6654 }
6655 
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6656 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6657 				    const struct hda_fixup *fix, int action)
6658 {
6659 	struct alc_spec *spec = codec->spec;
6660 
6661 	switch (action) {
6662 	case HDA_FIXUP_ACT_PRE_PROBE:
6663 		/* Mic RING SLEEVE swap for combo jack */
6664 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6665 		spec->no_internal_mic_pin = true;
6666 		break;
6667 	case HDA_FIXUP_ACT_INIT:
6668 		alc_combo_jack_hp_jd_restart(codec);
6669 		break;
6670 	}
6671 }
6672 
6673 /* GPIO1 = amplifier on/off
6674  * GPIO3 = mic mute LED
6675  */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6676 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6677 					  const struct hda_fixup *fix, int action)
6678 {
6679 	static const hda_nid_t conn[] = { 0x02 };
6680 
6681 	struct alc_spec *spec = codec->spec;
6682 	static const struct hda_pintbl pincfgs[] = {
6683 		{ 0x14, 0x90170110 },  /* front/high speakers */
6684 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6685 		{ }
6686 	};
6687 
6688 	//enable micmute led
6689 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6690 
6691 	switch (action) {
6692 	case HDA_FIXUP_ACT_PRE_PROBE:
6693 		spec->micmute_led_polarity = 1;
6694 		/* needed for amp of back speakers */
6695 		spec->gpio_mask |= 0x01;
6696 		spec->gpio_dir |= 0x01;
6697 		snd_hda_apply_pincfgs(codec, pincfgs);
6698 		/* share DAC to have unified volume control */
6699 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6700 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6701 		break;
6702 	case HDA_FIXUP_ACT_INIT:
6703 		/* need to toggle GPIO to enable the amp of back speakers */
6704 		alc_update_gpio_data(codec, 0x01, true);
6705 		msleep(100);
6706 		alc_update_gpio_data(codec, 0x01, false);
6707 		break;
6708 	}
6709 }
6710 
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6711 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6712 					  const struct hda_fixup *fix, int action)
6713 {
6714 	static const hda_nid_t conn[] = { 0x02 };
6715 	static const struct hda_pintbl pincfgs[] = {
6716 		{ 0x14, 0x90170110 },  /* rear speaker */
6717 		{ }
6718 	};
6719 
6720 	switch (action) {
6721 	case HDA_FIXUP_ACT_PRE_PROBE:
6722 		snd_hda_apply_pincfgs(codec, pincfgs);
6723 		/* force front speaker to DAC1 */
6724 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6725 		break;
6726 	}
6727 }
6728 
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6729 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6730 				      const struct hda_fixup *fix,
6731 				      int action)
6732 {
6733 	static const struct coef_fw coefs[] = {
6734 		WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6735 		WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6736 		WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6737 		WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6738 		WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6739 		WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6740 		WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6741 		WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6742 		WRITE_COEF(0x6e, 0x1005), { }
6743 	};
6744 
6745 	static const struct hda_pintbl pincfgs[] = {
6746 		{ 0x12, 0xb7a60130 },  /* Internal microphone*/
6747 		{ 0x14, 0x90170150 },  /* B&O soundbar speakers */
6748 		{ 0x17, 0x90170153 },  /* Side speakers */
6749 		{ 0x19, 0x03a11040 },  /* Headset microphone */
6750 		{ }
6751 	};
6752 
6753 	switch (action) {
6754 	case HDA_FIXUP_ACT_PRE_PROBE:
6755 		snd_hda_apply_pincfgs(codec, pincfgs);
6756 
6757 		/* Fixes volume control problem for side speakers */
6758 		alc295_fixup_disable_dac3(codec, fix, action);
6759 
6760 		/* Fixes no sound from headset speaker */
6761 		snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
6762 
6763 		/* Auto-enable headset mic when plugged */
6764 		snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
6765 
6766 		/* Headset mic volume enhancement */
6767 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
6768 		break;
6769 	case HDA_FIXUP_ACT_INIT:
6770 		alc_process_coef_fw(codec, coefs);
6771 		break;
6772 	case HDA_FIXUP_ACT_BUILD:
6773 		rename_ctl(codec, "Bass Speaker Playback Volume",
6774 			   "B&O-Tuned Playback Volume");
6775 		rename_ctl(codec, "Front Playback Switch",
6776 			   "B&O Soundbar Playback Switch");
6777 		rename_ctl(codec, "Bass Speaker Playback Switch",
6778 			   "Side Speaker Playback Switch");
6779 		break;
6780 	}
6781 }
6782 
6783 /* for hda_fixup_thinkpad_acpi() */
6784 #include "thinkpad_helper.c"
6785 
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)6786 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6787 				    const struct hda_fixup *fix, int action)
6788 {
6789 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6790 	hda_fixup_thinkpad_acpi(codec, fix, action);
6791 }
6792 
6793 /* 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)6794 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6795 						  const struct hda_fixup *fix,
6796 						  int action)
6797 {
6798 	struct alc_spec *spec = codec->spec;
6799 
6800 	switch (action) {
6801 	case HDA_FIXUP_ACT_PRE_PROBE:
6802 		spec->gen.suppress_auto_mute = 1;
6803 		break;
6804 	}
6805 }
6806 
comp_bind(struct device * dev)6807 static int comp_bind(struct device *dev)
6808 {
6809 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6810 	struct alc_spec *spec = cdc->spec;
6811 
6812 	return component_bind_all(dev, spec->comps);
6813 }
6814 
comp_unbind(struct device * dev)6815 static void comp_unbind(struct device *dev)
6816 {
6817 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6818 	struct alc_spec *spec = cdc->spec;
6819 
6820 	component_unbind_all(dev, spec->comps);
6821 }
6822 
6823 static const struct component_master_ops comp_master_ops = {
6824 	.bind = comp_bind,
6825 	.unbind = comp_unbind,
6826 };
6827 
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)6828 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6829 				       struct snd_pcm_substream *sub, int action)
6830 {
6831 	struct alc_spec *spec = cdc->spec;
6832 	int i;
6833 
6834 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6835 		if (spec->comps[i].dev && spec->comps[i].pre_playback_hook)
6836 			spec->comps[i].pre_playback_hook(spec->comps[i].dev, action);
6837 	}
6838 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6839 		if (spec->comps[i].dev && spec->comps[i].playback_hook)
6840 			spec->comps[i].playback_hook(spec->comps[i].dev, action);
6841 	}
6842 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6843 		if (spec->comps[i].dev && spec->comps[i].post_playback_hook)
6844 			spec->comps[i].post_playback_hook(spec->comps[i].dev, action);
6845 	}
6846 }
6847 
6848 struct scodec_dev_name {
6849 	const char *bus;
6850 	const char *hid;
6851 	int index;
6852 };
6853 
6854 /* match the device name in a slightly relaxed manner */
comp_match_cs35l41_dev_name(struct device * dev,void * data)6855 static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
6856 {
6857 	struct scodec_dev_name *p = data;
6858 	const char *d = dev_name(dev);
6859 	int n = strlen(p->bus);
6860 	char tmp[32];
6861 
6862 	/* check the bus name */
6863 	if (strncmp(d, p->bus, n))
6864 		return 0;
6865 	/* skip the bus number */
6866 	if (isdigit(d[n]))
6867 		n++;
6868 	/* the rest must be exact matching */
6869 	snprintf(tmp, sizeof(tmp), "-%s:00-cs35l41-hda.%d", p->hid, p->index);
6870 	return !strcmp(d + n, tmp);
6871 }
6872 
comp_match_tas2781_dev_name(struct device * dev,void * data)6873 static int comp_match_tas2781_dev_name(struct device *dev,
6874 	void *data)
6875 {
6876 	struct scodec_dev_name *p = data;
6877 	const char *d = dev_name(dev);
6878 	int n = strlen(p->bus);
6879 	char tmp[32];
6880 
6881 	/* check the bus name */
6882 	if (strncmp(d, p->bus, n))
6883 		return 0;
6884 	/* skip the bus number */
6885 	if (isdigit(d[n]))
6886 		n++;
6887 	/* the rest must be exact matching */
6888 	snprintf(tmp, sizeof(tmp), "-%s:00", p->hid);
6889 
6890 	return !strcmp(d + n, tmp);
6891 }
6892 
cs35l41_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,int count)6893 static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6894 				  const char *hid, int count)
6895 {
6896 	struct device *dev = hda_codec_dev(cdc);
6897 	struct alc_spec *spec = cdc->spec;
6898 	struct scodec_dev_name *rec;
6899 	int ret, i;
6900 
6901 	switch (action) {
6902 	case HDA_FIXUP_ACT_PRE_PROBE:
6903 		for (i = 0; i < count; i++) {
6904 			rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6905 			if (!rec)
6906 				return;
6907 			rec->bus = bus;
6908 			rec->hid = hid;
6909 			rec->index = i;
6910 			spec->comps[i].codec = cdc;
6911 			component_match_add(dev, &spec->match,
6912 					    comp_match_cs35l41_dev_name, rec);
6913 		}
6914 		ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6915 		if (ret)
6916 			codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6917 		else
6918 			spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6919 		break;
6920 	case HDA_FIXUP_ACT_FREE:
6921 		component_master_del(dev, &comp_master_ops);
6922 		break;
6923 	}
6924 }
6925 
tas2781_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid)6926 static void tas2781_generic_fixup(struct hda_codec *cdc, int action,
6927 	const char *bus, const char *hid)
6928 {
6929 	struct device *dev = hda_codec_dev(cdc);
6930 	struct alc_spec *spec = cdc->spec;
6931 	struct scodec_dev_name *rec;
6932 	int ret;
6933 
6934 	switch (action) {
6935 	case HDA_FIXUP_ACT_PRE_PROBE:
6936 		rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6937 		if (!rec)
6938 			return;
6939 		rec->bus = bus;
6940 		rec->hid = hid;
6941 		rec->index = 0;
6942 		spec->comps[0].codec = cdc;
6943 		component_match_add(dev, &spec->match,
6944 			comp_match_tas2781_dev_name, rec);
6945 		ret = component_master_add_with_match(dev, &comp_master_ops,
6946 			spec->match);
6947 		if (ret)
6948 			codec_err(cdc,
6949 				"Fail to register component aggregator %d\n",
6950 				ret);
6951 		else
6952 			spec->gen.pcm_playback_hook =
6953 				comp_generic_playback_hook;
6954 		break;
6955 	case HDA_FIXUP_ACT_FREE:
6956 		component_master_del(dev, &comp_master_ops);
6957 		break;
6958 	}
6959 }
6960 
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6961 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6962 {
6963 	cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6964 }
6965 
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)6966 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6967 {
6968 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2);
6969 }
6970 
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)6971 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6972 {
6973 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4);
6974 }
6975 
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6976 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6977 						 int action)
6978 {
6979 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
6980 }
6981 
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6982 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6983 						 int action)
6984 {
6985 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0101", 2);
6986 }
6987 
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6988 static void tas2781_fixup_i2c(struct hda_codec *cdc,
6989 	const struct hda_fixup *fix, int action)
6990 {
6991 	 tas2781_generic_fixup(cdc, action, "i2c", "TIAS2781");
6992 }
6993 
6994 /* for alc295_fixup_hp_top_speakers */
6995 #include "hp_x360_helper.c"
6996 
6997 /* for alc285_fixup_ideapad_s740_coef() */
6998 #include "ideapad_s740_helper.c"
6999 
7000 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
7001 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
7002 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
7003 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
7004 	{}
7005 };
7006 
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)7007 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
7008 					   const struct hda_fixup *fix,
7009 					   int action)
7010 {
7011 	/*
7012 	 * A certain other OS sets these coeffs to different values. On at least
7013 	 * one TongFang barebone these settings might survive even a cold
7014 	 * reboot. So to restore a clean slate the values are explicitly reset
7015 	 * to default here. Without this, the external microphone is always in a
7016 	 * plugged-in state, while the internal microphone is always in an
7017 	 * unplugged state, breaking the ability to use the internal microphone.
7018 	 */
7019 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7020 }
7021 
7022 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7023 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7024 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7025 	WRITE_COEF(0x49, 0x0149),
7026 	{}
7027 };
7028 
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7029 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7030 				       const struct hda_fixup *fix,
7031 				       int action)
7032 {
7033 	/*
7034 	 * The audio jack input and output is not detected on the ASRock NUC Box
7035 	 * 1100 series when cold booting without this fix. Warm rebooting from a
7036 	 * certain other OS makes the audio functional, as COEF settings are
7037 	 * preserved in this case. This fix sets these altered COEF values as
7038 	 * the default.
7039 	 */
7040 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7041 }
7042 
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7043 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7044 						    const struct hda_fixup *fix,
7045 						    int action)
7046 {
7047 	/*
7048 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7049 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7050 	 * needs an additional quirk for sound working after suspend and resume.
7051 	 */
7052 	if (codec->core.vendor_id == 0x10ec0256) {
7053 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7054 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7055 	} else {
7056 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7057 	}
7058 }
7059 
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7060 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7061 						  const struct hda_fixup *fix,
7062 						  int action)
7063 {
7064 	struct alc_spec *spec = codec->spec;
7065 	struct hda_input_mux *imux = &spec->gen.input_mux;
7066 	int i;
7067 
7068 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
7069 
7070 	switch (action) {
7071 	case HDA_FIXUP_ACT_PRE_PROBE:
7072 		/**
7073 		 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7074 		 * to Hi-Z to avoid pop noises at startup and when plugging and
7075 		 * unplugging headphones.
7076 		 */
7077 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7078 		snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7079 		break;
7080 	case HDA_FIXUP_ACT_PROBE:
7081 		/**
7082 		 * Make the internal mic (0x12) the default input source to
7083 		 * prevent pop noises on cold boot.
7084 		 */
7085 		for (i = 0; i < imux->num_items; i++) {
7086 			if (spec->gen.imux_pins[i] == 0x12) {
7087 				spec->gen.cur_mux[0] = i;
7088 				break;
7089 			}
7090 		}
7091 		break;
7092 	}
7093 }
7094 
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7095 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7096 					  const struct hda_fixup *fix, int action)
7097 {
7098 	/*
7099 	 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7100 	 * unconnected.
7101 	 */
7102 	static const struct hda_pintbl pincfgs[] = {
7103 		{ 0x17, 0x90170121 },
7104 		{ }
7105 	};
7106 	/*
7107 	 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7108 	 * DAC 0x02 and 0x03 would be fine.
7109 	 */
7110 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7111 	/*
7112 	 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7113 	 * Headphones (0x21) are connected to DAC 0x03.
7114 	 */
7115 	static const hda_nid_t preferred_pairs[] = {
7116 		0x14, 0x02,
7117 		0x17, 0x02,
7118 		0x21, 0x03,
7119 		0
7120 	};
7121 	struct alc_spec *spec = codec->spec;
7122 
7123 	switch (action) {
7124 	case HDA_FIXUP_ACT_PRE_PROBE:
7125 		snd_hda_apply_pincfgs(codec, pincfgs);
7126 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7127 		spec->gen.preferred_dacs = preferred_pairs;
7128 		break;
7129 	}
7130 }
7131 
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7132 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7133 					  const struct hda_fixup *fix, int action)
7134 {
7135 	static const struct hda_pintbl pincfgs[] = {
7136 		{ 0x14, 0x90170151 },
7137 		{ 0x17, 0x90170150 },
7138 		{ }
7139 	};
7140 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7141 	static const hda_nid_t preferred_pairs[] = {
7142 		0x14, 0x02,
7143 		0x17, 0x03,
7144 		0x21, 0x02,
7145 		0
7146 	};
7147 	struct alc_spec *spec = codec->spec;
7148 
7149 	alc_fixup_no_shutup(codec, fix, action);
7150 
7151 	switch (action) {
7152 	case HDA_FIXUP_ACT_PRE_PROBE:
7153 		snd_hda_apply_pincfgs(codec, pincfgs);
7154 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7155 		spec->gen.preferred_dacs = preferred_pairs;
7156 		break;
7157 	}
7158 }
7159 
7160 /* 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)7161 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7162 				    const struct hda_fixup *fix, int action)
7163 {
7164 	struct alc_spec *spec = codec->spec;
7165 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7166 	static const hda_nid_t preferred_pairs[] = {
7167 		0x17, 0x02, 0x21, 0x03, 0
7168 	};
7169 
7170 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7171 		return;
7172 
7173 	snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7174 	spec->gen.preferred_dacs = preferred_pairs;
7175 	spec->gen.auto_mute_via_amp = 1;
7176 	if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7177 		snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7178 					0x0); /* Make sure 0x14 was disable */
7179 	}
7180 }
7181 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7182 static void alc_fixup_headset_mic(struct hda_codec *codec,
7183 				   const struct hda_fixup *fix, int action)
7184 {
7185 	struct alc_spec *spec = codec->spec;
7186 	static const struct hda_pintbl pincfgs[] = {
7187 		{ 0x19, 0x03a1103c },
7188 		{ }
7189 	};
7190 
7191 	switch (action) {
7192 	case HDA_FIXUP_ACT_PRE_PROBE:
7193 		snd_hda_apply_pincfgs(codec, pincfgs);
7194 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7195 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7196 		break;
7197 	}
7198 }
7199 
7200 
7201 enum {
7202 	ALC269_FIXUP_GPIO2,
7203 	ALC269_FIXUP_SONY_VAIO,
7204 	ALC275_FIXUP_SONY_VAIO_GPIO2,
7205 	ALC269_FIXUP_DELL_M101Z,
7206 	ALC269_FIXUP_SKU_IGNORE,
7207 	ALC269_FIXUP_ASUS_G73JW,
7208 	ALC269_FIXUP_ASUS_N7601ZM_PINS,
7209 	ALC269_FIXUP_ASUS_N7601ZM,
7210 	ALC269_FIXUP_LENOVO_EAPD,
7211 	ALC275_FIXUP_SONY_HWEQ,
7212 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
7213 	ALC271_FIXUP_DMIC,
7214 	ALC269_FIXUP_PCM_44K,
7215 	ALC269_FIXUP_STEREO_DMIC,
7216 	ALC269_FIXUP_HEADSET_MIC,
7217 	ALC269_FIXUP_QUANTA_MUTE,
7218 	ALC269_FIXUP_LIFEBOOK,
7219 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
7220 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
7221 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7222 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7223 	ALC269_FIXUP_AMIC,
7224 	ALC269_FIXUP_DMIC,
7225 	ALC269VB_FIXUP_AMIC,
7226 	ALC269VB_FIXUP_DMIC,
7227 	ALC269_FIXUP_HP_MUTE_LED,
7228 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
7229 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
7230 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
7231 	ALC269_FIXUP_HP_GPIO_LED,
7232 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
7233 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
7234 	ALC269_FIXUP_INV_DMIC,
7235 	ALC269_FIXUP_LENOVO_DOCK,
7236 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7237 	ALC269_FIXUP_NO_SHUTUP,
7238 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7239 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7240 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7241 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7242 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7243 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7244 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7245 	ALC269_FIXUP_HEADSET_MODE,
7246 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7247 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7248 	ALC269_FIXUP_ASUS_X101_FUNC,
7249 	ALC269_FIXUP_ASUS_X101_VERB,
7250 	ALC269_FIXUP_ASUS_X101,
7251 	ALC271_FIXUP_AMIC_MIC2,
7252 	ALC271_FIXUP_HP_GATE_MIC_JACK,
7253 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7254 	ALC269_FIXUP_ACER_AC700,
7255 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7256 	ALC269VB_FIXUP_ASUS_ZENBOOK,
7257 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7258 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7259 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7260 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
7261 	ALC283_FIXUP_CHROME_BOOK,
7262 	ALC283_FIXUP_SENSE_COMBO_JACK,
7263 	ALC282_FIXUP_ASUS_TX300,
7264 	ALC283_FIXUP_INT_MIC,
7265 	ALC290_FIXUP_MONO_SPEAKERS,
7266 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7267 	ALC290_FIXUP_SUBWOOFER,
7268 	ALC290_FIXUP_SUBWOOFER_HSJACK,
7269 	ALC269_FIXUP_THINKPAD_ACPI,
7270 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7271 	ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7272 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7273 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7274 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7275 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7276 	ALC255_FIXUP_HEADSET_MODE,
7277 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7278 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7279 	ALC292_FIXUP_TPT440_DOCK,
7280 	ALC292_FIXUP_TPT440,
7281 	ALC283_FIXUP_HEADSET_MIC,
7282 	ALC255_FIXUP_MIC_MUTE_LED,
7283 	ALC282_FIXUP_ASPIRE_V5_PINS,
7284 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
7285 	ALC280_FIXUP_HP_GPIO4,
7286 	ALC286_FIXUP_HP_GPIO_LED,
7287 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7288 	ALC280_FIXUP_HP_DOCK_PINS,
7289 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7290 	ALC280_FIXUP_HP_9480M,
7291 	ALC245_FIXUP_HP_X360_AMP,
7292 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7293 	ALC285_FIXUP_HP_ENVY_X360,
7294 	ALC288_FIXUP_DELL_HEADSET_MODE,
7295 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7296 	ALC288_FIXUP_DELL_XPS_13,
7297 	ALC288_FIXUP_DISABLE_AAMIX,
7298 	ALC292_FIXUP_DELL_E7X_AAMIX,
7299 	ALC292_FIXUP_DELL_E7X,
7300 	ALC292_FIXUP_DISABLE_AAMIX,
7301 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7302 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7303 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7304 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7305 	ALC275_FIXUP_DELL_XPS,
7306 	ALC293_FIXUP_LENOVO_SPK_NOISE,
7307 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7308 	ALC255_FIXUP_DELL_SPK_NOISE,
7309 	ALC225_FIXUP_DISABLE_MIC_VREF,
7310 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7311 	ALC295_FIXUP_DISABLE_DAC3,
7312 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
7313 	ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7314 	ALC285_FIXUP_ASUS_HEADSET_MIC,
7315 	ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7316 	ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7317 	ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7318 	ALC280_FIXUP_HP_HEADSET_MIC,
7319 	ALC221_FIXUP_HP_FRONT_MIC,
7320 	ALC292_FIXUP_TPT460,
7321 	ALC298_FIXUP_SPK_VOLUME,
7322 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
7323 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7324 	ALC269_FIXUP_ATIV_BOOK_8,
7325 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7326 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7327 	ALC256_FIXUP_ASUS_HEADSET_MODE,
7328 	ALC256_FIXUP_ASUS_MIC,
7329 	ALC256_FIXUP_ASUS_AIO_GPIO2,
7330 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7331 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7332 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
7333 	ALC233_FIXUP_ACER_HEADSET_MIC,
7334 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
7335 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7336 	ALC225_FIXUP_S3_POP_NOISE,
7337 	ALC700_FIXUP_INTEL_REFERENCE,
7338 	ALC274_FIXUP_DELL_BIND_DACS,
7339 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7340 	ALC298_FIXUP_TPT470_DOCK_FIX,
7341 	ALC298_FIXUP_TPT470_DOCK,
7342 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7343 	ALC255_FIXUP_DELL_HEADSET_MIC,
7344 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7345 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
7346 	ALC295_FIXUP_HP_X360,
7347 	ALC221_FIXUP_HP_HEADSET_MIC,
7348 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7349 	ALC295_FIXUP_HP_AUTO_MUTE,
7350 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7351 	ALC294_FIXUP_ASUS_MIC,
7352 	ALC294_FIXUP_ASUS_HEADSET_MIC,
7353 	ALC294_FIXUP_ASUS_SPK,
7354 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7355 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7356 	ALC255_FIXUP_ACER_HEADSET_MIC,
7357 	ALC295_FIXUP_CHROME_BOOK,
7358 	ALC225_FIXUP_HEADSET_JACK,
7359 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7360 	ALC225_FIXUP_WYSE_AUTO_MUTE,
7361 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7362 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7363 	ALC256_FIXUP_ASUS_HEADSET_MIC,
7364 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7365 	ALC299_FIXUP_PREDATOR_SPK,
7366 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7367 	ALC289_FIXUP_DELL_SPK1,
7368 	ALC289_FIXUP_DELL_SPK2,
7369 	ALC289_FIXUP_DUAL_SPK,
7370 	ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7371 	ALC294_FIXUP_SPK2_TO_DAC1,
7372 	ALC294_FIXUP_ASUS_DUAL_SPK,
7373 	ALC285_FIXUP_THINKPAD_X1_GEN7,
7374 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7375 	ALC294_FIXUP_ASUS_ALLY,
7376 	ALC294_FIXUP_ASUS_ALLY_PINS,
7377 	ALC294_FIXUP_ASUS_ALLY_VERBS,
7378 	ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7379 	ALC294_FIXUP_ASUS_HPE,
7380 	ALC294_FIXUP_ASUS_COEF_1B,
7381 	ALC294_FIXUP_ASUS_GX502_HP,
7382 	ALC294_FIXUP_ASUS_GX502_PINS,
7383 	ALC294_FIXUP_ASUS_GX502_VERBS,
7384 	ALC294_FIXUP_ASUS_GU502_HP,
7385 	ALC294_FIXUP_ASUS_GU502_PINS,
7386 	ALC294_FIXUP_ASUS_GU502_VERBS,
7387 	ALC294_FIXUP_ASUS_G513_PINS,
7388 	ALC285_FIXUP_ASUS_G533Z_PINS,
7389 	ALC285_FIXUP_HP_GPIO_LED,
7390 	ALC285_FIXUP_HP_MUTE_LED,
7391 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7392 	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7393 	ALC236_FIXUP_HP_GPIO_LED,
7394 	ALC236_FIXUP_HP_MUTE_LED,
7395 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7396 	ALC236_FIXUP_LENOVO_INV_DMIC,
7397 	ALC298_FIXUP_SAMSUNG_AMP,
7398 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7399 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7400 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7401 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7402 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
7403 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7404 	ALC289_FIXUP_ASUS_GA401,
7405 	ALC289_FIXUP_ASUS_GA502,
7406 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7407 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
7408 	ALC269_FIXUP_CZC_B20,
7409 	ALC269_FIXUP_CZC_TMI,
7410 	ALC269_FIXUP_CZC_L101,
7411 	ALC269_FIXUP_LEMOTE_A1802,
7412 	ALC269_FIXUP_LEMOTE_A190X,
7413 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
7414 	ALC233_FIXUP_INTEL_NUC8_DMIC,
7415 	ALC233_FIXUP_INTEL_NUC8_BOOST,
7416 	ALC256_FIXUP_INTEL_NUC10,
7417 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7418 	ALC274_FIXUP_HP_MIC,
7419 	ALC274_FIXUP_HP_HEADSET_MIC,
7420 	ALC274_FIXUP_HP_ENVY_GPIO,
7421 	ALC256_FIXUP_ASUS_HPE,
7422 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7423 	ALC287_FIXUP_HP_GPIO_LED,
7424 	ALC256_FIXUP_HP_HEADSET_MIC,
7425 	ALC245_FIXUP_HP_GPIO_LED,
7426 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7427 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7428 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7429 	ALC256_FIXUP_ACER_HEADSET_MIC,
7430 	ALC285_FIXUP_IDEAPAD_S740_COEF,
7431 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7432 	ALC295_FIXUP_ASUS_DACS,
7433 	ALC295_FIXUP_HP_OMEN,
7434 	ALC285_FIXUP_HP_SPECTRE_X360,
7435 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7436 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7437 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7438 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7439 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7440 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7441 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7442 	ALC298_FIXUP_LENOVO_C940_DUET7,
7443 	ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
7444 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
7445 	ALC256_FIXUP_SET_COEF_DEFAULTS,
7446 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7447 	ALC233_FIXUP_NO_AUDIO_JACK,
7448 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7449 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7450 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7451 	ALC287_FIXUP_LEGION_16ACHG6,
7452 	ALC287_FIXUP_CS35L41_I2C_2,
7453 	ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7454 	ALC245_FIXUP_CS35L41_SPI_2,
7455 	ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7456 	ALC245_FIXUP_CS35L41_SPI_4,
7457 	ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7458 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7459 	ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7460 	ALC287_FIXUP_LEGION_16ITHG6,
7461 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7462 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7463 	ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7464 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7465 	ALC236_FIXUP_DELL_DUAL_CODECS,
7466 	ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7467 	ALC287_FIXUP_TAS2781_I2C,
7468 	ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7469 	ALC245_FIXUP_HP_X360_MUTE_LEDS,
7470 	ALC287_FIXUP_THINKPAD_I2S_SPK,
7471 	ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7472 	ALC2XX_FIXUP_HEADSET_MIC,
7473 	ALC289_FIXUP_DELL_CS35L41_SPI_2,
7474 	ALC294_FIXUP_CS35L41_I2C_2,
7475 };
7476 
7477 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7478  * both have the very same PCI SSID, and we need to apply different fixups
7479  * depending on the codec ID
7480  */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)7481 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7482 					   const struct hda_fixup *fix,
7483 					   int action)
7484 {
7485 	int id;
7486 
7487 	if (codec->core.vendor_id == 0x10ec0298)
7488 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7489 	else
7490 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7491 	__snd_hda_apply_fixup(codec, id, action, 0);
7492 }
7493 
7494 /* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
7495  * 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
7496  * so we need to apply a different fixup in this case. The only DuetITL codec
7497  * SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
7498  * and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
7499  * have matched correctly by their codecs.
7500  */
alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec * codec,const struct hda_fixup * fix,int action)7501 static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
7502 					      const struct hda_fixup *fix,
7503 					      int action)
7504 {
7505 	int id;
7506 
7507 	if (codec->core.subsystem_id == 0x17aa3802)
7508 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
7509 	else
7510 		id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
7511 	__snd_hda_apply_fixup(codec, id, action, 0);
7512 }
7513 
7514 static const struct hda_fixup alc269_fixups[] = {
7515 	[ALC269_FIXUP_GPIO2] = {
7516 		.type = HDA_FIXUP_FUNC,
7517 		.v.func = alc_fixup_gpio2,
7518 	},
7519 	[ALC269_FIXUP_SONY_VAIO] = {
7520 		.type = HDA_FIXUP_PINCTLS,
7521 		.v.pins = (const struct hda_pintbl[]) {
7522 			{0x19, PIN_VREFGRD},
7523 			{}
7524 		}
7525 	},
7526 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7527 		.type = HDA_FIXUP_FUNC,
7528 		.v.func = alc275_fixup_gpio4_off,
7529 		.chained = true,
7530 		.chain_id = ALC269_FIXUP_SONY_VAIO
7531 	},
7532 	[ALC269_FIXUP_DELL_M101Z] = {
7533 		.type = HDA_FIXUP_VERBS,
7534 		.v.verbs = (const struct hda_verb[]) {
7535 			/* Enables internal speaker */
7536 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
7537 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7538 			{}
7539 		}
7540 	},
7541 	[ALC269_FIXUP_SKU_IGNORE] = {
7542 		.type = HDA_FIXUP_FUNC,
7543 		.v.func = alc_fixup_sku_ignore,
7544 	},
7545 	[ALC269_FIXUP_ASUS_G73JW] = {
7546 		.type = HDA_FIXUP_PINS,
7547 		.v.pins = (const struct hda_pintbl[]) {
7548 			{ 0x17, 0x99130111 }, /* subwoofer */
7549 			{ }
7550 		}
7551 	},
7552 	[ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7553 		.type = HDA_FIXUP_PINS,
7554 		.v.pins = (const struct hda_pintbl[]) {
7555 			{ 0x19, 0x03A11050 },
7556 			{ 0x1a, 0x03A11C30 },
7557 			{ 0x21, 0x03211420 },
7558 			{ }
7559 		}
7560 	},
7561 	[ALC269_FIXUP_ASUS_N7601ZM] = {
7562 		.type = HDA_FIXUP_VERBS,
7563 		.v.verbs = (const struct hda_verb[]) {
7564 			{0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7565 			{0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7566 			{0x20, AC_VERB_SET_COEF_INDEX, 0x10},
7567 			{0x20, AC_VERB_SET_PROC_COEF, 0x8420},
7568 			{0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
7569 			{0x20, AC_VERB_SET_PROC_COEF, 0x7774},
7570 			{ }
7571 		},
7572 		.chained = true,
7573 		.chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
7574 	},
7575 	[ALC269_FIXUP_LENOVO_EAPD] = {
7576 		.type = HDA_FIXUP_VERBS,
7577 		.v.verbs = (const struct hda_verb[]) {
7578 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7579 			{}
7580 		}
7581 	},
7582 	[ALC275_FIXUP_SONY_HWEQ] = {
7583 		.type = HDA_FIXUP_FUNC,
7584 		.v.func = alc269_fixup_hweq,
7585 		.chained = true,
7586 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7587 	},
7588 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7589 		.type = HDA_FIXUP_FUNC,
7590 		.v.func = alc_fixup_disable_aamix,
7591 		.chained = true,
7592 		.chain_id = ALC269_FIXUP_SONY_VAIO
7593 	},
7594 	[ALC271_FIXUP_DMIC] = {
7595 		.type = HDA_FIXUP_FUNC,
7596 		.v.func = alc271_fixup_dmic,
7597 	},
7598 	[ALC269_FIXUP_PCM_44K] = {
7599 		.type = HDA_FIXUP_FUNC,
7600 		.v.func = alc269_fixup_pcm_44k,
7601 		.chained = true,
7602 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7603 	},
7604 	[ALC269_FIXUP_STEREO_DMIC] = {
7605 		.type = HDA_FIXUP_FUNC,
7606 		.v.func = alc269_fixup_stereo_dmic,
7607 	},
7608 	[ALC269_FIXUP_HEADSET_MIC] = {
7609 		.type = HDA_FIXUP_FUNC,
7610 		.v.func = alc269_fixup_headset_mic,
7611 	},
7612 	[ALC269_FIXUP_QUANTA_MUTE] = {
7613 		.type = HDA_FIXUP_FUNC,
7614 		.v.func = alc269_fixup_quanta_mute,
7615 	},
7616 	[ALC269_FIXUP_LIFEBOOK] = {
7617 		.type = HDA_FIXUP_PINS,
7618 		.v.pins = (const struct hda_pintbl[]) {
7619 			{ 0x1a, 0x2101103f }, /* dock line-out */
7620 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
7621 			{ }
7622 		},
7623 		.chained = true,
7624 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7625 	},
7626 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7627 		.type = HDA_FIXUP_PINS,
7628 		.v.pins = (const struct hda_pintbl[]) {
7629 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7630 			{ }
7631 		},
7632 	},
7633 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7634 		.type = HDA_FIXUP_PINS,
7635 		.v.pins = (const struct hda_pintbl[]) {
7636 			{ 0x21, 0x0221102f }, /* HP out */
7637 			{ }
7638 		},
7639 	},
7640 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7641 		.type = HDA_FIXUP_FUNC,
7642 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7643 	},
7644 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7645 		.type = HDA_FIXUP_FUNC,
7646 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7647 	},
7648 	[ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
7649 		.type = HDA_FIXUP_PINS,
7650 		.v.pins = (const struct hda_pintbl[]) {
7651 			{ 0x18, 0x03a19020 }, /* headset mic */
7652 			{ 0x1b, 0x90170150 }, /* speaker */
7653 			{ }
7654 		},
7655 	},
7656 	[ALC269_FIXUP_AMIC] = {
7657 		.type = HDA_FIXUP_PINS,
7658 		.v.pins = (const struct hda_pintbl[]) {
7659 			{ 0x14, 0x99130110 }, /* speaker */
7660 			{ 0x15, 0x0121401f }, /* HP out */
7661 			{ 0x18, 0x01a19c20 }, /* mic */
7662 			{ 0x19, 0x99a3092f }, /* int-mic */
7663 			{ }
7664 		},
7665 	},
7666 	[ALC269_FIXUP_DMIC] = {
7667 		.type = HDA_FIXUP_PINS,
7668 		.v.pins = (const struct hda_pintbl[]) {
7669 			{ 0x12, 0x99a3092f }, /* int-mic */
7670 			{ 0x14, 0x99130110 }, /* speaker */
7671 			{ 0x15, 0x0121401f }, /* HP out */
7672 			{ 0x18, 0x01a19c20 }, /* mic */
7673 			{ }
7674 		},
7675 	},
7676 	[ALC269VB_FIXUP_AMIC] = {
7677 		.type = HDA_FIXUP_PINS,
7678 		.v.pins = (const struct hda_pintbl[]) {
7679 			{ 0x14, 0x99130110 }, /* speaker */
7680 			{ 0x18, 0x01a19c20 }, /* mic */
7681 			{ 0x19, 0x99a3092f }, /* int-mic */
7682 			{ 0x21, 0x0121401f }, /* HP out */
7683 			{ }
7684 		},
7685 	},
7686 	[ALC269VB_FIXUP_DMIC] = {
7687 		.type = HDA_FIXUP_PINS,
7688 		.v.pins = (const struct hda_pintbl[]) {
7689 			{ 0x12, 0x99a3092f }, /* int-mic */
7690 			{ 0x14, 0x99130110 }, /* speaker */
7691 			{ 0x18, 0x01a19c20 }, /* mic */
7692 			{ 0x21, 0x0121401f }, /* HP out */
7693 			{ }
7694 		},
7695 	},
7696 	[ALC269_FIXUP_HP_MUTE_LED] = {
7697 		.type = HDA_FIXUP_FUNC,
7698 		.v.func = alc269_fixup_hp_mute_led,
7699 	},
7700 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7701 		.type = HDA_FIXUP_FUNC,
7702 		.v.func = alc269_fixup_hp_mute_led_mic1,
7703 	},
7704 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7705 		.type = HDA_FIXUP_FUNC,
7706 		.v.func = alc269_fixup_hp_mute_led_mic2,
7707 	},
7708 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7709 		.type = HDA_FIXUP_FUNC,
7710 		.v.func = alc269_fixup_hp_mute_led_mic3,
7711 		.chained = true,
7712 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7713 	},
7714 	[ALC269_FIXUP_HP_GPIO_LED] = {
7715 		.type = HDA_FIXUP_FUNC,
7716 		.v.func = alc269_fixup_hp_gpio_led,
7717 	},
7718 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7719 		.type = HDA_FIXUP_FUNC,
7720 		.v.func = alc269_fixup_hp_gpio_mic1_led,
7721 	},
7722 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7723 		.type = HDA_FIXUP_FUNC,
7724 		.v.func = alc269_fixup_hp_line1_mic1_led,
7725 	},
7726 	[ALC269_FIXUP_INV_DMIC] = {
7727 		.type = HDA_FIXUP_FUNC,
7728 		.v.func = alc_fixup_inv_dmic,
7729 	},
7730 	[ALC269_FIXUP_NO_SHUTUP] = {
7731 		.type = HDA_FIXUP_FUNC,
7732 		.v.func = alc_fixup_no_shutup,
7733 	},
7734 	[ALC269_FIXUP_LENOVO_DOCK] = {
7735 		.type = HDA_FIXUP_PINS,
7736 		.v.pins = (const struct hda_pintbl[]) {
7737 			{ 0x19, 0x23a11040 }, /* dock mic */
7738 			{ 0x1b, 0x2121103f }, /* dock headphone */
7739 			{ }
7740 		},
7741 		.chained = true,
7742 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7743 	},
7744 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7745 		.type = HDA_FIXUP_FUNC,
7746 		.v.func = alc269_fixup_limit_int_mic_boost,
7747 		.chained = true,
7748 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
7749 	},
7750 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7751 		.type = HDA_FIXUP_FUNC,
7752 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7753 		.chained = true,
7754 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7755 	},
7756 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7757 		.type = HDA_FIXUP_PINS,
7758 		.v.pins = (const struct hda_pintbl[]) {
7759 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7760 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7761 			{ }
7762 		},
7763 		.chained = true,
7764 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7765 	},
7766 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7767 		.type = HDA_FIXUP_PINS,
7768 		.v.pins = (const struct hda_pintbl[]) {
7769 			{ 0x16, 0x21014020 }, /* dock line out */
7770 			{ 0x19, 0x21a19030 }, /* dock mic */
7771 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7772 			{ }
7773 		},
7774 		.chained = true,
7775 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7776 	},
7777 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7778 		.type = HDA_FIXUP_PINS,
7779 		.v.pins = (const struct hda_pintbl[]) {
7780 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7781 			{ }
7782 		},
7783 		.chained = true,
7784 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7785 	},
7786 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7787 		.type = HDA_FIXUP_PINS,
7788 		.v.pins = (const struct hda_pintbl[]) {
7789 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7790 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7791 			{ }
7792 		},
7793 		.chained = true,
7794 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7795 	},
7796 	[ALC269_FIXUP_HEADSET_MODE] = {
7797 		.type = HDA_FIXUP_FUNC,
7798 		.v.func = alc_fixup_headset_mode,
7799 		.chained = true,
7800 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7801 	},
7802 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7803 		.type = HDA_FIXUP_FUNC,
7804 		.v.func = alc_fixup_headset_mode_no_hp_mic,
7805 	},
7806 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7807 		.type = HDA_FIXUP_PINS,
7808 		.v.pins = (const struct hda_pintbl[]) {
7809 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7810 			{ }
7811 		},
7812 		.chained = true,
7813 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
7814 	},
7815 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7816 		.type = HDA_FIXUP_PINS,
7817 		.v.pins = (const struct hda_pintbl[]) {
7818 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7819 			{ }
7820 		},
7821 		.chained = true,
7822 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7823 	},
7824 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7825 		.type = HDA_FIXUP_PINS,
7826 		.v.pins = (const struct hda_pintbl[]) {
7827 			{0x12, 0x90a60130},
7828 			{0x13, 0x40000000},
7829 			{0x14, 0x90170110},
7830 			{0x18, 0x411111f0},
7831 			{0x19, 0x04a11040},
7832 			{0x1a, 0x411111f0},
7833 			{0x1b, 0x90170112},
7834 			{0x1d, 0x40759a05},
7835 			{0x1e, 0x411111f0},
7836 			{0x21, 0x04211020},
7837 			{ }
7838 		},
7839 		.chained = true,
7840 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7841 	},
7842 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7843 		.type = HDA_FIXUP_FUNC,
7844 		.v.func = alc298_fixup_huawei_mbx_stereo,
7845 		.chained = true,
7846 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7847 	},
7848 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
7849 		.type = HDA_FIXUP_FUNC,
7850 		.v.func = alc269_fixup_x101_headset_mic,
7851 	},
7852 	[ALC269_FIXUP_ASUS_X101_VERB] = {
7853 		.type = HDA_FIXUP_VERBS,
7854 		.v.verbs = (const struct hda_verb[]) {
7855 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7856 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7857 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
7858 			{ }
7859 		},
7860 		.chained = true,
7861 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7862 	},
7863 	[ALC269_FIXUP_ASUS_X101] = {
7864 		.type = HDA_FIXUP_PINS,
7865 		.v.pins = (const struct hda_pintbl[]) {
7866 			{ 0x18, 0x04a1182c }, /* Headset mic */
7867 			{ }
7868 		},
7869 		.chained = true,
7870 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
7871 	},
7872 	[ALC271_FIXUP_AMIC_MIC2] = {
7873 		.type = HDA_FIXUP_PINS,
7874 		.v.pins = (const struct hda_pintbl[]) {
7875 			{ 0x14, 0x99130110 }, /* speaker */
7876 			{ 0x19, 0x01a19c20 }, /* mic */
7877 			{ 0x1b, 0x99a7012f }, /* int-mic */
7878 			{ 0x21, 0x0121401f }, /* HP out */
7879 			{ }
7880 		},
7881 	},
7882 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7883 		.type = HDA_FIXUP_FUNC,
7884 		.v.func = alc271_hp_gate_mic_jack,
7885 		.chained = true,
7886 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
7887 	},
7888 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7889 		.type = HDA_FIXUP_FUNC,
7890 		.v.func = alc269_fixup_limit_int_mic_boost,
7891 		.chained = true,
7892 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7893 	},
7894 	[ALC269_FIXUP_ACER_AC700] = {
7895 		.type = HDA_FIXUP_PINS,
7896 		.v.pins = (const struct hda_pintbl[]) {
7897 			{ 0x12, 0x99a3092f }, /* int-mic */
7898 			{ 0x14, 0x99130110 }, /* speaker */
7899 			{ 0x18, 0x03a11c20 }, /* mic */
7900 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
7901 			{ 0x21, 0x0321101f }, /* HP out */
7902 			{ }
7903 		},
7904 		.chained = true,
7905 		.chain_id = ALC271_FIXUP_DMIC,
7906 	},
7907 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7908 		.type = HDA_FIXUP_FUNC,
7909 		.v.func = alc269_fixup_limit_int_mic_boost,
7910 		.chained = true,
7911 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7912 	},
7913 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7914 		.type = HDA_FIXUP_FUNC,
7915 		.v.func = alc269_fixup_limit_int_mic_boost,
7916 		.chained = true,
7917 		.chain_id = ALC269VB_FIXUP_DMIC,
7918 	},
7919 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7920 		.type = HDA_FIXUP_VERBS,
7921 		.v.verbs = (const struct hda_verb[]) {
7922 			/* class-D output amp +5dB */
7923 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7924 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7925 			{}
7926 		},
7927 		.chained = true,
7928 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7929 	},
7930 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7931 		.type = HDA_FIXUP_PINS,
7932 		.v.pins = (const struct hda_pintbl[]) {
7933 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
7934 			{ }
7935 		},
7936 		.chained = true,
7937 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7938 	},
7939 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7940 		.type = HDA_FIXUP_FUNC,
7941 		.v.func = alc269_fixup_limit_int_mic_boost,
7942 		.chained = true,
7943 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7944 	},
7945 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7946 		.type = HDA_FIXUP_PINS,
7947 		.v.pins = (const struct hda_pintbl[]) {
7948 			{ 0x12, 0x99a3092f }, /* int-mic */
7949 			{ 0x18, 0x03a11d20 }, /* mic */
7950 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
7951 			{ }
7952 		},
7953 	},
7954 	[ALC283_FIXUP_CHROME_BOOK] = {
7955 		.type = HDA_FIXUP_FUNC,
7956 		.v.func = alc283_fixup_chromebook,
7957 	},
7958 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
7959 		.type = HDA_FIXUP_FUNC,
7960 		.v.func = alc283_fixup_sense_combo_jack,
7961 		.chained = true,
7962 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
7963 	},
7964 	[ALC282_FIXUP_ASUS_TX300] = {
7965 		.type = HDA_FIXUP_FUNC,
7966 		.v.func = alc282_fixup_asus_tx300,
7967 	},
7968 	[ALC283_FIXUP_INT_MIC] = {
7969 		.type = HDA_FIXUP_VERBS,
7970 		.v.verbs = (const struct hda_verb[]) {
7971 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7972 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7973 			{ }
7974 		},
7975 		.chained = true,
7976 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7977 	},
7978 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7979 		.type = HDA_FIXUP_PINS,
7980 		.v.pins = (const struct hda_pintbl[]) {
7981 			{ 0x17, 0x90170112 }, /* subwoofer */
7982 			{ }
7983 		},
7984 		.chained = true,
7985 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7986 	},
7987 	[ALC290_FIXUP_SUBWOOFER] = {
7988 		.type = HDA_FIXUP_PINS,
7989 		.v.pins = (const struct hda_pintbl[]) {
7990 			{ 0x17, 0x90170112 }, /* subwoofer */
7991 			{ }
7992 		},
7993 		.chained = true,
7994 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7995 	},
7996 	[ALC290_FIXUP_MONO_SPEAKERS] = {
7997 		.type = HDA_FIXUP_FUNC,
7998 		.v.func = alc290_fixup_mono_speakers,
7999 	},
8000 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8001 		.type = HDA_FIXUP_FUNC,
8002 		.v.func = alc290_fixup_mono_speakers,
8003 		.chained = true,
8004 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8005 	},
8006 	[ALC269_FIXUP_THINKPAD_ACPI] = {
8007 		.type = HDA_FIXUP_FUNC,
8008 		.v.func = alc_fixup_thinkpad_acpi,
8009 		.chained = true,
8010 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
8011 	},
8012 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8013 		.type = HDA_FIXUP_FUNC,
8014 		.v.func = alc_fixup_inv_dmic,
8015 		.chained = true,
8016 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8017 	},
8018 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8019 		.type = HDA_FIXUP_PINS,
8020 		.v.pins = (const struct hda_pintbl[]) {
8021 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8022 			{ }
8023 		},
8024 		.chained = true,
8025 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8026 	},
8027 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8028 		.type = HDA_FIXUP_PINS,
8029 		.v.pins = (const struct hda_pintbl[]) {
8030 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8031 			{ }
8032 		},
8033 		.chained = true,
8034 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8035 	},
8036 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8037 		.type = HDA_FIXUP_PINS,
8038 		.v.pins = (const struct hda_pintbl[]) {
8039 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8040 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8041 			{ }
8042 		},
8043 		.chained = true,
8044 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8045 	},
8046 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8047 		.type = HDA_FIXUP_PINS,
8048 		.v.pins = (const struct hda_pintbl[]) {
8049 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8050 			{ }
8051 		},
8052 		.chained = true,
8053 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8054 	},
8055 	[ALC255_FIXUP_HEADSET_MODE] = {
8056 		.type = HDA_FIXUP_FUNC,
8057 		.v.func = alc_fixup_headset_mode_alc255,
8058 		.chained = true,
8059 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8060 	},
8061 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8062 		.type = HDA_FIXUP_FUNC,
8063 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8064 	},
8065 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8066 		.type = HDA_FIXUP_PINS,
8067 		.v.pins = (const struct hda_pintbl[]) {
8068 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8069 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8070 			{ }
8071 		},
8072 		.chained = true,
8073 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8074 	},
8075 	[ALC292_FIXUP_TPT440_DOCK] = {
8076 		.type = HDA_FIXUP_FUNC,
8077 		.v.func = alc_fixup_tpt440_dock,
8078 		.chained = true,
8079 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8080 	},
8081 	[ALC292_FIXUP_TPT440] = {
8082 		.type = HDA_FIXUP_FUNC,
8083 		.v.func = alc_fixup_disable_aamix,
8084 		.chained = true,
8085 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
8086 	},
8087 	[ALC283_FIXUP_HEADSET_MIC] = {
8088 		.type = HDA_FIXUP_PINS,
8089 		.v.pins = (const struct hda_pintbl[]) {
8090 			{ 0x19, 0x04a110f0 },
8091 			{ },
8092 		},
8093 	},
8094 	[ALC255_FIXUP_MIC_MUTE_LED] = {
8095 		.type = HDA_FIXUP_FUNC,
8096 		.v.func = alc_fixup_micmute_led,
8097 	},
8098 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
8099 		.type = HDA_FIXUP_PINS,
8100 		.v.pins = (const struct hda_pintbl[]) {
8101 			{ 0x12, 0x90a60130 },
8102 			{ 0x14, 0x90170110 },
8103 			{ 0x17, 0x40000008 },
8104 			{ 0x18, 0x411111f0 },
8105 			{ 0x19, 0x01a1913c },
8106 			{ 0x1a, 0x411111f0 },
8107 			{ 0x1b, 0x411111f0 },
8108 			{ 0x1d, 0x40f89b2d },
8109 			{ 0x1e, 0x411111f0 },
8110 			{ 0x21, 0x0321101f },
8111 			{ },
8112 		},
8113 	},
8114 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8115 		.type = HDA_FIXUP_FUNC,
8116 		.v.func = alc269vb_fixup_aspire_e1_coef,
8117 	},
8118 	[ALC280_FIXUP_HP_GPIO4] = {
8119 		.type = HDA_FIXUP_FUNC,
8120 		.v.func = alc280_fixup_hp_gpio4,
8121 	},
8122 	[ALC286_FIXUP_HP_GPIO_LED] = {
8123 		.type = HDA_FIXUP_FUNC,
8124 		.v.func = alc286_fixup_hp_gpio_led,
8125 	},
8126 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8127 		.type = HDA_FIXUP_FUNC,
8128 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8129 	},
8130 	[ALC280_FIXUP_HP_DOCK_PINS] = {
8131 		.type = HDA_FIXUP_PINS,
8132 		.v.pins = (const struct hda_pintbl[]) {
8133 			{ 0x1b, 0x21011020 }, /* line-out */
8134 			{ 0x1a, 0x01a1903c }, /* headset mic */
8135 			{ 0x18, 0x2181103f }, /* line-in */
8136 			{ },
8137 		},
8138 		.chained = true,
8139 		.chain_id = ALC280_FIXUP_HP_GPIO4
8140 	},
8141 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8142 		.type = HDA_FIXUP_PINS,
8143 		.v.pins = (const struct hda_pintbl[]) {
8144 			{ 0x1b, 0x21011020 }, /* line-out */
8145 			{ 0x18, 0x2181103f }, /* line-in */
8146 			{ },
8147 		},
8148 		.chained = true,
8149 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8150 	},
8151 	[ALC280_FIXUP_HP_9480M] = {
8152 		.type = HDA_FIXUP_FUNC,
8153 		.v.func = alc280_fixup_hp_9480m,
8154 	},
8155 	[ALC245_FIXUP_HP_X360_AMP] = {
8156 		.type = HDA_FIXUP_FUNC,
8157 		.v.func = alc245_fixup_hp_x360_amp,
8158 		.chained = true,
8159 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
8160 	},
8161 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
8162 		.type = HDA_FIXUP_FUNC,
8163 		.v.func = alc_fixup_headset_mode_dell_alc288,
8164 		.chained = true,
8165 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8166 	},
8167 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8168 		.type = HDA_FIXUP_PINS,
8169 		.v.pins = (const struct hda_pintbl[]) {
8170 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8171 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8172 			{ }
8173 		},
8174 		.chained = true,
8175 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8176 	},
8177 	[ALC288_FIXUP_DISABLE_AAMIX] = {
8178 		.type = HDA_FIXUP_FUNC,
8179 		.v.func = alc_fixup_disable_aamix,
8180 		.chained = true,
8181 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8182 	},
8183 	[ALC288_FIXUP_DELL_XPS_13] = {
8184 		.type = HDA_FIXUP_FUNC,
8185 		.v.func = alc_fixup_dell_xps13,
8186 		.chained = true,
8187 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
8188 	},
8189 	[ALC292_FIXUP_DISABLE_AAMIX] = {
8190 		.type = HDA_FIXUP_FUNC,
8191 		.v.func = alc_fixup_disable_aamix,
8192 		.chained = true,
8193 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8194 	},
8195 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8196 		.type = HDA_FIXUP_FUNC,
8197 		.v.func = alc_fixup_disable_aamix,
8198 		.chained = true,
8199 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8200 	},
8201 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
8202 		.type = HDA_FIXUP_FUNC,
8203 		.v.func = alc_fixup_dell_xps13,
8204 		.chained = true,
8205 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
8206 	},
8207 	[ALC292_FIXUP_DELL_E7X] = {
8208 		.type = HDA_FIXUP_FUNC,
8209 		.v.func = alc_fixup_micmute_led,
8210 		/* micmute fixup must be applied at last */
8211 		.chained_before = true,
8212 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8213 	},
8214 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8215 		.type = HDA_FIXUP_PINS,
8216 		.v.pins = (const struct hda_pintbl[]) {
8217 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8218 			{ }
8219 		},
8220 		.chained_before = true,
8221 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8222 	},
8223 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8224 		.type = HDA_FIXUP_PINS,
8225 		.v.pins = (const struct hda_pintbl[]) {
8226 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8227 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8228 			{ }
8229 		},
8230 		.chained = true,
8231 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8232 	},
8233 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8234 		.type = HDA_FIXUP_PINS,
8235 		.v.pins = (const struct hda_pintbl[]) {
8236 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8237 			{ }
8238 		},
8239 		.chained = true,
8240 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8241 	},
8242 	[ALC275_FIXUP_DELL_XPS] = {
8243 		.type = HDA_FIXUP_VERBS,
8244 		.v.verbs = (const struct hda_verb[]) {
8245 			/* Enables internal speaker */
8246 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8247 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8248 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8249 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8250 			{}
8251 		}
8252 	},
8253 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8254 		.type = HDA_FIXUP_FUNC,
8255 		.v.func = alc_fixup_disable_aamix,
8256 		.chained = true,
8257 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8258 	},
8259 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8260 		.type = HDA_FIXUP_FUNC,
8261 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8262 	},
8263 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8264 		.type = HDA_FIXUP_FUNC,
8265 		.v.func = alc_fixup_inv_dmic,
8266 		.chained = true,
8267 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8268 	},
8269 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8270 		.type = HDA_FIXUP_FUNC,
8271 		.v.func = alc269_fixup_limit_int_mic_boost
8272 	},
8273 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
8274 		.type = HDA_FIXUP_FUNC,
8275 		.v.func = alc_fixup_disable_aamix,
8276 		.chained = true,
8277 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8278 	},
8279 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
8280 		.type = HDA_FIXUP_FUNC,
8281 		.v.func = alc_fixup_disable_mic_vref,
8282 		.chained = true,
8283 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8284 	},
8285 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8286 		.type = HDA_FIXUP_VERBS,
8287 		.v.verbs = (const struct hda_verb[]) {
8288 			/* Disable pass-through path for FRONT 14h */
8289 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8290 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8291 			{}
8292 		},
8293 		.chained = true,
8294 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8295 	},
8296 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
8297 		.type = HDA_FIXUP_FUNC,
8298 		.v.func = alc_fixup_disable_aamix,
8299 		.chained = true,
8300 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
8301 	},
8302 	[ALC221_FIXUP_HP_FRONT_MIC] = {
8303 		.type = HDA_FIXUP_PINS,
8304 		.v.pins = (const struct hda_pintbl[]) {
8305 			{ 0x19, 0x02a19020 }, /* Front Mic */
8306 			{ }
8307 		},
8308 	},
8309 	[ALC292_FIXUP_TPT460] = {
8310 		.type = HDA_FIXUP_FUNC,
8311 		.v.func = alc_fixup_tpt440_dock,
8312 		.chained = true,
8313 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8314 	},
8315 	[ALC298_FIXUP_SPK_VOLUME] = {
8316 		.type = HDA_FIXUP_FUNC,
8317 		.v.func = alc298_fixup_speaker_volume,
8318 		.chained = true,
8319 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8320 	},
8321 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8322 		.type = HDA_FIXUP_FUNC,
8323 		.v.func = alc298_fixup_speaker_volume,
8324 	},
8325 	[ALC295_FIXUP_DISABLE_DAC3] = {
8326 		.type = HDA_FIXUP_FUNC,
8327 		.v.func = alc295_fixup_disable_dac3,
8328 	},
8329 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8330 		.type = HDA_FIXUP_FUNC,
8331 		.v.func = alc285_fixup_speaker2_to_dac1,
8332 		.chained = true,
8333 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8334 	},
8335 	[ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8336 		.type = HDA_FIXUP_FUNC,
8337 		.v.func = alc285_fixup_speaker2_to_dac1,
8338 		.chained = true,
8339 		.chain_id = ALC245_FIXUP_CS35L41_SPI_2
8340 	},
8341 	[ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8342 		.type = HDA_FIXUP_PINS,
8343 		.v.pins = (const struct hda_pintbl[]) {
8344 			{ 0x19, 0x03a11050 },
8345 			{ 0x1b, 0x03a11c30 },
8346 			{ }
8347 		},
8348 		.chained = true,
8349 		.chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8350 	},
8351 	[ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8352 		.type = HDA_FIXUP_PINS,
8353 		.v.pins = (const struct hda_pintbl[]) {
8354 			{ 0x14, 0x90170120 },
8355 			{ }
8356 		},
8357 		.chained = true,
8358 		.chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8359 	},
8360 	[ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8361 		.type = HDA_FIXUP_FUNC,
8362 		.v.func = alc285_fixup_speaker2_to_dac1,
8363 		.chained = true,
8364 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2
8365 	},
8366 	[ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8367 		.type = HDA_FIXUP_PINS,
8368 		.v.pins = (const struct hda_pintbl[]) {
8369 			{ 0x19, 0x03a11050 },
8370 			{ 0x1b, 0x03a11c30 },
8371 			{ }
8372 		},
8373 		.chained = true,
8374 		.chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8375 	},
8376 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8377 		.type = HDA_FIXUP_PINS,
8378 		.v.pins = (const struct hda_pintbl[]) {
8379 			{ 0x1b, 0x90170151 },
8380 			{ }
8381 		},
8382 		.chained = true,
8383 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8384 	},
8385 	[ALC269_FIXUP_ATIV_BOOK_8] = {
8386 		.type = HDA_FIXUP_FUNC,
8387 		.v.func = alc_fixup_auto_mute_via_amp,
8388 		.chained = true,
8389 		.chain_id = ALC269_FIXUP_NO_SHUTUP
8390 	},
8391 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8392 		.type = HDA_FIXUP_PINS,
8393 		.v.pins = (const struct hda_pintbl[]) {
8394 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8395 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8396 			{ }
8397 		},
8398 		.chained = true,
8399 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8400 	},
8401 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8402 		.type = HDA_FIXUP_PINS,
8403 		.v.pins = (const struct hda_pintbl[]) {
8404 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8405 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8406 			{ }
8407 		},
8408 		.chained = true,
8409 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8410 	},
8411 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8412 		.type = HDA_FIXUP_FUNC,
8413 		.v.func = alc_fixup_headset_mode,
8414 	},
8415 	[ALC256_FIXUP_ASUS_MIC] = {
8416 		.type = HDA_FIXUP_PINS,
8417 		.v.pins = (const struct hda_pintbl[]) {
8418 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8419 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8420 			{ }
8421 		},
8422 		.chained = true,
8423 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8424 	},
8425 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8426 		.type = HDA_FIXUP_FUNC,
8427 		/* Set up GPIO2 for the speaker amp */
8428 		.v.func = alc_fixup_gpio4,
8429 	},
8430 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8431 		.type = HDA_FIXUP_PINS,
8432 		.v.pins = (const struct hda_pintbl[]) {
8433 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8434 			{ }
8435 		},
8436 		.chained = true,
8437 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8438 	},
8439 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8440 		.type = HDA_FIXUP_VERBS,
8441 		.v.verbs = (const struct hda_verb[]) {
8442 			/* Enables internal speaker */
8443 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8444 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8445 			{}
8446 		},
8447 		.chained = true,
8448 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8449 	},
8450 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8451 		.type = HDA_FIXUP_FUNC,
8452 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8453 		.chained = true,
8454 		.chain_id = ALC269_FIXUP_GPIO2
8455 	},
8456 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
8457 		.type = HDA_FIXUP_VERBS,
8458 		.v.verbs = (const struct hda_verb[]) {
8459 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8460 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8461 			{ }
8462 		},
8463 		.chained = true,
8464 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8465 	},
8466 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8467 		.type = HDA_FIXUP_PINS,
8468 		.v.pins = (const struct hda_pintbl[]) {
8469 			/* Change the mic location from front to right, otherwise there are
8470 			   two front mics with the same name, pulseaudio can't handle them.
8471 			   This is just a temporary workaround, after applying this fixup,
8472 			   there will be one "Front Mic" and one "Mic" in this machine.
8473 			 */
8474 			{ 0x1a, 0x04a19040 },
8475 			{ }
8476 		},
8477 	},
8478 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8479 		.type = HDA_FIXUP_PINS,
8480 		.v.pins = (const struct hda_pintbl[]) {
8481 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
8482 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8483 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8484 			{ 0x1b, 0x02011020 },
8485 			{ }
8486 		},
8487 		.chained = true,
8488 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
8489 	},
8490 	[ALC225_FIXUP_S3_POP_NOISE] = {
8491 		.type = HDA_FIXUP_FUNC,
8492 		.v.func = alc225_fixup_s3_pop_noise,
8493 		.chained = true,
8494 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8495 	},
8496 	[ALC700_FIXUP_INTEL_REFERENCE] = {
8497 		.type = HDA_FIXUP_VERBS,
8498 		.v.verbs = (const struct hda_verb[]) {
8499 			/* Enables internal speaker */
8500 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8501 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8502 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8503 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8504 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8505 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8506 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8507 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8508 			{}
8509 		}
8510 	},
8511 	[ALC274_FIXUP_DELL_BIND_DACS] = {
8512 		.type = HDA_FIXUP_FUNC,
8513 		.v.func = alc274_fixup_bind_dacs,
8514 		.chained = true,
8515 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8516 	},
8517 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8518 		.type = HDA_FIXUP_PINS,
8519 		.v.pins = (const struct hda_pintbl[]) {
8520 			{ 0x1b, 0x0401102f },
8521 			{ }
8522 		},
8523 		.chained = true,
8524 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
8525 	},
8526 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
8527 		.type = HDA_FIXUP_FUNC,
8528 		.v.func = alc_fixup_tpt470_dock,
8529 		.chained = true,
8530 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8531 	},
8532 	[ALC298_FIXUP_TPT470_DOCK] = {
8533 		.type = HDA_FIXUP_FUNC,
8534 		.v.func = alc_fixup_tpt470_dacs,
8535 		.chained = true,
8536 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8537 	},
8538 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8539 		.type = HDA_FIXUP_PINS,
8540 		.v.pins = (const struct hda_pintbl[]) {
8541 			{ 0x14, 0x0201101f },
8542 			{ }
8543 		},
8544 		.chained = true,
8545 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8546 	},
8547 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
8548 		.type = HDA_FIXUP_PINS,
8549 		.v.pins = (const struct hda_pintbl[]) {
8550 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8551 			{ }
8552 		},
8553 		.chained = true,
8554 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8555 	},
8556 	[ALC295_FIXUP_HP_X360] = {
8557 		.type = HDA_FIXUP_FUNC,
8558 		.v.func = alc295_fixup_hp_top_speakers,
8559 		.chained = true,
8560 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8561 	},
8562 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
8563 		.type = HDA_FIXUP_PINS,
8564 		.v.pins = (const struct hda_pintbl[]) {
8565 			{ 0x19, 0x0181313f},
8566 			{ }
8567 		},
8568 		.chained = true,
8569 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8570 	},
8571 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8572 		.type = HDA_FIXUP_FUNC,
8573 		.v.func = alc285_fixup_invalidate_dacs,
8574 		.chained = true,
8575 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8576 	},
8577 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
8578 		.type = HDA_FIXUP_FUNC,
8579 		.v.func = alc_fixup_auto_mute_via_amp,
8580 	},
8581 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8582 		.type = HDA_FIXUP_PINS,
8583 		.v.pins = (const struct hda_pintbl[]) {
8584 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8585 			{ }
8586 		},
8587 		.chained = true,
8588 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8589 	},
8590 	[ALC294_FIXUP_ASUS_MIC] = {
8591 		.type = HDA_FIXUP_PINS,
8592 		.v.pins = (const struct hda_pintbl[]) {
8593 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8594 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8595 			{ }
8596 		},
8597 		.chained = true,
8598 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8599 	},
8600 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8601 		.type = HDA_FIXUP_PINS,
8602 		.v.pins = (const struct hda_pintbl[]) {
8603 			{ 0x19, 0x01a1103c }, /* use as headset mic */
8604 			{ }
8605 		},
8606 		.chained = true,
8607 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8608 	},
8609 	[ALC294_FIXUP_ASUS_SPK] = {
8610 		.type = HDA_FIXUP_VERBS,
8611 		.v.verbs = (const struct hda_verb[]) {
8612 			/* Set EAPD high */
8613 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8614 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8615 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8616 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8617 			{ }
8618 		},
8619 		.chained = true,
8620 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8621 	},
8622 	[ALC295_FIXUP_CHROME_BOOK] = {
8623 		.type = HDA_FIXUP_FUNC,
8624 		.v.func = alc295_fixup_chromebook,
8625 		.chained = true,
8626 		.chain_id = ALC225_FIXUP_HEADSET_JACK
8627 	},
8628 	[ALC225_FIXUP_HEADSET_JACK] = {
8629 		.type = HDA_FIXUP_FUNC,
8630 		.v.func = alc_fixup_headset_jack,
8631 	},
8632 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8633 		.type = HDA_FIXUP_PINS,
8634 		.v.pins = (const struct hda_pintbl[]) {
8635 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8636 			{ }
8637 		},
8638 		.chained = true,
8639 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8640 	},
8641 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8642 		.type = HDA_FIXUP_VERBS,
8643 		.v.verbs = (const struct hda_verb[]) {
8644 			/* Disable PCBEEP-IN passthrough */
8645 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8646 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8647 			{ }
8648 		},
8649 		.chained = true,
8650 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8651 	},
8652 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
8653 		.type = HDA_FIXUP_PINS,
8654 		.v.pins = (const struct hda_pintbl[]) {
8655 			{ 0x19, 0x03a11130 },
8656 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
8657 			{ }
8658 		},
8659 		.chained = true,
8660 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8661 	},
8662 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8663 		.type = HDA_FIXUP_PINS,
8664 		.v.pins = (const struct hda_pintbl[]) {
8665 			{ 0x16, 0x01011020 }, /* Rear Line out */
8666 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8667 			{ }
8668 		},
8669 		.chained = true,
8670 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8671 	},
8672 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8673 		.type = HDA_FIXUP_FUNC,
8674 		.v.func = alc_fixup_auto_mute_via_amp,
8675 		.chained = true,
8676 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8677 	},
8678 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8679 		.type = HDA_FIXUP_FUNC,
8680 		.v.func = alc_fixup_disable_mic_vref,
8681 		.chained = true,
8682 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8683 	},
8684 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8685 		.type = HDA_FIXUP_VERBS,
8686 		.v.verbs = (const struct hda_verb[]) {
8687 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8688 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8689 			{ }
8690 		},
8691 		.chained = true,
8692 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8693 	},
8694 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8695 		.type = HDA_FIXUP_PINS,
8696 		.v.pins = (const struct hda_pintbl[]) {
8697 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
8698 			{ }
8699 		},
8700 		.chained = true,
8701 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8702 	},
8703 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8704 		.type = HDA_FIXUP_PINS,
8705 		.v.pins = (const struct hda_pintbl[]) {
8706 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8707 			{ }
8708 		},
8709 		.chained = true,
8710 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8711 	},
8712 	[ALC299_FIXUP_PREDATOR_SPK] = {
8713 		.type = HDA_FIXUP_PINS,
8714 		.v.pins = (const struct hda_pintbl[]) {
8715 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8716 			{ }
8717 		}
8718 	},
8719 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8720 		.type = HDA_FIXUP_PINS,
8721 		.v.pins = (const struct hda_pintbl[]) {
8722 			{ 0x19, 0x04a11040 },
8723 			{ 0x21, 0x04211020 },
8724 			{ }
8725 		},
8726 		.chained = true,
8727 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8728 	},
8729 	[ALC289_FIXUP_DELL_SPK1] = {
8730 		.type = HDA_FIXUP_PINS,
8731 		.v.pins = (const struct hda_pintbl[]) {
8732 			{ 0x14, 0x90170140 },
8733 			{ }
8734 		},
8735 		.chained = true,
8736 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8737 	},
8738 	[ALC289_FIXUP_DELL_SPK2] = {
8739 		.type = HDA_FIXUP_PINS,
8740 		.v.pins = (const struct hda_pintbl[]) {
8741 			{ 0x17, 0x90170130 }, /* bass spk */
8742 			{ }
8743 		},
8744 		.chained = true,
8745 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8746 	},
8747 	[ALC289_FIXUP_DUAL_SPK] = {
8748 		.type = HDA_FIXUP_FUNC,
8749 		.v.func = alc285_fixup_speaker2_to_dac1,
8750 		.chained = true,
8751 		.chain_id = ALC289_FIXUP_DELL_SPK2
8752 	},
8753 	[ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
8754 		.type = HDA_FIXUP_FUNC,
8755 		.v.func = alc285_fixup_speaker2_to_dac1,
8756 		.chained = true,
8757 		.chain_id = ALC289_FIXUP_DELL_SPK1
8758 	},
8759 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
8760 		.type = HDA_FIXUP_FUNC,
8761 		.v.func = alc285_fixup_speaker2_to_dac1,
8762 		.chained = true,
8763 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8764 	},
8765 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
8766 		.type = HDA_FIXUP_FUNC,
8767 		/* The GPIO must be pulled to initialize the AMP */
8768 		.v.func = alc_fixup_gpio4,
8769 		.chained = true,
8770 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8771 	},
8772 	[ALC294_FIXUP_ASUS_ALLY] = {
8773 		.type = HDA_FIXUP_FUNC,
8774 		.v.func = cs35l41_fixup_i2c_two,
8775 		.chained = true,
8776 		.chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
8777 	},
8778 	[ALC294_FIXUP_ASUS_ALLY_PINS] = {
8779 		.type = HDA_FIXUP_PINS,
8780 		.v.pins = (const struct hda_pintbl[]) {
8781 			{ 0x19, 0x03a11050 },
8782 			{ 0x1a, 0x03a11c30 },
8783 			{ 0x21, 0x03211420 },
8784 			{ }
8785 		},
8786 		.chained = true,
8787 		.chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
8788 	},
8789 	[ALC294_FIXUP_ASUS_ALLY_VERBS] = {
8790 		.type = HDA_FIXUP_VERBS,
8791 		.v.verbs = (const struct hda_verb[]) {
8792 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8793 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8794 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
8795 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
8796 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
8797 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
8798 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
8799 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
8800 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
8801 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
8802 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
8803 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
8804 			{ }
8805 		},
8806 		.chained = true,
8807 		.chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
8808 	},
8809 	[ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
8810 		.type = HDA_FIXUP_FUNC,
8811 		.v.func = alc285_fixup_speaker2_to_dac1,
8812 	},
8813 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8814 		.type = HDA_FIXUP_FUNC,
8815 		.v.func = alc285_fixup_thinkpad_x1_gen7,
8816 		.chained = true,
8817 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8818 	},
8819 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8820 		.type = HDA_FIXUP_FUNC,
8821 		.v.func = alc_fixup_headset_jack,
8822 		.chained = true,
8823 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8824 	},
8825 	[ALC294_FIXUP_ASUS_HPE] = {
8826 		.type = HDA_FIXUP_VERBS,
8827 		.v.verbs = (const struct hda_verb[]) {
8828 			/* Set EAPD high */
8829 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8830 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8831 			{ }
8832 		},
8833 		.chained = true,
8834 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8835 	},
8836 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
8837 		.type = HDA_FIXUP_PINS,
8838 		.v.pins = (const struct hda_pintbl[]) {
8839 			{ 0x19, 0x03a11050 }, /* front HP mic */
8840 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8841 			{ 0x21, 0x03211020 }, /* front HP out */
8842 			{ }
8843 		},
8844 		.chained = true,
8845 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8846 	},
8847 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
8848 		.type = HDA_FIXUP_VERBS,
8849 		.v.verbs = (const struct hda_verb[]) {
8850 			/* set 0x15 to HP-OUT ctrl */
8851 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8852 			/* unmute the 0x15 amp */
8853 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8854 			{ }
8855 		},
8856 		.chained = true,
8857 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
8858 	},
8859 	[ALC294_FIXUP_ASUS_GX502_HP] = {
8860 		.type = HDA_FIXUP_FUNC,
8861 		.v.func = alc294_fixup_gx502_hp,
8862 	},
8863 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
8864 		.type = HDA_FIXUP_PINS,
8865 		.v.pins = (const struct hda_pintbl[]) {
8866 			{ 0x19, 0x01a11050 }, /* rear HP mic */
8867 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8868 			{ 0x21, 0x012110f0 }, /* rear HP out */
8869 			{ }
8870 		},
8871 		.chained = true,
8872 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8873 	},
8874 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
8875 		.type = HDA_FIXUP_VERBS,
8876 		.v.verbs = (const struct hda_verb[]) {
8877 			/* set 0x15 to HP-OUT ctrl */
8878 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8879 			/* unmute the 0x15 amp */
8880 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8881 			/* set 0x1b to HP-OUT */
8882 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8883 			{ }
8884 		},
8885 		.chained = true,
8886 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
8887 	},
8888 	[ALC294_FIXUP_ASUS_GU502_HP] = {
8889 		.type = HDA_FIXUP_FUNC,
8890 		.v.func = alc294_fixup_gu502_hp,
8891 	},
8892 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
8893 		.type = HDA_FIXUP_PINS,
8894 		.v.pins = (const struct hda_pintbl[]) {
8895 				{ 0x19, 0x03a11050 }, /* front HP mic */
8896 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
8897 				{ 0x21, 0x03211420 }, /* front HP out */
8898 				{ }
8899 		},
8900 	},
8901 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
8902 		.type = HDA_FIXUP_PINS,
8903 		.v.pins = (const struct hda_pintbl[]) {
8904 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
8905 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
8906 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
8907 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
8908 			{ 0x21, 0x03211420 },
8909 			{ }
8910 		},
8911 	},
8912 	[ALC294_FIXUP_ASUS_COEF_1B] = {
8913 		.type = HDA_FIXUP_VERBS,
8914 		.v.verbs = (const struct hda_verb[]) {
8915 			/* Set bit 10 to correct noisy output after reboot from
8916 			 * Windows 10 (due to pop noise reduction?)
8917 			 */
8918 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8919 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8920 			{ }
8921 		},
8922 		.chained = true,
8923 		.chain_id = ALC289_FIXUP_ASUS_GA401,
8924 	},
8925 	[ALC285_FIXUP_HP_GPIO_LED] = {
8926 		.type = HDA_FIXUP_FUNC,
8927 		.v.func = alc285_fixup_hp_gpio_led,
8928 	},
8929 	[ALC285_FIXUP_HP_MUTE_LED] = {
8930 		.type = HDA_FIXUP_FUNC,
8931 		.v.func = alc285_fixup_hp_mute_led,
8932 	},
8933 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
8934 		.type = HDA_FIXUP_FUNC,
8935 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
8936 	},
8937 	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
8938 	    .type = HDA_FIXUP_FUNC,
8939 	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
8940 	},
8941 	[ALC236_FIXUP_HP_GPIO_LED] = {
8942 		.type = HDA_FIXUP_FUNC,
8943 		.v.func = alc236_fixup_hp_gpio_led,
8944 	},
8945 	[ALC236_FIXUP_HP_MUTE_LED] = {
8946 		.type = HDA_FIXUP_FUNC,
8947 		.v.func = alc236_fixup_hp_mute_led,
8948 	},
8949 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8950 		.type = HDA_FIXUP_FUNC,
8951 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
8952 	},
8953 	[ALC236_FIXUP_LENOVO_INV_DMIC] = {
8954 		.type = HDA_FIXUP_FUNC,
8955 		.v.func = alc_fixup_inv_dmic,
8956 		.chained = true,
8957 		.chain_id = ALC283_FIXUP_INT_MIC,
8958 	},
8959 	[ALC298_FIXUP_SAMSUNG_AMP] = {
8960 		.type = HDA_FIXUP_FUNC,
8961 		.v.func = alc298_fixup_samsung_amp,
8962 		.chained = true,
8963 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
8964 	},
8965 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8966 		.type = HDA_FIXUP_VERBS,
8967 		.v.verbs = (const struct hda_verb[]) {
8968 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8969 			{ }
8970 		},
8971 	},
8972 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8973 		.type = HDA_FIXUP_VERBS,
8974 		.v.verbs = (const struct hda_verb[]) {
8975 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8976 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
8977 			{ }
8978 		},
8979 	},
8980 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8981 		.type = HDA_FIXUP_PINS,
8982 		.v.pins = (const struct hda_pintbl[]) {
8983 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8984 			{ }
8985 		},
8986 		.chained = true,
8987 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8988 	},
8989 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8990 		.type = HDA_FIXUP_PINS,
8991 		.v.pins = (const struct hda_pintbl[]) {
8992 			{ 0x14, 0x90100120 }, /* use as internal speaker */
8993 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8994 			{ 0x1a, 0x01011020 }, /* use as line out */
8995 			{ },
8996 		},
8997 		.chained = true,
8998 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8999 	},
9000 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9001 		.type = HDA_FIXUP_PINS,
9002 		.v.pins = (const struct hda_pintbl[]) {
9003 			{ 0x18, 0x02a11030 }, /* use as headset mic */
9004 			{ }
9005 		},
9006 		.chained = true,
9007 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9008 	},
9009 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9010 		.type = HDA_FIXUP_PINS,
9011 		.v.pins = (const struct hda_pintbl[]) {
9012 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9013 			{ }
9014 		},
9015 		.chained = true,
9016 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9017 	},
9018 	[ALC289_FIXUP_ASUS_GA401] = {
9019 		.type = HDA_FIXUP_FUNC,
9020 		.v.func = alc289_fixup_asus_ga401,
9021 		.chained = true,
9022 		.chain_id = ALC289_FIXUP_ASUS_GA502,
9023 	},
9024 	[ALC289_FIXUP_ASUS_GA502] = {
9025 		.type = HDA_FIXUP_PINS,
9026 		.v.pins = (const struct hda_pintbl[]) {
9027 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9028 			{ }
9029 		},
9030 	},
9031 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9032 		.type = HDA_FIXUP_PINS,
9033 		.v.pins = (const struct hda_pintbl[]) {
9034 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9035 			{ }
9036 		},
9037 		.chained = true,
9038 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9039 	},
9040 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9041 		.type = HDA_FIXUP_FUNC,
9042 		.v.func = alc285_fixup_hp_gpio_amp_init,
9043 		.chained = true,
9044 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
9045 	},
9046 	[ALC269_FIXUP_CZC_B20] = {
9047 		.type = HDA_FIXUP_PINS,
9048 		.v.pins = (const struct hda_pintbl[]) {
9049 			{ 0x12, 0x411111f0 },
9050 			{ 0x14, 0x90170110 }, /* speaker */
9051 			{ 0x15, 0x032f1020 }, /* HP out */
9052 			{ 0x17, 0x411111f0 },
9053 			{ 0x18, 0x03ab1040 }, /* mic */
9054 			{ 0x19, 0xb7a7013f },
9055 			{ 0x1a, 0x0181305f },
9056 			{ 0x1b, 0x411111f0 },
9057 			{ 0x1d, 0x411111f0 },
9058 			{ 0x1e, 0x411111f0 },
9059 			{ }
9060 		},
9061 		.chain_id = ALC269_FIXUP_DMIC,
9062 	},
9063 	[ALC269_FIXUP_CZC_TMI] = {
9064 		.type = HDA_FIXUP_PINS,
9065 		.v.pins = (const struct hda_pintbl[]) {
9066 			{ 0x12, 0x4000c000 },
9067 			{ 0x14, 0x90170110 }, /* speaker */
9068 			{ 0x15, 0x0421401f }, /* HP out */
9069 			{ 0x17, 0x411111f0 },
9070 			{ 0x18, 0x04a19020 }, /* mic */
9071 			{ 0x19, 0x411111f0 },
9072 			{ 0x1a, 0x411111f0 },
9073 			{ 0x1b, 0x411111f0 },
9074 			{ 0x1d, 0x40448505 },
9075 			{ 0x1e, 0x411111f0 },
9076 			{ 0x20, 0x8000ffff },
9077 			{ }
9078 		},
9079 		.chain_id = ALC269_FIXUP_DMIC,
9080 	},
9081 	[ALC269_FIXUP_CZC_L101] = {
9082 		.type = HDA_FIXUP_PINS,
9083 		.v.pins = (const struct hda_pintbl[]) {
9084 			{ 0x12, 0x40000000 },
9085 			{ 0x14, 0x01014010 }, /* speaker */
9086 			{ 0x15, 0x411111f0 }, /* HP out */
9087 			{ 0x16, 0x411111f0 },
9088 			{ 0x18, 0x01a19020 }, /* mic */
9089 			{ 0x19, 0x02a19021 },
9090 			{ 0x1a, 0x0181302f },
9091 			{ 0x1b, 0x0221401f },
9092 			{ 0x1c, 0x411111f0 },
9093 			{ 0x1d, 0x4044c601 },
9094 			{ 0x1e, 0x411111f0 },
9095 			{ }
9096 		},
9097 		.chain_id = ALC269_FIXUP_DMIC,
9098 	},
9099 	[ALC269_FIXUP_LEMOTE_A1802] = {
9100 		.type = HDA_FIXUP_PINS,
9101 		.v.pins = (const struct hda_pintbl[]) {
9102 			{ 0x12, 0x40000000 },
9103 			{ 0x14, 0x90170110 }, /* speaker */
9104 			{ 0x17, 0x411111f0 },
9105 			{ 0x18, 0x03a19040 }, /* mic1 */
9106 			{ 0x19, 0x90a70130 }, /* mic2 */
9107 			{ 0x1a, 0x411111f0 },
9108 			{ 0x1b, 0x411111f0 },
9109 			{ 0x1d, 0x40489d2d },
9110 			{ 0x1e, 0x411111f0 },
9111 			{ 0x20, 0x0003ffff },
9112 			{ 0x21, 0x03214020 },
9113 			{ }
9114 		},
9115 		.chain_id = ALC269_FIXUP_DMIC,
9116 	},
9117 	[ALC269_FIXUP_LEMOTE_A190X] = {
9118 		.type = HDA_FIXUP_PINS,
9119 		.v.pins = (const struct hda_pintbl[]) {
9120 			{ 0x14, 0x99130110 }, /* speaker */
9121 			{ 0x15, 0x0121401f }, /* HP out */
9122 			{ 0x18, 0x01a19c20 }, /* rear  mic */
9123 			{ 0x19, 0x99a3092f }, /* front mic */
9124 			{ 0x1b, 0x0201401f }, /* front lineout */
9125 			{ }
9126 		},
9127 		.chain_id = ALC269_FIXUP_DMIC,
9128 	},
9129 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9130 		.type = HDA_FIXUP_PINS,
9131 		.v.pins = (const struct hda_pintbl[]) {
9132 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9133 			{ }
9134 		},
9135 		.chained = true,
9136 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9137 	},
9138 	[ALC256_FIXUP_INTEL_NUC10] = {
9139 		.type = HDA_FIXUP_PINS,
9140 		.v.pins = (const struct hda_pintbl[]) {
9141 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9142 			{ }
9143 		},
9144 		.chained = true,
9145 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9146 	},
9147 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9148 		.type = HDA_FIXUP_VERBS,
9149 		.v.verbs = (const struct hda_verb[]) {
9150 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9151 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9152 			{ }
9153 		},
9154 		.chained = true,
9155 		.chain_id = ALC289_FIXUP_ASUS_GA502
9156 	},
9157 	[ALC274_FIXUP_HP_MIC] = {
9158 		.type = HDA_FIXUP_VERBS,
9159 		.v.verbs = (const struct hda_verb[]) {
9160 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9161 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9162 			{ }
9163 		},
9164 	},
9165 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
9166 		.type = HDA_FIXUP_FUNC,
9167 		.v.func = alc274_fixup_hp_headset_mic,
9168 		.chained = true,
9169 		.chain_id = ALC274_FIXUP_HP_MIC
9170 	},
9171 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
9172 		.type = HDA_FIXUP_FUNC,
9173 		.v.func = alc274_fixup_hp_envy_gpio,
9174 	},
9175 	[ALC256_FIXUP_ASUS_HPE] = {
9176 		.type = HDA_FIXUP_VERBS,
9177 		.v.verbs = (const struct hda_verb[]) {
9178 			/* Set EAPD high */
9179 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9180 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9181 			{ }
9182 		},
9183 		.chained = true,
9184 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9185 	},
9186 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9187 		.type = HDA_FIXUP_FUNC,
9188 		.v.func = alc_fixup_headset_jack,
9189 		.chained = true,
9190 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9191 	},
9192 	[ALC287_FIXUP_HP_GPIO_LED] = {
9193 		.type = HDA_FIXUP_FUNC,
9194 		.v.func = alc287_fixup_hp_gpio_led,
9195 	},
9196 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
9197 		.type = HDA_FIXUP_FUNC,
9198 		.v.func = alc274_fixup_hp_headset_mic,
9199 	},
9200 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9201 		.type = HDA_FIXUP_FUNC,
9202 		.v.func = alc_fixup_no_int_mic,
9203 		.chained = true,
9204 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9205 	},
9206 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9207 		.type = HDA_FIXUP_PINS,
9208 		.v.pins = (const struct hda_pintbl[]) {
9209 			{ 0x1b, 0x411111f0 },
9210 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9211 			{ },
9212 		},
9213 		.chained = true,
9214 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9215 	},
9216 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9217 		.type = HDA_FIXUP_FUNC,
9218 		.v.func = alc269_fixup_limit_int_mic_boost,
9219 		.chained = true,
9220 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9221 	},
9222 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
9223 		.type = HDA_FIXUP_PINS,
9224 		.v.pins = (const struct hda_pintbl[]) {
9225 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9226 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
9227 			{ }
9228 		},
9229 		.chained = true,
9230 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9231 	},
9232 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9233 		.type = HDA_FIXUP_FUNC,
9234 		.v.func = alc285_fixup_ideapad_s740_coef,
9235 		.chained = true,
9236 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9237 	},
9238 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9239 		.type = HDA_FIXUP_FUNC,
9240 		.v.func = alc269_fixup_limit_int_mic_boost,
9241 		.chained = true,
9242 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9243 	},
9244 	[ALC295_FIXUP_ASUS_DACS] = {
9245 		.type = HDA_FIXUP_FUNC,
9246 		.v.func = alc295_fixup_asus_dacs,
9247 	},
9248 	[ALC295_FIXUP_HP_OMEN] = {
9249 		.type = HDA_FIXUP_PINS,
9250 		.v.pins = (const struct hda_pintbl[]) {
9251 			{ 0x12, 0xb7a60130 },
9252 			{ 0x13, 0x40000000 },
9253 			{ 0x14, 0x411111f0 },
9254 			{ 0x16, 0x411111f0 },
9255 			{ 0x17, 0x90170110 },
9256 			{ 0x18, 0x411111f0 },
9257 			{ 0x19, 0x02a11030 },
9258 			{ 0x1a, 0x411111f0 },
9259 			{ 0x1b, 0x04a19030 },
9260 			{ 0x1d, 0x40600001 },
9261 			{ 0x1e, 0x411111f0 },
9262 			{ 0x21, 0x03211020 },
9263 			{}
9264 		},
9265 		.chained = true,
9266 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9267 	},
9268 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
9269 		.type = HDA_FIXUP_FUNC,
9270 		.v.func = alc285_fixup_hp_spectre_x360,
9271 	},
9272 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9273 		.type = HDA_FIXUP_FUNC,
9274 		.v.func = alc285_fixup_hp_spectre_x360_eb1
9275 	},
9276 	[ALC285_FIXUP_HP_ENVY_X360] = {
9277 		.type = HDA_FIXUP_FUNC,
9278 		.v.func = alc285_fixup_hp_envy_x360,
9279 		.chained = true,
9280 		.chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9281 	},
9282 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9283 		.type = HDA_FIXUP_FUNC,
9284 		.v.func = alc285_fixup_ideapad_s740_coef,
9285 		.chained = true,
9286 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9287 	},
9288 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9289 		.type = HDA_FIXUP_FUNC,
9290 		.v.func = alc_fixup_no_shutup,
9291 		.chained = true,
9292 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
9293 	},
9294 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9295 		.type = HDA_FIXUP_PINS,
9296 		.v.pins = (const struct hda_pintbl[]) {
9297 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9298 			{ }
9299 		},
9300 		.chained = true,
9301 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9302 	},
9303 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9304 		.type = HDA_FIXUP_FUNC,
9305 		.v.func = alc269_fixup_limit_int_mic_boost,
9306 		.chained = true,
9307 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9308 	},
9309 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9310 		.type = HDA_FIXUP_FUNC,
9311 		.v.func = alc285_fixup_ideapad_s740_coef,
9312 		.chained = true,
9313 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9314 	},
9315 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9316 		.type = HDA_FIXUP_FUNC,
9317 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9318 		.chained = true,
9319 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9320 	},
9321 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9322 		.type = HDA_FIXUP_VERBS,
9323 		//.v.verbs = legion_15imhg05_coefs,
9324 		.v.verbs = (const struct hda_verb[]) {
9325 			 // set left speaker Legion 7i.
9326 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9327 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9328 
9329 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9330 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9331 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9332 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9333 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9334 
9335 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9336 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9337 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9338 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9339 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9340 
9341 			 // set right speaker Legion 7i.
9342 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9343 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9344 
9345 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9346 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9347 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9348 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9349 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9350 
9351 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9352 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9353 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9354 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9355 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9356 			 {}
9357 		},
9358 		.chained = true,
9359 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9360 	},
9361 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9362 		.type = HDA_FIXUP_FUNC,
9363 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9364 		.chained = true,
9365 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9366 	},
9367 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9368 		.type = HDA_FIXUP_VERBS,
9369 		.v.verbs = (const struct hda_verb[]) {
9370 			 // set left speaker Yoga 7i.
9371 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9372 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9373 
9374 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9375 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9376 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9377 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9378 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9379 
9380 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9381 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9382 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9383 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9384 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9385 
9386 			 // set right speaker Yoga 7i.
9387 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9388 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9389 
9390 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9391 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9392 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9393 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9394 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9395 
9396 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9397 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9398 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9399 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9400 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9401 			 {}
9402 		},
9403 		.chained = true,
9404 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9405 	},
9406 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
9407 		.type = HDA_FIXUP_FUNC,
9408 		.v.func = alc298_fixup_lenovo_c940_duet7,
9409 	},
9410 	[ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
9411 		.type = HDA_FIXUP_FUNC,
9412 		.v.func = alc287_fixup_lenovo_14irp8_duetitl,
9413 	},
9414 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9415 		.type = HDA_FIXUP_VERBS,
9416 		.v.verbs = (const struct hda_verb[]) {
9417 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9418 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9419 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9420 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9421 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9422 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9423 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9424 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9425 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9426 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9427 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9428 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9429 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9430 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9431 			{}
9432 		},
9433 		.chained = true,
9434 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9435 	},
9436 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9437 		.type = HDA_FIXUP_FUNC,
9438 		.v.func = alc256_fixup_set_coef_defaults,
9439 	},
9440 	[ALC245_FIXUP_HP_GPIO_LED] = {
9441 		.type = HDA_FIXUP_FUNC,
9442 		.v.func = alc245_fixup_hp_gpio_led,
9443 	},
9444 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9445 		.type = HDA_FIXUP_PINS,
9446 		.v.pins = (const struct hda_pintbl[]) {
9447 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9448 			{ }
9449 		},
9450 		.chained = true,
9451 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9452 	},
9453 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
9454 		.type = HDA_FIXUP_FUNC,
9455 		.v.func = alc233_fixup_no_audio_jack,
9456 	},
9457 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9458 		.type = HDA_FIXUP_FUNC,
9459 		.v.func = alc256_fixup_mic_no_presence_and_resume,
9460 		.chained = true,
9461 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9462 	},
9463 	[ALC287_FIXUP_LEGION_16ACHG6] = {
9464 		.type = HDA_FIXUP_FUNC,
9465 		.v.func = alc287_fixup_legion_16achg6_speakers,
9466 	},
9467 	[ALC287_FIXUP_CS35L41_I2C_2] = {
9468 		.type = HDA_FIXUP_FUNC,
9469 		.v.func = cs35l41_fixup_i2c_two,
9470 	},
9471 	[ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9472 		.type = HDA_FIXUP_FUNC,
9473 		.v.func = cs35l41_fixup_i2c_two,
9474 		.chained = true,
9475 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9476 	},
9477 	[ALC245_FIXUP_CS35L41_SPI_2] = {
9478 		.type = HDA_FIXUP_FUNC,
9479 		.v.func = cs35l41_fixup_spi_two,
9480 	},
9481 	[ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9482 		.type = HDA_FIXUP_FUNC,
9483 		.v.func = cs35l41_fixup_spi_two,
9484 		.chained = true,
9485 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9486 	},
9487 	[ALC245_FIXUP_CS35L41_SPI_4] = {
9488 		.type = HDA_FIXUP_FUNC,
9489 		.v.func = cs35l41_fixup_spi_four,
9490 	},
9491 	[ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9492 		.type = HDA_FIXUP_FUNC,
9493 		.v.func = cs35l41_fixup_spi_four,
9494 		.chained = true,
9495 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9496 	},
9497 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9498 		.type = HDA_FIXUP_VERBS,
9499 		.v.verbs = (const struct hda_verb[]) {
9500 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9501 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9502 			 { }
9503 		},
9504 		.chained = true,
9505 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9506 	},
9507 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9508 		.type = HDA_FIXUP_FUNC,
9509 		.v.func = alc_fixup_dell4_mic_no_presence_quiet,
9510 		.chained = true,
9511 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9512 	},
9513 	[ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9514 		.type = HDA_FIXUP_PINS,
9515 		.v.pins = (const struct hda_pintbl[]) {
9516 			{ 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9517 			{ }
9518 		},
9519 		.chained = true,
9520 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9521 	},
9522 	[ALC287_FIXUP_LEGION_16ITHG6] = {
9523 		.type = HDA_FIXUP_FUNC,
9524 		.v.func = alc287_fixup_legion_16ithg6_speakers,
9525 	},
9526 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9527 		.type = HDA_FIXUP_VERBS,
9528 		.v.verbs = (const struct hda_verb[]) {
9529 			// enable left speaker
9530 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9531 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9532 
9533 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9534 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9535 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9536 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9537 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9538 
9539 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9540 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9541 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9542 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9543 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9544 
9545 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9546 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9547 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9548 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9549 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9550 
9551 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9552 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9553 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9554 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9555 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9556 
9557 			// enable right speaker
9558 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9559 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9560 
9561 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9562 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9563 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9564 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9565 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9566 
9567 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9568 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9569 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9570 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9571 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9572 
9573 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9574 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9575 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9576 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9577 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9578 
9579 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9580 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9581 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9582 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9583 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9584 
9585 			{ },
9586 		},
9587 	},
9588 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9589 		.type = HDA_FIXUP_FUNC,
9590 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9591 		.chained = true,
9592 		.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9593 	},
9594 	[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
9595 		.type = HDA_FIXUP_FUNC,
9596 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9597 		.chained = true,
9598 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2,
9599 	},
9600 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
9601 		.type = HDA_FIXUP_FUNC,
9602 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
9603 		.chained = true,
9604 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9605 	},
9606 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
9607 		.type = HDA_FIXUP_PINS,
9608 		.v.func = alc1220_fixup_gb_dual_codecs,
9609 		.chained = true,
9610 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9611 	},
9612 	[ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
9613 		.type = HDA_FIXUP_FUNC,
9614 		.v.func = cs35l41_fixup_i2c_two,
9615 		.chained = true,
9616 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9617 	},
9618 	[ALC287_FIXUP_TAS2781_I2C] = {
9619 		.type = HDA_FIXUP_FUNC,
9620 		.v.func = tas2781_fixup_i2c,
9621 		.chained = true,
9622 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9623 	},
9624 	[ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
9625 		.type = HDA_FIXUP_FUNC,
9626 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9627 	},
9628 	[ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
9629 		.type = HDA_FIXUP_FUNC,
9630 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9631 		.chained = true,
9632 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
9633 	},
9634 	[ALC287_FIXUP_THINKPAD_I2S_SPK] = {
9635 		.type = HDA_FIXUP_FUNC,
9636 		.v.func = alc287_fixup_bind_dacs,
9637 		.chained = true,
9638 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9639 	},
9640 	[ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
9641 		.type = HDA_FIXUP_FUNC,
9642 		.v.func = alc287_fixup_bind_dacs,
9643 		.chained = true,
9644 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
9645 	},
9646 	[ALC2XX_FIXUP_HEADSET_MIC] = {
9647 		.type = HDA_FIXUP_FUNC,
9648 		.v.func = alc_fixup_headset_mic,
9649 	},
9650 	[ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
9651 		.type = HDA_FIXUP_FUNC,
9652 		.v.func = cs35l41_fixup_spi_two,
9653 		.chained = true,
9654 		.chain_id = ALC289_FIXUP_DUAL_SPK
9655 	},
9656 	[ALC294_FIXUP_CS35L41_I2C_2] = {
9657 		.type = HDA_FIXUP_FUNC,
9658 		.v.func = cs35l41_fixup_i2c_two,
9659 	},
9660 };
9661 
9662 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
9663 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
9664 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9665 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
9666 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
9667 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9668 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9669 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
9670 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9671 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9672 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
9673 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9674 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
9675 	SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9676 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
9677 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
9678 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
9679 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
9680 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9681 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9682 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9683 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9684 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
9685 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
9686 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
9687 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
9688 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9689 	SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9690 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9691 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9692 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9693 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
9694 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9695 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9696 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9697 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
9698 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
9699 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9700 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9701 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9702 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
9703 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9704 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
9705 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
9706 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
9707 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
9708 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
9709 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9710 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
9711 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
9712 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9713 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9714 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9715 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9716 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9717 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
9718 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
9719 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
9720 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9721 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9722 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
9723 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9724 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
9725 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9726 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9727 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9728 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9729 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9730 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9731 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9732 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9733 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9734 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
9735 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
9736 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
9737 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
9738 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9739 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
9740 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
9741 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9742 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9743 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9744 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9745 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9746 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
9747 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
9748 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9749 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9750 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9751 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9752 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9753 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9754 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9755 	SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
9756 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
9757 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
9758 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
9759 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9760 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9761 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9762 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
9763 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9764 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9765 	SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9766 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9767 	SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9768 	SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9769 	SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9770 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9771 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9772 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9773 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9774 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9775 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9776 	SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9777 	SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9778 	SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9779 	SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9780 	SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9781 	SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9782 	SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9783 	SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9784 	SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9785 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9786 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9787 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9788 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
9789 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
9790 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9791 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9792 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9793 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9794 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9795 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9796 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9797 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9798 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9799 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9800 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9801 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9802 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9803 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9804 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9805 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9806 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9807 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9808 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
9809 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
9810 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9811 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9812 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9813 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9814 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9815 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9816 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9817 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9818 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9819 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9820 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9821 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9822 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9823 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9824 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9825 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9826 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9827 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9828 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9829 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9830 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9831 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9832 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9833 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9834 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9835 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9836 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9837 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9838 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9839 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9840 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9841 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9842 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9843 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9844 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
9845 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9846 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9847 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9848 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9849 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
9850 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9851 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
9852 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9853 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9854 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9855 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9856 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9857 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9858 	SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9859 	SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9860 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
9861 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9862 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
9863 	SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9864 	SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
9865 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9866 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9867 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9868 	SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9869 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
9870 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9871 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9872 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
9873 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9874 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9875 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
9876 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
9877 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
9878 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9879 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9880 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9881 	SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
9882 	SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9883 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
9884 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9885 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
9886 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
9887 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
9888 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
9889 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9890 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9891 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9892 	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9893 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
9894 	SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9895 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9896 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9897 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9898 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9899 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
9900 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
9901 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9902 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9903 	SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9904 	SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9905 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9906 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9907 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9908 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9909 	SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9910 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9911 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9912 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9913 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9914 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9915 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9916 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9917 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9918 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9919 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9920 	SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9921 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
9922 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
9923 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
9924 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9925 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
9926 	SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
9927 	SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
9928 	SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9929 	SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
9930 	SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9931 	SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9932 	SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9933 	SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9934 	SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9935 	SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9936 	SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9937 	SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
9938 	SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
9939 	SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9940 	SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9941 	SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9942 	SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
9943 	SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9944 	SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
9945 	SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
9946 	SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
9947 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
9948 	SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
9949 	SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
9950 	SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9951 	SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9952 	SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9953 	SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9954 	SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9955 	SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
9956 	SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9957 	SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
9958 	SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9959 	SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
9960 	SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
9961 	SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
9962 	SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
9963 	SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
9964 	SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9965 	SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9966 	SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9967 	SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9968 	SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9969 	SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
9970 	SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9971 	SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9972 	SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9973 	SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9974 	SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9975 	SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9976 	SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9977 	SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9978 	SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9979 	SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9980 	SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9981 	SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9982 	SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9983 	SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9984 	SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9985 	SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
9986 	SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
9987 	SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
9988 	SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
9989 	SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
9990 	SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
9991 	SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
9992 	SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9993 	SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9994 	SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9995 	SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9996 	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
9997 	SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9998 	SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9999 	SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10000 	SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10001 	SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10002 	SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10003 	SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10004 	SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10005 	SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10006 	SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10007 	SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10008 	SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10009 	SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10010 	SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10011 	SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10012 	SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10013 	SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10014 	SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10015 	SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10016 	SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10017 	SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10018 	SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10019 	SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10020 	SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10021 	SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10022 	SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10023 	SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10024 	SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10025 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10026 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10027 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10028 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10029 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10030 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10031 	SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10032 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10033 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10034 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10035 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10036 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10037 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10038 	SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10039 	SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10040 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10041 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10042 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10043 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10044 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10045 	SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650P", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10046 	SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10047 	SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10048 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10049 	SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10050 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10051 	SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA", ALC287_FIXUP_CS35L41_I2C_2),
10052 	SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10053 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10054 	SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10055 	SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10056 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10057 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10058 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10059 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10060 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10061 	SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally RC71L_RC71L", ALC294_FIXUP_ASUS_ALLY),
10062 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10063 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10064 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10065 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10066 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10067 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10068 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10069 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10070 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10071 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10072 	SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
10073 	SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10074 	SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10075 	SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10076 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10077 	SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
10078 	SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10079 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10080 	SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10081 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10082 	SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10083 	SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10084 	SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10085 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10086 	SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10087 	SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10088 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10089 	SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS ROG Strix G17 2023 (G713PV)", ALC287_FIXUP_CS35L41_I2C_2),
10090 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10091 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10092 	SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10093 	SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10094 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10095 	SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10096 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10097 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10098 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10099 	SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10100 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10101 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10102 	SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10103 	SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10104 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10105 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10106 	SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2),
10107 	SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10108 	SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10109 	SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10110 	SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10111 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10112 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10113 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10114 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10115 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10116 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10117 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10118 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10119 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10120 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10121 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10122 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10123 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10124 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10125 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10126 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10127 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10128 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10129 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10130 	SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10131 	SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10132 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10133 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10134 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10135 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10136 	SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10137 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10138 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10139 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10140 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10141 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10142 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10143 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10144 	SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10145 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10146 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10147 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10148 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10149 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10150 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10151 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10152 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10153 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10154 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10155 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10156 	SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10157 	SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10158 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10159 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10160 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10161 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10162 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10163 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10164 	SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10165 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10166 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10167 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10168 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10169 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10170 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10171 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10172 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10173 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10174 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10175 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10176 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10177 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10178 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10179 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10180 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10181 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10182 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10183 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10184 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10185 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10186 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10187 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10188 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10189 	SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10190 	SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10191 	SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10192 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10193 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10194 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10195 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10196 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10197 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10198 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10199 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10200 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10201 	SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10202 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10203 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10204 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10205 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10206 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10207 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10208 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10209 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10210 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10211 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10212 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10213 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10214 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10215 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10216 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10217 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
10218 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10219 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10220 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10221 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10222 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10223 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10224 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10225 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10226 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10227 	SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10228 	SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10229 	SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10230 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10231 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10232 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10233 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10234 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10235 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10236 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
10237 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10238 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
10239 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
10240 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
10241 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
10242 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
10243 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
10244 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
10245 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
10246 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
10247 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
10248 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
10249 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
10250 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
10251 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
10252 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
10253 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10254 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10255 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10256 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
10257 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
10258 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10259 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10260 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10261 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
10262 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
10263 	SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
10264 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
10265 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10266 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10267 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
10268 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10269 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10270 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10271 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10272 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10273 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10274 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10275 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10276 	SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10277 	SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10278 	SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10279 	SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10280 	SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10281 	SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10282 	SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10283 	SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10284 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10285 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10286 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10287 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10288 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10289 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10290 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10291 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10292 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10293 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10294 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10295 	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
10296 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10297 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
10298 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10299 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
10300 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10301 	SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10302 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10303 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
10304 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10305 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10306 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
10307 	SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
10308 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10309 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10310 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10311 	SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
10312 	SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10313 	SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10314 	SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10315 	SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
10316 	SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
10317 	SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
10318 	SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10319 	SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10320 	SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10321 	SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10322 	SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
10323 	SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
10324 	SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
10325 	SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
10326 	SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
10327 	SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
10328 	SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
10329 	SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10330 	SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10331 	SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10332 	SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10333 	SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10334 	SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10335 	SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10336 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10337 	SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
10338 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
10339 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10340 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
10341 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10342 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
10343 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
10344 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10345 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
10346 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
10347 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
10348 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
10349 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
10350 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
10351 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
10352 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
10353 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10354 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10355 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10356 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10357 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10358 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10359 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10360 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
10361 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10362 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
10363 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
10364 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
10365 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10366 	SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
10367 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
10368 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
10369 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
10370 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
10371 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
10372 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
10373 	SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10374 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
10375 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
10376 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
10377 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
10378 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10379 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10380 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10381 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10382 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10383 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
10384 	SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10385 	SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10386 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10387 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
10388 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
10389 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
10390 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10391 	SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10392 	SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
10393 	SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
10394 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
10395 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
10396 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
10397 	SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
10398 	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10399 	SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10400 	SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10401 
10402 #if 0
10403 	/* Below is a quirk table taken from the old code.
10404 	 * Basically the device should work as is without the fixup table.
10405 	 * If BIOS doesn't give a proper info, enable the corresponding
10406 	 * fixup entry.
10407 	 */
10408 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
10409 		      ALC269_FIXUP_AMIC),
10410 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
10411 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
10412 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
10413 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
10414 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
10415 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
10416 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
10417 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
10418 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
10419 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
10420 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
10421 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
10422 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
10423 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
10424 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
10425 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
10426 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
10427 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
10428 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
10429 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
10430 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
10431 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
10432 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
10433 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
10434 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
10435 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
10436 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
10437 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
10438 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
10439 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
10440 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
10441 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
10442 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
10443 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
10444 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
10445 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
10446 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
10447 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
10448 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
10449 #endif
10450 	{}
10451 };
10452 
10453 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
10454 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
10455 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
10456 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
10457 	SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
10458 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
10459 	{}
10460 };
10461 
10462 static const struct hda_model_fixup alc269_fixup_models[] = {
10463 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
10464 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
10465 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
10466 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
10467 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
10468 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
10469 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
10470 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
10471 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
10472 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
10473 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10474 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
10475 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10476 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
10477 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
10478 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
10479 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
10480 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
10481 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
10482 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
10483 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
10484 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
10485 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
10486 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10487 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
10488 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
10489 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
10490 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
10491 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
10492 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
10493 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
10494 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
10495 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
10496 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
10497 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
10498 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
10499 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
10500 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
10501 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
10502 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
10503 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
10504 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
10505 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
10506 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
10507 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
10508 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
10509 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
10510 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
10511 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
10512 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
10513 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
10514 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
10515 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
10516 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
10517 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
10518 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
10519 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
10520 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
10521 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
10522 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
10523 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
10524 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
10525 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
10526 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
10527 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
10528 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
10529 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
10530 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
10531 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
10532 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10533 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
10534 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
10535 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
10536 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
10537 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
10538 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
10539 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
10540 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
10541 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
10542 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
10543 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
10544 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
10545 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
10546 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
10547 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
10548 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
10549 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
10550 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
10551 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
10552 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
10553 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
10554 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
10555 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
10556 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
10557 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
10558 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
10559 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
10560 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
10561 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
10562 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
10563 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
10564 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
10565 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
10566 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
10567 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
10568 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
10569 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
10570 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
10571 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
10572 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
10573 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
10574 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
10575 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
10576 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
10577 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
10578 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
10579 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
10580 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
10581 	{.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
10582 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
10583 	{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
10584 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
10585 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
10586 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
10587 	{.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
10588 	{}
10589 };
10590 #define ALC225_STANDARD_PINS \
10591 	{0x21, 0x04211020}
10592 
10593 #define ALC256_STANDARD_PINS \
10594 	{0x12, 0x90a60140}, \
10595 	{0x14, 0x90170110}, \
10596 	{0x21, 0x02211020}
10597 
10598 #define ALC282_STANDARD_PINS \
10599 	{0x14, 0x90170110}
10600 
10601 #define ALC290_STANDARD_PINS \
10602 	{0x12, 0x99a30130}
10603 
10604 #define ALC292_STANDARD_PINS \
10605 	{0x14, 0x90170110}, \
10606 	{0x15, 0x0221401f}
10607 
10608 #define ALC295_STANDARD_PINS \
10609 	{0x12, 0xb7a60130}, \
10610 	{0x14, 0x90170110}, \
10611 	{0x21, 0x04211020}
10612 
10613 #define ALC298_STANDARD_PINS \
10614 	{0x12, 0x90a60130}, \
10615 	{0x21, 0x03211020}
10616 
10617 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
10618 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
10619 		{0x14, 0x01014020},
10620 		{0x17, 0x90170110},
10621 		{0x18, 0x02a11030},
10622 		{0x19, 0x0181303F},
10623 		{0x21, 0x0221102f}),
10624 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
10625 		{0x12, 0x90a601c0},
10626 		{0x14, 0x90171120},
10627 		{0x21, 0x02211030}),
10628 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10629 		{0x14, 0x90170110},
10630 		{0x1b, 0x90a70130},
10631 		{0x21, 0x03211020}),
10632 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10633 		{0x1a, 0x90a70130},
10634 		{0x1b, 0x90170110},
10635 		{0x21, 0x03211020}),
10636 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10637 		ALC225_STANDARD_PINS,
10638 		{0x12, 0xb7a60130},
10639 		{0x14, 0x901701a0}),
10640 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10641 		ALC225_STANDARD_PINS,
10642 		{0x12, 0xb7a60130},
10643 		{0x14, 0x901701b0}),
10644 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10645 		ALC225_STANDARD_PINS,
10646 		{0x12, 0xb7a60150},
10647 		{0x14, 0x901701a0}),
10648 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10649 		ALC225_STANDARD_PINS,
10650 		{0x12, 0xb7a60150},
10651 		{0x14, 0x901701b0}),
10652 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10653 		ALC225_STANDARD_PINS,
10654 		{0x12, 0xb7a60130},
10655 		{0x1b, 0x90170110}),
10656 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10657 		{0x1b, 0x01111010},
10658 		{0x1e, 0x01451130},
10659 		{0x21, 0x02211020}),
10660 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
10661 		{0x12, 0x90a60140},
10662 		{0x14, 0x90170110},
10663 		{0x19, 0x02a11030},
10664 		{0x21, 0x02211020}),
10665 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10666 		{0x14, 0x90170110},
10667 		{0x19, 0x02a11030},
10668 		{0x1a, 0x02a11040},
10669 		{0x1b, 0x01014020},
10670 		{0x21, 0x0221101f}),
10671 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10672 		{0x14, 0x90170110},
10673 		{0x19, 0x02a11030},
10674 		{0x1a, 0x02a11040},
10675 		{0x1b, 0x01011020},
10676 		{0x21, 0x0221101f}),
10677 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10678 		{0x14, 0x90170110},
10679 		{0x19, 0x02a11020},
10680 		{0x1a, 0x02a11030},
10681 		{0x21, 0x0221101f}),
10682 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
10683 		{0x21, 0x02211010}),
10684 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10685 		{0x14, 0x90170110},
10686 		{0x19, 0x02a11020},
10687 		{0x21, 0x02211030}),
10688 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
10689 		{0x14, 0x90170110},
10690 		{0x21, 0x02211020}),
10691 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10692 		{0x14, 0x90170130},
10693 		{0x21, 0x02211040}),
10694 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10695 		{0x12, 0x90a60140},
10696 		{0x14, 0x90170110},
10697 		{0x21, 0x02211020}),
10698 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10699 		{0x12, 0x90a60160},
10700 		{0x14, 0x90170120},
10701 		{0x21, 0x02211030}),
10702 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10703 		{0x14, 0x90170110},
10704 		{0x1b, 0x02011020},
10705 		{0x21, 0x0221101f}),
10706 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10707 		{0x14, 0x90170110},
10708 		{0x1b, 0x01011020},
10709 		{0x21, 0x0221101f}),
10710 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10711 		{0x14, 0x90170130},
10712 		{0x1b, 0x01014020},
10713 		{0x21, 0x0221103f}),
10714 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10715 		{0x14, 0x90170130},
10716 		{0x1b, 0x01011020},
10717 		{0x21, 0x0221103f}),
10718 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10719 		{0x14, 0x90170130},
10720 		{0x1b, 0x02011020},
10721 		{0x21, 0x0221103f}),
10722 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10723 		{0x14, 0x90170150},
10724 		{0x1b, 0x02011020},
10725 		{0x21, 0x0221105f}),
10726 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10727 		{0x14, 0x90170110},
10728 		{0x1b, 0x01014020},
10729 		{0x21, 0x0221101f}),
10730 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10731 		{0x12, 0x90a60160},
10732 		{0x14, 0x90170120},
10733 		{0x17, 0x90170140},
10734 		{0x21, 0x0321102f}),
10735 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10736 		{0x12, 0x90a60160},
10737 		{0x14, 0x90170130},
10738 		{0x21, 0x02211040}),
10739 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10740 		{0x12, 0x90a60160},
10741 		{0x14, 0x90170140},
10742 		{0x21, 0x02211050}),
10743 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10744 		{0x12, 0x90a60170},
10745 		{0x14, 0x90170120},
10746 		{0x21, 0x02211030}),
10747 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10748 		{0x12, 0x90a60170},
10749 		{0x14, 0x90170130},
10750 		{0x21, 0x02211040}),
10751 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10752 		{0x12, 0x90a60170},
10753 		{0x14, 0x90171130},
10754 		{0x21, 0x02211040}),
10755 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10756 		{0x12, 0x90a60170},
10757 		{0x14, 0x90170140},
10758 		{0x21, 0x02211050}),
10759 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10760 		{0x12, 0x90a60180},
10761 		{0x14, 0x90170130},
10762 		{0x21, 0x02211040}),
10763 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10764 		{0x12, 0x90a60180},
10765 		{0x14, 0x90170120},
10766 		{0x21, 0x02211030}),
10767 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10768 		{0x1b, 0x01011020},
10769 		{0x21, 0x02211010}),
10770 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10771 		{0x14, 0x90170110},
10772 		{0x1b, 0x90a70130},
10773 		{0x21, 0x04211020}),
10774 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10775 		{0x14, 0x90170110},
10776 		{0x1b, 0x90a70130},
10777 		{0x21, 0x03211020}),
10778 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10779 		{0x12, 0x90a60130},
10780 		{0x14, 0x90170110},
10781 		{0x21, 0x03211020}),
10782 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10783 		{0x12, 0x90a60130},
10784 		{0x14, 0x90170110},
10785 		{0x21, 0x04211020}),
10786 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10787 		{0x1a, 0x90a70130},
10788 		{0x1b, 0x90170110},
10789 		{0x21, 0x03211020}),
10790        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10791 		{0x14, 0x90170110},
10792 		{0x19, 0x02a11020},
10793 		{0x21, 0x0221101f}),
10794        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
10795 		{0x17, 0x90170110},
10796 		{0x19, 0x03a11030},
10797 		{0x21, 0x03211020}),
10798 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10799 		{0x12, 0x90a60130},
10800 		{0x14, 0x90170110},
10801 		{0x15, 0x0421101f},
10802 		{0x1a, 0x04a11020}),
10803 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10804 		{0x12, 0x90a60140},
10805 		{0x14, 0x90170110},
10806 		{0x15, 0x0421101f},
10807 		{0x18, 0x02811030},
10808 		{0x1a, 0x04a1103f},
10809 		{0x1b, 0x02011020}),
10810 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10811 		ALC282_STANDARD_PINS,
10812 		{0x12, 0x99a30130},
10813 		{0x19, 0x03a11020},
10814 		{0x21, 0x0321101f}),
10815 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10816 		ALC282_STANDARD_PINS,
10817 		{0x12, 0x99a30130},
10818 		{0x19, 0x03a11020},
10819 		{0x21, 0x03211040}),
10820 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10821 		ALC282_STANDARD_PINS,
10822 		{0x12, 0x99a30130},
10823 		{0x19, 0x03a11030},
10824 		{0x21, 0x03211020}),
10825 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10826 		ALC282_STANDARD_PINS,
10827 		{0x12, 0x99a30130},
10828 		{0x19, 0x04a11020},
10829 		{0x21, 0x0421101f}),
10830 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
10831 		ALC282_STANDARD_PINS,
10832 		{0x12, 0x90a60140},
10833 		{0x19, 0x04a11030},
10834 		{0x21, 0x04211020}),
10835 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10836 		ALC282_STANDARD_PINS,
10837 		{0x12, 0x90a609c0},
10838 		{0x18, 0x03a11830},
10839 		{0x19, 0x04a19831},
10840 		{0x1a, 0x0481303f},
10841 		{0x1b, 0x04211020},
10842 		{0x21, 0x0321101f}),
10843 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10844 		ALC282_STANDARD_PINS,
10845 		{0x12, 0x90a60940},
10846 		{0x18, 0x03a11830},
10847 		{0x19, 0x04a19831},
10848 		{0x1a, 0x0481303f},
10849 		{0x1b, 0x04211020},
10850 		{0x21, 0x0321101f}),
10851 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10852 		ALC282_STANDARD_PINS,
10853 		{0x12, 0x90a60130},
10854 		{0x21, 0x0321101f}),
10855 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10856 		{0x12, 0x90a60160},
10857 		{0x14, 0x90170120},
10858 		{0x21, 0x02211030}),
10859 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10860 		ALC282_STANDARD_PINS,
10861 		{0x12, 0x90a60130},
10862 		{0x19, 0x03a11020},
10863 		{0x21, 0x0321101f}),
10864 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10865 		{0x12, 0x90a60130},
10866 		{0x14, 0x90170110},
10867 		{0x19, 0x04a11040},
10868 		{0x21, 0x04211020}),
10869 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10870 		{0x14, 0x90170110},
10871 		{0x19, 0x04a11040},
10872 		{0x1d, 0x40600001},
10873 		{0x21, 0x04211020}),
10874 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10875 		{0x14, 0x90170110},
10876 		{0x19, 0x04a11040},
10877 		{0x21, 0x04211020}),
10878 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10879 		{0x14, 0x90170110},
10880 		{0x17, 0x90170111},
10881 		{0x19, 0x03a11030},
10882 		{0x21, 0x03211020}),
10883 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10884 		{0x17, 0x90170110},
10885 		{0x19, 0x03a11030},
10886 		{0x21, 0x03211020}),
10887 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10888 		{0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
10889 		{0x19, 0x04a11040},
10890 		{0x21, 0x04211020}),
10891 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
10892 		{0x12, 0x90a60130},
10893 		{0x17, 0x90170110},
10894 		{0x21, 0x02211020}),
10895 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
10896 		{0x12, 0x90a60120},
10897 		{0x14, 0x90170110},
10898 		{0x21, 0x0321101f}),
10899 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10900 		ALC290_STANDARD_PINS,
10901 		{0x15, 0x04211040},
10902 		{0x18, 0x90170112},
10903 		{0x1a, 0x04a11020}),
10904 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10905 		ALC290_STANDARD_PINS,
10906 		{0x15, 0x04211040},
10907 		{0x18, 0x90170110},
10908 		{0x1a, 0x04a11020}),
10909 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10910 		ALC290_STANDARD_PINS,
10911 		{0x15, 0x0421101f},
10912 		{0x1a, 0x04a11020}),
10913 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10914 		ALC290_STANDARD_PINS,
10915 		{0x15, 0x04211020},
10916 		{0x1a, 0x04a11040}),
10917 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10918 		ALC290_STANDARD_PINS,
10919 		{0x14, 0x90170110},
10920 		{0x15, 0x04211020},
10921 		{0x1a, 0x04a11040}),
10922 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10923 		ALC290_STANDARD_PINS,
10924 		{0x14, 0x90170110},
10925 		{0x15, 0x04211020},
10926 		{0x1a, 0x04a11020}),
10927 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10928 		ALC290_STANDARD_PINS,
10929 		{0x14, 0x90170110},
10930 		{0x15, 0x0421101f},
10931 		{0x1a, 0x04a11020}),
10932 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10933 		ALC292_STANDARD_PINS,
10934 		{0x12, 0x90a60140},
10935 		{0x16, 0x01014020},
10936 		{0x19, 0x01a19030}),
10937 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10938 		ALC292_STANDARD_PINS,
10939 		{0x12, 0x90a60140},
10940 		{0x16, 0x01014020},
10941 		{0x18, 0x02a19031},
10942 		{0x19, 0x01a1903e}),
10943 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
10944 		ALC292_STANDARD_PINS,
10945 		{0x12, 0x90a60140}),
10946 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10947 		ALC292_STANDARD_PINS,
10948 		{0x13, 0x90a60140},
10949 		{0x16, 0x21014020},
10950 		{0x19, 0x21a19030}),
10951 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10952 		ALC292_STANDARD_PINS,
10953 		{0x13, 0x90a60140}),
10954 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
10955 		{0x17, 0x90170110},
10956 		{0x21, 0x04211020}),
10957 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
10958 		{0x14, 0x90170110},
10959 		{0x1b, 0x90a70130},
10960 		{0x21, 0x04211020}),
10961 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10962 		{0x12, 0x90a60130},
10963 		{0x17, 0x90170110},
10964 		{0x21, 0x03211020}),
10965 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10966 		{0x12, 0x90a60130},
10967 		{0x17, 0x90170110},
10968 		{0x21, 0x04211020}),
10969 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10970 		{0x12, 0x90a60130},
10971 		{0x17, 0x90170110},
10972 		{0x21, 0x03211020}),
10973 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10974 		{0x12, 0x90a60120},
10975 		{0x17, 0x90170110},
10976 		{0x21, 0x04211030}),
10977 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10978 		{0x12, 0x90a60130},
10979 		{0x17, 0x90170110},
10980 		{0x21, 0x03211020}),
10981 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10982 		{0x12, 0x90a60130},
10983 		{0x17, 0x90170110},
10984 		{0x21, 0x03211020}),
10985 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10986 		ALC298_STANDARD_PINS,
10987 		{0x17, 0x90170110}),
10988 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10989 		ALC298_STANDARD_PINS,
10990 		{0x17, 0x90170140}),
10991 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10992 		ALC298_STANDARD_PINS,
10993 		{0x17, 0x90170150}),
10994 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
10995 		{0x12, 0xb7a60140},
10996 		{0x13, 0xb7a60150},
10997 		{0x17, 0x90170110},
10998 		{0x1a, 0x03011020},
10999 		{0x21, 0x03211030}),
11000 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11001 		{0x12, 0xb7a60140},
11002 		{0x17, 0x90170110},
11003 		{0x1a, 0x03a11030},
11004 		{0x21, 0x03211020}),
11005 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11006 		ALC225_STANDARD_PINS,
11007 		{0x12, 0xb7a60130},
11008 		{0x17, 0x90170110}),
11009 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11010 		{0x14, 0x01014010},
11011 		{0x17, 0x90170120},
11012 		{0x18, 0x02a11030},
11013 		{0x19, 0x02a1103f},
11014 		{0x21, 0x0221101f}),
11015 	{}
11016 };
11017 
11018 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11019  * more machines, don't need to match all valid pins, just need to match
11020  * all the pins defined in the tbl. Just because of this reason, it is possible
11021  * that a single machine matches multiple tbls, so there is one limitation:
11022  *   at most one tbl is allowed to define for the same vendor and same codec
11023  */
11024 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11025 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11026 		{0x19, 0x40000000}),
11027 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11028 		{0x19, 0x40000000},
11029 		{0x1b, 0x40000000}),
11030 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11031 		{0x19, 0x40000000},
11032 		{0x1b, 0x40000000}),
11033 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11034 		{0x19, 0x40000000},
11035 		{0x1a, 0x40000000}),
11036 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11037 		{0x19, 0x40000000},
11038 		{0x1a, 0x40000000}),
11039 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
11040 		{0x19, 0x40000000},
11041 		{0x1a, 0x40000000}),
11042 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11043 		{0x19, 0x40000000}),
11044 	{}
11045 };
11046 
alc269_fill_coef(struct hda_codec * codec)11047 static void alc269_fill_coef(struct hda_codec *codec)
11048 {
11049 	struct alc_spec *spec = codec->spec;
11050 	int val;
11051 
11052 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11053 		return;
11054 
11055 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11056 		alc_write_coef_idx(codec, 0xf, 0x960b);
11057 		alc_write_coef_idx(codec, 0xe, 0x8817);
11058 	}
11059 
11060 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11061 		alc_write_coef_idx(codec, 0xf, 0x960b);
11062 		alc_write_coef_idx(codec, 0xe, 0x8814);
11063 	}
11064 
11065 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11066 		/* Power up output pin */
11067 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11068 	}
11069 
11070 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11071 		val = alc_read_coef_idx(codec, 0xd);
11072 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11073 			/* Capless ramp up clock control */
11074 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
11075 		}
11076 		val = alc_read_coef_idx(codec, 0x17);
11077 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11078 			/* Class D power on reset */
11079 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
11080 		}
11081 	}
11082 
11083 	/* HP */
11084 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11085 }
11086 
11087 /*
11088  */
patch_alc269(struct hda_codec * codec)11089 static int patch_alc269(struct hda_codec *codec)
11090 {
11091 	struct alc_spec *spec;
11092 	int err;
11093 
11094 	err = alc_alloc_spec(codec, 0x0b);
11095 	if (err < 0)
11096 		return err;
11097 
11098 	spec = codec->spec;
11099 	spec->gen.shared_mic_vref_pin = 0x18;
11100 	codec->power_save_node = 0;
11101 	spec->en_3kpull_low = true;
11102 
11103 #ifdef CONFIG_PM
11104 	codec->patch_ops.suspend = alc269_suspend;
11105 	codec->patch_ops.resume = alc269_resume;
11106 #endif
11107 	spec->shutup = alc_default_shutup;
11108 	spec->init_hook = alc_default_init;
11109 
11110 	switch (codec->core.vendor_id) {
11111 	case 0x10ec0269:
11112 		spec->codec_variant = ALC269_TYPE_ALC269VA;
11113 		switch (alc_get_coef0(codec) & 0x00f0) {
11114 		case 0x0010:
11115 			if (codec->bus->pci &&
11116 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
11117 			    spec->cdefine.platform_type == 1)
11118 				err = alc_codec_rename(codec, "ALC271X");
11119 			spec->codec_variant = ALC269_TYPE_ALC269VB;
11120 			break;
11121 		case 0x0020:
11122 			if (codec->bus->pci &&
11123 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
11124 			    codec->bus->pci->subsystem_device == 0x21f3)
11125 				err = alc_codec_rename(codec, "ALC3202");
11126 			spec->codec_variant = ALC269_TYPE_ALC269VC;
11127 			break;
11128 		case 0x0030:
11129 			spec->codec_variant = ALC269_TYPE_ALC269VD;
11130 			break;
11131 		default:
11132 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
11133 		}
11134 		if (err < 0)
11135 			goto error;
11136 		spec->shutup = alc269_shutup;
11137 		spec->init_hook = alc269_fill_coef;
11138 		alc269_fill_coef(codec);
11139 		break;
11140 
11141 	case 0x10ec0280:
11142 	case 0x10ec0290:
11143 		spec->codec_variant = ALC269_TYPE_ALC280;
11144 		break;
11145 	case 0x10ec0282:
11146 		spec->codec_variant = ALC269_TYPE_ALC282;
11147 		spec->shutup = alc282_shutup;
11148 		spec->init_hook = alc282_init;
11149 		break;
11150 	case 0x10ec0233:
11151 	case 0x10ec0283:
11152 		spec->codec_variant = ALC269_TYPE_ALC283;
11153 		spec->shutup = alc283_shutup;
11154 		spec->init_hook = alc283_init;
11155 		break;
11156 	case 0x10ec0284:
11157 	case 0x10ec0292:
11158 		spec->codec_variant = ALC269_TYPE_ALC284;
11159 		break;
11160 	case 0x10ec0293:
11161 		spec->codec_variant = ALC269_TYPE_ALC293;
11162 		break;
11163 	case 0x10ec0286:
11164 	case 0x10ec0288:
11165 		spec->codec_variant = ALC269_TYPE_ALC286;
11166 		break;
11167 	case 0x10ec0298:
11168 		spec->codec_variant = ALC269_TYPE_ALC298;
11169 		break;
11170 	case 0x10ec0235:
11171 	case 0x10ec0255:
11172 		spec->codec_variant = ALC269_TYPE_ALC255;
11173 		spec->shutup = alc256_shutup;
11174 		spec->init_hook = alc256_init;
11175 		break;
11176 	case 0x10ec0230:
11177 	case 0x10ec0236:
11178 	case 0x10ec0256:
11179 	case 0x19e58326:
11180 		spec->codec_variant = ALC269_TYPE_ALC256;
11181 		spec->shutup = alc256_shutup;
11182 		spec->init_hook = alc256_init;
11183 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
11184 		if (codec->core.vendor_id == 0x10ec0236 &&
11185 		    codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
11186 			spec->en_3kpull_low = false;
11187 		break;
11188 	case 0x10ec0257:
11189 		spec->codec_variant = ALC269_TYPE_ALC257;
11190 		spec->shutup = alc256_shutup;
11191 		spec->init_hook = alc256_init;
11192 		spec->gen.mixer_nid = 0;
11193 		spec->en_3kpull_low = false;
11194 		break;
11195 	case 0x10ec0215:
11196 	case 0x10ec0245:
11197 	case 0x10ec0285:
11198 	case 0x10ec0289:
11199 		if (alc_get_coef0(codec) & 0x0010)
11200 			spec->codec_variant = ALC269_TYPE_ALC245;
11201 		else
11202 			spec->codec_variant = ALC269_TYPE_ALC215;
11203 		spec->shutup = alc225_shutup;
11204 		spec->init_hook = alc225_init;
11205 		spec->gen.mixer_nid = 0;
11206 		break;
11207 	case 0x10ec0225:
11208 	case 0x10ec0295:
11209 	case 0x10ec0299:
11210 		spec->codec_variant = ALC269_TYPE_ALC225;
11211 		spec->shutup = alc225_shutup;
11212 		spec->init_hook = alc225_init;
11213 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
11214 		break;
11215 	case 0x10ec0287:
11216 		spec->codec_variant = ALC269_TYPE_ALC287;
11217 		spec->shutup = alc225_shutup;
11218 		spec->init_hook = alc225_init;
11219 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
11220 		break;
11221 	case 0x10ec0234:
11222 	case 0x10ec0274:
11223 	case 0x10ec0294:
11224 		spec->codec_variant = ALC269_TYPE_ALC294;
11225 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
11226 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
11227 		spec->init_hook = alc294_init;
11228 		break;
11229 	case 0x10ec0300:
11230 		spec->codec_variant = ALC269_TYPE_ALC300;
11231 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
11232 		break;
11233 	case 0x10ec0623:
11234 		spec->codec_variant = ALC269_TYPE_ALC623;
11235 		break;
11236 	case 0x10ec0700:
11237 	case 0x10ec0701:
11238 	case 0x10ec0703:
11239 	case 0x10ec0711:
11240 		spec->codec_variant = ALC269_TYPE_ALC700;
11241 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
11242 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
11243 		spec->init_hook = alc294_init;
11244 		break;
11245 
11246 	}
11247 
11248 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
11249 		spec->has_alc5505_dsp = 1;
11250 		spec->init_hook = alc5505_dsp_init;
11251 	}
11252 
11253 	alc_pre_init(codec);
11254 
11255 	snd_hda_pick_fixup(codec, alc269_fixup_models,
11256 		       alc269_fixup_tbl, alc269_fixups);
11257 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
11258 	 * the quirk breaks the latter (bko#214101).
11259 	 * Clear the wrong entry.
11260 	 */
11261 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
11262 	    codec->core.vendor_id == 0x10ec0294) {
11263 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
11264 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
11265 	}
11266 
11267 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
11268 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
11269 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
11270 			   alc269_fixups);
11271 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11272 
11273 	alc_auto_parse_customize_define(codec);
11274 
11275 	if (has_cdefine_beep(codec))
11276 		spec->gen.beep_nid = 0x01;
11277 
11278 	/* automatic parse from the BIOS config */
11279 	err = alc269_parse_auto_config(codec);
11280 	if (err < 0)
11281 		goto error;
11282 
11283 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
11284 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
11285 		if (err < 0)
11286 			goto error;
11287 	}
11288 
11289 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11290 
11291 	return 0;
11292 
11293  error:
11294 	alc_free(codec);
11295 	return err;
11296 }
11297 
11298 /*
11299  * ALC861
11300  */
11301 
alc861_parse_auto_config(struct hda_codec * codec)11302 static int alc861_parse_auto_config(struct hda_codec *codec)
11303 {
11304 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11305 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
11306 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
11307 }
11308 
11309 /* Pin config fixes */
11310 enum {
11311 	ALC861_FIXUP_FSC_AMILO_PI1505,
11312 	ALC861_FIXUP_AMP_VREF_0F,
11313 	ALC861_FIXUP_NO_JACK_DETECT,
11314 	ALC861_FIXUP_ASUS_A6RP,
11315 	ALC660_FIXUP_ASUS_W7J,
11316 };
11317 
11318 /* 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)11319 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
11320 			const struct hda_fixup *fix, int action)
11321 {
11322 	struct alc_spec *spec = codec->spec;
11323 	unsigned int val;
11324 
11325 	if (action != HDA_FIXUP_ACT_INIT)
11326 		return;
11327 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
11328 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
11329 		val |= AC_PINCTL_IN_EN;
11330 	val |= AC_PINCTL_VREF_50;
11331 	snd_hda_set_pin_ctl(codec, 0x0f, val);
11332 	spec->gen.keep_vref_in_automute = 1;
11333 }
11334 
11335 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)11336 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
11337 				     const struct hda_fixup *fix, int action)
11338 {
11339 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11340 		codec->no_jack_detect = 1;
11341 }
11342 
11343 static const struct hda_fixup alc861_fixups[] = {
11344 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
11345 		.type = HDA_FIXUP_PINS,
11346 		.v.pins = (const struct hda_pintbl[]) {
11347 			{ 0x0b, 0x0221101f }, /* HP */
11348 			{ 0x0f, 0x90170310 }, /* speaker */
11349 			{ }
11350 		}
11351 	},
11352 	[ALC861_FIXUP_AMP_VREF_0F] = {
11353 		.type = HDA_FIXUP_FUNC,
11354 		.v.func = alc861_fixup_asus_amp_vref_0f,
11355 	},
11356 	[ALC861_FIXUP_NO_JACK_DETECT] = {
11357 		.type = HDA_FIXUP_FUNC,
11358 		.v.func = alc_fixup_no_jack_detect,
11359 	},
11360 	[ALC861_FIXUP_ASUS_A6RP] = {
11361 		.type = HDA_FIXUP_FUNC,
11362 		.v.func = alc861_fixup_asus_amp_vref_0f,
11363 		.chained = true,
11364 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
11365 	},
11366 	[ALC660_FIXUP_ASUS_W7J] = {
11367 		.type = HDA_FIXUP_VERBS,
11368 		.v.verbs = (const struct hda_verb[]) {
11369 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
11370 			 * for enabling outputs
11371 			 */
11372 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11373 			{ }
11374 		},
11375 	}
11376 };
11377 
11378 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
11379 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
11380 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
11381 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
11382 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
11383 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
11384 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
11385 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
11386 	{}
11387 };
11388 
11389 /*
11390  */
patch_alc861(struct hda_codec * codec)11391 static int patch_alc861(struct hda_codec *codec)
11392 {
11393 	struct alc_spec *spec;
11394 	int err;
11395 
11396 	err = alc_alloc_spec(codec, 0x15);
11397 	if (err < 0)
11398 		return err;
11399 
11400 	spec = codec->spec;
11401 	if (has_cdefine_beep(codec))
11402 		spec->gen.beep_nid = 0x23;
11403 
11404 #ifdef CONFIG_PM
11405 	spec->power_hook = alc_power_eapd;
11406 #endif
11407 
11408 	alc_pre_init(codec);
11409 
11410 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
11411 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11412 
11413 	/* automatic parse from the BIOS config */
11414 	err = alc861_parse_auto_config(codec);
11415 	if (err < 0)
11416 		goto error;
11417 
11418 	if (!spec->gen.no_analog) {
11419 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
11420 		if (err < 0)
11421 			goto error;
11422 	}
11423 
11424 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11425 
11426 	return 0;
11427 
11428  error:
11429 	alc_free(codec);
11430 	return err;
11431 }
11432 
11433 /*
11434  * ALC861-VD support
11435  *
11436  * Based on ALC882
11437  *
11438  * In addition, an independent DAC
11439  */
alc861vd_parse_auto_config(struct hda_codec * codec)11440 static int alc861vd_parse_auto_config(struct hda_codec *codec)
11441 {
11442 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
11443 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11444 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
11445 }
11446 
11447 enum {
11448 	ALC660VD_FIX_ASUS_GPIO1,
11449 	ALC861VD_FIX_DALLAS,
11450 };
11451 
11452 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)11453 static void alc861vd_fixup_dallas(struct hda_codec *codec,
11454 				  const struct hda_fixup *fix, int action)
11455 {
11456 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11457 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
11458 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
11459 	}
11460 }
11461 
11462 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11463 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
11464 				      const struct hda_fixup *fix, int action)
11465 {
11466 	struct alc_spec *spec = codec->spec;
11467 
11468 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11469 		spec->gpio_mask |= 0x02;
11470 	alc_fixup_gpio(codec, action, 0x01);
11471 }
11472 
11473 static const struct hda_fixup alc861vd_fixups[] = {
11474 	[ALC660VD_FIX_ASUS_GPIO1] = {
11475 		.type = HDA_FIXUP_FUNC,
11476 		.v.func = alc660vd_fixup_asus_gpio1,
11477 	},
11478 	[ALC861VD_FIX_DALLAS] = {
11479 		.type = HDA_FIXUP_FUNC,
11480 		.v.func = alc861vd_fixup_dallas,
11481 	},
11482 };
11483 
11484 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
11485 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
11486 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
11487 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
11488 	{}
11489 };
11490 
11491 /*
11492  */
patch_alc861vd(struct hda_codec * codec)11493 static int patch_alc861vd(struct hda_codec *codec)
11494 {
11495 	struct alc_spec *spec;
11496 	int err;
11497 
11498 	err = alc_alloc_spec(codec, 0x0b);
11499 	if (err < 0)
11500 		return err;
11501 
11502 	spec = codec->spec;
11503 	if (has_cdefine_beep(codec))
11504 		spec->gen.beep_nid = 0x23;
11505 
11506 	spec->shutup = alc_eapd_shutup;
11507 
11508 	alc_pre_init(codec);
11509 
11510 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
11511 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11512 
11513 	/* automatic parse from the BIOS config */
11514 	err = alc861vd_parse_auto_config(codec);
11515 	if (err < 0)
11516 		goto error;
11517 
11518 	if (!spec->gen.no_analog) {
11519 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11520 		if (err < 0)
11521 			goto error;
11522 	}
11523 
11524 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11525 
11526 	return 0;
11527 
11528  error:
11529 	alc_free(codec);
11530 	return err;
11531 }
11532 
11533 /*
11534  * ALC662 support
11535  *
11536  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11537  * configuration.  Each pin widget can choose any input DACs and a mixer.
11538  * Each ADC is connected from a mixer of all inputs.  This makes possible
11539  * 6-channel independent captures.
11540  *
11541  * In addition, an independent DAC for the multi-playback (not used in this
11542  * driver yet).
11543  */
11544 
11545 /*
11546  * BIOS auto configuration
11547  */
11548 
alc662_parse_auto_config(struct hda_codec * codec)11549 static int alc662_parse_auto_config(struct hda_codec *codec)
11550 {
11551 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11552 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
11553 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11554 	const hda_nid_t *ssids;
11555 
11556 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
11557 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
11558 	    codec->core.vendor_id == 0x10ec0671)
11559 		ssids = alc663_ssids;
11560 	else
11561 		ssids = alc662_ssids;
11562 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
11563 }
11564 
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)11565 static void alc272_fixup_mario(struct hda_codec *codec,
11566 			       const struct hda_fixup *fix, int action)
11567 {
11568 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
11569 		return;
11570 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
11571 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
11572 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
11573 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11574 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
11575 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
11576 }
11577 
11578 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
11579 	{ .channels = 2,
11580 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
11581 	{ .channels = 4,
11582 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
11583 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
11584 	{ }
11585 };
11586 
11587 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)11588 static void alc_fixup_bass_chmap(struct hda_codec *codec,
11589 				    const struct hda_fixup *fix, int action)
11590 {
11591 	if (action == HDA_FIXUP_ACT_BUILD) {
11592 		struct alc_spec *spec = codec->spec;
11593 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
11594 	}
11595 }
11596 
11597 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)11598 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
11599 					  hda_nid_t nid,
11600 					  unsigned int power_state)
11601 {
11602 	struct alc_spec *spec = codec->spec;
11603 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
11604 		return AC_PWRST_D0;
11605 	return power_state;
11606 }
11607 
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11608 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
11609 				   const struct hda_fixup *fix, int action)
11610 {
11611 	struct alc_spec *spec = codec->spec;
11612 
11613 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
11614 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11615 		spec->mute_led_polarity = 1;
11616 		codec->power_filter = gpio_led_power_filter;
11617 	}
11618 }
11619 
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11620 static void alc662_usi_automute_hook(struct hda_codec *codec,
11621 					 struct hda_jack_callback *jack)
11622 {
11623 	struct alc_spec *spec = codec->spec;
11624 	int vref;
11625 	msleep(200);
11626 	snd_hda_gen_hp_automute(codec, jack);
11627 
11628 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
11629 	msleep(100);
11630 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11631 			    vref);
11632 }
11633 
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11634 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
11635 				     const struct hda_fixup *fix, int action)
11636 {
11637 	struct alc_spec *spec = codec->spec;
11638 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11639 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11640 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
11641 	}
11642 }
11643 
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)11644 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
11645 					struct hda_jack_callback *cb)
11646 {
11647 	/* surround speakers at 0x1b already get muted automatically when
11648 	 * headphones are plugged in, but we have to mute/unmute the remaining
11649 	 * channels manually:
11650 	 * 0x15 - front left/front right
11651 	 * 0x18 - front center/ LFE
11652 	 */
11653 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
11654 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
11655 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
11656 	} else {
11657 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
11658 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
11659 	}
11660 }
11661 
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)11662 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
11663 					const struct hda_fixup *fix, int action)
11664 {
11665     /* Pin 0x1b: shared headphones jack and surround speakers */
11666 	if (!is_jack_detectable(codec, 0x1b))
11667 		return;
11668 
11669 	switch (action) {
11670 	case HDA_FIXUP_ACT_PRE_PROBE:
11671 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
11672 				alc662_aspire_ethos_mute_speakers);
11673 		/* subwoofer needs an extra GPIO setting to become audible */
11674 		alc_setup_gpio(codec, 0x02);
11675 		break;
11676 	case HDA_FIXUP_ACT_INIT:
11677 		/* Make sure to start in a correct state, i.e. if
11678 		 * headphones have been plugged in before powering up the system
11679 		 */
11680 		alc662_aspire_ethos_mute_speakers(codec, NULL);
11681 		break;
11682 	}
11683 }
11684 
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)11685 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
11686 					     const struct hda_fixup *fix, int action)
11687 {
11688 	struct alc_spec *spec = codec->spec;
11689 
11690 	static const struct hda_pintbl pincfgs[] = {
11691 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
11692 		{ 0x1b, 0x0181304f },
11693 		{ }
11694 	};
11695 
11696 	switch (action) {
11697 	case HDA_FIXUP_ACT_PRE_PROBE:
11698 		spec->gen.mixer_nid = 0;
11699 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11700 		snd_hda_apply_pincfgs(codec, pincfgs);
11701 		break;
11702 	case HDA_FIXUP_ACT_INIT:
11703 		alc_write_coef_idx(codec, 0x19, 0xa054);
11704 		break;
11705 	}
11706 }
11707 
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11708 static void alc897_hp_automute_hook(struct hda_codec *codec,
11709 					 struct hda_jack_callback *jack)
11710 {
11711 	struct alc_spec *spec = codec->spec;
11712 	int vref;
11713 
11714 	snd_hda_gen_hp_automute(codec, jack);
11715 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
11716 	snd_hda_set_pin_ctl(codec, 0x1b, vref);
11717 }
11718 
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11719 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
11720 				     const struct hda_fixup *fix, int action)
11721 {
11722 	struct alc_spec *spec = codec->spec;
11723 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11724 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11725 		spec->no_shutup_pins = 1;
11726 	}
11727 	if (action == HDA_FIXUP_ACT_PROBE) {
11728 		snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
11729 	}
11730 }
11731 
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)11732 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
11733 				     const struct hda_fixup *fix, int action)
11734 {
11735 	struct alc_spec *spec = codec->spec;
11736 
11737 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11738 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11739 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11740 	}
11741 }
11742 
11743 static const struct coef_fw alc668_coefs[] = {
11744 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
11745 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
11746 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
11747 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
11748 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
11749 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
11750 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
11751 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
11752 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
11753 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
11754 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
11755 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
11756 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
11757 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
11758 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
11759 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
11760 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
11761 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
11762 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
11763 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
11764 	{}
11765 };
11766 
alc668_restore_default_value(struct hda_codec * codec)11767 static void alc668_restore_default_value(struct hda_codec *codec)
11768 {
11769 	alc_process_coef_fw(codec, alc668_coefs);
11770 }
11771 
11772 enum {
11773 	ALC662_FIXUP_ASPIRE,
11774 	ALC662_FIXUP_LED_GPIO1,
11775 	ALC662_FIXUP_IDEAPAD,
11776 	ALC272_FIXUP_MARIO,
11777 	ALC662_FIXUP_CZC_ET26,
11778 	ALC662_FIXUP_CZC_P10T,
11779 	ALC662_FIXUP_SKU_IGNORE,
11780 	ALC662_FIXUP_HP_RP5800,
11781 	ALC662_FIXUP_ASUS_MODE1,
11782 	ALC662_FIXUP_ASUS_MODE2,
11783 	ALC662_FIXUP_ASUS_MODE3,
11784 	ALC662_FIXUP_ASUS_MODE4,
11785 	ALC662_FIXUP_ASUS_MODE5,
11786 	ALC662_FIXUP_ASUS_MODE6,
11787 	ALC662_FIXUP_ASUS_MODE7,
11788 	ALC662_FIXUP_ASUS_MODE8,
11789 	ALC662_FIXUP_NO_JACK_DETECT,
11790 	ALC662_FIXUP_ZOTAC_Z68,
11791 	ALC662_FIXUP_INV_DMIC,
11792 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11793 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
11794 	ALC662_FIXUP_HEADSET_MODE,
11795 	ALC668_FIXUP_HEADSET_MODE,
11796 	ALC662_FIXUP_BASS_MODE4_CHMAP,
11797 	ALC662_FIXUP_BASS_16,
11798 	ALC662_FIXUP_BASS_1A,
11799 	ALC662_FIXUP_BASS_CHMAP,
11800 	ALC668_FIXUP_AUTO_MUTE,
11801 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
11802 	ALC668_FIXUP_DELL_XPS13,
11803 	ALC662_FIXUP_ASUS_Nx50,
11804 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11805 	ALC668_FIXUP_ASUS_Nx51,
11806 	ALC668_FIXUP_MIC_COEF,
11807 	ALC668_FIXUP_ASUS_G751,
11808 	ALC891_FIXUP_HEADSET_MODE,
11809 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11810 	ALC662_FIXUP_ACER_VERITON,
11811 	ALC892_FIXUP_ASROCK_MOBO,
11812 	ALC662_FIXUP_USI_FUNC,
11813 	ALC662_FIXUP_USI_HEADSET_MODE,
11814 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
11815 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
11816 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
11817 	ALC671_FIXUP_HP_HEADSET_MIC2,
11818 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
11819 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
11820 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
11821 	ALC668_FIXUP_HEADSET_MIC,
11822 	ALC668_FIXUP_MIC_DET_COEF,
11823 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
11824 	ALC897_FIXUP_HEADSET_MIC_PIN,
11825 	ALC897_FIXUP_HP_HSMIC_VERB,
11826 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
11827 	ALC897_FIXUP_HEADSET_MIC_PIN2,
11828 	ALC897_FIXUP_UNIS_H3C_X500S,
11829 	ALC897_FIXUP_HEADSET_MIC_PIN3,
11830 };
11831 
11832 static const struct hda_fixup alc662_fixups[] = {
11833 	[ALC662_FIXUP_ASPIRE] = {
11834 		.type = HDA_FIXUP_PINS,
11835 		.v.pins = (const struct hda_pintbl[]) {
11836 			{ 0x15, 0x99130112 }, /* subwoofer */
11837 			{ }
11838 		}
11839 	},
11840 	[ALC662_FIXUP_LED_GPIO1] = {
11841 		.type = HDA_FIXUP_FUNC,
11842 		.v.func = alc662_fixup_led_gpio1,
11843 	},
11844 	[ALC662_FIXUP_IDEAPAD] = {
11845 		.type = HDA_FIXUP_PINS,
11846 		.v.pins = (const struct hda_pintbl[]) {
11847 			{ 0x17, 0x99130112 }, /* subwoofer */
11848 			{ }
11849 		},
11850 		.chained = true,
11851 		.chain_id = ALC662_FIXUP_LED_GPIO1,
11852 	},
11853 	[ALC272_FIXUP_MARIO] = {
11854 		.type = HDA_FIXUP_FUNC,
11855 		.v.func = alc272_fixup_mario,
11856 	},
11857 	[ALC662_FIXUP_CZC_ET26] = {
11858 		.type = HDA_FIXUP_PINS,
11859 		.v.pins = (const struct hda_pintbl[]) {
11860 			{0x12, 0x403cc000},
11861 			{0x14, 0x90170110}, /* speaker */
11862 			{0x15, 0x411111f0},
11863 			{0x16, 0x411111f0},
11864 			{0x18, 0x01a19030}, /* mic */
11865 			{0x19, 0x90a7013f}, /* int-mic */
11866 			{0x1a, 0x01014020},
11867 			{0x1b, 0x0121401f},
11868 			{0x1c, 0x411111f0},
11869 			{0x1d, 0x411111f0},
11870 			{0x1e, 0x40478e35},
11871 			{}
11872 		},
11873 		.chained = true,
11874 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11875 	},
11876 	[ALC662_FIXUP_CZC_P10T] = {
11877 		.type = HDA_FIXUP_VERBS,
11878 		.v.verbs = (const struct hda_verb[]) {
11879 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
11880 			{}
11881 		}
11882 	},
11883 	[ALC662_FIXUP_SKU_IGNORE] = {
11884 		.type = HDA_FIXUP_FUNC,
11885 		.v.func = alc_fixup_sku_ignore,
11886 	},
11887 	[ALC662_FIXUP_HP_RP5800] = {
11888 		.type = HDA_FIXUP_PINS,
11889 		.v.pins = (const struct hda_pintbl[]) {
11890 			{ 0x14, 0x0221201f }, /* HP out */
11891 			{ }
11892 		},
11893 		.chained = true,
11894 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11895 	},
11896 	[ALC662_FIXUP_ASUS_MODE1] = {
11897 		.type = HDA_FIXUP_PINS,
11898 		.v.pins = (const struct hda_pintbl[]) {
11899 			{ 0x14, 0x99130110 }, /* speaker */
11900 			{ 0x18, 0x01a19c20 }, /* mic */
11901 			{ 0x19, 0x99a3092f }, /* int-mic */
11902 			{ 0x21, 0x0121401f }, /* HP out */
11903 			{ }
11904 		},
11905 		.chained = true,
11906 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11907 	},
11908 	[ALC662_FIXUP_ASUS_MODE2] = {
11909 		.type = HDA_FIXUP_PINS,
11910 		.v.pins = (const struct hda_pintbl[]) {
11911 			{ 0x14, 0x99130110 }, /* speaker */
11912 			{ 0x18, 0x01a19820 }, /* mic */
11913 			{ 0x19, 0x99a3092f }, /* int-mic */
11914 			{ 0x1b, 0x0121401f }, /* HP out */
11915 			{ }
11916 		},
11917 		.chained = true,
11918 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11919 	},
11920 	[ALC662_FIXUP_ASUS_MODE3] = {
11921 		.type = HDA_FIXUP_PINS,
11922 		.v.pins = (const struct hda_pintbl[]) {
11923 			{ 0x14, 0x99130110 }, /* speaker */
11924 			{ 0x15, 0x0121441f }, /* HP */
11925 			{ 0x18, 0x01a19840 }, /* mic */
11926 			{ 0x19, 0x99a3094f }, /* int-mic */
11927 			{ 0x21, 0x01211420 }, /* HP2 */
11928 			{ }
11929 		},
11930 		.chained = true,
11931 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11932 	},
11933 	[ALC662_FIXUP_ASUS_MODE4] = {
11934 		.type = HDA_FIXUP_PINS,
11935 		.v.pins = (const struct hda_pintbl[]) {
11936 			{ 0x14, 0x99130110 }, /* speaker */
11937 			{ 0x16, 0x99130111 }, /* speaker */
11938 			{ 0x18, 0x01a19840 }, /* mic */
11939 			{ 0x19, 0x99a3094f }, /* int-mic */
11940 			{ 0x21, 0x0121441f }, /* HP */
11941 			{ }
11942 		},
11943 		.chained = true,
11944 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11945 	},
11946 	[ALC662_FIXUP_ASUS_MODE5] = {
11947 		.type = HDA_FIXUP_PINS,
11948 		.v.pins = (const struct hda_pintbl[]) {
11949 			{ 0x14, 0x99130110 }, /* speaker */
11950 			{ 0x15, 0x0121441f }, /* HP */
11951 			{ 0x16, 0x99130111 }, /* speaker */
11952 			{ 0x18, 0x01a19840 }, /* mic */
11953 			{ 0x19, 0x99a3094f }, /* int-mic */
11954 			{ }
11955 		},
11956 		.chained = true,
11957 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11958 	},
11959 	[ALC662_FIXUP_ASUS_MODE6] = {
11960 		.type = HDA_FIXUP_PINS,
11961 		.v.pins = (const struct hda_pintbl[]) {
11962 			{ 0x14, 0x99130110 }, /* speaker */
11963 			{ 0x15, 0x01211420 }, /* HP2 */
11964 			{ 0x18, 0x01a19840 }, /* mic */
11965 			{ 0x19, 0x99a3094f }, /* int-mic */
11966 			{ 0x1b, 0x0121441f }, /* HP */
11967 			{ }
11968 		},
11969 		.chained = true,
11970 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11971 	},
11972 	[ALC662_FIXUP_ASUS_MODE7] = {
11973 		.type = HDA_FIXUP_PINS,
11974 		.v.pins = (const struct hda_pintbl[]) {
11975 			{ 0x14, 0x99130110 }, /* speaker */
11976 			{ 0x17, 0x99130111 }, /* speaker */
11977 			{ 0x18, 0x01a19840 }, /* mic */
11978 			{ 0x19, 0x99a3094f }, /* int-mic */
11979 			{ 0x1b, 0x01214020 }, /* HP */
11980 			{ 0x21, 0x0121401f }, /* HP */
11981 			{ }
11982 		},
11983 		.chained = true,
11984 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11985 	},
11986 	[ALC662_FIXUP_ASUS_MODE8] = {
11987 		.type = HDA_FIXUP_PINS,
11988 		.v.pins = (const struct hda_pintbl[]) {
11989 			{ 0x14, 0x99130110 }, /* speaker */
11990 			{ 0x12, 0x99a30970 }, /* int-mic */
11991 			{ 0x15, 0x01214020 }, /* HP */
11992 			{ 0x17, 0x99130111 }, /* speaker */
11993 			{ 0x18, 0x01a19840 }, /* mic */
11994 			{ 0x21, 0x0121401f }, /* HP */
11995 			{ }
11996 		},
11997 		.chained = true,
11998 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11999 	},
12000 	[ALC662_FIXUP_NO_JACK_DETECT] = {
12001 		.type = HDA_FIXUP_FUNC,
12002 		.v.func = alc_fixup_no_jack_detect,
12003 	},
12004 	[ALC662_FIXUP_ZOTAC_Z68] = {
12005 		.type = HDA_FIXUP_PINS,
12006 		.v.pins = (const struct hda_pintbl[]) {
12007 			{ 0x1b, 0x02214020 }, /* Front HP */
12008 			{ }
12009 		}
12010 	},
12011 	[ALC662_FIXUP_INV_DMIC] = {
12012 		.type = HDA_FIXUP_FUNC,
12013 		.v.func = alc_fixup_inv_dmic,
12014 	},
12015 	[ALC668_FIXUP_DELL_XPS13] = {
12016 		.type = HDA_FIXUP_FUNC,
12017 		.v.func = alc_fixup_dell_xps13,
12018 		.chained = true,
12019 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12020 	},
12021 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12022 		.type = HDA_FIXUP_FUNC,
12023 		.v.func = alc_fixup_disable_aamix,
12024 		.chained = true,
12025 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12026 	},
12027 	[ALC668_FIXUP_AUTO_MUTE] = {
12028 		.type = HDA_FIXUP_FUNC,
12029 		.v.func = alc_fixup_auto_mute_via_amp,
12030 		.chained = true,
12031 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12032 	},
12033 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12034 		.type = HDA_FIXUP_PINS,
12035 		.v.pins = (const struct hda_pintbl[]) {
12036 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12037 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12038 			{ }
12039 		},
12040 		.chained = true,
12041 		.chain_id = ALC662_FIXUP_HEADSET_MODE
12042 	},
12043 	[ALC662_FIXUP_HEADSET_MODE] = {
12044 		.type = HDA_FIXUP_FUNC,
12045 		.v.func = alc_fixup_headset_mode_alc662,
12046 	},
12047 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12048 		.type = HDA_FIXUP_PINS,
12049 		.v.pins = (const struct hda_pintbl[]) {
12050 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12051 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12052 			{ }
12053 		},
12054 		.chained = true,
12055 		.chain_id = ALC668_FIXUP_HEADSET_MODE
12056 	},
12057 	[ALC668_FIXUP_HEADSET_MODE] = {
12058 		.type = HDA_FIXUP_FUNC,
12059 		.v.func = alc_fixup_headset_mode_alc668,
12060 	},
12061 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12062 		.type = HDA_FIXUP_FUNC,
12063 		.v.func = alc_fixup_bass_chmap,
12064 		.chained = true,
12065 		.chain_id = ALC662_FIXUP_ASUS_MODE4
12066 	},
12067 	[ALC662_FIXUP_BASS_16] = {
12068 		.type = HDA_FIXUP_PINS,
12069 		.v.pins = (const struct hda_pintbl[]) {
12070 			{0x16, 0x80106111}, /* bass speaker */
12071 			{}
12072 		},
12073 		.chained = true,
12074 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12075 	},
12076 	[ALC662_FIXUP_BASS_1A] = {
12077 		.type = HDA_FIXUP_PINS,
12078 		.v.pins = (const struct hda_pintbl[]) {
12079 			{0x1a, 0x80106111}, /* bass speaker */
12080 			{}
12081 		},
12082 		.chained = true,
12083 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12084 	},
12085 	[ALC662_FIXUP_BASS_CHMAP] = {
12086 		.type = HDA_FIXUP_FUNC,
12087 		.v.func = alc_fixup_bass_chmap,
12088 	},
12089 	[ALC662_FIXUP_ASUS_Nx50] = {
12090 		.type = HDA_FIXUP_FUNC,
12091 		.v.func = alc_fixup_auto_mute_via_amp,
12092 		.chained = true,
12093 		.chain_id = ALC662_FIXUP_BASS_1A
12094 	},
12095 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12096 		.type = HDA_FIXUP_FUNC,
12097 		.v.func = alc_fixup_headset_mode_alc668,
12098 		.chain_id = ALC662_FIXUP_BASS_CHMAP
12099 	},
12100 	[ALC668_FIXUP_ASUS_Nx51] = {
12101 		.type = HDA_FIXUP_PINS,
12102 		.v.pins = (const struct hda_pintbl[]) {
12103 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12104 			{ 0x1a, 0x90170151 }, /* bass speaker */
12105 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12106 			{}
12107 		},
12108 		.chained = true,
12109 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12110 	},
12111 	[ALC668_FIXUP_MIC_COEF] = {
12112 		.type = HDA_FIXUP_VERBS,
12113 		.v.verbs = (const struct hda_verb[]) {
12114 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12115 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12116 			{}
12117 		},
12118 	},
12119 	[ALC668_FIXUP_ASUS_G751] = {
12120 		.type = HDA_FIXUP_PINS,
12121 		.v.pins = (const struct hda_pintbl[]) {
12122 			{ 0x16, 0x0421101f }, /* HP */
12123 			{}
12124 		},
12125 		.chained = true,
12126 		.chain_id = ALC668_FIXUP_MIC_COEF
12127 	},
12128 	[ALC891_FIXUP_HEADSET_MODE] = {
12129 		.type = HDA_FIXUP_FUNC,
12130 		.v.func = alc_fixup_headset_mode,
12131 	},
12132 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
12133 		.type = HDA_FIXUP_PINS,
12134 		.v.pins = (const struct hda_pintbl[]) {
12135 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12136 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12137 			{ }
12138 		},
12139 		.chained = true,
12140 		.chain_id = ALC891_FIXUP_HEADSET_MODE
12141 	},
12142 	[ALC662_FIXUP_ACER_VERITON] = {
12143 		.type = HDA_FIXUP_PINS,
12144 		.v.pins = (const struct hda_pintbl[]) {
12145 			{ 0x15, 0x50170120 }, /* no internal speaker */
12146 			{ }
12147 		}
12148 	},
12149 	[ALC892_FIXUP_ASROCK_MOBO] = {
12150 		.type = HDA_FIXUP_PINS,
12151 		.v.pins = (const struct hda_pintbl[]) {
12152 			{ 0x15, 0x40f000f0 }, /* disabled */
12153 			{ 0x16, 0x40f000f0 }, /* disabled */
12154 			{ }
12155 		}
12156 	},
12157 	[ALC662_FIXUP_USI_FUNC] = {
12158 		.type = HDA_FIXUP_FUNC,
12159 		.v.func = alc662_fixup_usi_headset_mic,
12160 	},
12161 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
12162 		.type = HDA_FIXUP_PINS,
12163 		.v.pins = (const struct hda_pintbl[]) {
12164 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
12165 			{ 0x18, 0x01a1903d },
12166 			{ }
12167 		},
12168 		.chained = true,
12169 		.chain_id = ALC662_FIXUP_USI_FUNC
12170 	},
12171 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
12172 		.type = HDA_FIXUP_FUNC,
12173 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
12174 	},
12175 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
12176 		.type = HDA_FIXUP_FUNC,
12177 		.v.func = alc662_fixup_aspire_ethos_hp,
12178 	},
12179 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
12180 		.type = HDA_FIXUP_PINS,
12181 		.v.pins = (const struct hda_pintbl[]) {
12182 			{ 0x15, 0x92130110 }, /* front speakers */
12183 			{ 0x18, 0x99130111 }, /* center/subwoofer */
12184 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
12185 			{ }
12186 		},
12187 		.chained = true,
12188 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
12189 	},
12190 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
12191 		.type = HDA_FIXUP_FUNC,
12192 		.v.func = alc671_fixup_hp_headset_mic2,
12193 	},
12194 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
12195 		.type = HDA_FIXUP_PINS,
12196 		.v.pins = (const struct hda_pintbl[]) {
12197 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
12198 			{ }
12199 		},
12200 		.chained = true,
12201 		.chain_id = ALC662_FIXUP_USI_FUNC
12202 	},
12203 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
12204 		.type = HDA_FIXUP_PINS,
12205 		.v.pins = (const struct hda_pintbl[]) {
12206 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12207 			{ 0x1b, 0x0221144f },
12208 			{ }
12209 		},
12210 		.chained = true,
12211 		.chain_id = ALC662_FIXUP_USI_FUNC
12212 	},
12213 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
12214 		.type = HDA_FIXUP_PINS,
12215 		.v.pins = (const struct hda_pintbl[]) {
12216 			{ 0x1b, 0x04a1112c },
12217 			{ }
12218 		},
12219 		.chained = true,
12220 		.chain_id = ALC668_FIXUP_HEADSET_MIC
12221 	},
12222 	[ALC668_FIXUP_HEADSET_MIC] = {
12223 		.type = HDA_FIXUP_FUNC,
12224 		.v.func = alc269_fixup_headset_mic,
12225 		.chained = true,
12226 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
12227 	},
12228 	[ALC668_FIXUP_MIC_DET_COEF] = {
12229 		.type = HDA_FIXUP_VERBS,
12230 		.v.verbs = (const struct hda_verb[]) {
12231 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
12232 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
12233 			{}
12234 		},
12235 	},
12236 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
12237 		.type = HDA_FIXUP_FUNC,
12238 		.v.func = alc897_fixup_lenovo_headset_mic,
12239 	},
12240 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
12241 		.type = HDA_FIXUP_PINS,
12242 		.v.pins = (const struct hda_pintbl[]) {
12243 			{ 0x1a, 0x03a11050 },
12244 			{ }
12245 		},
12246 		.chained = true,
12247 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
12248 	},
12249 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
12250 		.type = HDA_FIXUP_PINS,
12251 		.v.pins = (const struct hda_pintbl[]) {
12252 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
12253 			{ }
12254 		},
12255 	},
12256 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
12257 		.type = HDA_FIXUP_FUNC,
12258 		.v.func = alc897_fixup_lenovo_headset_mode,
12259 	},
12260 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
12261 		.type = HDA_FIXUP_PINS,
12262 		.v.pins = (const struct hda_pintbl[]) {
12263 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12264 			{ }
12265 		},
12266 		.chained = true,
12267 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
12268 	},
12269 	[ALC897_FIXUP_UNIS_H3C_X500S] = {
12270 		.type = HDA_FIXUP_VERBS,
12271 		.v.verbs = (const struct hda_verb[]) {
12272 			{ 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
12273 			{}
12274 		},
12275 	},
12276 	[ALC897_FIXUP_HEADSET_MIC_PIN3] = {
12277 		.type = HDA_FIXUP_PINS,
12278 		.v.pins = (const struct hda_pintbl[]) {
12279 			{ 0x19, 0x03a11050 }, /* use as headset mic */
12280 			{ }
12281 		},
12282 	},
12283 };
12284 
12285 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
12286 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
12287 	SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
12288 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
12289 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
12290 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
12291 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
12292 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
12293 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
12294 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
12295 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
12296 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
12297 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
12298 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12299 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12300 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
12301 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
12302 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
12303 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12304 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12305 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12306 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12307 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12308 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
12309 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12310 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12311 	SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12312 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
12313 	SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
12314 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
12315 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
12316 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
12317 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
12318 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
12319 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
12320 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
12321 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12322 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
12323 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
12324 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
12325 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
12326 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
12327 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
12328 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12329 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
12330 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
12331 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
12332 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
12333 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
12334 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
12335 	SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
12336 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
12337 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
12338 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
12339 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
12340 	SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12341 	SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12342 	SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
12343 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
12344 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
12345 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
12346 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
12347 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
12348 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
12349 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
12350 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
12351 	SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
12352 
12353 #if 0
12354 	/* Below is a quirk table taken from the old code.
12355 	 * Basically the device should work as is without the fixup table.
12356 	 * If BIOS doesn't give a proper info, enable the corresponding
12357 	 * fixup entry.
12358 	 */
12359 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
12360 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
12361 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
12362 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
12363 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12364 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12365 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12366 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
12367 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
12368 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12369 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
12370 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
12371 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
12372 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
12373 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
12374 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12375 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
12376 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
12377 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12378 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12379 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12380 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12381 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
12382 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
12383 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
12384 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12385 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
12386 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12387 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12388 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
12389 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12390 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12391 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
12392 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
12393 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
12394 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
12395 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
12396 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
12397 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
12398 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12399 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
12400 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
12401 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12402 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
12403 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
12404 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
12405 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
12406 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
12407 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12408 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
12409 #endif
12410 	{}
12411 };
12412 
12413 static const struct hda_model_fixup alc662_fixup_models[] = {
12414 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
12415 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
12416 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
12417 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
12418 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
12419 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
12420 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
12421 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
12422 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
12423 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
12424 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
12425 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
12426 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
12427 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
12428 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
12429 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
12430 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
12431 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
12432 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
12433 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
12434 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
12435 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
12436 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
12437 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
12438 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
12439 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
12440 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
12441 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
12442 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
12443 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
12444 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
12445 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
12446 	{.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
12447 	{}
12448 };
12449 
12450 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
12451 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12452 		{0x17, 0x02211010},
12453 		{0x18, 0x01a19030},
12454 		{0x1a, 0x01813040},
12455 		{0x21, 0x01014020}),
12456 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12457 		{0x16, 0x01813030},
12458 		{0x17, 0x02211010},
12459 		{0x18, 0x01a19040},
12460 		{0x21, 0x01014020}),
12461 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12462 		{0x14, 0x01014010},
12463 		{0x18, 0x01a19020},
12464 		{0x1a, 0x0181302f},
12465 		{0x1b, 0x0221401f}),
12466 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12467 		{0x12, 0x99a30130},
12468 		{0x14, 0x90170110},
12469 		{0x15, 0x0321101f},
12470 		{0x16, 0x03011020}),
12471 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12472 		{0x12, 0x99a30140},
12473 		{0x14, 0x90170110},
12474 		{0x15, 0x0321101f},
12475 		{0x16, 0x03011020}),
12476 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12477 		{0x12, 0x99a30150},
12478 		{0x14, 0x90170110},
12479 		{0x15, 0x0321101f},
12480 		{0x16, 0x03011020}),
12481 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12482 		{0x14, 0x90170110},
12483 		{0x15, 0x0321101f},
12484 		{0x16, 0x03011020}),
12485 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
12486 		{0x12, 0x90a60130},
12487 		{0x14, 0x90170110},
12488 		{0x15, 0x0321101f}),
12489 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12490 		{0x14, 0x01014010},
12491 		{0x17, 0x90170150},
12492 		{0x19, 0x02a11060},
12493 		{0x1b, 0x01813030},
12494 		{0x21, 0x02211020}),
12495 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12496 		{0x14, 0x01014010},
12497 		{0x18, 0x01a19040},
12498 		{0x1b, 0x01813030},
12499 		{0x21, 0x02211020}),
12500 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12501 		{0x14, 0x01014020},
12502 		{0x17, 0x90170110},
12503 		{0x18, 0x01a19050},
12504 		{0x1b, 0x01813040},
12505 		{0x21, 0x02211030}),
12506 	{}
12507 };
12508 
12509 /*
12510  */
patch_alc662(struct hda_codec * codec)12511 static int patch_alc662(struct hda_codec *codec)
12512 {
12513 	struct alc_spec *spec;
12514 	int err;
12515 
12516 	err = alc_alloc_spec(codec, 0x0b);
12517 	if (err < 0)
12518 		return err;
12519 
12520 	spec = codec->spec;
12521 
12522 	spec->shutup = alc_eapd_shutup;
12523 
12524 	/* handle multiple HPs as is */
12525 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
12526 
12527 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
12528 
12529 	switch (codec->core.vendor_id) {
12530 	case 0x10ec0668:
12531 		spec->init_hook = alc668_restore_default_value;
12532 		break;
12533 	}
12534 
12535 	alc_pre_init(codec);
12536 
12537 	snd_hda_pick_fixup(codec, alc662_fixup_models,
12538 		       alc662_fixup_tbl, alc662_fixups);
12539 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
12540 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12541 
12542 	alc_auto_parse_customize_define(codec);
12543 
12544 	if (has_cdefine_beep(codec))
12545 		spec->gen.beep_nid = 0x01;
12546 
12547 	if ((alc_get_coef0(codec) & (1 << 14)) &&
12548 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
12549 	    spec->cdefine.platform_type == 1) {
12550 		err = alc_codec_rename(codec, "ALC272X");
12551 		if (err < 0)
12552 			goto error;
12553 	}
12554 
12555 	/* automatic parse from the BIOS config */
12556 	err = alc662_parse_auto_config(codec);
12557 	if (err < 0)
12558 		goto error;
12559 
12560 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
12561 		switch (codec->core.vendor_id) {
12562 		case 0x10ec0662:
12563 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12564 			break;
12565 		case 0x10ec0272:
12566 		case 0x10ec0663:
12567 		case 0x10ec0665:
12568 		case 0x10ec0668:
12569 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12570 			break;
12571 		case 0x10ec0273:
12572 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
12573 			break;
12574 		}
12575 		if (err < 0)
12576 			goto error;
12577 	}
12578 
12579 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12580 
12581 	return 0;
12582 
12583  error:
12584 	alc_free(codec);
12585 	return err;
12586 }
12587 
12588 /*
12589  * ALC680 support
12590  */
12591 
alc680_parse_auto_config(struct hda_codec * codec)12592 static int alc680_parse_auto_config(struct hda_codec *codec)
12593 {
12594 	return alc_parse_auto_config(codec, NULL, NULL);
12595 }
12596 
12597 /*
12598  */
patch_alc680(struct hda_codec * codec)12599 static int patch_alc680(struct hda_codec *codec)
12600 {
12601 	int err;
12602 
12603 	/* ALC680 has no aa-loopback mixer */
12604 	err = alc_alloc_spec(codec, 0);
12605 	if (err < 0)
12606 		return err;
12607 
12608 	/* automatic parse from the BIOS config */
12609 	err = alc680_parse_auto_config(codec);
12610 	if (err < 0) {
12611 		alc_free(codec);
12612 		return err;
12613 	}
12614 
12615 	return 0;
12616 }
12617 
12618 /*
12619  * patch entries
12620  */
12621 static const struct hda_device_id snd_hda_id_realtek[] = {
12622 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
12623 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
12624 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
12625 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
12626 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
12627 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
12628 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
12629 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
12630 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
12631 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
12632 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
12633 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
12634 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
12635 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
12636 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
12637 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
12638 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
12639 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
12640 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
12641 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
12642 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
12643 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
12644 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
12645 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
12646 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
12647 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
12648 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
12649 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
12650 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
12651 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
12652 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
12653 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
12654 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
12655 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
12656 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
12657 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
12658 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
12659 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
12660 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
12661 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
12662 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
12663 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
12664 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
12665 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
12666 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
12667 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
12668 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
12669 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
12670 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
12671 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
12672 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
12673 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
12674 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
12675 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
12676 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
12677 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
12678 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
12679 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
12680 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
12681 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
12682 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
12683 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
12684 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
12685 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
12686 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
12687 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
12688 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
12689 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
12690 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
12691 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
12692 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
12693 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
12694 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
12695 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
12696 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
12697 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
12698 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
12699 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
12700 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
12701 	{} /* terminator */
12702 };
12703 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
12704 
12705 MODULE_LICENSE("GPL");
12706 MODULE_DESCRIPTION("Realtek HD-audio codec");
12707 
12708 static struct hda_codec_driver realtek_driver = {
12709 	.id = snd_hda_id_realtek,
12710 };
12711 
12712 module_hda_codec_driver(realtek_driver);
12713