xref: /openbmc/linux/sound/pci/hda/patch_realtek.c (revision b694e3c604e999343258c49e574abd7be012e726)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Universal Interface for Intel High Definition Audio Codec
4  *
5  * HD audio interface patch for Realtek ALC codecs
6  *
7  * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8  *                    PeiSen Hou <pshou@realtek.com.tw>
9  *                    Takashi Iwai <tiwai@suse.de>
10  *                    Jonathan Woithe <jwoithe@just42.net>
11  */
12 
13 #include <linux/init.h>
14 #include <linux/delay.h>
15 #include <linux/slab.h>
16 #include <linux/pci.h>
17 #include <linux/dmi.h>
18 #include <linux/module.h>
19 #include <linux/input.h>
20 #include <linux/leds.h>
21 #include <linux/ctype.h>
22 #include <sound/core.h>
23 #include <sound/jack.h>
24 #include <sound/hda_codec.h>
25 #include "hda_local.h"
26 #include "hda_auto_parser.h"
27 #include "hda_jack.h"
28 #include "hda_generic.h"
29 #include "hda_component.h"
30 
31 /* keep halting ALC5505 DSP, for power saving */
32 #define HALT_REALTEK_ALC5505
33 
34 /* extra amp-initialization sequence types */
35 enum {
36 	ALC_INIT_UNDEFINED,
37 	ALC_INIT_NONE,
38 	ALC_INIT_DEFAULT,
39 };
40 
41 enum {
42 	ALC_HEADSET_MODE_UNKNOWN,
43 	ALC_HEADSET_MODE_UNPLUGGED,
44 	ALC_HEADSET_MODE_HEADSET,
45 	ALC_HEADSET_MODE_MIC,
46 	ALC_HEADSET_MODE_HEADPHONE,
47 };
48 
49 enum {
50 	ALC_HEADSET_TYPE_UNKNOWN,
51 	ALC_HEADSET_TYPE_CTIA,
52 	ALC_HEADSET_TYPE_OMTP,
53 };
54 
55 enum {
56 	ALC_KEY_MICMUTE_INDEX,
57 };
58 
59 struct alc_customize_define {
60 	unsigned int  sku_cfg;
61 	unsigned char port_connectivity;
62 	unsigned char check_sum;
63 	unsigned char customization;
64 	unsigned char external_amp;
65 	unsigned int  enable_pcbeep:1;
66 	unsigned int  platform_type:1;
67 	unsigned int  swap:1;
68 	unsigned int  override:1;
69 	unsigned int  fixup:1; /* Means that this sku is set by driver, not read from hw */
70 };
71 
72 struct alc_coef_led {
73 	unsigned int idx;
74 	unsigned int mask;
75 	unsigned int on;
76 	unsigned int off;
77 };
78 
79 struct alc_spec {
80 	struct hda_gen_spec gen; /* must be at head */
81 
82 	/* codec parameterization */
83 	struct alc_customize_define cdefine;
84 	unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
85 
86 	/* GPIO bits */
87 	unsigned int gpio_mask;
88 	unsigned int gpio_dir;
89 	unsigned int gpio_data;
90 	bool gpio_write_delay;	/* add a delay before writing gpio_data */
91 
92 	/* mute LED for HP laptops, see vref_mute_led_set() */
93 	int mute_led_polarity;
94 	int micmute_led_polarity;
95 	hda_nid_t mute_led_nid;
96 	hda_nid_t cap_mute_led_nid;
97 
98 	unsigned int gpio_mute_led_mask;
99 	unsigned int gpio_mic_led_mask;
100 	struct alc_coef_led mute_led_coef;
101 	struct alc_coef_led mic_led_coef;
102 	struct mutex coef_mutex;
103 
104 	hda_nid_t headset_mic_pin;
105 	hda_nid_t headphone_mic_pin;
106 	int current_headset_mode;
107 	int current_headset_type;
108 
109 	/* hooks */
110 	void (*init_hook)(struct hda_codec *codec);
111 #ifdef CONFIG_PM
112 	void (*power_hook)(struct hda_codec *codec);
113 #endif
114 	void (*shutup)(struct hda_codec *codec);
115 
116 	int init_amp;
117 	int codec_variant;	/* flag for other variants */
118 	unsigned int has_alc5505_dsp:1;
119 	unsigned int no_depop_delay:1;
120 	unsigned int done_hp_init:1;
121 	unsigned int no_shutup_pins:1;
122 	unsigned int ultra_low_power:1;
123 	unsigned int has_hs_key:1;
124 	unsigned int no_internal_mic_pin:1;
125 	unsigned int en_3kpull_low:1;
126 
127 	/* for PLL fix */
128 	hda_nid_t pll_nid;
129 	unsigned int pll_coef_idx, pll_coef_bit;
130 	unsigned int coef0;
131 	struct input_dev *kb_dev;
132 	u8 alc_mute_keycode_map[1];
133 
134 	/* component binding */
135 	struct component_match *match;
136 	struct hda_component comps[HDA_MAX_COMPONENTS];
137 };
138 
139 /*
140  * COEF access helper functions
141  */
142 
coef_mutex_lock(struct hda_codec * codec)143 static void coef_mutex_lock(struct hda_codec *codec)
144 {
145 	struct alc_spec *spec = codec->spec;
146 
147 	snd_hda_power_up_pm(codec);
148 	mutex_lock(&spec->coef_mutex);
149 }
150 
coef_mutex_unlock(struct hda_codec * codec)151 static void coef_mutex_unlock(struct hda_codec *codec)
152 {
153 	struct alc_spec *spec = codec->spec;
154 
155 	mutex_unlock(&spec->coef_mutex);
156 	snd_hda_power_down_pm(codec);
157 }
158 
__alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)159 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 				 unsigned int coef_idx)
161 {
162 	unsigned int val;
163 
164 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
165 	val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
166 	return val;
167 }
168 
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)169 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
170 			       unsigned int coef_idx)
171 {
172 	unsigned int val;
173 
174 	coef_mutex_lock(codec);
175 	val = __alc_read_coefex_idx(codec, nid, coef_idx);
176 	coef_mutex_unlock(codec);
177 	return val;
178 }
179 
180 #define alc_read_coef_idx(codec, coef_idx) \
181 	alc_read_coefex_idx(codec, 0x20, coef_idx)
182 
__alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)183 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
184 				   unsigned int coef_idx, unsigned int coef_val)
185 {
186 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
187 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
188 }
189 
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)190 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
191 				 unsigned int coef_idx, unsigned int coef_val)
192 {
193 	coef_mutex_lock(codec);
194 	__alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
195 	coef_mutex_unlock(codec);
196 }
197 
198 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
199 	alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
200 
__alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)201 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
202 				    unsigned int coef_idx, unsigned int mask,
203 				    unsigned int bits_set)
204 {
205 	unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
206 
207 	if (val != -1)
208 		__alc_write_coefex_idx(codec, nid, coef_idx,
209 				       (val & ~mask) | bits_set);
210 }
211 
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)212 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
213 				  unsigned int coef_idx, unsigned int mask,
214 				  unsigned int bits_set)
215 {
216 	coef_mutex_lock(codec);
217 	__alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
218 	coef_mutex_unlock(codec);
219 }
220 
221 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set)	\
222 	alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
223 
224 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)225 static unsigned int alc_get_coef0(struct hda_codec *codec)
226 {
227 	struct alc_spec *spec = codec->spec;
228 
229 	if (!spec->coef0)
230 		spec->coef0 = alc_read_coef_idx(codec, 0);
231 	return spec->coef0;
232 }
233 
234 /* coef writes/updates batch */
235 struct coef_fw {
236 	unsigned char nid;
237 	unsigned char idx;
238 	unsigned short mask;
239 	unsigned short val;
240 };
241 
242 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
243 	{ .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
244 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
245 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
246 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
247 
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)248 static void alc_process_coef_fw(struct hda_codec *codec,
249 				const struct coef_fw *fw)
250 {
251 	coef_mutex_lock(codec);
252 	for (; fw->nid; fw++) {
253 		if (fw->mask == (unsigned short)-1)
254 			__alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
255 		else
256 			__alc_update_coefex_idx(codec, fw->nid, fw->idx,
257 						fw->mask, fw->val);
258 	}
259 	coef_mutex_unlock(codec);
260 }
261 
262 /*
263  * GPIO setup tables, used in initialization
264  */
265 
266 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)267 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
268 {
269 	struct alc_spec *spec = codec->spec;
270 
271 	spec->gpio_mask |= mask;
272 	spec->gpio_dir |= mask;
273 	spec->gpio_data |= mask;
274 }
275 
alc_write_gpio_data(struct hda_codec * codec)276 static void alc_write_gpio_data(struct hda_codec *codec)
277 {
278 	struct alc_spec *spec = codec->spec;
279 
280 	snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
281 			    spec->gpio_data);
282 }
283 
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)284 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
285 				 bool on)
286 {
287 	struct alc_spec *spec = codec->spec;
288 	unsigned int oldval = spec->gpio_data;
289 
290 	if (on)
291 		spec->gpio_data |= mask;
292 	else
293 		spec->gpio_data &= ~mask;
294 	if (oldval != spec->gpio_data)
295 		alc_write_gpio_data(codec);
296 }
297 
alc_write_gpio(struct hda_codec * codec)298 static void alc_write_gpio(struct hda_codec *codec)
299 {
300 	struct alc_spec *spec = codec->spec;
301 
302 	if (!spec->gpio_mask)
303 		return;
304 
305 	snd_hda_codec_write(codec, codec->core.afg, 0,
306 			    AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
307 	snd_hda_codec_write(codec, codec->core.afg, 0,
308 			    AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
309 	if (spec->gpio_write_delay)
310 		msleep(1);
311 	alc_write_gpio_data(codec);
312 }
313 
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)314 static void alc_fixup_gpio(struct hda_codec *codec, int action,
315 			   unsigned int mask)
316 {
317 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
318 		alc_setup_gpio(codec, mask);
319 }
320 
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)321 static void alc_fixup_gpio1(struct hda_codec *codec,
322 			    const struct hda_fixup *fix, int action)
323 {
324 	alc_fixup_gpio(codec, action, 0x01);
325 }
326 
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)327 static void alc_fixup_gpio2(struct hda_codec *codec,
328 			    const struct hda_fixup *fix, int action)
329 {
330 	alc_fixup_gpio(codec, action, 0x02);
331 }
332 
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)333 static void alc_fixup_gpio3(struct hda_codec *codec,
334 			    const struct hda_fixup *fix, int action)
335 {
336 	alc_fixup_gpio(codec, action, 0x03);
337 }
338 
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)339 static void alc_fixup_gpio4(struct hda_codec *codec,
340 			    const struct hda_fixup *fix, int action)
341 {
342 	alc_fixup_gpio(codec, action, 0x04);
343 }
344 
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)345 static void alc_fixup_micmute_led(struct hda_codec *codec,
346 				  const struct hda_fixup *fix, int action)
347 {
348 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
349 		snd_hda_gen_add_micmute_led_cdev(codec, NULL);
350 }
351 
352 /*
353  * Fix hardware PLL issue
354  * On some codecs, the analog PLL gating control must be off while
355  * the default value is 1.
356  */
alc_fix_pll(struct hda_codec * codec)357 static void alc_fix_pll(struct hda_codec *codec)
358 {
359 	struct alc_spec *spec = codec->spec;
360 
361 	if (spec->pll_nid)
362 		alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
363 				      1 << spec->pll_coef_bit, 0);
364 }
365 
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)366 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
367 			     unsigned int coef_idx, unsigned int coef_bit)
368 {
369 	struct alc_spec *spec = codec->spec;
370 	spec->pll_nid = nid;
371 	spec->pll_coef_idx = coef_idx;
372 	spec->pll_coef_bit = coef_bit;
373 	alc_fix_pll(codec);
374 }
375 
376 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)377 static void alc_update_knob_master(struct hda_codec *codec,
378 				   struct hda_jack_callback *jack)
379 {
380 	unsigned int val;
381 	struct snd_kcontrol *kctl;
382 	struct snd_ctl_elem_value *uctl;
383 
384 	kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
385 	if (!kctl)
386 		return;
387 	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
388 	if (!uctl)
389 		return;
390 	val = snd_hda_codec_read(codec, jack->nid, 0,
391 				 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
392 	val &= HDA_AMP_VOLMASK;
393 	uctl->value.integer.value[0] = val;
394 	uctl->value.integer.value[1] = val;
395 	kctl->put(kctl, uctl);
396 	kfree(uctl);
397 }
398 
alc880_unsol_event(struct hda_codec * codec,unsigned int res)399 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
400 {
401 	/* For some reason, the res given from ALC880 is broken.
402 	   Here we adjust it properly. */
403 	snd_hda_jack_unsol_event(codec, res >> 2);
404 }
405 
406 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)407 static void alc_fill_eapd_coef(struct hda_codec *codec)
408 {
409 	int coef;
410 
411 	coef = alc_get_coef0(codec);
412 
413 	switch (codec->core.vendor_id) {
414 	case 0x10ec0262:
415 		alc_update_coef_idx(codec, 0x7, 0, 1<<5);
416 		break;
417 	case 0x10ec0267:
418 	case 0x10ec0268:
419 		alc_update_coef_idx(codec, 0x7, 0, 1<<13);
420 		break;
421 	case 0x10ec0269:
422 		if ((coef & 0x00f0) == 0x0010)
423 			alc_update_coef_idx(codec, 0xd, 0, 1<<14);
424 		if ((coef & 0x00f0) == 0x0020)
425 			alc_update_coef_idx(codec, 0x4, 1<<15, 0);
426 		if ((coef & 0x00f0) == 0x0030)
427 			alc_update_coef_idx(codec, 0x10, 1<<9, 0);
428 		break;
429 	case 0x10ec0280:
430 	case 0x10ec0284:
431 	case 0x10ec0290:
432 	case 0x10ec0292:
433 		alc_update_coef_idx(codec, 0x4, 1<<15, 0);
434 		break;
435 	case 0x10ec0225:
436 	case 0x10ec0295:
437 	case 0x10ec0299:
438 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
439 		fallthrough;
440 	case 0x10ec0215:
441 	case 0x10ec0285:
442 	case 0x10ec0289:
443 		alc_update_coef_idx(codec, 0x36, 1<<13, 0);
444 		fallthrough;
445 	case 0x10ec0230:
446 	case 0x10ec0233:
447 	case 0x10ec0235:
448 	case 0x10ec0236:
449 	case 0x10ec0245:
450 	case 0x10ec0255:
451 	case 0x10ec0256:
452 	case 0x19e58326:
453 	case 0x10ec0257:
454 	case 0x10ec0282:
455 	case 0x10ec0283:
456 	case 0x10ec0286:
457 	case 0x10ec0288:
458 	case 0x10ec0298:
459 	case 0x10ec0300:
460 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
461 		break;
462 	case 0x10ec0275:
463 		alc_update_coef_idx(codec, 0xe, 0, 1<<0);
464 		break;
465 	case 0x10ec0287:
466 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
467 		alc_write_coef_idx(codec, 0x8, 0x4ab7);
468 		break;
469 	case 0x10ec0293:
470 		alc_update_coef_idx(codec, 0xa, 1<<13, 0);
471 		break;
472 	case 0x10ec0234:
473 	case 0x10ec0274:
474 		alc_write_coef_idx(codec, 0x6e, 0x0c25);
475 		fallthrough;
476 	case 0x10ec0294:
477 	case 0x10ec0700:
478 	case 0x10ec0701:
479 	case 0x10ec0703:
480 	case 0x10ec0711:
481 		alc_update_coef_idx(codec, 0x10, 1<<15, 0);
482 		break;
483 	case 0x10ec0662:
484 		if ((coef & 0x00f0) == 0x0030)
485 			alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
486 		break;
487 	case 0x10ec0272:
488 	case 0x10ec0273:
489 	case 0x10ec0663:
490 	case 0x10ec0665:
491 	case 0x10ec0670:
492 	case 0x10ec0671:
493 	case 0x10ec0672:
494 		alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
495 		break;
496 	case 0x10ec0222:
497 	case 0x10ec0623:
498 		alc_update_coef_idx(codec, 0x19, 1<<13, 0);
499 		break;
500 	case 0x10ec0668:
501 		alc_update_coef_idx(codec, 0x7, 3<<13, 0);
502 		break;
503 	case 0x10ec0867:
504 		alc_update_coef_idx(codec, 0x4, 1<<10, 0);
505 		break;
506 	case 0x10ec0888:
507 		if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
508 			alc_update_coef_idx(codec, 0x7, 1<<5, 0);
509 		break;
510 	case 0x10ec0892:
511 	case 0x10ec0897:
512 		alc_update_coef_idx(codec, 0x7, 1<<5, 0);
513 		break;
514 	case 0x10ec0899:
515 	case 0x10ec0900:
516 	case 0x10ec0b00:
517 	case 0x10ec1168:
518 	case 0x10ec1220:
519 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
520 		break;
521 	}
522 }
523 
524 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)525 static void alc888_coef_init(struct hda_codec *codec)
526 {
527 	switch (alc_get_coef0(codec) & 0x00f0) {
528 	/* alc888-VA */
529 	case 0x00:
530 	/* alc888-VB */
531 	case 0x10:
532 		alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
533 		break;
534 	}
535 }
536 
537 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)538 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
539 {
540 	if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
541 		return;
542 	if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
543 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
544 				    on ? 2 : 0);
545 }
546 
547 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)548 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
549 {
550 	/* We currently only handle front, HP */
551 	static const hda_nid_t pins[] = {
552 		0x0f, 0x10, 0x14, 0x15, 0x17, 0
553 	};
554 	const hda_nid_t *p;
555 	for (p = pins; *p; p++)
556 		set_eapd(codec, *p, on);
557 }
558 
559 static int find_ext_mic_pin(struct hda_codec *codec);
560 
alc_headset_mic_no_shutup(struct hda_codec * codec)561 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
562 {
563 	const struct hda_pincfg *pin;
564 	int mic_pin = find_ext_mic_pin(codec);
565 	int i;
566 
567 	/* don't shut up pins when unloading the driver; otherwise it breaks
568 	 * the default pin setup at the next load of the driver
569 	 */
570 	if (codec->bus->shutdown)
571 		return;
572 
573 	snd_array_for_each(&codec->init_pins, i, pin) {
574 		/* use read here for syncing after issuing each verb */
575 		if (pin->nid != mic_pin)
576 			snd_hda_codec_read(codec, pin->nid, 0,
577 					AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
578 	}
579 
580 	codec->pins_shutup = 1;
581 }
582 
alc_shutup_pins(struct hda_codec * codec)583 static void alc_shutup_pins(struct hda_codec *codec)
584 {
585 	struct alc_spec *spec = codec->spec;
586 
587 	if (spec->no_shutup_pins)
588 		return;
589 
590 	switch (codec->core.vendor_id) {
591 	case 0x10ec0236:
592 	case 0x10ec0256:
593 	case 0x10ec0257:
594 	case 0x19e58326:
595 	case 0x10ec0283:
596 	case 0x10ec0285:
597 	case 0x10ec0286:
598 	case 0x10ec0287:
599 	case 0x10ec0288:
600 	case 0x10ec0295:
601 	case 0x10ec0298:
602 		alc_headset_mic_no_shutup(codec);
603 		break;
604 	default:
605 		snd_hda_shutup_pins(codec);
606 		break;
607 	}
608 }
609 
610 /* generic shutup callback;
611  * just turning off EAPD and a little pause for avoiding pop-noise
612  */
alc_eapd_shutup(struct hda_codec * codec)613 static void alc_eapd_shutup(struct hda_codec *codec)
614 {
615 	struct alc_spec *spec = codec->spec;
616 
617 	alc_auto_setup_eapd(codec, false);
618 	if (!spec->no_depop_delay)
619 		msleep(200);
620 	alc_shutup_pins(codec);
621 }
622 
623 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)624 static void alc_auto_init_amp(struct hda_codec *codec, int type)
625 {
626 	alc_auto_setup_eapd(codec, true);
627 	alc_write_gpio(codec);
628 	switch (type) {
629 	case ALC_INIT_DEFAULT:
630 		switch (codec->core.vendor_id) {
631 		case 0x10ec0260:
632 			alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
633 			break;
634 		case 0x10ec0880:
635 		case 0x10ec0882:
636 		case 0x10ec0883:
637 		case 0x10ec0885:
638 			alc_update_coef_idx(codec, 7, 0, 0x2030);
639 			break;
640 		case 0x10ec0888:
641 			alc888_coef_init(codec);
642 			break;
643 		}
644 		break;
645 	}
646 }
647 
648 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)649 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
650 {
651 	if (spec->gen.autocfg.hp_pins[0])
652 		return spec->gen.autocfg.hp_pins[0];
653 	if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
654 		return spec->gen.autocfg.line_out_pins[0];
655 	return 0;
656 }
657 
658 /*
659  * Realtek SSID verification
660  */
661 
662 /* Could be any non-zero and even value. When used as fixup, tells
663  * the driver to ignore any present sku defines.
664  */
665 #define ALC_FIXUP_SKU_IGNORE (2)
666 
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)667 static void alc_fixup_sku_ignore(struct hda_codec *codec,
668 				 const struct hda_fixup *fix, int action)
669 {
670 	struct alc_spec *spec = codec->spec;
671 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
672 		spec->cdefine.fixup = 1;
673 		spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
674 	}
675 }
676 
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)677 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
678 				    const struct hda_fixup *fix, int action)
679 {
680 	struct alc_spec *spec = codec->spec;
681 
682 	if (action == HDA_FIXUP_ACT_PROBE) {
683 		spec->no_depop_delay = 1;
684 		codec->depop_delay = 0;
685 	}
686 }
687 
alc_auto_parse_customize_define(struct hda_codec * codec)688 static int alc_auto_parse_customize_define(struct hda_codec *codec)
689 {
690 	unsigned int ass, tmp, i;
691 	unsigned nid = 0;
692 	struct alc_spec *spec = codec->spec;
693 
694 	spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
695 
696 	if (spec->cdefine.fixup) {
697 		ass = spec->cdefine.sku_cfg;
698 		if (ass == ALC_FIXUP_SKU_IGNORE)
699 			return -1;
700 		goto do_sku;
701 	}
702 
703 	if (!codec->bus->pci)
704 		return -1;
705 	ass = codec->core.subsystem_id & 0xffff;
706 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
707 		goto do_sku;
708 
709 	nid = 0x1d;
710 	if (codec->core.vendor_id == 0x10ec0260)
711 		nid = 0x17;
712 	ass = snd_hda_codec_get_pincfg(codec, nid);
713 
714 	if (!(ass & 1)) {
715 		codec_info(codec, "%s: SKU not ready 0x%08x\n",
716 			   codec->core.chip_name, ass);
717 		return -1;
718 	}
719 
720 	/* check sum */
721 	tmp = 0;
722 	for (i = 1; i < 16; i++) {
723 		if ((ass >> i) & 1)
724 			tmp++;
725 	}
726 	if (((ass >> 16) & 0xf) != tmp)
727 		return -1;
728 
729 	spec->cdefine.port_connectivity = ass >> 30;
730 	spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
731 	spec->cdefine.check_sum = (ass >> 16) & 0xf;
732 	spec->cdefine.customization = ass >> 8;
733 do_sku:
734 	spec->cdefine.sku_cfg = ass;
735 	spec->cdefine.external_amp = (ass & 0x38) >> 3;
736 	spec->cdefine.platform_type = (ass & 0x4) >> 2;
737 	spec->cdefine.swap = (ass & 0x2) >> 1;
738 	spec->cdefine.override = ass & 0x1;
739 
740 	codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
741 		   nid, spec->cdefine.sku_cfg);
742 	codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
743 		   spec->cdefine.port_connectivity);
744 	codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
745 	codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
746 	codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
747 	codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
748 	codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
749 	codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
750 	codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
751 
752 	return 0;
753 }
754 
755 /* return the position of NID in the list, or -1 if not found */
find_idx_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)756 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
757 {
758 	int i;
759 	for (i = 0; i < nums; i++)
760 		if (list[i] == nid)
761 			return i;
762 	return -1;
763 }
764 /* return true if the given NID is found in the list */
found_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)765 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
766 {
767 	return find_idx_in_nid_list(nid, list, nums) >= 0;
768 }
769 
770 /* check subsystem ID and set up device-specific initialization;
771  * return 1 if initialized, 0 if invalid SSID
772  */
773 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
774  *	31 ~ 16 :	Manufacture ID
775  *	15 ~ 8	:	SKU ID
776  *	7  ~ 0	:	Assembly ID
777  *	port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
778  */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)779 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
780 {
781 	unsigned int ass, tmp, i;
782 	unsigned nid;
783 	struct alc_spec *spec = codec->spec;
784 
785 	if (spec->cdefine.fixup) {
786 		ass = spec->cdefine.sku_cfg;
787 		if (ass == ALC_FIXUP_SKU_IGNORE)
788 			return 0;
789 		goto do_sku;
790 	}
791 
792 	ass = codec->core.subsystem_id & 0xffff;
793 	if (codec->bus->pci &&
794 	    ass != codec->bus->pci->subsystem_device && (ass & 1))
795 		goto do_sku;
796 
797 	/* invalid SSID, check the special NID pin defcfg instead */
798 	/*
799 	 * 31~30	: port connectivity
800 	 * 29~21	: reserve
801 	 * 20		: PCBEEP input
802 	 * 19~16	: Check sum (15:1)
803 	 * 15~1		: Custom
804 	 * 0		: override
805 	*/
806 	nid = 0x1d;
807 	if (codec->core.vendor_id == 0x10ec0260)
808 		nid = 0x17;
809 	ass = snd_hda_codec_get_pincfg(codec, nid);
810 	codec_dbg(codec,
811 		  "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
812 		   ass, nid);
813 	if (!(ass & 1))
814 		return 0;
815 	if ((ass >> 30) != 1)	/* no physical connection */
816 		return 0;
817 
818 	/* check sum */
819 	tmp = 0;
820 	for (i = 1; i < 16; i++) {
821 		if ((ass >> i) & 1)
822 			tmp++;
823 	}
824 	if (((ass >> 16) & 0xf) != tmp)
825 		return 0;
826 do_sku:
827 	codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
828 		   ass & 0xffff, codec->core.vendor_id);
829 	/*
830 	 * 0 : override
831 	 * 1 :	Swap Jack
832 	 * 2 : 0 --> Desktop, 1 --> Laptop
833 	 * 3~5 : External Amplifier control
834 	 * 7~6 : Reserved
835 	*/
836 	tmp = (ass & 0x38) >> 3;	/* external Amp control */
837 	if (spec->init_amp == ALC_INIT_UNDEFINED) {
838 		switch (tmp) {
839 		case 1:
840 			alc_setup_gpio(codec, 0x01);
841 			break;
842 		case 3:
843 			alc_setup_gpio(codec, 0x02);
844 			break;
845 		case 7:
846 			alc_setup_gpio(codec, 0x04);
847 			break;
848 		case 5:
849 		default:
850 			spec->init_amp = ALC_INIT_DEFAULT;
851 			break;
852 		}
853 	}
854 
855 	/* is laptop or Desktop and enable the function "Mute internal speaker
856 	 * when the external headphone out jack is plugged"
857 	 */
858 	if (!(ass & 0x8000))
859 		return 1;
860 	/*
861 	 * 10~8 : Jack location
862 	 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
863 	 * 14~13: Resvered
864 	 * 15   : 1 --> enable the function "Mute internal speaker
865 	 *	        when the external headphone out jack is plugged"
866 	 */
867 	if (!alc_get_hp_pin(spec)) {
868 		hda_nid_t nid;
869 		tmp = (ass >> 11) & 0x3;	/* HP to chassis */
870 		nid = ports[tmp];
871 		if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
872 				      spec->gen.autocfg.line_outs))
873 			return 1;
874 		spec->gen.autocfg.hp_pins[0] = nid;
875 	}
876 	return 1;
877 }
878 
879 /* Check the validity of ALC subsystem-id
880  * ports contains an array of 4 pin NIDs for port-A, E, D and I */
alc_ssid_check(struct hda_codec * codec,const hda_nid_t * ports)881 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
882 {
883 	if (!alc_subsystem_id(codec, ports)) {
884 		struct alc_spec *spec = codec->spec;
885 		if (spec->init_amp == ALC_INIT_UNDEFINED) {
886 			codec_dbg(codec,
887 				  "realtek: Enable default setup for auto mode as fallback\n");
888 			spec->init_amp = ALC_INIT_DEFAULT;
889 		}
890 	}
891 }
892 
893 /*
894  */
895 
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)896 static void alc_fixup_inv_dmic(struct hda_codec *codec,
897 			       const struct hda_fixup *fix, int action)
898 {
899 	struct alc_spec *spec = codec->spec;
900 
901 	spec->gen.inv_dmic_split = 1;
902 }
903 
904 
alc_build_controls(struct hda_codec * codec)905 static int alc_build_controls(struct hda_codec *codec)
906 {
907 	int err;
908 
909 	err = snd_hda_gen_build_controls(codec);
910 	if (err < 0)
911 		return err;
912 
913 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
914 	return 0;
915 }
916 
917 
918 /*
919  * Common callbacks
920  */
921 
alc_pre_init(struct hda_codec * codec)922 static void alc_pre_init(struct hda_codec *codec)
923 {
924 	alc_fill_eapd_coef(codec);
925 }
926 
927 #define is_s3_resume(codec) \
928 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
929 #define is_s4_resume(codec) \
930 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
931 
alc_init(struct hda_codec * codec)932 static int alc_init(struct hda_codec *codec)
933 {
934 	struct alc_spec *spec = codec->spec;
935 
936 	/* hibernation resume needs the full chip initialization */
937 	if (is_s4_resume(codec))
938 		alc_pre_init(codec);
939 
940 	if (spec->init_hook)
941 		spec->init_hook(codec);
942 
943 	spec->gen.skip_verbs = 1; /* applied in below */
944 	snd_hda_gen_init(codec);
945 	alc_fix_pll(codec);
946 	alc_auto_init_amp(codec, spec->init_amp);
947 	snd_hda_apply_verbs(codec); /* apply verbs here after own init */
948 
949 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
950 
951 	return 0;
952 }
953 
954 #define alc_free	snd_hda_gen_free
955 
956 #ifdef CONFIG_PM
alc_shutup(struct hda_codec * codec)957 static inline void alc_shutup(struct hda_codec *codec)
958 {
959 	struct alc_spec *spec = codec->spec;
960 
961 	if (!snd_hda_get_bool_hint(codec, "shutup"))
962 		return; /* disabled explicitly by hints */
963 
964 	if (spec && spec->shutup)
965 		spec->shutup(codec);
966 	else
967 		alc_shutup_pins(codec);
968 }
969 
alc_power_eapd(struct hda_codec * codec)970 static void alc_power_eapd(struct hda_codec *codec)
971 {
972 	alc_auto_setup_eapd(codec, false);
973 }
974 
alc_suspend(struct hda_codec * codec)975 static int alc_suspend(struct hda_codec *codec)
976 {
977 	struct alc_spec *spec = codec->spec;
978 	alc_shutup(codec);
979 	if (spec && spec->power_hook)
980 		spec->power_hook(codec);
981 	return 0;
982 }
983 
alc_resume(struct hda_codec * codec)984 static int alc_resume(struct hda_codec *codec)
985 {
986 	struct alc_spec *spec = codec->spec;
987 
988 	if (!spec->no_depop_delay)
989 		msleep(150); /* to avoid pop noise */
990 	codec->patch_ops.init(codec);
991 	snd_hda_regmap_sync(codec);
992 	hda_call_check_power_status(codec, 0x01);
993 	return 0;
994 }
995 #endif
996 
997 /*
998  */
999 static const struct hda_codec_ops alc_patch_ops = {
1000 	.build_controls = alc_build_controls,
1001 	.build_pcms = snd_hda_gen_build_pcms,
1002 	.init = alc_init,
1003 	.free = alc_free,
1004 	.unsol_event = snd_hda_jack_unsol_event,
1005 #ifdef CONFIG_PM
1006 	.resume = alc_resume,
1007 	.suspend = alc_suspend,
1008 	.check_power_status = snd_hda_gen_check_power_status,
1009 #endif
1010 };
1011 
1012 
1013 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1014 
1015 /*
1016  * Rename codecs appropriately from COEF value or subvendor id
1017  */
1018 struct alc_codec_rename_table {
1019 	unsigned int vendor_id;
1020 	unsigned short coef_mask;
1021 	unsigned short coef_bits;
1022 	const char *name;
1023 };
1024 
1025 struct alc_codec_rename_pci_table {
1026 	unsigned int codec_vendor_id;
1027 	unsigned short pci_subvendor;
1028 	unsigned short pci_subdevice;
1029 	const char *name;
1030 };
1031 
1032 static const struct alc_codec_rename_table rename_tbl[] = {
1033 	{ 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1034 	{ 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1035 	{ 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1036 	{ 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1037 	{ 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1038 	{ 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1039 	{ 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1040 	{ 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1041 	{ 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1042 	{ 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1043 	{ 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1044 	{ 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1045 	{ 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1046 	{ 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1047 	{ 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1048 	{ 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1049 	{ 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1050 	{ } /* terminator */
1051 };
1052 
1053 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1054 	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
1055 	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
1056 	{ 0x10ec0283, 0x1028, 0, "ALC3223" },
1057 	{ 0x10ec0288, 0x1028, 0, "ALC3263" },
1058 	{ 0x10ec0292, 0x1028, 0, "ALC3226" },
1059 	{ 0x10ec0293, 0x1028, 0, "ALC3235" },
1060 	{ 0x10ec0255, 0x1028, 0, "ALC3234" },
1061 	{ 0x10ec0668, 0x1028, 0, "ALC3661" },
1062 	{ 0x10ec0275, 0x1028, 0, "ALC3260" },
1063 	{ 0x10ec0899, 0x1028, 0, "ALC3861" },
1064 	{ 0x10ec0298, 0x1028, 0, "ALC3266" },
1065 	{ 0x10ec0236, 0x1028, 0, "ALC3204" },
1066 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
1067 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
1068 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
1069 	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
1070 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
1071 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
1072 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
1073 	{ 0x10ec0233, 0x1043, 0, "ALC3236" },
1074 	{ 0x10ec0280, 0x103c, 0, "ALC3228" },
1075 	{ 0x10ec0282, 0x103c, 0, "ALC3227" },
1076 	{ 0x10ec0286, 0x103c, 0, "ALC3242" },
1077 	{ 0x10ec0290, 0x103c, 0, "ALC3241" },
1078 	{ 0x10ec0668, 0x103c, 0, "ALC3662" },
1079 	{ 0x10ec0283, 0x17aa, 0, "ALC3239" },
1080 	{ 0x10ec0292, 0x17aa, 0, "ALC3232" },
1081 	{ } /* terminator */
1082 };
1083 
alc_codec_rename_from_preset(struct hda_codec * codec)1084 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1085 {
1086 	const struct alc_codec_rename_table *p;
1087 	const struct alc_codec_rename_pci_table *q;
1088 
1089 	for (p = rename_tbl; p->vendor_id; p++) {
1090 		if (p->vendor_id != codec->core.vendor_id)
1091 			continue;
1092 		if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1093 			return alc_codec_rename(codec, p->name);
1094 	}
1095 
1096 	if (!codec->bus->pci)
1097 		return 0;
1098 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1099 		if (q->codec_vendor_id != codec->core.vendor_id)
1100 			continue;
1101 		if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1102 			continue;
1103 		if (!q->pci_subdevice ||
1104 		    q->pci_subdevice == codec->bus->pci->subsystem_device)
1105 			return alc_codec_rename(codec, q->name);
1106 	}
1107 
1108 	return 0;
1109 }
1110 
1111 
1112 /*
1113  * Digital-beep handlers
1114  */
1115 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1116 
1117 /* additional beep mixers; private_value will be overwritten */
1118 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1119 	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1120 	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1121 };
1122 
1123 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1124 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1125 			int idx, int dir)
1126 {
1127 	struct snd_kcontrol_new *knew;
1128 	unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1129 	int i;
1130 
1131 	for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1132 		knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1133 					    &alc_beep_mixer[i]);
1134 		if (!knew)
1135 			return -ENOMEM;
1136 		knew->private_value = beep_amp;
1137 	}
1138 	return 0;
1139 }
1140 
1141 static const struct snd_pci_quirk beep_allow_list[] = {
1142 	SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1143 	SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1144 	SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1145 	SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1146 	SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1147 	SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1148 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1149 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1150 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1151 	/* denylist -- no beep available */
1152 	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1153 	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1154 	{}
1155 };
1156 
has_cdefine_beep(struct hda_codec * codec)1157 static inline int has_cdefine_beep(struct hda_codec *codec)
1158 {
1159 	struct alc_spec *spec = codec->spec;
1160 	const struct snd_pci_quirk *q;
1161 	q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1162 	if (q)
1163 		return q->value;
1164 	return spec->cdefine.enable_pcbeep;
1165 }
1166 #else
1167 #define set_beep_amp(spec, nid, idx, dir)	0
1168 #define has_cdefine_beep(codec)		0
1169 #endif
1170 
1171 /* parse the BIOS configuration and set up the alc_spec */
1172 /* return 1 if successful, 0 if the proper config is not found,
1173  * or a negative error code
1174  */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1175 static int alc_parse_auto_config(struct hda_codec *codec,
1176 				 const hda_nid_t *ignore_nids,
1177 				 const hda_nid_t *ssid_nids)
1178 {
1179 	struct alc_spec *spec = codec->spec;
1180 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1181 	int err;
1182 
1183 	err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1184 				       spec->parse_flags);
1185 	if (err < 0)
1186 		return err;
1187 
1188 	if (ssid_nids)
1189 		alc_ssid_check(codec, ssid_nids);
1190 
1191 	err = snd_hda_gen_parse_auto_config(codec, cfg);
1192 	if (err < 0)
1193 		return err;
1194 
1195 	return 1;
1196 }
1197 
1198 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1199 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1200 {
1201 	struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1202 	int err;
1203 
1204 	if (!spec)
1205 		return -ENOMEM;
1206 	codec->spec = spec;
1207 	snd_hda_gen_spec_init(&spec->gen);
1208 	spec->gen.mixer_nid = mixer_nid;
1209 	spec->gen.own_eapd_ctl = 1;
1210 	codec->single_adc_amp = 1;
1211 	/* FIXME: do we need this for all Realtek codec models? */
1212 	codec->spdif_status_reset = 1;
1213 	codec->forced_resume = 1;
1214 	codec->patch_ops = alc_patch_ops;
1215 	mutex_init(&spec->coef_mutex);
1216 
1217 	err = alc_codec_rename_from_preset(codec);
1218 	if (err < 0) {
1219 		kfree(spec);
1220 		return err;
1221 	}
1222 	return 0;
1223 }
1224 
alc880_parse_auto_config(struct hda_codec * codec)1225 static int alc880_parse_auto_config(struct hda_codec *codec)
1226 {
1227 	static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1228 	static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1229 	return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1230 }
1231 
1232 /*
1233  * ALC880 fix-ups
1234  */
1235 enum {
1236 	ALC880_FIXUP_GPIO1,
1237 	ALC880_FIXUP_GPIO2,
1238 	ALC880_FIXUP_MEDION_RIM,
1239 	ALC880_FIXUP_LG,
1240 	ALC880_FIXUP_LG_LW25,
1241 	ALC880_FIXUP_W810,
1242 	ALC880_FIXUP_EAPD_COEF,
1243 	ALC880_FIXUP_TCL_S700,
1244 	ALC880_FIXUP_VOL_KNOB,
1245 	ALC880_FIXUP_FUJITSU,
1246 	ALC880_FIXUP_F1734,
1247 	ALC880_FIXUP_UNIWILL,
1248 	ALC880_FIXUP_UNIWILL_DIG,
1249 	ALC880_FIXUP_Z71V,
1250 	ALC880_FIXUP_ASUS_W5A,
1251 	ALC880_FIXUP_3ST_BASE,
1252 	ALC880_FIXUP_3ST,
1253 	ALC880_FIXUP_3ST_DIG,
1254 	ALC880_FIXUP_5ST_BASE,
1255 	ALC880_FIXUP_5ST,
1256 	ALC880_FIXUP_5ST_DIG,
1257 	ALC880_FIXUP_6ST_BASE,
1258 	ALC880_FIXUP_6ST,
1259 	ALC880_FIXUP_6ST_DIG,
1260 	ALC880_FIXUP_6ST_AUTOMUTE,
1261 };
1262 
1263 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1264 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1265 				  const struct hda_fixup *fix, int action)
1266 {
1267 	if (action == HDA_FIXUP_ACT_PROBE)
1268 		snd_hda_jack_detect_enable_callback(codec, 0x21,
1269 						    alc_update_knob_master);
1270 }
1271 
1272 static const struct hda_fixup alc880_fixups[] = {
1273 	[ALC880_FIXUP_GPIO1] = {
1274 		.type = HDA_FIXUP_FUNC,
1275 		.v.func = alc_fixup_gpio1,
1276 	},
1277 	[ALC880_FIXUP_GPIO2] = {
1278 		.type = HDA_FIXUP_FUNC,
1279 		.v.func = alc_fixup_gpio2,
1280 	},
1281 	[ALC880_FIXUP_MEDION_RIM] = {
1282 		.type = HDA_FIXUP_VERBS,
1283 		.v.verbs = (const struct hda_verb[]) {
1284 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1285 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1286 			{ }
1287 		},
1288 		.chained = true,
1289 		.chain_id = ALC880_FIXUP_GPIO2,
1290 	},
1291 	[ALC880_FIXUP_LG] = {
1292 		.type = HDA_FIXUP_PINS,
1293 		.v.pins = (const struct hda_pintbl[]) {
1294 			/* disable bogus unused pins */
1295 			{ 0x16, 0x411111f0 },
1296 			{ 0x18, 0x411111f0 },
1297 			{ 0x1a, 0x411111f0 },
1298 			{ }
1299 		}
1300 	},
1301 	[ALC880_FIXUP_LG_LW25] = {
1302 		.type = HDA_FIXUP_PINS,
1303 		.v.pins = (const struct hda_pintbl[]) {
1304 			{ 0x1a, 0x0181344f }, /* line-in */
1305 			{ 0x1b, 0x0321403f }, /* headphone */
1306 			{ }
1307 		}
1308 	},
1309 	[ALC880_FIXUP_W810] = {
1310 		.type = HDA_FIXUP_PINS,
1311 		.v.pins = (const struct hda_pintbl[]) {
1312 			/* disable bogus unused pins */
1313 			{ 0x17, 0x411111f0 },
1314 			{ }
1315 		},
1316 		.chained = true,
1317 		.chain_id = ALC880_FIXUP_GPIO2,
1318 	},
1319 	[ALC880_FIXUP_EAPD_COEF] = {
1320 		.type = HDA_FIXUP_VERBS,
1321 		.v.verbs = (const struct hda_verb[]) {
1322 			/* change to EAPD mode */
1323 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1324 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1325 			{}
1326 		},
1327 	},
1328 	[ALC880_FIXUP_TCL_S700] = {
1329 		.type = HDA_FIXUP_VERBS,
1330 		.v.verbs = (const struct hda_verb[]) {
1331 			/* change to EAPD mode */
1332 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1333 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3070 },
1334 			{}
1335 		},
1336 		.chained = true,
1337 		.chain_id = ALC880_FIXUP_GPIO2,
1338 	},
1339 	[ALC880_FIXUP_VOL_KNOB] = {
1340 		.type = HDA_FIXUP_FUNC,
1341 		.v.func = alc880_fixup_vol_knob,
1342 	},
1343 	[ALC880_FIXUP_FUJITSU] = {
1344 		/* override all pins as BIOS on old Amilo is broken */
1345 		.type = HDA_FIXUP_PINS,
1346 		.v.pins = (const struct hda_pintbl[]) {
1347 			{ 0x14, 0x0121401f }, /* HP */
1348 			{ 0x15, 0x99030120 }, /* speaker */
1349 			{ 0x16, 0x99030130 }, /* bass speaker */
1350 			{ 0x17, 0x411111f0 }, /* N/A */
1351 			{ 0x18, 0x411111f0 }, /* N/A */
1352 			{ 0x19, 0x01a19950 }, /* mic-in */
1353 			{ 0x1a, 0x411111f0 }, /* N/A */
1354 			{ 0x1b, 0x411111f0 }, /* N/A */
1355 			{ 0x1c, 0x411111f0 }, /* N/A */
1356 			{ 0x1d, 0x411111f0 }, /* N/A */
1357 			{ 0x1e, 0x01454140 }, /* SPDIF out */
1358 			{ }
1359 		},
1360 		.chained = true,
1361 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1362 	},
1363 	[ALC880_FIXUP_F1734] = {
1364 		/* almost compatible with FUJITSU, but no bass and SPDIF */
1365 		.type = HDA_FIXUP_PINS,
1366 		.v.pins = (const struct hda_pintbl[]) {
1367 			{ 0x14, 0x0121401f }, /* HP */
1368 			{ 0x15, 0x99030120 }, /* speaker */
1369 			{ 0x16, 0x411111f0 }, /* N/A */
1370 			{ 0x17, 0x411111f0 }, /* N/A */
1371 			{ 0x18, 0x411111f0 }, /* N/A */
1372 			{ 0x19, 0x01a19950 }, /* mic-in */
1373 			{ 0x1a, 0x411111f0 }, /* N/A */
1374 			{ 0x1b, 0x411111f0 }, /* N/A */
1375 			{ 0x1c, 0x411111f0 }, /* N/A */
1376 			{ 0x1d, 0x411111f0 }, /* N/A */
1377 			{ 0x1e, 0x411111f0 }, /* N/A */
1378 			{ }
1379 		},
1380 		.chained = true,
1381 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1382 	},
1383 	[ALC880_FIXUP_UNIWILL] = {
1384 		/* need to fix HP and speaker pins to be parsed correctly */
1385 		.type = HDA_FIXUP_PINS,
1386 		.v.pins = (const struct hda_pintbl[]) {
1387 			{ 0x14, 0x0121411f }, /* HP */
1388 			{ 0x15, 0x99030120 }, /* speaker */
1389 			{ 0x16, 0x99030130 }, /* bass speaker */
1390 			{ }
1391 		},
1392 	},
1393 	[ALC880_FIXUP_UNIWILL_DIG] = {
1394 		.type = HDA_FIXUP_PINS,
1395 		.v.pins = (const struct hda_pintbl[]) {
1396 			/* disable bogus unused pins */
1397 			{ 0x17, 0x411111f0 },
1398 			{ 0x19, 0x411111f0 },
1399 			{ 0x1b, 0x411111f0 },
1400 			{ 0x1f, 0x411111f0 },
1401 			{ }
1402 		}
1403 	},
1404 	[ALC880_FIXUP_Z71V] = {
1405 		.type = HDA_FIXUP_PINS,
1406 		.v.pins = (const struct hda_pintbl[]) {
1407 			/* set up the whole pins as BIOS is utterly broken */
1408 			{ 0x14, 0x99030120 }, /* speaker */
1409 			{ 0x15, 0x0121411f }, /* HP */
1410 			{ 0x16, 0x411111f0 }, /* N/A */
1411 			{ 0x17, 0x411111f0 }, /* N/A */
1412 			{ 0x18, 0x01a19950 }, /* mic-in */
1413 			{ 0x19, 0x411111f0 }, /* N/A */
1414 			{ 0x1a, 0x01813031 }, /* line-in */
1415 			{ 0x1b, 0x411111f0 }, /* N/A */
1416 			{ 0x1c, 0x411111f0 }, /* N/A */
1417 			{ 0x1d, 0x411111f0 }, /* N/A */
1418 			{ 0x1e, 0x0144111e }, /* SPDIF */
1419 			{ }
1420 		}
1421 	},
1422 	[ALC880_FIXUP_ASUS_W5A] = {
1423 		.type = HDA_FIXUP_PINS,
1424 		.v.pins = (const struct hda_pintbl[]) {
1425 			/* set up the whole pins as BIOS is utterly broken */
1426 			{ 0x14, 0x0121411f }, /* HP */
1427 			{ 0x15, 0x411111f0 }, /* N/A */
1428 			{ 0x16, 0x411111f0 }, /* N/A */
1429 			{ 0x17, 0x411111f0 }, /* N/A */
1430 			{ 0x18, 0x90a60160 }, /* mic */
1431 			{ 0x19, 0x411111f0 }, /* N/A */
1432 			{ 0x1a, 0x411111f0 }, /* N/A */
1433 			{ 0x1b, 0x411111f0 }, /* N/A */
1434 			{ 0x1c, 0x411111f0 }, /* N/A */
1435 			{ 0x1d, 0x411111f0 }, /* N/A */
1436 			{ 0x1e, 0xb743111e }, /* SPDIF out */
1437 			{ }
1438 		},
1439 		.chained = true,
1440 		.chain_id = ALC880_FIXUP_GPIO1,
1441 	},
1442 	[ALC880_FIXUP_3ST_BASE] = {
1443 		.type = HDA_FIXUP_PINS,
1444 		.v.pins = (const struct hda_pintbl[]) {
1445 			{ 0x14, 0x01014010 }, /* line-out */
1446 			{ 0x15, 0x411111f0 }, /* N/A */
1447 			{ 0x16, 0x411111f0 }, /* N/A */
1448 			{ 0x17, 0x411111f0 }, /* N/A */
1449 			{ 0x18, 0x01a19c30 }, /* mic-in */
1450 			{ 0x19, 0x0121411f }, /* HP */
1451 			{ 0x1a, 0x01813031 }, /* line-in */
1452 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1453 			{ 0x1c, 0x411111f0 }, /* N/A */
1454 			{ 0x1d, 0x411111f0 }, /* N/A */
1455 			/* 0x1e is filled in below */
1456 			{ 0x1f, 0x411111f0 }, /* N/A */
1457 			{ }
1458 		}
1459 	},
1460 	[ALC880_FIXUP_3ST] = {
1461 		.type = HDA_FIXUP_PINS,
1462 		.v.pins = (const struct hda_pintbl[]) {
1463 			{ 0x1e, 0x411111f0 }, /* N/A */
1464 			{ }
1465 		},
1466 		.chained = true,
1467 		.chain_id = ALC880_FIXUP_3ST_BASE,
1468 	},
1469 	[ALC880_FIXUP_3ST_DIG] = {
1470 		.type = HDA_FIXUP_PINS,
1471 		.v.pins = (const struct hda_pintbl[]) {
1472 			{ 0x1e, 0x0144111e }, /* SPDIF */
1473 			{ }
1474 		},
1475 		.chained = true,
1476 		.chain_id = ALC880_FIXUP_3ST_BASE,
1477 	},
1478 	[ALC880_FIXUP_5ST_BASE] = {
1479 		.type = HDA_FIXUP_PINS,
1480 		.v.pins = (const struct hda_pintbl[]) {
1481 			{ 0x14, 0x01014010 }, /* front */
1482 			{ 0x15, 0x411111f0 }, /* N/A */
1483 			{ 0x16, 0x01011411 }, /* CLFE */
1484 			{ 0x17, 0x01016412 }, /* surr */
1485 			{ 0x18, 0x01a19c30 }, /* mic-in */
1486 			{ 0x19, 0x0121411f }, /* HP */
1487 			{ 0x1a, 0x01813031 }, /* line-in */
1488 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1489 			{ 0x1c, 0x411111f0 }, /* N/A */
1490 			{ 0x1d, 0x411111f0 }, /* N/A */
1491 			/* 0x1e is filled in below */
1492 			{ 0x1f, 0x411111f0 }, /* N/A */
1493 			{ }
1494 		}
1495 	},
1496 	[ALC880_FIXUP_5ST] = {
1497 		.type = HDA_FIXUP_PINS,
1498 		.v.pins = (const struct hda_pintbl[]) {
1499 			{ 0x1e, 0x411111f0 }, /* N/A */
1500 			{ }
1501 		},
1502 		.chained = true,
1503 		.chain_id = ALC880_FIXUP_5ST_BASE,
1504 	},
1505 	[ALC880_FIXUP_5ST_DIG] = {
1506 		.type = HDA_FIXUP_PINS,
1507 		.v.pins = (const struct hda_pintbl[]) {
1508 			{ 0x1e, 0x0144111e }, /* SPDIF */
1509 			{ }
1510 		},
1511 		.chained = true,
1512 		.chain_id = ALC880_FIXUP_5ST_BASE,
1513 	},
1514 	[ALC880_FIXUP_6ST_BASE] = {
1515 		.type = HDA_FIXUP_PINS,
1516 		.v.pins = (const struct hda_pintbl[]) {
1517 			{ 0x14, 0x01014010 }, /* front */
1518 			{ 0x15, 0x01016412 }, /* surr */
1519 			{ 0x16, 0x01011411 }, /* CLFE */
1520 			{ 0x17, 0x01012414 }, /* side */
1521 			{ 0x18, 0x01a19c30 }, /* mic-in */
1522 			{ 0x19, 0x02a19c40 }, /* front-mic */
1523 			{ 0x1a, 0x01813031 }, /* line-in */
1524 			{ 0x1b, 0x0121411f }, /* HP */
1525 			{ 0x1c, 0x411111f0 }, /* N/A */
1526 			{ 0x1d, 0x411111f0 }, /* N/A */
1527 			/* 0x1e is filled in below */
1528 			{ 0x1f, 0x411111f0 }, /* N/A */
1529 			{ }
1530 		}
1531 	},
1532 	[ALC880_FIXUP_6ST] = {
1533 		.type = HDA_FIXUP_PINS,
1534 		.v.pins = (const struct hda_pintbl[]) {
1535 			{ 0x1e, 0x411111f0 }, /* N/A */
1536 			{ }
1537 		},
1538 		.chained = true,
1539 		.chain_id = ALC880_FIXUP_6ST_BASE,
1540 	},
1541 	[ALC880_FIXUP_6ST_DIG] = {
1542 		.type = HDA_FIXUP_PINS,
1543 		.v.pins = (const struct hda_pintbl[]) {
1544 			{ 0x1e, 0x0144111e }, /* SPDIF */
1545 			{ }
1546 		},
1547 		.chained = true,
1548 		.chain_id = ALC880_FIXUP_6ST_BASE,
1549 	},
1550 	[ALC880_FIXUP_6ST_AUTOMUTE] = {
1551 		.type = HDA_FIXUP_PINS,
1552 		.v.pins = (const struct hda_pintbl[]) {
1553 			{ 0x1b, 0x0121401f }, /* HP with jack detect */
1554 			{ }
1555 		},
1556 		.chained_before = true,
1557 		.chain_id = ALC880_FIXUP_6ST_BASE,
1558 	},
1559 };
1560 
1561 static const struct hda_quirk alc880_fixup_tbl[] = {
1562 	SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1563 	SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1564 	SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1565 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1566 	SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1567 	SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1568 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1569 	SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1570 	SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1571 	SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1572 	SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1573 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1574 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1575 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1576 	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1577 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1578 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1579 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1580 	SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1581 	SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1582 	SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1583 	SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1584 	SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1585 
1586 	/* Below is the copied entries from alc880_quirks.c.
1587 	 * It's not quite sure whether BIOS sets the correct pin-config table
1588 	 * on these machines, thus they are kept to be compatible with
1589 	 * the old static quirks.  Once when it's confirmed to work without
1590 	 * these overrides, it'd be better to remove.
1591 	 */
1592 	SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1593 	SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1594 	SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1595 	SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1596 	SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1597 	SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1598 	SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1599 	SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1600 	SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1601 	SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1602 	SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1603 	SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1604 	SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1605 	SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1606 	SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1607 	SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1608 	SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1609 	SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1610 	SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1611 	SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1612 	SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1613 	SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1614 	SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1615 	SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1616 	SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1617 	SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1618 	SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1619 	SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1620 	SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1621 	SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1622 	SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1623 	SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1624 	SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1625 	/* default Intel */
1626 	SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1627 	SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1628 	SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1629 	{}
1630 };
1631 
1632 static const struct hda_model_fixup alc880_fixup_models[] = {
1633 	{.id = ALC880_FIXUP_3ST, .name = "3stack"},
1634 	{.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1635 	{.id = ALC880_FIXUP_5ST, .name = "5stack"},
1636 	{.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1637 	{.id = ALC880_FIXUP_6ST, .name = "6stack"},
1638 	{.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1639 	{.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1640 	{}
1641 };
1642 
1643 
1644 /*
1645  * OK, here we have finally the patch for ALC880
1646  */
patch_alc880(struct hda_codec * codec)1647 static int patch_alc880(struct hda_codec *codec)
1648 {
1649 	struct alc_spec *spec;
1650 	int err;
1651 
1652 	err = alc_alloc_spec(codec, 0x0b);
1653 	if (err < 0)
1654 		return err;
1655 
1656 	spec = codec->spec;
1657 	spec->gen.need_dac_fix = 1;
1658 	spec->gen.beep_nid = 0x01;
1659 
1660 	codec->patch_ops.unsol_event = alc880_unsol_event;
1661 
1662 	alc_pre_init(codec);
1663 
1664 	snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1665 		       alc880_fixups);
1666 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1667 
1668 	/* automatic parse from the BIOS config */
1669 	err = alc880_parse_auto_config(codec);
1670 	if (err < 0)
1671 		goto error;
1672 
1673 	if (!spec->gen.no_analog) {
1674 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1675 		if (err < 0)
1676 			goto error;
1677 	}
1678 
1679 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1680 
1681 	return 0;
1682 
1683  error:
1684 	alc_free(codec);
1685 	return err;
1686 }
1687 
1688 
1689 /*
1690  * ALC260 support
1691  */
alc260_parse_auto_config(struct hda_codec * codec)1692 static int alc260_parse_auto_config(struct hda_codec *codec)
1693 {
1694 	static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1695 	static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1696 	return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1697 }
1698 
1699 /*
1700  * Pin config fixes
1701  */
1702 enum {
1703 	ALC260_FIXUP_HP_DC5750,
1704 	ALC260_FIXUP_HP_PIN_0F,
1705 	ALC260_FIXUP_COEF,
1706 	ALC260_FIXUP_GPIO1,
1707 	ALC260_FIXUP_GPIO1_TOGGLE,
1708 	ALC260_FIXUP_REPLACER,
1709 	ALC260_FIXUP_HP_B1900,
1710 	ALC260_FIXUP_KN1,
1711 	ALC260_FIXUP_FSC_S7020,
1712 	ALC260_FIXUP_FSC_S7020_JWSE,
1713 	ALC260_FIXUP_VAIO_PINS,
1714 };
1715 
alc260_gpio1_automute(struct hda_codec * codec)1716 static void alc260_gpio1_automute(struct hda_codec *codec)
1717 {
1718 	struct alc_spec *spec = codec->spec;
1719 
1720 	alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1721 }
1722 
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1723 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1724 				      const struct hda_fixup *fix, int action)
1725 {
1726 	struct alc_spec *spec = codec->spec;
1727 	if (action == HDA_FIXUP_ACT_PROBE) {
1728 		/* although the machine has only one output pin, we need to
1729 		 * toggle GPIO1 according to the jack state
1730 		 */
1731 		spec->gen.automute_hook = alc260_gpio1_automute;
1732 		spec->gen.detect_hp = 1;
1733 		spec->gen.automute_speaker = 1;
1734 		spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1735 		snd_hda_jack_detect_enable_callback(codec, 0x0f,
1736 						    snd_hda_gen_hp_automute);
1737 		alc_setup_gpio(codec, 0x01);
1738 	}
1739 }
1740 
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1741 static void alc260_fixup_kn1(struct hda_codec *codec,
1742 			     const struct hda_fixup *fix, int action)
1743 {
1744 	struct alc_spec *spec = codec->spec;
1745 	static const struct hda_pintbl pincfgs[] = {
1746 		{ 0x0f, 0x02214000 }, /* HP/speaker */
1747 		{ 0x12, 0x90a60160 }, /* int mic */
1748 		{ 0x13, 0x02a19000 }, /* ext mic */
1749 		{ 0x18, 0x01446000 }, /* SPDIF out */
1750 		/* disable bogus I/O pins */
1751 		{ 0x10, 0x411111f0 },
1752 		{ 0x11, 0x411111f0 },
1753 		{ 0x14, 0x411111f0 },
1754 		{ 0x15, 0x411111f0 },
1755 		{ 0x16, 0x411111f0 },
1756 		{ 0x17, 0x411111f0 },
1757 		{ 0x19, 0x411111f0 },
1758 		{ }
1759 	};
1760 
1761 	switch (action) {
1762 	case HDA_FIXUP_ACT_PRE_PROBE:
1763 		snd_hda_apply_pincfgs(codec, pincfgs);
1764 		spec->init_amp = ALC_INIT_NONE;
1765 		break;
1766 	}
1767 }
1768 
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1769 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1770 				   const struct hda_fixup *fix, int action)
1771 {
1772 	struct alc_spec *spec = codec->spec;
1773 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
1774 		spec->init_amp = ALC_INIT_NONE;
1775 }
1776 
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1777 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1778 				   const struct hda_fixup *fix, int action)
1779 {
1780 	struct alc_spec *spec = codec->spec;
1781 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1782 		spec->gen.add_jack_modes = 1;
1783 		spec->gen.hp_mic = 1;
1784 	}
1785 }
1786 
1787 static const struct hda_fixup alc260_fixups[] = {
1788 	[ALC260_FIXUP_HP_DC5750] = {
1789 		.type = HDA_FIXUP_PINS,
1790 		.v.pins = (const struct hda_pintbl[]) {
1791 			{ 0x11, 0x90130110 }, /* speaker */
1792 			{ }
1793 		}
1794 	},
1795 	[ALC260_FIXUP_HP_PIN_0F] = {
1796 		.type = HDA_FIXUP_PINS,
1797 		.v.pins = (const struct hda_pintbl[]) {
1798 			{ 0x0f, 0x01214000 }, /* HP */
1799 			{ }
1800 		}
1801 	},
1802 	[ALC260_FIXUP_COEF] = {
1803 		.type = HDA_FIXUP_VERBS,
1804 		.v.verbs = (const struct hda_verb[]) {
1805 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1806 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3040 },
1807 			{ }
1808 		},
1809 	},
1810 	[ALC260_FIXUP_GPIO1] = {
1811 		.type = HDA_FIXUP_FUNC,
1812 		.v.func = alc_fixup_gpio1,
1813 	},
1814 	[ALC260_FIXUP_GPIO1_TOGGLE] = {
1815 		.type = HDA_FIXUP_FUNC,
1816 		.v.func = alc260_fixup_gpio1_toggle,
1817 		.chained = true,
1818 		.chain_id = ALC260_FIXUP_HP_PIN_0F,
1819 	},
1820 	[ALC260_FIXUP_REPLACER] = {
1821 		.type = HDA_FIXUP_VERBS,
1822 		.v.verbs = (const struct hda_verb[]) {
1823 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1824 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3050 },
1825 			{ }
1826 		},
1827 		.chained = true,
1828 		.chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1829 	},
1830 	[ALC260_FIXUP_HP_B1900] = {
1831 		.type = HDA_FIXUP_FUNC,
1832 		.v.func = alc260_fixup_gpio1_toggle,
1833 		.chained = true,
1834 		.chain_id = ALC260_FIXUP_COEF,
1835 	},
1836 	[ALC260_FIXUP_KN1] = {
1837 		.type = HDA_FIXUP_FUNC,
1838 		.v.func = alc260_fixup_kn1,
1839 	},
1840 	[ALC260_FIXUP_FSC_S7020] = {
1841 		.type = HDA_FIXUP_FUNC,
1842 		.v.func = alc260_fixup_fsc_s7020,
1843 	},
1844 	[ALC260_FIXUP_FSC_S7020_JWSE] = {
1845 		.type = HDA_FIXUP_FUNC,
1846 		.v.func = alc260_fixup_fsc_s7020_jwse,
1847 		.chained = true,
1848 		.chain_id = ALC260_FIXUP_FSC_S7020,
1849 	},
1850 	[ALC260_FIXUP_VAIO_PINS] = {
1851 		.type = HDA_FIXUP_PINS,
1852 		.v.pins = (const struct hda_pintbl[]) {
1853 			/* Pin configs are missing completely on some VAIOs */
1854 			{ 0x0f, 0x01211020 },
1855 			{ 0x10, 0x0001003f },
1856 			{ 0x11, 0x411111f0 },
1857 			{ 0x12, 0x01a15930 },
1858 			{ 0x13, 0x411111f0 },
1859 			{ 0x14, 0x411111f0 },
1860 			{ 0x15, 0x411111f0 },
1861 			{ 0x16, 0x411111f0 },
1862 			{ 0x17, 0x411111f0 },
1863 			{ 0x18, 0x411111f0 },
1864 			{ 0x19, 0x411111f0 },
1865 			{ }
1866 		}
1867 	},
1868 };
1869 
1870 static const struct hda_quirk alc260_fixup_tbl[] = {
1871 	SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1872 	SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1873 	SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1874 	SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1875 	SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1876 	SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1877 	SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1878 	SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1879 	SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1880 	SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1881 	SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1882 	SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1883 	{}
1884 };
1885 
1886 static const struct hda_model_fixup alc260_fixup_models[] = {
1887 	{.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1888 	{.id = ALC260_FIXUP_COEF, .name = "coef"},
1889 	{.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1890 	{.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1891 	{}
1892 };
1893 
1894 /*
1895  */
patch_alc260(struct hda_codec * codec)1896 static int patch_alc260(struct hda_codec *codec)
1897 {
1898 	struct alc_spec *spec;
1899 	int err;
1900 
1901 	err = alc_alloc_spec(codec, 0x07);
1902 	if (err < 0)
1903 		return err;
1904 
1905 	spec = codec->spec;
1906 	/* as quite a few machines require HP amp for speaker outputs,
1907 	 * it's easier to enable it unconditionally; even if it's unneeded,
1908 	 * it's almost harmless.
1909 	 */
1910 	spec->gen.prefer_hp_amp = 1;
1911 	spec->gen.beep_nid = 0x01;
1912 
1913 	spec->shutup = alc_eapd_shutup;
1914 
1915 	alc_pre_init(codec);
1916 
1917 	snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1918 			   alc260_fixups);
1919 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1920 
1921 	/* automatic parse from the BIOS config */
1922 	err = alc260_parse_auto_config(codec);
1923 	if (err < 0)
1924 		goto error;
1925 
1926 	if (!spec->gen.no_analog) {
1927 		err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1928 		if (err < 0)
1929 			goto error;
1930 	}
1931 
1932 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1933 
1934 	return 0;
1935 
1936  error:
1937 	alc_free(codec);
1938 	return err;
1939 }
1940 
1941 
1942 /*
1943  * ALC882/883/885/888/889 support
1944  *
1945  * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1946  * configuration.  Each pin widget can choose any input DACs and a mixer.
1947  * Each ADC is connected from a mixer of all inputs.  This makes possible
1948  * 6-channel independent captures.
1949  *
1950  * In addition, an independent DAC for the multi-playback (not used in this
1951  * driver yet).
1952  */
1953 
1954 /*
1955  * Pin config fixes
1956  */
1957 enum {
1958 	ALC882_FIXUP_ABIT_AW9D_MAX,
1959 	ALC882_FIXUP_LENOVO_Y530,
1960 	ALC882_FIXUP_PB_M5210,
1961 	ALC882_FIXUP_ACER_ASPIRE_7736,
1962 	ALC882_FIXUP_ASUS_W90V,
1963 	ALC889_FIXUP_CD,
1964 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1965 	ALC889_FIXUP_VAIO_TT,
1966 	ALC888_FIXUP_EEE1601,
1967 	ALC886_FIXUP_EAPD,
1968 	ALC882_FIXUP_EAPD,
1969 	ALC883_FIXUP_EAPD,
1970 	ALC883_FIXUP_ACER_EAPD,
1971 	ALC882_FIXUP_GPIO1,
1972 	ALC882_FIXUP_GPIO2,
1973 	ALC882_FIXUP_GPIO3,
1974 	ALC889_FIXUP_COEF,
1975 	ALC882_FIXUP_ASUS_W2JC,
1976 	ALC882_FIXUP_ACER_ASPIRE_4930G,
1977 	ALC882_FIXUP_ACER_ASPIRE_8930G,
1978 	ALC882_FIXUP_ASPIRE_8930G_VERBS,
1979 	ALC885_FIXUP_MACPRO_GPIO,
1980 	ALC889_FIXUP_DAC_ROUTE,
1981 	ALC889_FIXUP_MBP_VREF,
1982 	ALC889_FIXUP_IMAC91_VREF,
1983 	ALC889_FIXUP_MBA11_VREF,
1984 	ALC889_FIXUP_MBA21_VREF,
1985 	ALC889_FIXUP_MP11_VREF,
1986 	ALC889_FIXUP_MP41_VREF,
1987 	ALC882_FIXUP_INV_DMIC,
1988 	ALC882_FIXUP_NO_PRIMARY_HP,
1989 	ALC887_FIXUP_ASUS_BASS,
1990 	ALC887_FIXUP_BASS_CHMAP,
1991 	ALC1220_FIXUP_GB_DUAL_CODECS,
1992 	ALC1220_FIXUP_GB_X570,
1993 	ALC1220_FIXUP_CLEVO_P950,
1994 	ALC1220_FIXUP_CLEVO_PB51ED,
1995 	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1996 	ALC887_FIXUP_ASUS_AUDIO,
1997 	ALC887_FIXUP_ASUS_HMIC,
1998 	ALCS1200A_FIXUP_MIC_VREF,
1999 	ALC888VD_FIXUP_MIC_100VREF,
2000 };
2001 
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)2002 static void alc889_fixup_coef(struct hda_codec *codec,
2003 			      const struct hda_fixup *fix, int action)
2004 {
2005 	if (action != HDA_FIXUP_ACT_INIT)
2006 		return;
2007 	alc_update_coef_idx(codec, 7, 0, 0x2030);
2008 }
2009 
2010 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2011 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2012 				     const struct hda_fixup *fix, int action)
2013 {
2014 	struct alc_spec *spec = codec->spec;
2015 
2016 	spec->gpio_write_delay = true;
2017 	alc_fixup_gpio3(codec, fix, action);
2018 }
2019 
2020 /* Fix the connection of some pins for ALC889:
2021  * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2022  * work correctly (bko#42740)
2023  */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2024 static void alc889_fixup_dac_route(struct hda_codec *codec,
2025 				   const struct hda_fixup *fix, int action)
2026 {
2027 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2028 		/* fake the connections during parsing the tree */
2029 		static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2030 		static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2031 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2032 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2033 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2034 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2035 	} else if (action == HDA_FIXUP_ACT_PROBE) {
2036 		/* restore the connections */
2037 		static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2038 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2039 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2040 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2041 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2042 	}
2043 }
2044 
2045 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2046 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2047 				  const struct hda_fixup *fix, int action)
2048 {
2049 	static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2050 	struct alc_spec *spec = codec->spec;
2051 	int i;
2052 
2053 	if (action != HDA_FIXUP_ACT_INIT)
2054 		return;
2055 	for (i = 0; i < ARRAY_SIZE(nids); i++) {
2056 		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2057 		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2058 			continue;
2059 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2060 		val |= AC_PINCTL_VREF_80;
2061 		snd_hda_set_pin_ctl(codec, nids[i], val);
2062 		spec->gen.keep_vref_in_automute = 1;
2063 		break;
2064 	}
2065 }
2066 
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2067 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2068 				  const hda_nid_t *nids, int num_nids)
2069 {
2070 	struct alc_spec *spec = codec->spec;
2071 	int i;
2072 
2073 	for (i = 0; i < num_nids; i++) {
2074 		unsigned int val;
2075 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2076 		val |= AC_PINCTL_VREF_50;
2077 		snd_hda_set_pin_ctl(codec, nids[i], val);
2078 	}
2079 	spec->gen.keep_vref_in_automute = 1;
2080 }
2081 
2082 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2083 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2084 				     const struct hda_fixup *fix, int action)
2085 {
2086 	static const hda_nid_t nids[] = { 0x18, 0x1a };
2087 
2088 	if (action == HDA_FIXUP_ACT_INIT)
2089 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2090 }
2091 
2092 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2093 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2094 				    const struct hda_fixup *fix, int action)
2095 {
2096 	static const hda_nid_t nids[] = { 0x18 };
2097 
2098 	if (action == HDA_FIXUP_ACT_INIT)
2099 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2100 }
2101 
2102 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2103 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2104 				    const struct hda_fixup *fix, int action)
2105 {
2106 	static const hda_nid_t nids[] = { 0x18, 0x19 };
2107 
2108 	if (action == HDA_FIXUP_ACT_INIT)
2109 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2110 }
2111 
2112 /* Don't take HP output as primary
2113  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2114  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2115  */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2116 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2117 				       const struct hda_fixup *fix, int action)
2118 {
2119 	struct alc_spec *spec = codec->spec;
2120 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2121 		spec->gen.no_primary_hp = 1;
2122 		spec->gen.no_multi_io = 1;
2123 	}
2124 }
2125 
2126 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2127 				 const struct hda_fixup *fix, int action);
2128 
2129 /* For dual-codec configuration, we need to disable some features to avoid
2130  * conflicts of kctls and PCM streams
2131  */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2132 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2133 				  const struct hda_fixup *fix, int action)
2134 {
2135 	struct alc_spec *spec = codec->spec;
2136 
2137 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2138 		return;
2139 	/* disable vmaster */
2140 	spec->gen.suppress_vmaster = 1;
2141 	/* auto-mute and auto-mic switch don't work with multiple codecs */
2142 	spec->gen.suppress_auto_mute = 1;
2143 	spec->gen.suppress_auto_mic = 1;
2144 	/* disable aamix as well */
2145 	spec->gen.mixer_nid = 0;
2146 	/* add location prefix to avoid conflicts */
2147 	codec->force_pin_prefix = 1;
2148 }
2149 
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2150 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2151 		       const char *newname)
2152 {
2153 	struct snd_kcontrol *kctl;
2154 
2155 	kctl = snd_hda_find_mixer_ctl(codec, oldname);
2156 	if (kctl)
2157 		snd_ctl_rename(codec->card, kctl, newname);
2158 }
2159 
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2160 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2161 					 const struct hda_fixup *fix,
2162 					 int action)
2163 {
2164 	alc_fixup_dual_codecs(codec, fix, action);
2165 	switch (action) {
2166 	case HDA_FIXUP_ACT_PRE_PROBE:
2167 		/* override card longname to provide a unique UCM profile */
2168 		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2169 		break;
2170 	case HDA_FIXUP_ACT_BUILD:
2171 		/* rename Capture controls depending on the codec */
2172 		rename_ctl(codec, "Capture Volume",
2173 			   codec->addr == 0 ?
2174 			   "Rear-Panel Capture Volume" :
2175 			   "Front-Panel Capture Volume");
2176 		rename_ctl(codec, "Capture Switch",
2177 			   codec->addr == 0 ?
2178 			   "Rear-Panel Capture Switch" :
2179 			   "Front-Panel Capture Switch");
2180 		break;
2181 	}
2182 }
2183 
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2184 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2185 				     const struct hda_fixup *fix,
2186 				     int action)
2187 {
2188 	static const hda_nid_t conn1[] = { 0x0c };
2189 	static const struct coef_fw gb_x570_coefs[] = {
2190 		WRITE_COEF(0x07, 0x03c0),
2191 		WRITE_COEF(0x1a, 0x01c1),
2192 		WRITE_COEF(0x1b, 0x0202),
2193 		WRITE_COEF(0x43, 0x3005),
2194 		{}
2195 	};
2196 
2197 	switch (action) {
2198 	case HDA_FIXUP_ACT_PRE_PROBE:
2199 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2200 		snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2201 		break;
2202 	case HDA_FIXUP_ACT_INIT:
2203 		alc_process_coef_fw(codec, gb_x570_coefs);
2204 		break;
2205 	}
2206 }
2207 
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2208 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2209 				     const struct hda_fixup *fix,
2210 				     int action)
2211 {
2212 	static const hda_nid_t conn1[] = { 0x0c };
2213 
2214 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2215 		return;
2216 
2217 	alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2218 	/* We therefore want to make sure 0x14 (front headphone) and
2219 	 * 0x1b (speakers) use the stereo DAC 0x02
2220 	 */
2221 	snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2222 	snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2223 }
2224 
2225 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2226 				const struct hda_fixup *fix, int action);
2227 
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2228 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2229 				     const struct hda_fixup *fix,
2230 				     int action)
2231 {
2232 	alc1220_fixup_clevo_p950(codec, fix, action);
2233 	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2234 }
2235 
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2236 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2237 					 struct hda_jack_callback *jack)
2238 {
2239 	struct alc_spec *spec = codec->spec;
2240 	unsigned int vref;
2241 
2242 	snd_hda_gen_hp_automute(codec, jack);
2243 
2244 	if (spec->gen.hp_jack_present)
2245 		vref = AC_PINCTL_VREF_80;
2246 	else
2247 		vref = AC_PINCTL_VREF_HIZ;
2248 	snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2249 }
2250 
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2251 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2252 				     const struct hda_fixup *fix, int action)
2253 {
2254 	struct alc_spec *spec = codec->spec;
2255 	if (action != HDA_FIXUP_ACT_PROBE)
2256 		return;
2257 	snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2258 	spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2259 }
2260 
2261 static const struct hda_fixup alc882_fixups[] = {
2262 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
2263 		.type = HDA_FIXUP_PINS,
2264 		.v.pins = (const struct hda_pintbl[]) {
2265 			{ 0x15, 0x01080104 }, /* side */
2266 			{ 0x16, 0x01011012 }, /* rear */
2267 			{ 0x17, 0x01016011 }, /* clfe */
2268 			{ }
2269 		}
2270 	},
2271 	[ALC882_FIXUP_LENOVO_Y530] = {
2272 		.type = HDA_FIXUP_PINS,
2273 		.v.pins = (const struct hda_pintbl[]) {
2274 			{ 0x15, 0x99130112 }, /* rear int speakers */
2275 			{ 0x16, 0x99130111 }, /* subwoofer */
2276 			{ }
2277 		}
2278 	},
2279 	[ALC882_FIXUP_PB_M5210] = {
2280 		.type = HDA_FIXUP_PINCTLS,
2281 		.v.pins = (const struct hda_pintbl[]) {
2282 			{ 0x19, PIN_VREF50 },
2283 			{}
2284 		}
2285 	},
2286 	[ALC882_FIXUP_ACER_ASPIRE_7736] = {
2287 		.type = HDA_FIXUP_FUNC,
2288 		.v.func = alc_fixup_sku_ignore,
2289 	},
2290 	[ALC882_FIXUP_ASUS_W90V] = {
2291 		.type = HDA_FIXUP_PINS,
2292 		.v.pins = (const struct hda_pintbl[]) {
2293 			{ 0x16, 0x99130110 }, /* fix sequence for CLFE */
2294 			{ }
2295 		}
2296 	},
2297 	[ALC889_FIXUP_CD] = {
2298 		.type = HDA_FIXUP_PINS,
2299 		.v.pins = (const struct hda_pintbl[]) {
2300 			{ 0x1c, 0x993301f0 }, /* CD */
2301 			{ }
2302 		}
2303 	},
2304 	[ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2305 		.type = HDA_FIXUP_PINS,
2306 		.v.pins = (const struct hda_pintbl[]) {
2307 			{ 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2308 			{ }
2309 		},
2310 		.chained = true,
2311 		.chain_id = ALC889_FIXUP_CD,
2312 	},
2313 	[ALC889_FIXUP_VAIO_TT] = {
2314 		.type = HDA_FIXUP_PINS,
2315 		.v.pins = (const struct hda_pintbl[]) {
2316 			{ 0x17, 0x90170111 }, /* hidden surround speaker */
2317 			{ }
2318 		}
2319 	},
2320 	[ALC888_FIXUP_EEE1601] = {
2321 		.type = HDA_FIXUP_VERBS,
2322 		.v.verbs = (const struct hda_verb[]) {
2323 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2324 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x0838 },
2325 			{ }
2326 		}
2327 	},
2328 	[ALC886_FIXUP_EAPD] = {
2329 		.type = HDA_FIXUP_VERBS,
2330 		.v.verbs = (const struct hda_verb[]) {
2331 			/* change to EAPD mode */
2332 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2333 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2334 			{ }
2335 		}
2336 	},
2337 	[ALC882_FIXUP_EAPD] = {
2338 		.type = HDA_FIXUP_VERBS,
2339 		.v.verbs = (const struct hda_verb[]) {
2340 			/* change to EAPD mode */
2341 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2342 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2343 			{ }
2344 		}
2345 	},
2346 	[ALC883_FIXUP_EAPD] = {
2347 		.type = HDA_FIXUP_VERBS,
2348 		.v.verbs = (const struct hda_verb[]) {
2349 			/* change to EAPD mode */
2350 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2351 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2352 			{ }
2353 		}
2354 	},
2355 	[ALC883_FIXUP_ACER_EAPD] = {
2356 		.type = HDA_FIXUP_VERBS,
2357 		.v.verbs = (const struct hda_verb[]) {
2358 			/* eanable EAPD on Acer laptops */
2359 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2360 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2361 			{ }
2362 		}
2363 	},
2364 	[ALC882_FIXUP_GPIO1] = {
2365 		.type = HDA_FIXUP_FUNC,
2366 		.v.func = alc_fixup_gpio1,
2367 	},
2368 	[ALC882_FIXUP_GPIO2] = {
2369 		.type = HDA_FIXUP_FUNC,
2370 		.v.func = alc_fixup_gpio2,
2371 	},
2372 	[ALC882_FIXUP_GPIO3] = {
2373 		.type = HDA_FIXUP_FUNC,
2374 		.v.func = alc_fixup_gpio3,
2375 	},
2376 	[ALC882_FIXUP_ASUS_W2JC] = {
2377 		.type = HDA_FIXUP_FUNC,
2378 		.v.func = alc_fixup_gpio1,
2379 		.chained = true,
2380 		.chain_id = ALC882_FIXUP_EAPD,
2381 	},
2382 	[ALC889_FIXUP_COEF] = {
2383 		.type = HDA_FIXUP_FUNC,
2384 		.v.func = alc889_fixup_coef,
2385 	},
2386 	[ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2387 		.type = HDA_FIXUP_PINS,
2388 		.v.pins = (const struct hda_pintbl[]) {
2389 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2390 			{ 0x17, 0x99130112 }, /* surround speaker */
2391 			{ }
2392 		},
2393 		.chained = true,
2394 		.chain_id = ALC882_FIXUP_GPIO1,
2395 	},
2396 	[ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2397 		.type = HDA_FIXUP_PINS,
2398 		.v.pins = (const struct hda_pintbl[]) {
2399 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2400 			{ 0x1b, 0x99130112 }, /* surround speaker */
2401 			{ }
2402 		},
2403 		.chained = true,
2404 		.chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2405 	},
2406 	[ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2407 		/* additional init verbs for Acer Aspire 8930G */
2408 		.type = HDA_FIXUP_VERBS,
2409 		.v.verbs = (const struct hda_verb[]) {
2410 			/* Enable all DACs */
2411 			/* DAC DISABLE/MUTE 1? */
2412 			/*  setting bits 1-5 disables DAC nids 0x02-0x06
2413 			 *  apparently. Init=0x38 */
2414 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2415 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2416 			/* DAC DISABLE/MUTE 2? */
2417 			/*  some bit here disables the other DACs.
2418 			 *  Init=0x4900 */
2419 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2420 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2421 			/* DMIC fix
2422 			 * This laptop has a stereo digital microphone.
2423 			 * The mics are only 1cm apart which makes the stereo
2424 			 * useless. However, either the mic or the ALC889
2425 			 * makes the signal become a difference/sum signal
2426 			 * instead of standard stereo, which is annoying.
2427 			 * So instead we flip this bit which makes the
2428 			 * codec replicate the sum signal to both channels,
2429 			 * turning it into a normal mono mic.
2430 			 */
2431 			/* DMIC_CONTROL? Init value = 0x0001 */
2432 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2433 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2434 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2435 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2436 			{ }
2437 		},
2438 		.chained = true,
2439 		.chain_id = ALC882_FIXUP_GPIO1,
2440 	},
2441 	[ALC885_FIXUP_MACPRO_GPIO] = {
2442 		.type = HDA_FIXUP_FUNC,
2443 		.v.func = alc885_fixup_macpro_gpio,
2444 	},
2445 	[ALC889_FIXUP_DAC_ROUTE] = {
2446 		.type = HDA_FIXUP_FUNC,
2447 		.v.func = alc889_fixup_dac_route,
2448 	},
2449 	[ALC889_FIXUP_MBP_VREF] = {
2450 		.type = HDA_FIXUP_FUNC,
2451 		.v.func = alc889_fixup_mbp_vref,
2452 		.chained = true,
2453 		.chain_id = ALC882_FIXUP_GPIO1,
2454 	},
2455 	[ALC889_FIXUP_IMAC91_VREF] = {
2456 		.type = HDA_FIXUP_FUNC,
2457 		.v.func = alc889_fixup_imac91_vref,
2458 		.chained = true,
2459 		.chain_id = ALC882_FIXUP_GPIO1,
2460 	},
2461 	[ALC889_FIXUP_MBA11_VREF] = {
2462 		.type = HDA_FIXUP_FUNC,
2463 		.v.func = alc889_fixup_mba11_vref,
2464 		.chained = true,
2465 		.chain_id = ALC889_FIXUP_MBP_VREF,
2466 	},
2467 	[ALC889_FIXUP_MBA21_VREF] = {
2468 		.type = HDA_FIXUP_FUNC,
2469 		.v.func = alc889_fixup_mba21_vref,
2470 		.chained = true,
2471 		.chain_id = ALC889_FIXUP_MBP_VREF,
2472 	},
2473 	[ALC889_FIXUP_MP11_VREF] = {
2474 		.type = HDA_FIXUP_FUNC,
2475 		.v.func = alc889_fixup_mba11_vref,
2476 		.chained = true,
2477 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2478 	},
2479 	[ALC889_FIXUP_MP41_VREF] = {
2480 		.type = HDA_FIXUP_FUNC,
2481 		.v.func = alc889_fixup_mbp_vref,
2482 		.chained = true,
2483 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2484 	},
2485 	[ALC882_FIXUP_INV_DMIC] = {
2486 		.type = HDA_FIXUP_FUNC,
2487 		.v.func = alc_fixup_inv_dmic,
2488 	},
2489 	[ALC882_FIXUP_NO_PRIMARY_HP] = {
2490 		.type = HDA_FIXUP_FUNC,
2491 		.v.func = alc882_fixup_no_primary_hp,
2492 	},
2493 	[ALC887_FIXUP_ASUS_BASS] = {
2494 		.type = HDA_FIXUP_PINS,
2495 		.v.pins = (const struct hda_pintbl[]) {
2496 			{0x16, 0x99130130}, /* bass speaker */
2497 			{}
2498 		},
2499 		.chained = true,
2500 		.chain_id = ALC887_FIXUP_BASS_CHMAP,
2501 	},
2502 	[ALC887_FIXUP_BASS_CHMAP] = {
2503 		.type = HDA_FIXUP_FUNC,
2504 		.v.func = alc_fixup_bass_chmap,
2505 	},
2506 	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
2507 		.type = HDA_FIXUP_FUNC,
2508 		.v.func = alc1220_fixup_gb_dual_codecs,
2509 	},
2510 	[ALC1220_FIXUP_GB_X570] = {
2511 		.type = HDA_FIXUP_FUNC,
2512 		.v.func = alc1220_fixup_gb_x570,
2513 	},
2514 	[ALC1220_FIXUP_CLEVO_P950] = {
2515 		.type = HDA_FIXUP_FUNC,
2516 		.v.func = alc1220_fixup_clevo_p950,
2517 	},
2518 	[ALC1220_FIXUP_CLEVO_PB51ED] = {
2519 		.type = HDA_FIXUP_FUNC,
2520 		.v.func = alc1220_fixup_clevo_pb51ed,
2521 	},
2522 	[ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2523 		.type = HDA_FIXUP_PINS,
2524 		.v.pins = (const struct hda_pintbl[]) {
2525 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2526 			{}
2527 		},
2528 		.chained = true,
2529 		.chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2530 	},
2531 	[ALC887_FIXUP_ASUS_AUDIO] = {
2532 		.type = HDA_FIXUP_PINS,
2533 		.v.pins = (const struct hda_pintbl[]) {
2534 			{ 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2535 			{ 0x19, 0x22219420 },
2536 			{}
2537 		},
2538 	},
2539 	[ALC887_FIXUP_ASUS_HMIC] = {
2540 		.type = HDA_FIXUP_FUNC,
2541 		.v.func = alc887_fixup_asus_jack,
2542 		.chained = true,
2543 		.chain_id = ALC887_FIXUP_ASUS_AUDIO,
2544 	},
2545 	[ALCS1200A_FIXUP_MIC_VREF] = {
2546 		.type = HDA_FIXUP_PINCTLS,
2547 		.v.pins = (const struct hda_pintbl[]) {
2548 			{ 0x18, PIN_VREF50 }, /* rear mic */
2549 			{ 0x19, PIN_VREF50 }, /* front mic */
2550 			{}
2551 		}
2552 	},
2553 	[ALC888VD_FIXUP_MIC_100VREF] = {
2554 		.type = HDA_FIXUP_PINCTLS,
2555 		.v.pins = (const struct hda_pintbl[]) {
2556 			{ 0x18, PIN_VREF100 }, /* headset mic */
2557 			{}
2558 		}
2559 	},
2560 };
2561 
2562 static const struct hda_quirk alc882_fixup_tbl[] = {
2563 	SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2564 	SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2565 	SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2566 	SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2567 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2568 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2569 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2570 	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2571 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2572 	SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2573 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2574 	SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2575 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2576 	SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2577 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2578 	SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2579 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2580 	SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2581 	SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2582 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2583 	SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2584 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2585 	SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2586 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2587 	SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2588 	SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2589 	SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2590 	SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2591 	SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2592 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2593 	SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2594 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2595 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2596 	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2597 	SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2598 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2599 	SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2600 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2601 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2602 	SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2603 
2604 	/* All Apple entries are in codec SSIDs */
2605 	SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2606 	SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2607 	SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2608 	SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2609 	SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2610 	SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2611 	SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2612 	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2613 	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2614 	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2615 	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2616 	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2617 	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2618 	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2619 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2620 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2621 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2622 	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2623 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2624 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2625 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2626 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2627 
2628 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2629 	SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2630 	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2631 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2632 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2633 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2634 	SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2635 	SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2636 	SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2637 	SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2638 	SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2639 	SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2640 	SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2641 	SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2642 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2643 	SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2644 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2645 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2646 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2647 	SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2648 	SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2649 	SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2650 	SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2651 	SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2652 	SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2653 	SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2654 	SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2655 	SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2656 	SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 	SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 	SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 	SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 	SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2661 	SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2662 	SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2663 	SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2664 	SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2665 	SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2666 	SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2667 	SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2668 	SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2669 	SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2670 	SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2671 	SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2672 	SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2673 	SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2674 	SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2675 	SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2676 	SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2677 	SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2678 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2679 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2680 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2681 	SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2682 	{}
2683 };
2684 
2685 static const struct hda_model_fixup alc882_fixup_models[] = {
2686 	{.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2687 	{.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2688 	{.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2689 	{.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2690 	{.id = ALC889_FIXUP_CD, .name = "cd"},
2691 	{.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2692 	{.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2693 	{.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2694 	{.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2695 	{.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2696 	{.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2697 	{.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2698 	{.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2699 	{.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2700 	{.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2701 	{.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2702 	{.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2703 	{.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2704 	{.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2705 	{.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2706 	{.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2707 	{.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2708 	{.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2709 	{.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2710 	{.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2711 	{.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2712 	{.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2713 	{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2714 	{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2715 	{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2716 	{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2717 	{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2718 	{}
2719 };
2720 
2721 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2722 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2723 		{0x14, 0x01014010},
2724 		{0x15, 0x01011012},
2725 		{0x16, 0x01016011},
2726 		{0x18, 0x01a19040},
2727 		{0x19, 0x02a19050},
2728 		{0x1a, 0x0181304f},
2729 		{0x1b, 0x0221401f},
2730 		{0x1e, 0x01456130}),
2731 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2732 		{0x14, 0x01015010},
2733 		{0x15, 0x01011012},
2734 		{0x16, 0x01011011},
2735 		{0x18, 0x01a11040},
2736 		{0x19, 0x02a19050},
2737 		{0x1a, 0x0181104f},
2738 		{0x1b, 0x0221401f},
2739 		{0x1e, 0x01451130}),
2740 	{}
2741 };
2742 
2743 /*
2744  * BIOS auto configuration
2745  */
2746 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2747 static int alc882_parse_auto_config(struct hda_codec *codec)
2748 {
2749 	static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2750 	static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2751 	return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2752 }
2753 
2754 /*
2755  */
patch_alc882(struct hda_codec * codec)2756 static int patch_alc882(struct hda_codec *codec)
2757 {
2758 	struct alc_spec *spec;
2759 	int err;
2760 
2761 	err = alc_alloc_spec(codec, 0x0b);
2762 	if (err < 0)
2763 		return err;
2764 
2765 	spec = codec->spec;
2766 
2767 	switch (codec->core.vendor_id) {
2768 	case 0x10ec0882:
2769 	case 0x10ec0885:
2770 	case 0x10ec0900:
2771 	case 0x10ec0b00:
2772 	case 0x10ec1220:
2773 		break;
2774 	default:
2775 		/* ALC883 and variants */
2776 		alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2777 		break;
2778 	}
2779 
2780 	alc_pre_init(codec);
2781 
2782 	snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2783 		       alc882_fixups);
2784 	snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2785 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2786 
2787 	alc_auto_parse_customize_define(codec);
2788 
2789 	if (has_cdefine_beep(codec))
2790 		spec->gen.beep_nid = 0x01;
2791 
2792 	/* automatic parse from the BIOS config */
2793 	err = alc882_parse_auto_config(codec);
2794 	if (err < 0)
2795 		goto error;
2796 
2797 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2798 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2799 		if (err < 0)
2800 			goto error;
2801 	}
2802 
2803 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2804 
2805 	return 0;
2806 
2807  error:
2808 	alc_free(codec);
2809 	return err;
2810 }
2811 
2812 
2813 /*
2814  * ALC262 support
2815  */
alc262_parse_auto_config(struct hda_codec * codec)2816 static int alc262_parse_auto_config(struct hda_codec *codec)
2817 {
2818 	static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2819 	static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2820 	return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2821 }
2822 
2823 /*
2824  * Pin config fixes
2825  */
2826 enum {
2827 	ALC262_FIXUP_FSC_H270,
2828 	ALC262_FIXUP_FSC_S7110,
2829 	ALC262_FIXUP_HP_Z200,
2830 	ALC262_FIXUP_TYAN,
2831 	ALC262_FIXUP_LENOVO_3000,
2832 	ALC262_FIXUP_BENQ,
2833 	ALC262_FIXUP_BENQ_T31,
2834 	ALC262_FIXUP_INV_DMIC,
2835 	ALC262_FIXUP_INTEL_BAYLEYBAY,
2836 };
2837 
2838 static const struct hda_fixup alc262_fixups[] = {
2839 	[ALC262_FIXUP_FSC_H270] = {
2840 		.type = HDA_FIXUP_PINS,
2841 		.v.pins = (const struct hda_pintbl[]) {
2842 			{ 0x14, 0x99130110 }, /* speaker */
2843 			{ 0x15, 0x0221142f }, /* front HP */
2844 			{ 0x1b, 0x0121141f }, /* rear HP */
2845 			{ }
2846 		}
2847 	},
2848 	[ALC262_FIXUP_FSC_S7110] = {
2849 		.type = HDA_FIXUP_PINS,
2850 		.v.pins = (const struct hda_pintbl[]) {
2851 			{ 0x15, 0x90170110 }, /* speaker */
2852 			{ }
2853 		},
2854 		.chained = true,
2855 		.chain_id = ALC262_FIXUP_BENQ,
2856 	},
2857 	[ALC262_FIXUP_HP_Z200] = {
2858 		.type = HDA_FIXUP_PINS,
2859 		.v.pins = (const struct hda_pintbl[]) {
2860 			{ 0x16, 0x99130120 }, /* internal speaker */
2861 			{ }
2862 		}
2863 	},
2864 	[ALC262_FIXUP_TYAN] = {
2865 		.type = HDA_FIXUP_PINS,
2866 		.v.pins = (const struct hda_pintbl[]) {
2867 			{ 0x14, 0x1993e1f0 }, /* int AUX */
2868 			{ }
2869 		}
2870 	},
2871 	[ALC262_FIXUP_LENOVO_3000] = {
2872 		.type = HDA_FIXUP_PINCTLS,
2873 		.v.pins = (const struct hda_pintbl[]) {
2874 			{ 0x19, PIN_VREF50 },
2875 			{}
2876 		},
2877 		.chained = true,
2878 		.chain_id = ALC262_FIXUP_BENQ,
2879 	},
2880 	[ALC262_FIXUP_BENQ] = {
2881 		.type = HDA_FIXUP_VERBS,
2882 		.v.verbs = (const struct hda_verb[]) {
2883 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2884 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2885 			{}
2886 		}
2887 	},
2888 	[ALC262_FIXUP_BENQ_T31] = {
2889 		.type = HDA_FIXUP_VERBS,
2890 		.v.verbs = (const struct hda_verb[]) {
2891 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2892 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2893 			{}
2894 		}
2895 	},
2896 	[ALC262_FIXUP_INV_DMIC] = {
2897 		.type = HDA_FIXUP_FUNC,
2898 		.v.func = alc_fixup_inv_dmic,
2899 	},
2900 	[ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2901 		.type = HDA_FIXUP_FUNC,
2902 		.v.func = alc_fixup_no_depop_delay,
2903 	},
2904 };
2905 
2906 static const struct hda_quirk alc262_fixup_tbl[] = {
2907 	SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2908 	SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2909 	SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2910 	SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2911 	SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2912 	SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2913 	SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2914 	SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2915 	SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2916 	SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2917 	{}
2918 };
2919 
2920 static const struct hda_model_fixup alc262_fixup_models[] = {
2921 	{.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2922 	{.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2923 	{.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2924 	{.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2925 	{.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2926 	{.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2927 	{.id = ALC262_FIXUP_BENQ, .name = "benq"},
2928 	{.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2929 	{.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2930 	{}
2931 };
2932 
2933 /*
2934  */
patch_alc262(struct hda_codec * codec)2935 static int patch_alc262(struct hda_codec *codec)
2936 {
2937 	struct alc_spec *spec;
2938 	int err;
2939 
2940 	err = alc_alloc_spec(codec, 0x0b);
2941 	if (err < 0)
2942 		return err;
2943 
2944 	spec = codec->spec;
2945 	spec->gen.shared_mic_vref_pin = 0x18;
2946 
2947 	spec->shutup = alc_eapd_shutup;
2948 
2949 #if 0
2950 	/* pshou 07/11/05  set a zero PCM sample to DAC when FIFO is
2951 	 * under-run
2952 	 */
2953 	alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2954 #endif
2955 	alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2956 
2957 	alc_pre_init(codec);
2958 
2959 	snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2960 		       alc262_fixups);
2961 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2962 
2963 	alc_auto_parse_customize_define(codec);
2964 
2965 	if (has_cdefine_beep(codec))
2966 		spec->gen.beep_nid = 0x01;
2967 
2968 	/* automatic parse from the BIOS config */
2969 	err = alc262_parse_auto_config(codec);
2970 	if (err < 0)
2971 		goto error;
2972 
2973 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2974 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2975 		if (err < 0)
2976 			goto error;
2977 	}
2978 
2979 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2980 
2981 	return 0;
2982 
2983  error:
2984 	alc_free(codec);
2985 	return err;
2986 }
2987 
2988 /*
2989  *  ALC268
2990  */
2991 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)2992 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2993 				  struct snd_ctl_elem_value *ucontrol)
2994 {
2995 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2996 	unsigned long pval;
2997 	int err;
2998 
2999 	mutex_lock(&codec->control_mutex);
3000 	pval = kcontrol->private_value;
3001 	kcontrol->private_value = (pval & ~0xff) | 0x0f;
3002 	err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3003 	if (err >= 0) {
3004 		kcontrol->private_value = (pval & ~0xff) | 0x10;
3005 		err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3006 	}
3007 	kcontrol->private_value = pval;
3008 	mutex_unlock(&codec->control_mutex);
3009 	return err;
3010 }
3011 
3012 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3013 	HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3014 	{
3015 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3016 		.name = "Beep Playback Switch",
3017 		.subdevice = HDA_SUBDEV_AMP_FLAG,
3018 		.info = snd_hda_mixer_amp_switch_info,
3019 		.get = snd_hda_mixer_amp_switch_get,
3020 		.put = alc268_beep_switch_put,
3021 		.private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3022 	},
3023 };
3024 
3025 /* set PCBEEP vol = 0, mute connections */
3026 static const struct hda_verb alc268_beep_init_verbs[] = {
3027 	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3028 	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3029 	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3030 	{ }
3031 };
3032 
3033 enum {
3034 	ALC268_FIXUP_INV_DMIC,
3035 	ALC268_FIXUP_HP_EAPD,
3036 	ALC268_FIXUP_SPDIF,
3037 };
3038 
3039 static const struct hda_fixup alc268_fixups[] = {
3040 	[ALC268_FIXUP_INV_DMIC] = {
3041 		.type = HDA_FIXUP_FUNC,
3042 		.v.func = alc_fixup_inv_dmic,
3043 	},
3044 	[ALC268_FIXUP_HP_EAPD] = {
3045 		.type = HDA_FIXUP_VERBS,
3046 		.v.verbs = (const struct hda_verb[]) {
3047 			{0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3048 			{}
3049 		}
3050 	},
3051 	[ALC268_FIXUP_SPDIF] = {
3052 		.type = HDA_FIXUP_PINS,
3053 		.v.pins = (const struct hda_pintbl[]) {
3054 			{ 0x1e, 0x014b1180 }, /* enable SPDIF out */
3055 			{}
3056 		}
3057 	},
3058 };
3059 
3060 static const struct hda_model_fixup alc268_fixup_models[] = {
3061 	{.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3062 	{.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3063 	{.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3064 	{}
3065 };
3066 
3067 static const struct hda_quirk alc268_fixup_tbl[] = {
3068 	SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3069 	SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3070 	/* below is codec SSID since multiple Toshiba laptops have the
3071 	 * same PCI SSID 1179:ff00
3072 	 */
3073 	SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3074 	{}
3075 };
3076 
3077 /*
3078  * BIOS auto configuration
3079  */
alc268_parse_auto_config(struct hda_codec * codec)3080 static int alc268_parse_auto_config(struct hda_codec *codec)
3081 {
3082 	static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3083 	return alc_parse_auto_config(codec, NULL, alc268_ssids);
3084 }
3085 
3086 /*
3087  */
patch_alc268(struct hda_codec * codec)3088 static int patch_alc268(struct hda_codec *codec)
3089 {
3090 	struct alc_spec *spec;
3091 	int i, err;
3092 
3093 	/* ALC268 has no aa-loopback mixer */
3094 	err = alc_alloc_spec(codec, 0);
3095 	if (err < 0)
3096 		return err;
3097 
3098 	spec = codec->spec;
3099 	if (has_cdefine_beep(codec))
3100 		spec->gen.beep_nid = 0x01;
3101 
3102 	spec->shutup = alc_eapd_shutup;
3103 
3104 	alc_pre_init(codec);
3105 
3106 	snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3107 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3108 
3109 	/* automatic parse from the BIOS config */
3110 	err = alc268_parse_auto_config(codec);
3111 	if (err < 0)
3112 		goto error;
3113 
3114 	if (err > 0 && !spec->gen.no_analog &&
3115 	    spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3116 		for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3117 			if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3118 						  &alc268_beep_mixer[i])) {
3119 				err = -ENOMEM;
3120 				goto error;
3121 			}
3122 		}
3123 		snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3124 		if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3125 			/* override the amp caps for beep generator */
3126 			snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3127 					  (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3128 					  (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3129 					  (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3130 					  (0 << AC_AMPCAP_MUTE_SHIFT));
3131 	}
3132 
3133 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3134 
3135 	return 0;
3136 
3137  error:
3138 	alc_free(codec);
3139 	return err;
3140 }
3141 
3142 /*
3143  * ALC269
3144  */
3145 
3146 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3147 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3148 };
3149 
3150 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3151 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3152 };
3153 
3154 /* different alc269-variants */
3155 enum {
3156 	ALC269_TYPE_ALC269VA,
3157 	ALC269_TYPE_ALC269VB,
3158 	ALC269_TYPE_ALC269VC,
3159 	ALC269_TYPE_ALC269VD,
3160 	ALC269_TYPE_ALC280,
3161 	ALC269_TYPE_ALC282,
3162 	ALC269_TYPE_ALC283,
3163 	ALC269_TYPE_ALC284,
3164 	ALC269_TYPE_ALC293,
3165 	ALC269_TYPE_ALC286,
3166 	ALC269_TYPE_ALC298,
3167 	ALC269_TYPE_ALC255,
3168 	ALC269_TYPE_ALC256,
3169 	ALC269_TYPE_ALC257,
3170 	ALC269_TYPE_ALC215,
3171 	ALC269_TYPE_ALC225,
3172 	ALC269_TYPE_ALC245,
3173 	ALC269_TYPE_ALC287,
3174 	ALC269_TYPE_ALC294,
3175 	ALC269_TYPE_ALC300,
3176 	ALC269_TYPE_ALC623,
3177 	ALC269_TYPE_ALC700,
3178 };
3179 
3180 /*
3181  * BIOS auto configuration
3182  */
alc269_parse_auto_config(struct hda_codec * codec)3183 static int alc269_parse_auto_config(struct hda_codec *codec)
3184 {
3185 	static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3186 	static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3187 	static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3188 	struct alc_spec *spec = codec->spec;
3189 	const hda_nid_t *ssids;
3190 
3191 	switch (spec->codec_variant) {
3192 	case ALC269_TYPE_ALC269VA:
3193 	case ALC269_TYPE_ALC269VC:
3194 	case ALC269_TYPE_ALC280:
3195 	case ALC269_TYPE_ALC284:
3196 	case ALC269_TYPE_ALC293:
3197 		ssids = alc269va_ssids;
3198 		break;
3199 	case ALC269_TYPE_ALC269VB:
3200 	case ALC269_TYPE_ALC269VD:
3201 	case ALC269_TYPE_ALC282:
3202 	case ALC269_TYPE_ALC283:
3203 	case ALC269_TYPE_ALC286:
3204 	case ALC269_TYPE_ALC298:
3205 	case ALC269_TYPE_ALC255:
3206 	case ALC269_TYPE_ALC256:
3207 	case ALC269_TYPE_ALC257:
3208 	case ALC269_TYPE_ALC215:
3209 	case ALC269_TYPE_ALC225:
3210 	case ALC269_TYPE_ALC245:
3211 	case ALC269_TYPE_ALC287:
3212 	case ALC269_TYPE_ALC294:
3213 	case ALC269_TYPE_ALC300:
3214 	case ALC269_TYPE_ALC623:
3215 	case ALC269_TYPE_ALC700:
3216 		ssids = alc269_ssids;
3217 		break;
3218 	default:
3219 		ssids = alc269_ssids;
3220 		break;
3221 	}
3222 
3223 	return alc_parse_auto_config(codec, alc269_ignore, ssids);
3224 }
3225 
3226 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3227 	{ SND_JACK_BTN_0, KEY_PLAYPAUSE },
3228 	{ SND_JACK_BTN_1, KEY_VOICECOMMAND },
3229 	{ SND_JACK_BTN_2, KEY_VOLUMEUP },
3230 	{ SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3231 	{}
3232 };
3233 
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3234 static void alc_headset_btn_callback(struct hda_codec *codec,
3235 				     struct hda_jack_callback *jack)
3236 {
3237 	int report = 0;
3238 
3239 	if (jack->unsol_res & (7 << 13))
3240 		report |= SND_JACK_BTN_0;
3241 
3242 	if (jack->unsol_res  & (1 << 16 | 3 << 8))
3243 		report |= SND_JACK_BTN_1;
3244 
3245 	/* Volume up key */
3246 	if (jack->unsol_res & (7 << 23))
3247 		report |= SND_JACK_BTN_2;
3248 
3249 	/* Volume down key */
3250 	if (jack->unsol_res & (7 << 10))
3251 		report |= SND_JACK_BTN_3;
3252 
3253 	snd_hda_jack_set_button_state(codec, jack->nid, report);
3254 }
3255 
alc_disable_headset_jack_key(struct hda_codec * codec)3256 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3257 {
3258 	struct alc_spec *spec = codec->spec;
3259 
3260 	if (!spec->has_hs_key)
3261 		return;
3262 
3263 	switch (codec->core.vendor_id) {
3264 	case 0x10ec0215:
3265 	case 0x10ec0225:
3266 	case 0x10ec0285:
3267 	case 0x10ec0287:
3268 	case 0x10ec0295:
3269 	case 0x10ec0289:
3270 	case 0x10ec0299:
3271 		alc_write_coef_idx(codec, 0x48, 0x0);
3272 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3273 		alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3274 		break;
3275 	case 0x10ec0230:
3276 	case 0x10ec0236:
3277 	case 0x10ec0256:
3278 	case 0x10ec0257:
3279 	case 0x19e58326:
3280 		alc_write_coef_idx(codec, 0x48, 0x0);
3281 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3282 		break;
3283 	}
3284 }
3285 
alc_enable_headset_jack_key(struct hda_codec * codec)3286 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3287 {
3288 	struct alc_spec *spec = codec->spec;
3289 
3290 	if (!spec->has_hs_key)
3291 		return;
3292 
3293 	switch (codec->core.vendor_id) {
3294 	case 0x10ec0215:
3295 	case 0x10ec0225:
3296 	case 0x10ec0285:
3297 	case 0x10ec0287:
3298 	case 0x10ec0295:
3299 	case 0x10ec0289:
3300 	case 0x10ec0299:
3301 		alc_write_coef_idx(codec, 0x48, 0xd011);
3302 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3303 		alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3304 		break;
3305 	case 0x10ec0230:
3306 	case 0x10ec0236:
3307 	case 0x10ec0256:
3308 	case 0x10ec0257:
3309 	case 0x19e58326:
3310 		alc_write_coef_idx(codec, 0x48, 0xd011);
3311 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3312 		break;
3313 	}
3314 }
3315 
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3316 static void alc_fixup_headset_jack(struct hda_codec *codec,
3317 				    const struct hda_fixup *fix, int action)
3318 {
3319 	struct alc_spec *spec = codec->spec;
3320 	hda_nid_t hp_pin;
3321 
3322 	switch (action) {
3323 	case HDA_FIXUP_ACT_PRE_PROBE:
3324 		spec->has_hs_key = 1;
3325 		snd_hda_jack_detect_enable_callback(codec, 0x55,
3326 						    alc_headset_btn_callback);
3327 		break;
3328 	case HDA_FIXUP_ACT_BUILD:
3329 		hp_pin = alc_get_hp_pin(spec);
3330 		if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3331 							alc_headset_btn_keymap,
3332 							hp_pin))
3333 			snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3334 					      false, SND_JACK_HEADSET,
3335 					      alc_headset_btn_keymap);
3336 
3337 		alc_enable_headset_jack_key(codec);
3338 		break;
3339 	}
3340 }
3341 
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3342 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3343 {
3344 	alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3345 }
3346 
alc269_shutup(struct hda_codec * codec)3347 static void alc269_shutup(struct hda_codec *codec)
3348 {
3349 	struct alc_spec *spec = codec->spec;
3350 
3351 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3352 		alc269vb_toggle_power_output(codec, 0);
3353 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3354 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3355 		msleep(150);
3356 	}
3357 	alc_shutup_pins(codec);
3358 }
3359 
3360 static const struct coef_fw alc282_coefs[] = {
3361 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3362 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3363 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3364 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3365 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3366 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3367 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3368 	WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3369 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3370 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3371 	WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3372 	UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3373 	WRITE_COEF(0x34, 0xa0c0), /* ANC */
3374 	UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3375 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3376 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3377 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3378 	WRITE_COEF(0x63, 0x2902), /* PLL */
3379 	WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3380 	WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3381 	WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3382 	WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3383 	UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3384 	WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3385 	UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3386 	WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3387 	WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3388 	UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3389 	WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3390 	{}
3391 };
3392 
alc282_restore_default_value(struct hda_codec * codec)3393 static void alc282_restore_default_value(struct hda_codec *codec)
3394 {
3395 	alc_process_coef_fw(codec, alc282_coefs);
3396 }
3397 
alc282_init(struct hda_codec * codec)3398 static void alc282_init(struct hda_codec *codec)
3399 {
3400 	struct alc_spec *spec = codec->spec;
3401 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3402 	bool hp_pin_sense;
3403 	int coef78;
3404 
3405 	alc282_restore_default_value(codec);
3406 
3407 	if (!hp_pin)
3408 		return;
3409 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3410 	coef78 = alc_read_coef_idx(codec, 0x78);
3411 
3412 	/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3413 	/* Headphone capless set to high power mode */
3414 	alc_write_coef_idx(codec, 0x78, 0x9004);
3415 
3416 	if (hp_pin_sense)
3417 		msleep(2);
3418 
3419 	snd_hda_codec_write(codec, hp_pin, 0,
3420 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3421 
3422 	if (hp_pin_sense)
3423 		msleep(85);
3424 
3425 	snd_hda_codec_write(codec, hp_pin, 0,
3426 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3427 
3428 	if (hp_pin_sense)
3429 		msleep(100);
3430 
3431 	/* Headphone capless set to normal mode */
3432 	alc_write_coef_idx(codec, 0x78, coef78);
3433 }
3434 
alc282_shutup(struct hda_codec * codec)3435 static void alc282_shutup(struct hda_codec *codec)
3436 {
3437 	struct alc_spec *spec = codec->spec;
3438 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3439 	bool hp_pin_sense;
3440 	int coef78;
3441 
3442 	if (!hp_pin) {
3443 		alc269_shutup(codec);
3444 		return;
3445 	}
3446 
3447 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3448 	coef78 = alc_read_coef_idx(codec, 0x78);
3449 	alc_write_coef_idx(codec, 0x78, 0x9004);
3450 
3451 	if (hp_pin_sense)
3452 		msleep(2);
3453 
3454 	snd_hda_codec_write(codec, hp_pin, 0,
3455 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3456 
3457 	if (hp_pin_sense)
3458 		msleep(85);
3459 
3460 	if (!spec->no_shutup_pins)
3461 		snd_hda_codec_write(codec, hp_pin, 0,
3462 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3463 
3464 	if (hp_pin_sense)
3465 		msleep(100);
3466 
3467 	alc_auto_setup_eapd(codec, false);
3468 	alc_shutup_pins(codec);
3469 	alc_write_coef_idx(codec, 0x78, coef78);
3470 }
3471 
3472 static const struct coef_fw alc283_coefs[] = {
3473 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3474 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3475 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3476 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3477 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3478 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3479 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3480 	WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3481 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3482 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3483 	WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3484 	UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3485 	WRITE_COEF(0x22, 0xa0c0), /* ANC */
3486 	UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3487 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3488 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3489 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3490 	WRITE_COEF(0x2e, 0x2902), /* PLL */
3491 	WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3492 	WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3493 	WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3494 	WRITE_COEF(0x36, 0x0), /* capless control 5 */
3495 	UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3496 	WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3497 	UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3498 	WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3499 	WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3500 	UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3501 	WRITE_COEF(0x49, 0x0), /* test mode */
3502 	UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3503 	UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3504 	WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3505 	UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3506 	{}
3507 };
3508 
alc283_restore_default_value(struct hda_codec * codec)3509 static void alc283_restore_default_value(struct hda_codec *codec)
3510 {
3511 	alc_process_coef_fw(codec, alc283_coefs);
3512 }
3513 
alc283_init(struct hda_codec * codec)3514 static void alc283_init(struct hda_codec *codec)
3515 {
3516 	struct alc_spec *spec = codec->spec;
3517 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3518 	bool hp_pin_sense;
3519 
3520 	alc283_restore_default_value(codec);
3521 
3522 	if (!hp_pin)
3523 		return;
3524 
3525 	msleep(30);
3526 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3527 
3528 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3529 	/* Headphone capless set to high power mode */
3530 	alc_write_coef_idx(codec, 0x43, 0x9004);
3531 
3532 	snd_hda_codec_write(codec, hp_pin, 0,
3533 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3534 
3535 	if (hp_pin_sense)
3536 		msleep(85);
3537 
3538 	snd_hda_codec_write(codec, hp_pin, 0,
3539 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3540 
3541 	if (hp_pin_sense)
3542 		msleep(85);
3543 	/* Index 0x46 Combo jack auto switch control 2 */
3544 	/* 3k pull low control for Headset jack. */
3545 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3546 	/* Headphone capless set to normal mode */
3547 	alc_write_coef_idx(codec, 0x43, 0x9614);
3548 }
3549 
alc283_shutup(struct hda_codec * codec)3550 static void alc283_shutup(struct hda_codec *codec)
3551 {
3552 	struct alc_spec *spec = codec->spec;
3553 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3554 	bool hp_pin_sense;
3555 
3556 	if (!hp_pin) {
3557 		alc269_shutup(codec);
3558 		return;
3559 	}
3560 
3561 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3562 
3563 	alc_write_coef_idx(codec, 0x43, 0x9004);
3564 
3565 	/*depop hp during suspend*/
3566 	alc_write_coef_idx(codec, 0x06, 0x2100);
3567 
3568 	snd_hda_codec_write(codec, hp_pin, 0,
3569 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3570 
3571 	if (hp_pin_sense)
3572 		msleep(100);
3573 
3574 	if (!spec->no_shutup_pins)
3575 		snd_hda_codec_write(codec, hp_pin, 0,
3576 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3577 
3578 	alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3579 
3580 	if (hp_pin_sense)
3581 		msleep(100);
3582 	alc_auto_setup_eapd(codec, false);
3583 	alc_shutup_pins(codec);
3584 	alc_write_coef_idx(codec, 0x43, 0x9614);
3585 }
3586 
alc256_init(struct hda_codec * codec)3587 static void alc256_init(struct hda_codec *codec)
3588 {
3589 	struct alc_spec *spec = codec->spec;
3590 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3591 	bool hp_pin_sense;
3592 
3593 	if (spec->ultra_low_power) {
3594 		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3595 		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3596 		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3597 		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3598 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3599 		msleep(30);
3600 	}
3601 
3602 	if (!hp_pin)
3603 		hp_pin = 0x21;
3604 
3605 	msleep(30);
3606 
3607 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3608 
3609 	if (hp_pin_sense) {
3610 		msleep(2);
3611 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3612 
3613 		snd_hda_codec_write(codec, hp_pin, 0,
3614 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3615 
3616 		msleep(75);
3617 
3618 		snd_hda_codec_write(codec, hp_pin, 0,
3619 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3620 
3621 		msleep(75);
3622 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3623 	}
3624 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3625 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3626 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3627 	/*
3628 	 * Expose headphone mic (or possibly Line In on some machines) instead
3629 	 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3630 	 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3631 	 * this register.
3632 	 */
3633 	alc_write_coef_idx(codec, 0x36, 0x5757);
3634 }
3635 
alc256_shutup(struct hda_codec * codec)3636 static void alc256_shutup(struct hda_codec *codec)
3637 {
3638 	struct alc_spec *spec = codec->spec;
3639 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3640 	bool hp_pin_sense;
3641 
3642 	if (!hp_pin)
3643 		hp_pin = 0x21;
3644 
3645 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3646 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3647 
3648 	if (hp_pin_sense) {
3649 		msleep(2);
3650 
3651 		snd_hda_codec_write(codec, hp_pin, 0,
3652 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3653 
3654 		msleep(75);
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 		msleep(75);
3669 	}
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 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3767 
3768 		if (hp1_pin_sense)
3769 			snd_hda_codec_write(codec, hp_pin, 0,
3770 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3771 		if (hp2_pin_sense)
3772 			snd_hda_codec_write(codec, 0x16, 0,
3773 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3774 		msleep(75);
3775 
3776 		if (hp1_pin_sense)
3777 			snd_hda_codec_write(codec, hp_pin, 0,
3778 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3779 		if (hp2_pin_sense)
3780 			snd_hda_codec_write(codec, 0x16, 0,
3781 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3782 
3783 		msleep(75);
3784 		alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3785 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3786 	}
3787 }
3788 
alc225_shutup(struct hda_codec * codec)3789 static void alc225_shutup(struct hda_codec *codec)
3790 {
3791 	struct alc_spec *spec = codec->spec;
3792 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3793 	bool hp1_pin_sense, hp2_pin_sense;
3794 
3795 	if (!hp_pin)
3796 		hp_pin = 0x21;
3797 
3798 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3799 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3800 
3801 	if (hp1_pin_sense || hp2_pin_sense) {
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 		msleep(2);
3806 
3807 		if (hp1_pin_sense)
3808 			snd_hda_codec_write(codec, hp_pin, 0,
3809 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3810 		if (hp2_pin_sense)
3811 			snd_hda_codec_write(codec, 0x16, 0,
3812 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3813 
3814 		msleep(75);
3815 
3816 		if (hp1_pin_sense)
3817 			snd_hda_codec_write(codec, hp_pin, 0,
3818 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3819 		if (hp2_pin_sense)
3820 			snd_hda_codec_write(codec, 0x16, 0,
3821 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3822 
3823 		msleep(75);
3824 		alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3825 		alc_enable_headset_jack_key(codec);
3826 	}
3827 	alc_auto_setup_eapd(codec, false);
3828 	alc_shutup_pins(codec);
3829 	if (spec->ultra_low_power) {
3830 		msleep(50);
3831 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3832 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3833 		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3834 		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3835 		msleep(30);
3836 	}
3837 }
3838 
alc222_init(struct hda_codec * codec)3839 static void alc222_init(struct hda_codec *codec)
3840 {
3841 	struct alc_spec *spec = codec->spec;
3842 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3843 	bool hp1_pin_sense, hp2_pin_sense;
3844 
3845 	if (!hp_pin)
3846 		return;
3847 
3848 	msleep(30);
3849 
3850 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3851 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3852 
3853 	if (hp1_pin_sense || hp2_pin_sense) {
3854 		msleep(2);
3855 
3856 		if (hp1_pin_sense)
3857 			snd_hda_codec_write(codec, hp_pin, 0,
3858 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3859 		if (hp2_pin_sense)
3860 			snd_hda_codec_write(codec, 0x14, 0,
3861 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3862 		msleep(75);
3863 
3864 		if (hp1_pin_sense)
3865 			snd_hda_codec_write(codec, hp_pin, 0,
3866 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3867 		if (hp2_pin_sense)
3868 			snd_hda_codec_write(codec, 0x14, 0,
3869 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3870 
3871 		msleep(75);
3872 	}
3873 }
3874 
alc222_shutup(struct hda_codec * codec)3875 static void alc222_shutup(struct hda_codec *codec)
3876 {
3877 	struct alc_spec *spec = codec->spec;
3878 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3879 	bool hp1_pin_sense, hp2_pin_sense;
3880 
3881 	if (!hp_pin)
3882 		hp_pin = 0x21;
3883 
3884 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3885 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3886 
3887 	if (hp1_pin_sense || hp2_pin_sense) {
3888 		msleep(2);
3889 
3890 		if (hp1_pin_sense)
3891 			snd_hda_codec_write(codec, hp_pin, 0,
3892 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3893 		if (hp2_pin_sense)
3894 			snd_hda_codec_write(codec, 0x14, 0,
3895 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3896 
3897 		msleep(75);
3898 
3899 		if (hp1_pin_sense)
3900 			snd_hda_codec_write(codec, hp_pin, 0,
3901 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3902 		if (hp2_pin_sense)
3903 			snd_hda_codec_write(codec, 0x14, 0,
3904 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3905 
3906 		msleep(75);
3907 	}
3908 	alc_auto_setup_eapd(codec, false);
3909 	alc_shutup_pins(codec);
3910 }
3911 
alc_default_init(struct hda_codec * codec)3912 static void alc_default_init(struct hda_codec *codec)
3913 {
3914 	struct alc_spec *spec = codec->spec;
3915 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3916 	bool hp_pin_sense;
3917 
3918 	if (!hp_pin)
3919 		return;
3920 
3921 	msleep(30);
3922 
3923 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3924 
3925 	if (hp_pin_sense) {
3926 		msleep(2);
3927 
3928 		snd_hda_codec_write(codec, hp_pin, 0,
3929 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3930 
3931 		msleep(75);
3932 
3933 		snd_hda_codec_write(codec, hp_pin, 0,
3934 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3935 		msleep(75);
3936 	}
3937 }
3938 
alc_default_shutup(struct hda_codec * codec)3939 static void alc_default_shutup(struct hda_codec *codec)
3940 {
3941 	struct alc_spec *spec = codec->spec;
3942 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3943 	bool hp_pin_sense;
3944 
3945 	if (!hp_pin) {
3946 		alc269_shutup(codec);
3947 		return;
3948 	}
3949 
3950 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3951 
3952 	if (hp_pin_sense) {
3953 		msleep(2);
3954 
3955 		snd_hda_codec_write(codec, hp_pin, 0,
3956 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3957 
3958 		msleep(75);
3959 
3960 		if (!spec->no_shutup_pins)
3961 			snd_hda_codec_write(codec, hp_pin, 0,
3962 					    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3963 
3964 		msleep(75);
3965 	}
3966 	alc_auto_setup_eapd(codec, false);
3967 	alc_shutup_pins(codec);
3968 }
3969 
alc294_hp_init(struct hda_codec * codec)3970 static void alc294_hp_init(struct hda_codec *codec)
3971 {
3972 	struct alc_spec *spec = codec->spec;
3973 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3974 	int i, val;
3975 
3976 	if (!hp_pin)
3977 		return;
3978 
3979 	snd_hda_codec_write(codec, hp_pin, 0,
3980 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3981 
3982 	msleep(100);
3983 
3984 	if (!spec->no_shutup_pins)
3985 		snd_hda_codec_write(codec, hp_pin, 0,
3986 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3987 
3988 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3989 	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3990 
3991 	/* Wait for depop procedure finish  */
3992 	val = alc_read_coefex_idx(codec, 0x58, 0x01);
3993 	for (i = 0; i < 20 && val & 0x0080; i++) {
3994 		msleep(50);
3995 		val = alc_read_coefex_idx(codec, 0x58, 0x01);
3996 	}
3997 	/* Set HP depop to auto mode */
3998 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3999 	msleep(50);
4000 }
4001 
alc294_init(struct hda_codec * codec)4002 static void alc294_init(struct hda_codec *codec)
4003 {
4004 	struct alc_spec *spec = codec->spec;
4005 
4006 	/* required only at boot or S4 resume time */
4007 	if (!spec->done_hp_init ||
4008 	    codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
4009 		alc294_hp_init(codec);
4010 		spec->done_hp_init = true;
4011 	}
4012 	alc_default_init(codec);
4013 }
4014 
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)4015 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
4016 			     unsigned int val)
4017 {
4018 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
4019 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
4020 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
4021 }
4022 
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)4023 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
4024 {
4025 	unsigned int val;
4026 
4027 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
4028 	val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
4029 		& 0xffff;
4030 	val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
4031 		<< 16;
4032 	return val;
4033 }
4034 
alc5505_dsp_halt(struct hda_codec * codec)4035 static void alc5505_dsp_halt(struct hda_codec *codec)
4036 {
4037 	unsigned int val;
4038 
4039 	alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
4040 	alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
4041 	alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
4042 	alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
4043 	alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
4044 	alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
4045 	alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
4046 	val = alc5505_coef_get(codec, 0x6220);
4047 	alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
4048 }
4049 
alc5505_dsp_back_from_halt(struct hda_codec * codec)4050 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
4051 {
4052 	alc5505_coef_set(codec, 0x61b8, 0x04133302);
4053 	alc5505_coef_set(codec, 0x61b0, 0x00005b16);
4054 	alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
4055 	alc5505_coef_set(codec, 0x6230, 0xf80d4011);
4056 	alc5505_coef_set(codec, 0x6220, 0x2002010f);
4057 	alc5505_coef_set(codec, 0x880c, 0x00000004);
4058 }
4059 
alc5505_dsp_init(struct hda_codec * codec)4060 static void alc5505_dsp_init(struct hda_codec *codec)
4061 {
4062 	unsigned int val;
4063 
4064 	alc5505_dsp_halt(codec);
4065 	alc5505_dsp_back_from_halt(codec);
4066 	alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
4067 	alc5505_coef_set(codec, 0x61b0, 0x5b16);
4068 	alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
4069 	alc5505_coef_set(codec, 0x61b4, 0x04132b02);
4070 	alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
4071 	alc5505_coef_set(codec, 0x61b8, 0x041f3302);
4072 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
4073 	alc5505_coef_set(codec, 0x61b8, 0x041b3302);
4074 	alc5505_coef_set(codec, 0x61b8, 0x04173302);
4075 	alc5505_coef_set(codec, 0x61b8, 0x04163302);
4076 	alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4077 	alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4078 	alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4079 
4080 	val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4081 	if (val <= 3)
4082 		alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4083 	else
4084 		alc5505_coef_set(codec, 0x6220, 0x6002018f);
4085 
4086 	alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4087 	alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4088 	alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4089 	alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4090 	alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4091 	alc5505_coef_set(codec, 0x880c, 0x00000003);
4092 	alc5505_coef_set(codec, 0x880c, 0x00000010);
4093 
4094 #ifdef HALT_REALTEK_ALC5505
4095 	alc5505_dsp_halt(codec);
4096 #endif
4097 }
4098 
4099 #ifdef HALT_REALTEK_ALC5505
4100 #define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
4101 #define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
4102 #else
4103 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
4104 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
4105 #endif
4106 
4107 #ifdef CONFIG_PM
alc269_suspend(struct hda_codec * codec)4108 static int alc269_suspend(struct hda_codec *codec)
4109 {
4110 	struct alc_spec *spec = codec->spec;
4111 
4112 	if (spec->has_alc5505_dsp)
4113 		alc5505_dsp_suspend(codec);
4114 
4115 	return alc_suspend(codec);
4116 }
4117 
alc269_resume(struct hda_codec * codec)4118 static int alc269_resume(struct hda_codec *codec)
4119 {
4120 	struct alc_spec *spec = codec->spec;
4121 
4122 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4123 		alc269vb_toggle_power_output(codec, 0);
4124 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4125 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
4126 		msleep(150);
4127 	}
4128 
4129 	codec->patch_ops.init(codec);
4130 
4131 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4132 		alc269vb_toggle_power_output(codec, 1);
4133 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4134 			(alc_get_coef0(codec) & 0x00ff) == 0x017) {
4135 		msleep(200);
4136 	}
4137 
4138 	snd_hda_regmap_sync(codec);
4139 	hda_call_check_power_status(codec, 0x01);
4140 
4141 	/* on some machine, the BIOS will clear the codec gpio data when enter
4142 	 * suspend, and won't restore the data after resume, so we restore it
4143 	 * in the driver.
4144 	 */
4145 	if (spec->gpio_data)
4146 		alc_write_gpio_data(codec);
4147 
4148 	if (spec->has_alc5505_dsp)
4149 		alc5505_dsp_resume(codec);
4150 
4151 	return 0;
4152 }
4153 #endif /* CONFIG_PM */
4154 
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4155 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4156 						 const struct hda_fixup *fix, int action)
4157 {
4158 	struct alc_spec *spec = codec->spec;
4159 
4160 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4161 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4162 }
4163 
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4164 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4165 						 const struct hda_fixup *fix,
4166 						 int action)
4167 {
4168 	unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4169 	unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4170 
4171 	if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4172 		snd_hda_codec_set_pincfg(codec, 0x19,
4173 			(cfg_headphone & ~AC_DEFCFG_DEVICE) |
4174 			(AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4175 }
4176 
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4177 static void alc269_fixup_hweq(struct hda_codec *codec,
4178 			       const struct hda_fixup *fix, int action)
4179 {
4180 	if (action == HDA_FIXUP_ACT_INIT)
4181 		alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4182 }
4183 
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4184 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4185 				       const struct hda_fixup *fix, int action)
4186 {
4187 	struct alc_spec *spec = codec->spec;
4188 
4189 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4190 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4191 }
4192 
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4193 static void alc271_fixup_dmic(struct hda_codec *codec,
4194 			      const struct hda_fixup *fix, int action)
4195 {
4196 	static const struct hda_verb verbs[] = {
4197 		{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4198 		{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4199 		{}
4200 	};
4201 	unsigned int cfg;
4202 
4203 	if (strcmp(codec->core.chip_name, "ALC271X") &&
4204 	    strcmp(codec->core.chip_name, "ALC269VB"))
4205 		return;
4206 	cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4207 	if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4208 		snd_hda_sequence_write(codec, verbs);
4209 }
4210 
4211 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4212 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4213 					  const struct hda_fixup *fix,
4214 					  int action)
4215 {
4216 	if (action == HDA_FIXUP_ACT_INIT)
4217 		alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4218 }
4219 
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4220 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4221 				 const struct hda_fixup *fix, int action)
4222 {
4223 	struct alc_spec *spec = codec->spec;
4224 
4225 	if (action != HDA_FIXUP_ACT_PROBE)
4226 		return;
4227 
4228 	/* Due to a hardware problem on Lenovo Ideadpad, we need to
4229 	 * fix the sample rate of analog I/O to 44.1kHz
4230 	 */
4231 	spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4232 	spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4233 }
4234 
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4235 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4236 				     const struct hda_fixup *fix, int action)
4237 {
4238 	/* The digital-mic unit sends PDM (differential signal) instead of
4239 	 * the standard PCM, thus you can't record a valid mono stream as is.
4240 	 * Below is a workaround specific to ALC269 to control the dmic
4241 	 * signal source as mono.
4242 	 */
4243 	if (action == HDA_FIXUP_ACT_INIT)
4244 		alc_update_coef_idx(codec, 0x07, 0, 0x80);
4245 }
4246 
alc269_quanta_automute(struct hda_codec * codec)4247 static void alc269_quanta_automute(struct hda_codec *codec)
4248 {
4249 	snd_hda_gen_update_outputs(codec);
4250 
4251 	alc_write_coef_idx(codec, 0x0c, 0x680);
4252 	alc_write_coef_idx(codec, 0x0c, 0x480);
4253 }
4254 
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4255 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4256 				     const struct hda_fixup *fix, int action)
4257 {
4258 	struct alc_spec *spec = codec->spec;
4259 	if (action != HDA_FIXUP_ACT_PROBE)
4260 		return;
4261 	spec->gen.automute_hook = alc269_quanta_automute;
4262 }
4263 
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4264 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4265 					 struct hda_jack_callback *jack)
4266 {
4267 	struct alc_spec *spec = codec->spec;
4268 	int vref;
4269 	msleep(200);
4270 	snd_hda_gen_hp_automute(codec, jack);
4271 
4272 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4273 	msleep(100);
4274 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4275 			    vref);
4276 	msleep(500);
4277 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4278 			    vref);
4279 }
4280 
4281 /*
4282  * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4283  */
4284 struct hda_alc298_mbxinit {
4285 	unsigned char value_0x23;
4286 	unsigned char value_0x25;
4287 };
4288 
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4289 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4290 					 const struct hda_alc298_mbxinit *initval,
4291 					 bool first)
4292 {
4293 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4294 	alc_write_coef_idx(codec, 0x26, 0xb000);
4295 
4296 	if (first)
4297 		snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4298 
4299 	snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4300 	alc_write_coef_idx(codec, 0x26, 0xf000);
4301 	alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4302 
4303 	if (initval->value_0x23 != 0x1e)
4304 		alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4305 
4306 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4307 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4308 }
4309 
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4310 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4311 					   const struct hda_fixup *fix,
4312 					   int action)
4313 {
4314 	/* Initialization magic */
4315 	static const struct hda_alc298_mbxinit dac_init[] = {
4316 		{0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4317 		{0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4318 		{0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4319 		{0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4320 		{0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4321 		{0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4322 		{0x2f, 0x00},
4323 		{0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4324 		{0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4325 		{0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4326 		{}
4327 	};
4328 	const struct hda_alc298_mbxinit *seq;
4329 
4330 	if (action != HDA_FIXUP_ACT_INIT)
4331 		return;
4332 
4333 	/* Start */
4334 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4335 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4336 	alc_write_coef_idx(codec, 0x26, 0xf000);
4337 	alc_write_coef_idx(codec, 0x22, 0x31);
4338 	alc_write_coef_idx(codec, 0x23, 0x0b);
4339 	alc_write_coef_idx(codec, 0x25, 0x00);
4340 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4341 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4342 
4343 	for (seq = dac_init; seq->value_0x23; seq++)
4344 		alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4345 }
4346 
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4347 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4348 				     const struct hda_fixup *fix, int action)
4349 {
4350 	struct alc_spec *spec = codec->spec;
4351 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4352 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4353 		spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4354 	}
4355 }
4356 
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4357 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4358 				bool polarity, bool on)
4359 {
4360 	unsigned int pinval;
4361 
4362 	if (!pin)
4363 		return;
4364 	if (polarity)
4365 		on = !on;
4366 	pinval = snd_hda_codec_get_pin_target(codec, pin);
4367 	pinval &= ~AC_PINCTL_VREFEN;
4368 	pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4369 	/* temporarily power up/down for setting VREF */
4370 	snd_hda_power_up_pm(codec);
4371 	snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4372 	snd_hda_power_down_pm(codec);
4373 }
4374 
4375 /* 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)4376 static int vref_mute_led_set(struct led_classdev *led_cdev,
4377 			     enum led_brightness brightness)
4378 {
4379 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4380 	struct alc_spec *spec = codec->spec;
4381 
4382 	alc_update_vref_led(codec, spec->mute_led_nid,
4383 			    spec->mute_led_polarity, brightness);
4384 	return 0;
4385 }
4386 
4387 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4388 static unsigned int led_power_filter(struct hda_codec *codec,
4389 						  hda_nid_t nid,
4390 						  unsigned int power_state)
4391 {
4392 	struct alc_spec *spec = codec->spec;
4393 
4394 	if (power_state != AC_PWRST_D3 || nid == 0 ||
4395 	    (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4396 		return power_state;
4397 
4398 	/* Set pin ctl again, it might have just been set to 0 */
4399 	snd_hda_set_pin_ctl(codec, nid,
4400 			    snd_hda_codec_get_pin_target(codec, nid));
4401 
4402 	return snd_hda_gen_path_power_filter(codec, nid, power_state);
4403 }
4404 
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4405 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4406 				     const struct hda_fixup *fix, int action)
4407 {
4408 	struct alc_spec *spec = codec->spec;
4409 	const struct dmi_device *dev = NULL;
4410 
4411 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4412 		return;
4413 
4414 	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4415 		int pol, pin;
4416 		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4417 			continue;
4418 		if (pin < 0x0a || pin >= 0x10)
4419 			break;
4420 		spec->mute_led_polarity = pol;
4421 		spec->mute_led_nid = pin - 0x0a + 0x18;
4422 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4423 		codec->power_filter = led_power_filter;
4424 		codec_dbg(codec,
4425 			  "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4426 			   spec->mute_led_polarity);
4427 		break;
4428 	}
4429 }
4430 
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4431 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4432 					  const struct hda_fixup *fix,
4433 					  int action, hda_nid_t pin)
4434 {
4435 	struct alc_spec *spec = codec->spec;
4436 
4437 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4438 		spec->mute_led_polarity = 0;
4439 		spec->mute_led_nid = pin;
4440 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4441 		codec->power_filter = led_power_filter;
4442 	}
4443 }
4444 
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4445 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4446 				const struct hda_fixup *fix, int action)
4447 {
4448 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4449 }
4450 
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4451 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4452 				const struct hda_fixup *fix, int action)
4453 {
4454 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4455 }
4456 
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4457 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4458 				const struct hda_fixup *fix, int action)
4459 {
4460 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4461 }
4462 
4463 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4464 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4465 				int polarity, bool enabled)
4466 {
4467 	if (polarity)
4468 		enabled = !enabled;
4469 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4470 }
4471 
4472 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4473 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4474 			     enum led_brightness brightness)
4475 {
4476 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4477 	struct alc_spec *spec = codec->spec;
4478 
4479 	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4480 			    spec->mute_led_polarity, !brightness);
4481 	return 0;
4482 }
4483 
4484 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4485 static int micmute_led_set(struct led_classdev *led_cdev,
4486 			   enum led_brightness brightness)
4487 {
4488 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4489 	struct alc_spec *spec = codec->spec;
4490 
4491 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4492 			    spec->micmute_led_polarity, !brightness);
4493 	return 0;
4494 }
4495 
4496 /* 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)4497 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4498 				  int action,
4499 				  unsigned int mute_mask,
4500 				  unsigned int micmute_mask)
4501 {
4502 	struct alc_spec *spec = codec->spec;
4503 
4504 	alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4505 
4506 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4507 		return;
4508 	if (mute_mask) {
4509 		spec->gpio_mute_led_mask = mute_mask;
4510 		snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4511 	}
4512 	if (micmute_mask) {
4513 		spec->gpio_mic_led_mask = micmute_mask;
4514 		snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4515 	}
4516 }
4517 
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4518 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4519 				const struct hda_fixup *fix, int action)
4520 {
4521 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4522 }
4523 
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4524 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4525 				const struct hda_fixup *fix, int action)
4526 {
4527 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4528 }
4529 
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4530 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4531 				const struct hda_fixup *fix, int action)
4532 {
4533 	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4534 }
4535 
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4536 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4537 				const struct hda_fixup *fix, int action)
4538 {
4539 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4540 }
4541 
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4542 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4543 				const struct hda_fixup *fix, int action)
4544 {
4545 	alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4546 }
4547 
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4548 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4549 				const struct hda_fixup *fix, int action)
4550 {
4551 	struct alc_spec *spec = codec->spec;
4552 
4553 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4554 		spec->micmute_led_polarity = 1;
4555 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4556 }
4557 
4558 /* 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)4559 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4560 				enum led_brightness brightness)
4561 {
4562 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4563 	struct alc_spec *spec = codec->spec;
4564 
4565 	alc_update_vref_led(codec, spec->cap_mute_led_nid,
4566 			    spec->micmute_led_polarity, brightness);
4567 	return 0;
4568 }
4569 
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4570 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4571 				const struct hda_fixup *fix, int action)
4572 {
4573 	struct alc_spec *spec = codec->spec;
4574 
4575 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4576 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4577 		/* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4578 		 * enable headphone amp
4579 		 */
4580 		spec->gpio_mask |= 0x10;
4581 		spec->gpio_dir |= 0x10;
4582 		spec->cap_mute_led_nid = 0x18;
4583 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4584 		codec->power_filter = led_power_filter;
4585 	}
4586 }
4587 
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4588 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4589 				   const struct hda_fixup *fix, int action)
4590 {
4591 	struct alc_spec *spec = codec->spec;
4592 
4593 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4594 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4595 		spec->cap_mute_led_nid = 0x18;
4596 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4597 		codec->power_filter = led_power_filter;
4598 	}
4599 }
4600 
4601 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4602  * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4603  */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4604 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4605 				     const struct hda_fixup *fix, int action)
4606 {
4607 	struct alc_spec *spec = codec->spec;
4608 
4609 	switch (action) {
4610 	case HDA_FIXUP_ACT_PRE_PROBE:
4611 		spec->gpio_mask |= 0x01;
4612 		spec->gpio_dir |= 0x01;
4613 		break;
4614 	case HDA_FIXUP_ACT_INIT:
4615 		/* need to toggle GPIO to enable the amp */
4616 		alc_update_gpio_data(codec, 0x01, true);
4617 		msleep(100);
4618 		alc_update_gpio_data(codec, 0x01, false);
4619 		break;
4620 	}
4621 }
4622 
4623 /* 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)4624 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4625 				    struct hda_codec *codec,
4626 				    struct snd_pcm_substream *substream,
4627 				    int action)
4628 {
4629 	switch (action) {
4630 	case HDA_GEN_PCM_ACT_PREPARE:
4631 		alc_update_gpio_data(codec, 0x04, true);
4632 		break;
4633 	case HDA_GEN_PCM_ACT_CLEANUP:
4634 		alc_update_gpio_data(codec, 0x04, false);
4635 		break;
4636 	}
4637 }
4638 
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4639 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4640 				      const struct hda_fixup *fix,
4641 				      int action)
4642 {
4643 	struct alc_spec *spec = codec->spec;
4644 
4645 	if (action == HDA_FIXUP_ACT_PROBE) {
4646 		spec->gpio_mask |= 0x04;
4647 		spec->gpio_dir |= 0x04;
4648 		spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4649 	}
4650 }
4651 
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4652 static void alc_update_coef_led(struct hda_codec *codec,
4653 				struct alc_coef_led *led,
4654 				bool polarity, bool on)
4655 {
4656 	if (polarity)
4657 		on = !on;
4658 	/* temporarily power up/down for setting COEF bit */
4659 	alc_update_coef_idx(codec, led->idx, led->mask,
4660 			    on ? led->on : led->off);
4661 }
4662 
4663 /* 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)4664 static int coef_mute_led_set(struct led_classdev *led_cdev,
4665 			     enum led_brightness brightness)
4666 {
4667 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4668 	struct alc_spec *spec = codec->spec;
4669 
4670 	alc_update_coef_led(codec, &spec->mute_led_coef,
4671 			    spec->mute_led_polarity, brightness);
4672 	return 0;
4673 }
4674 
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4675 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4676 					  const struct hda_fixup *fix,
4677 					  int action)
4678 {
4679 	struct alc_spec *spec = codec->spec;
4680 
4681 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4682 		spec->mute_led_polarity = 0;
4683 		spec->mute_led_coef.idx = 0x0b;
4684 		spec->mute_led_coef.mask = 1 << 3;
4685 		spec->mute_led_coef.on = 1 << 3;
4686 		spec->mute_led_coef.off = 0;
4687 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4688 	}
4689 }
4690 
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4691 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4692 					  const struct hda_fixup *fix,
4693 					  int action)
4694 {
4695 	struct alc_spec *spec = codec->spec;
4696 
4697 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4698 		spec->mute_led_polarity = 0;
4699 		spec->mute_led_coef.idx = 0x34;
4700 		spec->mute_led_coef.mask = 1 << 5;
4701 		spec->mute_led_coef.on = 0;
4702 		spec->mute_led_coef.off = 1 << 5;
4703 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4704 	}
4705 }
4706 
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4707 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4708 					  const struct hda_fixup *fix, int action)
4709 {
4710 	struct alc_spec *spec = codec->spec;
4711 
4712 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4713 		spec->mute_led_polarity = 0;
4714 		spec->mute_led_coef.idx = 0x07;
4715 		spec->mute_led_coef.mask = 1;
4716 		spec->mute_led_coef.on = 1;
4717 		spec->mute_led_coef.off = 0;
4718 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4719 	}
4720 }
4721 
alc245_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4722 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4723 					  const struct hda_fixup *fix,
4724 					  int action)
4725 {
4726 	struct alc_spec *spec = codec->spec;
4727 
4728 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4729 		spec->mute_led_polarity = 0;
4730 		spec->mute_led_coef.idx = 0x0b;
4731 		spec->mute_led_coef.mask = 3 << 2;
4732 		spec->mute_led_coef.on = 2 << 2;
4733 		spec->mute_led_coef.off = 1 << 2;
4734 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4735 	}
4736 }
4737 
4738 /* 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)4739 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4740 				enum led_brightness brightness)
4741 {
4742 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4743 	struct alc_spec *spec = codec->spec;
4744 
4745 	alc_update_coef_led(codec, &spec->mic_led_coef,
4746 			    spec->micmute_led_polarity, brightness);
4747 	return 0;
4748 }
4749 
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4750 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4751 				const struct hda_fixup *fix, int action)
4752 {
4753 	struct alc_spec *spec = codec->spec;
4754 
4755 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4756 		spec->mic_led_coef.idx = 0x19;
4757 		spec->mic_led_coef.mask = 1 << 13;
4758 		spec->mic_led_coef.on = 1 << 13;
4759 		spec->mic_led_coef.off = 0;
4760 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4761 	}
4762 }
4763 
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4764 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4765 				const struct hda_fixup *fix, int action)
4766 {
4767 	struct alc_spec *spec = codec->spec;
4768 
4769 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4770 		spec->micmute_led_polarity = 1;
4771 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4772 }
4773 
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4774 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4775 				const struct hda_fixup *fix, int action)
4776 {
4777 	struct alc_spec *spec = codec->spec;
4778 
4779 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4780 		spec->mic_led_coef.idx = 0x35;
4781 		spec->mic_led_coef.mask = 3 << 2;
4782 		spec->mic_led_coef.on = 2 << 2;
4783 		spec->mic_led_coef.off = 1 << 2;
4784 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4785 	}
4786 }
4787 
alc295_fixup_hp_mute_led_coefbit11(struct hda_codec * codec,const struct hda_fixup * fix,int action)4788 static void alc295_fixup_hp_mute_led_coefbit11(struct hda_codec *codec,
4789 				const struct hda_fixup *fix, int action)
4790 {
4791 	struct alc_spec *spec = codec->spec;
4792 
4793 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4794 		spec->mute_led_polarity = 0;
4795 		spec->mute_led_coef.idx = 0xb;
4796 		spec->mute_led_coef.mask = 3 << 3;
4797 		spec->mute_led_coef.on = 1 << 3;
4798 		spec->mute_led_coef.off = 1 << 4;
4799 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4800 	}
4801 }
4802 
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4803 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4804 				const struct hda_fixup *fix, int action)
4805 {
4806 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4807 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4808 }
4809 
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4810 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4811 				const struct hda_fixup *fix, int action)
4812 {
4813 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4814 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4815 }
4816 
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4817 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4818 				const struct hda_fixup *fix, int action)
4819 {
4820 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4821 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4822 }
4823 
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4824 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4825 				const struct hda_fixup *fix, int action)
4826 {
4827 	struct alc_spec *spec = codec->spec;
4828 
4829 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4830 		spec->cap_mute_led_nid = 0x1a;
4831 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4832 		codec->power_filter = led_power_filter;
4833 	}
4834 }
4835 
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4836 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4837 				const struct hda_fixup *fix, int action)
4838 {
4839 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4840 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4841 }
4842 
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4843 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4844 						  const unsigned short coefs[2])
4845 {
4846 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4847 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4848 	alc_write_coef_idx(codec, 0x26, 0xb011);
4849 }
4850 
4851 struct alc298_samsung_amp_desc {
4852 	unsigned char nid;
4853 	unsigned short init_seq[2][2];
4854 };
4855 
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4856 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4857 				     const struct hda_fixup *fix, int action)
4858 {
4859 	int i, j;
4860 	static const unsigned short init_seq[][2] = {
4861 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4862 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4863 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4864 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4865 	};
4866 	static const struct alc298_samsung_amp_desc amps[] = {
4867 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4868 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4869 	};
4870 
4871 	if (action != HDA_FIXUP_ACT_INIT)
4872 		return;
4873 
4874 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4875 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4876 
4877 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4878 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4879 
4880 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4881 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4882 	}
4883 }
4884 
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)4885 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4886 				   struct hda_jack_callback *event)
4887 {
4888 	struct alc_spec *spec = codec->spec;
4889 
4890 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4891 	   send both key on and key off event for every interrupt. */
4892 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4893 	input_sync(spec->kb_dev);
4894 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4895 	input_sync(spec->kb_dev);
4896 }
4897 
alc_register_micmute_input_device(struct hda_codec * codec)4898 static int alc_register_micmute_input_device(struct hda_codec *codec)
4899 {
4900 	struct alc_spec *spec = codec->spec;
4901 	int i;
4902 
4903 	spec->kb_dev = input_allocate_device();
4904 	if (!spec->kb_dev) {
4905 		codec_err(codec, "Out of memory (input_allocate_device)\n");
4906 		return -ENOMEM;
4907 	}
4908 
4909 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4910 
4911 	spec->kb_dev->name = "Microphone Mute Button";
4912 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4913 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4914 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4915 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4916 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4917 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4918 
4919 	if (input_register_device(spec->kb_dev)) {
4920 		codec_err(codec, "input_register_device failed\n");
4921 		input_free_device(spec->kb_dev);
4922 		spec->kb_dev = NULL;
4923 		return -ENOMEM;
4924 	}
4925 
4926 	return 0;
4927 }
4928 
4929 /* GPIO1 = set according to SKU external amp
4930  * GPIO2 = mic mute hotkey
4931  * GPIO3 = mute LED
4932  * GPIO4 = mic mute LED
4933  */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4934 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4935 					     const struct hda_fixup *fix, int action)
4936 {
4937 	struct alc_spec *spec = codec->spec;
4938 
4939 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4940 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4941 		spec->init_amp = ALC_INIT_DEFAULT;
4942 		if (alc_register_micmute_input_device(codec) != 0)
4943 			return;
4944 
4945 		spec->gpio_mask |= 0x06;
4946 		spec->gpio_dir |= 0x02;
4947 		spec->gpio_data |= 0x02;
4948 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4949 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4950 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4951 						    gpio2_mic_hotkey_event);
4952 		return;
4953 	}
4954 
4955 	if (!spec->kb_dev)
4956 		return;
4957 
4958 	switch (action) {
4959 	case HDA_FIXUP_ACT_FREE:
4960 		input_unregister_device(spec->kb_dev);
4961 		spec->kb_dev = NULL;
4962 	}
4963 }
4964 
4965 /* Line2 = mic mute hotkey
4966  * GPIO2 = mic mute LED
4967  */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4968 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4969 					     const struct hda_fixup *fix, int action)
4970 {
4971 	struct alc_spec *spec = codec->spec;
4972 
4973 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4974 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4975 		spec->init_amp = ALC_INIT_DEFAULT;
4976 		if (alc_register_micmute_input_device(codec) != 0)
4977 			return;
4978 
4979 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
4980 						    gpio2_mic_hotkey_event);
4981 		return;
4982 	}
4983 
4984 	if (!spec->kb_dev)
4985 		return;
4986 
4987 	switch (action) {
4988 	case HDA_FIXUP_ACT_FREE:
4989 		input_unregister_device(spec->kb_dev);
4990 		spec->kb_dev = NULL;
4991 	}
4992 }
4993 
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4994 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4995 				const struct hda_fixup *fix, int action)
4996 {
4997 	struct alc_spec *spec = codec->spec;
4998 
4999 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
5000 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5001 		spec->cap_mute_led_nid = 0x18;
5002 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
5003 	}
5004 }
5005 
alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)5006 static void alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec *codec,
5007 				const struct hda_fixup *fix, int action)
5008 {
5009 	struct alc_spec *spec = codec->spec;
5010 
5011 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
5012 		spec->micmute_led_polarity = 1;
5013 	alc233_fixup_lenovo_line2_mic_hotkey(codec, fix, action);
5014 }
5015 
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)5016 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
5017 {
5018 	if (delay <= 0)
5019 		delay = 75;
5020 	snd_hda_codec_write(codec, 0x21, 0,
5021 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5022 	msleep(delay);
5023 	snd_hda_codec_write(codec, 0x21, 0,
5024 		    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5025 	msleep(delay);
5026 }
5027 
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)5028 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
5029 {
5030 	if (delay <= 0)
5031 		delay = 75;
5032 	snd_hda_codec_write(codec, 0x21, 0,
5033 		    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5034 	msleep(delay);
5035 	snd_hda_codec_write(codec, 0x21, 0,
5036 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5037 	msleep(delay);
5038 }
5039 
5040 static const struct coef_fw alc225_pre_hsmode[] = {
5041 	UPDATE_COEF(0x4a, 1<<8, 0),
5042 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
5043 	UPDATE_COEF(0x63, 3<<14, 3<<14),
5044 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
5045 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
5046 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
5047 	UPDATE_COEF(0x4a, 3<<10, 0),
5048 	{}
5049 };
5050 
alc_headset_mode_unplugged(struct hda_codec * codec)5051 static void alc_headset_mode_unplugged(struct hda_codec *codec)
5052 {
5053 	struct alc_spec *spec = codec->spec;
5054 	static const struct coef_fw coef0255[] = {
5055 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
5056 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5057 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5058 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5059 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
5060 		{}
5061 	};
5062 	static const struct coef_fw coef0256[] = {
5063 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
5064 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5065 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5066 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
5067 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5068 		{}
5069 	};
5070 	static const struct coef_fw coef0233[] = {
5071 		WRITE_COEF(0x1b, 0x0c0b),
5072 		WRITE_COEF(0x45, 0xc429),
5073 		UPDATE_COEF(0x35, 0x4000, 0),
5074 		WRITE_COEF(0x06, 0x2104),
5075 		WRITE_COEF(0x1a, 0x0001),
5076 		WRITE_COEF(0x26, 0x0004),
5077 		WRITE_COEF(0x32, 0x42a3),
5078 		{}
5079 	};
5080 	static const struct coef_fw coef0288[] = {
5081 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5082 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5083 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5084 		UPDATE_COEF(0x66, 0x0008, 0),
5085 		UPDATE_COEF(0x67, 0x2000, 0),
5086 		{}
5087 	};
5088 	static const struct coef_fw coef0298[] = {
5089 		UPDATE_COEF(0x19, 0x1300, 0x0300),
5090 		{}
5091 	};
5092 	static const struct coef_fw coef0292[] = {
5093 		WRITE_COEF(0x76, 0x000e),
5094 		WRITE_COEF(0x6c, 0x2400),
5095 		WRITE_COEF(0x18, 0x7308),
5096 		WRITE_COEF(0x6b, 0xc429),
5097 		{}
5098 	};
5099 	static const struct coef_fw coef0293[] = {
5100 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5101 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5102 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5103 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5104 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5105 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5106 		{}
5107 	};
5108 	static const struct coef_fw coef0668[] = {
5109 		WRITE_COEF(0x15, 0x0d40),
5110 		WRITE_COEF(0xb7, 0x802b),
5111 		{}
5112 	};
5113 	static const struct coef_fw coef0225[] = {
5114 		UPDATE_COEF(0x63, 3<<14, 0),
5115 		{}
5116 	};
5117 	static const struct coef_fw coef0274[] = {
5118 		UPDATE_COEF(0x4a, 0x0100, 0),
5119 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5120 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
5121 		UPDATE_COEF(0x4a, 0x0010, 0),
5122 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5123 		WRITE_COEF(0x45, 0x5289),
5124 		UPDATE_COEF(0x4a, 0x0c00, 0),
5125 		{}
5126 	};
5127 
5128 	if (spec->no_internal_mic_pin) {
5129 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5130 		return;
5131 	}
5132 
5133 	switch (codec->core.vendor_id) {
5134 	case 0x10ec0255:
5135 		alc_process_coef_fw(codec, coef0255);
5136 		break;
5137 	case 0x10ec0230:
5138 	case 0x10ec0236:
5139 	case 0x10ec0256:
5140 	case 0x19e58326:
5141 		alc_hp_mute_disable(codec, 75);
5142 		alc_process_coef_fw(codec, coef0256);
5143 		break;
5144 	case 0x10ec0234:
5145 	case 0x10ec0274:
5146 	case 0x10ec0294:
5147 		alc_process_coef_fw(codec, coef0274);
5148 		break;
5149 	case 0x10ec0233:
5150 	case 0x10ec0283:
5151 		alc_process_coef_fw(codec, coef0233);
5152 		break;
5153 	case 0x10ec0286:
5154 	case 0x10ec0288:
5155 		alc_process_coef_fw(codec, coef0288);
5156 		break;
5157 	case 0x10ec0298:
5158 		alc_process_coef_fw(codec, coef0298);
5159 		alc_process_coef_fw(codec, coef0288);
5160 		break;
5161 	case 0x10ec0292:
5162 		alc_process_coef_fw(codec, coef0292);
5163 		break;
5164 	case 0x10ec0293:
5165 		alc_process_coef_fw(codec, coef0293);
5166 		break;
5167 	case 0x10ec0668:
5168 		alc_process_coef_fw(codec, coef0668);
5169 		break;
5170 	case 0x10ec0215:
5171 	case 0x10ec0225:
5172 	case 0x10ec0285:
5173 	case 0x10ec0295:
5174 	case 0x10ec0289:
5175 	case 0x10ec0299:
5176 		alc_hp_mute_disable(codec, 75);
5177 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5178 		alc_process_coef_fw(codec, coef0225);
5179 		break;
5180 	case 0x10ec0867:
5181 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5182 		break;
5183 	}
5184 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5185 }
5186 
5187 
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5188 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5189 				    hda_nid_t mic_pin)
5190 {
5191 	static const struct coef_fw coef0255[] = {
5192 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5193 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5194 		{}
5195 	};
5196 	static const struct coef_fw coef0256[] = {
5197 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5198 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5199 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5200 		{}
5201 	};
5202 	static const struct coef_fw coef0233[] = {
5203 		UPDATE_COEF(0x35, 0, 1<<14),
5204 		WRITE_COEF(0x06, 0x2100),
5205 		WRITE_COEF(0x1a, 0x0021),
5206 		WRITE_COEF(0x26, 0x008c),
5207 		{}
5208 	};
5209 	static const struct coef_fw coef0288[] = {
5210 		UPDATE_COEF(0x4f, 0x00c0, 0),
5211 		UPDATE_COEF(0x50, 0x2000, 0),
5212 		UPDATE_COEF(0x56, 0x0006, 0),
5213 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5214 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5215 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5216 		{}
5217 	};
5218 	static const struct coef_fw coef0292[] = {
5219 		WRITE_COEF(0x19, 0xa208),
5220 		WRITE_COEF(0x2e, 0xacf0),
5221 		{}
5222 	};
5223 	static const struct coef_fw coef0293[] = {
5224 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5225 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5226 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5227 		{}
5228 	};
5229 	static const struct coef_fw coef0688[] = {
5230 		WRITE_COEF(0xb7, 0x802b),
5231 		WRITE_COEF(0xb5, 0x1040),
5232 		UPDATE_COEF(0xc3, 0, 1<<12),
5233 		{}
5234 	};
5235 	static const struct coef_fw coef0225[] = {
5236 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5237 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5238 		UPDATE_COEF(0x63, 3<<14, 0),
5239 		{}
5240 	};
5241 	static const struct coef_fw coef0274[] = {
5242 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5243 		UPDATE_COEF(0x4a, 0x0010, 0),
5244 		UPDATE_COEF(0x6b, 0xf000, 0),
5245 		{}
5246 	};
5247 
5248 	switch (codec->core.vendor_id) {
5249 	case 0x10ec0255:
5250 		alc_write_coef_idx(codec, 0x45, 0xc489);
5251 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5252 		alc_process_coef_fw(codec, coef0255);
5253 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5254 		break;
5255 	case 0x10ec0230:
5256 	case 0x10ec0236:
5257 	case 0x10ec0256:
5258 	case 0x19e58326:
5259 		alc_write_coef_idx(codec, 0x45, 0xc489);
5260 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5261 		alc_process_coef_fw(codec, coef0256);
5262 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5263 		break;
5264 	case 0x10ec0234:
5265 	case 0x10ec0274:
5266 	case 0x10ec0294:
5267 		alc_write_coef_idx(codec, 0x45, 0x4689);
5268 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5269 		alc_process_coef_fw(codec, coef0274);
5270 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5271 		break;
5272 	case 0x10ec0233:
5273 	case 0x10ec0283:
5274 		alc_write_coef_idx(codec, 0x45, 0xc429);
5275 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5276 		alc_process_coef_fw(codec, coef0233);
5277 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5278 		break;
5279 	case 0x10ec0286:
5280 	case 0x10ec0288:
5281 	case 0x10ec0298:
5282 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5283 		alc_process_coef_fw(codec, coef0288);
5284 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5285 		break;
5286 	case 0x10ec0292:
5287 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5288 		alc_process_coef_fw(codec, coef0292);
5289 		break;
5290 	case 0x10ec0293:
5291 		/* Set to TRS mode */
5292 		alc_write_coef_idx(codec, 0x45, 0xc429);
5293 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5294 		alc_process_coef_fw(codec, coef0293);
5295 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5296 		break;
5297 	case 0x10ec0867:
5298 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5299 		fallthrough;
5300 	case 0x10ec0221:
5301 	case 0x10ec0662:
5302 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5303 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5304 		break;
5305 	case 0x10ec0668:
5306 		alc_write_coef_idx(codec, 0x11, 0x0001);
5307 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5308 		alc_process_coef_fw(codec, coef0688);
5309 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5310 		break;
5311 	case 0x10ec0215:
5312 	case 0x10ec0225:
5313 	case 0x10ec0285:
5314 	case 0x10ec0295:
5315 	case 0x10ec0289:
5316 	case 0x10ec0299:
5317 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5318 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5319 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5320 		alc_process_coef_fw(codec, coef0225);
5321 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5322 		break;
5323 	}
5324 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5325 }
5326 
alc_headset_mode_default(struct hda_codec * codec)5327 static void alc_headset_mode_default(struct hda_codec *codec)
5328 {
5329 	static const struct coef_fw coef0225[] = {
5330 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5331 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5332 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5333 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5334 		UPDATE_COEF(0x63, 3<<14, 0),
5335 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5336 		{}
5337 	};
5338 	static const struct coef_fw coef0255[] = {
5339 		WRITE_COEF(0x45, 0xc089),
5340 		WRITE_COEF(0x45, 0xc489),
5341 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5342 		WRITE_COEF(0x49, 0x0049),
5343 		{}
5344 	};
5345 	static const struct coef_fw coef0256[] = {
5346 		WRITE_COEF(0x45, 0xc489),
5347 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5348 		WRITE_COEF(0x49, 0x0049),
5349 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5350 		WRITE_COEF(0x06, 0x6100),
5351 		{}
5352 	};
5353 	static const struct coef_fw coef0233[] = {
5354 		WRITE_COEF(0x06, 0x2100),
5355 		WRITE_COEF(0x32, 0x4ea3),
5356 		{}
5357 	};
5358 	static const struct coef_fw coef0288[] = {
5359 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5360 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5361 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5362 		UPDATE_COEF(0x66, 0x0008, 0),
5363 		UPDATE_COEF(0x67, 0x2000, 0),
5364 		{}
5365 	};
5366 	static const struct coef_fw coef0292[] = {
5367 		WRITE_COEF(0x76, 0x000e),
5368 		WRITE_COEF(0x6c, 0x2400),
5369 		WRITE_COEF(0x6b, 0xc429),
5370 		WRITE_COEF(0x18, 0x7308),
5371 		{}
5372 	};
5373 	static const struct coef_fw coef0293[] = {
5374 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5375 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5376 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5377 		{}
5378 	};
5379 	static const struct coef_fw coef0688[] = {
5380 		WRITE_COEF(0x11, 0x0041),
5381 		WRITE_COEF(0x15, 0x0d40),
5382 		WRITE_COEF(0xb7, 0x802b),
5383 		{}
5384 	};
5385 	static const struct coef_fw coef0274[] = {
5386 		WRITE_COEF(0x45, 0x4289),
5387 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5388 		UPDATE_COEF(0x6b, 0x0f00, 0),
5389 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5390 		{}
5391 	};
5392 
5393 	switch (codec->core.vendor_id) {
5394 	case 0x10ec0215:
5395 	case 0x10ec0225:
5396 	case 0x10ec0285:
5397 	case 0x10ec0295:
5398 	case 0x10ec0289:
5399 	case 0x10ec0299:
5400 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5401 		alc_process_coef_fw(codec, coef0225);
5402 		alc_hp_enable_unmute(codec, 75);
5403 		break;
5404 	case 0x10ec0255:
5405 		alc_process_coef_fw(codec, coef0255);
5406 		break;
5407 	case 0x10ec0230:
5408 	case 0x10ec0236:
5409 	case 0x10ec0256:
5410 	case 0x19e58326:
5411 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5412 		alc_write_coef_idx(codec, 0x45, 0xc089);
5413 		msleep(50);
5414 		alc_process_coef_fw(codec, coef0256);
5415 		alc_hp_enable_unmute(codec, 75);
5416 		break;
5417 	case 0x10ec0234:
5418 	case 0x10ec0274:
5419 	case 0x10ec0294:
5420 		alc_process_coef_fw(codec, coef0274);
5421 		break;
5422 	case 0x10ec0233:
5423 	case 0x10ec0283:
5424 		alc_process_coef_fw(codec, coef0233);
5425 		break;
5426 	case 0x10ec0286:
5427 	case 0x10ec0288:
5428 	case 0x10ec0298:
5429 		alc_process_coef_fw(codec, coef0288);
5430 		break;
5431 	case 0x10ec0292:
5432 		alc_process_coef_fw(codec, coef0292);
5433 		break;
5434 	case 0x10ec0293:
5435 		alc_process_coef_fw(codec, coef0293);
5436 		break;
5437 	case 0x10ec0668:
5438 		alc_process_coef_fw(codec, coef0688);
5439 		break;
5440 	case 0x10ec0867:
5441 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5442 		break;
5443 	}
5444 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5445 }
5446 
5447 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5448 static void alc_headset_mode_ctia(struct hda_codec *codec)
5449 {
5450 	int val;
5451 
5452 	static const struct coef_fw coef0255[] = {
5453 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5454 		WRITE_COEF(0x1b, 0x0c2b),
5455 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5456 		{}
5457 	};
5458 	static const struct coef_fw coef0256[] = {
5459 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5460 		WRITE_COEF(0x1b, 0x0e6b),
5461 		{}
5462 	};
5463 	static const struct coef_fw coef0233[] = {
5464 		WRITE_COEF(0x45, 0xd429),
5465 		WRITE_COEF(0x1b, 0x0c2b),
5466 		WRITE_COEF(0x32, 0x4ea3),
5467 		{}
5468 	};
5469 	static const struct coef_fw coef0288[] = {
5470 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5471 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5472 		UPDATE_COEF(0x66, 0x0008, 0),
5473 		UPDATE_COEF(0x67, 0x2000, 0),
5474 		{}
5475 	};
5476 	static const struct coef_fw coef0292[] = {
5477 		WRITE_COEF(0x6b, 0xd429),
5478 		WRITE_COEF(0x76, 0x0008),
5479 		WRITE_COEF(0x18, 0x7388),
5480 		{}
5481 	};
5482 	static const struct coef_fw coef0293[] = {
5483 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5484 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5485 		{}
5486 	};
5487 	static const struct coef_fw coef0688[] = {
5488 		WRITE_COEF(0x11, 0x0001),
5489 		WRITE_COEF(0x15, 0x0d60),
5490 		WRITE_COEF(0xc3, 0x0000),
5491 		{}
5492 	};
5493 	static const struct coef_fw coef0225_1[] = {
5494 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5495 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5496 		{}
5497 	};
5498 	static const struct coef_fw coef0225_2[] = {
5499 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5500 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5501 		{}
5502 	};
5503 
5504 	switch (codec->core.vendor_id) {
5505 	case 0x10ec0255:
5506 		alc_process_coef_fw(codec, coef0255);
5507 		break;
5508 	case 0x10ec0230:
5509 	case 0x10ec0236:
5510 	case 0x10ec0256:
5511 	case 0x19e58326:
5512 		alc_process_coef_fw(codec, coef0256);
5513 		alc_hp_enable_unmute(codec, 75);
5514 		break;
5515 	case 0x10ec0234:
5516 	case 0x10ec0274:
5517 	case 0x10ec0294:
5518 		alc_write_coef_idx(codec, 0x45, 0xd689);
5519 		break;
5520 	case 0x10ec0233:
5521 	case 0x10ec0283:
5522 		alc_process_coef_fw(codec, coef0233);
5523 		break;
5524 	case 0x10ec0298:
5525 		val = alc_read_coef_idx(codec, 0x50);
5526 		if (val & (1 << 12)) {
5527 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5528 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5529 			msleep(300);
5530 		} else {
5531 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5532 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5533 			msleep(300);
5534 		}
5535 		break;
5536 	case 0x10ec0286:
5537 	case 0x10ec0288:
5538 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5539 		msleep(300);
5540 		alc_process_coef_fw(codec, coef0288);
5541 		break;
5542 	case 0x10ec0292:
5543 		alc_process_coef_fw(codec, coef0292);
5544 		break;
5545 	case 0x10ec0293:
5546 		alc_process_coef_fw(codec, coef0293);
5547 		break;
5548 	case 0x10ec0668:
5549 		alc_process_coef_fw(codec, coef0688);
5550 		break;
5551 	case 0x10ec0215:
5552 	case 0x10ec0225:
5553 	case 0x10ec0285:
5554 	case 0x10ec0295:
5555 	case 0x10ec0289:
5556 	case 0x10ec0299:
5557 		val = alc_read_coef_idx(codec, 0x45);
5558 		if (val & (1 << 9))
5559 			alc_process_coef_fw(codec, coef0225_2);
5560 		else
5561 			alc_process_coef_fw(codec, coef0225_1);
5562 		alc_hp_enable_unmute(codec, 75);
5563 		break;
5564 	case 0x10ec0867:
5565 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5566 		break;
5567 	}
5568 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5569 }
5570 
5571 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5572 static void alc_headset_mode_omtp(struct hda_codec *codec)
5573 {
5574 	static const struct coef_fw coef0255[] = {
5575 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5576 		WRITE_COEF(0x1b, 0x0c2b),
5577 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5578 		{}
5579 	};
5580 	static const struct coef_fw coef0256[] = {
5581 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5582 		WRITE_COEF(0x1b, 0x0e6b),
5583 		{}
5584 	};
5585 	static const struct coef_fw coef0233[] = {
5586 		WRITE_COEF(0x45, 0xe429),
5587 		WRITE_COEF(0x1b, 0x0c2b),
5588 		WRITE_COEF(0x32, 0x4ea3),
5589 		{}
5590 	};
5591 	static const struct coef_fw coef0288[] = {
5592 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5593 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5594 		UPDATE_COEF(0x66, 0x0008, 0),
5595 		UPDATE_COEF(0x67, 0x2000, 0),
5596 		{}
5597 	};
5598 	static const struct coef_fw coef0292[] = {
5599 		WRITE_COEF(0x6b, 0xe429),
5600 		WRITE_COEF(0x76, 0x0008),
5601 		WRITE_COEF(0x18, 0x7388),
5602 		{}
5603 	};
5604 	static const struct coef_fw coef0293[] = {
5605 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5606 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5607 		{}
5608 	};
5609 	static const struct coef_fw coef0688[] = {
5610 		WRITE_COEF(0x11, 0x0001),
5611 		WRITE_COEF(0x15, 0x0d50),
5612 		WRITE_COEF(0xc3, 0x0000),
5613 		{}
5614 	};
5615 	static const struct coef_fw coef0225[] = {
5616 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5617 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5618 		{}
5619 	};
5620 
5621 	switch (codec->core.vendor_id) {
5622 	case 0x10ec0255:
5623 		alc_process_coef_fw(codec, coef0255);
5624 		break;
5625 	case 0x10ec0230:
5626 	case 0x10ec0236:
5627 	case 0x10ec0256:
5628 	case 0x19e58326:
5629 		alc_process_coef_fw(codec, coef0256);
5630 		alc_hp_enable_unmute(codec, 75);
5631 		break;
5632 	case 0x10ec0234:
5633 	case 0x10ec0274:
5634 	case 0x10ec0294:
5635 		alc_write_coef_idx(codec, 0x45, 0xe689);
5636 		break;
5637 	case 0x10ec0233:
5638 	case 0x10ec0283:
5639 		alc_process_coef_fw(codec, coef0233);
5640 		break;
5641 	case 0x10ec0298:
5642 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5643 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5644 		msleep(300);
5645 		break;
5646 	case 0x10ec0286:
5647 	case 0x10ec0288:
5648 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5649 		msleep(300);
5650 		alc_process_coef_fw(codec, coef0288);
5651 		break;
5652 	case 0x10ec0292:
5653 		alc_process_coef_fw(codec, coef0292);
5654 		break;
5655 	case 0x10ec0293:
5656 		alc_process_coef_fw(codec, coef0293);
5657 		break;
5658 	case 0x10ec0668:
5659 		alc_process_coef_fw(codec, coef0688);
5660 		break;
5661 	case 0x10ec0215:
5662 	case 0x10ec0225:
5663 	case 0x10ec0285:
5664 	case 0x10ec0295:
5665 	case 0x10ec0289:
5666 	case 0x10ec0299:
5667 		alc_process_coef_fw(codec, coef0225);
5668 		alc_hp_enable_unmute(codec, 75);
5669 		break;
5670 	}
5671 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5672 }
5673 
alc_determine_headset_type(struct hda_codec * codec)5674 static void alc_determine_headset_type(struct hda_codec *codec)
5675 {
5676 	int val;
5677 	bool is_ctia = false;
5678 	struct alc_spec *spec = codec->spec;
5679 	static const struct coef_fw coef0255[] = {
5680 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5681 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5682  conteol) */
5683 		{}
5684 	};
5685 	static const struct coef_fw coef0288[] = {
5686 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5687 		{}
5688 	};
5689 	static const struct coef_fw coef0298[] = {
5690 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5691 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5692 		UPDATE_COEF(0x66, 0x0008, 0),
5693 		UPDATE_COEF(0x67, 0x2000, 0),
5694 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5695 		{}
5696 	};
5697 	static const struct coef_fw coef0293[] = {
5698 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5699 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5700 		{}
5701 	};
5702 	static const struct coef_fw coef0688[] = {
5703 		WRITE_COEF(0x11, 0x0001),
5704 		WRITE_COEF(0xb7, 0x802b),
5705 		WRITE_COEF(0x15, 0x0d60),
5706 		WRITE_COEF(0xc3, 0x0c00),
5707 		{}
5708 	};
5709 	static const struct coef_fw coef0274[] = {
5710 		UPDATE_COEF(0x4a, 0x0010, 0),
5711 		UPDATE_COEF(0x4a, 0x8000, 0),
5712 		WRITE_COEF(0x45, 0xd289),
5713 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5714 		{}
5715 	};
5716 
5717 	if (spec->no_internal_mic_pin) {
5718 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5719 		return;
5720 	}
5721 
5722 	switch (codec->core.vendor_id) {
5723 	case 0x10ec0255:
5724 		alc_process_coef_fw(codec, coef0255);
5725 		msleep(300);
5726 		val = alc_read_coef_idx(codec, 0x46);
5727 		is_ctia = (val & 0x0070) == 0x0070;
5728 		break;
5729 	case 0x10ec0230:
5730 	case 0x10ec0236:
5731 	case 0x10ec0256:
5732 	case 0x19e58326:
5733 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5734 		alc_write_coef_idx(codec, 0x06, 0x6104);
5735 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5736 
5737 		alc_process_coef_fw(codec, coef0255);
5738 		msleep(300);
5739 		val = alc_read_coef_idx(codec, 0x46);
5740 		is_ctia = (val & 0x0070) == 0x0070;
5741 		if (!is_ctia) {
5742 			alc_write_coef_idx(codec, 0x45, 0xe089);
5743 			msleep(100);
5744 			val = alc_read_coef_idx(codec, 0x46);
5745 			if ((val & 0x0070) == 0x0070)
5746 				is_ctia = false;
5747 			else
5748 				is_ctia = true;
5749 		}
5750 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5751 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5752 		break;
5753 	case 0x10ec0234:
5754 	case 0x10ec0274:
5755 	case 0x10ec0294:
5756 		alc_process_coef_fw(codec, coef0274);
5757 		msleep(850);
5758 		val = alc_read_coef_idx(codec, 0x46);
5759 		is_ctia = (val & 0x00f0) == 0x00f0;
5760 		break;
5761 	case 0x10ec0233:
5762 	case 0x10ec0283:
5763 		alc_write_coef_idx(codec, 0x45, 0xd029);
5764 		msleep(300);
5765 		val = alc_read_coef_idx(codec, 0x46);
5766 		is_ctia = (val & 0x0070) == 0x0070;
5767 		break;
5768 	case 0x10ec0298:
5769 		snd_hda_codec_write(codec, 0x21, 0,
5770 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5771 		msleep(100);
5772 		snd_hda_codec_write(codec, 0x21, 0,
5773 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5774 		msleep(200);
5775 
5776 		val = alc_read_coef_idx(codec, 0x50);
5777 		if (val & (1 << 12)) {
5778 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5779 			alc_process_coef_fw(codec, coef0288);
5780 			msleep(350);
5781 			val = alc_read_coef_idx(codec, 0x50);
5782 			is_ctia = (val & 0x0070) == 0x0070;
5783 		} else {
5784 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5785 			alc_process_coef_fw(codec, coef0288);
5786 			msleep(350);
5787 			val = alc_read_coef_idx(codec, 0x50);
5788 			is_ctia = (val & 0x0070) == 0x0070;
5789 		}
5790 		alc_process_coef_fw(codec, coef0298);
5791 		snd_hda_codec_write(codec, 0x21, 0,
5792 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5793 		msleep(75);
5794 		snd_hda_codec_write(codec, 0x21, 0,
5795 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5796 		break;
5797 	case 0x10ec0286:
5798 	case 0x10ec0288:
5799 		alc_process_coef_fw(codec, coef0288);
5800 		msleep(350);
5801 		val = alc_read_coef_idx(codec, 0x50);
5802 		is_ctia = (val & 0x0070) == 0x0070;
5803 		break;
5804 	case 0x10ec0292:
5805 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5806 		msleep(300);
5807 		val = alc_read_coef_idx(codec, 0x6c);
5808 		is_ctia = (val & 0x001c) == 0x001c;
5809 		break;
5810 	case 0x10ec0293:
5811 		alc_process_coef_fw(codec, coef0293);
5812 		msleep(300);
5813 		val = alc_read_coef_idx(codec, 0x46);
5814 		is_ctia = (val & 0x0070) == 0x0070;
5815 		break;
5816 	case 0x10ec0668:
5817 		alc_process_coef_fw(codec, coef0688);
5818 		msleep(300);
5819 		val = alc_read_coef_idx(codec, 0xbe);
5820 		is_ctia = (val & 0x1c02) == 0x1c02;
5821 		break;
5822 	case 0x10ec0215:
5823 	case 0x10ec0225:
5824 	case 0x10ec0285:
5825 	case 0x10ec0295:
5826 	case 0x10ec0289:
5827 	case 0x10ec0299:
5828 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5829 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5830 		val = alc_read_coef_idx(codec, 0x45);
5831 		if (val & (1 << 9)) {
5832 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5833 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5834 			msleep(800);
5835 			val = alc_read_coef_idx(codec, 0x46);
5836 			is_ctia = (val & 0x00f0) == 0x00f0;
5837 		} else {
5838 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5839 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5840 			msleep(800);
5841 			val = alc_read_coef_idx(codec, 0x46);
5842 			is_ctia = (val & 0x00f0) == 0x00f0;
5843 		}
5844 		if (!is_ctia) {
5845 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5846 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5847 			msleep(100);
5848 			val = alc_read_coef_idx(codec, 0x46);
5849 			if ((val & 0x00f0) == 0x00f0)
5850 				is_ctia = false;
5851 			else
5852 				is_ctia = true;
5853 		}
5854 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5855 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5856 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5857 		break;
5858 	case 0x10ec0867:
5859 		is_ctia = true;
5860 		break;
5861 	}
5862 
5863 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5864 		    is_ctia ? "yes" : "no");
5865 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5866 }
5867 
alc_update_headset_mode(struct hda_codec * codec)5868 static void alc_update_headset_mode(struct hda_codec *codec)
5869 {
5870 	struct alc_spec *spec = codec->spec;
5871 
5872 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5873 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
5874 
5875 	int new_headset_mode;
5876 
5877 	if (!snd_hda_jack_detect(codec, hp_pin))
5878 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5879 	else if (mux_pin == spec->headset_mic_pin)
5880 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5881 	else if (mux_pin == spec->headphone_mic_pin)
5882 		new_headset_mode = ALC_HEADSET_MODE_MIC;
5883 	else
5884 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5885 
5886 	if (new_headset_mode == spec->current_headset_mode) {
5887 		snd_hda_gen_update_outputs(codec);
5888 		return;
5889 	}
5890 
5891 	switch (new_headset_mode) {
5892 	case ALC_HEADSET_MODE_UNPLUGGED:
5893 		alc_headset_mode_unplugged(codec);
5894 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5895 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5896 		spec->gen.hp_jack_present = false;
5897 		break;
5898 	case ALC_HEADSET_MODE_HEADSET:
5899 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5900 			alc_determine_headset_type(codec);
5901 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5902 			alc_headset_mode_ctia(codec);
5903 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5904 			alc_headset_mode_omtp(codec);
5905 		spec->gen.hp_jack_present = true;
5906 		break;
5907 	case ALC_HEADSET_MODE_MIC:
5908 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5909 		spec->gen.hp_jack_present = false;
5910 		break;
5911 	case ALC_HEADSET_MODE_HEADPHONE:
5912 		alc_headset_mode_default(codec);
5913 		spec->gen.hp_jack_present = true;
5914 		break;
5915 	}
5916 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5917 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
5918 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5919 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5920 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5921 						  PIN_VREFHIZ);
5922 	}
5923 	spec->current_headset_mode = new_headset_mode;
5924 
5925 	snd_hda_gen_update_outputs(codec);
5926 }
5927 
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)5928 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5929 					 struct snd_kcontrol *kcontrol,
5930 					 struct snd_ctl_elem_value *ucontrol)
5931 {
5932 	alc_update_headset_mode(codec);
5933 }
5934 
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5935 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5936 				       struct hda_jack_callback *jack)
5937 {
5938 	snd_hda_gen_hp_automute(codec, jack);
5939 	alc_update_headset_mode(codec);
5940 }
5941 
alc_probe_headset_mode(struct hda_codec * codec)5942 static void alc_probe_headset_mode(struct hda_codec *codec)
5943 {
5944 	int i;
5945 	struct alc_spec *spec = codec->spec;
5946 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5947 
5948 	/* Find mic pins */
5949 	for (i = 0; i < cfg->num_inputs; i++) {
5950 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5951 			spec->headset_mic_pin = cfg->inputs[i].pin;
5952 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5953 			spec->headphone_mic_pin = cfg->inputs[i].pin;
5954 	}
5955 
5956 	WARN_ON(spec->gen.cap_sync_hook);
5957 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5958 	spec->gen.automute_hook = alc_update_headset_mode;
5959 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5960 }
5961 
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)5962 static void alc_fixup_headset_mode(struct hda_codec *codec,
5963 				const struct hda_fixup *fix, int action)
5964 {
5965 	struct alc_spec *spec = codec->spec;
5966 
5967 	switch (action) {
5968 	case HDA_FIXUP_ACT_PRE_PROBE:
5969 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5970 		break;
5971 	case HDA_FIXUP_ACT_PROBE:
5972 		alc_probe_headset_mode(codec);
5973 		break;
5974 	case HDA_FIXUP_ACT_INIT:
5975 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
5976 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5977 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5978 		}
5979 		alc_update_headset_mode(codec);
5980 		break;
5981 	}
5982 }
5983 
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5984 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5985 				const struct hda_fixup *fix, int action)
5986 {
5987 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5988 		struct alc_spec *spec = codec->spec;
5989 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5990 	}
5991 	else
5992 		alc_fixup_headset_mode(codec, fix, action);
5993 }
5994 
alc255_set_default_jack_type(struct hda_codec * codec)5995 static void alc255_set_default_jack_type(struct hda_codec *codec)
5996 {
5997 	/* Set to iphone type */
5998 	static const struct coef_fw alc255fw[] = {
5999 		WRITE_COEF(0x1b, 0x880b),
6000 		WRITE_COEF(0x45, 0xd089),
6001 		WRITE_COEF(0x1b, 0x080b),
6002 		WRITE_COEF(0x46, 0x0004),
6003 		WRITE_COEF(0x1b, 0x0c0b),
6004 		{}
6005 	};
6006 	static const struct coef_fw alc256fw[] = {
6007 		WRITE_COEF(0x1b, 0x884b),
6008 		WRITE_COEF(0x45, 0xd089),
6009 		WRITE_COEF(0x1b, 0x084b),
6010 		WRITE_COEF(0x46, 0x0004),
6011 		WRITE_COEF(0x1b, 0x0c4b),
6012 		{}
6013 	};
6014 	switch (codec->core.vendor_id) {
6015 	case 0x10ec0255:
6016 		alc_process_coef_fw(codec, alc255fw);
6017 		break;
6018 	case 0x10ec0230:
6019 	case 0x10ec0236:
6020 	case 0x10ec0256:
6021 	case 0x19e58326:
6022 		alc_process_coef_fw(codec, alc256fw);
6023 		break;
6024 	}
6025 	msleep(30);
6026 }
6027 
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)6028 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
6029 				const struct hda_fixup *fix, int action)
6030 {
6031 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6032 		alc255_set_default_jack_type(codec);
6033 	}
6034 	alc_fixup_headset_mode(codec, fix, action);
6035 }
6036 
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6037 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
6038 				const struct hda_fixup *fix, int action)
6039 {
6040 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6041 		struct alc_spec *spec = codec->spec;
6042 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6043 		alc255_set_default_jack_type(codec);
6044 	}
6045 	else
6046 		alc_fixup_headset_mode(codec, fix, action);
6047 }
6048 
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)6049 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
6050 				       struct hda_jack_callback *jack)
6051 {
6052 	struct alc_spec *spec = codec->spec;
6053 
6054 	alc_update_headset_jack_cb(codec, jack);
6055 	/* Headset Mic enable or disable, only for Dell Dino */
6056 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
6057 }
6058 
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)6059 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
6060 				const struct hda_fixup *fix, int action)
6061 {
6062 	alc_fixup_headset_mode(codec, fix, action);
6063 	if (action == HDA_FIXUP_ACT_PROBE) {
6064 		struct alc_spec *spec = codec->spec;
6065 		/* toggled via hp_automute_hook */
6066 		spec->gpio_mask |= 0x40;
6067 		spec->gpio_dir |= 0x40;
6068 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
6069 	}
6070 }
6071 
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6072 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
6073 					const struct hda_fixup *fix, int action)
6074 {
6075 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6076 		struct alc_spec *spec = codec->spec;
6077 		spec->gen.auto_mute_via_amp = 1;
6078 	}
6079 }
6080 
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)6081 static void alc_fixup_no_shutup(struct hda_codec *codec,
6082 				const struct hda_fixup *fix, int action)
6083 {
6084 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6085 		struct alc_spec *spec = codec->spec;
6086 		spec->no_shutup_pins = 1;
6087 	}
6088 }
6089 
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)6090 static void alc_fixup_disable_aamix(struct hda_codec *codec,
6091 				    const struct hda_fixup *fix, int action)
6092 {
6093 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6094 		struct alc_spec *spec = codec->spec;
6095 		/* Disable AA-loopback as it causes white noise */
6096 		spec->gen.mixer_nid = 0;
6097 	}
6098 }
6099 
6100 /* 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)6101 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6102 				  const struct hda_fixup *fix, int action)
6103 {
6104 	static const struct hda_pintbl pincfgs[] = {
6105 		{ 0x16, 0x21211010 }, /* dock headphone */
6106 		{ 0x19, 0x21a11010 }, /* dock mic */
6107 		{ }
6108 	};
6109 	struct alc_spec *spec = codec->spec;
6110 
6111 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6112 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6113 		codec->power_save_node = 0; /* avoid click noises */
6114 		snd_hda_apply_pincfgs(codec, pincfgs);
6115 	}
6116 }
6117 
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6118 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6119 				  const struct hda_fixup *fix, int action)
6120 {
6121 	static const struct hda_pintbl pincfgs[] = {
6122 		{ 0x17, 0x21211010 }, /* dock headphone */
6123 		{ 0x19, 0x21a11010 }, /* dock mic */
6124 		{ }
6125 	};
6126 	struct alc_spec *spec = codec->spec;
6127 
6128 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6129 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6130 		snd_hda_apply_pincfgs(codec, pincfgs);
6131 	} else if (action == HDA_FIXUP_ACT_INIT) {
6132 		/* Enable DOCK device */
6133 		snd_hda_codec_write(codec, 0x17, 0,
6134 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6135 		/* Enable DOCK device */
6136 		snd_hda_codec_write(codec, 0x19, 0,
6137 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6138 	}
6139 }
6140 
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6141 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6142 				  const struct hda_fixup *fix, int action)
6143 {
6144 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6145 	 * the speaker output becomes too low by some reason on Thinkpads with
6146 	 * ALC298 codec
6147 	 */
6148 	static const hda_nid_t preferred_pairs[] = {
6149 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6150 		0
6151 	};
6152 	struct alc_spec *spec = codec->spec;
6153 
6154 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6155 		spec->gen.preferred_dacs = preferred_pairs;
6156 }
6157 
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6158 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6159 				   const struct hda_fixup *fix, int action)
6160 {
6161 	static const hda_nid_t preferred_pairs[] = {
6162 		0x17, 0x02, 0x21, 0x03, 0
6163 	};
6164 	struct alc_spec *spec = codec->spec;
6165 
6166 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6167 		spec->gen.preferred_dacs = preferred_pairs;
6168 }
6169 
alc_shutup_dell_xps13(struct hda_codec * codec)6170 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6171 {
6172 	struct alc_spec *spec = codec->spec;
6173 	int hp_pin = alc_get_hp_pin(spec);
6174 
6175 	/* Prevent pop noises when headphones are plugged in */
6176 	snd_hda_codec_write(codec, hp_pin, 0,
6177 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6178 	msleep(20);
6179 }
6180 
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6181 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6182 				const struct hda_fixup *fix, int action)
6183 {
6184 	struct alc_spec *spec = codec->spec;
6185 	struct hda_input_mux *imux = &spec->gen.input_mux;
6186 	int i;
6187 
6188 	switch (action) {
6189 	case HDA_FIXUP_ACT_PRE_PROBE:
6190 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6191 		 * it causes a click noise at start up
6192 		 */
6193 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6194 		spec->shutup = alc_shutup_dell_xps13;
6195 		break;
6196 	case HDA_FIXUP_ACT_PROBE:
6197 		/* Make the internal mic the default input source. */
6198 		for (i = 0; i < imux->num_items; i++) {
6199 			if (spec->gen.imux_pins[i] == 0x12) {
6200 				spec->gen.cur_mux[0] = i;
6201 				break;
6202 			}
6203 		}
6204 		break;
6205 	}
6206 }
6207 
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6208 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6209 				const struct hda_fixup *fix, int action)
6210 {
6211 	struct alc_spec *spec = codec->spec;
6212 
6213 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6214 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6215 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6216 
6217 		/* Disable boost for mic-in permanently. (This code is only called
6218 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6219 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6220 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6221 	} else
6222 		alc_fixup_headset_mode(codec, fix, action);
6223 }
6224 
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6225 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6226 				const struct hda_fixup *fix, int action)
6227 {
6228 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6229 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6230 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6231 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6232 	}
6233 	alc_fixup_headset_mode(codec, fix, action);
6234 }
6235 
6236 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6237 static int find_ext_mic_pin(struct hda_codec *codec)
6238 {
6239 	struct alc_spec *spec = codec->spec;
6240 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6241 	hda_nid_t nid;
6242 	unsigned int defcfg;
6243 	int i;
6244 
6245 	for (i = 0; i < cfg->num_inputs; i++) {
6246 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6247 			continue;
6248 		nid = cfg->inputs[i].pin;
6249 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6250 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6251 			continue;
6252 		return nid;
6253 	}
6254 
6255 	return 0;
6256 }
6257 
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6258 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6259 				    const struct hda_fixup *fix,
6260 				    int action)
6261 {
6262 	struct alc_spec *spec = codec->spec;
6263 
6264 	if (action == HDA_FIXUP_ACT_PROBE) {
6265 		int mic_pin = find_ext_mic_pin(codec);
6266 		int hp_pin = alc_get_hp_pin(spec);
6267 
6268 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6269 			return;
6270 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6271 	}
6272 }
6273 
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6274 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6275 					     const struct hda_fixup *fix,
6276 					     int action)
6277 {
6278 	struct alc_spec *spec = codec->spec;
6279 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6280 	int i;
6281 
6282 	/* The mic boosts on level 2 and 3 are too noisy
6283 	   on the internal mic input.
6284 	   Therefore limit the boost to 0 or 1. */
6285 
6286 	if (action != HDA_FIXUP_ACT_PROBE)
6287 		return;
6288 
6289 	for (i = 0; i < cfg->num_inputs; i++) {
6290 		hda_nid_t nid = cfg->inputs[i].pin;
6291 		unsigned int defcfg;
6292 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6293 			continue;
6294 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6295 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6296 			continue;
6297 
6298 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6299 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6300 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6301 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6302 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6303 	}
6304 }
6305 
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6306 static void alc283_hp_automute_hook(struct hda_codec *codec,
6307 				    struct hda_jack_callback *jack)
6308 {
6309 	struct alc_spec *spec = codec->spec;
6310 	int vref;
6311 
6312 	msleep(200);
6313 	snd_hda_gen_hp_automute(codec, jack);
6314 
6315 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6316 
6317 	msleep(600);
6318 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6319 			    vref);
6320 }
6321 
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6322 static void alc283_fixup_chromebook(struct hda_codec *codec,
6323 				    const struct hda_fixup *fix, int action)
6324 {
6325 	struct alc_spec *spec = codec->spec;
6326 
6327 	switch (action) {
6328 	case HDA_FIXUP_ACT_PRE_PROBE:
6329 		snd_hda_override_wcaps(codec, 0x03, 0);
6330 		/* Disable AA-loopback as it causes white noise */
6331 		spec->gen.mixer_nid = 0;
6332 		break;
6333 	case HDA_FIXUP_ACT_INIT:
6334 		/* MIC2-VREF control */
6335 		/* Set to manual mode */
6336 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6337 		/* Enable Line1 input control by verb */
6338 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6339 		break;
6340 	}
6341 }
6342 
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6343 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6344 				    const struct hda_fixup *fix, int action)
6345 {
6346 	struct alc_spec *spec = codec->spec;
6347 
6348 	switch (action) {
6349 	case HDA_FIXUP_ACT_PRE_PROBE:
6350 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6351 		break;
6352 	case HDA_FIXUP_ACT_INIT:
6353 		/* MIC2-VREF control */
6354 		/* Set to manual mode */
6355 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6356 		break;
6357 	}
6358 }
6359 
6360 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6361 static void asus_tx300_automute(struct hda_codec *codec)
6362 {
6363 	struct alc_spec *spec = codec->spec;
6364 	snd_hda_gen_update_outputs(codec);
6365 	if (snd_hda_jack_detect(codec, 0x1b))
6366 		spec->gen.mute_bits |= (1ULL << 0x14);
6367 }
6368 
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6369 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6370 				    const struct hda_fixup *fix, int action)
6371 {
6372 	struct alc_spec *spec = codec->spec;
6373 	static const struct hda_pintbl dock_pins[] = {
6374 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6375 		{}
6376 	};
6377 
6378 	switch (action) {
6379 	case HDA_FIXUP_ACT_PRE_PROBE:
6380 		spec->init_amp = ALC_INIT_DEFAULT;
6381 		/* TX300 needs to set up GPIO2 for the speaker amp */
6382 		alc_setup_gpio(codec, 0x04);
6383 		snd_hda_apply_pincfgs(codec, dock_pins);
6384 		spec->gen.auto_mute_via_amp = 1;
6385 		spec->gen.automute_hook = asus_tx300_automute;
6386 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6387 						    snd_hda_gen_hp_automute);
6388 		break;
6389 	case HDA_FIXUP_ACT_PROBE:
6390 		spec->init_amp = ALC_INIT_DEFAULT;
6391 		break;
6392 	case HDA_FIXUP_ACT_BUILD:
6393 		/* this is a bit tricky; give more sane names for the main
6394 		 * (tablet) speaker and the dock speaker, respectively
6395 		 */
6396 		rename_ctl(codec, "Speaker Playback Switch",
6397 			   "Dock Speaker Playback Switch");
6398 		rename_ctl(codec, "Bass Speaker Playback Switch",
6399 			   "Speaker Playback Switch");
6400 		break;
6401 	}
6402 }
6403 
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6404 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6405 				       const struct hda_fixup *fix, int action)
6406 {
6407 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6408 		/* DAC node 0x03 is giving mono output. We therefore want to
6409 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6410 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6411 		static const hda_nid_t conn1[] = { 0x0c };
6412 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6413 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6414 	}
6415 }
6416 
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6417 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6418 					const struct hda_fixup *fix, int action)
6419 {
6420 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6421 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6422 		   we can't adjust the speaker's volume since this node does not has
6423 		   Amp-out capability. we change the speaker's route to:
6424 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6425 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6426 		   speaker's volume now. */
6427 
6428 		static const hda_nid_t conn1[] = { 0x0c };
6429 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6430 	}
6431 }
6432 
6433 /* 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)6434 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6435 				      const struct hda_fixup *fix, int action)
6436 {
6437 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6438 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6439 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6440 	}
6441 }
6442 
6443 /* 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)6444 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6445 					  const struct hda_fixup *fix, int action)
6446 {
6447 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6448 		static const hda_nid_t conn[] = { 0x02 };
6449 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6450 	}
6451 }
6452 
6453 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6454 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6455 					  struct hda_jack_callback *jack)
6456 {
6457 	struct alc_spec *spec = codec->spec;
6458 
6459 	snd_hda_gen_hp_automute(codec, jack);
6460 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6461 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6462 			    !spec->gen.hp_jack_present);
6463 }
6464 
6465 /* Manage GPIOs for HP EliteBook Folio 9480m.
6466  *
6467  * GPIO4 is the headphone amplifier power control
6468  * GPIO3 is the audio output mute indicator LED
6469  */
6470 
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6471 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6472 				  const struct hda_fixup *fix,
6473 				  int action)
6474 {
6475 	struct alc_spec *spec = codec->spec;
6476 
6477 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6478 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6479 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6480 		spec->gpio_mask |= 0x10;
6481 		spec->gpio_dir |= 0x10;
6482 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6483 	}
6484 }
6485 
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6486 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6487 				   const struct hda_fixup *fix,
6488 				   int action)
6489 {
6490 	struct alc_spec *spec = codec->spec;
6491 
6492 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6493 		spec->gpio_mask |= 0x04;
6494 		spec->gpio_dir |= 0x04;
6495 		/* set data bit low */
6496 	}
6497 }
6498 
6499 /* Quirk for Thinkpad X1 7th and 8th Gen
6500  * The following fixed routing needed
6501  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6502  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6503  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6504  */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6505 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6506 					  const struct hda_fixup *fix, int action)
6507 {
6508 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6509 	static const hda_nid_t preferred_pairs[] = {
6510 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6511 	};
6512 	struct alc_spec *spec = codec->spec;
6513 
6514 	switch (action) {
6515 	case HDA_FIXUP_ACT_PRE_PROBE:
6516 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6517 		spec->gen.preferred_dacs = preferred_pairs;
6518 		break;
6519 	case HDA_FIXUP_ACT_BUILD:
6520 		/* The generic parser creates somewhat unintuitive volume ctls
6521 		 * with the fixed routing above, and the shared DAC2 may be
6522 		 * confusing for PA.
6523 		 * Rename those to unique names so that PA doesn't touch them
6524 		 * and use only Master volume.
6525 		 */
6526 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6527 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6528 		break;
6529 	}
6530 }
6531 
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6532 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6533 					 const struct hda_fixup *fix,
6534 					 int action)
6535 {
6536 	alc_fixup_dual_codecs(codec, fix, action);
6537 	switch (action) {
6538 	case HDA_FIXUP_ACT_PRE_PROBE:
6539 		/* override card longname to provide a unique UCM profile */
6540 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6541 		break;
6542 	case HDA_FIXUP_ACT_BUILD:
6543 		/* rename Capture controls depending on the codec */
6544 		rename_ctl(codec, "Capture Volume",
6545 			   codec->addr == 0 ?
6546 			   "Rear-Panel Capture Volume" :
6547 			   "Front-Panel Capture Volume");
6548 		rename_ctl(codec, "Capture Switch",
6549 			   codec->addr == 0 ?
6550 			   "Rear-Panel Capture Switch" :
6551 			   "Front-Panel Capture Switch");
6552 		break;
6553 	}
6554 }
6555 
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6556 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6557 				      const struct hda_fixup *fix, int action)
6558 {
6559 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6560 		return;
6561 
6562 	codec->power_save_node = 1;
6563 }
6564 
6565 /* 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)6566 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6567 				    const struct hda_fixup *fix, int action)
6568 {
6569 	struct alc_spec *spec = codec->spec;
6570 	static const hda_nid_t preferred_pairs[] = {
6571 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6572 		0
6573 	};
6574 
6575 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6576 		return;
6577 
6578 	spec->gen.preferred_dacs = preferred_pairs;
6579 	spec->gen.auto_mute_via_amp = 1;
6580 	codec->power_save_node = 0;
6581 }
6582 
6583 /* 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)6584 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6585 				    const struct hda_fixup *fix, int action)
6586 {
6587 	static const hda_nid_t preferred_pairs[] = {
6588 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6589 	};
6590 	struct alc_spec *spec = codec->spec;
6591 
6592 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6593 		spec->gen.preferred_dacs = preferred_pairs;
6594 		spec->gen.obey_preferred_dacs = 1;
6595 	}
6596 }
6597 
6598 /* 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)6599 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6600 			      const struct hda_fixup *fix, int action)
6601 {
6602 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6603 		return;
6604 
6605 	snd_hda_override_wcaps(codec, 0x03, 0);
6606 }
6607 
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6608 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6609 {
6610 	switch (codec->core.vendor_id) {
6611 	case 0x10ec0274:
6612 	case 0x10ec0294:
6613 	case 0x10ec0225:
6614 	case 0x10ec0295:
6615 	case 0x10ec0299:
6616 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6617 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6618 		break;
6619 	case 0x10ec0230:
6620 	case 0x10ec0235:
6621 	case 0x10ec0236:
6622 	case 0x10ec0255:
6623 	case 0x10ec0256:
6624 	case 0x10ec0257:
6625 	case 0x19e58326:
6626 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6627 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6628 		break;
6629 	}
6630 }
6631 
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6632 static void alc295_fixup_chromebook(struct hda_codec *codec,
6633 				    const struct hda_fixup *fix, int action)
6634 {
6635 	struct alc_spec *spec = codec->spec;
6636 
6637 	switch (action) {
6638 	case HDA_FIXUP_ACT_PRE_PROBE:
6639 		spec->ultra_low_power = true;
6640 		break;
6641 	case HDA_FIXUP_ACT_INIT:
6642 		alc_combo_jack_hp_jd_restart(codec);
6643 		break;
6644 	}
6645 }
6646 
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6647 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6648 				  const struct hda_fixup *fix, int action)
6649 {
6650 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6651 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6652 }
6653 
6654 
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6655 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6656 					struct hda_jack_callback *cb)
6657 {
6658 	/* The Windows driver sets the codec up in a very different way where
6659 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6660 	 */
6661 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6662 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6663 	else
6664 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6665 }
6666 
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6667 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6668 					const struct hda_fixup *fix, int action)
6669 {
6670 	/* Pin 0x21: headphones/headset mic */
6671 	if (!is_jack_detectable(codec, 0x21))
6672 		return;
6673 
6674 	switch (action) {
6675 	case HDA_FIXUP_ACT_PRE_PROBE:
6676 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6677 				alc294_gx502_toggle_output);
6678 		break;
6679 	case HDA_FIXUP_ACT_INIT:
6680 		/* Make sure to start in a correct state, i.e. if
6681 		 * headphones have been plugged in before powering up the system
6682 		 */
6683 		alc294_gx502_toggle_output(codec, NULL);
6684 		break;
6685 	}
6686 }
6687 
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6688 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6689 				       struct hda_jack_callback *cb)
6690 {
6691 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6692 	 * responsible from changes between speakers and headphones
6693 	 */
6694 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6695 		alc_write_coef_idx(codec, 0x10, 0x8420);
6696 	else
6697 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6698 }
6699 
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6700 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6701 				  const struct hda_fixup *fix, int action)
6702 {
6703 	if (!is_jack_detectable(codec, 0x21))
6704 		return;
6705 
6706 	switch (action) {
6707 	case HDA_FIXUP_ACT_PRE_PROBE:
6708 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6709 				alc294_gu502_toggle_output);
6710 		break;
6711 	case HDA_FIXUP_ACT_INIT:
6712 		alc294_gu502_toggle_output(codec, NULL);
6713 		break;
6714 	}
6715 }
6716 
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6717 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6718 			      const struct hda_fixup *fix, int action)
6719 {
6720 	if (action != HDA_FIXUP_ACT_INIT)
6721 		return;
6722 
6723 	msleep(100);
6724 	alc_write_coef_idx(codec, 0x65, 0x0);
6725 }
6726 
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6727 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6728 				    const struct hda_fixup *fix, int action)
6729 {
6730 	switch (action) {
6731 	case HDA_FIXUP_ACT_INIT:
6732 		alc_combo_jack_hp_jd_restart(codec);
6733 		break;
6734 	}
6735 }
6736 
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6737 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6738 				    const struct hda_fixup *fix, int action)
6739 {
6740 	struct alc_spec *spec = codec->spec;
6741 
6742 	switch (action) {
6743 	case HDA_FIXUP_ACT_PRE_PROBE:
6744 		/* Mic RING SLEEVE swap for combo jack */
6745 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6746 		spec->no_internal_mic_pin = true;
6747 		break;
6748 	case HDA_FIXUP_ACT_INIT:
6749 		alc_combo_jack_hp_jd_restart(codec);
6750 		break;
6751 	}
6752 }
6753 
6754 /* GPIO1 = amplifier on/off
6755  * GPIO3 = mic mute LED
6756  */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6757 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6758 					  const struct hda_fixup *fix, int action)
6759 {
6760 	static const hda_nid_t conn[] = { 0x02 };
6761 
6762 	struct alc_spec *spec = codec->spec;
6763 	static const struct hda_pintbl pincfgs[] = {
6764 		{ 0x14, 0x90170110 },  /* front/high speakers */
6765 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6766 		{ }
6767 	};
6768 
6769 	//enable micmute led
6770 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6771 
6772 	switch (action) {
6773 	case HDA_FIXUP_ACT_PRE_PROBE:
6774 		spec->micmute_led_polarity = 1;
6775 		/* needed for amp of back speakers */
6776 		spec->gpio_mask |= 0x01;
6777 		spec->gpio_dir |= 0x01;
6778 		snd_hda_apply_pincfgs(codec, pincfgs);
6779 		/* share DAC to have unified volume control */
6780 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6781 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6782 		break;
6783 	case HDA_FIXUP_ACT_INIT:
6784 		/* need to toggle GPIO to enable the amp of back speakers */
6785 		alc_update_gpio_data(codec, 0x01, true);
6786 		msleep(100);
6787 		alc_update_gpio_data(codec, 0x01, false);
6788 		break;
6789 	}
6790 }
6791 
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6792 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6793 					  const struct hda_fixup *fix, int action)
6794 {
6795 	static const hda_nid_t conn[] = { 0x02 };
6796 	static const struct hda_pintbl pincfgs[] = {
6797 		{ 0x14, 0x90170110 },  /* rear speaker */
6798 		{ }
6799 	};
6800 
6801 	switch (action) {
6802 	case HDA_FIXUP_ACT_PRE_PROBE:
6803 		snd_hda_apply_pincfgs(codec, pincfgs);
6804 		/* force front speaker to DAC1 */
6805 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6806 		break;
6807 	}
6808 }
6809 
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6810 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6811 				      const struct hda_fixup *fix,
6812 				      int action)
6813 {
6814 	static const struct coef_fw coefs[] = {
6815 		WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6816 		WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6817 		WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6818 		WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6819 		WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6820 		WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6821 		WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6822 		WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6823 		WRITE_COEF(0x6e, 0x1005), { }
6824 	};
6825 
6826 	static const struct hda_pintbl pincfgs[] = {
6827 		{ 0x12, 0xb7a60130 },  /* Internal microphone*/
6828 		{ 0x14, 0x90170150 },  /* B&O soundbar speakers */
6829 		{ 0x17, 0x90170153 },  /* Side speakers */
6830 		{ 0x19, 0x03a11040 },  /* Headset microphone */
6831 		{ }
6832 	};
6833 
6834 	switch (action) {
6835 	case HDA_FIXUP_ACT_PRE_PROBE:
6836 		snd_hda_apply_pincfgs(codec, pincfgs);
6837 
6838 		/* Fixes volume control problem for side speakers */
6839 		alc295_fixup_disable_dac3(codec, fix, action);
6840 
6841 		/* Fixes no sound from headset speaker */
6842 		snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
6843 
6844 		/* Auto-enable headset mic when plugged */
6845 		snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
6846 
6847 		/* Headset mic volume enhancement */
6848 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
6849 		break;
6850 	case HDA_FIXUP_ACT_INIT:
6851 		alc_process_coef_fw(codec, coefs);
6852 		break;
6853 	case HDA_FIXUP_ACT_BUILD:
6854 		rename_ctl(codec, "Bass Speaker Playback Volume",
6855 			   "B&O-Tuned Playback Volume");
6856 		rename_ctl(codec, "Front Playback Switch",
6857 			   "B&O Soundbar Playback Switch");
6858 		rename_ctl(codec, "Bass Speaker Playback Switch",
6859 			   "Side Speaker Playback Switch");
6860 		break;
6861 	}
6862 }
6863 
6864 /* for hda_fixup_thinkpad_acpi() */
6865 #include "thinkpad_helper.c"
6866 
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)6867 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6868 				    const struct hda_fixup *fix, int action)
6869 {
6870 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6871 	hda_fixup_thinkpad_acpi(codec, fix, action);
6872 }
6873 
6874 /* 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)6875 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6876 						  const struct hda_fixup *fix,
6877 						  int action)
6878 {
6879 	struct alc_spec *spec = codec->spec;
6880 
6881 	switch (action) {
6882 	case HDA_FIXUP_ACT_PRE_PROBE:
6883 		spec->gen.suppress_auto_mute = 1;
6884 		break;
6885 	}
6886 }
6887 
comp_bind(struct device * dev)6888 static int comp_bind(struct device *dev)
6889 {
6890 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6891 	struct alc_spec *spec = cdc->spec;
6892 
6893 	return component_bind_all(dev, spec->comps);
6894 }
6895 
comp_unbind(struct device * dev)6896 static void comp_unbind(struct device *dev)
6897 {
6898 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6899 	struct alc_spec *spec = cdc->spec;
6900 
6901 	component_unbind_all(dev, spec->comps);
6902 }
6903 
6904 static const struct component_master_ops comp_master_ops = {
6905 	.bind = comp_bind,
6906 	.unbind = comp_unbind,
6907 };
6908 
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)6909 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6910 				       struct snd_pcm_substream *sub, int action)
6911 {
6912 	struct alc_spec *spec = cdc->spec;
6913 	int i;
6914 
6915 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6916 		if (spec->comps[i].dev && spec->comps[i].pre_playback_hook)
6917 			spec->comps[i].pre_playback_hook(spec->comps[i].dev, action);
6918 	}
6919 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6920 		if (spec->comps[i].dev && spec->comps[i].playback_hook)
6921 			spec->comps[i].playback_hook(spec->comps[i].dev, action);
6922 	}
6923 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6924 		if (spec->comps[i].dev && spec->comps[i].post_playback_hook)
6925 			spec->comps[i].post_playback_hook(spec->comps[i].dev, action);
6926 	}
6927 }
6928 
6929 struct scodec_dev_name {
6930 	const char *bus;
6931 	const char *hid;
6932 	int index;
6933 };
6934 
6935 /* match the device name in a slightly relaxed manner */
comp_match_cs35l41_dev_name(struct device * dev,void * data)6936 static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
6937 {
6938 	struct scodec_dev_name *p = data;
6939 	const char *d = dev_name(dev);
6940 	int n = strlen(p->bus);
6941 	char tmp[32];
6942 
6943 	/* check the bus name */
6944 	if (strncmp(d, p->bus, n))
6945 		return 0;
6946 	/* skip the bus number */
6947 	if (isdigit(d[n]))
6948 		n++;
6949 	/* the rest must be exact matching */
6950 	snprintf(tmp, sizeof(tmp), "-%s:00-cs35l41-hda.%d", p->hid, p->index);
6951 	return !strcmp(d + n, tmp);
6952 }
6953 
comp_match_tas2781_dev_name(struct device * dev,void * data)6954 static int comp_match_tas2781_dev_name(struct device *dev,
6955 	void *data)
6956 {
6957 	struct scodec_dev_name *p = data;
6958 	const char *d = dev_name(dev);
6959 	int n = strlen(p->bus);
6960 	char tmp[32];
6961 
6962 	/* check the bus name */
6963 	if (strncmp(d, p->bus, n))
6964 		return 0;
6965 	/* skip the bus number */
6966 	if (isdigit(d[n]))
6967 		n++;
6968 	/* the rest must be exact matching */
6969 	snprintf(tmp, sizeof(tmp), "-%s:00", p->hid);
6970 
6971 	return !strcmp(d + n, tmp);
6972 }
6973 
cs35l41_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,int count)6974 static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6975 				  const char *hid, int count)
6976 {
6977 	struct device *dev = hda_codec_dev(cdc);
6978 	struct alc_spec *spec = cdc->spec;
6979 	struct scodec_dev_name *rec;
6980 	int ret, i;
6981 
6982 	switch (action) {
6983 	case HDA_FIXUP_ACT_PRE_PROBE:
6984 		for (i = 0; i < count; i++) {
6985 			rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6986 			if (!rec)
6987 				return;
6988 			rec->bus = bus;
6989 			rec->hid = hid;
6990 			rec->index = i;
6991 			spec->comps[i].codec = cdc;
6992 			component_match_add(dev, &spec->match,
6993 					    comp_match_cs35l41_dev_name, rec);
6994 		}
6995 		ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6996 		if (ret)
6997 			codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6998 		else
6999 			spec->gen.pcm_playback_hook = comp_generic_playback_hook;
7000 		break;
7001 	case HDA_FIXUP_ACT_FREE:
7002 		component_master_del(dev, &comp_master_ops);
7003 		break;
7004 	}
7005 }
7006 
tas2781_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid)7007 static void tas2781_generic_fixup(struct hda_codec *cdc, int action,
7008 	const char *bus, const char *hid)
7009 {
7010 	struct device *dev = hda_codec_dev(cdc);
7011 	struct alc_spec *spec = cdc->spec;
7012 	struct scodec_dev_name *rec;
7013 	int ret;
7014 
7015 	switch (action) {
7016 	case HDA_FIXUP_ACT_PRE_PROBE:
7017 		rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
7018 		if (!rec)
7019 			return;
7020 		rec->bus = bus;
7021 		rec->hid = hid;
7022 		rec->index = 0;
7023 		spec->comps[0].codec = cdc;
7024 		component_match_add(dev, &spec->match,
7025 			comp_match_tas2781_dev_name, rec);
7026 		ret = component_master_add_with_match(dev, &comp_master_ops,
7027 			spec->match);
7028 		if (ret)
7029 			codec_err(cdc,
7030 				"Fail to register component aggregator %d\n",
7031 				ret);
7032 		else
7033 			spec->gen.pcm_playback_hook =
7034 				comp_generic_playback_hook;
7035 		break;
7036 	case HDA_FIXUP_ACT_FREE:
7037 		component_master_del(dev, &comp_master_ops);
7038 		break;
7039 	}
7040 }
7041 
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7042 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7043 {
7044 	cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
7045 }
7046 
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)7047 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7048 {
7049 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2);
7050 }
7051 
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)7052 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7053 {
7054 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4);
7055 }
7056 
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7057 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7058 						 int action)
7059 {
7060 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
7061 }
7062 
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7063 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7064 						 int action)
7065 {
7066 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0101", 2);
7067 }
7068 
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7069 static void tas2781_fixup_i2c(struct hda_codec *cdc,
7070 	const struct hda_fixup *fix, int action)
7071 {
7072 	 tas2781_generic_fixup(cdc, action, "i2c", "TIAS2781");
7073 }
7074 
7075 /* for alc295_fixup_hp_top_speakers */
7076 #include "hp_x360_helper.c"
7077 
7078 /* for alc285_fixup_ideapad_s740_coef() */
7079 #include "ideapad_s740_helper.c"
7080 
7081 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
7082 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
7083 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
7084 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
7085 	{}
7086 };
7087 
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)7088 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
7089 					   const struct hda_fixup *fix,
7090 					   int action)
7091 {
7092 	/*
7093 	 * A certain other OS sets these coeffs to different values. On at least
7094 	 * one TongFang barebone these settings might survive even a cold
7095 	 * reboot. So to restore a clean slate the values are explicitly reset
7096 	 * to default here. Without this, the external microphone is always in a
7097 	 * plugged-in state, while the internal microphone is always in an
7098 	 * unplugged state, breaking the ability to use the internal microphone.
7099 	 */
7100 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7101 }
7102 
7103 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7104 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7105 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7106 	WRITE_COEF(0x49, 0x0149),
7107 	{}
7108 };
7109 
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7110 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7111 				       const struct hda_fixup *fix,
7112 				       int action)
7113 {
7114 	/*
7115 	 * The audio jack input and output is not detected on the ASRock NUC Box
7116 	 * 1100 series when cold booting without this fix. Warm rebooting from a
7117 	 * certain other OS makes the audio functional, as COEF settings are
7118 	 * preserved in this case. This fix sets these altered COEF values as
7119 	 * the default.
7120 	 */
7121 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7122 }
7123 
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7124 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7125 						    const struct hda_fixup *fix,
7126 						    int action)
7127 {
7128 	/*
7129 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7130 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7131 	 * needs an additional quirk for sound working after suspend and resume.
7132 	 */
7133 	if (codec->core.vendor_id == 0x10ec0256) {
7134 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7135 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7136 	} else {
7137 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7138 	}
7139 }
7140 
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7141 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7142 						  const struct hda_fixup *fix,
7143 						  int action)
7144 {
7145 	struct alc_spec *spec = codec->spec;
7146 	struct hda_input_mux *imux = &spec->gen.input_mux;
7147 	int i;
7148 
7149 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
7150 
7151 	switch (action) {
7152 	case HDA_FIXUP_ACT_PRE_PROBE:
7153 		/**
7154 		 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7155 		 * to Hi-Z to avoid pop noises at startup and when plugging and
7156 		 * unplugging headphones.
7157 		 */
7158 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7159 		snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7160 		break;
7161 	case HDA_FIXUP_ACT_PROBE:
7162 		/**
7163 		 * Make the internal mic (0x12) the default input source to
7164 		 * prevent pop noises on cold boot.
7165 		 */
7166 		for (i = 0; i < imux->num_items; i++) {
7167 			if (spec->gen.imux_pins[i] == 0x12) {
7168 				spec->gen.cur_mux[0] = i;
7169 				break;
7170 			}
7171 		}
7172 		break;
7173 	}
7174 }
7175 
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7176 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7177 					  const struct hda_fixup *fix, int action)
7178 {
7179 	/*
7180 	 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7181 	 * unconnected.
7182 	 */
7183 	static const struct hda_pintbl pincfgs[] = {
7184 		{ 0x17, 0x90170121 },
7185 		{ }
7186 	};
7187 	/*
7188 	 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7189 	 * DAC 0x02 and 0x03 would be fine.
7190 	 */
7191 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7192 	/*
7193 	 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7194 	 * Headphones (0x21) are connected to DAC 0x03.
7195 	 */
7196 	static const hda_nid_t preferred_pairs[] = {
7197 		0x14, 0x02,
7198 		0x17, 0x02,
7199 		0x21, 0x03,
7200 		0
7201 	};
7202 	struct alc_spec *spec = codec->spec;
7203 
7204 	switch (action) {
7205 	case HDA_FIXUP_ACT_PRE_PROBE:
7206 		snd_hda_apply_pincfgs(codec, pincfgs);
7207 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7208 		spec->gen.preferred_dacs = preferred_pairs;
7209 		break;
7210 	}
7211 }
7212 
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7213 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7214 					  const struct hda_fixup *fix, int action)
7215 {
7216 	static const struct hda_pintbl pincfgs[] = {
7217 		{ 0x14, 0x90170151 },
7218 		{ 0x17, 0x90170150 },
7219 		{ }
7220 	};
7221 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7222 	static const hda_nid_t preferred_pairs[] = {
7223 		0x14, 0x02,
7224 		0x17, 0x03,
7225 		0x21, 0x02,
7226 		0
7227 	};
7228 	struct alc_spec *spec = codec->spec;
7229 
7230 	alc_fixup_no_shutup(codec, fix, action);
7231 
7232 	switch (action) {
7233 	case HDA_FIXUP_ACT_PRE_PROBE:
7234 		snd_hda_apply_pincfgs(codec, pincfgs);
7235 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7236 		spec->gen.preferred_dacs = preferred_pairs;
7237 		break;
7238 	}
7239 }
7240 
7241 /* 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)7242 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7243 				    const struct hda_fixup *fix, int action)
7244 {
7245 	struct alc_spec *spec = codec->spec;
7246 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7247 	static const hda_nid_t preferred_pairs[] = {
7248 		0x17, 0x02, 0x21, 0x03, 0
7249 	};
7250 
7251 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7252 		return;
7253 
7254 	snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7255 	spec->gen.preferred_dacs = preferred_pairs;
7256 	spec->gen.auto_mute_via_amp = 1;
7257 	if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7258 		snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7259 					0x0); /* Make sure 0x14 was disable */
7260 	}
7261 }
7262 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7263 static void alc_fixup_headset_mic(struct hda_codec *codec,
7264 				   const struct hda_fixup *fix, int action)
7265 {
7266 	struct alc_spec *spec = codec->spec;
7267 	static const struct hda_pintbl pincfgs[] = {
7268 		{ 0x19, 0x03a1103c },
7269 		{ }
7270 	};
7271 
7272 	switch (action) {
7273 	case HDA_FIXUP_ACT_PRE_PROBE:
7274 		snd_hda_apply_pincfgs(codec, pincfgs);
7275 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7276 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7277 		break;
7278 	}
7279 }
7280 
7281 
7282 enum {
7283 	ALC269_FIXUP_GPIO2,
7284 	ALC269_FIXUP_SONY_VAIO,
7285 	ALC275_FIXUP_SONY_VAIO_GPIO2,
7286 	ALC269_FIXUP_DELL_M101Z,
7287 	ALC269_FIXUP_SKU_IGNORE,
7288 	ALC269_FIXUP_ASUS_G73JW,
7289 	ALC269_FIXUP_ASUS_N7601ZM_PINS,
7290 	ALC269_FIXUP_ASUS_N7601ZM,
7291 	ALC269_FIXUP_LENOVO_EAPD,
7292 	ALC275_FIXUP_SONY_HWEQ,
7293 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
7294 	ALC271_FIXUP_DMIC,
7295 	ALC269_FIXUP_PCM_44K,
7296 	ALC269_FIXUP_STEREO_DMIC,
7297 	ALC269_FIXUP_HEADSET_MIC,
7298 	ALC269_FIXUP_QUANTA_MUTE,
7299 	ALC269_FIXUP_LIFEBOOK,
7300 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
7301 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
7302 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7303 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7304 	ALC269_FIXUP_AMIC,
7305 	ALC269_FIXUP_DMIC,
7306 	ALC269VB_FIXUP_AMIC,
7307 	ALC269VB_FIXUP_DMIC,
7308 	ALC269_FIXUP_HP_MUTE_LED,
7309 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
7310 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
7311 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
7312 	ALC269_FIXUP_HP_GPIO_LED,
7313 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
7314 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
7315 	ALC269_FIXUP_INV_DMIC,
7316 	ALC269_FIXUP_LENOVO_DOCK,
7317 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7318 	ALC269_FIXUP_NO_SHUTUP,
7319 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7320 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7321 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7322 	ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7323 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7324 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7325 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7326 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7327 	ALC269_FIXUP_HEADSET_MODE,
7328 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7329 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7330 	ALC269_FIXUP_ASUS_X101_FUNC,
7331 	ALC269_FIXUP_ASUS_X101_VERB,
7332 	ALC269_FIXUP_ASUS_X101,
7333 	ALC271_FIXUP_AMIC_MIC2,
7334 	ALC271_FIXUP_HP_GATE_MIC_JACK,
7335 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7336 	ALC269_FIXUP_ACER_AC700,
7337 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7338 	ALC269VB_FIXUP_ASUS_ZENBOOK,
7339 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7340 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7341 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7342 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
7343 	ALC283_FIXUP_CHROME_BOOK,
7344 	ALC283_FIXUP_SENSE_COMBO_JACK,
7345 	ALC282_FIXUP_ASUS_TX300,
7346 	ALC283_FIXUP_INT_MIC,
7347 	ALC290_FIXUP_MONO_SPEAKERS,
7348 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7349 	ALC290_FIXUP_SUBWOOFER,
7350 	ALC290_FIXUP_SUBWOOFER_HSJACK,
7351 	ALC295_FIXUP_HP_MUTE_LED_COEFBIT11,
7352 	ALC269_FIXUP_THINKPAD_ACPI,
7353 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7354 	ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
7355 	ALC269VC_FIXUP_INFINIX_Y4_MAX,
7356 	ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7357 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7358 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7359 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7360 	ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7361 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7362 	ALC255_FIXUP_HEADSET_MODE,
7363 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7364 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7365 	ALC292_FIXUP_TPT440_DOCK,
7366 	ALC292_FIXUP_TPT440,
7367 	ALC283_FIXUP_HEADSET_MIC,
7368 	ALC255_FIXUP_MIC_MUTE_LED,
7369 	ALC282_FIXUP_ASPIRE_V5_PINS,
7370 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
7371 	ALC280_FIXUP_HP_GPIO4,
7372 	ALC286_FIXUP_HP_GPIO_LED,
7373 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7374 	ALC280_FIXUP_HP_DOCK_PINS,
7375 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7376 	ALC280_FIXUP_HP_9480M,
7377 	ALC245_FIXUP_HP_X360_AMP,
7378 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7379 	ALC285_FIXUP_HP_ENVY_X360,
7380 	ALC288_FIXUP_DELL_HEADSET_MODE,
7381 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7382 	ALC288_FIXUP_DELL_XPS_13,
7383 	ALC288_FIXUP_DISABLE_AAMIX,
7384 	ALC292_FIXUP_DELL_E7X_AAMIX,
7385 	ALC292_FIXUP_DELL_E7X,
7386 	ALC292_FIXUP_DISABLE_AAMIX,
7387 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7388 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7389 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7390 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7391 	ALC275_FIXUP_DELL_XPS,
7392 	ALC293_FIXUP_LENOVO_SPK_NOISE,
7393 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7394 	ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED,
7395 	ALC255_FIXUP_DELL_SPK_NOISE,
7396 	ALC225_FIXUP_DISABLE_MIC_VREF,
7397 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7398 	ALC295_FIXUP_DISABLE_DAC3,
7399 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
7400 	ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7401 	ALC285_FIXUP_ASUS_HEADSET_MIC,
7402 	ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7403 	ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7404 	ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7405 	ALC280_FIXUP_HP_HEADSET_MIC,
7406 	ALC221_FIXUP_HP_FRONT_MIC,
7407 	ALC292_FIXUP_TPT460,
7408 	ALC298_FIXUP_SPK_VOLUME,
7409 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
7410 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7411 	ALC269_FIXUP_ATIV_BOOK_8,
7412 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7413 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7414 	ALC256_FIXUP_ASUS_HEADSET_MODE,
7415 	ALC256_FIXUP_ASUS_MIC,
7416 	ALC256_FIXUP_ASUS_AIO_GPIO2,
7417 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7418 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7419 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
7420 	ALC233_FIXUP_ACER_HEADSET_MIC,
7421 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
7422 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7423 	ALC225_FIXUP_S3_POP_NOISE,
7424 	ALC700_FIXUP_INTEL_REFERENCE,
7425 	ALC274_FIXUP_DELL_BIND_DACS,
7426 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7427 	ALC298_FIXUP_TPT470_DOCK_FIX,
7428 	ALC298_FIXUP_TPT470_DOCK,
7429 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7430 	ALC255_FIXUP_DELL_HEADSET_MIC,
7431 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7432 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
7433 	ALC295_FIXUP_HP_X360,
7434 	ALC221_FIXUP_HP_HEADSET_MIC,
7435 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7436 	ALC295_FIXUP_HP_AUTO_MUTE,
7437 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7438 	ALC294_FIXUP_ASUS_MIC,
7439 	ALC294_FIXUP_ASUS_HEADSET_MIC,
7440 	ALC294_FIXUP_ASUS_SPK,
7441 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7442 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7443 	ALC255_FIXUP_ACER_HEADSET_MIC,
7444 	ALC295_FIXUP_CHROME_BOOK,
7445 	ALC225_FIXUP_HEADSET_JACK,
7446 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7447 	ALC225_FIXUP_WYSE_AUTO_MUTE,
7448 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7449 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7450 	ALC256_FIXUP_ASUS_HEADSET_MIC,
7451 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7452 	ALC255_FIXUP_PREDATOR_SUBWOOFER,
7453 	ALC299_FIXUP_PREDATOR_SPK,
7454 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7455 	ALC289_FIXUP_DELL_SPK1,
7456 	ALC289_FIXUP_DELL_SPK2,
7457 	ALC289_FIXUP_DUAL_SPK,
7458 	ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7459 	ALC294_FIXUP_SPK2_TO_DAC1,
7460 	ALC294_FIXUP_ASUS_DUAL_SPK,
7461 	ALC285_FIXUP_THINKPAD_X1_GEN7,
7462 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7463 	ALC294_FIXUP_ASUS_ALLY,
7464 	ALC294_FIXUP_ASUS_ALLY_PINS,
7465 	ALC294_FIXUP_ASUS_ALLY_VERBS,
7466 	ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7467 	ALC294_FIXUP_ASUS_HPE,
7468 	ALC294_FIXUP_ASUS_COEF_1B,
7469 	ALC294_FIXUP_ASUS_GX502_HP,
7470 	ALC294_FIXUP_ASUS_GX502_PINS,
7471 	ALC294_FIXUP_ASUS_GX502_VERBS,
7472 	ALC294_FIXUP_ASUS_GU502_HP,
7473 	ALC294_FIXUP_ASUS_GU502_PINS,
7474 	ALC294_FIXUP_ASUS_GU502_VERBS,
7475 	ALC294_FIXUP_ASUS_G513_PINS,
7476 	ALC285_FIXUP_ASUS_G533Z_PINS,
7477 	ALC285_FIXUP_HP_GPIO_LED,
7478 	ALC285_FIXUP_HP_MUTE_LED,
7479 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7480 	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7481 	ALC236_FIXUP_HP_GPIO_LED,
7482 	ALC236_FIXUP_HP_MUTE_LED,
7483 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7484 	ALC236_FIXUP_LENOVO_INV_DMIC,
7485 	ALC298_FIXUP_SAMSUNG_AMP,
7486 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7487 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7488 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7489 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7490 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
7491 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7492 	ALC289_FIXUP_ASUS_GA401,
7493 	ALC289_FIXUP_ASUS_GA502,
7494 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7495 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
7496 	ALC269_FIXUP_CZC_B20,
7497 	ALC269_FIXUP_CZC_TMI,
7498 	ALC269_FIXUP_CZC_L101,
7499 	ALC269_FIXUP_LEMOTE_A1802,
7500 	ALC269_FIXUP_LEMOTE_A190X,
7501 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
7502 	ALC233_FIXUP_INTEL_NUC8_DMIC,
7503 	ALC233_FIXUP_INTEL_NUC8_BOOST,
7504 	ALC256_FIXUP_INTEL_NUC10,
7505 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7506 	ALC274_FIXUP_HP_MIC,
7507 	ALC274_FIXUP_HP_HEADSET_MIC,
7508 	ALC274_FIXUP_HP_ENVY_GPIO,
7509 	ALC256_FIXUP_ASUS_HPE,
7510 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7511 	ALC287_FIXUP_HP_GPIO_LED,
7512 	ALC256_FIXUP_HP_HEADSET_MIC,
7513 	ALC245_FIXUP_HP_GPIO_LED,
7514 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7515 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7516 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7517 	ALC256_FIXUP_ACER_HEADSET_MIC,
7518 	ALC285_FIXUP_IDEAPAD_S740_COEF,
7519 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7520 	ALC295_FIXUP_ASUS_DACS,
7521 	ALC295_FIXUP_HP_OMEN,
7522 	ALC285_FIXUP_HP_SPECTRE_X360,
7523 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7524 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7525 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7526 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7527 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7528 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7529 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7530 	ALC298_FIXUP_LENOVO_C940_DUET7,
7531 	ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
7532 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
7533 	ALC256_FIXUP_SET_COEF_DEFAULTS,
7534 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7535 	ALC233_FIXUP_NO_AUDIO_JACK,
7536 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7537 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7538 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7539 	ALC287_FIXUP_LEGION_16ACHG6,
7540 	ALC287_FIXUP_CS35L41_I2C_2,
7541 	ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7542 	ALC245_FIXUP_CS35L41_SPI_2,
7543 	ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7544 	ALC245_FIXUP_CS35L41_SPI_4,
7545 	ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7546 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7547 	ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7548 	ALC287_FIXUP_LEGION_16ITHG6,
7549 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7550 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7551 	ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7552 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7553 	ALC236_FIXUP_DELL_DUAL_CODECS,
7554 	ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7555 	ALC287_FIXUP_TAS2781_I2C,
7556 	ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7557 	ALC245_FIXUP_HP_X360_MUTE_LEDS,
7558 	ALC287_FIXUP_THINKPAD_I2S_SPK,
7559 	ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7560 	ALC2XX_FIXUP_HEADSET_MIC,
7561 	ALC289_FIXUP_DELL_CS35L41_SPI_2,
7562 	ALC294_FIXUP_CS35L41_I2C_2,
7563 };
7564 
7565 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7566  * both have the very same PCI SSID, and we need to apply different fixups
7567  * depending on the codec ID
7568  */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)7569 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7570 					   const struct hda_fixup *fix,
7571 					   int action)
7572 {
7573 	int id;
7574 
7575 	if (codec->core.vendor_id == 0x10ec0298)
7576 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7577 	else
7578 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7579 	__snd_hda_apply_fixup(codec, id, action, 0);
7580 }
7581 
7582 /* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
7583  * 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
7584  * so we need to apply a different fixup in this case. The only DuetITL codec
7585  * SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
7586  * and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
7587  * have matched correctly by their codecs.
7588  */
alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec * codec,const struct hda_fixup * fix,int action)7589 static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
7590 					      const struct hda_fixup *fix,
7591 					      int action)
7592 {
7593 	int id;
7594 
7595 	if (codec->core.subsystem_id == 0x17aa3802)
7596 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
7597 	else
7598 		id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
7599 	__snd_hda_apply_fixup(codec, id, action, 0);
7600 }
7601 
7602 static const struct hda_fixup alc269_fixups[] = {
7603 	[ALC269_FIXUP_GPIO2] = {
7604 		.type = HDA_FIXUP_FUNC,
7605 		.v.func = alc_fixup_gpio2,
7606 	},
7607 	[ALC269_FIXUP_SONY_VAIO] = {
7608 		.type = HDA_FIXUP_PINCTLS,
7609 		.v.pins = (const struct hda_pintbl[]) {
7610 			{0x19, PIN_VREFGRD},
7611 			{}
7612 		}
7613 	},
7614 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7615 		.type = HDA_FIXUP_FUNC,
7616 		.v.func = alc275_fixup_gpio4_off,
7617 		.chained = true,
7618 		.chain_id = ALC269_FIXUP_SONY_VAIO
7619 	},
7620 	[ALC269_FIXUP_DELL_M101Z] = {
7621 		.type = HDA_FIXUP_VERBS,
7622 		.v.verbs = (const struct hda_verb[]) {
7623 			/* Enables internal speaker */
7624 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
7625 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7626 			{}
7627 		}
7628 	},
7629 	[ALC269_FIXUP_SKU_IGNORE] = {
7630 		.type = HDA_FIXUP_FUNC,
7631 		.v.func = alc_fixup_sku_ignore,
7632 	},
7633 	[ALC269_FIXUP_ASUS_G73JW] = {
7634 		.type = HDA_FIXUP_PINS,
7635 		.v.pins = (const struct hda_pintbl[]) {
7636 			{ 0x17, 0x99130111 }, /* subwoofer */
7637 			{ }
7638 		}
7639 	},
7640 	[ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7641 		.type = HDA_FIXUP_PINS,
7642 		.v.pins = (const struct hda_pintbl[]) {
7643 			{ 0x19, 0x03A11050 },
7644 			{ 0x1a, 0x03A11C30 },
7645 			{ 0x21, 0x03211420 },
7646 			{ }
7647 		}
7648 	},
7649 	[ALC269_FIXUP_ASUS_N7601ZM] = {
7650 		.type = HDA_FIXUP_VERBS,
7651 		.v.verbs = (const struct hda_verb[]) {
7652 			{0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7653 			{0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7654 			{0x20, AC_VERB_SET_COEF_INDEX, 0x10},
7655 			{0x20, AC_VERB_SET_PROC_COEF, 0x8420},
7656 			{0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
7657 			{0x20, AC_VERB_SET_PROC_COEF, 0x7774},
7658 			{ }
7659 		},
7660 		.chained = true,
7661 		.chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
7662 	},
7663 	[ALC269_FIXUP_LENOVO_EAPD] = {
7664 		.type = HDA_FIXUP_VERBS,
7665 		.v.verbs = (const struct hda_verb[]) {
7666 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7667 			{}
7668 		}
7669 	},
7670 	[ALC275_FIXUP_SONY_HWEQ] = {
7671 		.type = HDA_FIXUP_FUNC,
7672 		.v.func = alc269_fixup_hweq,
7673 		.chained = true,
7674 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7675 	},
7676 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7677 		.type = HDA_FIXUP_FUNC,
7678 		.v.func = alc_fixup_disable_aamix,
7679 		.chained = true,
7680 		.chain_id = ALC269_FIXUP_SONY_VAIO
7681 	},
7682 	[ALC271_FIXUP_DMIC] = {
7683 		.type = HDA_FIXUP_FUNC,
7684 		.v.func = alc271_fixup_dmic,
7685 	},
7686 	[ALC269_FIXUP_PCM_44K] = {
7687 		.type = HDA_FIXUP_FUNC,
7688 		.v.func = alc269_fixup_pcm_44k,
7689 		.chained = true,
7690 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7691 	},
7692 	[ALC269_FIXUP_STEREO_DMIC] = {
7693 		.type = HDA_FIXUP_FUNC,
7694 		.v.func = alc269_fixup_stereo_dmic,
7695 	},
7696 	[ALC269_FIXUP_HEADSET_MIC] = {
7697 		.type = HDA_FIXUP_FUNC,
7698 		.v.func = alc269_fixup_headset_mic,
7699 	},
7700 	[ALC269_FIXUP_QUANTA_MUTE] = {
7701 		.type = HDA_FIXUP_FUNC,
7702 		.v.func = alc269_fixup_quanta_mute,
7703 	},
7704 	[ALC269_FIXUP_LIFEBOOK] = {
7705 		.type = HDA_FIXUP_PINS,
7706 		.v.pins = (const struct hda_pintbl[]) {
7707 			{ 0x1a, 0x2101103f }, /* dock line-out */
7708 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
7709 			{ }
7710 		},
7711 		.chained = true,
7712 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7713 	},
7714 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7715 		.type = HDA_FIXUP_PINS,
7716 		.v.pins = (const struct hda_pintbl[]) {
7717 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7718 			{ }
7719 		},
7720 	},
7721 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7722 		.type = HDA_FIXUP_PINS,
7723 		.v.pins = (const struct hda_pintbl[]) {
7724 			{ 0x21, 0x0221102f }, /* HP out */
7725 			{ }
7726 		},
7727 	},
7728 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7729 		.type = HDA_FIXUP_FUNC,
7730 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7731 	},
7732 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7733 		.type = HDA_FIXUP_FUNC,
7734 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7735 	},
7736 	[ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13] = {
7737 		.type = HDA_FIXUP_PINS,
7738 		.v.pins = (const struct hda_pintbl[]) {
7739 			{ 0x14, 0x90170151 }, /* use as internal speaker (LFE) */
7740 			{ 0x1b, 0x90170152 }, /* use as internal speaker (back) */
7741 			{ }
7742 		},
7743 		.chained = true,
7744 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7745 	},
7746 	[ALC269VC_FIXUP_INFINIX_Y4_MAX] = {
7747 		.type = HDA_FIXUP_PINS,
7748 		.v.pins = (const struct hda_pintbl[]) {
7749 			{ 0x1b, 0x90170150 }, /* use as internal speaker */
7750 			{ }
7751 		},
7752 		.chained = true,
7753 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7754 	},
7755 	[ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
7756 		.type = HDA_FIXUP_PINS,
7757 		.v.pins = (const struct hda_pintbl[]) {
7758 			{ 0x18, 0x03a19020 }, /* headset mic */
7759 			{ 0x1b, 0x90170150 }, /* speaker */
7760 			{ }
7761 		},
7762 	},
7763 	[ALC269_FIXUP_AMIC] = {
7764 		.type = HDA_FIXUP_PINS,
7765 		.v.pins = (const struct hda_pintbl[]) {
7766 			{ 0x14, 0x99130110 }, /* speaker */
7767 			{ 0x15, 0x0121401f }, /* HP out */
7768 			{ 0x18, 0x01a19c20 }, /* mic */
7769 			{ 0x19, 0x99a3092f }, /* int-mic */
7770 			{ }
7771 		},
7772 	},
7773 	[ALC269_FIXUP_DMIC] = {
7774 		.type = HDA_FIXUP_PINS,
7775 		.v.pins = (const struct hda_pintbl[]) {
7776 			{ 0x12, 0x99a3092f }, /* int-mic */
7777 			{ 0x14, 0x99130110 }, /* speaker */
7778 			{ 0x15, 0x0121401f }, /* HP out */
7779 			{ 0x18, 0x01a19c20 }, /* mic */
7780 			{ }
7781 		},
7782 	},
7783 	[ALC269VB_FIXUP_AMIC] = {
7784 		.type = HDA_FIXUP_PINS,
7785 		.v.pins = (const struct hda_pintbl[]) {
7786 			{ 0x14, 0x99130110 }, /* speaker */
7787 			{ 0x18, 0x01a19c20 }, /* mic */
7788 			{ 0x19, 0x99a3092f }, /* int-mic */
7789 			{ 0x21, 0x0121401f }, /* HP out */
7790 			{ }
7791 		},
7792 	},
7793 	[ALC269VB_FIXUP_DMIC] = {
7794 		.type = HDA_FIXUP_PINS,
7795 		.v.pins = (const struct hda_pintbl[]) {
7796 			{ 0x12, 0x99a3092f }, /* int-mic */
7797 			{ 0x14, 0x99130110 }, /* speaker */
7798 			{ 0x18, 0x01a19c20 }, /* mic */
7799 			{ 0x21, 0x0121401f }, /* HP out */
7800 			{ }
7801 		},
7802 	},
7803 	[ALC269_FIXUP_HP_MUTE_LED] = {
7804 		.type = HDA_FIXUP_FUNC,
7805 		.v.func = alc269_fixup_hp_mute_led,
7806 	},
7807 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7808 		.type = HDA_FIXUP_FUNC,
7809 		.v.func = alc269_fixup_hp_mute_led_mic1,
7810 	},
7811 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7812 		.type = HDA_FIXUP_FUNC,
7813 		.v.func = alc269_fixup_hp_mute_led_mic2,
7814 	},
7815 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7816 		.type = HDA_FIXUP_FUNC,
7817 		.v.func = alc269_fixup_hp_mute_led_mic3,
7818 		.chained = true,
7819 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7820 	},
7821 	[ALC269_FIXUP_HP_GPIO_LED] = {
7822 		.type = HDA_FIXUP_FUNC,
7823 		.v.func = alc269_fixup_hp_gpio_led,
7824 	},
7825 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7826 		.type = HDA_FIXUP_FUNC,
7827 		.v.func = alc269_fixup_hp_gpio_mic1_led,
7828 	},
7829 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7830 		.type = HDA_FIXUP_FUNC,
7831 		.v.func = alc269_fixup_hp_line1_mic1_led,
7832 	},
7833 	[ALC269_FIXUP_INV_DMIC] = {
7834 		.type = HDA_FIXUP_FUNC,
7835 		.v.func = alc_fixup_inv_dmic,
7836 	},
7837 	[ALC269_FIXUP_NO_SHUTUP] = {
7838 		.type = HDA_FIXUP_FUNC,
7839 		.v.func = alc_fixup_no_shutup,
7840 	},
7841 	[ALC269_FIXUP_LENOVO_DOCK] = {
7842 		.type = HDA_FIXUP_PINS,
7843 		.v.pins = (const struct hda_pintbl[]) {
7844 			{ 0x19, 0x23a11040 }, /* dock mic */
7845 			{ 0x1b, 0x2121103f }, /* dock headphone */
7846 			{ }
7847 		},
7848 		.chained = true,
7849 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7850 	},
7851 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7852 		.type = HDA_FIXUP_FUNC,
7853 		.v.func = alc269_fixup_limit_int_mic_boost,
7854 		.chained = true,
7855 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
7856 	},
7857 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7858 		.type = HDA_FIXUP_FUNC,
7859 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7860 		.chained = true,
7861 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7862 	},
7863 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7864 		.type = HDA_FIXUP_PINS,
7865 		.v.pins = (const struct hda_pintbl[]) {
7866 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7867 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7868 			{ }
7869 		},
7870 		.chained = true,
7871 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7872 	},
7873 	[ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
7874 		.type = HDA_FIXUP_FUNC,
7875 		.v.func = alc269_fixup_limit_int_mic_boost,
7876 		.chained = true,
7877 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7878 	},
7879 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7880 		.type = HDA_FIXUP_PINS,
7881 		.v.pins = (const struct hda_pintbl[]) {
7882 			{ 0x16, 0x21014020 }, /* dock line out */
7883 			{ 0x19, 0x21a19030 }, /* dock mic */
7884 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7885 			{ }
7886 		},
7887 		.chained = true,
7888 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7889 	},
7890 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7891 		.type = HDA_FIXUP_PINS,
7892 		.v.pins = (const struct hda_pintbl[]) {
7893 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7894 			{ }
7895 		},
7896 		.chained = true,
7897 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7898 	},
7899 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7900 		.type = HDA_FIXUP_PINS,
7901 		.v.pins = (const struct hda_pintbl[]) {
7902 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7903 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7904 			{ }
7905 		},
7906 		.chained = true,
7907 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7908 	},
7909 	[ALC269_FIXUP_HEADSET_MODE] = {
7910 		.type = HDA_FIXUP_FUNC,
7911 		.v.func = alc_fixup_headset_mode,
7912 		.chained = true,
7913 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7914 	},
7915 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7916 		.type = HDA_FIXUP_FUNC,
7917 		.v.func = alc_fixup_headset_mode_no_hp_mic,
7918 	},
7919 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7920 		.type = HDA_FIXUP_PINS,
7921 		.v.pins = (const struct hda_pintbl[]) {
7922 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7923 			{ }
7924 		},
7925 		.chained = true,
7926 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
7927 	},
7928 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7929 		.type = HDA_FIXUP_PINS,
7930 		.v.pins = (const struct hda_pintbl[]) {
7931 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7932 			{ }
7933 		},
7934 		.chained = true,
7935 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7936 	},
7937 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7938 		.type = HDA_FIXUP_PINS,
7939 		.v.pins = (const struct hda_pintbl[]) {
7940 			{0x12, 0x90a60130},
7941 			{0x13, 0x40000000},
7942 			{0x14, 0x90170110},
7943 			{0x18, 0x411111f0},
7944 			{0x19, 0x04a11040},
7945 			{0x1a, 0x411111f0},
7946 			{0x1b, 0x90170112},
7947 			{0x1d, 0x40759a05},
7948 			{0x1e, 0x411111f0},
7949 			{0x21, 0x04211020},
7950 			{ }
7951 		},
7952 		.chained = true,
7953 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7954 	},
7955 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7956 		.type = HDA_FIXUP_FUNC,
7957 		.v.func = alc298_fixup_huawei_mbx_stereo,
7958 		.chained = true,
7959 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7960 	},
7961 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
7962 		.type = HDA_FIXUP_FUNC,
7963 		.v.func = alc269_fixup_x101_headset_mic,
7964 	},
7965 	[ALC269_FIXUP_ASUS_X101_VERB] = {
7966 		.type = HDA_FIXUP_VERBS,
7967 		.v.verbs = (const struct hda_verb[]) {
7968 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7969 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7970 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
7971 			{ }
7972 		},
7973 		.chained = true,
7974 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7975 	},
7976 	[ALC269_FIXUP_ASUS_X101] = {
7977 		.type = HDA_FIXUP_PINS,
7978 		.v.pins = (const struct hda_pintbl[]) {
7979 			{ 0x18, 0x04a1182c }, /* Headset mic */
7980 			{ }
7981 		},
7982 		.chained = true,
7983 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
7984 	},
7985 	[ALC271_FIXUP_AMIC_MIC2] = {
7986 		.type = HDA_FIXUP_PINS,
7987 		.v.pins = (const struct hda_pintbl[]) {
7988 			{ 0x14, 0x99130110 }, /* speaker */
7989 			{ 0x19, 0x01a19c20 }, /* mic */
7990 			{ 0x1b, 0x99a7012f }, /* int-mic */
7991 			{ 0x21, 0x0121401f }, /* HP out */
7992 			{ }
7993 		},
7994 	},
7995 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7996 		.type = HDA_FIXUP_FUNC,
7997 		.v.func = alc271_hp_gate_mic_jack,
7998 		.chained = true,
7999 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
8000 	},
8001 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
8002 		.type = HDA_FIXUP_FUNC,
8003 		.v.func = alc269_fixup_limit_int_mic_boost,
8004 		.chained = true,
8005 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
8006 	},
8007 	[ALC269_FIXUP_ACER_AC700] = {
8008 		.type = HDA_FIXUP_PINS,
8009 		.v.pins = (const struct hda_pintbl[]) {
8010 			{ 0x12, 0x99a3092f }, /* int-mic */
8011 			{ 0x14, 0x99130110 }, /* speaker */
8012 			{ 0x18, 0x03a11c20 }, /* mic */
8013 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
8014 			{ 0x21, 0x0321101f }, /* HP out */
8015 			{ }
8016 		},
8017 		.chained = true,
8018 		.chain_id = ALC271_FIXUP_DMIC,
8019 	},
8020 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
8021 		.type = HDA_FIXUP_FUNC,
8022 		.v.func = alc269_fixup_limit_int_mic_boost,
8023 		.chained = true,
8024 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8025 	},
8026 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
8027 		.type = HDA_FIXUP_FUNC,
8028 		.v.func = alc269_fixup_limit_int_mic_boost,
8029 		.chained = true,
8030 		.chain_id = ALC269VB_FIXUP_DMIC,
8031 	},
8032 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
8033 		.type = HDA_FIXUP_VERBS,
8034 		.v.verbs = (const struct hda_verb[]) {
8035 			/* class-D output amp +5dB */
8036 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
8037 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
8038 			{}
8039 		},
8040 		.chained = true,
8041 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
8042 	},
8043 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8044 		.type = HDA_FIXUP_PINS,
8045 		.v.pins = (const struct hda_pintbl[]) {
8046 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
8047 			{ }
8048 		},
8049 		.chained = true,
8050 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8051 	},
8052 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
8053 		.type = HDA_FIXUP_FUNC,
8054 		.v.func = alc269_fixup_limit_int_mic_boost,
8055 		.chained = true,
8056 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
8057 	},
8058 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
8059 		.type = HDA_FIXUP_PINS,
8060 		.v.pins = (const struct hda_pintbl[]) {
8061 			{ 0x12, 0x99a3092f }, /* int-mic */
8062 			{ 0x18, 0x03a11d20 }, /* mic */
8063 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
8064 			{ }
8065 		},
8066 	},
8067 	[ALC283_FIXUP_CHROME_BOOK] = {
8068 		.type = HDA_FIXUP_FUNC,
8069 		.v.func = alc283_fixup_chromebook,
8070 	},
8071 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
8072 		.type = HDA_FIXUP_FUNC,
8073 		.v.func = alc283_fixup_sense_combo_jack,
8074 		.chained = true,
8075 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
8076 	},
8077 	[ALC282_FIXUP_ASUS_TX300] = {
8078 		.type = HDA_FIXUP_FUNC,
8079 		.v.func = alc282_fixup_asus_tx300,
8080 	},
8081 	[ALC283_FIXUP_INT_MIC] = {
8082 		.type = HDA_FIXUP_VERBS,
8083 		.v.verbs = (const struct hda_verb[]) {
8084 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
8085 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
8086 			{ }
8087 		},
8088 		.chained = true,
8089 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8090 	},
8091 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
8092 		.type = HDA_FIXUP_PINS,
8093 		.v.pins = (const struct hda_pintbl[]) {
8094 			{ 0x17, 0x90170112 }, /* subwoofer */
8095 			{ }
8096 		},
8097 		.chained = true,
8098 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
8099 	},
8100 	[ALC290_FIXUP_SUBWOOFER] = {
8101 		.type = HDA_FIXUP_PINS,
8102 		.v.pins = (const struct hda_pintbl[]) {
8103 			{ 0x17, 0x90170112 }, /* subwoofer */
8104 			{ }
8105 		},
8106 		.chained = true,
8107 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
8108 	},
8109 	[ALC290_FIXUP_MONO_SPEAKERS] = {
8110 		.type = HDA_FIXUP_FUNC,
8111 		.v.func = alc290_fixup_mono_speakers,
8112 	},
8113 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8114 		.type = HDA_FIXUP_FUNC,
8115 		.v.func = alc290_fixup_mono_speakers,
8116 		.chained = true,
8117 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8118 	},
8119 	[ALC269_FIXUP_THINKPAD_ACPI] = {
8120 		.type = HDA_FIXUP_FUNC,
8121 		.v.func = alc_fixup_thinkpad_acpi,
8122 		.chained = true,
8123 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
8124 	},
8125 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8126 		.type = HDA_FIXUP_FUNC,
8127 		.v.func = alc_fixup_inv_dmic,
8128 		.chained = true,
8129 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8130 	},
8131 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8132 		.type = HDA_FIXUP_PINS,
8133 		.v.pins = (const struct hda_pintbl[]) {
8134 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8135 			{ }
8136 		},
8137 		.chained = true,
8138 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8139 	},
8140 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8141 		.type = HDA_FIXUP_PINS,
8142 		.v.pins = (const struct hda_pintbl[]) {
8143 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8144 			{ }
8145 		},
8146 		.chained = true,
8147 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8148 	},
8149 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8150 		.type = HDA_FIXUP_PINS,
8151 		.v.pins = (const struct hda_pintbl[]) {
8152 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8153 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8154 			{ }
8155 		},
8156 		.chained = true,
8157 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8158 	},
8159 	[ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8160 		.type = HDA_FIXUP_FUNC,
8161 		.v.func = alc269_fixup_limit_int_mic_boost,
8162 		.chained = true,
8163 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8164 	},
8165 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8166 		.type = HDA_FIXUP_PINS,
8167 		.v.pins = (const struct hda_pintbl[]) {
8168 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8169 			{ }
8170 		},
8171 		.chained = true,
8172 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8173 	},
8174 	[ALC255_FIXUP_HEADSET_MODE] = {
8175 		.type = HDA_FIXUP_FUNC,
8176 		.v.func = alc_fixup_headset_mode_alc255,
8177 		.chained = true,
8178 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8179 	},
8180 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8181 		.type = HDA_FIXUP_FUNC,
8182 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8183 	},
8184 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8185 		.type = HDA_FIXUP_PINS,
8186 		.v.pins = (const struct hda_pintbl[]) {
8187 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8188 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8189 			{ }
8190 		},
8191 		.chained = true,
8192 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8193 	},
8194 	[ALC292_FIXUP_TPT440_DOCK] = {
8195 		.type = HDA_FIXUP_FUNC,
8196 		.v.func = alc_fixup_tpt440_dock,
8197 		.chained = true,
8198 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8199 	},
8200 	[ALC292_FIXUP_TPT440] = {
8201 		.type = HDA_FIXUP_FUNC,
8202 		.v.func = alc_fixup_disable_aamix,
8203 		.chained = true,
8204 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
8205 	},
8206 	[ALC283_FIXUP_HEADSET_MIC] = {
8207 		.type = HDA_FIXUP_PINS,
8208 		.v.pins = (const struct hda_pintbl[]) {
8209 			{ 0x19, 0x04a110f0 },
8210 			{ },
8211 		},
8212 	},
8213 	[ALC255_FIXUP_MIC_MUTE_LED] = {
8214 		.type = HDA_FIXUP_FUNC,
8215 		.v.func = alc_fixup_micmute_led,
8216 	},
8217 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
8218 		.type = HDA_FIXUP_PINS,
8219 		.v.pins = (const struct hda_pintbl[]) {
8220 			{ 0x12, 0x90a60130 },
8221 			{ 0x14, 0x90170110 },
8222 			{ 0x17, 0x40000008 },
8223 			{ 0x18, 0x411111f0 },
8224 			{ 0x19, 0x01a1913c },
8225 			{ 0x1a, 0x411111f0 },
8226 			{ 0x1b, 0x411111f0 },
8227 			{ 0x1d, 0x40f89b2d },
8228 			{ 0x1e, 0x411111f0 },
8229 			{ 0x21, 0x0321101f },
8230 			{ },
8231 		},
8232 	},
8233 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8234 		.type = HDA_FIXUP_FUNC,
8235 		.v.func = alc269vb_fixup_aspire_e1_coef,
8236 	},
8237 	[ALC280_FIXUP_HP_GPIO4] = {
8238 		.type = HDA_FIXUP_FUNC,
8239 		.v.func = alc280_fixup_hp_gpio4,
8240 	},
8241 	[ALC286_FIXUP_HP_GPIO_LED] = {
8242 		.type = HDA_FIXUP_FUNC,
8243 		.v.func = alc286_fixup_hp_gpio_led,
8244 	},
8245 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8246 		.type = HDA_FIXUP_FUNC,
8247 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8248 	},
8249 	[ALC280_FIXUP_HP_DOCK_PINS] = {
8250 		.type = HDA_FIXUP_PINS,
8251 		.v.pins = (const struct hda_pintbl[]) {
8252 			{ 0x1b, 0x21011020 }, /* line-out */
8253 			{ 0x1a, 0x01a1903c }, /* headset mic */
8254 			{ 0x18, 0x2181103f }, /* line-in */
8255 			{ },
8256 		},
8257 		.chained = true,
8258 		.chain_id = ALC280_FIXUP_HP_GPIO4
8259 	},
8260 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8261 		.type = HDA_FIXUP_PINS,
8262 		.v.pins = (const struct hda_pintbl[]) {
8263 			{ 0x1b, 0x21011020 }, /* line-out */
8264 			{ 0x18, 0x2181103f }, /* line-in */
8265 			{ },
8266 		},
8267 		.chained = true,
8268 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8269 	},
8270 	[ALC280_FIXUP_HP_9480M] = {
8271 		.type = HDA_FIXUP_FUNC,
8272 		.v.func = alc280_fixup_hp_9480m,
8273 	},
8274 	[ALC245_FIXUP_HP_X360_AMP] = {
8275 		.type = HDA_FIXUP_FUNC,
8276 		.v.func = alc245_fixup_hp_x360_amp,
8277 		.chained = true,
8278 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
8279 	},
8280 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
8281 		.type = HDA_FIXUP_FUNC,
8282 		.v.func = alc_fixup_headset_mode_dell_alc288,
8283 		.chained = true,
8284 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8285 	},
8286 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8287 		.type = HDA_FIXUP_PINS,
8288 		.v.pins = (const struct hda_pintbl[]) {
8289 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8290 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8291 			{ }
8292 		},
8293 		.chained = true,
8294 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8295 	},
8296 	[ALC288_FIXUP_DISABLE_AAMIX] = {
8297 		.type = HDA_FIXUP_FUNC,
8298 		.v.func = alc_fixup_disable_aamix,
8299 		.chained = true,
8300 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8301 	},
8302 	[ALC288_FIXUP_DELL_XPS_13] = {
8303 		.type = HDA_FIXUP_FUNC,
8304 		.v.func = alc_fixup_dell_xps13,
8305 		.chained = true,
8306 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
8307 	},
8308 	[ALC292_FIXUP_DISABLE_AAMIX] = {
8309 		.type = HDA_FIXUP_FUNC,
8310 		.v.func = alc_fixup_disable_aamix,
8311 		.chained = true,
8312 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8313 	},
8314 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8315 		.type = HDA_FIXUP_FUNC,
8316 		.v.func = alc_fixup_disable_aamix,
8317 		.chained = true,
8318 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8319 	},
8320 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
8321 		.type = HDA_FIXUP_FUNC,
8322 		.v.func = alc_fixup_dell_xps13,
8323 		.chained = true,
8324 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
8325 	},
8326 	[ALC292_FIXUP_DELL_E7X] = {
8327 		.type = HDA_FIXUP_FUNC,
8328 		.v.func = alc_fixup_micmute_led,
8329 		/* micmute fixup must be applied at last */
8330 		.chained_before = true,
8331 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8332 	},
8333 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8334 		.type = HDA_FIXUP_PINS,
8335 		.v.pins = (const struct hda_pintbl[]) {
8336 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8337 			{ }
8338 		},
8339 		.chained_before = true,
8340 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8341 	},
8342 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8343 		.type = HDA_FIXUP_PINS,
8344 		.v.pins = (const struct hda_pintbl[]) {
8345 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8346 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8347 			{ }
8348 		},
8349 		.chained = true,
8350 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8351 	},
8352 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8353 		.type = HDA_FIXUP_PINS,
8354 		.v.pins = (const struct hda_pintbl[]) {
8355 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8356 			{ }
8357 		},
8358 		.chained = true,
8359 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8360 	},
8361 	[ALC275_FIXUP_DELL_XPS] = {
8362 		.type = HDA_FIXUP_VERBS,
8363 		.v.verbs = (const struct hda_verb[]) {
8364 			/* Enables internal speaker */
8365 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8366 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8367 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8368 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8369 			{}
8370 		}
8371 	},
8372 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8373 		.type = HDA_FIXUP_FUNC,
8374 		.v.func = alc_fixup_disable_aamix,
8375 		.chained = true,
8376 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8377 	},
8378 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8379 		.type = HDA_FIXUP_FUNC,
8380 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8381 	},
8382 	[ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED] = {
8383 		.type = HDA_FIXUP_FUNC,
8384 		.v.func = alc233_fixup_lenovo_low_en_micmute_led,
8385 	},
8386 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8387 		.type = HDA_FIXUP_FUNC,
8388 		.v.func = alc_fixup_inv_dmic,
8389 		.chained = true,
8390 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8391 	},
8392 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8393 		.type = HDA_FIXUP_FUNC,
8394 		.v.func = alc269_fixup_limit_int_mic_boost
8395 	},
8396 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
8397 		.type = HDA_FIXUP_FUNC,
8398 		.v.func = alc_fixup_disable_aamix,
8399 		.chained = true,
8400 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8401 	},
8402 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
8403 		.type = HDA_FIXUP_FUNC,
8404 		.v.func = alc_fixup_disable_mic_vref,
8405 		.chained = true,
8406 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8407 	},
8408 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8409 		.type = HDA_FIXUP_VERBS,
8410 		.v.verbs = (const struct hda_verb[]) {
8411 			/* Disable pass-through path for FRONT 14h */
8412 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8413 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8414 			{}
8415 		},
8416 		.chained = true,
8417 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8418 	},
8419 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
8420 		.type = HDA_FIXUP_FUNC,
8421 		.v.func = alc_fixup_disable_aamix,
8422 		.chained = true,
8423 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
8424 	},
8425 	[ALC221_FIXUP_HP_FRONT_MIC] = {
8426 		.type = HDA_FIXUP_PINS,
8427 		.v.pins = (const struct hda_pintbl[]) {
8428 			{ 0x19, 0x02a19020 }, /* Front Mic */
8429 			{ }
8430 		},
8431 	},
8432 	[ALC292_FIXUP_TPT460] = {
8433 		.type = HDA_FIXUP_FUNC,
8434 		.v.func = alc_fixup_tpt440_dock,
8435 		.chained = true,
8436 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8437 	},
8438 	[ALC298_FIXUP_SPK_VOLUME] = {
8439 		.type = HDA_FIXUP_FUNC,
8440 		.v.func = alc298_fixup_speaker_volume,
8441 		.chained = true,
8442 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8443 	},
8444 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8445 		.type = HDA_FIXUP_FUNC,
8446 		.v.func = alc298_fixup_speaker_volume,
8447 	},
8448 	[ALC295_FIXUP_DISABLE_DAC3] = {
8449 		.type = HDA_FIXUP_FUNC,
8450 		.v.func = alc295_fixup_disable_dac3,
8451 	},
8452 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8453 		.type = HDA_FIXUP_FUNC,
8454 		.v.func = alc285_fixup_speaker2_to_dac1,
8455 		.chained = true,
8456 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8457 	},
8458 	[ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8459 		.type = HDA_FIXUP_FUNC,
8460 		.v.func = alc285_fixup_speaker2_to_dac1,
8461 		.chained = true,
8462 		.chain_id = ALC245_FIXUP_CS35L41_SPI_2
8463 	},
8464 	[ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8465 		.type = HDA_FIXUP_PINS,
8466 		.v.pins = (const struct hda_pintbl[]) {
8467 			{ 0x19, 0x03a11050 },
8468 			{ 0x1b, 0x03a11c30 },
8469 			{ }
8470 		},
8471 		.chained = true,
8472 		.chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8473 	},
8474 	[ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8475 		.type = HDA_FIXUP_PINS,
8476 		.v.pins = (const struct hda_pintbl[]) {
8477 			{ 0x14, 0x90170120 },
8478 			{ }
8479 		},
8480 		.chained = true,
8481 		.chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8482 	},
8483 	[ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8484 		.type = HDA_FIXUP_FUNC,
8485 		.v.func = alc285_fixup_speaker2_to_dac1,
8486 		.chained = true,
8487 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2
8488 	},
8489 	[ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8490 		.type = HDA_FIXUP_PINS,
8491 		.v.pins = (const struct hda_pintbl[]) {
8492 			{ 0x19, 0x03a11050 },
8493 			{ 0x1b, 0x03a11c30 },
8494 			{ }
8495 		},
8496 		.chained = true,
8497 		.chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8498 	},
8499 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8500 		.type = HDA_FIXUP_PINS,
8501 		.v.pins = (const struct hda_pintbl[]) {
8502 			{ 0x1b, 0x90170151 },
8503 			{ }
8504 		},
8505 		.chained = true,
8506 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8507 	},
8508 	[ALC269_FIXUP_ATIV_BOOK_8] = {
8509 		.type = HDA_FIXUP_FUNC,
8510 		.v.func = alc_fixup_auto_mute_via_amp,
8511 		.chained = true,
8512 		.chain_id = ALC269_FIXUP_NO_SHUTUP
8513 	},
8514 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8515 		.type = HDA_FIXUP_PINS,
8516 		.v.pins = (const struct hda_pintbl[]) {
8517 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8518 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8519 			{ }
8520 		},
8521 		.chained = true,
8522 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8523 	},
8524 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8525 		.type = HDA_FIXUP_PINS,
8526 		.v.pins = (const struct hda_pintbl[]) {
8527 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8528 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8529 			{ }
8530 		},
8531 		.chained = true,
8532 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8533 	},
8534 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8535 		.type = HDA_FIXUP_FUNC,
8536 		.v.func = alc_fixup_headset_mode,
8537 	},
8538 	[ALC256_FIXUP_ASUS_MIC] = {
8539 		.type = HDA_FIXUP_PINS,
8540 		.v.pins = (const struct hda_pintbl[]) {
8541 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8542 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8543 			{ }
8544 		},
8545 		.chained = true,
8546 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8547 	},
8548 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8549 		.type = HDA_FIXUP_FUNC,
8550 		/* Set up GPIO2 for the speaker amp */
8551 		.v.func = alc_fixup_gpio4,
8552 	},
8553 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8554 		.type = HDA_FIXUP_PINS,
8555 		.v.pins = (const struct hda_pintbl[]) {
8556 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8557 			{ }
8558 		},
8559 		.chained = true,
8560 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8561 	},
8562 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8563 		.type = HDA_FIXUP_VERBS,
8564 		.v.verbs = (const struct hda_verb[]) {
8565 			/* Enables internal speaker */
8566 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8567 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8568 			{}
8569 		},
8570 		.chained = true,
8571 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8572 	},
8573 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8574 		.type = HDA_FIXUP_FUNC,
8575 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8576 		.chained = true,
8577 		.chain_id = ALC269_FIXUP_GPIO2
8578 	},
8579 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
8580 		.type = HDA_FIXUP_VERBS,
8581 		.v.verbs = (const struct hda_verb[]) {
8582 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8583 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8584 			{ }
8585 		},
8586 		.chained = true,
8587 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8588 	},
8589 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8590 		.type = HDA_FIXUP_PINS,
8591 		.v.pins = (const struct hda_pintbl[]) {
8592 			/* Change the mic location from front to right, otherwise there are
8593 			   two front mics with the same name, pulseaudio can't handle them.
8594 			   This is just a temporary workaround, after applying this fixup,
8595 			   there will be one "Front Mic" and one "Mic" in this machine.
8596 			 */
8597 			{ 0x1a, 0x04a19040 },
8598 			{ }
8599 		},
8600 	},
8601 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8602 		.type = HDA_FIXUP_PINS,
8603 		.v.pins = (const struct hda_pintbl[]) {
8604 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
8605 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8606 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8607 			{ 0x1b, 0x02011020 },
8608 			{ }
8609 		},
8610 		.chained = true,
8611 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
8612 	},
8613 	[ALC225_FIXUP_S3_POP_NOISE] = {
8614 		.type = HDA_FIXUP_FUNC,
8615 		.v.func = alc225_fixup_s3_pop_noise,
8616 		.chained = true,
8617 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8618 	},
8619 	[ALC700_FIXUP_INTEL_REFERENCE] = {
8620 		.type = HDA_FIXUP_VERBS,
8621 		.v.verbs = (const struct hda_verb[]) {
8622 			/* Enables internal speaker */
8623 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8624 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8625 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8626 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8627 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8628 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8629 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8630 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8631 			{}
8632 		}
8633 	},
8634 	[ALC274_FIXUP_DELL_BIND_DACS] = {
8635 		.type = HDA_FIXUP_FUNC,
8636 		.v.func = alc274_fixup_bind_dacs,
8637 		.chained = true,
8638 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8639 	},
8640 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8641 		.type = HDA_FIXUP_PINS,
8642 		.v.pins = (const struct hda_pintbl[]) {
8643 			{ 0x1b, 0x0401102f },
8644 			{ }
8645 		},
8646 		.chained = true,
8647 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
8648 	},
8649 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
8650 		.type = HDA_FIXUP_FUNC,
8651 		.v.func = alc_fixup_tpt470_dock,
8652 		.chained = true,
8653 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8654 	},
8655 	[ALC298_FIXUP_TPT470_DOCK] = {
8656 		.type = HDA_FIXUP_FUNC,
8657 		.v.func = alc_fixup_tpt470_dacs,
8658 		.chained = true,
8659 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8660 	},
8661 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8662 		.type = HDA_FIXUP_PINS,
8663 		.v.pins = (const struct hda_pintbl[]) {
8664 			{ 0x14, 0x0201101f },
8665 			{ }
8666 		},
8667 		.chained = true,
8668 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8669 	},
8670 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
8671 		.type = HDA_FIXUP_PINS,
8672 		.v.pins = (const struct hda_pintbl[]) {
8673 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8674 			{ }
8675 		},
8676 		.chained = true,
8677 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8678 	},
8679 	[ALC295_FIXUP_HP_X360] = {
8680 		.type = HDA_FIXUP_FUNC,
8681 		.v.func = alc295_fixup_hp_top_speakers,
8682 		.chained = true,
8683 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8684 	},
8685 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
8686 		.type = HDA_FIXUP_PINS,
8687 		.v.pins = (const struct hda_pintbl[]) {
8688 			{ 0x19, 0x0181313f},
8689 			{ }
8690 		},
8691 		.chained = true,
8692 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8693 	},
8694 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8695 		.type = HDA_FIXUP_FUNC,
8696 		.v.func = alc285_fixup_invalidate_dacs,
8697 		.chained = true,
8698 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8699 	},
8700 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
8701 		.type = HDA_FIXUP_FUNC,
8702 		.v.func = alc_fixup_auto_mute_via_amp,
8703 	},
8704 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8705 		.type = HDA_FIXUP_PINS,
8706 		.v.pins = (const struct hda_pintbl[]) {
8707 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8708 			{ }
8709 		},
8710 		.chained = true,
8711 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8712 	},
8713 	[ALC294_FIXUP_ASUS_MIC] = {
8714 		.type = HDA_FIXUP_PINS,
8715 		.v.pins = (const struct hda_pintbl[]) {
8716 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8717 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8718 			{ }
8719 		},
8720 		.chained = true,
8721 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8722 	},
8723 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8724 		.type = HDA_FIXUP_PINS,
8725 		.v.pins = (const struct hda_pintbl[]) {
8726 			{ 0x19, 0x01a1103c }, /* use as headset mic */
8727 			{ }
8728 		},
8729 		.chained = true,
8730 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8731 	},
8732 	[ALC294_FIXUP_ASUS_SPK] = {
8733 		.type = HDA_FIXUP_VERBS,
8734 		.v.verbs = (const struct hda_verb[]) {
8735 			/* Set EAPD high */
8736 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8737 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8738 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8739 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8740 			{ }
8741 		},
8742 		.chained = true,
8743 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8744 	},
8745 	[ALC295_FIXUP_CHROME_BOOK] = {
8746 		.type = HDA_FIXUP_FUNC,
8747 		.v.func = alc295_fixup_chromebook,
8748 		.chained = true,
8749 		.chain_id = ALC225_FIXUP_HEADSET_JACK
8750 	},
8751 	[ALC225_FIXUP_HEADSET_JACK] = {
8752 		.type = HDA_FIXUP_FUNC,
8753 		.v.func = alc_fixup_headset_jack,
8754 	},
8755 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8756 		.type = HDA_FIXUP_PINS,
8757 		.v.pins = (const struct hda_pintbl[]) {
8758 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8759 			{ }
8760 		},
8761 		.chained = true,
8762 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8763 	},
8764 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8765 		.type = HDA_FIXUP_VERBS,
8766 		.v.verbs = (const struct hda_verb[]) {
8767 			/* Disable PCBEEP-IN passthrough */
8768 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8769 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8770 			{ }
8771 		},
8772 		.chained = true,
8773 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8774 	},
8775 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
8776 		.type = HDA_FIXUP_PINS,
8777 		.v.pins = (const struct hda_pintbl[]) {
8778 			{ 0x19, 0x03a11130 },
8779 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
8780 			{ }
8781 		},
8782 		.chained = true,
8783 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8784 	},
8785 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8786 		.type = HDA_FIXUP_PINS,
8787 		.v.pins = (const struct hda_pintbl[]) {
8788 			{ 0x16, 0x01011020 }, /* Rear Line out */
8789 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8790 			{ }
8791 		},
8792 		.chained = true,
8793 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8794 	},
8795 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8796 		.type = HDA_FIXUP_FUNC,
8797 		.v.func = alc_fixup_auto_mute_via_amp,
8798 		.chained = true,
8799 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8800 	},
8801 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8802 		.type = HDA_FIXUP_FUNC,
8803 		.v.func = alc_fixup_disable_mic_vref,
8804 		.chained = true,
8805 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8806 	},
8807 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8808 		.type = HDA_FIXUP_VERBS,
8809 		.v.verbs = (const struct hda_verb[]) {
8810 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8811 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8812 			{ }
8813 		},
8814 		.chained = true,
8815 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8816 	},
8817 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8818 		.type = HDA_FIXUP_PINS,
8819 		.v.pins = (const struct hda_pintbl[]) {
8820 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
8821 			{ }
8822 		},
8823 		.chained = true,
8824 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8825 	},
8826 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8827 		.type = HDA_FIXUP_PINS,
8828 		.v.pins = (const struct hda_pintbl[]) {
8829 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8830 			{ }
8831 		},
8832 		.chained = true,
8833 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8834 	},
8835 	[ALC255_FIXUP_PREDATOR_SUBWOOFER] = {
8836 		.type = HDA_FIXUP_PINS,
8837 		.v.pins = (const struct hda_pintbl[]) {
8838 			{ 0x17, 0x90170151 }, /* use as internal speaker (LFE) */
8839 			{ 0x1b, 0x90170152 } /* use as internal speaker (back) */
8840 		}
8841 	},
8842 	[ALC299_FIXUP_PREDATOR_SPK] = {
8843 		.type = HDA_FIXUP_PINS,
8844 		.v.pins = (const struct hda_pintbl[]) {
8845 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8846 			{ }
8847 		}
8848 	},
8849 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8850 		.type = HDA_FIXUP_PINS,
8851 		.v.pins = (const struct hda_pintbl[]) {
8852 			{ 0x19, 0x04a11040 },
8853 			{ 0x21, 0x04211020 },
8854 			{ }
8855 		},
8856 		.chained = true,
8857 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8858 	},
8859 	[ALC289_FIXUP_DELL_SPK1] = {
8860 		.type = HDA_FIXUP_PINS,
8861 		.v.pins = (const struct hda_pintbl[]) {
8862 			{ 0x14, 0x90170140 },
8863 			{ }
8864 		},
8865 		.chained = true,
8866 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8867 	},
8868 	[ALC289_FIXUP_DELL_SPK2] = {
8869 		.type = HDA_FIXUP_PINS,
8870 		.v.pins = (const struct hda_pintbl[]) {
8871 			{ 0x17, 0x90170130 }, /* bass spk */
8872 			{ }
8873 		},
8874 		.chained = true,
8875 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8876 	},
8877 	[ALC289_FIXUP_DUAL_SPK] = {
8878 		.type = HDA_FIXUP_FUNC,
8879 		.v.func = alc285_fixup_speaker2_to_dac1,
8880 		.chained = true,
8881 		.chain_id = ALC289_FIXUP_DELL_SPK2
8882 	},
8883 	[ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
8884 		.type = HDA_FIXUP_FUNC,
8885 		.v.func = alc285_fixup_speaker2_to_dac1,
8886 		.chained = true,
8887 		.chain_id = ALC289_FIXUP_DELL_SPK1
8888 	},
8889 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
8890 		.type = HDA_FIXUP_FUNC,
8891 		.v.func = alc285_fixup_speaker2_to_dac1,
8892 		.chained = true,
8893 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8894 	},
8895 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
8896 		.type = HDA_FIXUP_FUNC,
8897 		/* The GPIO must be pulled to initialize the AMP */
8898 		.v.func = alc_fixup_gpio4,
8899 		.chained = true,
8900 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8901 	},
8902 	[ALC294_FIXUP_ASUS_ALLY] = {
8903 		.type = HDA_FIXUP_FUNC,
8904 		.v.func = cs35l41_fixup_i2c_two,
8905 		.chained = true,
8906 		.chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
8907 	},
8908 	[ALC294_FIXUP_ASUS_ALLY_PINS] = {
8909 		.type = HDA_FIXUP_PINS,
8910 		.v.pins = (const struct hda_pintbl[]) {
8911 			{ 0x19, 0x03a11050 },
8912 			{ 0x1a, 0x03a11c30 },
8913 			{ 0x21, 0x03211420 },
8914 			{ }
8915 		},
8916 		.chained = true,
8917 		.chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
8918 	},
8919 	[ALC294_FIXUP_ASUS_ALLY_VERBS] = {
8920 		.type = HDA_FIXUP_VERBS,
8921 		.v.verbs = (const struct hda_verb[]) {
8922 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8923 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8924 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
8925 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
8926 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
8927 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
8928 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
8929 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
8930 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
8931 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
8932 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
8933 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
8934 			{ }
8935 		},
8936 		.chained = true,
8937 		.chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
8938 	},
8939 	[ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
8940 		.type = HDA_FIXUP_FUNC,
8941 		.v.func = alc285_fixup_speaker2_to_dac1,
8942 	},
8943 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8944 		.type = HDA_FIXUP_FUNC,
8945 		.v.func = alc285_fixup_thinkpad_x1_gen7,
8946 		.chained = true,
8947 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8948 	},
8949 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8950 		.type = HDA_FIXUP_FUNC,
8951 		.v.func = alc_fixup_headset_jack,
8952 		.chained = true,
8953 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8954 	},
8955 	[ALC294_FIXUP_ASUS_HPE] = {
8956 		.type = HDA_FIXUP_VERBS,
8957 		.v.verbs = (const struct hda_verb[]) {
8958 			/* Set EAPD high */
8959 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8960 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8961 			{ }
8962 		},
8963 		.chained = true,
8964 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8965 	},
8966 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
8967 		.type = HDA_FIXUP_PINS,
8968 		.v.pins = (const struct hda_pintbl[]) {
8969 			{ 0x19, 0x03a11050 }, /* front HP mic */
8970 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8971 			{ 0x21, 0x03211020 }, /* front HP out */
8972 			{ }
8973 		},
8974 		.chained = true,
8975 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8976 	},
8977 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
8978 		.type = HDA_FIXUP_VERBS,
8979 		.v.verbs = (const struct hda_verb[]) {
8980 			/* set 0x15 to HP-OUT ctrl */
8981 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8982 			/* unmute the 0x15 amp */
8983 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8984 			{ }
8985 		},
8986 		.chained = true,
8987 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
8988 	},
8989 	[ALC294_FIXUP_ASUS_GX502_HP] = {
8990 		.type = HDA_FIXUP_FUNC,
8991 		.v.func = alc294_fixup_gx502_hp,
8992 	},
8993 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
8994 		.type = HDA_FIXUP_PINS,
8995 		.v.pins = (const struct hda_pintbl[]) {
8996 			{ 0x19, 0x01a11050 }, /* rear HP mic */
8997 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8998 			{ 0x21, 0x012110f0 }, /* rear HP out */
8999 			{ }
9000 		},
9001 		.chained = true,
9002 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
9003 	},
9004 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
9005 		.type = HDA_FIXUP_VERBS,
9006 		.v.verbs = (const struct hda_verb[]) {
9007 			/* set 0x15 to HP-OUT ctrl */
9008 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9009 			/* unmute the 0x15 amp */
9010 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
9011 			/* set 0x1b to HP-OUT */
9012 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9013 			{ }
9014 		},
9015 		.chained = true,
9016 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
9017 	},
9018 	[ALC294_FIXUP_ASUS_GU502_HP] = {
9019 		.type = HDA_FIXUP_FUNC,
9020 		.v.func = alc294_fixup_gu502_hp,
9021 	},
9022 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
9023 		.type = HDA_FIXUP_PINS,
9024 		.v.pins = (const struct hda_pintbl[]) {
9025 				{ 0x19, 0x03a11050 }, /* front HP mic */
9026 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
9027 				{ 0x21, 0x03211420 }, /* front HP out */
9028 				{ }
9029 		},
9030 	},
9031 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
9032 		.type = HDA_FIXUP_PINS,
9033 		.v.pins = (const struct hda_pintbl[]) {
9034 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
9035 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
9036 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
9037 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
9038 			{ 0x21, 0x03211420 },
9039 			{ }
9040 		},
9041 	},
9042 	[ALC294_FIXUP_ASUS_COEF_1B] = {
9043 		.type = HDA_FIXUP_VERBS,
9044 		.v.verbs = (const struct hda_verb[]) {
9045 			/* Set bit 10 to correct noisy output after reboot from
9046 			 * Windows 10 (due to pop noise reduction?)
9047 			 */
9048 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
9049 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
9050 			{ }
9051 		},
9052 		.chained = true,
9053 		.chain_id = ALC289_FIXUP_ASUS_GA401,
9054 	},
9055 	[ALC285_FIXUP_HP_GPIO_LED] = {
9056 		.type = HDA_FIXUP_FUNC,
9057 		.v.func = alc285_fixup_hp_gpio_led,
9058 	},
9059 	[ALC285_FIXUP_HP_MUTE_LED] = {
9060 		.type = HDA_FIXUP_FUNC,
9061 		.v.func = alc285_fixup_hp_mute_led,
9062 	},
9063 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
9064 		.type = HDA_FIXUP_FUNC,
9065 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
9066 	},
9067 	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
9068 	    .type = HDA_FIXUP_FUNC,
9069 	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
9070 	},
9071 	[ALC236_FIXUP_HP_GPIO_LED] = {
9072 		.type = HDA_FIXUP_FUNC,
9073 		.v.func = alc236_fixup_hp_gpio_led,
9074 	},
9075 	[ALC236_FIXUP_HP_MUTE_LED] = {
9076 		.type = HDA_FIXUP_FUNC,
9077 		.v.func = alc236_fixup_hp_mute_led,
9078 	},
9079 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
9080 		.type = HDA_FIXUP_FUNC,
9081 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
9082 	},
9083 	[ALC236_FIXUP_LENOVO_INV_DMIC] = {
9084 		.type = HDA_FIXUP_FUNC,
9085 		.v.func = alc_fixup_inv_dmic,
9086 		.chained = true,
9087 		.chain_id = ALC283_FIXUP_INT_MIC,
9088 	},
9089 	[ALC295_FIXUP_HP_MUTE_LED_COEFBIT11] = {
9090 		.type = HDA_FIXUP_FUNC,
9091 		.v.func = alc295_fixup_hp_mute_led_coefbit11,
9092 	},
9093 	[ALC298_FIXUP_SAMSUNG_AMP] = {
9094 		.type = HDA_FIXUP_FUNC,
9095 		.v.func = alc298_fixup_samsung_amp,
9096 		.chained = true,
9097 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
9098 	},
9099 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9100 		.type = HDA_FIXUP_VERBS,
9101 		.v.verbs = (const struct hda_verb[]) {
9102 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
9103 			{ }
9104 		},
9105 	},
9106 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9107 		.type = HDA_FIXUP_VERBS,
9108 		.v.verbs = (const struct hda_verb[]) {
9109 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
9110 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
9111 			{ }
9112 		},
9113 	},
9114 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9115 		.type = HDA_FIXUP_PINS,
9116 		.v.pins = (const struct hda_pintbl[]) {
9117 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9118 			{ }
9119 		},
9120 		.chained = true,
9121 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9122 	},
9123 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
9124 		.type = HDA_FIXUP_PINS,
9125 		.v.pins = (const struct hda_pintbl[]) {
9126 			{ 0x14, 0x90100120 }, /* use as internal speaker */
9127 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
9128 			{ 0x1a, 0x01011020 }, /* use as line out */
9129 			{ },
9130 		},
9131 		.chained = true,
9132 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9133 	},
9134 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9135 		.type = HDA_FIXUP_PINS,
9136 		.v.pins = (const struct hda_pintbl[]) {
9137 			{ 0x18, 0x02a11030 }, /* use as headset mic */
9138 			{ }
9139 		},
9140 		.chained = true,
9141 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9142 	},
9143 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9144 		.type = HDA_FIXUP_PINS,
9145 		.v.pins = (const struct hda_pintbl[]) {
9146 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9147 			{ }
9148 		},
9149 		.chained = true,
9150 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9151 	},
9152 	[ALC289_FIXUP_ASUS_GA401] = {
9153 		.type = HDA_FIXUP_FUNC,
9154 		.v.func = alc289_fixup_asus_ga401,
9155 		.chained = true,
9156 		.chain_id = ALC289_FIXUP_ASUS_GA502,
9157 	},
9158 	[ALC289_FIXUP_ASUS_GA502] = {
9159 		.type = HDA_FIXUP_PINS,
9160 		.v.pins = (const struct hda_pintbl[]) {
9161 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9162 			{ }
9163 		},
9164 	},
9165 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9166 		.type = HDA_FIXUP_PINS,
9167 		.v.pins = (const struct hda_pintbl[]) {
9168 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9169 			{ }
9170 		},
9171 		.chained = true,
9172 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9173 	},
9174 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9175 		.type = HDA_FIXUP_FUNC,
9176 		.v.func = alc285_fixup_hp_gpio_amp_init,
9177 		.chained = true,
9178 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
9179 	},
9180 	[ALC269_FIXUP_CZC_B20] = {
9181 		.type = HDA_FIXUP_PINS,
9182 		.v.pins = (const struct hda_pintbl[]) {
9183 			{ 0x12, 0x411111f0 },
9184 			{ 0x14, 0x90170110 }, /* speaker */
9185 			{ 0x15, 0x032f1020 }, /* HP out */
9186 			{ 0x17, 0x411111f0 },
9187 			{ 0x18, 0x03ab1040 }, /* mic */
9188 			{ 0x19, 0xb7a7013f },
9189 			{ 0x1a, 0x0181305f },
9190 			{ 0x1b, 0x411111f0 },
9191 			{ 0x1d, 0x411111f0 },
9192 			{ 0x1e, 0x411111f0 },
9193 			{ }
9194 		},
9195 		.chain_id = ALC269_FIXUP_DMIC,
9196 	},
9197 	[ALC269_FIXUP_CZC_TMI] = {
9198 		.type = HDA_FIXUP_PINS,
9199 		.v.pins = (const struct hda_pintbl[]) {
9200 			{ 0x12, 0x4000c000 },
9201 			{ 0x14, 0x90170110 }, /* speaker */
9202 			{ 0x15, 0x0421401f }, /* HP out */
9203 			{ 0x17, 0x411111f0 },
9204 			{ 0x18, 0x04a19020 }, /* mic */
9205 			{ 0x19, 0x411111f0 },
9206 			{ 0x1a, 0x411111f0 },
9207 			{ 0x1b, 0x411111f0 },
9208 			{ 0x1d, 0x40448505 },
9209 			{ 0x1e, 0x411111f0 },
9210 			{ 0x20, 0x8000ffff },
9211 			{ }
9212 		},
9213 		.chain_id = ALC269_FIXUP_DMIC,
9214 	},
9215 	[ALC269_FIXUP_CZC_L101] = {
9216 		.type = HDA_FIXUP_PINS,
9217 		.v.pins = (const struct hda_pintbl[]) {
9218 			{ 0x12, 0x40000000 },
9219 			{ 0x14, 0x01014010 }, /* speaker */
9220 			{ 0x15, 0x411111f0 }, /* HP out */
9221 			{ 0x16, 0x411111f0 },
9222 			{ 0x18, 0x01a19020 }, /* mic */
9223 			{ 0x19, 0x02a19021 },
9224 			{ 0x1a, 0x0181302f },
9225 			{ 0x1b, 0x0221401f },
9226 			{ 0x1c, 0x411111f0 },
9227 			{ 0x1d, 0x4044c601 },
9228 			{ 0x1e, 0x411111f0 },
9229 			{ }
9230 		},
9231 		.chain_id = ALC269_FIXUP_DMIC,
9232 	},
9233 	[ALC269_FIXUP_LEMOTE_A1802] = {
9234 		.type = HDA_FIXUP_PINS,
9235 		.v.pins = (const struct hda_pintbl[]) {
9236 			{ 0x12, 0x40000000 },
9237 			{ 0x14, 0x90170110 }, /* speaker */
9238 			{ 0x17, 0x411111f0 },
9239 			{ 0x18, 0x03a19040 }, /* mic1 */
9240 			{ 0x19, 0x90a70130 }, /* mic2 */
9241 			{ 0x1a, 0x411111f0 },
9242 			{ 0x1b, 0x411111f0 },
9243 			{ 0x1d, 0x40489d2d },
9244 			{ 0x1e, 0x411111f0 },
9245 			{ 0x20, 0x0003ffff },
9246 			{ 0x21, 0x03214020 },
9247 			{ }
9248 		},
9249 		.chain_id = ALC269_FIXUP_DMIC,
9250 	},
9251 	[ALC269_FIXUP_LEMOTE_A190X] = {
9252 		.type = HDA_FIXUP_PINS,
9253 		.v.pins = (const struct hda_pintbl[]) {
9254 			{ 0x14, 0x99130110 }, /* speaker */
9255 			{ 0x15, 0x0121401f }, /* HP out */
9256 			{ 0x18, 0x01a19c20 }, /* rear  mic */
9257 			{ 0x19, 0x99a3092f }, /* front mic */
9258 			{ 0x1b, 0x0201401f }, /* front lineout */
9259 			{ }
9260 		},
9261 		.chain_id = ALC269_FIXUP_DMIC,
9262 	},
9263 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9264 		.type = HDA_FIXUP_PINS,
9265 		.v.pins = (const struct hda_pintbl[]) {
9266 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9267 			{ }
9268 		},
9269 		.chained = true,
9270 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9271 	},
9272 	[ALC256_FIXUP_INTEL_NUC10] = {
9273 		.type = HDA_FIXUP_PINS,
9274 		.v.pins = (const struct hda_pintbl[]) {
9275 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9276 			{ }
9277 		},
9278 		.chained = true,
9279 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9280 	},
9281 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9282 		.type = HDA_FIXUP_VERBS,
9283 		.v.verbs = (const struct hda_verb[]) {
9284 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9285 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9286 			{ }
9287 		},
9288 		.chained = true,
9289 		.chain_id = ALC289_FIXUP_ASUS_GA502
9290 	},
9291 	[ALC274_FIXUP_HP_MIC] = {
9292 		.type = HDA_FIXUP_VERBS,
9293 		.v.verbs = (const struct hda_verb[]) {
9294 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9295 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9296 			{ }
9297 		},
9298 	},
9299 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
9300 		.type = HDA_FIXUP_FUNC,
9301 		.v.func = alc274_fixup_hp_headset_mic,
9302 		.chained = true,
9303 		.chain_id = ALC274_FIXUP_HP_MIC
9304 	},
9305 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
9306 		.type = HDA_FIXUP_FUNC,
9307 		.v.func = alc274_fixup_hp_envy_gpio,
9308 	},
9309 	[ALC256_FIXUP_ASUS_HPE] = {
9310 		.type = HDA_FIXUP_VERBS,
9311 		.v.verbs = (const struct hda_verb[]) {
9312 			/* Set EAPD high */
9313 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9314 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9315 			{ }
9316 		},
9317 		.chained = true,
9318 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9319 	},
9320 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9321 		.type = HDA_FIXUP_FUNC,
9322 		.v.func = alc_fixup_headset_jack,
9323 		.chained = true,
9324 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9325 	},
9326 	[ALC287_FIXUP_HP_GPIO_LED] = {
9327 		.type = HDA_FIXUP_FUNC,
9328 		.v.func = alc287_fixup_hp_gpio_led,
9329 	},
9330 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
9331 		.type = HDA_FIXUP_FUNC,
9332 		.v.func = alc274_fixup_hp_headset_mic,
9333 	},
9334 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9335 		.type = HDA_FIXUP_FUNC,
9336 		.v.func = alc_fixup_no_int_mic,
9337 		.chained = true,
9338 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9339 	},
9340 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9341 		.type = HDA_FIXUP_PINS,
9342 		.v.pins = (const struct hda_pintbl[]) {
9343 			{ 0x1b, 0x411111f0 },
9344 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9345 			{ },
9346 		},
9347 		.chained = true,
9348 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9349 	},
9350 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9351 		.type = HDA_FIXUP_FUNC,
9352 		.v.func = alc269_fixup_limit_int_mic_boost,
9353 		.chained = true,
9354 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9355 	},
9356 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
9357 		.type = HDA_FIXUP_PINS,
9358 		.v.pins = (const struct hda_pintbl[]) {
9359 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9360 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
9361 			{ }
9362 		},
9363 		.chained = true,
9364 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9365 	},
9366 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9367 		.type = HDA_FIXUP_FUNC,
9368 		.v.func = alc285_fixup_ideapad_s740_coef,
9369 		.chained = true,
9370 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9371 	},
9372 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9373 		.type = HDA_FIXUP_FUNC,
9374 		.v.func = alc269_fixup_limit_int_mic_boost,
9375 		.chained = true,
9376 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9377 	},
9378 	[ALC295_FIXUP_ASUS_DACS] = {
9379 		.type = HDA_FIXUP_FUNC,
9380 		.v.func = alc295_fixup_asus_dacs,
9381 	},
9382 	[ALC295_FIXUP_HP_OMEN] = {
9383 		.type = HDA_FIXUP_PINS,
9384 		.v.pins = (const struct hda_pintbl[]) {
9385 			{ 0x12, 0xb7a60130 },
9386 			{ 0x13, 0x40000000 },
9387 			{ 0x14, 0x411111f0 },
9388 			{ 0x16, 0x411111f0 },
9389 			{ 0x17, 0x90170110 },
9390 			{ 0x18, 0x411111f0 },
9391 			{ 0x19, 0x02a11030 },
9392 			{ 0x1a, 0x411111f0 },
9393 			{ 0x1b, 0x04a19030 },
9394 			{ 0x1d, 0x40600001 },
9395 			{ 0x1e, 0x411111f0 },
9396 			{ 0x21, 0x03211020 },
9397 			{}
9398 		},
9399 		.chained = true,
9400 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9401 	},
9402 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
9403 		.type = HDA_FIXUP_FUNC,
9404 		.v.func = alc285_fixup_hp_spectre_x360,
9405 	},
9406 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9407 		.type = HDA_FIXUP_FUNC,
9408 		.v.func = alc285_fixup_hp_spectre_x360_eb1
9409 	},
9410 	[ALC285_FIXUP_HP_ENVY_X360] = {
9411 		.type = HDA_FIXUP_FUNC,
9412 		.v.func = alc285_fixup_hp_envy_x360,
9413 		.chained = true,
9414 		.chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9415 	},
9416 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9417 		.type = HDA_FIXUP_FUNC,
9418 		.v.func = alc285_fixup_ideapad_s740_coef,
9419 		.chained = true,
9420 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9421 	},
9422 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9423 		.type = HDA_FIXUP_FUNC,
9424 		.v.func = alc_fixup_no_shutup,
9425 		.chained = true,
9426 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
9427 	},
9428 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9429 		.type = HDA_FIXUP_PINS,
9430 		.v.pins = (const struct hda_pintbl[]) {
9431 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9432 			{ }
9433 		},
9434 		.chained = true,
9435 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9436 	},
9437 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9438 		.type = HDA_FIXUP_FUNC,
9439 		.v.func = alc269_fixup_limit_int_mic_boost,
9440 		.chained = true,
9441 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9442 	},
9443 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9444 		.type = HDA_FIXUP_FUNC,
9445 		.v.func = alc285_fixup_ideapad_s740_coef,
9446 		.chained = true,
9447 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9448 	},
9449 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9450 		.type = HDA_FIXUP_FUNC,
9451 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9452 		.chained = true,
9453 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9454 	},
9455 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9456 		.type = HDA_FIXUP_VERBS,
9457 		//.v.verbs = legion_15imhg05_coefs,
9458 		.v.verbs = (const struct hda_verb[]) {
9459 			 // set left speaker Legion 7i.
9460 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9461 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9462 
9463 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9464 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9465 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9466 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9467 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9468 
9469 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9470 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9471 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9472 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9473 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9474 
9475 			 // set right speaker Legion 7i.
9476 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9477 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9478 
9479 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9480 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9481 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9482 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9483 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9484 
9485 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9486 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9487 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9488 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9489 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9490 			 {}
9491 		},
9492 		.chained = true,
9493 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9494 	},
9495 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9496 		.type = HDA_FIXUP_FUNC,
9497 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9498 		.chained = true,
9499 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9500 	},
9501 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9502 		.type = HDA_FIXUP_VERBS,
9503 		.v.verbs = (const struct hda_verb[]) {
9504 			 // set left speaker Yoga 7i.
9505 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9506 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9507 
9508 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9509 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9510 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9511 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9512 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9513 
9514 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9515 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9516 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9517 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9518 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9519 
9520 			 // set right speaker Yoga 7i.
9521 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9522 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9523 
9524 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9525 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9526 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9527 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9528 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9529 
9530 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9531 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9532 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9533 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9534 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9535 			 {}
9536 		},
9537 		.chained = true,
9538 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9539 	},
9540 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
9541 		.type = HDA_FIXUP_FUNC,
9542 		.v.func = alc298_fixup_lenovo_c940_duet7,
9543 	},
9544 	[ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
9545 		.type = HDA_FIXUP_FUNC,
9546 		.v.func = alc287_fixup_lenovo_14irp8_duetitl,
9547 	},
9548 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9549 		.type = HDA_FIXUP_VERBS,
9550 		.v.verbs = (const struct hda_verb[]) {
9551 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9552 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9553 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9554 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9555 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9556 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9557 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9558 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9559 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9560 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9561 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9562 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9563 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9564 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9565 			{}
9566 		},
9567 		.chained = true,
9568 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9569 	},
9570 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9571 		.type = HDA_FIXUP_FUNC,
9572 		.v.func = alc256_fixup_set_coef_defaults,
9573 	},
9574 	[ALC245_FIXUP_HP_GPIO_LED] = {
9575 		.type = HDA_FIXUP_FUNC,
9576 		.v.func = alc245_fixup_hp_gpio_led,
9577 	},
9578 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9579 		.type = HDA_FIXUP_PINS,
9580 		.v.pins = (const struct hda_pintbl[]) {
9581 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9582 			{ }
9583 		},
9584 		.chained = true,
9585 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9586 	},
9587 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
9588 		.type = HDA_FIXUP_FUNC,
9589 		.v.func = alc233_fixup_no_audio_jack,
9590 	},
9591 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9592 		.type = HDA_FIXUP_FUNC,
9593 		.v.func = alc256_fixup_mic_no_presence_and_resume,
9594 		.chained = true,
9595 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9596 	},
9597 	[ALC287_FIXUP_LEGION_16ACHG6] = {
9598 		.type = HDA_FIXUP_FUNC,
9599 		.v.func = alc287_fixup_legion_16achg6_speakers,
9600 	},
9601 	[ALC287_FIXUP_CS35L41_I2C_2] = {
9602 		.type = HDA_FIXUP_FUNC,
9603 		.v.func = cs35l41_fixup_i2c_two,
9604 	},
9605 	[ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9606 		.type = HDA_FIXUP_FUNC,
9607 		.v.func = cs35l41_fixup_i2c_two,
9608 		.chained = true,
9609 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9610 	},
9611 	[ALC245_FIXUP_CS35L41_SPI_2] = {
9612 		.type = HDA_FIXUP_FUNC,
9613 		.v.func = cs35l41_fixup_spi_two,
9614 	},
9615 	[ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9616 		.type = HDA_FIXUP_FUNC,
9617 		.v.func = cs35l41_fixup_spi_two,
9618 		.chained = true,
9619 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9620 	},
9621 	[ALC245_FIXUP_CS35L41_SPI_4] = {
9622 		.type = HDA_FIXUP_FUNC,
9623 		.v.func = cs35l41_fixup_spi_four,
9624 	},
9625 	[ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9626 		.type = HDA_FIXUP_FUNC,
9627 		.v.func = cs35l41_fixup_spi_four,
9628 		.chained = true,
9629 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9630 	},
9631 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9632 		.type = HDA_FIXUP_VERBS,
9633 		.v.verbs = (const struct hda_verb[]) {
9634 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9635 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9636 			 { }
9637 		},
9638 		.chained = true,
9639 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9640 	},
9641 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9642 		.type = HDA_FIXUP_FUNC,
9643 		.v.func = alc_fixup_dell4_mic_no_presence_quiet,
9644 		.chained = true,
9645 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9646 	},
9647 	[ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9648 		.type = HDA_FIXUP_PINS,
9649 		.v.pins = (const struct hda_pintbl[]) {
9650 			{ 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9651 			{ }
9652 		},
9653 		.chained = true,
9654 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9655 	},
9656 	[ALC287_FIXUP_LEGION_16ITHG6] = {
9657 		.type = HDA_FIXUP_FUNC,
9658 		.v.func = alc287_fixup_legion_16ithg6_speakers,
9659 	},
9660 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9661 		.type = HDA_FIXUP_VERBS,
9662 		.v.verbs = (const struct hda_verb[]) {
9663 			// enable left speaker
9664 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9665 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9666 
9667 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9668 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9669 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9670 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9671 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9672 
9673 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9674 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9675 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9676 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9677 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9678 
9679 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9680 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9681 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9682 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9683 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9684 
9685 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9686 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9687 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9688 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9689 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9690 
9691 			// enable right speaker
9692 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9693 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9694 
9695 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9696 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9697 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9698 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9699 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9700 
9701 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9702 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9703 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9704 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9705 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9706 
9707 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9708 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9709 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9710 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9711 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9712 
9713 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9714 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9715 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9716 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9717 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9718 
9719 			{ },
9720 		},
9721 	},
9722 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9723 		.type = HDA_FIXUP_FUNC,
9724 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9725 		.chained = true,
9726 		.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9727 	},
9728 	[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
9729 		.type = HDA_FIXUP_FUNC,
9730 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9731 		.chained = true,
9732 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2,
9733 	},
9734 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
9735 		.type = HDA_FIXUP_FUNC,
9736 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
9737 		.chained = true,
9738 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9739 	},
9740 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
9741 		.type = HDA_FIXUP_PINS,
9742 		.v.func = alc1220_fixup_gb_dual_codecs,
9743 		.chained = true,
9744 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9745 	},
9746 	[ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
9747 		.type = HDA_FIXUP_FUNC,
9748 		.v.func = cs35l41_fixup_i2c_two,
9749 		.chained = true,
9750 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9751 	},
9752 	[ALC287_FIXUP_TAS2781_I2C] = {
9753 		.type = HDA_FIXUP_FUNC,
9754 		.v.func = tas2781_fixup_i2c,
9755 		.chained = true,
9756 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9757 	},
9758 	[ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
9759 		.type = HDA_FIXUP_FUNC,
9760 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9761 	},
9762 	[ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
9763 		.type = HDA_FIXUP_FUNC,
9764 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9765 		.chained = true,
9766 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
9767 	},
9768 	[ALC287_FIXUP_THINKPAD_I2S_SPK] = {
9769 		.type = HDA_FIXUP_FUNC,
9770 		.v.func = alc287_fixup_bind_dacs,
9771 		.chained = true,
9772 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9773 	},
9774 	[ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
9775 		.type = HDA_FIXUP_FUNC,
9776 		.v.func = alc287_fixup_bind_dacs,
9777 		.chained = true,
9778 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
9779 	},
9780 	[ALC2XX_FIXUP_HEADSET_MIC] = {
9781 		.type = HDA_FIXUP_FUNC,
9782 		.v.func = alc_fixup_headset_mic,
9783 	},
9784 	[ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
9785 		.type = HDA_FIXUP_FUNC,
9786 		.v.func = cs35l41_fixup_spi_two,
9787 		.chained = true,
9788 		.chain_id = ALC289_FIXUP_DUAL_SPK
9789 	},
9790 	[ALC294_FIXUP_CS35L41_I2C_2] = {
9791 		.type = HDA_FIXUP_FUNC,
9792 		.v.func = cs35l41_fixup_i2c_two,
9793 	},
9794 };
9795 
9796 static const struct hda_quirk alc269_fixup_tbl[] = {
9797 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
9798 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9799 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
9800 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
9801 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9802 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9803 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
9804 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9805 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9806 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
9807 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9808 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
9809 	SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9810 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
9811 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
9812 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
9813 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
9814 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9815 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9816 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9817 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9818 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
9819 	SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9820 	SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9821 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
9822 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
9823 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
9824 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9825 	SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9826 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9827 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9828 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9829 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
9830 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9831 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9832 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9833 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
9834 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
9835 	SND_PCI_QUIRK(0x1025, 0x1360, "Acer Aspire A115", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9836 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9837 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9838 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9839 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
9840 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9841 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
9842 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
9843 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
9844 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
9845 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
9846 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9847 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
9848 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
9849 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9850 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9851 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9852 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9853 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9854 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
9855 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
9856 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
9857 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9858 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9859 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
9860 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9861 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
9862 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9863 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9864 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9865 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9866 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9867 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9868 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9869 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9870 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9871 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
9872 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
9873 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
9874 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
9875 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9876 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
9877 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
9878 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9879 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9880 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9881 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9882 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9883 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
9884 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
9885 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9886 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9887 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9888 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9889 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9890 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9891 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9892 	SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
9893 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
9894 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
9895 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
9896 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9897 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9898 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9899 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
9900 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9901 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9902 	SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9903 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9904 	SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9905 	SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9906 	SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9907 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9908 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9909 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9910 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9911 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9912 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9913 	SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9914 	SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9915 	SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9916 	SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9917 	SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9918 	SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9919 	SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9920 	SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9921 	SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9922 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9923 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9924 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9925 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
9926 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
9927 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9928 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9929 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9930 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9931 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9932 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9933 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9934 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9935 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9936 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9937 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9938 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9939 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9940 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9941 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9942 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9943 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9944 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9945 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
9946 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
9947 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9948 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9949 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9950 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9951 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9952 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9953 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9954 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9955 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9956 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9957 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9958 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9959 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9960 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9961 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9962 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9963 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9964 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9965 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9966 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9967 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9968 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9969 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9970 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9971 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9972 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9973 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9974 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9975 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9976 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9977 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9978 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9979 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9980 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9981 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
9982 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9983 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9984 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9985 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9986 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
9987 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9988 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
9989 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9990 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9991 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9992 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9993 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9994 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9995 	SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9996 	SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9997 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
9998 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9999 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
10000 	SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10001 	SND_PCI_QUIRK(0x103c, 0x85c6, "HP Pavilion x360 Convertible 14-dy1xxx", ALC295_FIXUP_HP_MUTE_LED_COEFBIT11),
10002 	SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
10003 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10004 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10005 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10006 	SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10007 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
10008 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10009 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10010 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
10011 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10012 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10013 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
10014 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
10015 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
10016 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10017 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10018 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10019 	SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
10020 	SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10021 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
10022 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10023 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
10024 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10025 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
10026 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10027 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10028 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10029 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10030 	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10031 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
10032 	SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10033 	SND_PCI_QUIRK(0x103c, 0x87df, "HP ProBook 430 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10034 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10035 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10036 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10037 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10038 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
10039 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
10040 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10041 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10042 	SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10043 	SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10044 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10045 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10046 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10047 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10048 	SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10049 	SND_PCI_QUIRK(0x103c, 0x881e, "HP Laptop 15s-du3xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10050 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10051 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10052 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10053 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10054 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10055 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10056 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10057 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10058 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10059 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10060 	SND_PCI_QUIRK(0x103c, 0x887c, "HP Laptop 14s-fq1xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10061 	SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10062 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
10063 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
10064 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
10065 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10066 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
10067 	SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
10068 	SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
10069 	SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10070 	SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
10071 	SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10072 	SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10073 	SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10074 	SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10075 	SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10076 	SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10077 	SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10078 	SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
10079 	SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
10080 	SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10081 	SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10082 	SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10083 	SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
10084 	SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10085 	SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
10086 	SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
10087 	SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
10088 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
10089 	SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
10090 	SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
10091 	SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10092 	SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10093 	SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10094 	SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10095 	SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10096 	SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
10097 	SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10098 	SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10099 	SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10100 	SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
10101 	SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
10102 	SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
10103 	SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
10104 	SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
10105 	SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10106 	SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10107 	SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10108 	SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10109 	SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10110 	SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
10111 	SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10112 	SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10113 	SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10114 	SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10115 	SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10116 	SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10117 	SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10118 	SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10119 	SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10120 	SND_PCI_QUIRK(0x103c, 0x8b5f, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10121 	SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10122 	SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10123 	SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10124 	SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10125 	SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10126 	SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10127 	SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
10128 	SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10129 	SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10130 	SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
10131 	SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10132 	SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
10133 	SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10134 	SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10135 	SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10136 	SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10137 	SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10138 	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10139 	SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10140 	SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10141 	SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10142 	SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10143 	SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10144 	SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10145 	SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10146 	SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10147 	SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10148 	SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10149 	SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10150 	SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10151 	SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10152 	SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10153 	SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10154 	SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10155 	SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10156 	SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10157 	SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10158 	SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10159 	SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10160 	SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10161 	SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10162 	SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10163 	SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10164 	SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10165 	SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10166 	SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10167 	SND_PCI_QUIRK(0x103c, 0x8d01, "HP ZBook Power 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10168 	SND_PCI_QUIRK(0x103c, 0x8d84, "HP EliteBook X G1i", ALC285_FIXUP_HP_GPIO_LED),
10169 	SND_PCI_QUIRK(0x103c, 0x8d91, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10170 	SND_PCI_QUIRK(0x103c, 0x8d92, "HP ZBook Firefly 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10171 	SND_PCI_QUIRK(0x103c, 0x8e18, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10172 	SND_PCI_QUIRK(0x103c, 0x8e19, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10173 	SND_PCI_QUIRK(0x103c, 0x8e1a, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10174 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10175 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10176 	SND_PCI_QUIRK(0x1043, 0x1054, "ASUS G614FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2),
10177 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10178 	SND_PCI_QUIRK(0x1043, 0x1074, "ASUS G614PH/PM/PP", ALC287_FIXUP_CS35L41_I2C_2),
10179 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10180 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10181 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10182 	SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10183 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10184 	SND_PCI_QUIRK(0x1043, 0x1194, "ASUS UM3406KA", ALC287_FIXUP_CS35L41_I2C_2),
10185 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10186 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10187 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10188 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10189 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10190 	SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10191 	SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10192 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10193 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10194 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10195 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10196 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10197 	SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVV", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10198 	SND_PCI_QUIRK(0x1043, 0x1460, "Asus VivoBook 15", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10199 	SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X/GA402N", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10200 	SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604VI/VC/VE/VG/VJ/VQ/VU/VV/VY/VZ", ALC285_FIXUP_ASUS_HEADSET_MIC),
10201 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603VQ/VU/VV/VJ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10202 	SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601VV/VU/VJ/VQ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10203 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G614JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10204 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS G513PI/PU/PV", ALC287_FIXUP_CS35L41_I2C_2),
10205 	SND_PCI_QUIRK(0x1043, 0x14f2, "ASUS VivoBook X515JA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10206 	SND_PCI_QUIRK(0x1043, 0x1503, "ASUS G733PY/PZ/PZV/PYV", ALC287_FIXUP_CS35L41_I2C_2),
10207 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10208 	SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA/XJ/XQ/XU/XV/XI", ALC287_FIXUP_CS35L41_I2C_2),
10209 	SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301VV/VQ/VU/VJ/VA/VC/VE/VVC/VQC/VUC/VJC/VEC/VCC", ALC285_FIXUP_ASUS_HEADSET_MIC),
10210 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10211 	SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZI/ZJ/ZQ/ZU/ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10212 	SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10213 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10214 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10215 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10216 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10217 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10218 	SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally NR2301L/X", ALC294_FIXUP_ASUS_ALLY),
10219 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10220 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10221 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10222 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10223 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10224 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10225 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10226 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10227 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10228 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10229 	SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10230 	SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10231 	SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10232 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10233 	SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
10234 	SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10235 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10236 	SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10237 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10238 	SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10239 	SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10240 	SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10241 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10242 	SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JU/JV/JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10243 	SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JY/JZ/JI/JG", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10244 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10245 	SND_PCI_QUIRK(0x1043, 0x1ccf, "ASUS G814JU/JV/JI", ALC245_FIXUP_CS35L41_SPI_2),
10246 	SND_PCI_QUIRK(0x1043, 0x1cdf, "ASUS G814JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10247 	SND_PCI_QUIRK(0x1043, 0x1cef, "ASUS G834JY/JZ/JI/JG", ALC285_FIXUP_ASUS_HEADSET_MIC),
10248 	SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS G713PI/PU/PV/PVN", ALC287_FIXUP_CS35L41_I2C_2),
10249 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10250 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10251 	SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10252 	SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10253 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10254 	SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10255 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10256 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10257 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10258 	SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10259 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10260 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10261 	SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10262 	SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10263 	SND_PCI_QUIRK(0x1043, 0x1f63, "ASUS P5405CSA", ALC245_FIXUP_CS35L41_SPI_2),
10264 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10265 	SND_PCI_QUIRK(0x1043, 0x1fb3, "ASUS ROG Flow Z13 GZ302EA", ALC287_FIXUP_CS35L41_I2C_2),
10266 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10267 	SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2),
10268 	SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10269 	SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10270 	SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10271 	SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10272 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10273 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10274 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10275 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10276 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10277 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10278 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10279 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10280 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10281 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10282 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10283 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10284 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10285 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10286 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10287 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10288 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10289 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10290 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10291 	SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10292 	SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10293 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10294 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10295 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10296 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10297 	SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10298 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10299 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10300 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10301 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10302 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10303 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10304 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10305 	SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10306 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10307 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10308 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10309 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10310 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10311 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10312 	SND_PCI_QUIRK(0x144d, 0xca06, "Samsung Galaxy Book3 360 (NP730QFG)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10313 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10314 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10315 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10316 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10317 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10318 	SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10319 	SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10320 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10321 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10322 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10323 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10324 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10325 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10326 	SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10327 	SND_PCI_QUIRK(0x1558, 0x28c1, "Clevo V370VND", ALC2XX_FIXUP_HEADSET_MIC),
10328 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10329 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10330 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10331 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10332 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10333 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10334 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10335 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10336 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10337 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10338 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10339 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10340 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10341 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10342 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10343 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10344 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10345 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10346 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10347 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10348 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10349 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10350 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10351 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10352 	SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10353 	SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10354 	SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10355 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10356 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10357 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10358 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10359 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10360 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10361 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10362 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10363 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10364 	SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10365 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10366 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10367 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10368 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10369 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10370 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10371 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10372 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10373 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10374 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10375 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10376 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10377 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10378 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10379 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10380 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
10381 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10382 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10383 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10384 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10385 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10386 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10387 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10388 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10389 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10390 	SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10391 	SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10392 	SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10393 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10394 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10395 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10396 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10397 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10398 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10399 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
10400 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10401 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
10402 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
10403 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
10404 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
10405 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
10406 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
10407 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
10408 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
10409 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
10410 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
10411 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
10412 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
10413 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
10414 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
10415 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
10416 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10417 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10418 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10419 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
10420 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
10421 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10422 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10423 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10424 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
10425 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
10426 	SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
10427 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
10428 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10429 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10430 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
10431 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10432 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10433 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10434 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10435 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10436 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10437 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10438 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10439 	SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10440 	SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10441 	SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10442 	SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10443 	SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10444 	SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10445 	SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10446 	SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10447 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10448 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10449 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10450 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10451 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10452 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10453 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10454 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10455 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10456 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10457 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10458 	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
10459 	SND_PCI_QUIRK(0x17aa, 0x3384, "ThinkCentre M90a PRO", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
10460 	SND_PCI_QUIRK(0x17aa, 0x3386, "ThinkCentre M90a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
10461 	SND_PCI_QUIRK(0x17aa, 0x3387, "ThinkCentre M70a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
10462 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10463 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
10464 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10465 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
10466 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10467 	SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10468 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10469 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
10470 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10471 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10472 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
10473 	SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
10474 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10475 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10476 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10477 	SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
10478 	SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10479 	SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10480 	SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10481 	SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
10482 	SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
10483 	SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
10484 	SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10485 	SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10486 	SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10487 	SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10488 	SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
10489 	SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
10490 	SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
10491 	SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
10492 	SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
10493 	SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
10494 	SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
10495 	SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10496 	SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10497 	SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10498 	SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10499 	SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10500 	SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10501 	SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10502 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10503 	SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
10504 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
10505 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10506 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
10507 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10508 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
10509 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
10510 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10511 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
10512 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
10513 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
10514 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
10515 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
10516 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
10517 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
10518 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
10519 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10520 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10521 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10522 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10523 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10524 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10525 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10526 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
10527 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10528 	SND_PCI_QUIRK(0x1849, 0x0269, "Positivo Master C6400", ALC269VB_FIXUP_ASUS_ZENBOOK),
10529 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
10530 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
10531 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
10532 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10533 	SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
10534 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
10535 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
10536 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
10537 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
10538 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
10539 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
10540 	SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10541 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
10542 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
10543 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
10544 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
10545 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10546 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10547 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10548 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10549 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10550 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
10551 	SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10552 	SND_PCI_QUIRK(0x1d05, 0x1409, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10553 	SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10554 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10555 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
10556 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
10557 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
10558 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10559 	SND_PCI_QUIRK(0x1f66, 0x0105, "Ayaneo Portable Game Player", ALC287_FIXUP_CS35L41_I2C_2),
10560 	SND_PCI_QUIRK(0x2014, 0x800a, "Positivo ARN50", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10561 	SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10562 	SND_PCI_QUIRK(0x2782, 0x0228, "Infinix ZERO BOOK 13", ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13),
10563 	SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
10564 	SND_PCI_QUIRK(0x2782, 0x1701, "Infinix Y4 Max", ALC269VC_FIXUP_INFINIX_Y4_MAX),
10565 	SND_PCI_QUIRK(0x2782, 0x1705, "MEDION E15433", ALC269VC_FIXUP_INFINIX_Y4_MAX),
10566 	SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
10567 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
10568 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
10569 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
10570 	SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
10571 	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10572 	SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10573 	SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10574 	SND_PCI_QUIRK(0xf111, 0x000c, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10575 
10576 #if 0
10577 	/* Below is a quirk table taken from the old code.
10578 	 * Basically the device should work as is without the fixup table.
10579 	 * If BIOS doesn't give a proper info, enable the corresponding
10580 	 * fixup entry.
10581 	 */
10582 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
10583 		      ALC269_FIXUP_AMIC),
10584 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
10585 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
10586 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
10587 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
10588 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
10589 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
10590 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
10591 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
10592 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
10593 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
10594 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
10595 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
10596 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
10597 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
10598 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
10599 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
10600 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
10601 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
10602 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
10603 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
10604 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
10605 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
10606 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
10607 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
10608 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
10609 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
10610 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
10611 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
10612 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
10613 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
10614 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
10615 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
10616 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
10617 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
10618 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
10619 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
10620 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
10621 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
10622 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
10623 #endif
10624 	{}
10625 };
10626 
10627 static const struct hda_quirk alc269_fixup_vendor_tbl[] = {
10628 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
10629 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
10630 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
10631 	SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
10632 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
10633 	{}
10634 };
10635 
10636 static const struct hda_model_fixup alc269_fixup_models[] = {
10637 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
10638 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
10639 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
10640 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
10641 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
10642 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
10643 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
10644 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
10645 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
10646 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
10647 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10648 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
10649 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10650 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
10651 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
10652 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
10653 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
10654 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
10655 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
10656 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
10657 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
10658 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
10659 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
10660 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
10661 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10662 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
10663 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
10664 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
10665 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
10666 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
10667 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
10668 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
10669 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
10670 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
10671 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
10672 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
10673 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
10674 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
10675 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
10676 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
10677 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
10678 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
10679 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
10680 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
10681 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
10682 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
10683 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
10684 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
10685 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
10686 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
10687 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
10688 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
10689 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
10690 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
10691 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
10692 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
10693 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
10694 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
10695 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
10696 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
10697 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
10698 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
10699 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
10700 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
10701 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
10702 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
10703 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
10704 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
10705 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
10706 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
10707 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10708 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
10709 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
10710 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
10711 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
10712 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
10713 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
10714 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
10715 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
10716 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
10717 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
10718 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
10719 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
10720 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
10721 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
10722 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
10723 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
10724 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
10725 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
10726 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
10727 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
10728 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
10729 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
10730 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
10731 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
10732 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
10733 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
10734 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
10735 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
10736 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
10737 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
10738 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
10739 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
10740 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
10741 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
10742 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
10743 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
10744 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
10745 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
10746 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
10747 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
10748 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
10749 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
10750 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
10751 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
10752 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
10753 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
10754 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
10755 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
10756 	{.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
10757 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
10758 	{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
10759 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
10760 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
10761 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
10762 	{.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
10763 	{.id = ALC2XX_FIXUP_HEADSET_MIC, .name = "alc2xx-fixup-headset-mic"},
10764 	{}
10765 };
10766 #define ALC225_STANDARD_PINS \
10767 	{0x21, 0x04211020}
10768 
10769 #define ALC256_STANDARD_PINS \
10770 	{0x12, 0x90a60140}, \
10771 	{0x14, 0x90170110}, \
10772 	{0x21, 0x02211020}
10773 
10774 #define ALC282_STANDARD_PINS \
10775 	{0x14, 0x90170110}
10776 
10777 #define ALC290_STANDARD_PINS \
10778 	{0x12, 0x99a30130}
10779 
10780 #define ALC292_STANDARD_PINS \
10781 	{0x14, 0x90170110}, \
10782 	{0x15, 0x0221401f}
10783 
10784 #define ALC295_STANDARD_PINS \
10785 	{0x12, 0xb7a60130}, \
10786 	{0x14, 0x90170110}, \
10787 	{0x21, 0x04211020}
10788 
10789 #define ALC298_STANDARD_PINS \
10790 	{0x12, 0x90a60130}, \
10791 	{0x21, 0x03211020}
10792 
10793 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
10794 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
10795 		{0x14, 0x01014020},
10796 		{0x17, 0x90170110},
10797 		{0x18, 0x02a11030},
10798 		{0x19, 0x0181303F},
10799 		{0x21, 0x0221102f}),
10800 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
10801 		{0x12, 0x90a601c0},
10802 		{0x14, 0x90171120},
10803 		{0x21, 0x02211030}),
10804 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10805 		{0x14, 0x90170110},
10806 		{0x1b, 0x90a70130},
10807 		{0x21, 0x03211020}),
10808 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10809 		{0x1a, 0x90a70130},
10810 		{0x1b, 0x90170110},
10811 		{0x21, 0x03211020}),
10812 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10813 		ALC225_STANDARD_PINS,
10814 		{0x12, 0xb7a60130},
10815 		{0x14, 0x901701a0}),
10816 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10817 		ALC225_STANDARD_PINS,
10818 		{0x12, 0xb7a60130},
10819 		{0x14, 0x901701b0}),
10820 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10821 		ALC225_STANDARD_PINS,
10822 		{0x12, 0xb7a60150},
10823 		{0x14, 0x901701a0}),
10824 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10825 		ALC225_STANDARD_PINS,
10826 		{0x12, 0xb7a60150},
10827 		{0x14, 0x901701b0}),
10828 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10829 		ALC225_STANDARD_PINS,
10830 		{0x12, 0xb7a60130},
10831 		{0x1b, 0x90170110}),
10832 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10833 		{0x1b, 0x01111010},
10834 		{0x1e, 0x01451130},
10835 		{0x21, 0x02211020}),
10836 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
10837 		{0x12, 0x90a60140},
10838 		{0x14, 0x90170110},
10839 		{0x19, 0x02a11030},
10840 		{0x21, 0x02211020}),
10841 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10842 		{0x14, 0x90170110},
10843 		{0x19, 0x02a11030},
10844 		{0x1a, 0x02a11040},
10845 		{0x1b, 0x01014020},
10846 		{0x21, 0x0221101f}),
10847 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10848 		{0x14, 0x90170110},
10849 		{0x19, 0x02a11030},
10850 		{0x1a, 0x02a11040},
10851 		{0x1b, 0x01011020},
10852 		{0x21, 0x0221101f}),
10853 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10854 		{0x14, 0x90170110},
10855 		{0x19, 0x02a11020},
10856 		{0x1a, 0x02a11030},
10857 		{0x21, 0x0221101f}),
10858 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
10859 		{0x21, 0x02211010}),
10860 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10861 		{0x14, 0x90170110},
10862 		{0x19, 0x02a11020},
10863 		{0x21, 0x02211030}),
10864 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
10865 		{0x14, 0x90170110},
10866 		{0x21, 0x02211020}),
10867 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10868 		{0x14, 0x90170130},
10869 		{0x21, 0x02211040}),
10870 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10871 		{0x12, 0x90a60140},
10872 		{0x14, 0x90170110},
10873 		{0x21, 0x02211020}),
10874 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10875 		{0x12, 0x90a60160},
10876 		{0x14, 0x90170120},
10877 		{0x21, 0x02211030}),
10878 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10879 		{0x14, 0x90170110},
10880 		{0x1b, 0x02011020},
10881 		{0x21, 0x0221101f}),
10882 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10883 		{0x14, 0x90170110},
10884 		{0x1b, 0x01011020},
10885 		{0x21, 0x0221101f}),
10886 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10887 		{0x14, 0x90170130},
10888 		{0x1b, 0x01014020},
10889 		{0x21, 0x0221103f}),
10890 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10891 		{0x14, 0x90170130},
10892 		{0x1b, 0x01011020},
10893 		{0x21, 0x0221103f}),
10894 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10895 		{0x14, 0x90170130},
10896 		{0x1b, 0x02011020},
10897 		{0x21, 0x0221103f}),
10898 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10899 		{0x14, 0x90170150},
10900 		{0x1b, 0x02011020},
10901 		{0x21, 0x0221105f}),
10902 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10903 		{0x14, 0x90170110},
10904 		{0x1b, 0x01014020},
10905 		{0x21, 0x0221101f}),
10906 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10907 		{0x12, 0x90a60160},
10908 		{0x14, 0x90170120},
10909 		{0x17, 0x90170140},
10910 		{0x21, 0x0321102f}),
10911 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10912 		{0x12, 0x90a60160},
10913 		{0x14, 0x90170130},
10914 		{0x21, 0x02211040}),
10915 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10916 		{0x12, 0x90a60160},
10917 		{0x14, 0x90170140},
10918 		{0x21, 0x02211050}),
10919 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10920 		{0x12, 0x90a60170},
10921 		{0x14, 0x90170120},
10922 		{0x21, 0x02211030}),
10923 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10924 		{0x12, 0x90a60170},
10925 		{0x14, 0x90170130},
10926 		{0x21, 0x02211040}),
10927 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10928 		{0x12, 0x90a60170},
10929 		{0x14, 0x90171130},
10930 		{0x21, 0x02211040}),
10931 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10932 		{0x12, 0x90a60170},
10933 		{0x14, 0x90170140},
10934 		{0x21, 0x02211050}),
10935 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10936 		{0x12, 0x90a60180},
10937 		{0x14, 0x90170130},
10938 		{0x21, 0x02211040}),
10939 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10940 		{0x12, 0x90a60180},
10941 		{0x14, 0x90170120},
10942 		{0x21, 0x02211030}),
10943 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10944 		{0x1b, 0x01011020},
10945 		{0x21, 0x02211010}),
10946 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10947 		{0x14, 0x90170110},
10948 		{0x1b, 0x90a70130},
10949 		{0x21, 0x04211020}),
10950 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10951 		{0x14, 0x90170110},
10952 		{0x1b, 0x90a70130},
10953 		{0x21, 0x03211020}),
10954 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10955 		{0x12, 0x90a60130},
10956 		{0x14, 0x90170110},
10957 		{0x21, 0x03211020}),
10958 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10959 		{0x12, 0x90a60130},
10960 		{0x14, 0x90170110},
10961 		{0x21, 0x04211020}),
10962 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10963 		{0x1a, 0x90a70130},
10964 		{0x1b, 0x90170110},
10965 		{0x21, 0x03211020}),
10966        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10967 		{0x14, 0x90170110},
10968 		{0x19, 0x02a11020},
10969 		{0x21, 0x0221101f}),
10970        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
10971 		{0x17, 0x90170110},
10972 		{0x19, 0x03a11030},
10973 		{0x21, 0x03211020}),
10974 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10975 		{0x12, 0x90a60130},
10976 		{0x14, 0x90170110},
10977 		{0x15, 0x0421101f},
10978 		{0x1a, 0x04a11020}),
10979 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10980 		{0x12, 0x90a60140},
10981 		{0x14, 0x90170110},
10982 		{0x15, 0x0421101f},
10983 		{0x18, 0x02811030},
10984 		{0x1a, 0x04a1103f},
10985 		{0x1b, 0x02011020}),
10986 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10987 		ALC282_STANDARD_PINS,
10988 		{0x12, 0x99a30130},
10989 		{0x19, 0x03a11020},
10990 		{0x21, 0x0321101f}),
10991 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10992 		ALC282_STANDARD_PINS,
10993 		{0x12, 0x99a30130},
10994 		{0x19, 0x03a11020},
10995 		{0x21, 0x03211040}),
10996 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10997 		ALC282_STANDARD_PINS,
10998 		{0x12, 0x99a30130},
10999 		{0x19, 0x03a11030},
11000 		{0x21, 0x03211020}),
11001 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11002 		ALC282_STANDARD_PINS,
11003 		{0x12, 0x99a30130},
11004 		{0x19, 0x04a11020},
11005 		{0x21, 0x0421101f}),
11006 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
11007 		ALC282_STANDARD_PINS,
11008 		{0x12, 0x90a60140},
11009 		{0x19, 0x04a11030},
11010 		{0x21, 0x04211020}),
11011 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11012 		ALC282_STANDARD_PINS,
11013 		{0x12, 0x90a609c0},
11014 		{0x18, 0x03a11830},
11015 		{0x19, 0x04a19831},
11016 		{0x1a, 0x0481303f},
11017 		{0x1b, 0x04211020},
11018 		{0x21, 0x0321101f}),
11019 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11020 		ALC282_STANDARD_PINS,
11021 		{0x12, 0x90a60940},
11022 		{0x18, 0x03a11830},
11023 		{0x19, 0x04a19831},
11024 		{0x1a, 0x0481303f},
11025 		{0x1b, 0x04211020},
11026 		{0x21, 0x0321101f}),
11027 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11028 		ALC282_STANDARD_PINS,
11029 		{0x12, 0x90a60130},
11030 		{0x21, 0x0321101f}),
11031 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11032 		{0x12, 0x90a60160},
11033 		{0x14, 0x90170120},
11034 		{0x21, 0x02211030}),
11035 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11036 		ALC282_STANDARD_PINS,
11037 		{0x12, 0x90a60130},
11038 		{0x19, 0x03a11020},
11039 		{0x21, 0x0321101f}),
11040 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11041 		{0x12, 0x90a60130},
11042 		{0x14, 0x90170110},
11043 		{0x19, 0x04a11040},
11044 		{0x21, 0x04211020}),
11045 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11046 		{0x14, 0x90170110},
11047 		{0x19, 0x04a11040},
11048 		{0x1d, 0x40600001},
11049 		{0x21, 0x04211020}),
11050 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
11051 		{0x14, 0x90170110},
11052 		{0x19, 0x04a11040},
11053 		{0x21, 0x04211020}),
11054 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
11055 		{0x14, 0x90170110},
11056 		{0x17, 0x90170111},
11057 		{0x19, 0x03a11030},
11058 		{0x21, 0x03211020}),
11059 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11060 		{0x17, 0x90170110},
11061 		{0x19, 0x03a11030},
11062 		{0x21, 0x03211020}),
11063 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11064 		{0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
11065 		{0x19, 0x04a11040},
11066 		{0x21, 0x04211020}),
11067 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
11068 		{0x12, 0x90a60130},
11069 		{0x17, 0x90170110},
11070 		{0x21, 0x02211020}),
11071 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
11072 		{0x12, 0x90a60120},
11073 		{0x14, 0x90170110},
11074 		{0x21, 0x0321101f}),
11075 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11076 		ALC290_STANDARD_PINS,
11077 		{0x15, 0x04211040},
11078 		{0x18, 0x90170112},
11079 		{0x1a, 0x04a11020}),
11080 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11081 		ALC290_STANDARD_PINS,
11082 		{0x15, 0x04211040},
11083 		{0x18, 0x90170110},
11084 		{0x1a, 0x04a11020}),
11085 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11086 		ALC290_STANDARD_PINS,
11087 		{0x15, 0x0421101f},
11088 		{0x1a, 0x04a11020}),
11089 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11090 		ALC290_STANDARD_PINS,
11091 		{0x15, 0x04211020},
11092 		{0x1a, 0x04a11040}),
11093 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11094 		ALC290_STANDARD_PINS,
11095 		{0x14, 0x90170110},
11096 		{0x15, 0x04211020},
11097 		{0x1a, 0x04a11040}),
11098 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11099 		ALC290_STANDARD_PINS,
11100 		{0x14, 0x90170110},
11101 		{0x15, 0x04211020},
11102 		{0x1a, 0x04a11020}),
11103 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11104 		ALC290_STANDARD_PINS,
11105 		{0x14, 0x90170110},
11106 		{0x15, 0x0421101f},
11107 		{0x1a, 0x04a11020}),
11108 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11109 		ALC292_STANDARD_PINS,
11110 		{0x12, 0x90a60140},
11111 		{0x16, 0x01014020},
11112 		{0x19, 0x01a19030}),
11113 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11114 		ALC292_STANDARD_PINS,
11115 		{0x12, 0x90a60140},
11116 		{0x16, 0x01014020},
11117 		{0x18, 0x02a19031},
11118 		{0x19, 0x01a1903e}),
11119 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
11120 		ALC292_STANDARD_PINS,
11121 		{0x12, 0x90a60140}),
11122 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11123 		ALC292_STANDARD_PINS,
11124 		{0x13, 0x90a60140},
11125 		{0x16, 0x21014020},
11126 		{0x19, 0x21a19030}),
11127 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11128 		ALC292_STANDARD_PINS,
11129 		{0x13, 0x90a60140}),
11130 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
11131 		{0x17, 0x90170110},
11132 		{0x21, 0x04211020}),
11133 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
11134 		{0x14, 0x90170110},
11135 		{0x1b, 0x90a70130},
11136 		{0x21, 0x04211020}),
11137 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11138 		{0x12, 0x90a60130},
11139 		{0x17, 0x90170110},
11140 		{0x21, 0x03211020}),
11141 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11142 		{0x12, 0x90a60130},
11143 		{0x17, 0x90170110},
11144 		{0x21, 0x04211020}),
11145 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11146 		{0x12, 0x90a60130},
11147 		{0x17, 0x90170110},
11148 		{0x21, 0x03211020}),
11149 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11150 		{0x12, 0x90a60120},
11151 		{0x17, 0x90170110},
11152 		{0x21, 0x04211030}),
11153 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11154 		{0x12, 0x90a60130},
11155 		{0x17, 0x90170110},
11156 		{0x21, 0x03211020}),
11157 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11158 		{0x12, 0x90a60130},
11159 		{0x17, 0x90170110},
11160 		{0x21, 0x03211020}),
11161 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11162 		ALC298_STANDARD_PINS,
11163 		{0x17, 0x90170110}),
11164 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11165 		ALC298_STANDARD_PINS,
11166 		{0x17, 0x90170140}),
11167 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11168 		ALC298_STANDARD_PINS,
11169 		{0x17, 0x90170150}),
11170 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11171 		{0x12, 0xb7a60140},
11172 		{0x13, 0xb7a60150},
11173 		{0x17, 0x90170110},
11174 		{0x1a, 0x03011020},
11175 		{0x21, 0x03211030}),
11176 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11177 		{0x12, 0xb7a60140},
11178 		{0x17, 0x90170110},
11179 		{0x1a, 0x03a11030},
11180 		{0x21, 0x03211020}),
11181 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11182 		ALC225_STANDARD_PINS,
11183 		{0x12, 0xb7a60130},
11184 		{0x17, 0x90170110}),
11185 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11186 		{0x14, 0x01014010},
11187 		{0x17, 0x90170120},
11188 		{0x18, 0x02a11030},
11189 		{0x19, 0x02a1103f},
11190 		{0x21, 0x0221101f}),
11191 	{}
11192 };
11193 
11194 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11195  * more machines, don't need to match all valid pins, just need to match
11196  * all the pins defined in the tbl. Just because of this reason, it is possible
11197  * that a single machine matches multiple tbls, so there is one limitation:
11198  *   at most one tbl is allowed to define for the same vendor and same codec
11199  */
11200 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11201 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11202 		{0x19, 0x40000000}),
11203 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11204 		{0x19, 0x40000000},
11205 		{0x1b, 0x40000000}),
11206 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
11207 		{0x19, 0x40000000},
11208 		{0x1b, 0x40000000}),
11209 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11210 		{0x19, 0x40000000},
11211 		{0x1a, 0x40000000}),
11212 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11213 		{0x19, 0x40000000},
11214 		{0x1a, 0x40000000}),
11215 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11216 		{0x19, 0x40000000},
11217 		{0x1a, 0x40000000}),
11218 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11219 		{0x19, 0x40000000}),
11220 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1558, "Clevo", ALC2XX_FIXUP_HEADSET_MIC,
11221 		{0x19, 0x40000000}),
11222 	{}
11223 };
11224 
alc269_fill_coef(struct hda_codec * codec)11225 static void alc269_fill_coef(struct hda_codec *codec)
11226 {
11227 	struct alc_spec *spec = codec->spec;
11228 	int val;
11229 
11230 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11231 		return;
11232 
11233 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11234 		alc_write_coef_idx(codec, 0xf, 0x960b);
11235 		alc_write_coef_idx(codec, 0xe, 0x8817);
11236 	}
11237 
11238 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11239 		alc_write_coef_idx(codec, 0xf, 0x960b);
11240 		alc_write_coef_idx(codec, 0xe, 0x8814);
11241 	}
11242 
11243 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11244 		/* Power up output pin */
11245 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11246 	}
11247 
11248 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11249 		val = alc_read_coef_idx(codec, 0xd);
11250 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11251 			/* Capless ramp up clock control */
11252 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
11253 		}
11254 		val = alc_read_coef_idx(codec, 0x17);
11255 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11256 			/* Class D power on reset */
11257 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
11258 		}
11259 	}
11260 
11261 	/* HP */
11262 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11263 }
11264 
11265 /*
11266  */
patch_alc269(struct hda_codec * codec)11267 static int patch_alc269(struct hda_codec *codec)
11268 {
11269 	struct alc_spec *spec;
11270 	int err;
11271 
11272 	err = alc_alloc_spec(codec, 0x0b);
11273 	if (err < 0)
11274 		return err;
11275 
11276 	spec = codec->spec;
11277 	spec->gen.shared_mic_vref_pin = 0x18;
11278 	codec->power_save_node = 0;
11279 	spec->en_3kpull_low = true;
11280 
11281 #ifdef CONFIG_PM
11282 	codec->patch_ops.suspend = alc269_suspend;
11283 	codec->patch_ops.resume = alc269_resume;
11284 #endif
11285 	spec->shutup = alc_default_shutup;
11286 	spec->init_hook = alc_default_init;
11287 
11288 	switch (codec->core.vendor_id) {
11289 	case 0x10ec0269:
11290 		spec->codec_variant = ALC269_TYPE_ALC269VA;
11291 		switch (alc_get_coef0(codec) & 0x00f0) {
11292 		case 0x0010:
11293 			if (codec->bus->pci &&
11294 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
11295 			    spec->cdefine.platform_type == 1)
11296 				err = alc_codec_rename(codec, "ALC271X");
11297 			spec->codec_variant = ALC269_TYPE_ALC269VB;
11298 			break;
11299 		case 0x0020:
11300 			if (codec->bus->pci &&
11301 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
11302 			    codec->bus->pci->subsystem_device == 0x21f3)
11303 				err = alc_codec_rename(codec, "ALC3202");
11304 			spec->codec_variant = ALC269_TYPE_ALC269VC;
11305 			break;
11306 		case 0x0030:
11307 			spec->codec_variant = ALC269_TYPE_ALC269VD;
11308 			break;
11309 		default:
11310 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
11311 		}
11312 		if (err < 0)
11313 			goto error;
11314 		spec->shutup = alc269_shutup;
11315 		spec->init_hook = alc269_fill_coef;
11316 		alc269_fill_coef(codec);
11317 		break;
11318 
11319 	case 0x10ec0280:
11320 	case 0x10ec0290:
11321 		spec->codec_variant = ALC269_TYPE_ALC280;
11322 		break;
11323 	case 0x10ec0282:
11324 		spec->codec_variant = ALC269_TYPE_ALC282;
11325 		spec->shutup = alc282_shutup;
11326 		spec->init_hook = alc282_init;
11327 		break;
11328 	case 0x10ec0233:
11329 	case 0x10ec0283:
11330 		spec->codec_variant = ALC269_TYPE_ALC283;
11331 		spec->shutup = alc283_shutup;
11332 		spec->init_hook = alc283_init;
11333 		break;
11334 	case 0x10ec0284:
11335 	case 0x10ec0292:
11336 		spec->codec_variant = ALC269_TYPE_ALC284;
11337 		break;
11338 	case 0x10ec0293:
11339 		spec->codec_variant = ALC269_TYPE_ALC293;
11340 		break;
11341 	case 0x10ec0286:
11342 	case 0x10ec0288:
11343 		spec->codec_variant = ALC269_TYPE_ALC286;
11344 		break;
11345 	case 0x10ec0298:
11346 		spec->codec_variant = ALC269_TYPE_ALC298;
11347 		break;
11348 	case 0x10ec0235:
11349 	case 0x10ec0255:
11350 		spec->codec_variant = ALC269_TYPE_ALC255;
11351 		spec->shutup = alc256_shutup;
11352 		spec->init_hook = alc256_init;
11353 		break;
11354 	case 0x10ec0230:
11355 	case 0x10ec0236:
11356 	case 0x10ec0256:
11357 	case 0x19e58326:
11358 		spec->codec_variant = ALC269_TYPE_ALC256;
11359 		spec->shutup = alc256_shutup;
11360 		spec->init_hook = alc256_init;
11361 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
11362 		if (codec->core.vendor_id == 0x10ec0236 &&
11363 		    codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
11364 			spec->en_3kpull_low = false;
11365 		break;
11366 	case 0x10ec0257:
11367 		spec->codec_variant = ALC269_TYPE_ALC257;
11368 		spec->shutup = alc256_shutup;
11369 		spec->init_hook = alc256_init;
11370 		spec->gen.mixer_nid = 0;
11371 		spec->en_3kpull_low = false;
11372 		break;
11373 	case 0x10ec0215:
11374 	case 0x10ec0245:
11375 	case 0x10ec0285:
11376 	case 0x10ec0289:
11377 		if (alc_get_coef0(codec) & 0x0010)
11378 			spec->codec_variant = ALC269_TYPE_ALC245;
11379 		else
11380 			spec->codec_variant = ALC269_TYPE_ALC215;
11381 		spec->shutup = alc225_shutup;
11382 		spec->init_hook = alc225_init;
11383 		spec->gen.mixer_nid = 0;
11384 		break;
11385 	case 0x10ec0225:
11386 	case 0x10ec0295:
11387 	case 0x10ec0299:
11388 		spec->codec_variant = ALC269_TYPE_ALC225;
11389 		spec->shutup = alc225_shutup;
11390 		spec->init_hook = alc225_init;
11391 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
11392 		break;
11393 	case 0x10ec0287:
11394 		spec->codec_variant = ALC269_TYPE_ALC287;
11395 		spec->shutup = alc225_shutup;
11396 		spec->init_hook = alc225_init;
11397 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
11398 		break;
11399 	case 0x10ec0234:
11400 	case 0x10ec0274:
11401 	case 0x10ec0294:
11402 		spec->codec_variant = ALC269_TYPE_ALC294;
11403 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
11404 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
11405 		spec->init_hook = alc294_init;
11406 		break;
11407 	case 0x10ec0300:
11408 		spec->codec_variant = ALC269_TYPE_ALC300;
11409 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
11410 		break;
11411 	case 0x10ec0222:
11412 	case 0x10ec0623:
11413 		spec->codec_variant = ALC269_TYPE_ALC623;
11414 		spec->shutup = alc222_shutup;
11415 		spec->init_hook = alc222_init;
11416 		break;
11417 	case 0x10ec0700:
11418 	case 0x10ec0701:
11419 	case 0x10ec0703:
11420 	case 0x10ec0711:
11421 		spec->codec_variant = ALC269_TYPE_ALC700;
11422 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
11423 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
11424 		spec->init_hook = alc294_init;
11425 		break;
11426 
11427 	}
11428 
11429 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
11430 		spec->has_alc5505_dsp = 1;
11431 		spec->init_hook = alc5505_dsp_init;
11432 	}
11433 
11434 	alc_pre_init(codec);
11435 
11436 	snd_hda_pick_fixup(codec, alc269_fixup_models,
11437 		       alc269_fixup_tbl, alc269_fixups);
11438 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
11439 	 * the quirk breaks the latter (bko#214101).
11440 	 * Clear the wrong entry.
11441 	 */
11442 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
11443 	    codec->core.vendor_id == 0x10ec0294) {
11444 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
11445 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
11446 	}
11447 
11448 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
11449 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
11450 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
11451 			   alc269_fixups);
11452 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11453 
11454 	alc_auto_parse_customize_define(codec);
11455 
11456 	if (has_cdefine_beep(codec))
11457 		spec->gen.beep_nid = 0x01;
11458 
11459 	/* automatic parse from the BIOS config */
11460 	err = alc269_parse_auto_config(codec);
11461 	if (err < 0)
11462 		goto error;
11463 
11464 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
11465 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
11466 		if (err < 0)
11467 			goto error;
11468 	}
11469 
11470 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11471 
11472 	return 0;
11473 
11474  error:
11475 	alc_free(codec);
11476 	return err;
11477 }
11478 
11479 /*
11480  * ALC861
11481  */
11482 
alc861_parse_auto_config(struct hda_codec * codec)11483 static int alc861_parse_auto_config(struct hda_codec *codec)
11484 {
11485 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11486 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
11487 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
11488 }
11489 
11490 /* Pin config fixes */
11491 enum {
11492 	ALC861_FIXUP_FSC_AMILO_PI1505,
11493 	ALC861_FIXUP_AMP_VREF_0F,
11494 	ALC861_FIXUP_NO_JACK_DETECT,
11495 	ALC861_FIXUP_ASUS_A6RP,
11496 	ALC660_FIXUP_ASUS_W7J,
11497 };
11498 
11499 /* 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)11500 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
11501 			const struct hda_fixup *fix, int action)
11502 {
11503 	struct alc_spec *spec = codec->spec;
11504 	unsigned int val;
11505 
11506 	if (action != HDA_FIXUP_ACT_INIT)
11507 		return;
11508 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
11509 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
11510 		val |= AC_PINCTL_IN_EN;
11511 	val |= AC_PINCTL_VREF_50;
11512 	snd_hda_set_pin_ctl(codec, 0x0f, val);
11513 	spec->gen.keep_vref_in_automute = 1;
11514 }
11515 
11516 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)11517 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
11518 				     const struct hda_fixup *fix, int action)
11519 {
11520 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11521 		codec->no_jack_detect = 1;
11522 }
11523 
11524 static const struct hda_fixup alc861_fixups[] = {
11525 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
11526 		.type = HDA_FIXUP_PINS,
11527 		.v.pins = (const struct hda_pintbl[]) {
11528 			{ 0x0b, 0x0221101f }, /* HP */
11529 			{ 0x0f, 0x90170310 }, /* speaker */
11530 			{ }
11531 		}
11532 	},
11533 	[ALC861_FIXUP_AMP_VREF_0F] = {
11534 		.type = HDA_FIXUP_FUNC,
11535 		.v.func = alc861_fixup_asus_amp_vref_0f,
11536 	},
11537 	[ALC861_FIXUP_NO_JACK_DETECT] = {
11538 		.type = HDA_FIXUP_FUNC,
11539 		.v.func = alc_fixup_no_jack_detect,
11540 	},
11541 	[ALC861_FIXUP_ASUS_A6RP] = {
11542 		.type = HDA_FIXUP_FUNC,
11543 		.v.func = alc861_fixup_asus_amp_vref_0f,
11544 		.chained = true,
11545 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
11546 	},
11547 	[ALC660_FIXUP_ASUS_W7J] = {
11548 		.type = HDA_FIXUP_VERBS,
11549 		.v.verbs = (const struct hda_verb[]) {
11550 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
11551 			 * for enabling outputs
11552 			 */
11553 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11554 			{ }
11555 		},
11556 	}
11557 };
11558 
11559 static const struct hda_quirk alc861_fixup_tbl[] = {
11560 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
11561 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
11562 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
11563 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
11564 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
11565 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
11566 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
11567 	{}
11568 };
11569 
11570 /*
11571  */
patch_alc861(struct hda_codec * codec)11572 static int patch_alc861(struct hda_codec *codec)
11573 {
11574 	struct alc_spec *spec;
11575 	int err;
11576 
11577 	err = alc_alloc_spec(codec, 0x15);
11578 	if (err < 0)
11579 		return err;
11580 
11581 	spec = codec->spec;
11582 	if (has_cdefine_beep(codec))
11583 		spec->gen.beep_nid = 0x23;
11584 
11585 #ifdef CONFIG_PM
11586 	spec->power_hook = alc_power_eapd;
11587 #endif
11588 
11589 	alc_pre_init(codec);
11590 
11591 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
11592 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11593 
11594 	/* automatic parse from the BIOS config */
11595 	err = alc861_parse_auto_config(codec);
11596 	if (err < 0)
11597 		goto error;
11598 
11599 	if (!spec->gen.no_analog) {
11600 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
11601 		if (err < 0)
11602 			goto error;
11603 	}
11604 
11605 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11606 
11607 	return 0;
11608 
11609  error:
11610 	alc_free(codec);
11611 	return err;
11612 }
11613 
11614 /*
11615  * ALC861-VD support
11616  *
11617  * Based on ALC882
11618  *
11619  * In addition, an independent DAC
11620  */
alc861vd_parse_auto_config(struct hda_codec * codec)11621 static int alc861vd_parse_auto_config(struct hda_codec *codec)
11622 {
11623 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
11624 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11625 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
11626 }
11627 
11628 enum {
11629 	ALC660VD_FIX_ASUS_GPIO1,
11630 	ALC861VD_FIX_DALLAS,
11631 };
11632 
11633 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)11634 static void alc861vd_fixup_dallas(struct hda_codec *codec,
11635 				  const struct hda_fixup *fix, int action)
11636 {
11637 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11638 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
11639 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
11640 	}
11641 }
11642 
11643 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11644 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
11645 				      const struct hda_fixup *fix, int action)
11646 {
11647 	struct alc_spec *spec = codec->spec;
11648 
11649 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11650 		spec->gpio_mask |= 0x02;
11651 	alc_fixup_gpio(codec, action, 0x01);
11652 }
11653 
11654 static const struct hda_fixup alc861vd_fixups[] = {
11655 	[ALC660VD_FIX_ASUS_GPIO1] = {
11656 		.type = HDA_FIXUP_FUNC,
11657 		.v.func = alc660vd_fixup_asus_gpio1,
11658 	},
11659 	[ALC861VD_FIX_DALLAS] = {
11660 		.type = HDA_FIXUP_FUNC,
11661 		.v.func = alc861vd_fixup_dallas,
11662 	},
11663 };
11664 
11665 static const struct hda_quirk alc861vd_fixup_tbl[] = {
11666 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
11667 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
11668 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
11669 	{}
11670 };
11671 
11672 /*
11673  */
patch_alc861vd(struct hda_codec * codec)11674 static int patch_alc861vd(struct hda_codec *codec)
11675 {
11676 	struct alc_spec *spec;
11677 	int err;
11678 
11679 	err = alc_alloc_spec(codec, 0x0b);
11680 	if (err < 0)
11681 		return err;
11682 
11683 	spec = codec->spec;
11684 	if (has_cdefine_beep(codec))
11685 		spec->gen.beep_nid = 0x23;
11686 
11687 	spec->shutup = alc_eapd_shutup;
11688 
11689 	alc_pre_init(codec);
11690 
11691 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
11692 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11693 
11694 	/* automatic parse from the BIOS config */
11695 	err = alc861vd_parse_auto_config(codec);
11696 	if (err < 0)
11697 		goto error;
11698 
11699 	if (!spec->gen.no_analog) {
11700 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11701 		if (err < 0)
11702 			goto error;
11703 	}
11704 
11705 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11706 
11707 	return 0;
11708 
11709  error:
11710 	alc_free(codec);
11711 	return err;
11712 }
11713 
11714 /*
11715  * ALC662 support
11716  *
11717  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11718  * configuration.  Each pin widget can choose any input DACs and a mixer.
11719  * Each ADC is connected from a mixer of all inputs.  This makes possible
11720  * 6-channel independent captures.
11721  *
11722  * In addition, an independent DAC for the multi-playback (not used in this
11723  * driver yet).
11724  */
11725 
11726 /*
11727  * BIOS auto configuration
11728  */
11729 
alc662_parse_auto_config(struct hda_codec * codec)11730 static int alc662_parse_auto_config(struct hda_codec *codec)
11731 {
11732 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11733 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
11734 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11735 	const hda_nid_t *ssids;
11736 
11737 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
11738 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
11739 	    codec->core.vendor_id == 0x10ec0671)
11740 		ssids = alc663_ssids;
11741 	else
11742 		ssids = alc662_ssids;
11743 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
11744 }
11745 
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)11746 static void alc272_fixup_mario(struct hda_codec *codec,
11747 			       const struct hda_fixup *fix, int action)
11748 {
11749 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
11750 		return;
11751 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
11752 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
11753 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
11754 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11755 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
11756 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
11757 }
11758 
11759 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
11760 	{ .channels = 2,
11761 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
11762 	{ .channels = 4,
11763 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
11764 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
11765 	{ }
11766 };
11767 
11768 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)11769 static void alc_fixup_bass_chmap(struct hda_codec *codec,
11770 				    const struct hda_fixup *fix, int action)
11771 {
11772 	if (action == HDA_FIXUP_ACT_BUILD) {
11773 		struct alc_spec *spec = codec->spec;
11774 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
11775 	}
11776 }
11777 
11778 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)11779 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
11780 					  hda_nid_t nid,
11781 					  unsigned int power_state)
11782 {
11783 	struct alc_spec *spec = codec->spec;
11784 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
11785 		return AC_PWRST_D0;
11786 	return power_state;
11787 }
11788 
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11789 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
11790 				   const struct hda_fixup *fix, int action)
11791 {
11792 	struct alc_spec *spec = codec->spec;
11793 
11794 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
11795 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11796 		spec->mute_led_polarity = 1;
11797 		codec->power_filter = gpio_led_power_filter;
11798 	}
11799 }
11800 
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11801 static void alc662_usi_automute_hook(struct hda_codec *codec,
11802 					 struct hda_jack_callback *jack)
11803 {
11804 	struct alc_spec *spec = codec->spec;
11805 	int vref;
11806 	msleep(200);
11807 	snd_hda_gen_hp_automute(codec, jack);
11808 
11809 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
11810 	msleep(100);
11811 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11812 			    vref);
11813 }
11814 
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11815 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
11816 				     const struct hda_fixup *fix, int action)
11817 {
11818 	struct alc_spec *spec = codec->spec;
11819 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11820 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11821 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
11822 	}
11823 }
11824 
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)11825 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
11826 					struct hda_jack_callback *cb)
11827 {
11828 	/* surround speakers at 0x1b already get muted automatically when
11829 	 * headphones are plugged in, but we have to mute/unmute the remaining
11830 	 * channels manually:
11831 	 * 0x15 - front left/front right
11832 	 * 0x18 - front center/ LFE
11833 	 */
11834 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
11835 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
11836 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
11837 	} else {
11838 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
11839 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
11840 	}
11841 }
11842 
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)11843 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
11844 					const struct hda_fixup *fix, int action)
11845 {
11846     /* Pin 0x1b: shared headphones jack and surround speakers */
11847 	if (!is_jack_detectable(codec, 0x1b))
11848 		return;
11849 
11850 	switch (action) {
11851 	case HDA_FIXUP_ACT_PRE_PROBE:
11852 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
11853 				alc662_aspire_ethos_mute_speakers);
11854 		/* subwoofer needs an extra GPIO setting to become audible */
11855 		alc_setup_gpio(codec, 0x02);
11856 		break;
11857 	case HDA_FIXUP_ACT_INIT:
11858 		/* Make sure to start in a correct state, i.e. if
11859 		 * headphones have been plugged in before powering up the system
11860 		 */
11861 		alc662_aspire_ethos_mute_speakers(codec, NULL);
11862 		break;
11863 	}
11864 }
11865 
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)11866 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
11867 					     const struct hda_fixup *fix, int action)
11868 {
11869 	struct alc_spec *spec = codec->spec;
11870 
11871 	static const struct hda_pintbl pincfgs[] = {
11872 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
11873 		{ 0x1b, 0x0181304f },
11874 		{ }
11875 	};
11876 
11877 	switch (action) {
11878 	case HDA_FIXUP_ACT_PRE_PROBE:
11879 		spec->gen.mixer_nid = 0;
11880 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11881 		snd_hda_apply_pincfgs(codec, pincfgs);
11882 		break;
11883 	case HDA_FIXUP_ACT_INIT:
11884 		alc_write_coef_idx(codec, 0x19, 0xa054);
11885 		break;
11886 	}
11887 }
11888 
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11889 static void alc897_hp_automute_hook(struct hda_codec *codec,
11890 					 struct hda_jack_callback *jack)
11891 {
11892 	struct alc_spec *spec = codec->spec;
11893 	int vref;
11894 
11895 	snd_hda_gen_hp_automute(codec, jack);
11896 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
11897 	snd_hda_set_pin_ctl(codec, 0x1b, vref);
11898 }
11899 
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11900 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
11901 				     const struct hda_fixup *fix, int action)
11902 {
11903 	struct alc_spec *spec = codec->spec;
11904 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11905 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11906 		spec->no_shutup_pins = 1;
11907 	}
11908 	if (action == HDA_FIXUP_ACT_PROBE) {
11909 		snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
11910 	}
11911 }
11912 
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)11913 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
11914 				     const struct hda_fixup *fix, int action)
11915 {
11916 	struct alc_spec *spec = codec->spec;
11917 
11918 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11919 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11920 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11921 	}
11922 }
11923 
11924 static const struct coef_fw alc668_coefs[] = {
11925 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
11926 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
11927 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
11928 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
11929 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
11930 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
11931 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
11932 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
11933 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
11934 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
11935 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
11936 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
11937 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
11938 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
11939 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
11940 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
11941 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
11942 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
11943 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
11944 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
11945 	{}
11946 };
11947 
alc668_restore_default_value(struct hda_codec * codec)11948 static void alc668_restore_default_value(struct hda_codec *codec)
11949 {
11950 	alc_process_coef_fw(codec, alc668_coefs);
11951 }
11952 
11953 enum {
11954 	ALC662_FIXUP_ASPIRE,
11955 	ALC662_FIXUP_LED_GPIO1,
11956 	ALC662_FIXUP_IDEAPAD,
11957 	ALC272_FIXUP_MARIO,
11958 	ALC662_FIXUP_CZC_ET26,
11959 	ALC662_FIXUP_CZC_P10T,
11960 	ALC662_FIXUP_SKU_IGNORE,
11961 	ALC662_FIXUP_HP_RP5800,
11962 	ALC662_FIXUP_ASUS_MODE1,
11963 	ALC662_FIXUP_ASUS_MODE2,
11964 	ALC662_FIXUP_ASUS_MODE3,
11965 	ALC662_FIXUP_ASUS_MODE4,
11966 	ALC662_FIXUP_ASUS_MODE5,
11967 	ALC662_FIXUP_ASUS_MODE6,
11968 	ALC662_FIXUP_ASUS_MODE7,
11969 	ALC662_FIXUP_ASUS_MODE8,
11970 	ALC662_FIXUP_NO_JACK_DETECT,
11971 	ALC662_FIXUP_ZOTAC_Z68,
11972 	ALC662_FIXUP_INV_DMIC,
11973 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11974 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
11975 	ALC662_FIXUP_HEADSET_MODE,
11976 	ALC668_FIXUP_HEADSET_MODE,
11977 	ALC662_FIXUP_BASS_MODE4_CHMAP,
11978 	ALC662_FIXUP_BASS_16,
11979 	ALC662_FIXUP_BASS_1A,
11980 	ALC662_FIXUP_BASS_CHMAP,
11981 	ALC668_FIXUP_AUTO_MUTE,
11982 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
11983 	ALC668_FIXUP_DELL_XPS13,
11984 	ALC662_FIXUP_ASUS_Nx50,
11985 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11986 	ALC668_FIXUP_ASUS_Nx51,
11987 	ALC668_FIXUP_MIC_COEF,
11988 	ALC668_FIXUP_ASUS_G751,
11989 	ALC891_FIXUP_HEADSET_MODE,
11990 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11991 	ALC662_FIXUP_ACER_VERITON,
11992 	ALC892_FIXUP_ASROCK_MOBO,
11993 	ALC662_FIXUP_USI_FUNC,
11994 	ALC662_FIXUP_USI_HEADSET_MODE,
11995 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
11996 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
11997 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
11998 	ALC671_FIXUP_HP_HEADSET_MIC2,
11999 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
12000 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
12001 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
12002 	ALC668_FIXUP_HEADSET_MIC,
12003 	ALC668_FIXUP_MIC_DET_COEF,
12004 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
12005 	ALC897_FIXUP_HEADSET_MIC_PIN,
12006 	ALC897_FIXUP_HP_HSMIC_VERB,
12007 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
12008 	ALC897_FIXUP_HEADSET_MIC_PIN2,
12009 	ALC897_FIXUP_UNIS_H3C_X500S,
12010 	ALC897_FIXUP_HEADSET_MIC_PIN3,
12011 };
12012 
12013 static const struct hda_fixup alc662_fixups[] = {
12014 	[ALC662_FIXUP_ASPIRE] = {
12015 		.type = HDA_FIXUP_PINS,
12016 		.v.pins = (const struct hda_pintbl[]) {
12017 			{ 0x15, 0x99130112 }, /* subwoofer */
12018 			{ }
12019 		}
12020 	},
12021 	[ALC662_FIXUP_LED_GPIO1] = {
12022 		.type = HDA_FIXUP_FUNC,
12023 		.v.func = alc662_fixup_led_gpio1,
12024 	},
12025 	[ALC662_FIXUP_IDEAPAD] = {
12026 		.type = HDA_FIXUP_PINS,
12027 		.v.pins = (const struct hda_pintbl[]) {
12028 			{ 0x17, 0x99130112 }, /* subwoofer */
12029 			{ }
12030 		},
12031 		.chained = true,
12032 		.chain_id = ALC662_FIXUP_LED_GPIO1,
12033 	},
12034 	[ALC272_FIXUP_MARIO] = {
12035 		.type = HDA_FIXUP_FUNC,
12036 		.v.func = alc272_fixup_mario,
12037 	},
12038 	[ALC662_FIXUP_CZC_ET26] = {
12039 		.type = HDA_FIXUP_PINS,
12040 		.v.pins = (const struct hda_pintbl[]) {
12041 			{0x12, 0x403cc000},
12042 			{0x14, 0x90170110}, /* speaker */
12043 			{0x15, 0x411111f0},
12044 			{0x16, 0x411111f0},
12045 			{0x18, 0x01a19030}, /* mic */
12046 			{0x19, 0x90a7013f}, /* int-mic */
12047 			{0x1a, 0x01014020},
12048 			{0x1b, 0x0121401f},
12049 			{0x1c, 0x411111f0},
12050 			{0x1d, 0x411111f0},
12051 			{0x1e, 0x40478e35},
12052 			{}
12053 		},
12054 		.chained = true,
12055 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12056 	},
12057 	[ALC662_FIXUP_CZC_P10T] = {
12058 		.type = HDA_FIXUP_VERBS,
12059 		.v.verbs = (const struct hda_verb[]) {
12060 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
12061 			{}
12062 		}
12063 	},
12064 	[ALC662_FIXUP_SKU_IGNORE] = {
12065 		.type = HDA_FIXUP_FUNC,
12066 		.v.func = alc_fixup_sku_ignore,
12067 	},
12068 	[ALC662_FIXUP_HP_RP5800] = {
12069 		.type = HDA_FIXUP_PINS,
12070 		.v.pins = (const struct hda_pintbl[]) {
12071 			{ 0x14, 0x0221201f }, /* HP out */
12072 			{ }
12073 		},
12074 		.chained = true,
12075 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12076 	},
12077 	[ALC662_FIXUP_ASUS_MODE1] = {
12078 		.type = HDA_FIXUP_PINS,
12079 		.v.pins = (const struct hda_pintbl[]) {
12080 			{ 0x14, 0x99130110 }, /* speaker */
12081 			{ 0x18, 0x01a19c20 }, /* mic */
12082 			{ 0x19, 0x99a3092f }, /* int-mic */
12083 			{ 0x21, 0x0121401f }, /* HP out */
12084 			{ }
12085 		},
12086 		.chained = true,
12087 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12088 	},
12089 	[ALC662_FIXUP_ASUS_MODE2] = {
12090 		.type = HDA_FIXUP_PINS,
12091 		.v.pins = (const struct hda_pintbl[]) {
12092 			{ 0x14, 0x99130110 }, /* speaker */
12093 			{ 0x18, 0x01a19820 }, /* mic */
12094 			{ 0x19, 0x99a3092f }, /* int-mic */
12095 			{ 0x1b, 0x0121401f }, /* HP out */
12096 			{ }
12097 		},
12098 		.chained = true,
12099 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12100 	},
12101 	[ALC662_FIXUP_ASUS_MODE3] = {
12102 		.type = HDA_FIXUP_PINS,
12103 		.v.pins = (const struct hda_pintbl[]) {
12104 			{ 0x14, 0x99130110 }, /* speaker */
12105 			{ 0x15, 0x0121441f }, /* HP */
12106 			{ 0x18, 0x01a19840 }, /* mic */
12107 			{ 0x19, 0x99a3094f }, /* int-mic */
12108 			{ 0x21, 0x01211420 }, /* HP2 */
12109 			{ }
12110 		},
12111 		.chained = true,
12112 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12113 	},
12114 	[ALC662_FIXUP_ASUS_MODE4] = {
12115 		.type = HDA_FIXUP_PINS,
12116 		.v.pins = (const struct hda_pintbl[]) {
12117 			{ 0x14, 0x99130110 }, /* speaker */
12118 			{ 0x16, 0x99130111 }, /* speaker */
12119 			{ 0x18, 0x01a19840 }, /* mic */
12120 			{ 0x19, 0x99a3094f }, /* int-mic */
12121 			{ 0x21, 0x0121441f }, /* HP */
12122 			{ }
12123 		},
12124 		.chained = true,
12125 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12126 	},
12127 	[ALC662_FIXUP_ASUS_MODE5] = {
12128 		.type = HDA_FIXUP_PINS,
12129 		.v.pins = (const struct hda_pintbl[]) {
12130 			{ 0x14, 0x99130110 }, /* speaker */
12131 			{ 0x15, 0x0121441f }, /* HP */
12132 			{ 0x16, 0x99130111 }, /* speaker */
12133 			{ 0x18, 0x01a19840 }, /* mic */
12134 			{ 0x19, 0x99a3094f }, /* int-mic */
12135 			{ }
12136 		},
12137 		.chained = true,
12138 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12139 	},
12140 	[ALC662_FIXUP_ASUS_MODE6] = {
12141 		.type = HDA_FIXUP_PINS,
12142 		.v.pins = (const struct hda_pintbl[]) {
12143 			{ 0x14, 0x99130110 }, /* speaker */
12144 			{ 0x15, 0x01211420 }, /* HP2 */
12145 			{ 0x18, 0x01a19840 }, /* mic */
12146 			{ 0x19, 0x99a3094f }, /* int-mic */
12147 			{ 0x1b, 0x0121441f }, /* HP */
12148 			{ }
12149 		},
12150 		.chained = true,
12151 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12152 	},
12153 	[ALC662_FIXUP_ASUS_MODE7] = {
12154 		.type = HDA_FIXUP_PINS,
12155 		.v.pins = (const struct hda_pintbl[]) {
12156 			{ 0x14, 0x99130110 }, /* speaker */
12157 			{ 0x17, 0x99130111 }, /* speaker */
12158 			{ 0x18, 0x01a19840 }, /* mic */
12159 			{ 0x19, 0x99a3094f }, /* int-mic */
12160 			{ 0x1b, 0x01214020 }, /* HP */
12161 			{ 0x21, 0x0121401f }, /* HP */
12162 			{ }
12163 		},
12164 		.chained = true,
12165 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12166 	},
12167 	[ALC662_FIXUP_ASUS_MODE8] = {
12168 		.type = HDA_FIXUP_PINS,
12169 		.v.pins = (const struct hda_pintbl[]) {
12170 			{ 0x14, 0x99130110 }, /* speaker */
12171 			{ 0x12, 0x99a30970 }, /* int-mic */
12172 			{ 0x15, 0x01214020 }, /* HP */
12173 			{ 0x17, 0x99130111 }, /* speaker */
12174 			{ 0x18, 0x01a19840 }, /* mic */
12175 			{ 0x21, 0x0121401f }, /* HP */
12176 			{ }
12177 		},
12178 		.chained = true,
12179 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12180 	},
12181 	[ALC662_FIXUP_NO_JACK_DETECT] = {
12182 		.type = HDA_FIXUP_FUNC,
12183 		.v.func = alc_fixup_no_jack_detect,
12184 	},
12185 	[ALC662_FIXUP_ZOTAC_Z68] = {
12186 		.type = HDA_FIXUP_PINS,
12187 		.v.pins = (const struct hda_pintbl[]) {
12188 			{ 0x1b, 0x02214020 }, /* Front HP */
12189 			{ }
12190 		}
12191 	},
12192 	[ALC662_FIXUP_INV_DMIC] = {
12193 		.type = HDA_FIXUP_FUNC,
12194 		.v.func = alc_fixup_inv_dmic,
12195 	},
12196 	[ALC668_FIXUP_DELL_XPS13] = {
12197 		.type = HDA_FIXUP_FUNC,
12198 		.v.func = alc_fixup_dell_xps13,
12199 		.chained = true,
12200 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12201 	},
12202 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12203 		.type = HDA_FIXUP_FUNC,
12204 		.v.func = alc_fixup_disable_aamix,
12205 		.chained = true,
12206 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12207 	},
12208 	[ALC668_FIXUP_AUTO_MUTE] = {
12209 		.type = HDA_FIXUP_FUNC,
12210 		.v.func = alc_fixup_auto_mute_via_amp,
12211 		.chained = true,
12212 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12213 	},
12214 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12215 		.type = HDA_FIXUP_PINS,
12216 		.v.pins = (const struct hda_pintbl[]) {
12217 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12218 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12219 			{ }
12220 		},
12221 		.chained = true,
12222 		.chain_id = ALC662_FIXUP_HEADSET_MODE
12223 	},
12224 	[ALC662_FIXUP_HEADSET_MODE] = {
12225 		.type = HDA_FIXUP_FUNC,
12226 		.v.func = alc_fixup_headset_mode_alc662,
12227 	},
12228 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12229 		.type = HDA_FIXUP_PINS,
12230 		.v.pins = (const struct hda_pintbl[]) {
12231 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12232 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12233 			{ }
12234 		},
12235 		.chained = true,
12236 		.chain_id = ALC668_FIXUP_HEADSET_MODE
12237 	},
12238 	[ALC668_FIXUP_HEADSET_MODE] = {
12239 		.type = HDA_FIXUP_FUNC,
12240 		.v.func = alc_fixup_headset_mode_alc668,
12241 	},
12242 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12243 		.type = HDA_FIXUP_FUNC,
12244 		.v.func = alc_fixup_bass_chmap,
12245 		.chained = true,
12246 		.chain_id = ALC662_FIXUP_ASUS_MODE4
12247 	},
12248 	[ALC662_FIXUP_BASS_16] = {
12249 		.type = HDA_FIXUP_PINS,
12250 		.v.pins = (const struct hda_pintbl[]) {
12251 			{0x16, 0x80106111}, /* bass speaker */
12252 			{}
12253 		},
12254 		.chained = true,
12255 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12256 	},
12257 	[ALC662_FIXUP_BASS_1A] = {
12258 		.type = HDA_FIXUP_PINS,
12259 		.v.pins = (const struct hda_pintbl[]) {
12260 			{0x1a, 0x80106111}, /* bass speaker */
12261 			{}
12262 		},
12263 		.chained = true,
12264 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12265 	},
12266 	[ALC662_FIXUP_BASS_CHMAP] = {
12267 		.type = HDA_FIXUP_FUNC,
12268 		.v.func = alc_fixup_bass_chmap,
12269 	},
12270 	[ALC662_FIXUP_ASUS_Nx50] = {
12271 		.type = HDA_FIXUP_FUNC,
12272 		.v.func = alc_fixup_auto_mute_via_amp,
12273 		.chained = true,
12274 		.chain_id = ALC662_FIXUP_BASS_1A
12275 	},
12276 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12277 		.type = HDA_FIXUP_FUNC,
12278 		.v.func = alc_fixup_headset_mode_alc668,
12279 		.chain_id = ALC662_FIXUP_BASS_CHMAP
12280 	},
12281 	[ALC668_FIXUP_ASUS_Nx51] = {
12282 		.type = HDA_FIXUP_PINS,
12283 		.v.pins = (const struct hda_pintbl[]) {
12284 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12285 			{ 0x1a, 0x90170151 }, /* bass speaker */
12286 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12287 			{}
12288 		},
12289 		.chained = true,
12290 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12291 	},
12292 	[ALC668_FIXUP_MIC_COEF] = {
12293 		.type = HDA_FIXUP_VERBS,
12294 		.v.verbs = (const struct hda_verb[]) {
12295 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12296 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12297 			{}
12298 		},
12299 	},
12300 	[ALC668_FIXUP_ASUS_G751] = {
12301 		.type = HDA_FIXUP_PINS,
12302 		.v.pins = (const struct hda_pintbl[]) {
12303 			{ 0x16, 0x0421101f }, /* HP */
12304 			{}
12305 		},
12306 		.chained = true,
12307 		.chain_id = ALC668_FIXUP_MIC_COEF
12308 	},
12309 	[ALC891_FIXUP_HEADSET_MODE] = {
12310 		.type = HDA_FIXUP_FUNC,
12311 		.v.func = alc_fixup_headset_mode,
12312 	},
12313 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
12314 		.type = HDA_FIXUP_PINS,
12315 		.v.pins = (const struct hda_pintbl[]) {
12316 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12317 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12318 			{ }
12319 		},
12320 		.chained = true,
12321 		.chain_id = ALC891_FIXUP_HEADSET_MODE
12322 	},
12323 	[ALC662_FIXUP_ACER_VERITON] = {
12324 		.type = HDA_FIXUP_PINS,
12325 		.v.pins = (const struct hda_pintbl[]) {
12326 			{ 0x15, 0x50170120 }, /* no internal speaker */
12327 			{ }
12328 		}
12329 	},
12330 	[ALC892_FIXUP_ASROCK_MOBO] = {
12331 		.type = HDA_FIXUP_PINS,
12332 		.v.pins = (const struct hda_pintbl[]) {
12333 			{ 0x15, 0x40f000f0 }, /* disabled */
12334 			{ 0x16, 0x40f000f0 }, /* disabled */
12335 			{ }
12336 		}
12337 	},
12338 	[ALC662_FIXUP_USI_FUNC] = {
12339 		.type = HDA_FIXUP_FUNC,
12340 		.v.func = alc662_fixup_usi_headset_mic,
12341 	},
12342 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
12343 		.type = HDA_FIXUP_PINS,
12344 		.v.pins = (const struct hda_pintbl[]) {
12345 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
12346 			{ 0x18, 0x01a1903d },
12347 			{ }
12348 		},
12349 		.chained = true,
12350 		.chain_id = ALC662_FIXUP_USI_FUNC
12351 	},
12352 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
12353 		.type = HDA_FIXUP_FUNC,
12354 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
12355 	},
12356 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
12357 		.type = HDA_FIXUP_FUNC,
12358 		.v.func = alc662_fixup_aspire_ethos_hp,
12359 	},
12360 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
12361 		.type = HDA_FIXUP_PINS,
12362 		.v.pins = (const struct hda_pintbl[]) {
12363 			{ 0x15, 0x92130110 }, /* front speakers */
12364 			{ 0x18, 0x99130111 }, /* center/subwoofer */
12365 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
12366 			{ }
12367 		},
12368 		.chained = true,
12369 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
12370 	},
12371 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
12372 		.type = HDA_FIXUP_FUNC,
12373 		.v.func = alc671_fixup_hp_headset_mic2,
12374 	},
12375 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
12376 		.type = HDA_FIXUP_PINS,
12377 		.v.pins = (const struct hda_pintbl[]) {
12378 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
12379 			{ }
12380 		},
12381 		.chained = true,
12382 		.chain_id = ALC662_FIXUP_USI_FUNC
12383 	},
12384 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
12385 		.type = HDA_FIXUP_PINS,
12386 		.v.pins = (const struct hda_pintbl[]) {
12387 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12388 			{ 0x1b, 0x0221144f },
12389 			{ }
12390 		},
12391 		.chained = true,
12392 		.chain_id = ALC662_FIXUP_USI_FUNC
12393 	},
12394 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
12395 		.type = HDA_FIXUP_PINS,
12396 		.v.pins = (const struct hda_pintbl[]) {
12397 			{ 0x1b, 0x04a1112c },
12398 			{ }
12399 		},
12400 		.chained = true,
12401 		.chain_id = ALC668_FIXUP_HEADSET_MIC
12402 	},
12403 	[ALC668_FIXUP_HEADSET_MIC] = {
12404 		.type = HDA_FIXUP_FUNC,
12405 		.v.func = alc269_fixup_headset_mic,
12406 		.chained = true,
12407 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
12408 	},
12409 	[ALC668_FIXUP_MIC_DET_COEF] = {
12410 		.type = HDA_FIXUP_VERBS,
12411 		.v.verbs = (const struct hda_verb[]) {
12412 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
12413 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
12414 			{}
12415 		},
12416 	},
12417 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
12418 		.type = HDA_FIXUP_FUNC,
12419 		.v.func = alc897_fixup_lenovo_headset_mic,
12420 	},
12421 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
12422 		.type = HDA_FIXUP_PINS,
12423 		.v.pins = (const struct hda_pintbl[]) {
12424 			{ 0x1a, 0x03a11050 },
12425 			{ }
12426 		},
12427 		.chained = true,
12428 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
12429 	},
12430 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
12431 		.type = HDA_FIXUP_PINS,
12432 		.v.pins = (const struct hda_pintbl[]) {
12433 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
12434 			{ }
12435 		},
12436 	},
12437 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
12438 		.type = HDA_FIXUP_FUNC,
12439 		.v.func = alc897_fixup_lenovo_headset_mode,
12440 	},
12441 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
12442 		.type = HDA_FIXUP_PINS,
12443 		.v.pins = (const struct hda_pintbl[]) {
12444 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12445 			{ }
12446 		},
12447 		.chained = true,
12448 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
12449 	},
12450 	[ALC897_FIXUP_UNIS_H3C_X500S] = {
12451 		.type = HDA_FIXUP_VERBS,
12452 		.v.verbs = (const struct hda_verb[]) {
12453 			{ 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
12454 			{}
12455 		},
12456 	},
12457 	[ALC897_FIXUP_HEADSET_MIC_PIN3] = {
12458 		.type = HDA_FIXUP_PINS,
12459 		.v.pins = (const struct hda_pintbl[]) {
12460 			{ 0x19, 0x03a11050 }, /* use as headset mic */
12461 			{ }
12462 		},
12463 	},
12464 };
12465 
12466 static const struct hda_quirk alc662_fixup_tbl[] = {
12467 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
12468 	SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
12469 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
12470 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
12471 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
12472 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
12473 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
12474 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
12475 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
12476 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
12477 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
12478 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
12479 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12480 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12481 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
12482 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
12483 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
12484 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12485 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12486 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12487 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12488 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12489 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
12490 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12491 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12492 	SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12493 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
12494 	SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
12495 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
12496 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
12497 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
12498 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
12499 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
12500 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
12501 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
12502 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12503 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
12504 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
12505 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
12506 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
12507 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
12508 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
12509 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12510 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
12511 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
12512 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
12513 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
12514 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
12515 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
12516 	SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
12517 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
12518 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
12519 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
12520 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
12521 	SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12522 	SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12523 	SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
12524 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
12525 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
12526 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
12527 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
12528 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
12529 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
12530 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
12531 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
12532 	SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
12533 
12534 #if 0
12535 	/* Below is a quirk table taken from the old code.
12536 	 * Basically the device should work as is without the fixup table.
12537 	 * If BIOS doesn't give a proper info, enable the corresponding
12538 	 * fixup entry.
12539 	 */
12540 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
12541 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
12542 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
12543 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
12544 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12545 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12546 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12547 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
12548 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
12549 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12550 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
12551 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
12552 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
12553 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
12554 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
12555 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12556 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
12557 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
12558 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12559 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12560 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12561 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12562 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
12563 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
12564 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
12565 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12566 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
12567 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12568 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12569 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
12570 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12571 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12572 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
12573 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
12574 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
12575 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
12576 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
12577 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
12578 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
12579 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12580 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
12581 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
12582 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12583 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
12584 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
12585 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
12586 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
12587 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
12588 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12589 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
12590 #endif
12591 	{}
12592 };
12593 
12594 static const struct hda_model_fixup alc662_fixup_models[] = {
12595 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
12596 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
12597 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
12598 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
12599 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
12600 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
12601 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
12602 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
12603 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
12604 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
12605 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
12606 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
12607 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
12608 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
12609 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
12610 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
12611 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
12612 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
12613 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
12614 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
12615 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
12616 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
12617 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
12618 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
12619 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
12620 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
12621 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
12622 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
12623 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
12624 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
12625 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
12626 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
12627 	{.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
12628 	{}
12629 };
12630 
12631 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
12632 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12633 		{0x17, 0x02211010},
12634 		{0x18, 0x01a19030},
12635 		{0x1a, 0x01813040},
12636 		{0x21, 0x01014020}),
12637 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12638 		{0x16, 0x01813030},
12639 		{0x17, 0x02211010},
12640 		{0x18, 0x01a19040},
12641 		{0x21, 0x01014020}),
12642 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12643 		{0x14, 0x01014010},
12644 		{0x18, 0x01a19020},
12645 		{0x1a, 0x0181302f},
12646 		{0x1b, 0x0221401f}),
12647 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12648 		{0x12, 0x99a30130},
12649 		{0x14, 0x90170110},
12650 		{0x15, 0x0321101f},
12651 		{0x16, 0x03011020}),
12652 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12653 		{0x12, 0x99a30140},
12654 		{0x14, 0x90170110},
12655 		{0x15, 0x0321101f},
12656 		{0x16, 0x03011020}),
12657 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12658 		{0x12, 0x99a30150},
12659 		{0x14, 0x90170110},
12660 		{0x15, 0x0321101f},
12661 		{0x16, 0x03011020}),
12662 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12663 		{0x14, 0x90170110},
12664 		{0x15, 0x0321101f},
12665 		{0x16, 0x03011020}),
12666 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
12667 		{0x12, 0x90a60130},
12668 		{0x14, 0x90170110},
12669 		{0x15, 0x0321101f}),
12670 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12671 		{0x14, 0x01014010},
12672 		{0x17, 0x90170150},
12673 		{0x19, 0x02a11060},
12674 		{0x1b, 0x01813030},
12675 		{0x21, 0x02211020}),
12676 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12677 		{0x14, 0x01014010},
12678 		{0x18, 0x01a19040},
12679 		{0x1b, 0x01813030},
12680 		{0x21, 0x02211020}),
12681 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12682 		{0x14, 0x01014020},
12683 		{0x17, 0x90170110},
12684 		{0x18, 0x01a19050},
12685 		{0x1b, 0x01813040},
12686 		{0x21, 0x02211030}),
12687 	{}
12688 };
12689 
12690 /*
12691  */
patch_alc662(struct hda_codec * codec)12692 static int patch_alc662(struct hda_codec *codec)
12693 {
12694 	struct alc_spec *spec;
12695 	int err;
12696 
12697 	err = alc_alloc_spec(codec, 0x0b);
12698 	if (err < 0)
12699 		return err;
12700 
12701 	spec = codec->spec;
12702 
12703 	spec->shutup = alc_eapd_shutup;
12704 
12705 	/* handle multiple HPs as is */
12706 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
12707 
12708 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
12709 
12710 	switch (codec->core.vendor_id) {
12711 	case 0x10ec0668:
12712 		spec->init_hook = alc668_restore_default_value;
12713 		break;
12714 	}
12715 
12716 	alc_pre_init(codec);
12717 
12718 	snd_hda_pick_fixup(codec, alc662_fixup_models,
12719 		       alc662_fixup_tbl, alc662_fixups);
12720 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
12721 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12722 
12723 	alc_auto_parse_customize_define(codec);
12724 
12725 	if (has_cdefine_beep(codec))
12726 		spec->gen.beep_nid = 0x01;
12727 
12728 	if ((alc_get_coef0(codec) & (1 << 14)) &&
12729 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
12730 	    spec->cdefine.platform_type == 1) {
12731 		err = alc_codec_rename(codec, "ALC272X");
12732 		if (err < 0)
12733 			goto error;
12734 	}
12735 
12736 	/* automatic parse from the BIOS config */
12737 	err = alc662_parse_auto_config(codec);
12738 	if (err < 0)
12739 		goto error;
12740 
12741 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
12742 		switch (codec->core.vendor_id) {
12743 		case 0x10ec0662:
12744 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12745 			break;
12746 		case 0x10ec0272:
12747 		case 0x10ec0663:
12748 		case 0x10ec0665:
12749 		case 0x10ec0668:
12750 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12751 			break;
12752 		case 0x10ec0273:
12753 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
12754 			break;
12755 		}
12756 		if (err < 0)
12757 			goto error;
12758 	}
12759 
12760 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12761 
12762 	return 0;
12763 
12764  error:
12765 	alc_free(codec);
12766 	return err;
12767 }
12768 
12769 /*
12770  * ALC680 support
12771  */
12772 
alc680_parse_auto_config(struct hda_codec * codec)12773 static int alc680_parse_auto_config(struct hda_codec *codec)
12774 {
12775 	return alc_parse_auto_config(codec, NULL, NULL);
12776 }
12777 
12778 /*
12779  */
patch_alc680(struct hda_codec * codec)12780 static int patch_alc680(struct hda_codec *codec)
12781 {
12782 	int err;
12783 
12784 	/* ALC680 has no aa-loopback mixer */
12785 	err = alc_alloc_spec(codec, 0);
12786 	if (err < 0)
12787 		return err;
12788 
12789 	/* automatic parse from the BIOS config */
12790 	err = alc680_parse_auto_config(codec);
12791 	if (err < 0) {
12792 		alc_free(codec);
12793 		return err;
12794 	}
12795 
12796 	return 0;
12797 }
12798 
12799 /*
12800  * patch entries
12801  */
12802 static const struct hda_device_id snd_hda_id_realtek[] = {
12803 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
12804 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
12805 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
12806 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
12807 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
12808 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
12809 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
12810 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
12811 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
12812 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
12813 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
12814 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
12815 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
12816 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
12817 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
12818 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
12819 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
12820 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
12821 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
12822 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
12823 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
12824 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
12825 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
12826 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
12827 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
12828 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
12829 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
12830 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
12831 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
12832 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
12833 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
12834 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
12835 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
12836 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
12837 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
12838 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
12839 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
12840 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
12841 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
12842 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
12843 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
12844 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
12845 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
12846 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
12847 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
12848 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
12849 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
12850 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
12851 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
12852 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
12853 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
12854 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
12855 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
12856 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
12857 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
12858 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
12859 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
12860 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
12861 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
12862 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
12863 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
12864 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
12865 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
12866 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
12867 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
12868 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
12869 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
12870 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
12871 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
12872 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
12873 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
12874 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
12875 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
12876 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
12877 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
12878 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
12879 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
12880 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
12881 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
12882 	{} /* terminator */
12883 };
12884 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
12885 
12886 MODULE_LICENSE("GPL");
12887 MODULE_DESCRIPTION("Realtek HD-audio codec");
12888 
12889 static struct hda_codec_driver realtek_driver = {
12890 	.id = snd_hda_id_realtek,
12891 };
12892 
12893 module_hda_codec_driver(realtek_driver);
12894