xref: /openbmc/linux/sound/pci/hda/patch_realtek.c (revision 037108f0)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Universal Interface for Intel High Definition Audio Codec
4  *
5  * HD audio interface patch for Realtek ALC codecs
6  *
7  * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8  *                    PeiSen Hou <pshou@realtek.com.tw>
9  *                    Takashi Iwai <tiwai@suse.de>
10  *                    Jonathan Woithe <jwoithe@just42.net>
11  */
12 
13 #include <linux/init.h>
14 #include <linux/delay.h>
15 #include <linux/slab.h>
16 #include <linux/pci.h>
17 #include <linux/dmi.h>
18 #include <linux/module.h>
19 #include <linux/input.h>
20 #include <linux/leds.h>
21 #include <linux/ctype.h>
22 #include <sound/core.h>
23 #include <sound/jack.h>
24 #include <sound/hda_codec.h>
25 #include "hda_local.h"
26 #include "hda_auto_parser.h"
27 #include "hda_jack.h"
28 #include "hda_generic.h"
29 #include "hda_component.h"
30 
31 /* keep halting ALC5505 DSP, for power saving */
32 #define HALT_REALTEK_ALC5505
33 
34 /* extra amp-initialization sequence types */
35 enum {
36 	ALC_INIT_UNDEFINED,
37 	ALC_INIT_NONE,
38 	ALC_INIT_DEFAULT,
39 };
40 
41 enum {
42 	ALC_HEADSET_MODE_UNKNOWN,
43 	ALC_HEADSET_MODE_UNPLUGGED,
44 	ALC_HEADSET_MODE_HEADSET,
45 	ALC_HEADSET_MODE_MIC,
46 	ALC_HEADSET_MODE_HEADPHONE,
47 };
48 
49 enum {
50 	ALC_HEADSET_TYPE_UNKNOWN,
51 	ALC_HEADSET_TYPE_CTIA,
52 	ALC_HEADSET_TYPE_OMTP,
53 };
54 
55 enum {
56 	ALC_KEY_MICMUTE_INDEX,
57 };
58 
59 struct alc_customize_define {
60 	unsigned int  sku_cfg;
61 	unsigned char port_connectivity;
62 	unsigned char check_sum;
63 	unsigned char customization;
64 	unsigned char external_amp;
65 	unsigned int  enable_pcbeep:1;
66 	unsigned int  platform_type:1;
67 	unsigned int  swap:1;
68 	unsigned int  override:1;
69 	unsigned int  fixup:1; /* Means that this sku is set by driver, not read from hw */
70 };
71 
72 struct alc_coef_led {
73 	unsigned int idx;
74 	unsigned int mask;
75 	unsigned int on;
76 	unsigned int off;
77 };
78 
79 struct alc_spec {
80 	struct hda_gen_spec gen; /* must be at head */
81 
82 	/* codec parameterization */
83 	struct alc_customize_define cdefine;
84 	unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
85 
86 	/* GPIO bits */
87 	unsigned int gpio_mask;
88 	unsigned int gpio_dir;
89 	unsigned int gpio_data;
90 	bool gpio_write_delay;	/* add a delay before writing gpio_data */
91 
92 	/* mute LED for HP laptops, see vref_mute_led_set() */
93 	int mute_led_polarity;
94 	int micmute_led_polarity;
95 	hda_nid_t mute_led_nid;
96 	hda_nid_t cap_mute_led_nid;
97 
98 	unsigned int gpio_mute_led_mask;
99 	unsigned int gpio_mic_led_mask;
100 	struct alc_coef_led mute_led_coef;
101 	struct alc_coef_led mic_led_coef;
102 	struct mutex coef_mutex;
103 
104 	hda_nid_t headset_mic_pin;
105 	hda_nid_t headphone_mic_pin;
106 	int current_headset_mode;
107 	int current_headset_type;
108 
109 	/* hooks */
110 	void (*init_hook)(struct hda_codec *codec);
111 #ifdef CONFIG_PM
112 	void (*power_hook)(struct hda_codec *codec);
113 #endif
114 	void (*shutup)(struct hda_codec *codec);
115 
116 	int init_amp;
117 	int codec_variant;	/* flag for other variants */
118 	unsigned int has_alc5505_dsp:1;
119 	unsigned int no_depop_delay:1;
120 	unsigned int done_hp_init:1;
121 	unsigned int no_shutup_pins:1;
122 	unsigned int ultra_low_power:1;
123 	unsigned int has_hs_key:1;
124 	unsigned int no_internal_mic_pin:1;
125 	unsigned int en_3kpull_low:1;
126 
127 	/* for PLL fix */
128 	hda_nid_t pll_nid;
129 	unsigned int pll_coef_idx, pll_coef_bit;
130 	unsigned int coef0;
131 	struct input_dev *kb_dev;
132 	u8 alc_mute_keycode_map[1];
133 
134 	/* component binding */
135 	struct component_match *match;
136 	struct hda_component comps[HDA_MAX_COMPONENTS];
137 };
138 
139 /*
140  * COEF access helper functions
141  */
142 
coef_mutex_lock(struct hda_codec * codec)143 static void coef_mutex_lock(struct hda_codec *codec)
144 {
145 	struct alc_spec *spec = codec->spec;
146 
147 	snd_hda_power_up_pm(codec);
148 	mutex_lock(&spec->coef_mutex);
149 }
150 
coef_mutex_unlock(struct hda_codec * codec)151 static void coef_mutex_unlock(struct hda_codec *codec)
152 {
153 	struct alc_spec *spec = codec->spec;
154 
155 	mutex_unlock(&spec->coef_mutex);
156 	snd_hda_power_down_pm(codec);
157 }
158 
__alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)159 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 				 unsigned int coef_idx)
161 {
162 	unsigned int val;
163 
164 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
165 	val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
166 	return val;
167 }
168 
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)169 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
170 			       unsigned int coef_idx)
171 {
172 	unsigned int val;
173 
174 	coef_mutex_lock(codec);
175 	val = __alc_read_coefex_idx(codec, nid, coef_idx);
176 	coef_mutex_unlock(codec);
177 	return val;
178 }
179 
180 #define alc_read_coef_idx(codec, coef_idx) \
181 	alc_read_coefex_idx(codec, 0x20, coef_idx)
182 
__alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)183 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
184 				   unsigned int coef_idx, unsigned int coef_val)
185 {
186 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
187 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
188 }
189 
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)190 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
191 				 unsigned int coef_idx, unsigned int coef_val)
192 {
193 	coef_mutex_lock(codec);
194 	__alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
195 	coef_mutex_unlock(codec);
196 }
197 
198 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
199 	alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
200 
__alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)201 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
202 				    unsigned int coef_idx, unsigned int mask,
203 				    unsigned int bits_set)
204 {
205 	unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
206 
207 	if (val != -1)
208 		__alc_write_coefex_idx(codec, nid, coef_idx,
209 				       (val & ~mask) | bits_set);
210 }
211 
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)212 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
213 				  unsigned int coef_idx, unsigned int mask,
214 				  unsigned int bits_set)
215 {
216 	coef_mutex_lock(codec);
217 	__alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
218 	coef_mutex_unlock(codec);
219 }
220 
221 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set)	\
222 	alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
223 
224 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)225 static unsigned int alc_get_coef0(struct hda_codec *codec)
226 {
227 	struct alc_spec *spec = codec->spec;
228 
229 	if (!spec->coef0)
230 		spec->coef0 = alc_read_coef_idx(codec, 0);
231 	return spec->coef0;
232 }
233 
234 /* coef writes/updates batch */
235 struct coef_fw {
236 	unsigned char nid;
237 	unsigned char idx;
238 	unsigned short mask;
239 	unsigned short val;
240 };
241 
242 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
243 	{ .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
244 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
245 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
246 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
247 
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)248 static void alc_process_coef_fw(struct hda_codec *codec,
249 				const struct coef_fw *fw)
250 {
251 	coef_mutex_lock(codec);
252 	for (; fw->nid; fw++) {
253 		if (fw->mask == (unsigned short)-1)
254 			__alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
255 		else
256 			__alc_update_coefex_idx(codec, fw->nid, fw->idx,
257 						fw->mask, fw->val);
258 	}
259 	coef_mutex_unlock(codec);
260 }
261 
262 /*
263  * GPIO setup tables, used in initialization
264  */
265 
266 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)267 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
268 {
269 	struct alc_spec *spec = codec->spec;
270 
271 	spec->gpio_mask |= mask;
272 	spec->gpio_dir |= mask;
273 	spec->gpio_data |= mask;
274 }
275 
alc_write_gpio_data(struct hda_codec * codec)276 static void alc_write_gpio_data(struct hda_codec *codec)
277 {
278 	struct alc_spec *spec = codec->spec;
279 
280 	snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
281 			    spec->gpio_data);
282 }
283 
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)284 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
285 				 bool on)
286 {
287 	struct alc_spec *spec = codec->spec;
288 	unsigned int oldval = spec->gpio_data;
289 
290 	if (on)
291 		spec->gpio_data |= mask;
292 	else
293 		spec->gpio_data &= ~mask;
294 	if (oldval != spec->gpio_data)
295 		alc_write_gpio_data(codec);
296 }
297 
alc_write_gpio(struct hda_codec * codec)298 static void alc_write_gpio(struct hda_codec *codec)
299 {
300 	struct alc_spec *spec = codec->spec;
301 
302 	if (!spec->gpio_mask)
303 		return;
304 
305 	snd_hda_codec_write(codec, codec->core.afg, 0,
306 			    AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
307 	snd_hda_codec_write(codec, codec->core.afg, 0,
308 			    AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
309 	if (spec->gpio_write_delay)
310 		msleep(1);
311 	alc_write_gpio_data(codec);
312 }
313 
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)314 static void alc_fixup_gpio(struct hda_codec *codec, int action,
315 			   unsigned int mask)
316 {
317 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
318 		alc_setup_gpio(codec, mask);
319 }
320 
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)321 static void alc_fixup_gpio1(struct hda_codec *codec,
322 			    const struct hda_fixup *fix, int action)
323 {
324 	alc_fixup_gpio(codec, action, 0x01);
325 }
326 
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)327 static void alc_fixup_gpio2(struct hda_codec *codec,
328 			    const struct hda_fixup *fix, int action)
329 {
330 	alc_fixup_gpio(codec, action, 0x02);
331 }
332 
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)333 static void alc_fixup_gpio3(struct hda_codec *codec,
334 			    const struct hda_fixup *fix, int action)
335 {
336 	alc_fixup_gpio(codec, action, 0x03);
337 }
338 
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)339 static void alc_fixup_gpio4(struct hda_codec *codec,
340 			    const struct hda_fixup *fix, int action)
341 {
342 	alc_fixup_gpio(codec, action, 0x04);
343 }
344 
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)345 static void alc_fixup_micmute_led(struct hda_codec *codec,
346 				  const struct hda_fixup *fix, int action)
347 {
348 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
349 		snd_hda_gen_add_micmute_led_cdev(codec, NULL);
350 }
351 
352 /*
353  * Fix hardware PLL issue
354  * On some codecs, the analog PLL gating control must be off while
355  * the default value is 1.
356  */
alc_fix_pll(struct hda_codec * codec)357 static void alc_fix_pll(struct hda_codec *codec)
358 {
359 	struct alc_spec *spec = codec->spec;
360 
361 	if (spec->pll_nid)
362 		alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
363 				      1 << spec->pll_coef_bit, 0);
364 }
365 
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)366 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
367 			     unsigned int coef_idx, unsigned int coef_bit)
368 {
369 	struct alc_spec *spec = codec->spec;
370 	spec->pll_nid = nid;
371 	spec->pll_coef_idx = coef_idx;
372 	spec->pll_coef_bit = coef_bit;
373 	alc_fix_pll(codec);
374 }
375 
376 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)377 static void alc_update_knob_master(struct hda_codec *codec,
378 				   struct hda_jack_callback *jack)
379 {
380 	unsigned int val;
381 	struct snd_kcontrol *kctl;
382 	struct snd_ctl_elem_value *uctl;
383 
384 	kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
385 	if (!kctl)
386 		return;
387 	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
388 	if (!uctl)
389 		return;
390 	val = snd_hda_codec_read(codec, jack->nid, 0,
391 				 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
392 	val &= HDA_AMP_VOLMASK;
393 	uctl->value.integer.value[0] = val;
394 	uctl->value.integer.value[1] = val;
395 	kctl->put(kctl, uctl);
396 	kfree(uctl);
397 }
398 
alc880_unsol_event(struct hda_codec * codec,unsigned int res)399 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
400 {
401 	/* For some reason, the res given from ALC880 is broken.
402 	   Here we adjust it properly. */
403 	snd_hda_jack_unsol_event(codec, res >> 2);
404 }
405 
406 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)407 static void alc_fill_eapd_coef(struct hda_codec *codec)
408 {
409 	int coef;
410 
411 	coef = alc_get_coef0(codec);
412 
413 	switch (codec->core.vendor_id) {
414 	case 0x10ec0262:
415 		alc_update_coef_idx(codec, 0x7, 0, 1<<5);
416 		break;
417 	case 0x10ec0267:
418 	case 0x10ec0268:
419 		alc_update_coef_idx(codec, 0x7, 0, 1<<13);
420 		break;
421 	case 0x10ec0269:
422 		if ((coef & 0x00f0) == 0x0010)
423 			alc_update_coef_idx(codec, 0xd, 0, 1<<14);
424 		if ((coef & 0x00f0) == 0x0020)
425 			alc_update_coef_idx(codec, 0x4, 1<<15, 0);
426 		if ((coef & 0x00f0) == 0x0030)
427 			alc_update_coef_idx(codec, 0x10, 1<<9, 0);
428 		break;
429 	case 0x10ec0280:
430 	case 0x10ec0284:
431 	case 0x10ec0290:
432 	case 0x10ec0292:
433 		alc_update_coef_idx(codec, 0x4, 1<<15, 0);
434 		break;
435 	case 0x10ec0225:
436 	case 0x10ec0295:
437 	case 0x10ec0299:
438 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
439 		fallthrough;
440 	case 0x10ec0215:
441 	case 0x10ec0285:
442 	case 0x10ec0289:
443 		alc_update_coef_idx(codec, 0x36, 1<<13, 0);
444 		fallthrough;
445 	case 0x10ec0230:
446 	case 0x10ec0233:
447 	case 0x10ec0235:
448 	case 0x10ec0236:
449 	case 0x10ec0245:
450 	case 0x10ec0255:
451 	case 0x10ec0256:
452 	case 0x19e58326:
453 	case 0x10ec0257:
454 	case 0x10ec0282:
455 	case 0x10ec0283:
456 	case 0x10ec0286:
457 	case 0x10ec0288:
458 	case 0x10ec0298:
459 	case 0x10ec0300:
460 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
461 		break;
462 	case 0x10ec0275:
463 		alc_update_coef_idx(codec, 0xe, 0, 1<<0);
464 		break;
465 	case 0x10ec0287:
466 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
467 		alc_write_coef_idx(codec, 0x8, 0x4ab7);
468 		break;
469 	case 0x10ec0293:
470 		alc_update_coef_idx(codec, 0xa, 1<<13, 0);
471 		break;
472 	case 0x10ec0234:
473 	case 0x10ec0274:
474 	case 0x10ec0294:
475 	case 0x10ec0700:
476 	case 0x10ec0701:
477 	case 0x10ec0703:
478 	case 0x10ec0711:
479 		alc_update_coef_idx(codec, 0x10, 1<<15, 0);
480 		break;
481 	case 0x10ec0662:
482 		if ((coef & 0x00f0) == 0x0030)
483 			alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
484 		break;
485 	case 0x10ec0272:
486 	case 0x10ec0273:
487 	case 0x10ec0663:
488 	case 0x10ec0665:
489 	case 0x10ec0670:
490 	case 0x10ec0671:
491 	case 0x10ec0672:
492 		alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
493 		break;
494 	case 0x10ec0222:
495 	case 0x10ec0623:
496 		alc_update_coef_idx(codec, 0x19, 1<<13, 0);
497 		break;
498 	case 0x10ec0668:
499 		alc_update_coef_idx(codec, 0x7, 3<<13, 0);
500 		break;
501 	case 0x10ec0867:
502 		alc_update_coef_idx(codec, 0x4, 1<<10, 0);
503 		break;
504 	case 0x10ec0888:
505 		if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
506 			alc_update_coef_idx(codec, 0x7, 1<<5, 0);
507 		break;
508 	case 0x10ec0892:
509 	case 0x10ec0897:
510 		alc_update_coef_idx(codec, 0x7, 1<<5, 0);
511 		break;
512 	case 0x10ec0899:
513 	case 0x10ec0900:
514 	case 0x10ec0b00:
515 	case 0x10ec1168:
516 	case 0x10ec1220:
517 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
518 		break;
519 	}
520 }
521 
522 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)523 static void alc888_coef_init(struct hda_codec *codec)
524 {
525 	switch (alc_get_coef0(codec) & 0x00f0) {
526 	/* alc888-VA */
527 	case 0x00:
528 	/* alc888-VB */
529 	case 0x10:
530 		alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
531 		break;
532 	}
533 }
534 
535 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)536 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
537 {
538 	if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
539 		return;
540 	if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
541 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
542 				    on ? 2 : 0);
543 }
544 
545 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)546 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
547 {
548 	/* We currently only handle front, HP */
549 	static const hda_nid_t pins[] = {
550 		0x0f, 0x10, 0x14, 0x15, 0x17, 0
551 	};
552 	const hda_nid_t *p;
553 	for (p = pins; *p; p++)
554 		set_eapd(codec, *p, on);
555 }
556 
557 static int find_ext_mic_pin(struct hda_codec *codec);
558 
alc_headset_mic_no_shutup(struct hda_codec * codec)559 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
560 {
561 	const struct hda_pincfg *pin;
562 	int mic_pin = find_ext_mic_pin(codec);
563 	int i;
564 
565 	/* don't shut up pins when unloading the driver; otherwise it breaks
566 	 * the default pin setup at the next load of the driver
567 	 */
568 	if (codec->bus->shutdown)
569 		return;
570 
571 	snd_array_for_each(&codec->init_pins, i, pin) {
572 		/* use read here for syncing after issuing each verb */
573 		if (pin->nid != mic_pin)
574 			snd_hda_codec_read(codec, pin->nid, 0,
575 					AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
576 	}
577 
578 	codec->pins_shutup = 1;
579 }
580 
alc_shutup_pins(struct hda_codec * codec)581 static void alc_shutup_pins(struct hda_codec *codec)
582 {
583 	struct alc_spec *spec = codec->spec;
584 
585 	switch (codec->core.vendor_id) {
586 	case 0x10ec0236:
587 	case 0x10ec0256:
588 	case 0x10ec0257:
589 	case 0x19e58326:
590 	case 0x10ec0283:
591 	case 0x10ec0285:
592 	case 0x10ec0286:
593 	case 0x10ec0287:
594 	case 0x10ec0288:
595 	case 0x10ec0295:
596 	case 0x10ec0298:
597 		alc_headset_mic_no_shutup(codec);
598 		break;
599 	default:
600 		if (!spec->no_shutup_pins)
601 			snd_hda_shutup_pins(codec);
602 		break;
603 	}
604 }
605 
606 /* generic shutup callback;
607  * just turning off EAPD and a little pause for avoiding pop-noise
608  */
alc_eapd_shutup(struct hda_codec * codec)609 static void alc_eapd_shutup(struct hda_codec *codec)
610 {
611 	struct alc_spec *spec = codec->spec;
612 
613 	alc_auto_setup_eapd(codec, false);
614 	if (!spec->no_depop_delay)
615 		msleep(200);
616 	alc_shutup_pins(codec);
617 }
618 
619 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)620 static void alc_auto_init_amp(struct hda_codec *codec, int type)
621 {
622 	alc_auto_setup_eapd(codec, true);
623 	alc_write_gpio(codec);
624 	switch (type) {
625 	case ALC_INIT_DEFAULT:
626 		switch (codec->core.vendor_id) {
627 		case 0x10ec0260:
628 			alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
629 			break;
630 		case 0x10ec0880:
631 		case 0x10ec0882:
632 		case 0x10ec0883:
633 		case 0x10ec0885:
634 			alc_update_coef_idx(codec, 7, 0, 0x2030);
635 			break;
636 		case 0x10ec0888:
637 			alc888_coef_init(codec);
638 			break;
639 		}
640 		break;
641 	}
642 }
643 
644 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)645 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
646 {
647 	if (spec->gen.autocfg.hp_pins[0])
648 		return spec->gen.autocfg.hp_pins[0];
649 	if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
650 		return spec->gen.autocfg.line_out_pins[0];
651 	return 0;
652 }
653 
654 /*
655  * Realtek SSID verification
656  */
657 
658 /* Could be any non-zero and even value. When used as fixup, tells
659  * the driver to ignore any present sku defines.
660  */
661 #define ALC_FIXUP_SKU_IGNORE (2)
662 
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)663 static void alc_fixup_sku_ignore(struct hda_codec *codec,
664 				 const struct hda_fixup *fix, int action)
665 {
666 	struct alc_spec *spec = codec->spec;
667 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
668 		spec->cdefine.fixup = 1;
669 		spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
670 	}
671 }
672 
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)673 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
674 				    const struct hda_fixup *fix, int action)
675 {
676 	struct alc_spec *spec = codec->spec;
677 
678 	if (action == HDA_FIXUP_ACT_PROBE) {
679 		spec->no_depop_delay = 1;
680 		codec->depop_delay = 0;
681 	}
682 }
683 
alc_auto_parse_customize_define(struct hda_codec * codec)684 static int alc_auto_parse_customize_define(struct hda_codec *codec)
685 {
686 	unsigned int ass, tmp, i;
687 	unsigned nid = 0;
688 	struct alc_spec *spec = codec->spec;
689 
690 	spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
691 
692 	if (spec->cdefine.fixup) {
693 		ass = spec->cdefine.sku_cfg;
694 		if (ass == ALC_FIXUP_SKU_IGNORE)
695 			return -1;
696 		goto do_sku;
697 	}
698 
699 	if (!codec->bus->pci)
700 		return -1;
701 	ass = codec->core.subsystem_id & 0xffff;
702 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
703 		goto do_sku;
704 
705 	nid = 0x1d;
706 	if (codec->core.vendor_id == 0x10ec0260)
707 		nid = 0x17;
708 	ass = snd_hda_codec_get_pincfg(codec, nid);
709 
710 	if (!(ass & 1)) {
711 		codec_info(codec, "%s: SKU not ready 0x%08x\n",
712 			   codec->core.chip_name, ass);
713 		return -1;
714 	}
715 
716 	/* check sum */
717 	tmp = 0;
718 	for (i = 1; i < 16; i++) {
719 		if ((ass >> i) & 1)
720 			tmp++;
721 	}
722 	if (((ass >> 16) & 0xf) != tmp)
723 		return -1;
724 
725 	spec->cdefine.port_connectivity = ass >> 30;
726 	spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
727 	spec->cdefine.check_sum = (ass >> 16) & 0xf;
728 	spec->cdefine.customization = ass >> 8;
729 do_sku:
730 	spec->cdefine.sku_cfg = ass;
731 	spec->cdefine.external_amp = (ass & 0x38) >> 3;
732 	spec->cdefine.platform_type = (ass & 0x4) >> 2;
733 	spec->cdefine.swap = (ass & 0x2) >> 1;
734 	spec->cdefine.override = ass & 0x1;
735 
736 	codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
737 		   nid, spec->cdefine.sku_cfg);
738 	codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
739 		   spec->cdefine.port_connectivity);
740 	codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
741 	codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
742 	codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
743 	codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
744 	codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
745 	codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
746 	codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
747 
748 	return 0;
749 }
750 
751 /* return the position of NID in the list, or -1 if not found */
find_idx_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)752 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
753 {
754 	int i;
755 	for (i = 0; i < nums; i++)
756 		if (list[i] == nid)
757 			return i;
758 	return -1;
759 }
760 /* return true if the given NID is found in the list */
found_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)761 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
762 {
763 	return find_idx_in_nid_list(nid, list, nums) >= 0;
764 }
765 
766 /* check subsystem ID and set up device-specific initialization;
767  * return 1 if initialized, 0 if invalid SSID
768  */
769 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
770  *	31 ~ 16 :	Manufacture ID
771  *	15 ~ 8	:	SKU ID
772  *	7  ~ 0	:	Assembly ID
773  *	port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
774  */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)775 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
776 {
777 	unsigned int ass, tmp, i;
778 	unsigned nid;
779 	struct alc_spec *spec = codec->spec;
780 
781 	if (spec->cdefine.fixup) {
782 		ass = spec->cdefine.sku_cfg;
783 		if (ass == ALC_FIXUP_SKU_IGNORE)
784 			return 0;
785 		goto do_sku;
786 	}
787 
788 	ass = codec->core.subsystem_id & 0xffff;
789 	if (codec->bus->pci &&
790 	    ass != codec->bus->pci->subsystem_device && (ass & 1))
791 		goto do_sku;
792 
793 	/* invalid SSID, check the special NID pin defcfg instead */
794 	/*
795 	 * 31~30	: port connectivity
796 	 * 29~21	: reserve
797 	 * 20		: PCBEEP input
798 	 * 19~16	: Check sum (15:1)
799 	 * 15~1		: Custom
800 	 * 0		: override
801 	*/
802 	nid = 0x1d;
803 	if (codec->core.vendor_id == 0x10ec0260)
804 		nid = 0x17;
805 	ass = snd_hda_codec_get_pincfg(codec, nid);
806 	codec_dbg(codec,
807 		  "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
808 		   ass, nid);
809 	if (!(ass & 1))
810 		return 0;
811 	if ((ass >> 30) != 1)	/* no physical connection */
812 		return 0;
813 
814 	/* check sum */
815 	tmp = 0;
816 	for (i = 1; i < 16; i++) {
817 		if ((ass >> i) & 1)
818 			tmp++;
819 	}
820 	if (((ass >> 16) & 0xf) != tmp)
821 		return 0;
822 do_sku:
823 	codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
824 		   ass & 0xffff, codec->core.vendor_id);
825 	/*
826 	 * 0 : override
827 	 * 1 :	Swap Jack
828 	 * 2 : 0 --> Desktop, 1 --> Laptop
829 	 * 3~5 : External Amplifier control
830 	 * 7~6 : Reserved
831 	*/
832 	tmp = (ass & 0x38) >> 3;	/* external Amp control */
833 	if (spec->init_amp == ALC_INIT_UNDEFINED) {
834 		switch (tmp) {
835 		case 1:
836 			alc_setup_gpio(codec, 0x01);
837 			break;
838 		case 3:
839 			alc_setup_gpio(codec, 0x02);
840 			break;
841 		case 7:
842 			alc_setup_gpio(codec, 0x04);
843 			break;
844 		case 5:
845 		default:
846 			spec->init_amp = ALC_INIT_DEFAULT;
847 			break;
848 		}
849 	}
850 
851 	/* is laptop or Desktop and enable the function "Mute internal speaker
852 	 * when the external headphone out jack is plugged"
853 	 */
854 	if (!(ass & 0x8000))
855 		return 1;
856 	/*
857 	 * 10~8 : Jack location
858 	 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
859 	 * 14~13: Resvered
860 	 * 15   : 1 --> enable the function "Mute internal speaker
861 	 *	        when the external headphone out jack is plugged"
862 	 */
863 	if (!alc_get_hp_pin(spec)) {
864 		hda_nid_t nid;
865 		tmp = (ass >> 11) & 0x3;	/* HP to chassis */
866 		nid = ports[tmp];
867 		if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
868 				      spec->gen.autocfg.line_outs))
869 			return 1;
870 		spec->gen.autocfg.hp_pins[0] = nid;
871 	}
872 	return 1;
873 }
874 
875 /* Check the validity of ALC subsystem-id
876  * ports contains an array of 4 pin NIDs for port-A, E, D and I */
alc_ssid_check(struct hda_codec * codec,const hda_nid_t * ports)877 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
878 {
879 	if (!alc_subsystem_id(codec, ports)) {
880 		struct alc_spec *spec = codec->spec;
881 		if (spec->init_amp == ALC_INIT_UNDEFINED) {
882 			codec_dbg(codec,
883 				  "realtek: Enable default setup for auto mode as fallback\n");
884 			spec->init_amp = ALC_INIT_DEFAULT;
885 		}
886 	}
887 }
888 
889 /*
890  */
891 
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)892 static void alc_fixup_inv_dmic(struct hda_codec *codec,
893 			       const struct hda_fixup *fix, int action)
894 {
895 	struct alc_spec *spec = codec->spec;
896 
897 	spec->gen.inv_dmic_split = 1;
898 }
899 
900 
alc_build_controls(struct hda_codec * codec)901 static int alc_build_controls(struct hda_codec *codec)
902 {
903 	int err;
904 
905 	err = snd_hda_gen_build_controls(codec);
906 	if (err < 0)
907 		return err;
908 
909 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
910 	return 0;
911 }
912 
913 
914 /*
915  * Common callbacks
916  */
917 
alc_pre_init(struct hda_codec * codec)918 static void alc_pre_init(struct hda_codec *codec)
919 {
920 	alc_fill_eapd_coef(codec);
921 }
922 
923 #define is_s3_resume(codec) \
924 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
925 #define is_s4_resume(codec) \
926 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
927 
alc_init(struct hda_codec * codec)928 static int alc_init(struct hda_codec *codec)
929 {
930 	struct alc_spec *spec = codec->spec;
931 
932 	/* hibernation resume needs the full chip initialization */
933 	if (is_s4_resume(codec))
934 		alc_pre_init(codec);
935 
936 	if (spec->init_hook)
937 		spec->init_hook(codec);
938 
939 	spec->gen.skip_verbs = 1; /* applied in below */
940 	snd_hda_gen_init(codec);
941 	alc_fix_pll(codec);
942 	alc_auto_init_amp(codec, spec->init_amp);
943 	snd_hda_apply_verbs(codec); /* apply verbs here after own init */
944 
945 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
946 
947 	return 0;
948 }
949 
950 #define alc_free	snd_hda_gen_free
951 
952 #ifdef CONFIG_PM
alc_shutup(struct hda_codec * codec)953 static inline void alc_shutup(struct hda_codec *codec)
954 {
955 	struct alc_spec *spec = codec->spec;
956 
957 	if (!snd_hda_get_bool_hint(codec, "shutup"))
958 		return; /* disabled explicitly by hints */
959 
960 	if (spec && spec->shutup)
961 		spec->shutup(codec);
962 	else
963 		alc_shutup_pins(codec);
964 }
965 
alc_power_eapd(struct hda_codec * codec)966 static void alc_power_eapd(struct hda_codec *codec)
967 {
968 	alc_auto_setup_eapd(codec, false);
969 }
970 
alc_suspend(struct hda_codec * codec)971 static int alc_suspend(struct hda_codec *codec)
972 {
973 	struct alc_spec *spec = codec->spec;
974 	alc_shutup(codec);
975 	if (spec && spec->power_hook)
976 		spec->power_hook(codec);
977 	return 0;
978 }
979 
alc_resume(struct hda_codec * codec)980 static int alc_resume(struct hda_codec *codec)
981 {
982 	struct alc_spec *spec = codec->spec;
983 
984 	if (!spec->no_depop_delay)
985 		msleep(150); /* to avoid pop noise */
986 	codec->patch_ops.init(codec);
987 	snd_hda_regmap_sync(codec);
988 	hda_call_check_power_status(codec, 0x01);
989 	return 0;
990 }
991 #endif
992 
993 /*
994  */
995 static const struct hda_codec_ops alc_patch_ops = {
996 	.build_controls = alc_build_controls,
997 	.build_pcms = snd_hda_gen_build_pcms,
998 	.init = alc_init,
999 	.free = alc_free,
1000 	.unsol_event = snd_hda_jack_unsol_event,
1001 #ifdef CONFIG_PM
1002 	.resume = alc_resume,
1003 	.suspend = alc_suspend,
1004 	.check_power_status = snd_hda_gen_check_power_status,
1005 #endif
1006 };
1007 
1008 
1009 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1010 
1011 /*
1012  * Rename codecs appropriately from COEF value or subvendor id
1013  */
1014 struct alc_codec_rename_table {
1015 	unsigned int vendor_id;
1016 	unsigned short coef_mask;
1017 	unsigned short coef_bits;
1018 	const char *name;
1019 };
1020 
1021 struct alc_codec_rename_pci_table {
1022 	unsigned int codec_vendor_id;
1023 	unsigned short pci_subvendor;
1024 	unsigned short pci_subdevice;
1025 	const char *name;
1026 };
1027 
1028 static const struct alc_codec_rename_table rename_tbl[] = {
1029 	{ 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1030 	{ 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1031 	{ 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1032 	{ 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1033 	{ 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1034 	{ 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1035 	{ 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1036 	{ 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1037 	{ 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1038 	{ 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1039 	{ 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1040 	{ 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1041 	{ 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1042 	{ 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1043 	{ 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1044 	{ 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1045 	{ 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1046 	{ } /* terminator */
1047 };
1048 
1049 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1050 	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
1051 	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
1052 	{ 0x10ec0283, 0x1028, 0, "ALC3223" },
1053 	{ 0x10ec0288, 0x1028, 0, "ALC3263" },
1054 	{ 0x10ec0292, 0x1028, 0, "ALC3226" },
1055 	{ 0x10ec0293, 0x1028, 0, "ALC3235" },
1056 	{ 0x10ec0255, 0x1028, 0, "ALC3234" },
1057 	{ 0x10ec0668, 0x1028, 0, "ALC3661" },
1058 	{ 0x10ec0275, 0x1028, 0, "ALC3260" },
1059 	{ 0x10ec0899, 0x1028, 0, "ALC3861" },
1060 	{ 0x10ec0298, 0x1028, 0, "ALC3266" },
1061 	{ 0x10ec0236, 0x1028, 0, "ALC3204" },
1062 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
1063 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
1064 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
1065 	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
1066 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
1067 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
1068 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
1069 	{ 0x10ec0233, 0x1043, 0, "ALC3236" },
1070 	{ 0x10ec0280, 0x103c, 0, "ALC3228" },
1071 	{ 0x10ec0282, 0x103c, 0, "ALC3227" },
1072 	{ 0x10ec0286, 0x103c, 0, "ALC3242" },
1073 	{ 0x10ec0290, 0x103c, 0, "ALC3241" },
1074 	{ 0x10ec0668, 0x103c, 0, "ALC3662" },
1075 	{ 0x10ec0283, 0x17aa, 0, "ALC3239" },
1076 	{ 0x10ec0292, 0x17aa, 0, "ALC3232" },
1077 	{ } /* terminator */
1078 };
1079 
alc_codec_rename_from_preset(struct hda_codec * codec)1080 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1081 {
1082 	const struct alc_codec_rename_table *p;
1083 	const struct alc_codec_rename_pci_table *q;
1084 
1085 	for (p = rename_tbl; p->vendor_id; p++) {
1086 		if (p->vendor_id != codec->core.vendor_id)
1087 			continue;
1088 		if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1089 			return alc_codec_rename(codec, p->name);
1090 	}
1091 
1092 	if (!codec->bus->pci)
1093 		return 0;
1094 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1095 		if (q->codec_vendor_id != codec->core.vendor_id)
1096 			continue;
1097 		if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1098 			continue;
1099 		if (!q->pci_subdevice ||
1100 		    q->pci_subdevice == codec->bus->pci->subsystem_device)
1101 			return alc_codec_rename(codec, q->name);
1102 	}
1103 
1104 	return 0;
1105 }
1106 
1107 
1108 /*
1109  * Digital-beep handlers
1110  */
1111 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1112 
1113 /* additional beep mixers; private_value will be overwritten */
1114 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1115 	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1116 	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1117 };
1118 
1119 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1120 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1121 			int idx, int dir)
1122 {
1123 	struct snd_kcontrol_new *knew;
1124 	unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1125 	int i;
1126 
1127 	for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1128 		knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1129 					    &alc_beep_mixer[i]);
1130 		if (!knew)
1131 			return -ENOMEM;
1132 		knew->private_value = beep_amp;
1133 	}
1134 	return 0;
1135 }
1136 
1137 static const struct snd_pci_quirk beep_allow_list[] = {
1138 	SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1139 	SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1140 	SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1141 	SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1142 	SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1143 	SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1144 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1145 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1146 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1147 	/* denylist -- no beep available */
1148 	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1149 	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1150 	{}
1151 };
1152 
has_cdefine_beep(struct hda_codec * codec)1153 static inline int has_cdefine_beep(struct hda_codec *codec)
1154 {
1155 	struct alc_spec *spec = codec->spec;
1156 	const struct snd_pci_quirk *q;
1157 	q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1158 	if (q)
1159 		return q->value;
1160 	return spec->cdefine.enable_pcbeep;
1161 }
1162 #else
1163 #define set_beep_amp(spec, nid, idx, dir)	0
1164 #define has_cdefine_beep(codec)		0
1165 #endif
1166 
1167 /* parse the BIOS configuration and set up the alc_spec */
1168 /* return 1 if successful, 0 if the proper config is not found,
1169  * or a negative error code
1170  */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1171 static int alc_parse_auto_config(struct hda_codec *codec,
1172 				 const hda_nid_t *ignore_nids,
1173 				 const hda_nid_t *ssid_nids)
1174 {
1175 	struct alc_spec *spec = codec->spec;
1176 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1177 	int err;
1178 
1179 	err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1180 				       spec->parse_flags);
1181 	if (err < 0)
1182 		return err;
1183 
1184 	if (ssid_nids)
1185 		alc_ssid_check(codec, ssid_nids);
1186 
1187 	err = snd_hda_gen_parse_auto_config(codec, cfg);
1188 	if (err < 0)
1189 		return err;
1190 
1191 	return 1;
1192 }
1193 
1194 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1195 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1196 {
1197 	struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1198 	int err;
1199 
1200 	if (!spec)
1201 		return -ENOMEM;
1202 	codec->spec = spec;
1203 	snd_hda_gen_spec_init(&spec->gen);
1204 	spec->gen.mixer_nid = mixer_nid;
1205 	spec->gen.own_eapd_ctl = 1;
1206 	codec->single_adc_amp = 1;
1207 	/* FIXME: do we need this for all Realtek codec models? */
1208 	codec->spdif_status_reset = 1;
1209 	codec->forced_resume = 1;
1210 	codec->patch_ops = alc_patch_ops;
1211 	mutex_init(&spec->coef_mutex);
1212 
1213 	err = alc_codec_rename_from_preset(codec);
1214 	if (err < 0) {
1215 		kfree(spec);
1216 		return err;
1217 	}
1218 	return 0;
1219 }
1220 
alc880_parse_auto_config(struct hda_codec * codec)1221 static int alc880_parse_auto_config(struct hda_codec *codec)
1222 {
1223 	static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1224 	static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1225 	return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1226 }
1227 
1228 /*
1229  * ALC880 fix-ups
1230  */
1231 enum {
1232 	ALC880_FIXUP_GPIO1,
1233 	ALC880_FIXUP_GPIO2,
1234 	ALC880_FIXUP_MEDION_RIM,
1235 	ALC880_FIXUP_LG,
1236 	ALC880_FIXUP_LG_LW25,
1237 	ALC880_FIXUP_W810,
1238 	ALC880_FIXUP_EAPD_COEF,
1239 	ALC880_FIXUP_TCL_S700,
1240 	ALC880_FIXUP_VOL_KNOB,
1241 	ALC880_FIXUP_FUJITSU,
1242 	ALC880_FIXUP_F1734,
1243 	ALC880_FIXUP_UNIWILL,
1244 	ALC880_FIXUP_UNIWILL_DIG,
1245 	ALC880_FIXUP_Z71V,
1246 	ALC880_FIXUP_ASUS_W5A,
1247 	ALC880_FIXUP_3ST_BASE,
1248 	ALC880_FIXUP_3ST,
1249 	ALC880_FIXUP_3ST_DIG,
1250 	ALC880_FIXUP_5ST_BASE,
1251 	ALC880_FIXUP_5ST,
1252 	ALC880_FIXUP_5ST_DIG,
1253 	ALC880_FIXUP_6ST_BASE,
1254 	ALC880_FIXUP_6ST,
1255 	ALC880_FIXUP_6ST_DIG,
1256 	ALC880_FIXUP_6ST_AUTOMUTE,
1257 };
1258 
1259 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1260 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1261 				  const struct hda_fixup *fix, int action)
1262 {
1263 	if (action == HDA_FIXUP_ACT_PROBE)
1264 		snd_hda_jack_detect_enable_callback(codec, 0x21,
1265 						    alc_update_knob_master);
1266 }
1267 
1268 static const struct hda_fixup alc880_fixups[] = {
1269 	[ALC880_FIXUP_GPIO1] = {
1270 		.type = HDA_FIXUP_FUNC,
1271 		.v.func = alc_fixup_gpio1,
1272 	},
1273 	[ALC880_FIXUP_GPIO2] = {
1274 		.type = HDA_FIXUP_FUNC,
1275 		.v.func = alc_fixup_gpio2,
1276 	},
1277 	[ALC880_FIXUP_MEDION_RIM] = {
1278 		.type = HDA_FIXUP_VERBS,
1279 		.v.verbs = (const struct hda_verb[]) {
1280 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1281 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1282 			{ }
1283 		},
1284 		.chained = true,
1285 		.chain_id = ALC880_FIXUP_GPIO2,
1286 	},
1287 	[ALC880_FIXUP_LG] = {
1288 		.type = HDA_FIXUP_PINS,
1289 		.v.pins = (const struct hda_pintbl[]) {
1290 			/* disable bogus unused pins */
1291 			{ 0x16, 0x411111f0 },
1292 			{ 0x18, 0x411111f0 },
1293 			{ 0x1a, 0x411111f0 },
1294 			{ }
1295 		}
1296 	},
1297 	[ALC880_FIXUP_LG_LW25] = {
1298 		.type = HDA_FIXUP_PINS,
1299 		.v.pins = (const struct hda_pintbl[]) {
1300 			{ 0x1a, 0x0181344f }, /* line-in */
1301 			{ 0x1b, 0x0321403f }, /* headphone */
1302 			{ }
1303 		}
1304 	},
1305 	[ALC880_FIXUP_W810] = {
1306 		.type = HDA_FIXUP_PINS,
1307 		.v.pins = (const struct hda_pintbl[]) {
1308 			/* disable bogus unused pins */
1309 			{ 0x17, 0x411111f0 },
1310 			{ }
1311 		},
1312 		.chained = true,
1313 		.chain_id = ALC880_FIXUP_GPIO2,
1314 	},
1315 	[ALC880_FIXUP_EAPD_COEF] = {
1316 		.type = HDA_FIXUP_VERBS,
1317 		.v.verbs = (const struct hda_verb[]) {
1318 			/* change to EAPD mode */
1319 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1320 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1321 			{}
1322 		},
1323 	},
1324 	[ALC880_FIXUP_TCL_S700] = {
1325 		.type = HDA_FIXUP_VERBS,
1326 		.v.verbs = (const struct hda_verb[]) {
1327 			/* change to EAPD mode */
1328 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1329 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3070 },
1330 			{}
1331 		},
1332 		.chained = true,
1333 		.chain_id = ALC880_FIXUP_GPIO2,
1334 	},
1335 	[ALC880_FIXUP_VOL_KNOB] = {
1336 		.type = HDA_FIXUP_FUNC,
1337 		.v.func = alc880_fixup_vol_knob,
1338 	},
1339 	[ALC880_FIXUP_FUJITSU] = {
1340 		/* override all pins as BIOS on old Amilo is broken */
1341 		.type = HDA_FIXUP_PINS,
1342 		.v.pins = (const struct hda_pintbl[]) {
1343 			{ 0x14, 0x0121401f }, /* HP */
1344 			{ 0x15, 0x99030120 }, /* speaker */
1345 			{ 0x16, 0x99030130 }, /* bass speaker */
1346 			{ 0x17, 0x411111f0 }, /* N/A */
1347 			{ 0x18, 0x411111f0 }, /* N/A */
1348 			{ 0x19, 0x01a19950 }, /* mic-in */
1349 			{ 0x1a, 0x411111f0 }, /* N/A */
1350 			{ 0x1b, 0x411111f0 }, /* N/A */
1351 			{ 0x1c, 0x411111f0 }, /* N/A */
1352 			{ 0x1d, 0x411111f0 }, /* N/A */
1353 			{ 0x1e, 0x01454140 }, /* SPDIF out */
1354 			{ }
1355 		},
1356 		.chained = true,
1357 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1358 	},
1359 	[ALC880_FIXUP_F1734] = {
1360 		/* almost compatible with FUJITSU, but no bass and SPDIF */
1361 		.type = HDA_FIXUP_PINS,
1362 		.v.pins = (const struct hda_pintbl[]) {
1363 			{ 0x14, 0x0121401f }, /* HP */
1364 			{ 0x15, 0x99030120 }, /* speaker */
1365 			{ 0x16, 0x411111f0 }, /* N/A */
1366 			{ 0x17, 0x411111f0 }, /* N/A */
1367 			{ 0x18, 0x411111f0 }, /* N/A */
1368 			{ 0x19, 0x01a19950 }, /* mic-in */
1369 			{ 0x1a, 0x411111f0 }, /* N/A */
1370 			{ 0x1b, 0x411111f0 }, /* N/A */
1371 			{ 0x1c, 0x411111f0 }, /* N/A */
1372 			{ 0x1d, 0x411111f0 }, /* N/A */
1373 			{ 0x1e, 0x411111f0 }, /* N/A */
1374 			{ }
1375 		},
1376 		.chained = true,
1377 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1378 	},
1379 	[ALC880_FIXUP_UNIWILL] = {
1380 		/* need to fix HP and speaker pins to be parsed correctly */
1381 		.type = HDA_FIXUP_PINS,
1382 		.v.pins = (const struct hda_pintbl[]) {
1383 			{ 0x14, 0x0121411f }, /* HP */
1384 			{ 0x15, 0x99030120 }, /* speaker */
1385 			{ 0x16, 0x99030130 }, /* bass speaker */
1386 			{ }
1387 		},
1388 	},
1389 	[ALC880_FIXUP_UNIWILL_DIG] = {
1390 		.type = HDA_FIXUP_PINS,
1391 		.v.pins = (const struct hda_pintbl[]) {
1392 			/* disable bogus unused pins */
1393 			{ 0x17, 0x411111f0 },
1394 			{ 0x19, 0x411111f0 },
1395 			{ 0x1b, 0x411111f0 },
1396 			{ 0x1f, 0x411111f0 },
1397 			{ }
1398 		}
1399 	},
1400 	[ALC880_FIXUP_Z71V] = {
1401 		.type = HDA_FIXUP_PINS,
1402 		.v.pins = (const struct hda_pintbl[]) {
1403 			/* set up the whole pins as BIOS is utterly broken */
1404 			{ 0x14, 0x99030120 }, /* speaker */
1405 			{ 0x15, 0x0121411f }, /* HP */
1406 			{ 0x16, 0x411111f0 }, /* N/A */
1407 			{ 0x17, 0x411111f0 }, /* N/A */
1408 			{ 0x18, 0x01a19950 }, /* mic-in */
1409 			{ 0x19, 0x411111f0 }, /* N/A */
1410 			{ 0x1a, 0x01813031 }, /* line-in */
1411 			{ 0x1b, 0x411111f0 }, /* N/A */
1412 			{ 0x1c, 0x411111f0 }, /* N/A */
1413 			{ 0x1d, 0x411111f0 }, /* N/A */
1414 			{ 0x1e, 0x0144111e }, /* SPDIF */
1415 			{ }
1416 		}
1417 	},
1418 	[ALC880_FIXUP_ASUS_W5A] = {
1419 		.type = HDA_FIXUP_PINS,
1420 		.v.pins = (const struct hda_pintbl[]) {
1421 			/* set up the whole pins as BIOS is utterly broken */
1422 			{ 0x14, 0x0121411f }, /* HP */
1423 			{ 0x15, 0x411111f0 }, /* N/A */
1424 			{ 0x16, 0x411111f0 }, /* N/A */
1425 			{ 0x17, 0x411111f0 }, /* N/A */
1426 			{ 0x18, 0x90a60160 }, /* mic */
1427 			{ 0x19, 0x411111f0 }, /* N/A */
1428 			{ 0x1a, 0x411111f0 }, /* N/A */
1429 			{ 0x1b, 0x411111f0 }, /* N/A */
1430 			{ 0x1c, 0x411111f0 }, /* N/A */
1431 			{ 0x1d, 0x411111f0 }, /* N/A */
1432 			{ 0x1e, 0xb743111e }, /* SPDIF out */
1433 			{ }
1434 		},
1435 		.chained = true,
1436 		.chain_id = ALC880_FIXUP_GPIO1,
1437 	},
1438 	[ALC880_FIXUP_3ST_BASE] = {
1439 		.type = HDA_FIXUP_PINS,
1440 		.v.pins = (const struct hda_pintbl[]) {
1441 			{ 0x14, 0x01014010 }, /* line-out */
1442 			{ 0x15, 0x411111f0 }, /* N/A */
1443 			{ 0x16, 0x411111f0 }, /* N/A */
1444 			{ 0x17, 0x411111f0 }, /* N/A */
1445 			{ 0x18, 0x01a19c30 }, /* mic-in */
1446 			{ 0x19, 0x0121411f }, /* HP */
1447 			{ 0x1a, 0x01813031 }, /* line-in */
1448 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1449 			{ 0x1c, 0x411111f0 }, /* N/A */
1450 			{ 0x1d, 0x411111f0 }, /* N/A */
1451 			/* 0x1e is filled in below */
1452 			{ 0x1f, 0x411111f0 }, /* N/A */
1453 			{ }
1454 		}
1455 	},
1456 	[ALC880_FIXUP_3ST] = {
1457 		.type = HDA_FIXUP_PINS,
1458 		.v.pins = (const struct hda_pintbl[]) {
1459 			{ 0x1e, 0x411111f0 }, /* N/A */
1460 			{ }
1461 		},
1462 		.chained = true,
1463 		.chain_id = ALC880_FIXUP_3ST_BASE,
1464 	},
1465 	[ALC880_FIXUP_3ST_DIG] = {
1466 		.type = HDA_FIXUP_PINS,
1467 		.v.pins = (const struct hda_pintbl[]) {
1468 			{ 0x1e, 0x0144111e }, /* SPDIF */
1469 			{ }
1470 		},
1471 		.chained = true,
1472 		.chain_id = ALC880_FIXUP_3ST_BASE,
1473 	},
1474 	[ALC880_FIXUP_5ST_BASE] = {
1475 		.type = HDA_FIXUP_PINS,
1476 		.v.pins = (const struct hda_pintbl[]) {
1477 			{ 0x14, 0x01014010 }, /* front */
1478 			{ 0x15, 0x411111f0 }, /* N/A */
1479 			{ 0x16, 0x01011411 }, /* CLFE */
1480 			{ 0x17, 0x01016412 }, /* surr */
1481 			{ 0x18, 0x01a19c30 }, /* mic-in */
1482 			{ 0x19, 0x0121411f }, /* HP */
1483 			{ 0x1a, 0x01813031 }, /* line-in */
1484 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1485 			{ 0x1c, 0x411111f0 }, /* N/A */
1486 			{ 0x1d, 0x411111f0 }, /* N/A */
1487 			/* 0x1e is filled in below */
1488 			{ 0x1f, 0x411111f0 }, /* N/A */
1489 			{ }
1490 		}
1491 	},
1492 	[ALC880_FIXUP_5ST] = {
1493 		.type = HDA_FIXUP_PINS,
1494 		.v.pins = (const struct hda_pintbl[]) {
1495 			{ 0x1e, 0x411111f0 }, /* N/A */
1496 			{ }
1497 		},
1498 		.chained = true,
1499 		.chain_id = ALC880_FIXUP_5ST_BASE,
1500 	},
1501 	[ALC880_FIXUP_5ST_DIG] = {
1502 		.type = HDA_FIXUP_PINS,
1503 		.v.pins = (const struct hda_pintbl[]) {
1504 			{ 0x1e, 0x0144111e }, /* SPDIF */
1505 			{ }
1506 		},
1507 		.chained = true,
1508 		.chain_id = ALC880_FIXUP_5ST_BASE,
1509 	},
1510 	[ALC880_FIXUP_6ST_BASE] = {
1511 		.type = HDA_FIXUP_PINS,
1512 		.v.pins = (const struct hda_pintbl[]) {
1513 			{ 0x14, 0x01014010 }, /* front */
1514 			{ 0x15, 0x01016412 }, /* surr */
1515 			{ 0x16, 0x01011411 }, /* CLFE */
1516 			{ 0x17, 0x01012414 }, /* side */
1517 			{ 0x18, 0x01a19c30 }, /* mic-in */
1518 			{ 0x19, 0x02a19c40 }, /* front-mic */
1519 			{ 0x1a, 0x01813031 }, /* line-in */
1520 			{ 0x1b, 0x0121411f }, /* HP */
1521 			{ 0x1c, 0x411111f0 }, /* N/A */
1522 			{ 0x1d, 0x411111f0 }, /* N/A */
1523 			/* 0x1e is filled in below */
1524 			{ 0x1f, 0x411111f0 }, /* N/A */
1525 			{ }
1526 		}
1527 	},
1528 	[ALC880_FIXUP_6ST] = {
1529 		.type = HDA_FIXUP_PINS,
1530 		.v.pins = (const struct hda_pintbl[]) {
1531 			{ 0x1e, 0x411111f0 }, /* N/A */
1532 			{ }
1533 		},
1534 		.chained = true,
1535 		.chain_id = ALC880_FIXUP_6ST_BASE,
1536 	},
1537 	[ALC880_FIXUP_6ST_DIG] = {
1538 		.type = HDA_FIXUP_PINS,
1539 		.v.pins = (const struct hda_pintbl[]) {
1540 			{ 0x1e, 0x0144111e }, /* SPDIF */
1541 			{ }
1542 		},
1543 		.chained = true,
1544 		.chain_id = ALC880_FIXUP_6ST_BASE,
1545 	},
1546 	[ALC880_FIXUP_6ST_AUTOMUTE] = {
1547 		.type = HDA_FIXUP_PINS,
1548 		.v.pins = (const struct hda_pintbl[]) {
1549 			{ 0x1b, 0x0121401f }, /* HP with jack detect */
1550 			{ }
1551 		},
1552 		.chained_before = true,
1553 		.chain_id = ALC880_FIXUP_6ST_BASE,
1554 	},
1555 };
1556 
1557 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1558 	SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1559 	SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1560 	SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1561 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1562 	SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1563 	SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1564 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1565 	SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1566 	SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1567 	SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1568 	SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1569 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1570 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1571 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1572 	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1573 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1574 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1575 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1576 	SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1577 	SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1578 	SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1579 	SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1580 	SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1581 
1582 	/* Below is the copied entries from alc880_quirks.c.
1583 	 * It's not quite sure whether BIOS sets the correct pin-config table
1584 	 * on these machines, thus they are kept to be compatible with
1585 	 * the old static quirks.  Once when it's confirmed to work without
1586 	 * these overrides, it'd be better to remove.
1587 	 */
1588 	SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1589 	SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1590 	SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1591 	SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1592 	SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1593 	SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1594 	SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1595 	SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1596 	SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1597 	SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1598 	SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1599 	SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1600 	SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1601 	SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1602 	SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1603 	SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1604 	SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1605 	SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1606 	SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1607 	SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1608 	SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1609 	SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1610 	SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1611 	SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1612 	SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1613 	SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1614 	SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1615 	SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1616 	SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1617 	SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1618 	SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1619 	SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1620 	SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1621 	/* default Intel */
1622 	SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1623 	SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1624 	SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1625 	{}
1626 };
1627 
1628 static const struct hda_model_fixup alc880_fixup_models[] = {
1629 	{.id = ALC880_FIXUP_3ST, .name = "3stack"},
1630 	{.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1631 	{.id = ALC880_FIXUP_5ST, .name = "5stack"},
1632 	{.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1633 	{.id = ALC880_FIXUP_6ST, .name = "6stack"},
1634 	{.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1635 	{.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1636 	{}
1637 };
1638 
1639 
1640 /*
1641  * OK, here we have finally the patch for ALC880
1642  */
patch_alc880(struct hda_codec * codec)1643 static int patch_alc880(struct hda_codec *codec)
1644 {
1645 	struct alc_spec *spec;
1646 	int err;
1647 
1648 	err = alc_alloc_spec(codec, 0x0b);
1649 	if (err < 0)
1650 		return err;
1651 
1652 	spec = codec->spec;
1653 	spec->gen.need_dac_fix = 1;
1654 	spec->gen.beep_nid = 0x01;
1655 
1656 	codec->patch_ops.unsol_event = alc880_unsol_event;
1657 
1658 	alc_pre_init(codec);
1659 
1660 	snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1661 		       alc880_fixups);
1662 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1663 
1664 	/* automatic parse from the BIOS config */
1665 	err = alc880_parse_auto_config(codec);
1666 	if (err < 0)
1667 		goto error;
1668 
1669 	if (!spec->gen.no_analog) {
1670 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1671 		if (err < 0)
1672 			goto error;
1673 	}
1674 
1675 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1676 
1677 	return 0;
1678 
1679  error:
1680 	alc_free(codec);
1681 	return err;
1682 }
1683 
1684 
1685 /*
1686  * ALC260 support
1687  */
alc260_parse_auto_config(struct hda_codec * codec)1688 static int alc260_parse_auto_config(struct hda_codec *codec)
1689 {
1690 	static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1691 	static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1692 	return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1693 }
1694 
1695 /*
1696  * Pin config fixes
1697  */
1698 enum {
1699 	ALC260_FIXUP_HP_DC5750,
1700 	ALC260_FIXUP_HP_PIN_0F,
1701 	ALC260_FIXUP_COEF,
1702 	ALC260_FIXUP_GPIO1,
1703 	ALC260_FIXUP_GPIO1_TOGGLE,
1704 	ALC260_FIXUP_REPLACER,
1705 	ALC260_FIXUP_HP_B1900,
1706 	ALC260_FIXUP_KN1,
1707 	ALC260_FIXUP_FSC_S7020,
1708 	ALC260_FIXUP_FSC_S7020_JWSE,
1709 	ALC260_FIXUP_VAIO_PINS,
1710 };
1711 
alc260_gpio1_automute(struct hda_codec * codec)1712 static void alc260_gpio1_automute(struct hda_codec *codec)
1713 {
1714 	struct alc_spec *spec = codec->spec;
1715 
1716 	alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1717 }
1718 
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1719 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1720 				      const struct hda_fixup *fix, int action)
1721 {
1722 	struct alc_spec *spec = codec->spec;
1723 	if (action == HDA_FIXUP_ACT_PROBE) {
1724 		/* although the machine has only one output pin, we need to
1725 		 * toggle GPIO1 according to the jack state
1726 		 */
1727 		spec->gen.automute_hook = alc260_gpio1_automute;
1728 		spec->gen.detect_hp = 1;
1729 		spec->gen.automute_speaker = 1;
1730 		spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1731 		snd_hda_jack_detect_enable_callback(codec, 0x0f,
1732 						    snd_hda_gen_hp_automute);
1733 		alc_setup_gpio(codec, 0x01);
1734 	}
1735 }
1736 
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1737 static void alc260_fixup_kn1(struct hda_codec *codec,
1738 			     const struct hda_fixup *fix, int action)
1739 {
1740 	struct alc_spec *spec = codec->spec;
1741 	static const struct hda_pintbl pincfgs[] = {
1742 		{ 0x0f, 0x02214000 }, /* HP/speaker */
1743 		{ 0x12, 0x90a60160 }, /* int mic */
1744 		{ 0x13, 0x02a19000 }, /* ext mic */
1745 		{ 0x18, 0x01446000 }, /* SPDIF out */
1746 		/* disable bogus I/O pins */
1747 		{ 0x10, 0x411111f0 },
1748 		{ 0x11, 0x411111f0 },
1749 		{ 0x14, 0x411111f0 },
1750 		{ 0x15, 0x411111f0 },
1751 		{ 0x16, 0x411111f0 },
1752 		{ 0x17, 0x411111f0 },
1753 		{ 0x19, 0x411111f0 },
1754 		{ }
1755 	};
1756 
1757 	switch (action) {
1758 	case HDA_FIXUP_ACT_PRE_PROBE:
1759 		snd_hda_apply_pincfgs(codec, pincfgs);
1760 		spec->init_amp = ALC_INIT_NONE;
1761 		break;
1762 	}
1763 }
1764 
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1765 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1766 				   const struct hda_fixup *fix, int action)
1767 {
1768 	struct alc_spec *spec = codec->spec;
1769 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
1770 		spec->init_amp = ALC_INIT_NONE;
1771 }
1772 
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1773 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1774 				   const struct hda_fixup *fix, int action)
1775 {
1776 	struct alc_spec *spec = codec->spec;
1777 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1778 		spec->gen.add_jack_modes = 1;
1779 		spec->gen.hp_mic = 1;
1780 	}
1781 }
1782 
1783 static const struct hda_fixup alc260_fixups[] = {
1784 	[ALC260_FIXUP_HP_DC5750] = {
1785 		.type = HDA_FIXUP_PINS,
1786 		.v.pins = (const struct hda_pintbl[]) {
1787 			{ 0x11, 0x90130110 }, /* speaker */
1788 			{ }
1789 		}
1790 	},
1791 	[ALC260_FIXUP_HP_PIN_0F] = {
1792 		.type = HDA_FIXUP_PINS,
1793 		.v.pins = (const struct hda_pintbl[]) {
1794 			{ 0x0f, 0x01214000 }, /* HP */
1795 			{ }
1796 		}
1797 	},
1798 	[ALC260_FIXUP_COEF] = {
1799 		.type = HDA_FIXUP_VERBS,
1800 		.v.verbs = (const struct hda_verb[]) {
1801 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1802 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3040 },
1803 			{ }
1804 		},
1805 	},
1806 	[ALC260_FIXUP_GPIO1] = {
1807 		.type = HDA_FIXUP_FUNC,
1808 		.v.func = alc_fixup_gpio1,
1809 	},
1810 	[ALC260_FIXUP_GPIO1_TOGGLE] = {
1811 		.type = HDA_FIXUP_FUNC,
1812 		.v.func = alc260_fixup_gpio1_toggle,
1813 		.chained = true,
1814 		.chain_id = ALC260_FIXUP_HP_PIN_0F,
1815 	},
1816 	[ALC260_FIXUP_REPLACER] = {
1817 		.type = HDA_FIXUP_VERBS,
1818 		.v.verbs = (const struct hda_verb[]) {
1819 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1820 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3050 },
1821 			{ }
1822 		},
1823 		.chained = true,
1824 		.chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1825 	},
1826 	[ALC260_FIXUP_HP_B1900] = {
1827 		.type = HDA_FIXUP_FUNC,
1828 		.v.func = alc260_fixup_gpio1_toggle,
1829 		.chained = true,
1830 		.chain_id = ALC260_FIXUP_COEF,
1831 	},
1832 	[ALC260_FIXUP_KN1] = {
1833 		.type = HDA_FIXUP_FUNC,
1834 		.v.func = alc260_fixup_kn1,
1835 	},
1836 	[ALC260_FIXUP_FSC_S7020] = {
1837 		.type = HDA_FIXUP_FUNC,
1838 		.v.func = alc260_fixup_fsc_s7020,
1839 	},
1840 	[ALC260_FIXUP_FSC_S7020_JWSE] = {
1841 		.type = HDA_FIXUP_FUNC,
1842 		.v.func = alc260_fixup_fsc_s7020_jwse,
1843 		.chained = true,
1844 		.chain_id = ALC260_FIXUP_FSC_S7020,
1845 	},
1846 	[ALC260_FIXUP_VAIO_PINS] = {
1847 		.type = HDA_FIXUP_PINS,
1848 		.v.pins = (const struct hda_pintbl[]) {
1849 			/* Pin configs are missing completely on some VAIOs */
1850 			{ 0x0f, 0x01211020 },
1851 			{ 0x10, 0x0001003f },
1852 			{ 0x11, 0x411111f0 },
1853 			{ 0x12, 0x01a15930 },
1854 			{ 0x13, 0x411111f0 },
1855 			{ 0x14, 0x411111f0 },
1856 			{ 0x15, 0x411111f0 },
1857 			{ 0x16, 0x411111f0 },
1858 			{ 0x17, 0x411111f0 },
1859 			{ 0x18, 0x411111f0 },
1860 			{ 0x19, 0x411111f0 },
1861 			{ }
1862 		}
1863 	},
1864 };
1865 
1866 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1867 	SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1868 	SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1869 	SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1870 	SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1871 	SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1872 	SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1873 	SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1874 	SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1875 	SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1876 	SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1877 	SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1878 	SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1879 	{}
1880 };
1881 
1882 static const struct hda_model_fixup alc260_fixup_models[] = {
1883 	{.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1884 	{.id = ALC260_FIXUP_COEF, .name = "coef"},
1885 	{.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1886 	{.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1887 	{}
1888 };
1889 
1890 /*
1891  */
patch_alc260(struct hda_codec * codec)1892 static int patch_alc260(struct hda_codec *codec)
1893 {
1894 	struct alc_spec *spec;
1895 	int err;
1896 
1897 	err = alc_alloc_spec(codec, 0x07);
1898 	if (err < 0)
1899 		return err;
1900 
1901 	spec = codec->spec;
1902 	/* as quite a few machines require HP amp for speaker outputs,
1903 	 * it's easier to enable it unconditionally; even if it's unneeded,
1904 	 * it's almost harmless.
1905 	 */
1906 	spec->gen.prefer_hp_amp = 1;
1907 	spec->gen.beep_nid = 0x01;
1908 
1909 	spec->shutup = alc_eapd_shutup;
1910 
1911 	alc_pre_init(codec);
1912 
1913 	snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1914 			   alc260_fixups);
1915 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1916 
1917 	/* automatic parse from the BIOS config */
1918 	err = alc260_parse_auto_config(codec);
1919 	if (err < 0)
1920 		goto error;
1921 
1922 	if (!spec->gen.no_analog) {
1923 		err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1924 		if (err < 0)
1925 			goto error;
1926 	}
1927 
1928 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1929 
1930 	return 0;
1931 
1932  error:
1933 	alc_free(codec);
1934 	return err;
1935 }
1936 
1937 
1938 /*
1939  * ALC882/883/885/888/889 support
1940  *
1941  * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1942  * configuration.  Each pin widget can choose any input DACs and a mixer.
1943  * Each ADC is connected from a mixer of all inputs.  This makes possible
1944  * 6-channel independent captures.
1945  *
1946  * In addition, an independent DAC for the multi-playback (not used in this
1947  * driver yet).
1948  */
1949 
1950 /*
1951  * Pin config fixes
1952  */
1953 enum {
1954 	ALC882_FIXUP_ABIT_AW9D_MAX,
1955 	ALC882_FIXUP_LENOVO_Y530,
1956 	ALC882_FIXUP_PB_M5210,
1957 	ALC882_FIXUP_ACER_ASPIRE_7736,
1958 	ALC882_FIXUP_ASUS_W90V,
1959 	ALC889_FIXUP_CD,
1960 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1961 	ALC889_FIXUP_VAIO_TT,
1962 	ALC888_FIXUP_EEE1601,
1963 	ALC886_FIXUP_EAPD,
1964 	ALC882_FIXUP_EAPD,
1965 	ALC883_FIXUP_EAPD,
1966 	ALC883_FIXUP_ACER_EAPD,
1967 	ALC882_FIXUP_GPIO1,
1968 	ALC882_FIXUP_GPIO2,
1969 	ALC882_FIXUP_GPIO3,
1970 	ALC889_FIXUP_COEF,
1971 	ALC882_FIXUP_ASUS_W2JC,
1972 	ALC882_FIXUP_ACER_ASPIRE_4930G,
1973 	ALC882_FIXUP_ACER_ASPIRE_8930G,
1974 	ALC882_FIXUP_ASPIRE_8930G_VERBS,
1975 	ALC885_FIXUP_MACPRO_GPIO,
1976 	ALC889_FIXUP_DAC_ROUTE,
1977 	ALC889_FIXUP_MBP_VREF,
1978 	ALC889_FIXUP_IMAC91_VREF,
1979 	ALC889_FIXUP_MBA11_VREF,
1980 	ALC889_FIXUP_MBA21_VREF,
1981 	ALC889_FIXUP_MP11_VREF,
1982 	ALC889_FIXUP_MP41_VREF,
1983 	ALC882_FIXUP_INV_DMIC,
1984 	ALC882_FIXUP_NO_PRIMARY_HP,
1985 	ALC887_FIXUP_ASUS_BASS,
1986 	ALC887_FIXUP_BASS_CHMAP,
1987 	ALC1220_FIXUP_GB_DUAL_CODECS,
1988 	ALC1220_FIXUP_GB_X570,
1989 	ALC1220_FIXUP_CLEVO_P950,
1990 	ALC1220_FIXUP_CLEVO_PB51ED,
1991 	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1992 	ALC887_FIXUP_ASUS_AUDIO,
1993 	ALC887_FIXUP_ASUS_HMIC,
1994 	ALCS1200A_FIXUP_MIC_VREF,
1995 	ALC888VD_FIXUP_MIC_100VREF,
1996 };
1997 
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)1998 static void alc889_fixup_coef(struct hda_codec *codec,
1999 			      const struct hda_fixup *fix, int action)
2000 {
2001 	if (action != HDA_FIXUP_ACT_INIT)
2002 		return;
2003 	alc_update_coef_idx(codec, 7, 0, 0x2030);
2004 }
2005 
2006 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2007 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2008 				     const struct hda_fixup *fix, int action)
2009 {
2010 	struct alc_spec *spec = codec->spec;
2011 
2012 	spec->gpio_write_delay = true;
2013 	alc_fixup_gpio3(codec, fix, action);
2014 }
2015 
2016 /* Fix the connection of some pins for ALC889:
2017  * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2018  * work correctly (bko#42740)
2019  */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2020 static void alc889_fixup_dac_route(struct hda_codec *codec,
2021 				   const struct hda_fixup *fix, int action)
2022 {
2023 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2024 		/* fake the connections during parsing the tree */
2025 		static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2026 		static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2027 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2028 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2029 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2030 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2031 	} else if (action == HDA_FIXUP_ACT_PROBE) {
2032 		/* restore the connections */
2033 		static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2034 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2035 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2036 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2037 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2038 	}
2039 }
2040 
2041 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2042 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2043 				  const struct hda_fixup *fix, int action)
2044 {
2045 	static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2046 	struct alc_spec *spec = codec->spec;
2047 	int i;
2048 
2049 	if (action != HDA_FIXUP_ACT_INIT)
2050 		return;
2051 	for (i = 0; i < ARRAY_SIZE(nids); i++) {
2052 		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2053 		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2054 			continue;
2055 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2056 		val |= AC_PINCTL_VREF_80;
2057 		snd_hda_set_pin_ctl(codec, nids[i], val);
2058 		spec->gen.keep_vref_in_automute = 1;
2059 		break;
2060 	}
2061 }
2062 
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2063 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2064 				  const hda_nid_t *nids, int num_nids)
2065 {
2066 	struct alc_spec *spec = codec->spec;
2067 	int i;
2068 
2069 	for (i = 0; i < num_nids; i++) {
2070 		unsigned int val;
2071 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2072 		val |= AC_PINCTL_VREF_50;
2073 		snd_hda_set_pin_ctl(codec, nids[i], val);
2074 	}
2075 	spec->gen.keep_vref_in_automute = 1;
2076 }
2077 
2078 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2079 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2080 				     const struct hda_fixup *fix, int action)
2081 {
2082 	static const hda_nid_t nids[] = { 0x18, 0x1a };
2083 
2084 	if (action == HDA_FIXUP_ACT_INIT)
2085 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2086 }
2087 
2088 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2089 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2090 				    const struct hda_fixup *fix, int action)
2091 {
2092 	static const hda_nid_t nids[] = { 0x18 };
2093 
2094 	if (action == HDA_FIXUP_ACT_INIT)
2095 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2096 }
2097 
2098 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2099 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2100 				    const struct hda_fixup *fix, int action)
2101 {
2102 	static const hda_nid_t nids[] = { 0x18, 0x19 };
2103 
2104 	if (action == HDA_FIXUP_ACT_INIT)
2105 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2106 }
2107 
2108 /* Don't take HP output as primary
2109  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2110  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2111  */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2112 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2113 				       const struct hda_fixup *fix, int action)
2114 {
2115 	struct alc_spec *spec = codec->spec;
2116 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2117 		spec->gen.no_primary_hp = 1;
2118 		spec->gen.no_multi_io = 1;
2119 	}
2120 }
2121 
2122 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2123 				 const struct hda_fixup *fix, int action);
2124 
2125 /* For dual-codec configuration, we need to disable some features to avoid
2126  * conflicts of kctls and PCM streams
2127  */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2128 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2129 				  const struct hda_fixup *fix, int action)
2130 {
2131 	struct alc_spec *spec = codec->spec;
2132 
2133 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2134 		return;
2135 	/* disable vmaster */
2136 	spec->gen.suppress_vmaster = 1;
2137 	/* auto-mute and auto-mic switch don't work with multiple codecs */
2138 	spec->gen.suppress_auto_mute = 1;
2139 	spec->gen.suppress_auto_mic = 1;
2140 	/* disable aamix as well */
2141 	spec->gen.mixer_nid = 0;
2142 	/* add location prefix to avoid conflicts */
2143 	codec->force_pin_prefix = 1;
2144 }
2145 
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2146 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2147 		       const char *newname)
2148 {
2149 	struct snd_kcontrol *kctl;
2150 
2151 	kctl = snd_hda_find_mixer_ctl(codec, oldname);
2152 	if (kctl)
2153 		snd_ctl_rename(codec->card, kctl, newname);
2154 }
2155 
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2156 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2157 					 const struct hda_fixup *fix,
2158 					 int action)
2159 {
2160 	alc_fixup_dual_codecs(codec, fix, action);
2161 	switch (action) {
2162 	case HDA_FIXUP_ACT_PRE_PROBE:
2163 		/* override card longname to provide a unique UCM profile */
2164 		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2165 		break;
2166 	case HDA_FIXUP_ACT_BUILD:
2167 		/* rename Capture controls depending on the codec */
2168 		rename_ctl(codec, "Capture Volume",
2169 			   codec->addr == 0 ?
2170 			   "Rear-Panel Capture Volume" :
2171 			   "Front-Panel Capture Volume");
2172 		rename_ctl(codec, "Capture Switch",
2173 			   codec->addr == 0 ?
2174 			   "Rear-Panel Capture Switch" :
2175 			   "Front-Panel Capture Switch");
2176 		break;
2177 	}
2178 }
2179 
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2180 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2181 				     const struct hda_fixup *fix,
2182 				     int action)
2183 {
2184 	static const hda_nid_t conn1[] = { 0x0c };
2185 	static const struct coef_fw gb_x570_coefs[] = {
2186 		WRITE_COEF(0x07, 0x03c0),
2187 		WRITE_COEF(0x1a, 0x01c1),
2188 		WRITE_COEF(0x1b, 0x0202),
2189 		WRITE_COEF(0x43, 0x3005),
2190 		{}
2191 	};
2192 
2193 	switch (action) {
2194 	case HDA_FIXUP_ACT_PRE_PROBE:
2195 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2196 		snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2197 		break;
2198 	case HDA_FIXUP_ACT_INIT:
2199 		alc_process_coef_fw(codec, gb_x570_coefs);
2200 		break;
2201 	}
2202 }
2203 
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2204 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2205 				     const struct hda_fixup *fix,
2206 				     int action)
2207 {
2208 	static const hda_nid_t conn1[] = { 0x0c };
2209 
2210 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2211 		return;
2212 
2213 	alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2214 	/* We therefore want to make sure 0x14 (front headphone) and
2215 	 * 0x1b (speakers) use the stereo DAC 0x02
2216 	 */
2217 	snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2218 	snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2219 }
2220 
2221 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2222 				const struct hda_fixup *fix, int action);
2223 
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2224 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2225 				     const struct hda_fixup *fix,
2226 				     int action)
2227 {
2228 	alc1220_fixup_clevo_p950(codec, fix, action);
2229 	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2230 }
2231 
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2232 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2233 					 struct hda_jack_callback *jack)
2234 {
2235 	struct alc_spec *spec = codec->spec;
2236 	unsigned int vref;
2237 
2238 	snd_hda_gen_hp_automute(codec, jack);
2239 
2240 	if (spec->gen.hp_jack_present)
2241 		vref = AC_PINCTL_VREF_80;
2242 	else
2243 		vref = AC_PINCTL_VREF_HIZ;
2244 	snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2245 }
2246 
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2247 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2248 				     const struct hda_fixup *fix, int action)
2249 {
2250 	struct alc_spec *spec = codec->spec;
2251 	if (action != HDA_FIXUP_ACT_PROBE)
2252 		return;
2253 	snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2254 	spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2255 }
2256 
2257 static const struct hda_fixup alc882_fixups[] = {
2258 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
2259 		.type = HDA_FIXUP_PINS,
2260 		.v.pins = (const struct hda_pintbl[]) {
2261 			{ 0x15, 0x01080104 }, /* side */
2262 			{ 0x16, 0x01011012 }, /* rear */
2263 			{ 0x17, 0x01016011 }, /* clfe */
2264 			{ }
2265 		}
2266 	},
2267 	[ALC882_FIXUP_LENOVO_Y530] = {
2268 		.type = HDA_FIXUP_PINS,
2269 		.v.pins = (const struct hda_pintbl[]) {
2270 			{ 0x15, 0x99130112 }, /* rear int speakers */
2271 			{ 0x16, 0x99130111 }, /* subwoofer */
2272 			{ }
2273 		}
2274 	},
2275 	[ALC882_FIXUP_PB_M5210] = {
2276 		.type = HDA_FIXUP_PINCTLS,
2277 		.v.pins = (const struct hda_pintbl[]) {
2278 			{ 0x19, PIN_VREF50 },
2279 			{}
2280 		}
2281 	},
2282 	[ALC882_FIXUP_ACER_ASPIRE_7736] = {
2283 		.type = HDA_FIXUP_FUNC,
2284 		.v.func = alc_fixup_sku_ignore,
2285 	},
2286 	[ALC882_FIXUP_ASUS_W90V] = {
2287 		.type = HDA_FIXUP_PINS,
2288 		.v.pins = (const struct hda_pintbl[]) {
2289 			{ 0x16, 0x99130110 }, /* fix sequence for CLFE */
2290 			{ }
2291 		}
2292 	},
2293 	[ALC889_FIXUP_CD] = {
2294 		.type = HDA_FIXUP_PINS,
2295 		.v.pins = (const struct hda_pintbl[]) {
2296 			{ 0x1c, 0x993301f0 }, /* CD */
2297 			{ }
2298 		}
2299 	},
2300 	[ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2301 		.type = HDA_FIXUP_PINS,
2302 		.v.pins = (const struct hda_pintbl[]) {
2303 			{ 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2304 			{ }
2305 		},
2306 		.chained = true,
2307 		.chain_id = ALC889_FIXUP_CD,
2308 	},
2309 	[ALC889_FIXUP_VAIO_TT] = {
2310 		.type = HDA_FIXUP_PINS,
2311 		.v.pins = (const struct hda_pintbl[]) {
2312 			{ 0x17, 0x90170111 }, /* hidden surround speaker */
2313 			{ }
2314 		}
2315 	},
2316 	[ALC888_FIXUP_EEE1601] = {
2317 		.type = HDA_FIXUP_VERBS,
2318 		.v.verbs = (const struct hda_verb[]) {
2319 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2320 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x0838 },
2321 			{ }
2322 		}
2323 	},
2324 	[ALC886_FIXUP_EAPD] = {
2325 		.type = HDA_FIXUP_VERBS,
2326 		.v.verbs = (const struct hda_verb[]) {
2327 			/* change to EAPD mode */
2328 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2329 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2330 			{ }
2331 		}
2332 	},
2333 	[ALC882_FIXUP_EAPD] = {
2334 		.type = HDA_FIXUP_VERBS,
2335 		.v.verbs = (const struct hda_verb[]) {
2336 			/* change to EAPD mode */
2337 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2338 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2339 			{ }
2340 		}
2341 	},
2342 	[ALC883_FIXUP_EAPD] = {
2343 		.type = HDA_FIXUP_VERBS,
2344 		.v.verbs = (const struct hda_verb[]) {
2345 			/* change to EAPD mode */
2346 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2347 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2348 			{ }
2349 		}
2350 	},
2351 	[ALC883_FIXUP_ACER_EAPD] = {
2352 		.type = HDA_FIXUP_VERBS,
2353 		.v.verbs = (const struct hda_verb[]) {
2354 			/* eanable EAPD on Acer laptops */
2355 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2356 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2357 			{ }
2358 		}
2359 	},
2360 	[ALC882_FIXUP_GPIO1] = {
2361 		.type = HDA_FIXUP_FUNC,
2362 		.v.func = alc_fixup_gpio1,
2363 	},
2364 	[ALC882_FIXUP_GPIO2] = {
2365 		.type = HDA_FIXUP_FUNC,
2366 		.v.func = alc_fixup_gpio2,
2367 	},
2368 	[ALC882_FIXUP_GPIO3] = {
2369 		.type = HDA_FIXUP_FUNC,
2370 		.v.func = alc_fixup_gpio3,
2371 	},
2372 	[ALC882_FIXUP_ASUS_W2JC] = {
2373 		.type = HDA_FIXUP_FUNC,
2374 		.v.func = alc_fixup_gpio1,
2375 		.chained = true,
2376 		.chain_id = ALC882_FIXUP_EAPD,
2377 	},
2378 	[ALC889_FIXUP_COEF] = {
2379 		.type = HDA_FIXUP_FUNC,
2380 		.v.func = alc889_fixup_coef,
2381 	},
2382 	[ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2383 		.type = HDA_FIXUP_PINS,
2384 		.v.pins = (const struct hda_pintbl[]) {
2385 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2386 			{ 0x17, 0x99130112 }, /* surround speaker */
2387 			{ }
2388 		},
2389 		.chained = true,
2390 		.chain_id = ALC882_FIXUP_GPIO1,
2391 	},
2392 	[ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2393 		.type = HDA_FIXUP_PINS,
2394 		.v.pins = (const struct hda_pintbl[]) {
2395 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2396 			{ 0x1b, 0x99130112 }, /* surround speaker */
2397 			{ }
2398 		},
2399 		.chained = true,
2400 		.chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2401 	},
2402 	[ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2403 		/* additional init verbs for Acer Aspire 8930G */
2404 		.type = HDA_FIXUP_VERBS,
2405 		.v.verbs = (const struct hda_verb[]) {
2406 			/* Enable all DACs */
2407 			/* DAC DISABLE/MUTE 1? */
2408 			/*  setting bits 1-5 disables DAC nids 0x02-0x06
2409 			 *  apparently. Init=0x38 */
2410 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2411 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2412 			/* DAC DISABLE/MUTE 2? */
2413 			/*  some bit here disables the other DACs.
2414 			 *  Init=0x4900 */
2415 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2416 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2417 			/* DMIC fix
2418 			 * This laptop has a stereo digital microphone.
2419 			 * The mics are only 1cm apart which makes the stereo
2420 			 * useless. However, either the mic or the ALC889
2421 			 * makes the signal become a difference/sum signal
2422 			 * instead of standard stereo, which is annoying.
2423 			 * So instead we flip this bit which makes the
2424 			 * codec replicate the sum signal to both channels,
2425 			 * turning it into a normal mono mic.
2426 			 */
2427 			/* DMIC_CONTROL? Init value = 0x0001 */
2428 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2429 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2430 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2431 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2432 			{ }
2433 		},
2434 		.chained = true,
2435 		.chain_id = ALC882_FIXUP_GPIO1,
2436 	},
2437 	[ALC885_FIXUP_MACPRO_GPIO] = {
2438 		.type = HDA_FIXUP_FUNC,
2439 		.v.func = alc885_fixup_macpro_gpio,
2440 	},
2441 	[ALC889_FIXUP_DAC_ROUTE] = {
2442 		.type = HDA_FIXUP_FUNC,
2443 		.v.func = alc889_fixup_dac_route,
2444 	},
2445 	[ALC889_FIXUP_MBP_VREF] = {
2446 		.type = HDA_FIXUP_FUNC,
2447 		.v.func = alc889_fixup_mbp_vref,
2448 		.chained = true,
2449 		.chain_id = ALC882_FIXUP_GPIO1,
2450 	},
2451 	[ALC889_FIXUP_IMAC91_VREF] = {
2452 		.type = HDA_FIXUP_FUNC,
2453 		.v.func = alc889_fixup_imac91_vref,
2454 		.chained = true,
2455 		.chain_id = ALC882_FIXUP_GPIO1,
2456 	},
2457 	[ALC889_FIXUP_MBA11_VREF] = {
2458 		.type = HDA_FIXUP_FUNC,
2459 		.v.func = alc889_fixup_mba11_vref,
2460 		.chained = true,
2461 		.chain_id = ALC889_FIXUP_MBP_VREF,
2462 	},
2463 	[ALC889_FIXUP_MBA21_VREF] = {
2464 		.type = HDA_FIXUP_FUNC,
2465 		.v.func = alc889_fixup_mba21_vref,
2466 		.chained = true,
2467 		.chain_id = ALC889_FIXUP_MBP_VREF,
2468 	},
2469 	[ALC889_FIXUP_MP11_VREF] = {
2470 		.type = HDA_FIXUP_FUNC,
2471 		.v.func = alc889_fixup_mba11_vref,
2472 		.chained = true,
2473 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2474 	},
2475 	[ALC889_FIXUP_MP41_VREF] = {
2476 		.type = HDA_FIXUP_FUNC,
2477 		.v.func = alc889_fixup_mbp_vref,
2478 		.chained = true,
2479 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2480 	},
2481 	[ALC882_FIXUP_INV_DMIC] = {
2482 		.type = HDA_FIXUP_FUNC,
2483 		.v.func = alc_fixup_inv_dmic,
2484 	},
2485 	[ALC882_FIXUP_NO_PRIMARY_HP] = {
2486 		.type = HDA_FIXUP_FUNC,
2487 		.v.func = alc882_fixup_no_primary_hp,
2488 	},
2489 	[ALC887_FIXUP_ASUS_BASS] = {
2490 		.type = HDA_FIXUP_PINS,
2491 		.v.pins = (const struct hda_pintbl[]) {
2492 			{0x16, 0x99130130}, /* bass speaker */
2493 			{}
2494 		},
2495 		.chained = true,
2496 		.chain_id = ALC887_FIXUP_BASS_CHMAP,
2497 	},
2498 	[ALC887_FIXUP_BASS_CHMAP] = {
2499 		.type = HDA_FIXUP_FUNC,
2500 		.v.func = alc_fixup_bass_chmap,
2501 	},
2502 	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
2503 		.type = HDA_FIXUP_FUNC,
2504 		.v.func = alc1220_fixup_gb_dual_codecs,
2505 	},
2506 	[ALC1220_FIXUP_GB_X570] = {
2507 		.type = HDA_FIXUP_FUNC,
2508 		.v.func = alc1220_fixup_gb_x570,
2509 	},
2510 	[ALC1220_FIXUP_CLEVO_P950] = {
2511 		.type = HDA_FIXUP_FUNC,
2512 		.v.func = alc1220_fixup_clevo_p950,
2513 	},
2514 	[ALC1220_FIXUP_CLEVO_PB51ED] = {
2515 		.type = HDA_FIXUP_FUNC,
2516 		.v.func = alc1220_fixup_clevo_pb51ed,
2517 	},
2518 	[ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2519 		.type = HDA_FIXUP_PINS,
2520 		.v.pins = (const struct hda_pintbl[]) {
2521 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2522 			{}
2523 		},
2524 		.chained = true,
2525 		.chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2526 	},
2527 	[ALC887_FIXUP_ASUS_AUDIO] = {
2528 		.type = HDA_FIXUP_PINS,
2529 		.v.pins = (const struct hda_pintbl[]) {
2530 			{ 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2531 			{ 0x19, 0x22219420 },
2532 			{}
2533 		},
2534 	},
2535 	[ALC887_FIXUP_ASUS_HMIC] = {
2536 		.type = HDA_FIXUP_FUNC,
2537 		.v.func = alc887_fixup_asus_jack,
2538 		.chained = true,
2539 		.chain_id = ALC887_FIXUP_ASUS_AUDIO,
2540 	},
2541 	[ALCS1200A_FIXUP_MIC_VREF] = {
2542 		.type = HDA_FIXUP_PINCTLS,
2543 		.v.pins = (const struct hda_pintbl[]) {
2544 			{ 0x18, PIN_VREF50 }, /* rear mic */
2545 			{ 0x19, PIN_VREF50 }, /* front mic */
2546 			{}
2547 		}
2548 	},
2549 	[ALC888VD_FIXUP_MIC_100VREF] = {
2550 		.type = HDA_FIXUP_PINCTLS,
2551 		.v.pins = (const struct hda_pintbl[]) {
2552 			{ 0x18, PIN_VREF100 }, /* headset mic */
2553 			{}
2554 		}
2555 	},
2556 };
2557 
2558 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2559 	SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2560 	SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2561 	SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2562 	SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2563 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2564 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2565 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2566 	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2567 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2568 	SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2569 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2570 	SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2571 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2572 	SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2573 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2574 	SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2575 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2576 	SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2577 	SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2578 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2579 	SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2580 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2581 	SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2582 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2583 	SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2584 	SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2585 	SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2586 	SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2587 	SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2588 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2589 	SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2590 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2591 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2592 	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2593 	SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2594 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2595 	SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2596 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2597 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2598 	SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2599 
2600 	/* All Apple entries are in codec SSIDs */
2601 	SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2602 	SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2603 	SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2604 	SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2605 	SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2606 	SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2607 	SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2608 	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2609 	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2610 	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2611 	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2612 	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2613 	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2614 	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2615 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2616 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2617 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2618 	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2619 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2620 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2621 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2622 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2623 
2624 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2625 	SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2626 	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2627 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2628 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2629 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2630 	SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2631 	SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2632 	SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2633 	SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2634 	SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2635 	SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2636 	SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2637 	SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2638 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2639 	SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2640 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2641 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2642 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2643 	SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2644 	SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2645 	SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2646 	SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2647 	SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2648 	SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2649 	SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2650 	SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2651 	SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2652 	SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2653 	SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2654 	SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2655 	SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2656 	SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 	SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 	SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 	SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 	SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2661 	SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2662 	SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2663 	SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2664 	SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2665 	SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2666 	SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2667 	SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2668 	SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2669 	SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2670 	SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2671 	SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2672 	SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2673 	SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2674 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2675 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2676 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2677 	SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2678 	{}
2679 };
2680 
2681 static const struct hda_model_fixup alc882_fixup_models[] = {
2682 	{.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2683 	{.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2684 	{.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2685 	{.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2686 	{.id = ALC889_FIXUP_CD, .name = "cd"},
2687 	{.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2688 	{.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2689 	{.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2690 	{.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2691 	{.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2692 	{.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2693 	{.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2694 	{.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2695 	{.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2696 	{.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2697 	{.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2698 	{.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2699 	{.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2700 	{.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2701 	{.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2702 	{.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2703 	{.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2704 	{.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2705 	{.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2706 	{.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2707 	{.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2708 	{.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2709 	{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2710 	{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2711 	{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2712 	{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2713 	{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2714 	{}
2715 };
2716 
2717 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2718 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2719 		{0x14, 0x01014010},
2720 		{0x15, 0x01011012},
2721 		{0x16, 0x01016011},
2722 		{0x18, 0x01a19040},
2723 		{0x19, 0x02a19050},
2724 		{0x1a, 0x0181304f},
2725 		{0x1b, 0x0221401f},
2726 		{0x1e, 0x01456130}),
2727 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2728 		{0x14, 0x01015010},
2729 		{0x15, 0x01011012},
2730 		{0x16, 0x01011011},
2731 		{0x18, 0x01a11040},
2732 		{0x19, 0x02a19050},
2733 		{0x1a, 0x0181104f},
2734 		{0x1b, 0x0221401f},
2735 		{0x1e, 0x01451130}),
2736 	{}
2737 };
2738 
2739 /*
2740  * BIOS auto configuration
2741  */
2742 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2743 static int alc882_parse_auto_config(struct hda_codec *codec)
2744 {
2745 	static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2746 	static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2747 	return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2748 }
2749 
2750 /*
2751  */
patch_alc882(struct hda_codec * codec)2752 static int patch_alc882(struct hda_codec *codec)
2753 {
2754 	struct alc_spec *spec;
2755 	int err;
2756 
2757 	err = alc_alloc_spec(codec, 0x0b);
2758 	if (err < 0)
2759 		return err;
2760 
2761 	spec = codec->spec;
2762 
2763 	switch (codec->core.vendor_id) {
2764 	case 0x10ec0882:
2765 	case 0x10ec0885:
2766 	case 0x10ec0900:
2767 	case 0x10ec0b00:
2768 	case 0x10ec1220:
2769 		break;
2770 	default:
2771 		/* ALC883 and variants */
2772 		alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2773 		break;
2774 	}
2775 
2776 	alc_pre_init(codec);
2777 
2778 	snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2779 		       alc882_fixups);
2780 	snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2781 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2782 
2783 	alc_auto_parse_customize_define(codec);
2784 
2785 	if (has_cdefine_beep(codec))
2786 		spec->gen.beep_nid = 0x01;
2787 
2788 	/* automatic parse from the BIOS config */
2789 	err = alc882_parse_auto_config(codec);
2790 	if (err < 0)
2791 		goto error;
2792 
2793 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2794 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2795 		if (err < 0)
2796 			goto error;
2797 	}
2798 
2799 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2800 
2801 	return 0;
2802 
2803  error:
2804 	alc_free(codec);
2805 	return err;
2806 }
2807 
2808 
2809 /*
2810  * ALC262 support
2811  */
alc262_parse_auto_config(struct hda_codec * codec)2812 static int alc262_parse_auto_config(struct hda_codec *codec)
2813 {
2814 	static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2815 	static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2816 	return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2817 }
2818 
2819 /*
2820  * Pin config fixes
2821  */
2822 enum {
2823 	ALC262_FIXUP_FSC_H270,
2824 	ALC262_FIXUP_FSC_S7110,
2825 	ALC262_FIXUP_HP_Z200,
2826 	ALC262_FIXUP_TYAN,
2827 	ALC262_FIXUP_LENOVO_3000,
2828 	ALC262_FIXUP_BENQ,
2829 	ALC262_FIXUP_BENQ_T31,
2830 	ALC262_FIXUP_INV_DMIC,
2831 	ALC262_FIXUP_INTEL_BAYLEYBAY,
2832 };
2833 
2834 static const struct hda_fixup alc262_fixups[] = {
2835 	[ALC262_FIXUP_FSC_H270] = {
2836 		.type = HDA_FIXUP_PINS,
2837 		.v.pins = (const struct hda_pintbl[]) {
2838 			{ 0x14, 0x99130110 }, /* speaker */
2839 			{ 0x15, 0x0221142f }, /* front HP */
2840 			{ 0x1b, 0x0121141f }, /* rear HP */
2841 			{ }
2842 		}
2843 	},
2844 	[ALC262_FIXUP_FSC_S7110] = {
2845 		.type = HDA_FIXUP_PINS,
2846 		.v.pins = (const struct hda_pintbl[]) {
2847 			{ 0x15, 0x90170110 }, /* speaker */
2848 			{ }
2849 		},
2850 		.chained = true,
2851 		.chain_id = ALC262_FIXUP_BENQ,
2852 	},
2853 	[ALC262_FIXUP_HP_Z200] = {
2854 		.type = HDA_FIXUP_PINS,
2855 		.v.pins = (const struct hda_pintbl[]) {
2856 			{ 0x16, 0x99130120 }, /* internal speaker */
2857 			{ }
2858 		}
2859 	},
2860 	[ALC262_FIXUP_TYAN] = {
2861 		.type = HDA_FIXUP_PINS,
2862 		.v.pins = (const struct hda_pintbl[]) {
2863 			{ 0x14, 0x1993e1f0 }, /* int AUX */
2864 			{ }
2865 		}
2866 	},
2867 	[ALC262_FIXUP_LENOVO_3000] = {
2868 		.type = HDA_FIXUP_PINCTLS,
2869 		.v.pins = (const struct hda_pintbl[]) {
2870 			{ 0x19, PIN_VREF50 },
2871 			{}
2872 		},
2873 		.chained = true,
2874 		.chain_id = ALC262_FIXUP_BENQ,
2875 	},
2876 	[ALC262_FIXUP_BENQ] = {
2877 		.type = HDA_FIXUP_VERBS,
2878 		.v.verbs = (const struct hda_verb[]) {
2879 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2880 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2881 			{}
2882 		}
2883 	},
2884 	[ALC262_FIXUP_BENQ_T31] = {
2885 		.type = HDA_FIXUP_VERBS,
2886 		.v.verbs = (const struct hda_verb[]) {
2887 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2888 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2889 			{}
2890 		}
2891 	},
2892 	[ALC262_FIXUP_INV_DMIC] = {
2893 		.type = HDA_FIXUP_FUNC,
2894 		.v.func = alc_fixup_inv_dmic,
2895 	},
2896 	[ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2897 		.type = HDA_FIXUP_FUNC,
2898 		.v.func = alc_fixup_no_depop_delay,
2899 	},
2900 };
2901 
2902 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2903 	SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2904 	SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2905 	SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2906 	SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2907 	SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2908 	SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2909 	SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2910 	SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2911 	SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2912 	SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2913 	{}
2914 };
2915 
2916 static const struct hda_model_fixup alc262_fixup_models[] = {
2917 	{.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2918 	{.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2919 	{.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2920 	{.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2921 	{.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2922 	{.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2923 	{.id = ALC262_FIXUP_BENQ, .name = "benq"},
2924 	{.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2925 	{.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2926 	{}
2927 };
2928 
2929 /*
2930  */
patch_alc262(struct hda_codec * codec)2931 static int patch_alc262(struct hda_codec *codec)
2932 {
2933 	struct alc_spec *spec;
2934 	int err;
2935 
2936 	err = alc_alloc_spec(codec, 0x0b);
2937 	if (err < 0)
2938 		return err;
2939 
2940 	spec = codec->spec;
2941 	spec->gen.shared_mic_vref_pin = 0x18;
2942 
2943 	spec->shutup = alc_eapd_shutup;
2944 
2945 #if 0
2946 	/* pshou 07/11/05  set a zero PCM sample to DAC when FIFO is
2947 	 * under-run
2948 	 */
2949 	alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2950 #endif
2951 	alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2952 
2953 	alc_pre_init(codec);
2954 
2955 	snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2956 		       alc262_fixups);
2957 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2958 
2959 	alc_auto_parse_customize_define(codec);
2960 
2961 	if (has_cdefine_beep(codec))
2962 		spec->gen.beep_nid = 0x01;
2963 
2964 	/* automatic parse from the BIOS config */
2965 	err = alc262_parse_auto_config(codec);
2966 	if (err < 0)
2967 		goto error;
2968 
2969 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2970 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2971 		if (err < 0)
2972 			goto error;
2973 	}
2974 
2975 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2976 
2977 	return 0;
2978 
2979  error:
2980 	alc_free(codec);
2981 	return err;
2982 }
2983 
2984 /*
2985  *  ALC268
2986  */
2987 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)2988 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2989 				  struct snd_ctl_elem_value *ucontrol)
2990 {
2991 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2992 	unsigned long pval;
2993 	int err;
2994 
2995 	mutex_lock(&codec->control_mutex);
2996 	pval = kcontrol->private_value;
2997 	kcontrol->private_value = (pval & ~0xff) | 0x0f;
2998 	err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2999 	if (err >= 0) {
3000 		kcontrol->private_value = (pval & ~0xff) | 0x10;
3001 		err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3002 	}
3003 	kcontrol->private_value = pval;
3004 	mutex_unlock(&codec->control_mutex);
3005 	return err;
3006 }
3007 
3008 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3009 	HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3010 	{
3011 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3012 		.name = "Beep Playback Switch",
3013 		.subdevice = HDA_SUBDEV_AMP_FLAG,
3014 		.info = snd_hda_mixer_amp_switch_info,
3015 		.get = snd_hda_mixer_amp_switch_get,
3016 		.put = alc268_beep_switch_put,
3017 		.private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3018 	},
3019 };
3020 
3021 /* set PCBEEP vol = 0, mute connections */
3022 static const struct hda_verb alc268_beep_init_verbs[] = {
3023 	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3024 	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3025 	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3026 	{ }
3027 };
3028 
3029 enum {
3030 	ALC268_FIXUP_INV_DMIC,
3031 	ALC268_FIXUP_HP_EAPD,
3032 	ALC268_FIXUP_SPDIF,
3033 };
3034 
3035 static const struct hda_fixup alc268_fixups[] = {
3036 	[ALC268_FIXUP_INV_DMIC] = {
3037 		.type = HDA_FIXUP_FUNC,
3038 		.v.func = alc_fixup_inv_dmic,
3039 	},
3040 	[ALC268_FIXUP_HP_EAPD] = {
3041 		.type = HDA_FIXUP_VERBS,
3042 		.v.verbs = (const struct hda_verb[]) {
3043 			{0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3044 			{}
3045 		}
3046 	},
3047 	[ALC268_FIXUP_SPDIF] = {
3048 		.type = HDA_FIXUP_PINS,
3049 		.v.pins = (const struct hda_pintbl[]) {
3050 			{ 0x1e, 0x014b1180 }, /* enable SPDIF out */
3051 			{}
3052 		}
3053 	},
3054 };
3055 
3056 static const struct hda_model_fixup alc268_fixup_models[] = {
3057 	{.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3058 	{.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3059 	{.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3060 	{}
3061 };
3062 
3063 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
3064 	SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3065 	SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3066 	/* below is codec SSID since multiple Toshiba laptops have the
3067 	 * same PCI SSID 1179:ff00
3068 	 */
3069 	SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3070 	{}
3071 };
3072 
3073 /*
3074  * BIOS auto configuration
3075  */
alc268_parse_auto_config(struct hda_codec * codec)3076 static int alc268_parse_auto_config(struct hda_codec *codec)
3077 {
3078 	static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3079 	return alc_parse_auto_config(codec, NULL, alc268_ssids);
3080 }
3081 
3082 /*
3083  */
patch_alc268(struct hda_codec * codec)3084 static int patch_alc268(struct hda_codec *codec)
3085 {
3086 	struct alc_spec *spec;
3087 	int i, err;
3088 
3089 	/* ALC268 has no aa-loopback mixer */
3090 	err = alc_alloc_spec(codec, 0);
3091 	if (err < 0)
3092 		return err;
3093 
3094 	spec = codec->spec;
3095 	if (has_cdefine_beep(codec))
3096 		spec->gen.beep_nid = 0x01;
3097 
3098 	spec->shutup = alc_eapd_shutup;
3099 
3100 	alc_pre_init(codec);
3101 
3102 	snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3103 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3104 
3105 	/* automatic parse from the BIOS config */
3106 	err = alc268_parse_auto_config(codec);
3107 	if (err < 0)
3108 		goto error;
3109 
3110 	if (err > 0 && !spec->gen.no_analog &&
3111 	    spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3112 		for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3113 			if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3114 						  &alc268_beep_mixer[i])) {
3115 				err = -ENOMEM;
3116 				goto error;
3117 			}
3118 		}
3119 		snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3120 		if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3121 			/* override the amp caps for beep generator */
3122 			snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3123 					  (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3124 					  (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3125 					  (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3126 					  (0 << AC_AMPCAP_MUTE_SHIFT));
3127 	}
3128 
3129 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3130 
3131 	return 0;
3132 
3133  error:
3134 	alc_free(codec);
3135 	return err;
3136 }
3137 
3138 /*
3139  * ALC269
3140  */
3141 
3142 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3143 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3144 };
3145 
3146 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3147 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3148 };
3149 
3150 /* different alc269-variants */
3151 enum {
3152 	ALC269_TYPE_ALC269VA,
3153 	ALC269_TYPE_ALC269VB,
3154 	ALC269_TYPE_ALC269VC,
3155 	ALC269_TYPE_ALC269VD,
3156 	ALC269_TYPE_ALC280,
3157 	ALC269_TYPE_ALC282,
3158 	ALC269_TYPE_ALC283,
3159 	ALC269_TYPE_ALC284,
3160 	ALC269_TYPE_ALC293,
3161 	ALC269_TYPE_ALC286,
3162 	ALC269_TYPE_ALC298,
3163 	ALC269_TYPE_ALC255,
3164 	ALC269_TYPE_ALC256,
3165 	ALC269_TYPE_ALC257,
3166 	ALC269_TYPE_ALC215,
3167 	ALC269_TYPE_ALC225,
3168 	ALC269_TYPE_ALC245,
3169 	ALC269_TYPE_ALC287,
3170 	ALC269_TYPE_ALC294,
3171 	ALC269_TYPE_ALC300,
3172 	ALC269_TYPE_ALC623,
3173 	ALC269_TYPE_ALC700,
3174 };
3175 
3176 /*
3177  * BIOS auto configuration
3178  */
alc269_parse_auto_config(struct hda_codec * codec)3179 static int alc269_parse_auto_config(struct hda_codec *codec)
3180 {
3181 	static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3182 	static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3183 	static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3184 	struct alc_spec *spec = codec->spec;
3185 	const hda_nid_t *ssids;
3186 
3187 	switch (spec->codec_variant) {
3188 	case ALC269_TYPE_ALC269VA:
3189 	case ALC269_TYPE_ALC269VC:
3190 	case ALC269_TYPE_ALC280:
3191 	case ALC269_TYPE_ALC284:
3192 	case ALC269_TYPE_ALC293:
3193 		ssids = alc269va_ssids;
3194 		break;
3195 	case ALC269_TYPE_ALC269VB:
3196 	case ALC269_TYPE_ALC269VD:
3197 	case ALC269_TYPE_ALC282:
3198 	case ALC269_TYPE_ALC283:
3199 	case ALC269_TYPE_ALC286:
3200 	case ALC269_TYPE_ALC298:
3201 	case ALC269_TYPE_ALC255:
3202 	case ALC269_TYPE_ALC256:
3203 	case ALC269_TYPE_ALC257:
3204 	case ALC269_TYPE_ALC215:
3205 	case ALC269_TYPE_ALC225:
3206 	case ALC269_TYPE_ALC245:
3207 	case ALC269_TYPE_ALC287:
3208 	case ALC269_TYPE_ALC294:
3209 	case ALC269_TYPE_ALC300:
3210 	case ALC269_TYPE_ALC623:
3211 	case ALC269_TYPE_ALC700:
3212 		ssids = alc269_ssids;
3213 		break;
3214 	default:
3215 		ssids = alc269_ssids;
3216 		break;
3217 	}
3218 
3219 	return alc_parse_auto_config(codec, alc269_ignore, ssids);
3220 }
3221 
3222 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3223 	{ SND_JACK_BTN_0, KEY_PLAYPAUSE },
3224 	{ SND_JACK_BTN_1, KEY_VOICECOMMAND },
3225 	{ SND_JACK_BTN_2, KEY_VOLUMEUP },
3226 	{ SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3227 	{}
3228 };
3229 
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3230 static void alc_headset_btn_callback(struct hda_codec *codec,
3231 				     struct hda_jack_callback *jack)
3232 {
3233 	int report = 0;
3234 
3235 	if (jack->unsol_res & (7 << 13))
3236 		report |= SND_JACK_BTN_0;
3237 
3238 	if (jack->unsol_res  & (1 << 16 | 3 << 8))
3239 		report |= SND_JACK_BTN_1;
3240 
3241 	/* Volume up key */
3242 	if (jack->unsol_res & (7 << 23))
3243 		report |= SND_JACK_BTN_2;
3244 
3245 	/* Volume down key */
3246 	if (jack->unsol_res & (7 << 10))
3247 		report |= SND_JACK_BTN_3;
3248 
3249 	snd_hda_jack_set_button_state(codec, jack->nid, report);
3250 }
3251 
alc_disable_headset_jack_key(struct hda_codec * codec)3252 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3253 {
3254 	struct alc_spec *spec = codec->spec;
3255 
3256 	if (!spec->has_hs_key)
3257 		return;
3258 
3259 	switch (codec->core.vendor_id) {
3260 	case 0x10ec0215:
3261 	case 0x10ec0225:
3262 	case 0x10ec0285:
3263 	case 0x10ec0287:
3264 	case 0x10ec0295:
3265 	case 0x10ec0289:
3266 	case 0x10ec0299:
3267 		alc_write_coef_idx(codec, 0x48, 0x0);
3268 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3269 		alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3270 		break;
3271 	case 0x10ec0230:
3272 	case 0x10ec0236:
3273 	case 0x10ec0256:
3274 	case 0x10ec0257:
3275 	case 0x19e58326:
3276 		alc_write_coef_idx(codec, 0x48, 0x0);
3277 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3278 		break;
3279 	}
3280 }
3281 
alc_enable_headset_jack_key(struct hda_codec * codec)3282 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3283 {
3284 	struct alc_spec *spec = codec->spec;
3285 
3286 	if (!spec->has_hs_key)
3287 		return;
3288 
3289 	switch (codec->core.vendor_id) {
3290 	case 0x10ec0215:
3291 	case 0x10ec0225:
3292 	case 0x10ec0285:
3293 	case 0x10ec0287:
3294 	case 0x10ec0295:
3295 	case 0x10ec0289:
3296 	case 0x10ec0299:
3297 		alc_write_coef_idx(codec, 0x48, 0xd011);
3298 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3299 		alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3300 		break;
3301 	case 0x10ec0230:
3302 	case 0x10ec0236:
3303 	case 0x10ec0256:
3304 	case 0x10ec0257:
3305 	case 0x19e58326:
3306 		alc_write_coef_idx(codec, 0x48, 0xd011);
3307 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3308 		break;
3309 	}
3310 }
3311 
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3312 static void alc_fixup_headset_jack(struct hda_codec *codec,
3313 				    const struct hda_fixup *fix, int action)
3314 {
3315 	struct alc_spec *spec = codec->spec;
3316 	hda_nid_t hp_pin;
3317 
3318 	switch (action) {
3319 	case HDA_FIXUP_ACT_PRE_PROBE:
3320 		spec->has_hs_key = 1;
3321 		snd_hda_jack_detect_enable_callback(codec, 0x55,
3322 						    alc_headset_btn_callback);
3323 		break;
3324 	case HDA_FIXUP_ACT_BUILD:
3325 		hp_pin = alc_get_hp_pin(spec);
3326 		if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3327 							alc_headset_btn_keymap,
3328 							hp_pin))
3329 			snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3330 					      false, SND_JACK_HEADSET,
3331 					      alc_headset_btn_keymap);
3332 
3333 		alc_enable_headset_jack_key(codec);
3334 		break;
3335 	}
3336 }
3337 
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3338 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3339 {
3340 	alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3341 }
3342 
alc269_shutup(struct hda_codec * codec)3343 static void alc269_shutup(struct hda_codec *codec)
3344 {
3345 	struct alc_spec *spec = codec->spec;
3346 
3347 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3348 		alc269vb_toggle_power_output(codec, 0);
3349 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3350 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3351 		msleep(150);
3352 	}
3353 	alc_shutup_pins(codec);
3354 }
3355 
3356 static const struct coef_fw alc282_coefs[] = {
3357 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3358 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3359 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3360 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3361 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3362 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3363 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3364 	WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3365 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3366 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3367 	WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3368 	UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3369 	WRITE_COEF(0x34, 0xa0c0), /* ANC */
3370 	UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3371 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3372 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3373 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3374 	WRITE_COEF(0x63, 0x2902), /* PLL */
3375 	WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3376 	WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3377 	WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3378 	WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3379 	UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3380 	WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3381 	UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3382 	WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3383 	WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3384 	UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3385 	WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3386 	{}
3387 };
3388 
alc282_restore_default_value(struct hda_codec * codec)3389 static void alc282_restore_default_value(struct hda_codec *codec)
3390 {
3391 	alc_process_coef_fw(codec, alc282_coefs);
3392 }
3393 
alc282_init(struct hda_codec * codec)3394 static void alc282_init(struct hda_codec *codec)
3395 {
3396 	struct alc_spec *spec = codec->spec;
3397 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3398 	bool hp_pin_sense;
3399 	int coef78;
3400 
3401 	alc282_restore_default_value(codec);
3402 
3403 	if (!hp_pin)
3404 		return;
3405 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3406 	coef78 = alc_read_coef_idx(codec, 0x78);
3407 
3408 	/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3409 	/* Headphone capless set to high power mode */
3410 	alc_write_coef_idx(codec, 0x78, 0x9004);
3411 
3412 	if (hp_pin_sense)
3413 		msleep(2);
3414 
3415 	snd_hda_codec_write(codec, hp_pin, 0,
3416 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3417 
3418 	if (hp_pin_sense)
3419 		msleep(85);
3420 
3421 	snd_hda_codec_write(codec, hp_pin, 0,
3422 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3423 
3424 	if (hp_pin_sense)
3425 		msleep(100);
3426 
3427 	/* Headphone capless set to normal mode */
3428 	alc_write_coef_idx(codec, 0x78, coef78);
3429 }
3430 
alc282_shutup(struct hda_codec * codec)3431 static void alc282_shutup(struct hda_codec *codec)
3432 {
3433 	struct alc_spec *spec = codec->spec;
3434 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3435 	bool hp_pin_sense;
3436 	int coef78;
3437 
3438 	if (!hp_pin) {
3439 		alc269_shutup(codec);
3440 		return;
3441 	}
3442 
3443 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3444 	coef78 = alc_read_coef_idx(codec, 0x78);
3445 	alc_write_coef_idx(codec, 0x78, 0x9004);
3446 
3447 	if (hp_pin_sense)
3448 		msleep(2);
3449 
3450 	snd_hda_codec_write(codec, hp_pin, 0,
3451 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3452 
3453 	if (hp_pin_sense)
3454 		msleep(85);
3455 
3456 	if (!spec->no_shutup_pins)
3457 		snd_hda_codec_write(codec, hp_pin, 0,
3458 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3459 
3460 	if (hp_pin_sense)
3461 		msleep(100);
3462 
3463 	alc_auto_setup_eapd(codec, false);
3464 	alc_shutup_pins(codec);
3465 	alc_write_coef_idx(codec, 0x78, coef78);
3466 }
3467 
3468 static const struct coef_fw alc283_coefs[] = {
3469 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3470 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3471 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3472 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3473 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3474 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3475 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3476 	WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3477 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3478 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3479 	WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3480 	UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3481 	WRITE_COEF(0x22, 0xa0c0), /* ANC */
3482 	UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3483 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3484 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3485 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3486 	WRITE_COEF(0x2e, 0x2902), /* PLL */
3487 	WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3488 	WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3489 	WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3490 	WRITE_COEF(0x36, 0x0), /* capless control 5 */
3491 	UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3492 	WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3493 	UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3494 	WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3495 	WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3496 	UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3497 	WRITE_COEF(0x49, 0x0), /* test mode */
3498 	UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3499 	UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3500 	WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3501 	UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3502 	{}
3503 };
3504 
alc283_restore_default_value(struct hda_codec * codec)3505 static void alc283_restore_default_value(struct hda_codec *codec)
3506 {
3507 	alc_process_coef_fw(codec, alc283_coefs);
3508 }
3509 
alc283_init(struct hda_codec * codec)3510 static void alc283_init(struct hda_codec *codec)
3511 {
3512 	struct alc_spec *spec = codec->spec;
3513 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3514 	bool hp_pin_sense;
3515 
3516 	alc283_restore_default_value(codec);
3517 
3518 	if (!hp_pin)
3519 		return;
3520 
3521 	msleep(30);
3522 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3523 
3524 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3525 	/* Headphone capless set to high power mode */
3526 	alc_write_coef_idx(codec, 0x43, 0x9004);
3527 
3528 	snd_hda_codec_write(codec, hp_pin, 0,
3529 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3530 
3531 	if (hp_pin_sense)
3532 		msleep(85);
3533 
3534 	snd_hda_codec_write(codec, hp_pin, 0,
3535 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3536 
3537 	if (hp_pin_sense)
3538 		msleep(85);
3539 	/* Index 0x46 Combo jack auto switch control 2 */
3540 	/* 3k pull low control for Headset jack. */
3541 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3542 	/* Headphone capless set to normal mode */
3543 	alc_write_coef_idx(codec, 0x43, 0x9614);
3544 }
3545 
alc283_shutup(struct hda_codec * codec)3546 static void alc283_shutup(struct hda_codec *codec)
3547 {
3548 	struct alc_spec *spec = codec->spec;
3549 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3550 	bool hp_pin_sense;
3551 
3552 	if (!hp_pin) {
3553 		alc269_shutup(codec);
3554 		return;
3555 	}
3556 
3557 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3558 
3559 	alc_write_coef_idx(codec, 0x43, 0x9004);
3560 
3561 	/*depop hp during suspend*/
3562 	alc_write_coef_idx(codec, 0x06, 0x2100);
3563 
3564 	snd_hda_codec_write(codec, hp_pin, 0,
3565 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3566 
3567 	if (hp_pin_sense)
3568 		msleep(100);
3569 
3570 	if (!spec->no_shutup_pins)
3571 		snd_hda_codec_write(codec, hp_pin, 0,
3572 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3573 
3574 	alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3575 
3576 	if (hp_pin_sense)
3577 		msleep(100);
3578 	alc_auto_setup_eapd(codec, false);
3579 	alc_shutup_pins(codec);
3580 	alc_write_coef_idx(codec, 0x43, 0x9614);
3581 }
3582 
alc256_init(struct hda_codec * codec)3583 static void alc256_init(struct hda_codec *codec)
3584 {
3585 	struct alc_spec *spec = codec->spec;
3586 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3587 	bool hp_pin_sense;
3588 
3589 	if (spec->ultra_low_power) {
3590 		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3591 		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3592 		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3593 		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3594 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3595 		msleep(30);
3596 	}
3597 
3598 	if (!hp_pin)
3599 		hp_pin = 0x21;
3600 
3601 	msleep(30);
3602 
3603 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3604 
3605 	if (hp_pin_sense)
3606 		msleep(2);
3607 
3608 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3609 
3610 	snd_hda_codec_write(codec, hp_pin, 0,
3611 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3612 
3613 	if (hp_pin_sense || spec->ultra_low_power)
3614 		msleep(85);
3615 
3616 	snd_hda_codec_write(codec, hp_pin, 0,
3617 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3618 
3619 	if (hp_pin_sense || spec->ultra_low_power)
3620 		msleep(100);
3621 
3622 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3623 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3624 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3625 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3626 	/*
3627 	 * Expose headphone mic (or possibly Line In on some machines) instead
3628 	 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3629 	 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3630 	 * this register.
3631 	 */
3632 	alc_write_coef_idx(codec, 0x36, 0x5757);
3633 }
3634 
alc256_shutup(struct hda_codec * codec)3635 static void alc256_shutup(struct hda_codec *codec)
3636 {
3637 	struct alc_spec *spec = codec->spec;
3638 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3639 	bool hp_pin_sense;
3640 
3641 	if (!hp_pin)
3642 		hp_pin = 0x21;
3643 
3644 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3645 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3646 
3647 	if (hp_pin_sense)
3648 		msleep(2);
3649 
3650 	snd_hda_codec_write(codec, hp_pin, 0,
3651 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3652 
3653 	if (hp_pin_sense || spec->ultra_low_power)
3654 		msleep(85);
3655 
3656 	/* 3k pull low control for Headset jack. */
3657 	/* NOTE: call this before clearing the pin, otherwise codec stalls */
3658 	/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3659 	 * when booting with headset plugged. So skip setting it for the codec alc257
3660 	 */
3661 	if (spec->en_3kpull_low)
3662 		alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3663 
3664 	if (!spec->no_shutup_pins)
3665 		snd_hda_codec_write(codec, hp_pin, 0,
3666 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3667 
3668 	if (hp_pin_sense || spec->ultra_low_power)
3669 		msleep(100);
3670 
3671 	alc_auto_setup_eapd(codec, false);
3672 	alc_shutup_pins(codec);
3673 	if (spec->ultra_low_power) {
3674 		msleep(50);
3675 		alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3676 		alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3677 		alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3678 		alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3679 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3680 		msleep(30);
3681 	}
3682 }
3683 
alc285_hp_init(struct hda_codec * codec)3684 static void alc285_hp_init(struct hda_codec *codec)
3685 {
3686 	struct alc_spec *spec = codec->spec;
3687 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3688 	int i, val;
3689 	int coef38, coef0d, coef36;
3690 
3691 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3692 	alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3693 	coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3694 	coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3695 	coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3696 	alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3697 	alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3698 
3699 	alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3700 
3701 	if (hp_pin)
3702 		snd_hda_codec_write(codec, hp_pin, 0,
3703 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3704 
3705 	msleep(130);
3706 	alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3707 	alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3708 
3709 	if (hp_pin)
3710 		snd_hda_codec_write(codec, hp_pin, 0,
3711 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3712 	msleep(10);
3713 	alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3714 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3715 	alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3716 	alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3717 
3718 	alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3719 	val = alc_read_coefex_idx(codec, 0x58, 0x00);
3720 	for (i = 0; i < 20 && val & 0x8000; i++) {
3721 		msleep(50);
3722 		val = alc_read_coefex_idx(codec, 0x58, 0x00);
3723 	} /* Wait for depop procedure finish  */
3724 
3725 	alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3726 	alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3727 	alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3728 	alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3729 
3730 	msleep(50);
3731 	alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3732 }
3733 
alc225_init(struct hda_codec * codec)3734 static void alc225_init(struct hda_codec *codec)
3735 {
3736 	struct alc_spec *spec = codec->spec;
3737 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3738 	bool hp1_pin_sense, hp2_pin_sense;
3739 
3740 	if (spec->ultra_low_power) {
3741 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3742 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3743 		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3744 		msleep(30);
3745 	}
3746 
3747 	if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3748 		spec->codec_variant != ALC269_TYPE_ALC245)
3749 		/* required only at boot or S3 and S4 resume time */
3750 		if (!spec->done_hp_init ||
3751 			is_s3_resume(codec) ||
3752 			is_s4_resume(codec)) {
3753 			alc285_hp_init(codec);
3754 			spec->done_hp_init = true;
3755 		}
3756 
3757 	if (!hp_pin)
3758 		hp_pin = 0x21;
3759 	msleep(30);
3760 
3761 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3762 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3763 
3764 	if (hp1_pin_sense || hp2_pin_sense)
3765 		msleep(2);
3766 
3767 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3768 
3769 	if (hp1_pin_sense || spec->ultra_low_power)
3770 		snd_hda_codec_write(codec, hp_pin, 0,
3771 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3772 	if (hp2_pin_sense)
3773 		snd_hda_codec_write(codec, 0x16, 0,
3774 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3775 
3776 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3777 		msleep(85);
3778 
3779 	if (hp1_pin_sense || spec->ultra_low_power)
3780 		snd_hda_codec_write(codec, hp_pin, 0,
3781 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3782 	if (hp2_pin_sense)
3783 		snd_hda_codec_write(codec, 0x16, 0,
3784 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3785 
3786 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3787 		msleep(100);
3788 
3789 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3790 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3791 }
3792 
alc225_shutup(struct hda_codec * codec)3793 static void alc225_shutup(struct hda_codec *codec)
3794 {
3795 	struct alc_spec *spec = codec->spec;
3796 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3797 	bool hp1_pin_sense, hp2_pin_sense;
3798 
3799 	if (!hp_pin)
3800 		hp_pin = 0x21;
3801 
3802 	alc_disable_headset_jack_key(codec);
3803 	/* 3k pull low control for Headset jack. */
3804 	alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3805 
3806 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3807 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3808 
3809 	if (hp1_pin_sense || hp2_pin_sense)
3810 		msleep(2);
3811 
3812 	if (hp1_pin_sense || spec->ultra_low_power)
3813 		snd_hda_codec_write(codec, hp_pin, 0,
3814 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3815 	if (hp2_pin_sense)
3816 		snd_hda_codec_write(codec, 0x16, 0,
3817 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3818 
3819 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3820 		msleep(85);
3821 
3822 	if (hp1_pin_sense || spec->ultra_low_power)
3823 		snd_hda_codec_write(codec, hp_pin, 0,
3824 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3825 	if (hp2_pin_sense)
3826 		snd_hda_codec_write(codec, 0x16, 0,
3827 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3828 
3829 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3830 		msleep(100);
3831 
3832 	alc_auto_setup_eapd(codec, false);
3833 	alc_shutup_pins(codec);
3834 	if (spec->ultra_low_power) {
3835 		msleep(50);
3836 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3837 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3838 		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3839 		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3840 		msleep(30);
3841 	}
3842 
3843 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3844 	alc_enable_headset_jack_key(codec);
3845 }
3846 
alc_default_init(struct hda_codec * codec)3847 static void alc_default_init(struct hda_codec *codec)
3848 {
3849 	struct alc_spec *spec = codec->spec;
3850 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3851 	bool hp_pin_sense;
3852 
3853 	if (!hp_pin)
3854 		return;
3855 
3856 	msleep(30);
3857 
3858 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3859 
3860 	if (hp_pin_sense) {
3861 		msleep(2);
3862 
3863 		snd_hda_codec_write(codec, hp_pin, 0,
3864 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3865 
3866 		msleep(75);
3867 
3868 		snd_hda_codec_write(codec, hp_pin, 0,
3869 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3870 		msleep(75);
3871 	}
3872 }
3873 
alc_default_shutup(struct hda_codec * codec)3874 static void alc_default_shutup(struct hda_codec *codec)
3875 {
3876 	struct alc_spec *spec = codec->spec;
3877 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3878 	bool hp_pin_sense;
3879 
3880 	if (!hp_pin) {
3881 		alc269_shutup(codec);
3882 		return;
3883 	}
3884 
3885 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3886 
3887 	if (hp_pin_sense) {
3888 		msleep(2);
3889 
3890 		snd_hda_codec_write(codec, hp_pin, 0,
3891 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3892 
3893 		msleep(75);
3894 
3895 		if (!spec->no_shutup_pins)
3896 			snd_hda_codec_write(codec, hp_pin, 0,
3897 					    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3898 
3899 		msleep(75);
3900 	}
3901 	alc_auto_setup_eapd(codec, false);
3902 	alc_shutup_pins(codec);
3903 }
3904 
alc294_hp_init(struct hda_codec * codec)3905 static void alc294_hp_init(struct hda_codec *codec)
3906 {
3907 	struct alc_spec *spec = codec->spec;
3908 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3909 	int i, val;
3910 
3911 	if (!hp_pin)
3912 		return;
3913 
3914 	snd_hda_codec_write(codec, hp_pin, 0,
3915 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3916 
3917 	msleep(100);
3918 
3919 	if (!spec->no_shutup_pins)
3920 		snd_hda_codec_write(codec, hp_pin, 0,
3921 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3922 
3923 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3924 	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3925 
3926 	/* Wait for depop procedure finish  */
3927 	val = alc_read_coefex_idx(codec, 0x58, 0x01);
3928 	for (i = 0; i < 20 && val & 0x0080; i++) {
3929 		msleep(50);
3930 		val = alc_read_coefex_idx(codec, 0x58, 0x01);
3931 	}
3932 	/* Set HP depop to auto mode */
3933 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3934 	msleep(50);
3935 }
3936 
alc294_init(struct hda_codec * codec)3937 static void alc294_init(struct hda_codec *codec)
3938 {
3939 	struct alc_spec *spec = codec->spec;
3940 
3941 	/* required only at boot or S4 resume time */
3942 	if (!spec->done_hp_init ||
3943 	    codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3944 		alc294_hp_init(codec);
3945 		spec->done_hp_init = true;
3946 	}
3947 	alc_default_init(codec);
3948 }
3949 
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)3950 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3951 			     unsigned int val)
3952 {
3953 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3954 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3955 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3956 }
3957 
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)3958 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3959 {
3960 	unsigned int val;
3961 
3962 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3963 	val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3964 		& 0xffff;
3965 	val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3966 		<< 16;
3967 	return val;
3968 }
3969 
alc5505_dsp_halt(struct hda_codec * codec)3970 static void alc5505_dsp_halt(struct hda_codec *codec)
3971 {
3972 	unsigned int val;
3973 
3974 	alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3975 	alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3976 	alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3977 	alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3978 	alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3979 	alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3980 	alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3981 	val = alc5505_coef_get(codec, 0x6220);
3982 	alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3983 }
3984 
alc5505_dsp_back_from_halt(struct hda_codec * codec)3985 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3986 {
3987 	alc5505_coef_set(codec, 0x61b8, 0x04133302);
3988 	alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3989 	alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3990 	alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3991 	alc5505_coef_set(codec, 0x6220, 0x2002010f);
3992 	alc5505_coef_set(codec, 0x880c, 0x00000004);
3993 }
3994 
alc5505_dsp_init(struct hda_codec * codec)3995 static void alc5505_dsp_init(struct hda_codec *codec)
3996 {
3997 	unsigned int val;
3998 
3999 	alc5505_dsp_halt(codec);
4000 	alc5505_dsp_back_from_halt(codec);
4001 	alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
4002 	alc5505_coef_set(codec, 0x61b0, 0x5b16);
4003 	alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
4004 	alc5505_coef_set(codec, 0x61b4, 0x04132b02);
4005 	alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
4006 	alc5505_coef_set(codec, 0x61b8, 0x041f3302);
4007 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
4008 	alc5505_coef_set(codec, 0x61b8, 0x041b3302);
4009 	alc5505_coef_set(codec, 0x61b8, 0x04173302);
4010 	alc5505_coef_set(codec, 0x61b8, 0x04163302);
4011 	alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4012 	alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4013 	alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4014 
4015 	val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4016 	if (val <= 3)
4017 		alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4018 	else
4019 		alc5505_coef_set(codec, 0x6220, 0x6002018f);
4020 
4021 	alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4022 	alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4023 	alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4024 	alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4025 	alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4026 	alc5505_coef_set(codec, 0x880c, 0x00000003);
4027 	alc5505_coef_set(codec, 0x880c, 0x00000010);
4028 
4029 #ifdef HALT_REALTEK_ALC5505
4030 	alc5505_dsp_halt(codec);
4031 #endif
4032 }
4033 
4034 #ifdef HALT_REALTEK_ALC5505
4035 #define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
4036 #define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
4037 #else
4038 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
4039 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
4040 #endif
4041 
4042 #ifdef CONFIG_PM
alc269_suspend(struct hda_codec * codec)4043 static int alc269_suspend(struct hda_codec *codec)
4044 {
4045 	struct alc_spec *spec = codec->spec;
4046 
4047 	if (spec->has_alc5505_dsp)
4048 		alc5505_dsp_suspend(codec);
4049 
4050 	return alc_suspend(codec);
4051 }
4052 
alc269_resume(struct hda_codec * codec)4053 static int alc269_resume(struct hda_codec *codec)
4054 {
4055 	struct alc_spec *spec = codec->spec;
4056 
4057 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4058 		alc269vb_toggle_power_output(codec, 0);
4059 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4060 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
4061 		msleep(150);
4062 	}
4063 
4064 	codec->patch_ops.init(codec);
4065 
4066 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4067 		alc269vb_toggle_power_output(codec, 1);
4068 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4069 			(alc_get_coef0(codec) & 0x00ff) == 0x017) {
4070 		msleep(200);
4071 	}
4072 
4073 	snd_hda_regmap_sync(codec);
4074 	hda_call_check_power_status(codec, 0x01);
4075 
4076 	/* on some machine, the BIOS will clear the codec gpio data when enter
4077 	 * suspend, and won't restore the data after resume, so we restore it
4078 	 * in the driver.
4079 	 */
4080 	if (spec->gpio_data)
4081 		alc_write_gpio_data(codec);
4082 
4083 	if (spec->has_alc5505_dsp)
4084 		alc5505_dsp_resume(codec);
4085 
4086 	return 0;
4087 }
4088 #endif /* CONFIG_PM */
4089 
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4090 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4091 						 const struct hda_fixup *fix, int action)
4092 {
4093 	struct alc_spec *spec = codec->spec;
4094 
4095 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4096 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4097 }
4098 
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4099 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4100 						 const struct hda_fixup *fix,
4101 						 int action)
4102 {
4103 	unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4104 	unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4105 
4106 	if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4107 		snd_hda_codec_set_pincfg(codec, 0x19,
4108 			(cfg_headphone & ~AC_DEFCFG_DEVICE) |
4109 			(AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4110 }
4111 
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4112 static void alc269_fixup_hweq(struct hda_codec *codec,
4113 			       const struct hda_fixup *fix, int action)
4114 {
4115 	if (action == HDA_FIXUP_ACT_INIT)
4116 		alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4117 }
4118 
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4119 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4120 				       const struct hda_fixup *fix, int action)
4121 {
4122 	struct alc_spec *spec = codec->spec;
4123 
4124 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4125 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4126 }
4127 
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4128 static void alc271_fixup_dmic(struct hda_codec *codec,
4129 			      const struct hda_fixup *fix, int action)
4130 {
4131 	static const struct hda_verb verbs[] = {
4132 		{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4133 		{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4134 		{}
4135 	};
4136 	unsigned int cfg;
4137 
4138 	if (strcmp(codec->core.chip_name, "ALC271X") &&
4139 	    strcmp(codec->core.chip_name, "ALC269VB"))
4140 		return;
4141 	cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4142 	if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4143 		snd_hda_sequence_write(codec, verbs);
4144 }
4145 
4146 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4147 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4148 					  const struct hda_fixup *fix,
4149 					  int action)
4150 {
4151 	if (action == HDA_FIXUP_ACT_INIT)
4152 		alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4153 }
4154 
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4155 static void alc269_fixup_pcm_44k(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_PROBE)
4161 		return;
4162 
4163 	/* Due to a hardware problem on Lenovo Ideadpad, we need to
4164 	 * fix the sample rate of analog I/O to 44.1kHz
4165 	 */
4166 	spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4167 	spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4168 }
4169 
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4170 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4171 				     const struct hda_fixup *fix, int action)
4172 {
4173 	/* The digital-mic unit sends PDM (differential signal) instead of
4174 	 * the standard PCM, thus you can't record a valid mono stream as is.
4175 	 * Below is a workaround specific to ALC269 to control the dmic
4176 	 * signal source as mono.
4177 	 */
4178 	if (action == HDA_FIXUP_ACT_INIT)
4179 		alc_update_coef_idx(codec, 0x07, 0, 0x80);
4180 }
4181 
alc269_quanta_automute(struct hda_codec * codec)4182 static void alc269_quanta_automute(struct hda_codec *codec)
4183 {
4184 	snd_hda_gen_update_outputs(codec);
4185 
4186 	alc_write_coef_idx(codec, 0x0c, 0x680);
4187 	alc_write_coef_idx(codec, 0x0c, 0x480);
4188 }
4189 
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4190 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4191 				     const struct hda_fixup *fix, int action)
4192 {
4193 	struct alc_spec *spec = codec->spec;
4194 	if (action != HDA_FIXUP_ACT_PROBE)
4195 		return;
4196 	spec->gen.automute_hook = alc269_quanta_automute;
4197 }
4198 
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4199 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4200 					 struct hda_jack_callback *jack)
4201 {
4202 	struct alc_spec *spec = codec->spec;
4203 	int vref;
4204 	msleep(200);
4205 	snd_hda_gen_hp_automute(codec, jack);
4206 
4207 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4208 	msleep(100);
4209 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4210 			    vref);
4211 	msleep(500);
4212 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4213 			    vref);
4214 }
4215 
4216 /*
4217  * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4218  */
4219 struct hda_alc298_mbxinit {
4220 	unsigned char value_0x23;
4221 	unsigned char value_0x25;
4222 };
4223 
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4224 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4225 					 const struct hda_alc298_mbxinit *initval,
4226 					 bool first)
4227 {
4228 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4229 	alc_write_coef_idx(codec, 0x26, 0xb000);
4230 
4231 	if (first)
4232 		snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4233 
4234 	snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4235 	alc_write_coef_idx(codec, 0x26, 0xf000);
4236 	alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4237 
4238 	if (initval->value_0x23 != 0x1e)
4239 		alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4240 
4241 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4242 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4243 }
4244 
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4245 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4246 					   const struct hda_fixup *fix,
4247 					   int action)
4248 {
4249 	/* Initialization magic */
4250 	static const struct hda_alc298_mbxinit dac_init[] = {
4251 		{0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4252 		{0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4253 		{0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4254 		{0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4255 		{0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4256 		{0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4257 		{0x2f, 0x00},
4258 		{0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4259 		{0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4260 		{0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4261 		{}
4262 	};
4263 	const struct hda_alc298_mbxinit *seq;
4264 
4265 	if (action != HDA_FIXUP_ACT_INIT)
4266 		return;
4267 
4268 	/* Start */
4269 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4270 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4271 	alc_write_coef_idx(codec, 0x26, 0xf000);
4272 	alc_write_coef_idx(codec, 0x22, 0x31);
4273 	alc_write_coef_idx(codec, 0x23, 0x0b);
4274 	alc_write_coef_idx(codec, 0x25, 0x00);
4275 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4276 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4277 
4278 	for (seq = dac_init; seq->value_0x23; seq++)
4279 		alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4280 }
4281 
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4282 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4283 				     const struct hda_fixup *fix, int action)
4284 {
4285 	struct alc_spec *spec = codec->spec;
4286 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4287 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4288 		spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4289 	}
4290 }
4291 
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4292 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4293 				bool polarity, bool on)
4294 {
4295 	unsigned int pinval;
4296 
4297 	if (!pin)
4298 		return;
4299 	if (polarity)
4300 		on = !on;
4301 	pinval = snd_hda_codec_get_pin_target(codec, pin);
4302 	pinval &= ~AC_PINCTL_VREFEN;
4303 	pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4304 	/* temporarily power up/down for setting VREF */
4305 	snd_hda_power_up_pm(codec);
4306 	snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4307 	snd_hda_power_down_pm(codec);
4308 }
4309 
4310 /* 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)4311 static int vref_mute_led_set(struct led_classdev *led_cdev,
4312 			     enum led_brightness brightness)
4313 {
4314 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4315 	struct alc_spec *spec = codec->spec;
4316 
4317 	alc_update_vref_led(codec, spec->mute_led_nid,
4318 			    spec->mute_led_polarity, brightness);
4319 	return 0;
4320 }
4321 
4322 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4323 static unsigned int led_power_filter(struct hda_codec *codec,
4324 						  hda_nid_t nid,
4325 						  unsigned int power_state)
4326 {
4327 	struct alc_spec *spec = codec->spec;
4328 
4329 	if (power_state != AC_PWRST_D3 || nid == 0 ||
4330 	    (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4331 		return power_state;
4332 
4333 	/* Set pin ctl again, it might have just been set to 0 */
4334 	snd_hda_set_pin_ctl(codec, nid,
4335 			    snd_hda_codec_get_pin_target(codec, nid));
4336 
4337 	return snd_hda_gen_path_power_filter(codec, nid, power_state);
4338 }
4339 
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4340 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4341 				     const struct hda_fixup *fix, int action)
4342 {
4343 	struct alc_spec *spec = codec->spec;
4344 	const struct dmi_device *dev = NULL;
4345 
4346 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4347 		return;
4348 
4349 	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4350 		int pol, pin;
4351 		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4352 			continue;
4353 		if (pin < 0x0a || pin >= 0x10)
4354 			break;
4355 		spec->mute_led_polarity = pol;
4356 		spec->mute_led_nid = pin - 0x0a + 0x18;
4357 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4358 		codec->power_filter = led_power_filter;
4359 		codec_dbg(codec,
4360 			  "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4361 			   spec->mute_led_polarity);
4362 		break;
4363 	}
4364 }
4365 
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4366 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4367 					  const struct hda_fixup *fix,
4368 					  int action, hda_nid_t pin)
4369 {
4370 	struct alc_spec *spec = codec->spec;
4371 
4372 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4373 		spec->mute_led_polarity = 0;
4374 		spec->mute_led_nid = pin;
4375 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4376 		codec->power_filter = led_power_filter;
4377 	}
4378 }
4379 
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4380 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4381 				const struct hda_fixup *fix, int action)
4382 {
4383 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4384 }
4385 
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4386 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4387 				const struct hda_fixup *fix, int action)
4388 {
4389 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4390 }
4391 
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4392 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4393 				const struct hda_fixup *fix, int action)
4394 {
4395 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4396 }
4397 
4398 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4399 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4400 				int polarity, bool enabled)
4401 {
4402 	if (polarity)
4403 		enabled = !enabled;
4404 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4405 }
4406 
4407 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4408 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4409 			     enum led_brightness brightness)
4410 {
4411 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4412 	struct alc_spec *spec = codec->spec;
4413 
4414 	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4415 			    spec->mute_led_polarity, !brightness);
4416 	return 0;
4417 }
4418 
4419 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4420 static int micmute_led_set(struct led_classdev *led_cdev,
4421 			   enum led_brightness brightness)
4422 {
4423 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4424 	struct alc_spec *spec = codec->spec;
4425 
4426 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4427 			    spec->micmute_led_polarity, !brightness);
4428 	return 0;
4429 }
4430 
4431 /* 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)4432 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4433 				  int action,
4434 				  unsigned int mute_mask,
4435 				  unsigned int micmute_mask)
4436 {
4437 	struct alc_spec *spec = codec->spec;
4438 
4439 	alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4440 
4441 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4442 		return;
4443 	if (mute_mask) {
4444 		spec->gpio_mute_led_mask = mute_mask;
4445 		snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4446 	}
4447 	if (micmute_mask) {
4448 		spec->gpio_mic_led_mask = micmute_mask;
4449 		snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4450 	}
4451 }
4452 
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4453 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4454 				const struct hda_fixup *fix, int action)
4455 {
4456 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4457 }
4458 
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4459 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4460 				const struct hda_fixup *fix, int action)
4461 {
4462 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4463 }
4464 
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4465 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4466 				const struct hda_fixup *fix, int action)
4467 {
4468 	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4469 }
4470 
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4471 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4472 				const struct hda_fixup *fix, int action)
4473 {
4474 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4475 }
4476 
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4477 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4478 				const struct hda_fixup *fix, int action)
4479 {
4480 	alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4481 }
4482 
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4483 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4484 				const struct hda_fixup *fix, int action)
4485 {
4486 	struct alc_spec *spec = codec->spec;
4487 
4488 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4489 		spec->micmute_led_polarity = 1;
4490 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4491 }
4492 
4493 /* 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)4494 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4495 				enum led_brightness brightness)
4496 {
4497 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4498 	struct alc_spec *spec = codec->spec;
4499 
4500 	alc_update_vref_led(codec, spec->cap_mute_led_nid,
4501 			    spec->micmute_led_polarity, brightness);
4502 	return 0;
4503 }
4504 
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4505 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4506 				const struct hda_fixup *fix, int action)
4507 {
4508 	struct alc_spec *spec = codec->spec;
4509 
4510 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4511 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4512 		/* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4513 		 * enable headphone amp
4514 		 */
4515 		spec->gpio_mask |= 0x10;
4516 		spec->gpio_dir |= 0x10;
4517 		spec->cap_mute_led_nid = 0x18;
4518 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4519 		codec->power_filter = led_power_filter;
4520 	}
4521 }
4522 
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4523 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4524 				   const struct hda_fixup *fix, int action)
4525 {
4526 	struct alc_spec *spec = codec->spec;
4527 
4528 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4529 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4530 		spec->cap_mute_led_nid = 0x18;
4531 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4532 		codec->power_filter = led_power_filter;
4533 	}
4534 }
4535 
4536 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4537  * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4538  */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4539 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4540 				     const struct hda_fixup *fix, int action)
4541 {
4542 	struct alc_spec *spec = codec->spec;
4543 
4544 	switch (action) {
4545 	case HDA_FIXUP_ACT_PRE_PROBE:
4546 		spec->gpio_mask |= 0x01;
4547 		spec->gpio_dir |= 0x01;
4548 		break;
4549 	case HDA_FIXUP_ACT_INIT:
4550 		/* need to toggle GPIO to enable the amp */
4551 		alc_update_gpio_data(codec, 0x01, true);
4552 		msleep(100);
4553 		alc_update_gpio_data(codec, 0x01, false);
4554 		break;
4555 	}
4556 }
4557 
4558 /* 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)4559 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4560 				    struct hda_codec *codec,
4561 				    struct snd_pcm_substream *substream,
4562 				    int action)
4563 {
4564 	switch (action) {
4565 	case HDA_GEN_PCM_ACT_PREPARE:
4566 		alc_update_gpio_data(codec, 0x04, true);
4567 		break;
4568 	case HDA_GEN_PCM_ACT_CLEANUP:
4569 		alc_update_gpio_data(codec, 0x04, false);
4570 		break;
4571 	}
4572 }
4573 
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4574 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4575 				      const struct hda_fixup *fix,
4576 				      int action)
4577 {
4578 	struct alc_spec *spec = codec->spec;
4579 
4580 	if (action == HDA_FIXUP_ACT_PROBE) {
4581 		spec->gpio_mask |= 0x04;
4582 		spec->gpio_dir |= 0x04;
4583 		spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4584 	}
4585 }
4586 
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4587 static void alc_update_coef_led(struct hda_codec *codec,
4588 				struct alc_coef_led *led,
4589 				bool polarity, bool on)
4590 {
4591 	if (polarity)
4592 		on = !on;
4593 	/* temporarily power up/down for setting COEF bit */
4594 	alc_update_coef_idx(codec, led->idx, led->mask,
4595 			    on ? led->on : led->off);
4596 }
4597 
4598 /* 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)4599 static int coef_mute_led_set(struct led_classdev *led_cdev,
4600 			     enum led_brightness brightness)
4601 {
4602 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4603 	struct alc_spec *spec = codec->spec;
4604 
4605 	alc_update_coef_led(codec, &spec->mute_led_coef,
4606 			    spec->mute_led_polarity, brightness);
4607 	return 0;
4608 }
4609 
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4610 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4611 					  const struct hda_fixup *fix,
4612 					  int action)
4613 {
4614 	struct alc_spec *spec = codec->spec;
4615 
4616 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4617 		spec->mute_led_polarity = 0;
4618 		spec->mute_led_coef.idx = 0x0b;
4619 		spec->mute_led_coef.mask = 1 << 3;
4620 		spec->mute_led_coef.on = 1 << 3;
4621 		spec->mute_led_coef.off = 0;
4622 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4623 	}
4624 }
4625 
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4626 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4627 					  const struct hda_fixup *fix,
4628 					  int action)
4629 {
4630 	struct alc_spec *spec = codec->spec;
4631 
4632 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4633 		spec->mute_led_polarity = 0;
4634 		spec->mute_led_coef.idx = 0x34;
4635 		spec->mute_led_coef.mask = 1 << 5;
4636 		spec->mute_led_coef.on = 0;
4637 		spec->mute_led_coef.off = 1 << 5;
4638 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4639 	}
4640 }
4641 
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4642 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4643 					  const struct hda_fixup *fix, int action)
4644 {
4645 	struct alc_spec *spec = codec->spec;
4646 
4647 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4648 		spec->mute_led_polarity = 0;
4649 		spec->mute_led_coef.idx = 0x07;
4650 		spec->mute_led_coef.mask = 1;
4651 		spec->mute_led_coef.on = 1;
4652 		spec->mute_led_coef.off = 0;
4653 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4654 	}
4655 }
4656 
alc245_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4657 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4658 					  const struct hda_fixup *fix,
4659 					  int action)
4660 {
4661 	struct alc_spec *spec = codec->spec;
4662 
4663 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4664 		spec->mute_led_polarity = 0;
4665 		spec->mute_led_coef.idx = 0x0b;
4666 		spec->mute_led_coef.mask = 3 << 2;
4667 		spec->mute_led_coef.on = 2 << 2;
4668 		spec->mute_led_coef.off = 1 << 2;
4669 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4670 	}
4671 }
4672 
4673 /* 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)4674 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4675 				enum led_brightness brightness)
4676 {
4677 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4678 	struct alc_spec *spec = codec->spec;
4679 
4680 	alc_update_coef_led(codec, &spec->mic_led_coef,
4681 			    spec->micmute_led_polarity, brightness);
4682 	return 0;
4683 }
4684 
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4685 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4686 				const struct hda_fixup *fix, int action)
4687 {
4688 	struct alc_spec *spec = codec->spec;
4689 
4690 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4691 		spec->mic_led_coef.idx = 0x19;
4692 		spec->mic_led_coef.mask = 1 << 13;
4693 		spec->mic_led_coef.on = 1 << 13;
4694 		spec->mic_led_coef.off = 0;
4695 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4696 	}
4697 }
4698 
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4699 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4700 				const struct hda_fixup *fix, int action)
4701 {
4702 	struct alc_spec *spec = codec->spec;
4703 
4704 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4705 		spec->micmute_led_polarity = 1;
4706 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4707 }
4708 
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4709 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4710 				const struct hda_fixup *fix, int action)
4711 {
4712 	struct alc_spec *spec = codec->spec;
4713 
4714 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4715 		spec->mic_led_coef.idx = 0x35;
4716 		spec->mic_led_coef.mask = 3 << 2;
4717 		spec->mic_led_coef.on = 2 << 2;
4718 		spec->mic_led_coef.off = 1 << 2;
4719 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4720 	}
4721 }
4722 
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4723 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4724 				const struct hda_fixup *fix, int action)
4725 {
4726 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4727 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4728 }
4729 
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4730 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4731 				const struct hda_fixup *fix, int action)
4732 {
4733 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4734 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4735 }
4736 
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4737 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4738 				const struct hda_fixup *fix, int action)
4739 {
4740 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4741 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4742 }
4743 
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4744 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4745 				const struct hda_fixup *fix, int action)
4746 {
4747 	struct alc_spec *spec = codec->spec;
4748 
4749 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4750 		spec->cap_mute_led_nid = 0x1a;
4751 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4752 		codec->power_filter = led_power_filter;
4753 	}
4754 }
4755 
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4756 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4757 				const struct hda_fixup *fix, int action)
4758 {
4759 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4760 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4761 }
4762 
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4763 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4764 						  const unsigned short coefs[2])
4765 {
4766 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4767 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4768 	alc_write_coef_idx(codec, 0x26, 0xb011);
4769 }
4770 
4771 struct alc298_samsung_amp_desc {
4772 	unsigned char nid;
4773 	unsigned short init_seq[2][2];
4774 };
4775 
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4776 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4777 				     const struct hda_fixup *fix, int action)
4778 {
4779 	int i, j;
4780 	static const unsigned short init_seq[][2] = {
4781 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4782 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4783 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4784 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4785 	};
4786 	static const struct alc298_samsung_amp_desc amps[] = {
4787 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4788 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4789 	};
4790 
4791 	if (action != HDA_FIXUP_ACT_INIT)
4792 		return;
4793 
4794 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4795 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4796 
4797 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4798 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4799 
4800 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4801 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4802 	}
4803 }
4804 
4805 #if IS_REACHABLE(CONFIG_INPUT)
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)4806 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4807 				   struct hda_jack_callback *event)
4808 {
4809 	struct alc_spec *spec = codec->spec;
4810 
4811 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4812 	   send both key on and key off event for every interrupt. */
4813 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4814 	input_sync(spec->kb_dev);
4815 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4816 	input_sync(spec->kb_dev);
4817 }
4818 
alc_register_micmute_input_device(struct hda_codec * codec)4819 static int alc_register_micmute_input_device(struct hda_codec *codec)
4820 {
4821 	struct alc_spec *spec = codec->spec;
4822 	int i;
4823 
4824 	spec->kb_dev = input_allocate_device();
4825 	if (!spec->kb_dev) {
4826 		codec_err(codec, "Out of memory (input_allocate_device)\n");
4827 		return -ENOMEM;
4828 	}
4829 
4830 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4831 
4832 	spec->kb_dev->name = "Microphone Mute Button";
4833 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4834 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4835 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4836 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4837 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4838 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4839 
4840 	if (input_register_device(spec->kb_dev)) {
4841 		codec_err(codec, "input_register_device failed\n");
4842 		input_free_device(spec->kb_dev);
4843 		spec->kb_dev = NULL;
4844 		return -ENOMEM;
4845 	}
4846 
4847 	return 0;
4848 }
4849 
4850 /* GPIO1 = set according to SKU external amp
4851  * GPIO2 = mic mute hotkey
4852  * GPIO3 = mute LED
4853  * GPIO4 = mic mute LED
4854  */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4855 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4856 					     const struct hda_fixup *fix, int action)
4857 {
4858 	struct alc_spec *spec = codec->spec;
4859 
4860 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4861 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4862 		spec->init_amp = ALC_INIT_DEFAULT;
4863 		if (alc_register_micmute_input_device(codec) != 0)
4864 			return;
4865 
4866 		spec->gpio_mask |= 0x06;
4867 		spec->gpio_dir |= 0x02;
4868 		spec->gpio_data |= 0x02;
4869 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4870 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4871 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4872 						    gpio2_mic_hotkey_event);
4873 		return;
4874 	}
4875 
4876 	if (!spec->kb_dev)
4877 		return;
4878 
4879 	switch (action) {
4880 	case HDA_FIXUP_ACT_FREE:
4881 		input_unregister_device(spec->kb_dev);
4882 		spec->kb_dev = NULL;
4883 	}
4884 }
4885 
4886 /* Line2 = mic mute hotkey
4887  * GPIO2 = mic mute LED
4888  */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4889 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4890 					     const struct hda_fixup *fix, int action)
4891 {
4892 	struct alc_spec *spec = codec->spec;
4893 
4894 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4895 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4896 		spec->init_amp = ALC_INIT_DEFAULT;
4897 		if (alc_register_micmute_input_device(codec) != 0)
4898 			return;
4899 
4900 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
4901 						    gpio2_mic_hotkey_event);
4902 		return;
4903 	}
4904 
4905 	if (!spec->kb_dev)
4906 		return;
4907 
4908 	switch (action) {
4909 	case HDA_FIXUP_ACT_FREE:
4910 		input_unregister_device(spec->kb_dev);
4911 		spec->kb_dev = NULL;
4912 	}
4913 }
4914 #else /* INPUT */
4915 #define alc280_fixup_hp_gpio2_mic_hotkey	NULL
4916 #define alc233_fixup_lenovo_line2_mic_hotkey	NULL
4917 #endif /* INPUT */
4918 
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4919 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4920 				const struct hda_fixup *fix, int action)
4921 {
4922 	struct alc_spec *spec = codec->spec;
4923 
4924 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4925 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4926 		spec->cap_mute_led_nid = 0x18;
4927 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4928 	}
4929 }
4930 
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)4931 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
4932 {
4933 	if (delay <= 0)
4934 		delay = 75;
4935 	snd_hda_codec_write(codec, 0x21, 0,
4936 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4937 	msleep(delay);
4938 	snd_hda_codec_write(codec, 0x21, 0,
4939 		    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4940 	msleep(delay);
4941 }
4942 
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)4943 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
4944 {
4945 	if (delay <= 0)
4946 		delay = 75;
4947 	snd_hda_codec_write(codec, 0x21, 0,
4948 		    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4949 	msleep(delay);
4950 	snd_hda_codec_write(codec, 0x21, 0,
4951 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4952 	msleep(delay);
4953 }
4954 
4955 static const struct coef_fw alc225_pre_hsmode[] = {
4956 	UPDATE_COEF(0x4a, 1<<8, 0),
4957 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4958 	UPDATE_COEF(0x63, 3<<14, 3<<14),
4959 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
4960 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
4961 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4962 	UPDATE_COEF(0x4a, 3<<10, 0),
4963 	{}
4964 };
4965 
alc_headset_mode_unplugged(struct hda_codec * codec)4966 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4967 {
4968 	struct alc_spec *spec = codec->spec;
4969 	static const struct coef_fw coef0255[] = {
4970 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4971 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4972 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4973 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4974 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4975 		{}
4976 	};
4977 	static const struct coef_fw coef0256[] = {
4978 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4979 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4980 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4981 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4982 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4983 		{}
4984 	};
4985 	static const struct coef_fw coef0233[] = {
4986 		WRITE_COEF(0x1b, 0x0c0b),
4987 		WRITE_COEF(0x45, 0xc429),
4988 		UPDATE_COEF(0x35, 0x4000, 0),
4989 		WRITE_COEF(0x06, 0x2104),
4990 		WRITE_COEF(0x1a, 0x0001),
4991 		WRITE_COEF(0x26, 0x0004),
4992 		WRITE_COEF(0x32, 0x42a3),
4993 		{}
4994 	};
4995 	static const struct coef_fw coef0288[] = {
4996 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4997 		UPDATE_COEF(0x50, 0x2000, 0x2000),
4998 		UPDATE_COEF(0x56, 0x0006, 0x0006),
4999 		UPDATE_COEF(0x66, 0x0008, 0),
5000 		UPDATE_COEF(0x67, 0x2000, 0),
5001 		{}
5002 	};
5003 	static const struct coef_fw coef0298[] = {
5004 		UPDATE_COEF(0x19, 0x1300, 0x0300),
5005 		{}
5006 	};
5007 	static const struct coef_fw coef0292[] = {
5008 		WRITE_COEF(0x76, 0x000e),
5009 		WRITE_COEF(0x6c, 0x2400),
5010 		WRITE_COEF(0x18, 0x7308),
5011 		WRITE_COEF(0x6b, 0xc429),
5012 		{}
5013 	};
5014 	static const struct coef_fw coef0293[] = {
5015 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5016 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5017 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5018 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5019 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5020 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5021 		{}
5022 	};
5023 	static const struct coef_fw coef0668[] = {
5024 		WRITE_COEF(0x15, 0x0d40),
5025 		WRITE_COEF(0xb7, 0x802b),
5026 		{}
5027 	};
5028 	static const struct coef_fw coef0225[] = {
5029 		UPDATE_COEF(0x63, 3<<14, 0),
5030 		{}
5031 	};
5032 	static const struct coef_fw coef0274[] = {
5033 		UPDATE_COEF(0x4a, 0x0100, 0),
5034 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5035 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
5036 		UPDATE_COEF(0x4a, 0x0010, 0),
5037 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5038 		WRITE_COEF(0x45, 0x5289),
5039 		UPDATE_COEF(0x4a, 0x0c00, 0),
5040 		{}
5041 	};
5042 
5043 	if (spec->no_internal_mic_pin) {
5044 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5045 		return;
5046 	}
5047 
5048 	switch (codec->core.vendor_id) {
5049 	case 0x10ec0255:
5050 		alc_process_coef_fw(codec, coef0255);
5051 		break;
5052 	case 0x10ec0230:
5053 	case 0x10ec0236:
5054 	case 0x10ec0256:
5055 	case 0x19e58326:
5056 		alc_hp_mute_disable(codec, 75);
5057 		alc_process_coef_fw(codec, coef0256);
5058 		break;
5059 	case 0x10ec0234:
5060 	case 0x10ec0274:
5061 	case 0x10ec0294:
5062 		alc_process_coef_fw(codec, coef0274);
5063 		break;
5064 	case 0x10ec0233:
5065 	case 0x10ec0283:
5066 		alc_process_coef_fw(codec, coef0233);
5067 		break;
5068 	case 0x10ec0286:
5069 	case 0x10ec0288:
5070 		alc_process_coef_fw(codec, coef0288);
5071 		break;
5072 	case 0x10ec0298:
5073 		alc_process_coef_fw(codec, coef0298);
5074 		alc_process_coef_fw(codec, coef0288);
5075 		break;
5076 	case 0x10ec0292:
5077 		alc_process_coef_fw(codec, coef0292);
5078 		break;
5079 	case 0x10ec0293:
5080 		alc_process_coef_fw(codec, coef0293);
5081 		break;
5082 	case 0x10ec0668:
5083 		alc_process_coef_fw(codec, coef0668);
5084 		break;
5085 	case 0x10ec0215:
5086 	case 0x10ec0225:
5087 	case 0x10ec0285:
5088 	case 0x10ec0295:
5089 	case 0x10ec0289:
5090 	case 0x10ec0299:
5091 		alc_hp_mute_disable(codec, 75);
5092 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5093 		alc_process_coef_fw(codec, coef0225);
5094 		break;
5095 	case 0x10ec0867:
5096 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5097 		break;
5098 	}
5099 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5100 }
5101 
5102 
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5103 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5104 				    hda_nid_t mic_pin)
5105 {
5106 	static const struct coef_fw coef0255[] = {
5107 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5108 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5109 		{}
5110 	};
5111 	static const struct coef_fw coef0256[] = {
5112 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5113 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5114 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5115 		{}
5116 	};
5117 	static const struct coef_fw coef0233[] = {
5118 		UPDATE_COEF(0x35, 0, 1<<14),
5119 		WRITE_COEF(0x06, 0x2100),
5120 		WRITE_COEF(0x1a, 0x0021),
5121 		WRITE_COEF(0x26, 0x008c),
5122 		{}
5123 	};
5124 	static const struct coef_fw coef0288[] = {
5125 		UPDATE_COEF(0x4f, 0x00c0, 0),
5126 		UPDATE_COEF(0x50, 0x2000, 0),
5127 		UPDATE_COEF(0x56, 0x0006, 0),
5128 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5129 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5130 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5131 		{}
5132 	};
5133 	static const struct coef_fw coef0292[] = {
5134 		WRITE_COEF(0x19, 0xa208),
5135 		WRITE_COEF(0x2e, 0xacf0),
5136 		{}
5137 	};
5138 	static const struct coef_fw coef0293[] = {
5139 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5140 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5141 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5142 		{}
5143 	};
5144 	static const struct coef_fw coef0688[] = {
5145 		WRITE_COEF(0xb7, 0x802b),
5146 		WRITE_COEF(0xb5, 0x1040),
5147 		UPDATE_COEF(0xc3, 0, 1<<12),
5148 		{}
5149 	};
5150 	static const struct coef_fw coef0225[] = {
5151 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5152 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5153 		UPDATE_COEF(0x63, 3<<14, 0),
5154 		{}
5155 	};
5156 	static const struct coef_fw coef0274[] = {
5157 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5158 		UPDATE_COEF(0x4a, 0x0010, 0),
5159 		UPDATE_COEF(0x6b, 0xf000, 0),
5160 		{}
5161 	};
5162 
5163 	switch (codec->core.vendor_id) {
5164 	case 0x10ec0255:
5165 		alc_write_coef_idx(codec, 0x45, 0xc489);
5166 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5167 		alc_process_coef_fw(codec, coef0255);
5168 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5169 		break;
5170 	case 0x10ec0230:
5171 	case 0x10ec0236:
5172 	case 0x10ec0256:
5173 	case 0x19e58326:
5174 		alc_write_coef_idx(codec, 0x45, 0xc489);
5175 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5176 		alc_process_coef_fw(codec, coef0256);
5177 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5178 		break;
5179 	case 0x10ec0234:
5180 	case 0x10ec0274:
5181 	case 0x10ec0294:
5182 		alc_write_coef_idx(codec, 0x45, 0x4689);
5183 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5184 		alc_process_coef_fw(codec, coef0274);
5185 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5186 		break;
5187 	case 0x10ec0233:
5188 	case 0x10ec0283:
5189 		alc_write_coef_idx(codec, 0x45, 0xc429);
5190 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5191 		alc_process_coef_fw(codec, coef0233);
5192 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5193 		break;
5194 	case 0x10ec0286:
5195 	case 0x10ec0288:
5196 	case 0x10ec0298:
5197 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5198 		alc_process_coef_fw(codec, coef0288);
5199 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5200 		break;
5201 	case 0x10ec0292:
5202 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5203 		alc_process_coef_fw(codec, coef0292);
5204 		break;
5205 	case 0x10ec0293:
5206 		/* Set to TRS mode */
5207 		alc_write_coef_idx(codec, 0x45, 0xc429);
5208 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5209 		alc_process_coef_fw(codec, coef0293);
5210 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5211 		break;
5212 	case 0x10ec0867:
5213 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5214 		fallthrough;
5215 	case 0x10ec0221:
5216 	case 0x10ec0662:
5217 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5218 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5219 		break;
5220 	case 0x10ec0668:
5221 		alc_write_coef_idx(codec, 0x11, 0x0001);
5222 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5223 		alc_process_coef_fw(codec, coef0688);
5224 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5225 		break;
5226 	case 0x10ec0215:
5227 	case 0x10ec0225:
5228 	case 0x10ec0285:
5229 	case 0x10ec0295:
5230 	case 0x10ec0289:
5231 	case 0x10ec0299:
5232 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5233 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5234 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5235 		alc_process_coef_fw(codec, coef0225);
5236 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5237 		break;
5238 	}
5239 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5240 }
5241 
alc_headset_mode_default(struct hda_codec * codec)5242 static void alc_headset_mode_default(struct hda_codec *codec)
5243 {
5244 	static const struct coef_fw coef0225[] = {
5245 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5246 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5247 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5248 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5249 		UPDATE_COEF(0x63, 3<<14, 0),
5250 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5251 		{}
5252 	};
5253 	static const struct coef_fw coef0255[] = {
5254 		WRITE_COEF(0x45, 0xc089),
5255 		WRITE_COEF(0x45, 0xc489),
5256 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5257 		WRITE_COEF(0x49, 0x0049),
5258 		{}
5259 	};
5260 	static const struct coef_fw coef0256[] = {
5261 		WRITE_COEF(0x45, 0xc489),
5262 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5263 		WRITE_COEF(0x49, 0x0049),
5264 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5265 		WRITE_COEF(0x06, 0x6100),
5266 		{}
5267 	};
5268 	static const struct coef_fw coef0233[] = {
5269 		WRITE_COEF(0x06, 0x2100),
5270 		WRITE_COEF(0x32, 0x4ea3),
5271 		{}
5272 	};
5273 	static const struct coef_fw coef0288[] = {
5274 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5275 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5276 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5277 		UPDATE_COEF(0x66, 0x0008, 0),
5278 		UPDATE_COEF(0x67, 0x2000, 0),
5279 		{}
5280 	};
5281 	static const struct coef_fw coef0292[] = {
5282 		WRITE_COEF(0x76, 0x000e),
5283 		WRITE_COEF(0x6c, 0x2400),
5284 		WRITE_COEF(0x6b, 0xc429),
5285 		WRITE_COEF(0x18, 0x7308),
5286 		{}
5287 	};
5288 	static const struct coef_fw coef0293[] = {
5289 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5290 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5291 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5292 		{}
5293 	};
5294 	static const struct coef_fw coef0688[] = {
5295 		WRITE_COEF(0x11, 0x0041),
5296 		WRITE_COEF(0x15, 0x0d40),
5297 		WRITE_COEF(0xb7, 0x802b),
5298 		{}
5299 	};
5300 	static const struct coef_fw coef0274[] = {
5301 		WRITE_COEF(0x45, 0x4289),
5302 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5303 		UPDATE_COEF(0x6b, 0x0f00, 0),
5304 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5305 		{}
5306 	};
5307 
5308 	switch (codec->core.vendor_id) {
5309 	case 0x10ec0215:
5310 	case 0x10ec0225:
5311 	case 0x10ec0285:
5312 	case 0x10ec0295:
5313 	case 0x10ec0289:
5314 	case 0x10ec0299:
5315 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5316 		alc_process_coef_fw(codec, coef0225);
5317 		alc_hp_enable_unmute(codec, 75);
5318 		break;
5319 	case 0x10ec0255:
5320 		alc_process_coef_fw(codec, coef0255);
5321 		break;
5322 	case 0x10ec0230:
5323 	case 0x10ec0236:
5324 	case 0x10ec0256:
5325 	case 0x19e58326:
5326 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5327 		alc_write_coef_idx(codec, 0x45, 0xc089);
5328 		msleep(50);
5329 		alc_process_coef_fw(codec, coef0256);
5330 		alc_hp_enable_unmute(codec, 75);
5331 		break;
5332 	case 0x10ec0234:
5333 	case 0x10ec0274:
5334 	case 0x10ec0294:
5335 		alc_process_coef_fw(codec, coef0274);
5336 		break;
5337 	case 0x10ec0233:
5338 	case 0x10ec0283:
5339 		alc_process_coef_fw(codec, coef0233);
5340 		break;
5341 	case 0x10ec0286:
5342 	case 0x10ec0288:
5343 	case 0x10ec0298:
5344 		alc_process_coef_fw(codec, coef0288);
5345 		break;
5346 	case 0x10ec0292:
5347 		alc_process_coef_fw(codec, coef0292);
5348 		break;
5349 	case 0x10ec0293:
5350 		alc_process_coef_fw(codec, coef0293);
5351 		break;
5352 	case 0x10ec0668:
5353 		alc_process_coef_fw(codec, coef0688);
5354 		break;
5355 	case 0x10ec0867:
5356 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5357 		break;
5358 	}
5359 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5360 }
5361 
5362 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5363 static void alc_headset_mode_ctia(struct hda_codec *codec)
5364 {
5365 	int val;
5366 
5367 	static const struct coef_fw coef0255[] = {
5368 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5369 		WRITE_COEF(0x1b, 0x0c2b),
5370 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5371 		{}
5372 	};
5373 	static const struct coef_fw coef0256[] = {
5374 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5375 		WRITE_COEF(0x1b, 0x0e6b),
5376 		{}
5377 	};
5378 	static const struct coef_fw coef0233[] = {
5379 		WRITE_COEF(0x45, 0xd429),
5380 		WRITE_COEF(0x1b, 0x0c2b),
5381 		WRITE_COEF(0x32, 0x4ea3),
5382 		{}
5383 	};
5384 	static const struct coef_fw coef0288[] = {
5385 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5386 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5387 		UPDATE_COEF(0x66, 0x0008, 0),
5388 		UPDATE_COEF(0x67, 0x2000, 0),
5389 		{}
5390 	};
5391 	static const struct coef_fw coef0292[] = {
5392 		WRITE_COEF(0x6b, 0xd429),
5393 		WRITE_COEF(0x76, 0x0008),
5394 		WRITE_COEF(0x18, 0x7388),
5395 		{}
5396 	};
5397 	static const struct coef_fw coef0293[] = {
5398 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5399 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5400 		{}
5401 	};
5402 	static const struct coef_fw coef0688[] = {
5403 		WRITE_COEF(0x11, 0x0001),
5404 		WRITE_COEF(0x15, 0x0d60),
5405 		WRITE_COEF(0xc3, 0x0000),
5406 		{}
5407 	};
5408 	static const struct coef_fw coef0225_1[] = {
5409 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5410 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5411 		{}
5412 	};
5413 	static const struct coef_fw coef0225_2[] = {
5414 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5415 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5416 		{}
5417 	};
5418 
5419 	switch (codec->core.vendor_id) {
5420 	case 0x10ec0255:
5421 		alc_process_coef_fw(codec, coef0255);
5422 		break;
5423 	case 0x10ec0230:
5424 	case 0x10ec0236:
5425 	case 0x10ec0256:
5426 	case 0x19e58326:
5427 		alc_process_coef_fw(codec, coef0256);
5428 		alc_hp_enable_unmute(codec, 75);
5429 		break;
5430 	case 0x10ec0234:
5431 	case 0x10ec0274:
5432 	case 0x10ec0294:
5433 		alc_write_coef_idx(codec, 0x45, 0xd689);
5434 		break;
5435 	case 0x10ec0233:
5436 	case 0x10ec0283:
5437 		alc_process_coef_fw(codec, coef0233);
5438 		break;
5439 	case 0x10ec0298:
5440 		val = alc_read_coef_idx(codec, 0x50);
5441 		if (val & (1 << 12)) {
5442 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5443 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5444 			msleep(300);
5445 		} else {
5446 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5447 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5448 			msleep(300);
5449 		}
5450 		break;
5451 	case 0x10ec0286:
5452 	case 0x10ec0288:
5453 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5454 		msleep(300);
5455 		alc_process_coef_fw(codec, coef0288);
5456 		break;
5457 	case 0x10ec0292:
5458 		alc_process_coef_fw(codec, coef0292);
5459 		break;
5460 	case 0x10ec0293:
5461 		alc_process_coef_fw(codec, coef0293);
5462 		break;
5463 	case 0x10ec0668:
5464 		alc_process_coef_fw(codec, coef0688);
5465 		break;
5466 	case 0x10ec0215:
5467 	case 0x10ec0225:
5468 	case 0x10ec0285:
5469 	case 0x10ec0295:
5470 	case 0x10ec0289:
5471 	case 0x10ec0299:
5472 		val = alc_read_coef_idx(codec, 0x45);
5473 		if (val & (1 << 9))
5474 			alc_process_coef_fw(codec, coef0225_2);
5475 		else
5476 			alc_process_coef_fw(codec, coef0225_1);
5477 		alc_hp_enable_unmute(codec, 75);
5478 		break;
5479 	case 0x10ec0867:
5480 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5481 		break;
5482 	}
5483 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5484 }
5485 
5486 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5487 static void alc_headset_mode_omtp(struct hda_codec *codec)
5488 {
5489 	static const struct coef_fw coef0255[] = {
5490 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5491 		WRITE_COEF(0x1b, 0x0c2b),
5492 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5493 		{}
5494 	};
5495 	static const struct coef_fw coef0256[] = {
5496 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5497 		WRITE_COEF(0x1b, 0x0e6b),
5498 		{}
5499 	};
5500 	static const struct coef_fw coef0233[] = {
5501 		WRITE_COEF(0x45, 0xe429),
5502 		WRITE_COEF(0x1b, 0x0c2b),
5503 		WRITE_COEF(0x32, 0x4ea3),
5504 		{}
5505 	};
5506 	static const struct coef_fw coef0288[] = {
5507 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5508 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5509 		UPDATE_COEF(0x66, 0x0008, 0),
5510 		UPDATE_COEF(0x67, 0x2000, 0),
5511 		{}
5512 	};
5513 	static const struct coef_fw coef0292[] = {
5514 		WRITE_COEF(0x6b, 0xe429),
5515 		WRITE_COEF(0x76, 0x0008),
5516 		WRITE_COEF(0x18, 0x7388),
5517 		{}
5518 	};
5519 	static const struct coef_fw coef0293[] = {
5520 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5521 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5522 		{}
5523 	};
5524 	static const struct coef_fw coef0688[] = {
5525 		WRITE_COEF(0x11, 0x0001),
5526 		WRITE_COEF(0x15, 0x0d50),
5527 		WRITE_COEF(0xc3, 0x0000),
5528 		{}
5529 	};
5530 	static const struct coef_fw coef0225[] = {
5531 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5532 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5533 		{}
5534 	};
5535 
5536 	switch (codec->core.vendor_id) {
5537 	case 0x10ec0255:
5538 		alc_process_coef_fw(codec, coef0255);
5539 		break;
5540 	case 0x10ec0230:
5541 	case 0x10ec0236:
5542 	case 0x10ec0256:
5543 	case 0x19e58326:
5544 		alc_process_coef_fw(codec, coef0256);
5545 		alc_hp_enable_unmute(codec, 75);
5546 		break;
5547 	case 0x10ec0234:
5548 	case 0x10ec0274:
5549 	case 0x10ec0294:
5550 		alc_write_coef_idx(codec, 0x45, 0xe689);
5551 		break;
5552 	case 0x10ec0233:
5553 	case 0x10ec0283:
5554 		alc_process_coef_fw(codec, coef0233);
5555 		break;
5556 	case 0x10ec0298:
5557 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5558 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5559 		msleep(300);
5560 		break;
5561 	case 0x10ec0286:
5562 	case 0x10ec0288:
5563 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5564 		msleep(300);
5565 		alc_process_coef_fw(codec, coef0288);
5566 		break;
5567 	case 0x10ec0292:
5568 		alc_process_coef_fw(codec, coef0292);
5569 		break;
5570 	case 0x10ec0293:
5571 		alc_process_coef_fw(codec, coef0293);
5572 		break;
5573 	case 0x10ec0668:
5574 		alc_process_coef_fw(codec, coef0688);
5575 		break;
5576 	case 0x10ec0215:
5577 	case 0x10ec0225:
5578 	case 0x10ec0285:
5579 	case 0x10ec0295:
5580 	case 0x10ec0289:
5581 	case 0x10ec0299:
5582 		alc_process_coef_fw(codec, coef0225);
5583 		alc_hp_enable_unmute(codec, 75);
5584 		break;
5585 	}
5586 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5587 }
5588 
alc_determine_headset_type(struct hda_codec * codec)5589 static void alc_determine_headset_type(struct hda_codec *codec)
5590 {
5591 	int val;
5592 	bool is_ctia = false;
5593 	struct alc_spec *spec = codec->spec;
5594 	static const struct coef_fw coef0255[] = {
5595 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5596 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5597  conteol) */
5598 		{}
5599 	};
5600 	static const struct coef_fw coef0288[] = {
5601 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5602 		{}
5603 	};
5604 	static const struct coef_fw coef0298[] = {
5605 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5606 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5607 		UPDATE_COEF(0x66, 0x0008, 0),
5608 		UPDATE_COEF(0x67, 0x2000, 0),
5609 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5610 		{}
5611 	};
5612 	static const struct coef_fw coef0293[] = {
5613 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5614 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5615 		{}
5616 	};
5617 	static const struct coef_fw coef0688[] = {
5618 		WRITE_COEF(0x11, 0x0001),
5619 		WRITE_COEF(0xb7, 0x802b),
5620 		WRITE_COEF(0x15, 0x0d60),
5621 		WRITE_COEF(0xc3, 0x0c00),
5622 		{}
5623 	};
5624 	static const struct coef_fw coef0274[] = {
5625 		UPDATE_COEF(0x4a, 0x0010, 0),
5626 		UPDATE_COEF(0x4a, 0x8000, 0),
5627 		WRITE_COEF(0x45, 0xd289),
5628 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5629 		{}
5630 	};
5631 
5632 	if (spec->no_internal_mic_pin) {
5633 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5634 		return;
5635 	}
5636 
5637 	switch (codec->core.vendor_id) {
5638 	case 0x10ec0255:
5639 		alc_process_coef_fw(codec, coef0255);
5640 		msleep(300);
5641 		val = alc_read_coef_idx(codec, 0x46);
5642 		is_ctia = (val & 0x0070) == 0x0070;
5643 		break;
5644 	case 0x10ec0230:
5645 	case 0x10ec0236:
5646 	case 0x10ec0256:
5647 	case 0x19e58326:
5648 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5649 		alc_write_coef_idx(codec, 0x06, 0x6104);
5650 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5651 
5652 		alc_process_coef_fw(codec, coef0255);
5653 		msleep(300);
5654 		val = alc_read_coef_idx(codec, 0x46);
5655 		is_ctia = (val & 0x0070) == 0x0070;
5656 		if (!is_ctia) {
5657 			alc_write_coef_idx(codec, 0x45, 0xe089);
5658 			msleep(100);
5659 			val = alc_read_coef_idx(codec, 0x46);
5660 			if ((val & 0x0070) == 0x0070)
5661 				is_ctia = false;
5662 			else
5663 				is_ctia = true;
5664 		}
5665 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5666 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5667 		break;
5668 	case 0x10ec0234:
5669 	case 0x10ec0274:
5670 	case 0x10ec0294:
5671 		alc_process_coef_fw(codec, coef0274);
5672 		msleep(850);
5673 		val = alc_read_coef_idx(codec, 0x46);
5674 		is_ctia = (val & 0x00f0) == 0x00f0;
5675 		break;
5676 	case 0x10ec0233:
5677 	case 0x10ec0283:
5678 		alc_write_coef_idx(codec, 0x45, 0xd029);
5679 		msleep(300);
5680 		val = alc_read_coef_idx(codec, 0x46);
5681 		is_ctia = (val & 0x0070) == 0x0070;
5682 		break;
5683 	case 0x10ec0298:
5684 		snd_hda_codec_write(codec, 0x21, 0,
5685 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5686 		msleep(100);
5687 		snd_hda_codec_write(codec, 0x21, 0,
5688 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5689 		msleep(200);
5690 
5691 		val = alc_read_coef_idx(codec, 0x50);
5692 		if (val & (1 << 12)) {
5693 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5694 			alc_process_coef_fw(codec, coef0288);
5695 			msleep(350);
5696 			val = alc_read_coef_idx(codec, 0x50);
5697 			is_ctia = (val & 0x0070) == 0x0070;
5698 		} else {
5699 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5700 			alc_process_coef_fw(codec, coef0288);
5701 			msleep(350);
5702 			val = alc_read_coef_idx(codec, 0x50);
5703 			is_ctia = (val & 0x0070) == 0x0070;
5704 		}
5705 		alc_process_coef_fw(codec, coef0298);
5706 		snd_hda_codec_write(codec, 0x21, 0,
5707 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5708 		msleep(75);
5709 		snd_hda_codec_write(codec, 0x21, 0,
5710 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5711 		break;
5712 	case 0x10ec0286:
5713 	case 0x10ec0288:
5714 		alc_process_coef_fw(codec, coef0288);
5715 		msleep(350);
5716 		val = alc_read_coef_idx(codec, 0x50);
5717 		is_ctia = (val & 0x0070) == 0x0070;
5718 		break;
5719 	case 0x10ec0292:
5720 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5721 		msleep(300);
5722 		val = alc_read_coef_idx(codec, 0x6c);
5723 		is_ctia = (val & 0x001c) == 0x001c;
5724 		break;
5725 	case 0x10ec0293:
5726 		alc_process_coef_fw(codec, coef0293);
5727 		msleep(300);
5728 		val = alc_read_coef_idx(codec, 0x46);
5729 		is_ctia = (val & 0x0070) == 0x0070;
5730 		break;
5731 	case 0x10ec0668:
5732 		alc_process_coef_fw(codec, coef0688);
5733 		msleep(300);
5734 		val = alc_read_coef_idx(codec, 0xbe);
5735 		is_ctia = (val & 0x1c02) == 0x1c02;
5736 		break;
5737 	case 0x10ec0215:
5738 	case 0x10ec0225:
5739 	case 0x10ec0285:
5740 	case 0x10ec0295:
5741 	case 0x10ec0289:
5742 	case 0x10ec0299:
5743 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5744 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5745 		val = alc_read_coef_idx(codec, 0x45);
5746 		if (val & (1 << 9)) {
5747 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5748 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5749 			msleep(800);
5750 			val = alc_read_coef_idx(codec, 0x46);
5751 			is_ctia = (val & 0x00f0) == 0x00f0;
5752 		} else {
5753 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5754 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5755 			msleep(800);
5756 			val = alc_read_coef_idx(codec, 0x46);
5757 			is_ctia = (val & 0x00f0) == 0x00f0;
5758 		}
5759 		if (!is_ctia) {
5760 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5761 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5762 			msleep(100);
5763 			val = alc_read_coef_idx(codec, 0x46);
5764 			if ((val & 0x00f0) == 0x00f0)
5765 				is_ctia = false;
5766 			else
5767 				is_ctia = true;
5768 		}
5769 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5770 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5771 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5772 		break;
5773 	case 0x10ec0867:
5774 		is_ctia = true;
5775 		break;
5776 	}
5777 
5778 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5779 		    is_ctia ? "yes" : "no");
5780 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5781 }
5782 
alc_update_headset_mode(struct hda_codec * codec)5783 static void alc_update_headset_mode(struct hda_codec *codec)
5784 {
5785 	struct alc_spec *spec = codec->spec;
5786 
5787 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5788 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
5789 
5790 	int new_headset_mode;
5791 
5792 	if (!snd_hda_jack_detect(codec, hp_pin))
5793 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5794 	else if (mux_pin == spec->headset_mic_pin)
5795 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5796 	else if (mux_pin == spec->headphone_mic_pin)
5797 		new_headset_mode = ALC_HEADSET_MODE_MIC;
5798 	else
5799 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5800 
5801 	if (new_headset_mode == spec->current_headset_mode) {
5802 		snd_hda_gen_update_outputs(codec);
5803 		return;
5804 	}
5805 
5806 	switch (new_headset_mode) {
5807 	case ALC_HEADSET_MODE_UNPLUGGED:
5808 		alc_headset_mode_unplugged(codec);
5809 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5810 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5811 		spec->gen.hp_jack_present = false;
5812 		break;
5813 	case ALC_HEADSET_MODE_HEADSET:
5814 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5815 			alc_determine_headset_type(codec);
5816 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5817 			alc_headset_mode_ctia(codec);
5818 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5819 			alc_headset_mode_omtp(codec);
5820 		spec->gen.hp_jack_present = true;
5821 		break;
5822 	case ALC_HEADSET_MODE_MIC:
5823 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5824 		spec->gen.hp_jack_present = false;
5825 		break;
5826 	case ALC_HEADSET_MODE_HEADPHONE:
5827 		alc_headset_mode_default(codec);
5828 		spec->gen.hp_jack_present = true;
5829 		break;
5830 	}
5831 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5832 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
5833 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5834 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5835 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5836 						  PIN_VREFHIZ);
5837 	}
5838 	spec->current_headset_mode = new_headset_mode;
5839 
5840 	snd_hda_gen_update_outputs(codec);
5841 }
5842 
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)5843 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5844 					 struct snd_kcontrol *kcontrol,
5845 					 struct snd_ctl_elem_value *ucontrol)
5846 {
5847 	alc_update_headset_mode(codec);
5848 }
5849 
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5850 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5851 				       struct hda_jack_callback *jack)
5852 {
5853 	snd_hda_gen_hp_automute(codec, jack);
5854 	alc_update_headset_mode(codec);
5855 }
5856 
alc_probe_headset_mode(struct hda_codec * codec)5857 static void alc_probe_headset_mode(struct hda_codec *codec)
5858 {
5859 	int i;
5860 	struct alc_spec *spec = codec->spec;
5861 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5862 
5863 	/* Find mic pins */
5864 	for (i = 0; i < cfg->num_inputs; i++) {
5865 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5866 			spec->headset_mic_pin = cfg->inputs[i].pin;
5867 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5868 			spec->headphone_mic_pin = cfg->inputs[i].pin;
5869 	}
5870 
5871 	WARN_ON(spec->gen.cap_sync_hook);
5872 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5873 	spec->gen.automute_hook = alc_update_headset_mode;
5874 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5875 }
5876 
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)5877 static void alc_fixup_headset_mode(struct hda_codec *codec,
5878 				const struct hda_fixup *fix, int action)
5879 {
5880 	struct alc_spec *spec = codec->spec;
5881 
5882 	switch (action) {
5883 	case HDA_FIXUP_ACT_PRE_PROBE:
5884 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5885 		break;
5886 	case HDA_FIXUP_ACT_PROBE:
5887 		alc_probe_headset_mode(codec);
5888 		break;
5889 	case HDA_FIXUP_ACT_INIT:
5890 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
5891 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5892 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5893 		}
5894 		alc_update_headset_mode(codec);
5895 		break;
5896 	}
5897 }
5898 
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5899 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5900 				const struct hda_fixup *fix, int action)
5901 {
5902 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5903 		struct alc_spec *spec = codec->spec;
5904 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5905 	}
5906 	else
5907 		alc_fixup_headset_mode(codec, fix, action);
5908 }
5909 
alc255_set_default_jack_type(struct hda_codec * codec)5910 static void alc255_set_default_jack_type(struct hda_codec *codec)
5911 {
5912 	/* Set to iphone type */
5913 	static const struct coef_fw alc255fw[] = {
5914 		WRITE_COEF(0x1b, 0x880b),
5915 		WRITE_COEF(0x45, 0xd089),
5916 		WRITE_COEF(0x1b, 0x080b),
5917 		WRITE_COEF(0x46, 0x0004),
5918 		WRITE_COEF(0x1b, 0x0c0b),
5919 		{}
5920 	};
5921 	static const struct coef_fw alc256fw[] = {
5922 		WRITE_COEF(0x1b, 0x884b),
5923 		WRITE_COEF(0x45, 0xd089),
5924 		WRITE_COEF(0x1b, 0x084b),
5925 		WRITE_COEF(0x46, 0x0004),
5926 		WRITE_COEF(0x1b, 0x0c4b),
5927 		{}
5928 	};
5929 	switch (codec->core.vendor_id) {
5930 	case 0x10ec0255:
5931 		alc_process_coef_fw(codec, alc255fw);
5932 		break;
5933 	case 0x10ec0230:
5934 	case 0x10ec0236:
5935 	case 0x10ec0256:
5936 	case 0x19e58326:
5937 		alc_process_coef_fw(codec, alc256fw);
5938 		break;
5939 	}
5940 	msleep(30);
5941 }
5942 
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)5943 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5944 				const struct hda_fixup *fix, int action)
5945 {
5946 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5947 		alc255_set_default_jack_type(codec);
5948 	}
5949 	alc_fixup_headset_mode(codec, fix, action);
5950 }
5951 
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5952 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5953 				const struct hda_fixup *fix, int action)
5954 {
5955 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5956 		struct alc_spec *spec = codec->spec;
5957 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5958 		alc255_set_default_jack_type(codec);
5959 	}
5960 	else
5961 		alc_fixup_headset_mode(codec, fix, action);
5962 }
5963 
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5964 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5965 				       struct hda_jack_callback *jack)
5966 {
5967 	struct alc_spec *spec = codec->spec;
5968 
5969 	alc_update_headset_jack_cb(codec, jack);
5970 	/* Headset Mic enable or disable, only for Dell Dino */
5971 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5972 }
5973 
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)5974 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5975 				const struct hda_fixup *fix, int action)
5976 {
5977 	alc_fixup_headset_mode(codec, fix, action);
5978 	if (action == HDA_FIXUP_ACT_PROBE) {
5979 		struct alc_spec *spec = codec->spec;
5980 		/* toggled via hp_automute_hook */
5981 		spec->gpio_mask |= 0x40;
5982 		spec->gpio_dir |= 0x40;
5983 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5984 	}
5985 }
5986 
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)5987 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5988 					const struct hda_fixup *fix, int action)
5989 {
5990 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5991 		struct alc_spec *spec = codec->spec;
5992 		spec->gen.auto_mute_via_amp = 1;
5993 	}
5994 }
5995 
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)5996 static void alc_fixup_no_shutup(struct hda_codec *codec,
5997 				const struct hda_fixup *fix, int action)
5998 {
5999 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6000 		struct alc_spec *spec = codec->spec;
6001 		spec->no_shutup_pins = 1;
6002 	}
6003 }
6004 
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)6005 static void alc_fixup_disable_aamix(struct hda_codec *codec,
6006 				    const struct hda_fixup *fix, int action)
6007 {
6008 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6009 		struct alc_spec *spec = codec->spec;
6010 		/* Disable AA-loopback as it causes white noise */
6011 		spec->gen.mixer_nid = 0;
6012 	}
6013 }
6014 
6015 /* 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)6016 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6017 				  const struct hda_fixup *fix, int action)
6018 {
6019 	static const struct hda_pintbl pincfgs[] = {
6020 		{ 0x16, 0x21211010 }, /* dock headphone */
6021 		{ 0x19, 0x21a11010 }, /* dock mic */
6022 		{ }
6023 	};
6024 	struct alc_spec *spec = codec->spec;
6025 
6026 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6027 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6028 		codec->power_save_node = 0; /* avoid click noises */
6029 		snd_hda_apply_pincfgs(codec, pincfgs);
6030 	}
6031 }
6032 
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6033 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6034 				  const struct hda_fixup *fix, int action)
6035 {
6036 	static const struct hda_pintbl pincfgs[] = {
6037 		{ 0x17, 0x21211010 }, /* dock headphone */
6038 		{ 0x19, 0x21a11010 }, /* dock mic */
6039 		{ }
6040 	};
6041 	struct alc_spec *spec = codec->spec;
6042 
6043 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6044 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6045 		snd_hda_apply_pincfgs(codec, pincfgs);
6046 	} else if (action == HDA_FIXUP_ACT_INIT) {
6047 		/* Enable DOCK device */
6048 		snd_hda_codec_write(codec, 0x17, 0,
6049 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6050 		/* Enable DOCK device */
6051 		snd_hda_codec_write(codec, 0x19, 0,
6052 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6053 	}
6054 }
6055 
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6056 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6057 				  const struct hda_fixup *fix, int action)
6058 {
6059 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6060 	 * the speaker output becomes too low by some reason on Thinkpads with
6061 	 * ALC298 codec
6062 	 */
6063 	static const hda_nid_t preferred_pairs[] = {
6064 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6065 		0
6066 	};
6067 	struct alc_spec *spec = codec->spec;
6068 
6069 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6070 		spec->gen.preferred_dacs = preferred_pairs;
6071 }
6072 
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6073 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6074 				   const struct hda_fixup *fix, int action)
6075 {
6076 	static const hda_nid_t preferred_pairs[] = {
6077 		0x17, 0x02, 0x21, 0x03, 0
6078 	};
6079 	struct alc_spec *spec = codec->spec;
6080 
6081 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6082 		spec->gen.preferred_dacs = preferred_pairs;
6083 }
6084 
alc_shutup_dell_xps13(struct hda_codec * codec)6085 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6086 {
6087 	struct alc_spec *spec = codec->spec;
6088 	int hp_pin = alc_get_hp_pin(spec);
6089 
6090 	/* Prevent pop noises when headphones are plugged in */
6091 	snd_hda_codec_write(codec, hp_pin, 0,
6092 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6093 	msleep(20);
6094 }
6095 
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6096 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6097 				const struct hda_fixup *fix, int action)
6098 {
6099 	struct alc_spec *spec = codec->spec;
6100 	struct hda_input_mux *imux = &spec->gen.input_mux;
6101 	int i;
6102 
6103 	switch (action) {
6104 	case HDA_FIXUP_ACT_PRE_PROBE:
6105 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6106 		 * it causes a click noise at start up
6107 		 */
6108 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6109 		spec->shutup = alc_shutup_dell_xps13;
6110 		break;
6111 	case HDA_FIXUP_ACT_PROBE:
6112 		/* Make the internal mic the default input source. */
6113 		for (i = 0; i < imux->num_items; i++) {
6114 			if (spec->gen.imux_pins[i] == 0x12) {
6115 				spec->gen.cur_mux[0] = i;
6116 				break;
6117 			}
6118 		}
6119 		break;
6120 	}
6121 }
6122 
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6123 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6124 				const struct hda_fixup *fix, int action)
6125 {
6126 	struct alc_spec *spec = codec->spec;
6127 
6128 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6129 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6130 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6131 
6132 		/* Disable boost for mic-in permanently. (This code is only called
6133 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6134 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6135 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6136 	} else
6137 		alc_fixup_headset_mode(codec, fix, action);
6138 }
6139 
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6140 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6141 				const struct hda_fixup *fix, int action)
6142 {
6143 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6144 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6145 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6146 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6147 	}
6148 	alc_fixup_headset_mode(codec, fix, action);
6149 }
6150 
6151 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6152 static int find_ext_mic_pin(struct hda_codec *codec)
6153 {
6154 	struct alc_spec *spec = codec->spec;
6155 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6156 	hda_nid_t nid;
6157 	unsigned int defcfg;
6158 	int i;
6159 
6160 	for (i = 0; i < cfg->num_inputs; i++) {
6161 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6162 			continue;
6163 		nid = cfg->inputs[i].pin;
6164 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6165 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6166 			continue;
6167 		return nid;
6168 	}
6169 
6170 	return 0;
6171 }
6172 
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6173 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6174 				    const struct hda_fixup *fix,
6175 				    int action)
6176 {
6177 	struct alc_spec *spec = codec->spec;
6178 
6179 	if (action == HDA_FIXUP_ACT_PROBE) {
6180 		int mic_pin = find_ext_mic_pin(codec);
6181 		int hp_pin = alc_get_hp_pin(spec);
6182 
6183 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6184 			return;
6185 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6186 	}
6187 }
6188 
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6189 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6190 					     const struct hda_fixup *fix,
6191 					     int action)
6192 {
6193 	struct alc_spec *spec = codec->spec;
6194 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6195 	int i;
6196 
6197 	/* The mic boosts on level 2 and 3 are too noisy
6198 	   on the internal mic input.
6199 	   Therefore limit the boost to 0 or 1. */
6200 
6201 	if (action != HDA_FIXUP_ACT_PROBE)
6202 		return;
6203 
6204 	for (i = 0; i < cfg->num_inputs; i++) {
6205 		hda_nid_t nid = cfg->inputs[i].pin;
6206 		unsigned int defcfg;
6207 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6208 			continue;
6209 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6210 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6211 			continue;
6212 
6213 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6214 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6215 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6216 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6217 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6218 	}
6219 }
6220 
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6221 static void alc283_hp_automute_hook(struct hda_codec *codec,
6222 				    struct hda_jack_callback *jack)
6223 {
6224 	struct alc_spec *spec = codec->spec;
6225 	int vref;
6226 
6227 	msleep(200);
6228 	snd_hda_gen_hp_automute(codec, jack);
6229 
6230 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6231 
6232 	msleep(600);
6233 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6234 			    vref);
6235 }
6236 
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6237 static void alc283_fixup_chromebook(struct hda_codec *codec,
6238 				    const struct hda_fixup *fix, int action)
6239 {
6240 	struct alc_spec *spec = codec->spec;
6241 
6242 	switch (action) {
6243 	case HDA_FIXUP_ACT_PRE_PROBE:
6244 		snd_hda_override_wcaps(codec, 0x03, 0);
6245 		/* Disable AA-loopback as it causes white noise */
6246 		spec->gen.mixer_nid = 0;
6247 		break;
6248 	case HDA_FIXUP_ACT_INIT:
6249 		/* MIC2-VREF control */
6250 		/* Set to manual mode */
6251 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6252 		/* Enable Line1 input control by verb */
6253 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6254 		break;
6255 	}
6256 }
6257 
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6258 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6259 				    const struct hda_fixup *fix, int action)
6260 {
6261 	struct alc_spec *spec = codec->spec;
6262 
6263 	switch (action) {
6264 	case HDA_FIXUP_ACT_PRE_PROBE:
6265 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6266 		break;
6267 	case HDA_FIXUP_ACT_INIT:
6268 		/* MIC2-VREF control */
6269 		/* Set to manual mode */
6270 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6271 		break;
6272 	}
6273 }
6274 
6275 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6276 static void asus_tx300_automute(struct hda_codec *codec)
6277 {
6278 	struct alc_spec *spec = codec->spec;
6279 	snd_hda_gen_update_outputs(codec);
6280 	if (snd_hda_jack_detect(codec, 0x1b))
6281 		spec->gen.mute_bits |= (1ULL << 0x14);
6282 }
6283 
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6284 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6285 				    const struct hda_fixup *fix, int action)
6286 {
6287 	struct alc_spec *spec = codec->spec;
6288 	static const struct hda_pintbl dock_pins[] = {
6289 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6290 		{}
6291 	};
6292 
6293 	switch (action) {
6294 	case HDA_FIXUP_ACT_PRE_PROBE:
6295 		spec->init_amp = ALC_INIT_DEFAULT;
6296 		/* TX300 needs to set up GPIO2 for the speaker amp */
6297 		alc_setup_gpio(codec, 0x04);
6298 		snd_hda_apply_pincfgs(codec, dock_pins);
6299 		spec->gen.auto_mute_via_amp = 1;
6300 		spec->gen.automute_hook = asus_tx300_automute;
6301 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6302 						    snd_hda_gen_hp_automute);
6303 		break;
6304 	case HDA_FIXUP_ACT_PROBE:
6305 		spec->init_amp = ALC_INIT_DEFAULT;
6306 		break;
6307 	case HDA_FIXUP_ACT_BUILD:
6308 		/* this is a bit tricky; give more sane names for the main
6309 		 * (tablet) speaker and the dock speaker, respectively
6310 		 */
6311 		rename_ctl(codec, "Speaker Playback Switch",
6312 			   "Dock Speaker Playback Switch");
6313 		rename_ctl(codec, "Bass Speaker Playback Switch",
6314 			   "Speaker Playback Switch");
6315 		break;
6316 	}
6317 }
6318 
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6319 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6320 				       const struct hda_fixup *fix, int action)
6321 {
6322 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6323 		/* DAC node 0x03 is giving mono output. We therefore want to
6324 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6325 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6326 		static const hda_nid_t conn1[] = { 0x0c };
6327 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6328 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6329 	}
6330 }
6331 
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6332 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6333 					const struct hda_fixup *fix, int action)
6334 {
6335 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6336 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6337 		   we can't adjust the speaker's volume since this node does not has
6338 		   Amp-out capability. we change the speaker's route to:
6339 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6340 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6341 		   speaker's volume now. */
6342 
6343 		static const hda_nid_t conn1[] = { 0x0c };
6344 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6345 	}
6346 }
6347 
6348 /* 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)6349 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6350 				      const struct hda_fixup *fix, int action)
6351 {
6352 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6353 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6354 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6355 	}
6356 }
6357 
6358 /* 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)6359 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6360 					  const struct hda_fixup *fix, int action)
6361 {
6362 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6363 		static const hda_nid_t conn[] = { 0x02 };
6364 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6365 	}
6366 }
6367 
6368 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6369 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6370 					  struct hda_jack_callback *jack)
6371 {
6372 	struct alc_spec *spec = codec->spec;
6373 
6374 	snd_hda_gen_hp_automute(codec, jack);
6375 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6376 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6377 			    !spec->gen.hp_jack_present);
6378 }
6379 
6380 /* Manage GPIOs for HP EliteBook Folio 9480m.
6381  *
6382  * GPIO4 is the headphone amplifier power control
6383  * GPIO3 is the audio output mute indicator LED
6384  */
6385 
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6386 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6387 				  const struct hda_fixup *fix,
6388 				  int action)
6389 {
6390 	struct alc_spec *spec = codec->spec;
6391 
6392 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6393 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6394 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6395 		spec->gpio_mask |= 0x10;
6396 		spec->gpio_dir |= 0x10;
6397 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6398 	}
6399 }
6400 
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6401 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6402 				   const struct hda_fixup *fix,
6403 				   int action)
6404 {
6405 	struct alc_spec *spec = codec->spec;
6406 
6407 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6408 		spec->gpio_mask |= 0x04;
6409 		spec->gpio_dir |= 0x04;
6410 		/* set data bit low */
6411 	}
6412 }
6413 
6414 /* Quirk for Thinkpad X1 7th and 8th Gen
6415  * The following fixed routing needed
6416  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6417  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6418  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6419  */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6420 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6421 					  const struct hda_fixup *fix, int action)
6422 {
6423 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6424 	static const hda_nid_t preferred_pairs[] = {
6425 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6426 	};
6427 	struct alc_spec *spec = codec->spec;
6428 
6429 	switch (action) {
6430 	case HDA_FIXUP_ACT_PRE_PROBE:
6431 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6432 		spec->gen.preferred_dacs = preferred_pairs;
6433 		break;
6434 	case HDA_FIXUP_ACT_BUILD:
6435 		/* The generic parser creates somewhat unintuitive volume ctls
6436 		 * with the fixed routing above, and the shared DAC2 may be
6437 		 * confusing for PA.
6438 		 * Rename those to unique names so that PA doesn't touch them
6439 		 * and use only Master volume.
6440 		 */
6441 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6442 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6443 		break;
6444 	}
6445 }
6446 
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6447 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6448 					 const struct hda_fixup *fix,
6449 					 int action)
6450 {
6451 	alc_fixup_dual_codecs(codec, fix, action);
6452 	switch (action) {
6453 	case HDA_FIXUP_ACT_PRE_PROBE:
6454 		/* override card longname to provide a unique UCM profile */
6455 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6456 		break;
6457 	case HDA_FIXUP_ACT_BUILD:
6458 		/* rename Capture controls depending on the codec */
6459 		rename_ctl(codec, "Capture Volume",
6460 			   codec->addr == 0 ?
6461 			   "Rear-Panel Capture Volume" :
6462 			   "Front-Panel Capture Volume");
6463 		rename_ctl(codec, "Capture Switch",
6464 			   codec->addr == 0 ?
6465 			   "Rear-Panel Capture Switch" :
6466 			   "Front-Panel Capture Switch");
6467 		break;
6468 	}
6469 }
6470 
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6471 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6472 				      const struct hda_fixup *fix, int action)
6473 {
6474 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6475 		return;
6476 
6477 	codec->power_save_node = 1;
6478 }
6479 
6480 /* 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)6481 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6482 				    const struct hda_fixup *fix, int action)
6483 {
6484 	struct alc_spec *spec = codec->spec;
6485 	static const hda_nid_t preferred_pairs[] = {
6486 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6487 		0
6488 	};
6489 
6490 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6491 		return;
6492 
6493 	spec->gen.preferred_dacs = preferred_pairs;
6494 	spec->gen.auto_mute_via_amp = 1;
6495 	codec->power_save_node = 0;
6496 }
6497 
6498 /* 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)6499 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6500 				    const struct hda_fixup *fix, int action)
6501 {
6502 	static const hda_nid_t preferred_pairs[] = {
6503 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6504 	};
6505 	struct alc_spec *spec = codec->spec;
6506 
6507 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6508 		spec->gen.preferred_dacs = preferred_pairs;
6509 		spec->gen.obey_preferred_dacs = 1;
6510 	}
6511 }
6512 
6513 /* 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)6514 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6515 			      const struct hda_fixup *fix, int action)
6516 {
6517 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6518 		return;
6519 
6520 	snd_hda_override_wcaps(codec, 0x03, 0);
6521 }
6522 
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6523 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6524 {
6525 	switch (codec->core.vendor_id) {
6526 	case 0x10ec0274:
6527 	case 0x10ec0294:
6528 	case 0x10ec0225:
6529 	case 0x10ec0295:
6530 	case 0x10ec0299:
6531 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6532 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6533 		break;
6534 	case 0x10ec0230:
6535 	case 0x10ec0235:
6536 	case 0x10ec0236:
6537 	case 0x10ec0255:
6538 	case 0x10ec0256:
6539 	case 0x10ec0257:
6540 	case 0x19e58326:
6541 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6542 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6543 		break;
6544 	}
6545 }
6546 
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6547 static void alc295_fixup_chromebook(struct hda_codec *codec,
6548 				    const struct hda_fixup *fix, int action)
6549 {
6550 	struct alc_spec *spec = codec->spec;
6551 
6552 	switch (action) {
6553 	case HDA_FIXUP_ACT_PRE_PROBE:
6554 		spec->ultra_low_power = true;
6555 		break;
6556 	case HDA_FIXUP_ACT_INIT:
6557 		alc_combo_jack_hp_jd_restart(codec);
6558 		break;
6559 	}
6560 }
6561 
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6562 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6563 				  const struct hda_fixup *fix, int action)
6564 {
6565 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6566 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6567 }
6568 
6569 
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6570 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6571 					struct hda_jack_callback *cb)
6572 {
6573 	/* The Windows driver sets the codec up in a very different way where
6574 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6575 	 */
6576 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6577 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6578 	else
6579 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6580 }
6581 
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6582 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6583 					const struct hda_fixup *fix, int action)
6584 {
6585 	/* Pin 0x21: headphones/headset mic */
6586 	if (!is_jack_detectable(codec, 0x21))
6587 		return;
6588 
6589 	switch (action) {
6590 	case HDA_FIXUP_ACT_PRE_PROBE:
6591 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6592 				alc294_gx502_toggle_output);
6593 		break;
6594 	case HDA_FIXUP_ACT_INIT:
6595 		/* Make sure to start in a correct state, i.e. if
6596 		 * headphones have been plugged in before powering up the system
6597 		 */
6598 		alc294_gx502_toggle_output(codec, NULL);
6599 		break;
6600 	}
6601 }
6602 
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6603 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6604 				       struct hda_jack_callback *cb)
6605 {
6606 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6607 	 * responsible from changes between speakers and headphones
6608 	 */
6609 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6610 		alc_write_coef_idx(codec, 0x10, 0x8420);
6611 	else
6612 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6613 }
6614 
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6615 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6616 				  const struct hda_fixup *fix, int action)
6617 {
6618 	if (!is_jack_detectable(codec, 0x21))
6619 		return;
6620 
6621 	switch (action) {
6622 	case HDA_FIXUP_ACT_PRE_PROBE:
6623 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6624 				alc294_gu502_toggle_output);
6625 		break;
6626 	case HDA_FIXUP_ACT_INIT:
6627 		alc294_gu502_toggle_output(codec, NULL);
6628 		break;
6629 	}
6630 }
6631 
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6632 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6633 			      const struct hda_fixup *fix, int action)
6634 {
6635 	if (action != HDA_FIXUP_ACT_INIT)
6636 		return;
6637 
6638 	msleep(100);
6639 	alc_write_coef_idx(codec, 0x65, 0x0);
6640 }
6641 
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6642 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6643 				    const struct hda_fixup *fix, int action)
6644 {
6645 	switch (action) {
6646 	case HDA_FIXUP_ACT_INIT:
6647 		alc_combo_jack_hp_jd_restart(codec);
6648 		break;
6649 	}
6650 }
6651 
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6652 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6653 				    const struct hda_fixup *fix, int action)
6654 {
6655 	struct alc_spec *spec = codec->spec;
6656 
6657 	switch (action) {
6658 	case HDA_FIXUP_ACT_PRE_PROBE:
6659 		/* Mic RING SLEEVE swap for combo jack */
6660 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6661 		spec->no_internal_mic_pin = true;
6662 		break;
6663 	case HDA_FIXUP_ACT_INIT:
6664 		alc_combo_jack_hp_jd_restart(codec);
6665 		break;
6666 	}
6667 }
6668 
6669 /* GPIO1 = amplifier on/off
6670  * GPIO3 = mic mute LED
6671  */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6672 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6673 					  const struct hda_fixup *fix, int action)
6674 {
6675 	static const hda_nid_t conn[] = { 0x02 };
6676 
6677 	struct alc_spec *spec = codec->spec;
6678 	static const struct hda_pintbl pincfgs[] = {
6679 		{ 0x14, 0x90170110 },  /* front/high speakers */
6680 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6681 		{ }
6682 	};
6683 
6684 	//enable micmute led
6685 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6686 
6687 	switch (action) {
6688 	case HDA_FIXUP_ACT_PRE_PROBE:
6689 		spec->micmute_led_polarity = 1;
6690 		/* needed for amp of back speakers */
6691 		spec->gpio_mask |= 0x01;
6692 		spec->gpio_dir |= 0x01;
6693 		snd_hda_apply_pincfgs(codec, pincfgs);
6694 		/* share DAC to have unified volume control */
6695 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6696 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6697 		break;
6698 	case HDA_FIXUP_ACT_INIT:
6699 		/* need to toggle GPIO to enable the amp of back speakers */
6700 		alc_update_gpio_data(codec, 0x01, true);
6701 		msleep(100);
6702 		alc_update_gpio_data(codec, 0x01, false);
6703 		break;
6704 	}
6705 }
6706 
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6707 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6708 					  const struct hda_fixup *fix, int action)
6709 {
6710 	static const hda_nid_t conn[] = { 0x02 };
6711 	static const struct hda_pintbl pincfgs[] = {
6712 		{ 0x14, 0x90170110 },  /* rear speaker */
6713 		{ }
6714 	};
6715 
6716 	switch (action) {
6717 	case HDA_FIXUP_ACT_PRE_PROBE:
6718 		snd_hda_apply_pincfgs(codec, pincfgs);
6719 		/* force front speaker to DAC1 */
6720 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6721 		break;
6722 	}
6723 }
6724 
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6725 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6726 				      const struct hda_fixup *fix,
6727 				      int action)
6728 {
6729 	static const struct coef_fw coefs[] = {
6730 		WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6731 		WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6732 		WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6733 		WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6734 		WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6735 		WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6736 		WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6737 		WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6738 		WRITE_COEF(0x6e, 0x1005), { }
6739 	};
6740 
6741 	static const struct hda_pintbl pincfgs[] = {
6742 		{ 0x12, 0xb7a60130 },  /* Internal microphone*/
6743 		{ 0x14, 0x90170150 },  /* B&O soundbar speakers */
6744 		{ 0x17, 0x90170153 },  /* Side speakers */
6745 		{ 0x19, 0x03a11040 },  /* Headset microphone */
6746 		{ }
6747 	};
6748 
6749 	switch (action) {
6750 	case HDA_FIXUP_ACT_PRE_PROBE:
6751 		snd_hda_apply_pincfgs(codec, pincfgs);
6752 
6753 		/* Fixes volume control problem for side speakers */
6754 		alc295_fixup_disable_dac3(codec, fix, action);
6755 
6756 		/* Fixes no sound from headset speaker */
6757 		snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
6758 
6759 		/* Auto-enable headset mic when plugged */
6760 		snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
6761 
6762 		/* Headset mic volume enhancement */
6763 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
6764 		break;
6765 	case HDA_FIXUP_ACT_INIT:
6766 		alc_process_coef_fw(codec, coefs);
6767 		break;
6768 	case HDA_FIXUP_ACT_BUILD:
6769 		rename_ctl(codec, "Bass Speaker Playback Volume",
6770 			   "B&O-Tuned Playback Volume");
6771 		rename_ctl(codec, "Front Playback Switch",
6772 			   "B&O Soundbar Playback Switch");
6773 		rename_ctl(codec, "Bass Speaker Playback Switch",
6774 			   "Side Speaker Playback Switch");
6775 		break;
6776 	}
6777 }
6778 
6779 /* for hda_fixup_thinkpad_acpi() */
6780 #include "thinkpad_helper.c"
6781 
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)6782 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6783 				    const struct hda_fixup *fix, int action)
6784 {
6785 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6786 	hda_fixup_thinkpad_acpi(codec, fix, action);
6787 }
6788 
6789 /* 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)6790 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6791 						  const struct hda_fixup *fix,
6792 						  int action)
6793 {
6794 	struct alc_spec *spec = codec->spec;
6795 
6796 	switch (action) {
6797 	case HDA_FIXUP_ACT_PRE_PROBE:
6798 		spec->gen.suppress_auto_mute = 1;
6799 		break;
6800 	}
6801 }
6802 
comp_bind(struct device * dev)6803 static int comp_bind(struct device *dev)
6804 {
6805 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6806 	struct alc_spec *spec = cdc->spec;
6807 
6808 	return component_bind_all(dev, spec->comps);
6809 }
6810 
comp_unbind(struct device * dev)6811 static void comp_unbind(struct device *dev)
6812 {
6813 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6814 	struct alc_spec *spec = cdc->spec;
6815 
6816 	component_unbind_all(dev, spec->comps);
6817 }
6818 
6819 static const struct component_master_ops comp_master_ops = {
6820 	.bind = comp_bind,
6821 	.unbind = comp_unbind,
6822 };
6823 
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)6824 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6825 				       struct snd_pcm_substream *sub, int action)
6826 {
6827 	struct alc_spec *spec = cdc->spec;
6828 	int i;
6829 
6830 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6831 		if (spec->comps[i].dev && spec->comps[i].pre_playback_hook)
6832 			spec->comps[i].pre_playback_hook(spec->comps[i].dev, action);
6833 	}
6834 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6835 		if (spec->comps[i].dev && spec->comps[i].playback_hook)
6836 			spec->comps[i].playback_hook(spec->comps[i].dev, action);
6837 	}
6838 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6839 		if (spec->comps[i].dev && spec->comps[i].post_playback_hook)
6840 			spec->comps[i].post_playback_hook(spec->comps[i].dev, action);
6841 	}
6842 }
6843 
6844 struct scodec_dev_name {
6845 	const char *bus;
6846 	const char *hid;
6847 	int index;
6848 };
6849 
6850 /* match the device name in a slightly relaxed manner */
comp_match_cs35l41_dev_name(struct device * dev,void * data)6851 static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
6852 {
6853 	struct scodec_dev_name *p = data;
6854 	const char *d = dev_name(dev);
6855 	int n = strlen(p->bus);
6856 	char tmp[32];
6857 
6858 	/* check the bus name */
6859 	if (strncmp(d, p->bus, n))
6860 		return 0;
6861 	/* skip the bus number */
6862 	if (isdigit(d[n]))
6863 		n++;
6864 	/* the rest must be exact matching */
6865 	snprintf(tmp, sizeof(tmp), "-%s:00-cs35l41-hda.%d", p->hid, p->index);
6866 	return !strcmp(d + n, tmp);
6867 }
6868 
comp_match_tas2781_dev_name(struct device * dev,void * data)6869 static int comp_match_tas2781_dev_name(struct device *dev,
6870 	void *data)
6871 {
6872 	struct scodec_dev_name *p = data;
6873 	const char *d = dev_name(dev);
6874 	int n = strlen(p->bus);
6875 	char tmp[32];
6876 
6877 	/* check the bus name */
6878 	if (strncmp(d, p->bus, n))
6879 		return 0;
6880 	/* skip the bus number */
6881 	if (isdigit(d[n]))
6882 		n++;
6883 	/* the rest must be exact matching */
6884 	snprintf(tmp, sizeof(tmp), "-%s:00", p->hid);
6885 
6886 	return !strcmp(d + n, tmp);
6887 }
6888 
cs35l41_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,int count)6889 static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6890 				  const char *hid, int count)
6891 {
6892 	struct device *dev = hda_codec_dev(cdc);
6893 	struct alc_spec *spec = cdc->spec;
6894 	struct scodec_dev_name *rec;
6895 	int ret, i;
6896 
6897 	switch (action) {
6898 	case HDA_FIXUP_ACT_PRE_PROBE:
6899 		for (i = 0; i < count; i++) {
6900 			rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6901 			if (!rec)
6902 				return;
6903 			rec->bus = bus;
6904 			rec->hid = hid;
6905 			rec->index = i;
6906 			spec->comps[i].codec = cdc;
6907 			component_match_add(dev, &spec->match,
6908 					    comp_match_cs35l41_dev_name, rec);
6909 		}
6910 		ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6911 		if (ret)
6912 			codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6913 		else
6914 			spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6915 		break;
6916 	case HDA_FIXUP_ACT_FREE:
6917 		component_master_del(dev, &comp_master_ops);
6918 		break;
6919 	}
6920 }
6921 
tas2781_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid)6922 static void tas2781_generic_fixup(struct hda_codec *cdc, int action,
6923 	const char *bus, const char *hid)
6924 {
6925 	struct device *dev = hda_codec_dev(cdc);
6926 	struct alc_spec *spec = cdc->spec;
6927 	struct scodec_dev_name *rec;
6928 	int ret;
6929 
6930 	switch (action) {
6931 	case HDA_FIXUP_ACT_PRE_PROBE:
6932 		rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6933 		if (!rec)
6934 			return;
6935 		rec->bus = bus;
6936 		rec->hid = hid;
6937 		rec->index = 0;
6938 		spec->comps[0].codec = cdc;
6939 		component_match_add(dev, &spec->match,
6940 			comp_match_tas2781_dev_name, rec);
6941 		ret = component_master_add_with_match(dev, &comp_master_ops,
6942 			spec->match);
6943 		if (ret)
6944 			codec_err(cdc,
6945 				"Fail to register component aggregator %d\n",
6946 				ret);
6947 		else
6948 			spec->gen.pcm_playback_hook =
6949 				comp_generic_playback_hook;
6950 		break;
6951 	case HDA_FIXUP_ACT_FREE:
6952 		component_master_del(dev, &comp_master_ops);
6953 		break;
6954 	}
6955 }
6956 
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6957 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6958 {
6959 	cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6960 }
6961 
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)6962 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6963 {
6964 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2);
6965 }
6966 
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)6967 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6968 {
6969 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4);
6970 }
6971 
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6972 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6973 						 int action)
6974 {
6975 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
6976 }
6977 
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6978 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6979 						 int action)
6980 {
6981 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0101", 2);
6982 }
6983 
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6984 static void tas2781_fixup_i2c(struct hda_codec *cdc,
6985 	const struct hda_fixup *fix, int action)
6986 {
6987 	 tas2781_generic_fixup(cdc, action, "i2c", "TIAS2781");
6988 }
6989 
6990 /* for alc295_fixup_hp_top_speakers */
6991 #include "hp_x360_helper.c"
6992 
6993 /* for alc285_fixup_ideapad_s740_coef() */
6994 #include "ideapad_s740_helper.c"
6995 
6996 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6997 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6998 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6999 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
7000 	{}
7001 };
7002 
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)7003 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
7004 					   const struct hda_fixup *fix,
7005 					   int action)
7006 {
7007 	/*
7008 	 * A certain other OS sets these coeffs to different values. On at least
7009 	 * one TongFang barebone these settings might survive even a cold
7010 	 * reboot. So to restore a clean slate the values are explicitly reset
7011 	 * to default here. Without this, the external microphone is always in a
7012 	 * plugged-in state, while the internal microphone is always in an
7013 	 * unplugged state, breaking the ability to use the internal microphone.
7014 	 */
7015 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7016 }
7017 
7018 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7019 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7020 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7021 	WRITE_COEF(0x49, 0x0149),
7022 	{}
7023 };
7024 
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7025 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7026 				       const struct hda_fixup *fix,
7027 				       int action)
7028 {
7029 	/*
7030 	 * The audio jack input and output is not detected on the ASRock NUC Box
7031 	 * 1100 series when cold booting without this fix. Warm rebooting from a
7032 	 * certain other OS makes the audio functional, as COEF settings are
7033 	 * preserved in this case. This fix sets these altered COEF values as
7034 	 * the default.
7035 	 */
7036 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7037 }
7038 
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7039 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7040 						    const struct hda_fixup *fix,
7041 						    int action)
7042 {
7043 	/*
7044 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7045 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7046 	 * needs an additional quirk for sound working after suspend and resume.
7047 	 */
7048 	if (codec->core.vendor_id == 0x10ec0256) {
7049 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7050 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7051 	} else {
7052 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7053 	}
7054 }
7055 
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7056 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7057 						  const struct hda_fixup *fix,
7058 						  int action)
7059 {
7060 	struct alc_spec *spec = codec->spec;
7061 	struct hda_input_mux *imux = &spec->gen.input_mux;
7062 	int i;
7063 
7064 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
7065 
7066 	switch (action) {
7067 	case HDA_FIXUP_ACT_PRE_PROBE:
7068 		/**
7069 		 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7070 		 * to Hi-Z to avoid pop noises at startup and when plugging and
7071 		 * unplugging headphones.
7072 		 */
7073 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7074 		snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7075 		break;
7076 	case HDA_FIXUP_ACT_PROBE:
7077 		/**
7078 		 * Make the internal mic (0x12) the default input source to
7079 		 * prevent pop noises on cold boot.
7080 		 */
7081 		for (i = 0; i < imux->num_items; i++) {
7082 			if (spec->gen.imux_pins[i] == 0x12) {
7083 				spec->gen.cur_mux[0] = i;
7084 				break;
7085 			}
7086 		}
7087 		break;
7088 	}
7089 }
7090 
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7091 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7092 					  const struct hda_fixup *fix, int action)
7093 {
7094 	/*
7095 	 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7096 	 * unconnected.
7097 	 */
7098 	static const struct hda_pintbl pincfgs[] = {
7099 		{ 0x17, 0x90170121 },
7100 		{ }
7101 	};
7102 	/*
7103 	 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7104 	 * DAC 0x02 and 0x03 would be fine.
7105 	 */
7106 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7107 	/*
7108 	 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7109 	 * Headphones (0x21) are connected to DAC 0x03.
7110 	 */
7111 	static const hda_nid_t preferred_pairs[] = {
7112 		0x14, 0x02,
7113 		0x17, 0x02,
7114 		0x21, 0x03,
7115 		0
7116 	};
7117 	struct alc_spec *spec = codec->spec;
7118 
7119 	switch (action) {
7120 	case HDA_FIXUP_ACT_PRE_PROBE:
7121 		snd_hda_apply_pincfgs(codec, pincfgs);
7122 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7123 		spec->gen.preferred_dacs = preferred_pairs;
7124 		break;
7125 	}
7126 }
7127 
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7128 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7129 					  const struct hda_fixup *fix, int action)
7130 {
7131 	static const struct hda_pintbl pincfgs[] = {
7132 		{ 0x14, 0x90170151 },
7133 		{ 0x17, 0x90170150 },
7134 		{ }
7135 	};
7136 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7137 	static const hda_nid_t preferred_pairs[] = {
7138 		0x14, 0x02,
7139 		0x17, 0x03,
7140 		0x21, 0x02,
7141 		0
7142 	};
7143 	struct alc_spec *spec = codec->spec;
7144 
7145 	alc_fixup_no_shutup(codec, fix, action);
7146 
7147 	switch (action) {
7148 	case HDA_FIXUP_ACT_PRE_PROBE:
7149 		snd_hda_apply_pincfgs(codec, pincfgs);
7150 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7151 		spec->gen.preferred_dacs = preferred_pairs;
7152 		break;
7153 	}
7154 }
7155 
7156 /* 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)7157 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7158 				    const struct hda_fixup *fix, int action)
7159 {
7160 	struct alc_spec *spec = codec->spec;
7161 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7162 	static const hda_nid_t preferred_pairs[] = {
7163 		0x17, 0x02, 0x21, 0x03, 0
7164 	};
7165 
7166 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7167 		return;
7168 
7169 	snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7170 	spec->gen.preferred_dacs = preferred_pairs;
7171 	spec->gen.auto_mute_via_amp = 1;
7172 	if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7173 		snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7174 					0x0); /* Make sure 0x14 was disable */
7175 	}
7176 }
7177 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7178 static void alc_fixup_headset_mic(struct hda_codec *codec,
7179 				   const struct hda_fixup *fix, int action)
7180 {
7181 	struct alc_spec *spec = codec->spec;
7182 	static const struct hda_pintbl pincfgs[] = {
7183 		{ 0x19, 0x03a1103c },
7184 		{ }
7185 	};
7186 
7187 	switch (action) {
7188 	case HDA_FIXUP_ACT_PRE_PROBE:
7189 		snd_hda_apply_pincfgs(codec, pincfgs);
7190 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7191 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7192 		break;
7193 	}
7194 }
7195 
7196 
7197 enum {
7198 	ALC269_FIXUP_GPIO2,
7199 	ALC269_FIXUP_SONY_VAIO,
7200 	ALC275_FIXUP_SONY_VAIO_GPIO2,
7201 	ALC269_FIXUP_DELL_M101Z,
7202 	ALC269_FIXUP_SKU_IGNORE,
7203 	ALC269_FIXUP_ASUS_G73JW,
7204 	ALC269_FIXUP_ASUS_N7601ZM_PINS,
7205 	ALC269_FIXUP_ASUS_N7601ZM,
7206 	ALC269_FIXUP_LENOVO_EAPD,
7207 	ALC275_FIXUP_SONY_HWEQ,
7208 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
7209 	ALC271_FIXUP_DMIC,
7210 	ALC269_FIXUP_PCM_44K,
7211 	ALC269_FIXUP_STEREO_DMIC,
7212 	ALC269_FIXUP_HEADSET_MIC,
7213 	ALC269_FIXUP_QUANTA_MUTE,
7214 	ALC269_FIXUP_LIFEBOOK,
7215 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
7216 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
7217 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7218 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7219 	ALC269_FIXUP_AMIC,
7220 	ALC269_FIXUP_DMIC,
7221 	ALC269VB_FIXUP_AMIC,
7222 	ALC269VB_FIXUP_DMIC,
7223 	ALC269_FIXUP_HP_MUTE_LED,
7224 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
7225 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
7226 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
7227 	ALC269_FIXUP_HP_GPIO_LED,
7228 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
7229 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
7230 	ALC269_FIXUP_INV_DMIC,
7231 	ALC269_FIXUP_LENOVO_DOCK,
7232 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7233 	ALC269_FIXUP_NO_SHUTUP,
7234 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7235 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7236 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7237 	ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7238 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7239 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7240 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7241 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7242 	ALC269_FIXUP_HEADSET_MODE,
7243 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7244 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7245 	ALC269_FIXUP_ASUS_X101_FUNC,
7246 	ALC269_FIXUP_ASUS_X101_VERB,
7247 	ALC269_FIXUP_ASUS_X101,
7248 	ALC271_FIXUP_AMIC_MIC2,
7249 	ALC271_FIXUP_HP_GATE_MIC_JACK,
7250 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7251 	ALC269_FIXUP_ACER_AC700,
7252 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7253 	ALC269VB_FIXUP_ASUS_ZENBOOK,
7254 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7255 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7256 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7257 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
7258 	ALC283_FIXUP_CHROME_BOOK,
7259 	ALC283_FIXUP_SENSE_COMBO_JACK,
7260 	ALC282_FIXUP_ASUS_TX300,
7261 	ALC283_FIXUP_INT_MIC,
7262 	ALC290_FIXUP_MONO_SPEAKERS,
7263 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7264 	ALC290_FIXUP_SUBWOOFER,
7265 	ALC290_FIXUP_SUBWOOFER_HSJACK,
7266 	ALC269_FIXUP_THINKPAD_ACPI,
7267 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7268 	ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7269 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7270 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7271 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7272 	ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7273 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7274 	ALC255_FIXUP_HEADSET_MODE,
7275 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7276 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7277 	ALC292_FIXUP_TPT440_DOCK,
7278 	ALC292_FIXUP_TPT440,
7279 	ALC283_FIXUP_HEADSET_MIC,
7280 	ALC255_FIXUP_MIC_MUTE_LED,
7281 	ALC282_FIXUP_ASPIRE_V5_PINS,
7282 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
7283 	ALC280_FIXUP_HP_GPIO4,
7284 	ALC286_FIXUP_HP_GPIO_LED,
7285 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7286 	ALC280_FIXUP_HP_DOCK_PINS,
7287 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7288 	ALC280_FIXUP_HP_9480M,
7289 	ALC245_FIXUP_HP_X360_AMP,
7290 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7291 	ALC285_FIXUP_HP_ENVY_X360,
7292 	ALC288_FIXUP_DELL_HEADSET_MODE,
7293 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7294 	ALC288_FIXUP_DELL_XPS_13,
7295 	ALC288_FIXUP_DISABLE_AAMIX,
7296 	ALC292_FIXUP_DELL_E7X_AAMIX,
7297 	ALC292_FIXUP_DELL_E7X,
7298 	ALC292_FIXUP_DISABLE_AAMIX,
7299 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7300 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7301 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7302 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7303 	ALC275_FIXUP_DELL_XPS,
7304 	ALC293_FIXUP_LENOVO_SPK_NOISE,
7305 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7306 	ALC255_FIXUP_DELL_SPK_NOISE,
7307 	ALC225_FIXUP_DISABLE_MIC_VREF,
7308 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7309 	ALC295_FIXUP_DISABLE_DAC3,
7310 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
7311 	ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7312 	ALC285_FIXUP_ASUS_HEADSET_MIC,
7313 	ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7314 	ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7315 	ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7316 	ALC280_FIXUP_HP_HEADSET_MIC,
7317 	ALC221_FIXUP_HP_FRONT_MIC,
7318 	ALC292_FIXUP_TPT460,
7319 	ALC298_FIXUP_SPK_VOLUME,
7320 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
7321 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7322 	ALC269_FIXUP_ATIV_BOOK_8,
7323 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7324 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7325 	ALC256_FIXUP_ASUS_HEADSET_MODE,
7326 	ALC256_FIXUP_ASUS_MIC,
7327 	ALC256_FIXUP_ASUS_AIO_GPIO2,
7328 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7329 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7330 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
7331 	ALC233_FIXUP_ACER_HEADSET_MIC,
7332 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
7333 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7334 	ALC225_FIXUP_S3_POP_NOISE,
7335 	ALC700_FIXUP_INTEL_REFERENCE,
7336 	ALC274_FIXUP_DELL_BIND_DACS,
7337 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7338 	ALC298_FIXUP_TPT470_DOCK_FIX,
7339 	ALC298_FIXUP_TPT470_DOCK,
7340 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7341 	ALC255_FIXUP_DELL_HEADSET_MIC,
7342 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7343 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
7344 	ALC295_FIXUP_HP_X360,
7345 	ALC221_FIXUP_HP_HEADSET_MIC,
7346 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7347 	ALC295_FIXUP_HP_AUTO_MUTE,
7348 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7349 	ALC294_FIXUP_ASUS_MIC,
7350 	ALC294_FIXUP_ASUS_HEADSET_MIC,
7351 	ALC294_FIXUP_ASUS_SPK,
7352 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7353 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7354 	ALC255_FIXUP_ACER_HEADSET_MIC,
7355 	ALC295_FIXUP_CHROME_BOOK,
7356 	ALC225_FIXUP_HEADSET_JACK,
7357 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7358 	ALC225_FIXUP_WYSE_AUTO_MUTE,
7359 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7360 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7361 	ALC256_FIXUP_ASUS_HEADSET_MIC,
7362 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7363 	ALC255_FIXUP_PREDATOR_SUBWOOFER,
7364 	ALC299_FIXUP_PREDATOR_SPK,
7365 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7366 	ALC289_FIXUP_DELL_SPK1,
7367 	ALC289_FIXUP_DELL_SPK2,
7368 	ALC289_FIXUP_DUAL_SPK,
7369 	ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7370 	ALC294_FIXUP_SPK2_TO_DAC1,
7371 	ALC294_FIXUP_ASUS_DUAL_SPK,
7372 	ALC285_FIXUP_THINKPAD_X1_GEN7,
7373 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7374 	ALC294_FIXUP_ASUS_ALLY,
7375 	ALC294_FIXUP_ASUS_ALLY_PINS,
7376 	ALC294_FIXUP_ASUS_ALLY_VERBS,
7377 	ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7378 	ALC294_FIXUP_ASUS_HPE,
7379 	ALC294_FIXUP_ASUS_COEF_1B,
7380 	ALC294_FIXUP_ASUS_GX502_HP,
7381 	ALC294_FIXUP_ASUS_GX502_PINS,
7382 	ALC294_FIXUP_ASUS_GX502_VERBS,
7383 	ALC294_FIXUP_ASUS_GU502_HP,
7384 	ALC294_FIXUP_ASUS_GU502_PINS,
7385 	ALC294_FIXUP_ASUS_GU502_VERBS,
7386 	ALC294_FIXUP_ASUS_G513_PINS,
7387 	ALC285_FIXUP_ASUS_G533Z_PINS,
7388 	ALC285_FIXUP_HP_GPIO_LED,
7389 	ALC285_FIXUP_HP_MUTE_LED,
7390 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7391 	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7392 	ALC236_FIXUP_HP_GPIO_LED,
7393 	ALC236_FIXUP_HP_MUTE_LED,
7394 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7395 	ALC236_FIXUP_LENOVO_INV_DMIC,
7396 	ALC298_FIXUP_SAMSUNG_AMP,
7397 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7398 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7399 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7400 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7401 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
7402 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7403 	ALC289_FIXUP_ASUS_GA401,
7404 	ALC289_FIXUP_ASUS_GA502,
7405 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7406 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
7407 	ALC269_FIXUP_CZC_B20,
7408 	ALC269_FIXUP_CZC_TMI,
7409 	ALC269_FIXUP_CZC_L101,
7410 	ALC269_FIXUP_LEMOTE_A1802,
7411 	ALC269_FIXUP_LEMOTE_A190X,
7412 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
7413 	ALC233_FIXUP_INTEL_NUC8_DMIC,
7414 	ALC233_FIXUP_INTEL_NUC8_BOOST,
7415 	ALC256_FIXUP_INTEL_NUC10,
7416 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7417 	ALC274_FIXUP_HP_MIC,
7418 	ALC274_FIXUP_HP_HEADSET_MIC,
7419 	ALC274_FIXUP_HP_ENVY_GPIO,
7420 	ALC256_FIXUP_ASUS_HPE,
7421 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7422 	ALC287_FIXUP_HP_GPIO_LED,
7423 	ALC256_FIXUP_HP_HEADSET_MIC,
7424 	ALC245_FIXUP_HP_GPIO_LED,
7425 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7426 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7427 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7428 	ALC256_FIXUP_ACER_HEADSET_MIC,
7429 	ALC285_FIXUP_IDEAPAD_S740_COEF,
7430 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7431 	ALC295_FIXUP_ASUS_DACS,
7432 	ALC295_FIXUP_HP_OMEN,
7433 	ALC285_FIXUP_HP_SPECTRE_X360,
7434 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7435 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7436 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7437 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7438 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7439 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7440 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7441 	ALC298_FIXUP_LENOVO_C940_DUET7,
7442 	ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
7443 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
7444 	ALC256_FIXUP_SET_COEF_DEFAULTS,
7445 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7446 	ALC233_FIXUP_NO_AUDIO_JACK,
7447 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7448 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7449 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7450 	ALC287_FIXUP_LEGION_16ACHG6,
7451 	ALC287_FIXUP_CS35L41_I2C_2,
7452 	ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7453 	ALC245_FIXUP_CS35L41_SPI_2,
7454 	ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7455 	ALC245_FIXUP_CS35L41_SPI_4,
7456 	ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7457 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7458 	ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7459 	ALC287_FIXUP_LEGION_16ITHG6,
7460 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7461 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7462 	ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7463 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7464 	ALC236_FIXUP_DELL_DUAL_CODECS,
7465 	ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7466 	ALC287_FIXUP_TAS2781_I2C,
7467 	ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7468 	ALC245_FIXUP_HP_X360_MUTE_LEDS,
7469 	ALC287_FIXUP_THINKPAD_I2S_SPK,
7470 	ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7471 	ALC2XX_FIXUP_HEADSET_MIC,
7472 	ALC289_FIXUP_DELL_CS35L41_SPI_2,
7473 	ALC294_FIXUP_CS35L41_I2C_2,
7474 };
7475 
7476 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7477  * both have the very same PCI SSID, and we need to apply different fixups
7478  * depending on the codec ID
7479  */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)7480 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7481 					   const struct hda_fixup *fix,
7482 					   int action)
7483 {
7484 	int id;
7485 
7486 	if (codec->core.vendor_id == 0x10ec0298)
7487 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7488 	else
7489 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7490 	__snd_hda_apply_fixup(codec, id, action, 0);
7491 }
7492 
7493 /* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
7494  * 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
7495  * so we need to apply a different fixup in this case. The only DuetITL codec
7496  * SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
7497  * and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
7498  * have matched correctly by their codecs.
7499  */
alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec * codec,const struct hda_fixup * fix,int action)7500 static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
7501 					      const struct hda_fixup *fix,
7502 					      int action)
7503 {
7504 	int id;
7505 
7506 	if (codec->core.subsystem_id == 0x17aa3802)
7507 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
7508 	else
7509 		id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
7510 	__snd_hda_apply_fixup(codec, id, action, 0);
7511 }
7512 
7513 static const struct hda_fixup alc269_fixups[] = {
7514 	[ALC269_FIXUP_GPIO2] = {
7515 		.type = HDA_FIXUP_FUNC,
7516 		.v.func = alc_fixup_gpio2,
7517 	},
7518 	[ALC269_FIXUP_SONY_VAIO] = {
7519 		.type = HDA_FIXUP_PINCTLS,
7520 		.v.pins = (const struct hda_pintbl[]) {
7521 			{0x19, PIN_VREFGRD},
7522 			{}
7523 		}
7524 	},
7525 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7526 		.type = HDA_FIXUP_FUNC,
7527 		.v.func = alc275_fixup_gpio4_off,
7528 		.chained = true,
7529 		.chain_id = ALC269_FIXUP_SONY_VAIO
7530 	},
7531 	[ALC269_FIXUP_DELL_M101Z] = {
7532 		.type = HDA_FIXUP_VERBS,
7533 		.v.verbs = (const struct hda_verb[]) {
7534 			/* Enables internal speaker */
7535 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
7536 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7537 			{}
7538 		}
7539 	},
7540 	[ALC269_FIXUP_SKU_IGNORE] = {
7541 		.type = HDA_FIXUP_FUNC,
7542 		.v.func = alc_fixup_sku_ignore,
7543 	},
7544 	[ALC269_FIXUP_ASUS_G73JW] = {
7545 		.type = HDA_FIXUP_PINS,
7546 		.v.pins = (const struct hda_pintbl[]) {
7547 			{ 0x17, 0x99130111 }, /* subwoofer */
7548 			{ }
7549 		}
7550 	},
7551 	[ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7552 		.type = HDA_FIXUP_PINS,
7553 		.v.pins = (const struct hda_pintbl[]) {
7554 			{ 0x19, 0x03A11050 },
7555 			{ 0x1a, 0x03A11C30 },
7556 			{ 0x21, 0x03211420 },
7557 			{ }
7558 		}
7559 	},
7560 	[ALC269_FIXUP_ASUS_N7601ZM] = {
7561 		.type = HDA_FIXUP_VERBS,
7562 		.v.verbs = (const struct hda_verb[]) {
7563 			{0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7564 			{0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7565 			{0x20, AC_VERB_SET_COEF_INDEX, 0x10},
7566 			{0x20, AC_VERB_SET_PROC_COEF, 0x8420},
7567 			{0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
7568 			{0x20, AC_VERB_SET_PROC_COEF, 0x7774},
7569 			{ }
7570 		},
7571 		.chained = true,
7572 		.chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
7573 	},
7574 	[ALC269_FIXUP_LENOVO_EAPD] = {
7575 		.type = HDA_FIXUP_VERBS,
7576 		.v.verbs = (const struct hda_verb[]) {
7577 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7578 			{}
7579 		}
7580 	},
7581 	[ALC275_FIXUP_SONY_HWEQ] = {
7582 		.type = HDA_FIXUP_FUNC,
7583 		.v.func = alc269_fixup_hweq,
7584 		.chained = true,
7585 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7586 	},
7587 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7588 		.type = HDA_FIXUP_FUNC,
7589 		.v.func = alc_fixup_disable_aamix,
7590 		.chained = true,
7591 		.chain_id = ALC269_FIXUP_SONY_VAIO
7592 	},
7593 	[ALC271_FIXUP_DMIC] = {
7594 		.type = HDA_FIXUP_FUNC,
7595 		.v.func = alc271_fixup_dmic,
7596 	},
7597 	[ALC269_FIXUP_PCM_44K] = {
7598 		.type = HDA_FIXUP_FUNC,
7599 		.v.func = alc269_fixup_pcm_44k,
7600 		.chained = true,
7601 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7602 	},
7603 	[ALC269_FIXUP_STEREO_DMIC] = {
7604 		.type = HDA_FIXUP_FUNC,
7605 		.v.func = alc269_fixup_stereo_dmic,
7606 	},
7607 	[ALC269_FIXUP_HEADSET_MIC] = {
7608 		.type = HDA_FIXUP_FUNC,
7609 		.v.func = alc269_fixup_headset_mic,
7610 	},
7611 	[ALC269_FIXUP_QUANTA_MUTE] = {
7612 		.type = HDA_FIXUP_FUNC,
7613 		.v.func = alc269_fixup_quanta_mute,
7614 	},
7615 	[ALC269_FIXUP_LIFEBOOK] = {
7616 		.type = HDA_FIXUP_PINS,
7617 		.v.pins = (const struct hda_pintbl[]) {
7618 			{ 0x1a, 0x2101103f }, /* dock line-out */
7619 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
7620 			{ }
7621 		},
7622 		.chained = true,
7623 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7624 	},
7625 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7626 		.type = HDA_FIXUP_PINS,
7627 		.v.pins = (const struct hda_pintbl[]) {
7628 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7629 			{ }
7630 		},
7631 	},
7632 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7633 		.type = HDA_FIXUP_PINS,
7634 		.v.pins = (const struct hda_pintbl[]) {
7635 			{ 0x21, 0x0221102f }, /* HP out */
7636 			{ }
7637 		},
7638 	},
7639 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7640 		.type = HDA_FIXUP_FUNC,
7641 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7642 	},
7643 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7644 		.type = HDA_FIXUP_FUNC,
7645 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7646 	},
7647 	[ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
7648 		.type = HDA_FIXUP_PINS,
7649 		.v.pins = (const struct hda_pintbl[]) {
7650 			{ 0x18, 0x03a19020 }, /* headset mic */
7651 			{ 0x1b, 0x90170150 }, /* speaker */
7652 			{ }
7653 		},
7654 	},
7655 	[ALC269_FIXUP_AMIC] = {
7656 		.type = HDA_FIXUP_PINS,
7657 		.v.pins = (const struct hda_pintbl[]) {
7658 			{ 0x14, 0x99130110 }, /* speaker */
7659 			{ 0x15, 0x0121401f }, /* HP out */
7660 			{ 0x18, 0x01a19c20 }, /* mic */
7661 			{ 0x19, 0x99a3092f }, /* int-mic */
7662 			{ }
7663 		},
7664 	},
7665 	[ALC269_FIXUP_DMIC] = {
7666 		.type = HDA_FIXUP_PINS,
7667 		.v.pins = (const struct hda_pintbl[]) {
7668 			{ 0x12, 0x99a3092f }, /* int-mic */
7669 			{ 0x14, 0x99130110 }, /* speaker */
7670 			{ 0x15, 0x0121401f }, /* HP out */
7671 			{ 0x18, 0x01a19c20 }, /* mic */
7672 			{ }
7673 		},
7674 	},
7675 	[ALC269VB_FIXUP_AMIC] = {
7676 		.type = HDA_FIXUP_PINS,
7677 		.v.pins = (const struct hda_pintbl[]) {
7678 			{ 0x14, 0x99130110 }, /* speaker */
7679 			{ 0x18, 0x01a19c20 }, /* mic */
7680 			{ 0x19, 0x99a3092f }, /* int-mic */
7681 			{ 0x21, 0x0121401f }, /* HP out */
7682 			{ }
7683 		},
7684 	},
7685 	[ALC269VB_FIXUP_DMIC] = {
7686 		.type = HDA_FIXUP_PINS,
7687 		.v.pins = (const struct hda_pintbl[]) {
7688 			{ 0x12, 0x99a3092f }, /* int-mic */
7689 			{ 0x14, 0x99130110 }, /* speaker */
7690 			{ 0x18, 0x01a19c20 }, /* mic */
7691 			{ 0x21, 0x0121401f }, /* HP out */
7692 			{ }
7693 		},
7694 	},
7695 	[ALC269_FIXUP_HP_MUTE_LED] = {
7696 		.type = HDA_FIXUP_FUNC,
7697 		.v.func = alc269_fixup_hp_mute_led,
7698 	},
7699 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7700 		.type = HDA_FIXUP_FUNC,
7701 		.v.func = alc269_fixup_hp_mute_led_mic1,
7702 	},
7703 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7704 		.type = HDA_FIXUP_FUNC,
7705 		.v.func = alc269_fixup_hp_mute_led_mic2,
7706 	},
7707 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7708 		.type = HDA_FIXUP_FUNC,
7709 		.v.func = alc269_fixup_hp_mute_led_mic3,
7710 		.chained = true,
7711 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7712 	},
7713 	[ALC269_FIXUP_HP_GPIO_LED] = {
7714 		.type = HDA_FIXUP_FUNC,
7715 		.v.func = alc269_fixup_hp_gpio_led,
7716 	},
7717 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7718 		.type = HDA_FIXUP_FUNC,
7719 		.v.func = alc269_fixup_hp_gpio_mic1_led,
7720 	},
7721 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7722 		.type = HDA_FIXUP_FUNC,
7723 		.v.func = alc269_fixup_hp_line1_mic1_led,
7724 	},
7725 	[ALC269_FIXUP_INV_DMIC] = {
7726 		.type = HDA_FIXUP_FUNC,
7727 		.v.func = alc_fixup_inv_dmic,
7728 	},
7729 	[ALC269_FIXUP_NO_SHUTUP] = {
7730 		.type = HDA_FIXUP_FUNC,
7731 		.v.func = alc_fixup_no_shutup,
7732 	},
7733 	[ALC269_FIXUP_LENOVO_DOCK] = {
7734 		.type = HDA_FIXUP_PINS,
7735 		.v.pins = (const struct hda_pintbl[]) {
7736 			{ 0x19, 0x23a11040 }, /* dock mic */
7737 			{ 0x1b, 0x2121103f }, /* dock headphone */
7738 			{ }
7739 		},
7740 		.chained = true,
7741 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7742 	},
7743 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7744 		.type = HDA_FIXUP_FUNC,
7745 		.v.func = alc269_fixup_limit_int_mic_boost,
7746 		.chained = true,
7747 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
7748 	},
7749 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7750 		.type = HDA_FIXUP_FUNC,
7751 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7752 		.chained = true,
7753 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7754 	},
7755 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7756 		.type = HDA_FIXUP_PINS,
7757 		.v.pins = (const struct hda_pintbl[]) {
7758 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7759 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7760 			{ }
7761 		},
7762 		.chained = true,
7763 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7764 	},
7765 	[ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
7766 		.type = HDA_FIXUP_FUNC,
7767 		.v.func = alc269_fixup_limit_int_mic_boost,
7768 		.chained = true,
7769 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7770 	},
7771 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7772 		.type = HDA_FIXUP_PINS,
7773 		.v.pins = (const struct hda_pintbl[]) {
7774 			{ 0x16, 0x21014020 }, /* dock line out */
7775 			{ 0x19, 0x21a19030 }, /* dock mic */
7776 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7777 			{ }
7778 		},
7779 		.chained = true,
7780 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7781 	},
7782 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7783 		.type = HDA_FIXUP_PINS,
7784 		.v.pins = (const struct hda_pintbl[]) {
7785 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7786 			{ }
7787 		},
7788 		.chained = true,
7789 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7790 	},
7791 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7792 		.type = HDA_FIXUP_PINS,
7793 		.v.pins = (const struct hda_pintbl[]) {
7794 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7795 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7796 			{ }
7797 		},
7798 		.chained = true,
7799 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7800 	},
7801 	[ALC269_FIXUP_HEADSET_MODE] = {
7802 		.type = HDA_FIXUP_FUNC,
7803 		.v.func = alc_fixup_headset_mode,
7804 		.chained = true,
7805 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7806 	},
7807 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7808 		.type = HDA_FIXUP_FUNC,
7809 		.v.func = alc_fixup_headset_mode_no_hp_mic,
7810 	},
7811 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7812 		.type = HDA_FIXUP_PINS,
7813 		.v.pins = (const struct hda_pintbl[]) {
7814 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7815 			{ }
7816 		},
7817 		.chained = true,
7818 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
7819 	},
7820 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7821 		.type = HDA_FIXUP_PINS,
7822 		.v.pins = (const struct hda_pintbl[]) {
7823 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7824 			{ }
7825 		},
7826 		.chained = true,
7827 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7828 	},
7829 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7830 		.type = HDA_FIXUP_PINS,
7831 		.v.pins = (const struct hda_pintbl[]) {
7832 			{0x12, 0x90a60130},
7833 			{0x13, 0x40000000},
7834 			{0x14, 0x90170110},
7835 			{0x18, 0x411111f0},
7836 			{0x19, 0x04a11040},
7837 			{0x1a, 0x411111f0},
7838 			{0x1b, 0x90170112},
7839 			{0x1d, 0x40759a05},
7840 			{0x1e, 0x411111f0},
7841 			{0x21, 0x04211020},
7842 			{ }
7843 		},
7844 		.chained = true,
7845 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7846 	},
7847 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7848 		.type = HDA_FIXUP_FUNC,
7849 		.v.func = alc298_fixup_huawei_mbx_stereo,
7850 		.chained = true,
7851 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7852 	},
7853 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
7854 		.type = HDA_FIXUP_FUNC,
7855 		.v.func = alc269_fixup_x101_headset_mic,
7856 	},
7857 	[ALC269_FIXUP_ASUS_X101_VERB] = {
7858 		.type = HDA_FIXUP_VERBS,
7859 		.v.verbs = (const struct hda_verb[]) {
7860 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7861 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7862 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
7863 			{ }
7864 		},
7865 		.chained = true,
7866 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7867 	},
7868 	[ALC269_FIXUP_ASUS_X101] = {
7869 		.type = HDA_FIXUP_PINS,
7870 		.v.pins = (const struct hda_pintbl[]) {
7871 			{ 0x18, 0x04a1182c }, /* Headset mic */
7872 			{ }
7873 		},
7874 		.chained = true,
7875 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
7876 	},
7877 	[ALC271_FIXUP_AMIC_MIC2] = {
7878 		.type = HDA_FIXUP_PINS,
7879 		.v.pins = (const struct hda_pintbl[]) {
7880 			{ 0x14, 0x99130110 }, /* speaker */
7881 			{ 0x19, 0x01a19c20 }, /* mic */
7882 			{ 0x1b, 0x99a7012f }, /* int-mic */
7883 			{ 0x21, 0x0121401f }, /* HP out */
7884 			{ }
7885 		},
7886 	},
7887 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7888 		.type = HDA_FIXUP_FUNC,
7889 		.v.func = alc271_hp_gate_mic_jack,
7890 		.chained = true,
7891 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
7892 	},
7893 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7894 		.type = HDA_FIXUP_FUNC,
7895 		.v.func = alc269_fixup_limit_int_mic_boost,
7896 		.chained = true,
7897 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7898 	},
7899 	[ALC269_FIXUP_ACER_AC700] = {
7900 		.type = HDA_FIXUP_PINS,
7901 		.v.pins = (const struct hda_pintbl[]) {
7902 			{ 0x12, 0x99a3092f }, /* int-mic */
7903 			{ 0x14, 0x99130110 }, /* speaker */
7904 			{ 0x18, 0x03a11c20 }, /* mic */
7905 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
7906 			{ 0x21, 0x0321101f }, /* HP out */
7907 			{ }
7908 		},
7909 		.chained = true,
7910 		.chain_id = ALC271_FIXUP_DMIC,
7911 	},
7912 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7913 		.type = HDA_FIXUP_FUNC,
7914 		.v.func = alc269_fixup_limit_int_mic_boost,
7915 		.chained = true,
7916 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7917 	},
7918 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7919 		.type = HDA_FIXUP_FUNC,
7920 		.v.func = alc269_fixup_limit_int_mic_boost,
7921 		.chained = true,
7922 		.chain_id = ALC269VB_FIXUP_DMIC,
7923 	},
7924 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7925 		.type = HDA_FIXUP_VERBS,
7926 		.v.verbs = (const struct hda_verb[]) {
7927 			/* class-D output amp +5dB */
7928 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7929 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7930 			{}
7931 		},
7932 		.chained = true,
7933 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7934 	},
7935 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7936 		.type = HDA_FIXUP_PINS,
7937 		.v.pins = (const struct hda_pintbl[]) {
7938 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
7939 			{ }
7940 		},
7941 		.chained = true,
7942 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7943 	},
7944 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7945 		.type = HDA_FIXUP_FUNC,
7946 		.v.func = alc269_fixup_limit_int_mic_boost,
7947 		.chained = true,
7948 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7949 	},
7950 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7951 		.type = HDA_FIXUP_PINS,
7952 		.v.pins = (const struct hda_pintbl[]) {
7953 			{ 0x12, 0x99a3092f }, /* int-mic */
7954 			{ 0x18, 0x03a11d20 }, /* mic */
7955 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
7956 			{ }
7957 		},
7958 	},
7959 	[ALC283_FIXUP_CHROME_BOOK] = {
7960 		.type = HDA_FIXUP_FUNC,
7961 		.v.func = alc283_fixup_chromebook,
7962 	},
7963 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
7964 		.type = HDA_FIXUP_FUNC,
7965 		.v.func = alc283_fixup_sense_combo_jack,
7966 		.chained = true,
7967 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
7968 	},
7969 	[ALC282_FIXUP_ASUS_TX300] = {
7970 		.type = HDA_FIXUP_FUNC,
7971 		.v.func = alc282_fixup_asus_tx300,
7972 	},
7973 	[ALC283_FIXUP_INT_MIC] = {
7974 		.type = HDA_FIXUP_VERBS,
7975 		.v.verbs = (const struct hda_verb[]) {
7976 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7977 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7978 			{ }
7979 		},
7980 		.chained = true,
7981 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7982 	},
7983 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7984 		.type = HDA_FIXUP_PINS,
7985 		.v.pins = (const struct hda_pintbl[]) {
7986 			{ 0x17, 0x90170112 }, /* subwoofer */
7987 			{ }
7988 		},
7989 		.chained = true,
7990 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7991 	},
7992 	[ALC290_FIXUP_SUBWOOFER] = {
7993 		.type = HDA_FIXUP_PINS,
7994 		.v.pins = (const struct hda_pintbl[]) {
7995 			{ 0x17, 0x90170112 }, /* subwoofer */
7996 			{ }
7997 		},
7998 		.chained = true,
7999 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
8000 	},
8001 	[ALC290_FIXUP_MONO_SPEAKERS] = {
8002 		.type = HDA_FIXUP_FUNC,
8003 		.v.func = alc290_fixup_mono_speakers,
8004 	},
8005 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8006 		.type = HDA_FIXUP_FUNC,
8007 		.v.func = alc290_fixup_mono_speakers,
8008 		.chained = true,
8009 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8010 	},
8011 	[ALC269_FIXUP_THINKPAD_ACPI] = {
8012 		.type = HDA_FIXUP_FUNC,
8013 		.v.func = alc_fixup_thinkpad_acpi,
8014 		.chained = true,
8015 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
8016 	},
8017 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8018 		.type = HDA_FIXUP_FUNC,
8019 		.v.func = alc_fixup_inv_dmic,
8020 		.chained = true,
8021 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8022 	},
8023 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8024 		.type = HDA_FIXUP_PINS,
8025 		.v.pins = (const struct hda_pintbl[]) {
8026 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8027 			{ }
8028 		},
8029 		.chained = true,
8030 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8031 	},
8032 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8033 		.type = HDA_FIXUP_PINS,
8034 		.v.pins = (const struct hda_pintbl[]) {
8035 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8036 			{ }
8037 		},
8038 		.chained = true,
8039 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8040 	},
8041 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8042 		.type = HDA_FIXUP_PINS,
8043 		.v.pins = (const struct hda_pintbl[]) {
8044 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8045 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8046 			{ }
8047 		},
8048 		.chained = true,
8049 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8050 	},
8051 	[ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8052 		.type = HDA_FIXUP_FUNC,
8053 		.v.func = alc269_fixup_limit_int_mic_boost,
8054 		.chained = true,
8055 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8056 	},
8057 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8058 		.type = HDA_FIXUP_PINS,
8059 		.v.pins = (const struct hda_pintbl[]) {
8060 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8061 			{ }
8062 		},
8063 		.chained = true,
8064 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8065 	},
8066 	[ALC255_FIXUP_HEADSET_MODE] = {
8067 		.type = HDA_FIXUP_FUNC,
8068 		.v.func = alc_fixup_headset_mode_alc255,
8069 		.chained = true,
8070 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8071 	},
8072 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8073 		.type = HDA_FIXUP_FUNC,
8074 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8075 	},
8076 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8077 		.type = HDA_FIXUP_PINS,
8078 		.v.pins = (const struct hda_pintbl[]) {
8079 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8080 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8081 			{ }
8082 		},
8083 		.chained = true,
8084 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8085 	},
8086 	[ALC292_FIXUP_TPT440_DOCK] = {
8087 		.type = HDA_FIXUP_FUNC,
8088 		.v.func = alc_fixup_tpt440_dock,
8089 		.chained = true,
8090 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8091 	},
8092 	[ALC292_FIXUP_TPT440] = {
8093 		.type = HDA_FIXUP_FUNC,
8094 		.v.func = alc_fixup_disable_aamix,
8095 		.chained = true,
8096 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
8097 	},
8098 	[ALC283_FIXUP_HEADSET_MIC] = {
8099 		.type = HDA_FIXUP_PINS,
8100 		.v.pins = (const struct hda_pintbl[]) {
8101 			{ 0x19, 0x04a110f0 },
8102 			{ },
8103 		},
8104 	},
8105 	[ALC255_FIXUP_MIC_MUTE_LED] = {
8106 		.type = HDA_FIXUP_FUNC,
8107 		.v.func = alc_fixup_micmute_led,
8108 	},
8109 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
8110 		.type = HDA_FIXUP_PINS,
8111 		.v.pins = (const struct hda_pintbl[]) {
8112 			{ 0x12, 0x90a60130 },
8113 			{ 0x14, 0x90170110 },
8114 			{ 0x17, 0x40000008 },
8115 			{ 0x18, 0x411111f0 },
8116 			{ 0x19, 0x01a1913c },
8117 			{ 0x1a, 0x411111f0 },
8118 			{ 0x1b, 0x411111f0 },
8119 			{ 0x1d, 0x40f89b2d },
8120 			{ 0x1e, 0x411111f0 },
8121 			{ 0x21, 0x0321101f },
8122 			{ },
8123 		},
8124 	},
8125 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8126 		.type = HDA_FIXUP_FUNC,
8127 		.v.func = alc269vb_fixup_aspire_e1_coef,
8128 	},
8129 	[ALC280_FIXUP_HP_GPIO4] = {
8130 		.type = HDA_FIXUP_FUNC,
8131 		.v.func = alc280_fixup_hp_gpio4,
8132 	},
8133 	[ALC286_FIXUP_HP_GPIO_LED] = {
8134 		.type = HDA_FIXUP_FUNC,
8135 		.v.func = alc286_fixup_hp_gpio_led,
8136 	},
8137 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8138 		.type = HDA_FIXUP_FUNC,
8139 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8140 	},
8141 	[ALC280_FIXUP_HP_DOCK_PINS] = {
8142 		.type = HDA_FIXUP_PINS,
8143 		.v.pins = (const struct hda_pintbl[]) {
8144 			{ 0x1b, 0x21011020 }, /* line-out */
8145 			{ 0x1a, 0x01a1903c }, /* headset mic */
8146 			{ 0x18, 0x2181103f }, /* line-in */
8147 			{ },
8148 		},
8149 		.chained = true,
8150 		.chain_id = ALC280_FIXUP_HP_GPIO4
8151 	},
8152 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8153 		.type = HDA_FIXUP_PINS,
8154 		.v.pins = (const struct hda_pintbl[]) {
8155 			{ 0x1b, 0x21011020 }, /* line-out */
8156 			{ 0x18, 0x2181103f }, /* line-in */
8157 			{ },
8158 		},
8159 		.chained = true,
8160 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8161 	},
8162 	[ALC280_FIXUP_HP_9480M] = {
8163 		.type = HDA_FIXUP_FUNC,
8164 		.v.func = alc280_fixup_hp_9480m,
8165 	},
8166 	[ALC245_FIXUP_HP_X360_AMP] = {
8167 		.type = HDA_FIXUP_FUNC,
8168 		.v.func = alc245_fixup_hp_x360_amp,
8169 		.chained = true,
8170 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
8171 	},
8172 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
8173 		.type = HDA_FIXUP_FUNC,
8174 		.v.func = alc_fixup_headset_mode_dell_alc288,
8175 		.chained = true,
8176 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8177 	},
8178 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8179 		.type = HDA_FIXUP_PINS,
8180 		.v.pins = (const struct hda_pintbl[]) {
8181 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8182 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8183 			{ }
8184 		},
8185 		.chained = true,
8186 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8187 	},
8188 	[ALC288_FIXUP_DISABLE_AAMIX] = {
8189 		.type = HDA_FIXUP_FUNC,
8190 		.v.func = alc_fixup_disable_aamix,
8191 		.chained = true,
8192 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8193 	},
8194 	[ALC288_FIXUP_DELL_XPS_13] = {
8195 		.type = HDA_FIXUP_FUNC,
8196 		.v.func = alc_fixup_dell_xps13,
8197 		.chained = true,
8198 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
8199 	},
8200 	[ALC292_FIXUP_DISABLE_AAMIX] = {
8201 		.type = HDA_FIXUP_FUNC,
8202 		.v.func = alc_fixup_disable_aamix,
8203 		.chained = true,
8204 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8205 	},
8206 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8207 		.type = HDA_FIXUP_FUNC,
8208 		.v.func = alc_fixup_disable_aamix,
8209 		.chained = true,
8210 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8211 	},
8212 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
8213 		.type = HDA_FIXUP_FUNC,
8214 		.v.func = alc_fixup_dell_xps13,
8215 		.chained = true,
8216 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
8217 	},
8218 	[ALC292_FIXUP_DELL_E7X] = {
8219 		.type = HDA_FIXUP_FUNC,
8220 		.v.func = alc_fixup_micmute_led,
8221 		/* micmute fixup must be applied at last */
8222 		.chained_before = true,
8223 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8224 	},
8225 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8226 		.type = HDA_FIXUP_PINS,
8227 		.v.pins = (const struct hda_pintbl[]) {
8228 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8229 			{ }
8230 		},
8231 		.chained_before = true,
8232 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8233 	},
8234 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8235 		.type = HDA_FIXUP_PINS,
8236 		.v.pins = (const struct hda_pintbl[]) {
8237 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8238 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8239 			{ }
8240 		},
8241 		.chained = true,
8242 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8243 	},
8244 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8245 		.type = HDA_FIXUP_PINS,
8246 		.v.pins = (const struct hda_pintbl[]) {
8247 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8248 			{ }
8249 		},
8250 		.chained = true,
8251 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8252 	},
8253 	[ALC275_FIXUP_DELL_XPS] = {
8254 		.type = HDA_FIXUP_VERBS,
8255 		.v.verbs = (const struct hda_verb[]) {
8256 			/* Enables internal speaker */
8257 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8258 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8259 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8260 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8261 			{}
8262 		}
8263 	},
8264 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8265 		.type = HDA_FIXUP_FUNC,
8266 		.v.func = alc_fixup_disable_aamix,
8267 		.chained = true,
8268 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8269 	},
8270 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8271 		.type = HDA_FIXUP_FUNC,
8272 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8273 	},
8274 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8275 		.type = HDA_FIXUP_FUNC,
8276 		.v.func = alc_fixup_inv_dmic,
8277 		.chained = true,
8278 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8279 	},
8280 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8281 		.type = HDA_FIXUP_FUNC,
8282 		.v.func = alc269_fixup_limit_int_mic_boost
8283 	},
8284 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
8285 		.type = HDA_FIXUP_FUNC,
8286 		.v.func = alc_fixup_disable_aamix,
8287 		.chained = true,
8288 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8289 	},
8290 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
8291 		.type = HDA_FIXUP_FUNC,
8292 		.v.func = alc_fixup_disable_mic_vref,
8293 		.chained = true,
8294 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8295 	},
8296 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8297 		.type = HDA_FIXUP_VERBS,
8298 		.v.verbs = (const struct hda_verb[]) {
8299 			/* Disable pass-through path for FRONT 14h */
8300 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8301 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8302 			{}
8303 		},
8304 		.chained = true,
8305 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8306 	},
8307 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
8308 		.type = HDA_FIXUP_FUNC,
8309 		.v.func = alc_fixup_disable_aamix,
8310 		.chained = true,
8311 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
8312 	},
8313 	[ALC221_FIXUP_HP_FRONT_MIC] = {
8314 		.type = HDA_FIXUP_PINS,
8315 		.v.pins = (const struct hda_pintbl[]) {
8316 			{ 0x19, 0x02a19020 }, /* Front Mic */
8317 			{ }
8318 		},
8319 	},
8320 	[ALC292_FIXUP_TPT460] = {
8321 		.type = HDA_FIXUP_FUNC,
8322 		.v.func = alc_fixup_tpt440_dock,
8323 		.chained = true,
8324 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8325 	},
8326 	[ALC298_FIXUP_SPK_VOLUME] = {
8327 		.type = HDA_FIXUP_FUNC,
8328 		.v.func = alc298_fixup_speaker_volume,
8329 		.chained = true,
8330 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8331 	},
8332 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8333 		.type = HDA_FIXUP_FUNC,
8334 		.v.func = alc298_fixup_speaker_volume,
8335 	},
8336 	[ALC295_FIXUP_DISABLE_DAC3] = {
8337 		.type = HDA_FIXUP_FUNC,
8338 		.v.func = alc295_fixup_disable_dac3,
8339 	},
8340 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8341 		.type = HDA_FIXUP_FUNC,
8342 		.v.func = alc285_fixup_speaker2_to_dac1,
8343 		.chained = true,
8344 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8345 	},
8346 	[ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8347 		.type = HDA_FIXUP_FUNC,
8348 		.v.func = alc285_fixup_speaker2_to_dac1,
8349 		.chained = true,
8350 		.chain_id = ALC245_FIXUP_CS35L41_SPI_2
8351 	},
8352 	[ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8353 		.type = HDA_FIXUP_PINS,
8354 		.v.pins = (const struct hda_pintbl[]) {
8355 			{ 0x19, 0x03a11050 },
8356 			{ 0x1b, 0x03a11c30 },
8357 			{ }
8358 		},
8359 		.chained = true,
8360 		.chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8361 	},
8362 	[ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8363 		.type = HDA_FIXUP_PINS,
8364 		.v.pins = (const struct hda_pintbl[]) {
8365 			{ 0x14, 0x90170120 },
8366 			{ }
8367 		},
8368 		.chained = true,
8369 		.chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8370 	},
8371 	[ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8372 		.type = HDA_FIXUP_FUNC,
8373 		.v.func = alc285_fixup_speaker2_to_dac1,
8374 		.chained = true,
8375 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2
8376 	},
8377 	[ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8378 		.type = HDA_FIXUP_PINS,
8379 		.v.pins = (const struct hda_pintbl[]) {
8380 			{ 0x19, 0x03a11050 },
8381 			{ 0x1b, 0x03a11c30 },
8382 			{ }
8383 		},
8384 		.chained = true,
8385 		.chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8386 	},
8387 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8388 		.type = HDA_FIXUP_PINS,
8389 		.v.pins = (const struct hda_pintbl[]) {
8390 			{ 0x1b, 0x90170151 },
8391 			{ }
8392 		},
8393 		.chained = true,
8394 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8395 	},
8396 	[ALC269_FIXUP_ATIV_BOOK_8] = {
8397 		.type = HDA_FIXUP_FUNC,
8398 		.v.func = alc_fixup_auto_mute_via_amp,
8399 		.chained = true,
8400 		.chain_id = ALC269_FIXUP_NO_SHUTUP
8401 	},
8402 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8403 		.type = HDA_FIXUP_PINS,
8404 		.v.pins = (const struct hda_pintbl[]) {
8405 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8406 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8407 			{ }
8408 		},
8409 		.chained = true,
8410 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8411 	},
8412 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8413 		.type = HDA_FIXUP_PINS,
8414 		.v.pins = (const struct hda_pintbl[]) {
8415 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8416 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8417 			{ }
8418 		},
8419 		.chained = true,
8420 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8421 	},
8422 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8423 		.type = HDA_FIXUP_FUNC,
8424 		.v.func = alc_fixup_headset_mode,
8425 	},
8426 	[ALC256_FIXUP_ASUS_MIC] = {
8427 		.type = HDA_FIXUP_PINS,
8428 		.v.pins = (const struct hda_pintbl[]) {
8429 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8430 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8431 			{ }
8432 		},
8433 		.chained = true,
8434 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8435 	},
8436 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8437 		.type = HDA_FIXUP_FUNC,
8438 		/* Set up GPIO2 for the speaker amp */
8439 		.v.func = alc_fixup_gpio4,
8440 	},
8441 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8442 		.type = HDA_FIXUP_PINS,
8443 		.v.pins = (const struct hda_pintbl[]) {
8444 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8445 			{ }
8446 		},
8447 		.chained = true,
8448 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8449 	},
8450 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8451 		.type = HDA_FIXUP_VERBS,
8452 		.v.verbs = (const struct hda_verb[]) {
8453 			/* Enables internal speaker */
8454 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8455 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8456 			{}
8457 		},
8458 		.chained = true,
8459 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8460 	},
8461 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8462 		.type = HDA_FIXUP_FUNC,
8463 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8464 		.chained = true,
8465 		.chain_id = ALC269_FIXUP_GPIO2
8466 	},
8467 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
8468 		.type = HDA_FIXUP_VERBS,
8469 		.v.verbs = (const struct hda_verb[]) {
8470 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8471 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8472 			{ }
8473 		},
8474 		.chained = true,
8475 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8476 	},
8477 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8478 		.type = HDA_FIXUP_PINS,
8479 		.v.pins = (const struct hda_pintbl[]) {
8480 			/* Change the mic location from front to right, otherwise there are
8481 			   two front mics with the same name, pulseaudio can't handle them.
8482 			   This is just a temporary workaround, after applying this fixup,
8483 			   there will be one "Front Mic" and one "Mic" in this machine.
8484 			 */
8485 			{ 0x1a, 0x04a19040 },
8486 			{ }
8487 		},
8488 	},
8489 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8490 		.type = HDA_FIXUP_PINS,
8491 		.v.pins = (const struct hda_pintbl[]) {
8492 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
8493 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8494 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8495 			{ 0x1b, 0x02011020 },
8496 			{ }
8497 		},
8498 		.chained = true,
8499 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
8500 	},
8501 	[ALC225_FIXUP_S3_POP_NOISE] = {
8502 		.type = HDA_FIXUP_FUNC,
8503 		.v.func = alc225_fixup_s3_pop_noise,
8504 		.chained = true,
8505 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8506 	},
8507 	[ALC700_FIXUP_INTEL_REFERENCE] = {
8508 		.type = HDA_FIXUP_VERBS,
8509 		.v.verbs = (const struct hda_verb[]) {
8510 			/* Enables internal speaker */
8511 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8512 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8513 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8514 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8515 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8516 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8517 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8518 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8519 			{}
8520 		}
8521 	},
8522 	[ALC274_FIXUP_DELL_BIND_DACS] = {
8523 		.type = HDA_FIXUP_FUNC,
8524 		.v.func = alc274_fixup_bind_dacs,
8525 		.chained = true,
8526 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8527 	},
8528 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8529 		.type = HDA_FIXUP_PINS,
8530 		.v.pins = (const struct hda_pintbl[]) {
8531 			{ 0x1b, 0x0401102f },
8532 			{ }
8533 		},
8534 		.chained = true,
8535 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
8536 	},
8537 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
8538 		.type = HDA_FIXUP_FUNC,
8539 		.v.func = alc_fixup_tpt470_dock,
8540 		.chained = true,
8541 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8542 	},
8543 	[ALC298_FIXUP_TPT470_DOCK] = {
8544 		.type = HDA_FIXUP_FUNC,
8545 		.v.func = alc_fixup_tpt470_dacs,
8546 		.chained = true,
8547 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8548 	},
8549 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8550 		.type = HDA_FIXUP_PINS,
8551 		.v.pins = (const struct hda_pintbl[]) {
8552 			{ 0x14, 0x0201101f },
8553 			{ }
8554 		},
8555 		.chained = true,
8556 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8557 	},
8558 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
8559 		.type = HDA_FIXUP_PINS,
8560 		.v.pins = (const struct hda_pintbl[]) {
8561 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8562 			{ }
8563 		},
8564 		.chained = true,
8565 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8566 	},
8567 	[ALC295_FIXUP_HP_X360] = {
8568 		.type = HDA_FIXUP_FUNC,
8569 		.v.func = alc295_fixup_hp_top_speakers,
8570 		.chained = true,
8571 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8572 	},
8573 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
8574 		.type = HDA_FIXUP_PINS,
8575 		.v.pins = (const struct hda_pintbl[]) {
8576 			{ 0x19, 0x0181313f},
8577 			{ }
8578 		},
8579 		.chained = true,
8580 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8581 	},
8582 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8583 		.type = HDA_FIXUP_FUNC,
8584 		.v.func = alc285_fixup_invalidate_dacs,
8585 		.chained = true,
8586 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8587 	},
8588 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
8589 		.type = HDA_FIXUP_FUNC,
8590 		.v.func = alc_fixup_auto_mute_via_amp,
8591 	},
8592 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8593 		.type = HDA_FIXUP_PINS,
8594 		.v.pins = (const struct hda_pintbl[]) {
8595 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8596 			{ }
8597 		},
8598 		.chained = true,
8599 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8600 	},
8601 	[ALC294_FIXUP_ASUS_MIC] = {
8602 		.type = HDA_FIXUP_PINS,
8603 		.v.pins = (const struct hda_pintbl[]) {
8604 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8605 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8606 			{ }
8607 		},
8608 		.chained = true,
8609 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8610 	},
8611 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8612 		.type = HDA_FIXUP_PINS,
8613 		.v.pins = (const struct hda_pintbl[]) {
8614 			{ 0x19, 0x01a1103c }, /* use as headset mic */
8615 			{ }
8616 		},
8617 		.chained = true,
8618 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8619 	},
8620 	[ALC294_FIXUP_ASUS_SPK] = {
8621 		.type = HDA_FIXUP_VERBS,
8622 		.v.verbs = (const struct hda_verb[]) {
8623 			/* Set EAPD high */
8624 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8625 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8626 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8627 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8628 			{ }
8629 		},
8630 		.chained = true,
8631 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8632 	},
8633 	[ALC295_FIXUP_CHROME_BOOK] = {
8634 		.type = HDA_FIXUP_FUNC,
8635 		.v.func = alc295_fixup_chromebook,
8636 		.chained = true,
8637 		.chain_id = ALC225_FIXUP_HEADSET_JACK
8638 	},
8639 	[ALC225_FIXUP_HEADSET_JACK] = {
8640 		.type = HDA_FIXUP_FUNC,
8641 		.v.func = alc_fixup_headset_jack,
8642 	},
8643 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8644 		.type = HDA_FIXUP_PINS,
8645 		.v.pins = (const struct hda_pintbl[]) {
8646 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8647 			{ }
8648 		},
8649 		.chained = true,
8650 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8651 	},
8652 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8653 		.type = HDA_FIXUP_VERBS,
8654 		.v.verbs = (const struct hda_verb[]) {
8655 			/* Disable PCBEEP-IN passthrough */
8656 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8657 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8658 			{ }
8659 		},
8660 		.chained = true,
8661 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8662 	},
8663 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
8664 		.type = HDA_FIXUP_PINS,
8665 		.v.pins = (const struct hda_pintbl[]) {
8666 			{ 0x19, 0x03a11130 },
8667 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
8668 			{ }
8669 		},
8670 		.chained = true,
8671 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8672 	},
8673 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8674 		.type = HDA_FIXUP_PINS,
8675 		.v.pins = (const struct hda_pintbl[]) {
8676 			{ 0x16, 0x01011020 }, /* Rear Line out */
8677 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8678 			{ }
8679 		},
8680 		.chained = true,
8681 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8682 	},
8683 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8684 		.type = HDA_FIXUP_FUNC,
8685 		.v.func = alc_fixup_auto_mute_via_amp,
8686 		.chained = true,
8687 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8688 	},
8689 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8690 		.type = HDA_FIXUP_FUNC,
8691 		.v.func = alc_fixup_disable_mic_vref,
8692 		.chained = true,
8693 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8694 	},
8695 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8696 		.type = HDA_FIXUP_VERBS,
8697 		.v.verbs = (const struct hda_verb[]) {
8698 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8699 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8700 			{ }
8701 		},
8702 		.chained = true,
8703 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8704 	},
8705 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8706 		.type = HDA_FIXUP_PINS,
8707 		.v.pins = (const struct hda_pintbl[]) {
8708 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
8709 			{ }
8710 		},
8711 		.chained = true,
8712 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8713 	},
8714 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8715 		.type = HDA_FIXUP_PINS,
8716 		.v.pins = (const struct hda_pintbl[]) {
8717 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8718 			{ }
8719 		},
8720 		.chained = true,
8721 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8722 	},
8723 	[ALC255_FIXUP_PREDATOR_SUBWOOFER] = {
8724 		.type = HDA_FIXUP_PINS,
8725 		.v.pins = (const struct hda_pintbl[]) {
8726 			{ 0x17, 0x90170151 }, /* use as internal speaker (LFE) */
8727 			{ 0x1b, 0x90170152 } /* use as internal speaker (back) */
8728 		}
8729 	},
8730 	[ALC299_FIXUP_PREDATOR_SPK] = {
8731 		.type = HDA_FIXUP_PINS,
8732 		.v.pins = (const struct hda_pintbl[]) {
8733 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8734 			{ }
8735 		}
8736 	},
8737 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8738 		.type = HDA_FIXUP_PINS,
8739 		.v.pins = (const struct hda_pintbl[]) {
8740 			{ 0x19, 0x04a11040 },
8741 			{ 0x21, 0x04211020 },
8742 			{ }
8743 		},
8744 		.chained = true,
8745 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8746 	},
8747 	[ALC289_FIXUP_DELL_SPK1] = {
8748 		.type = HDA_FIXUP_PINS,
8749 		.v.pins = (const struct hda_pintbl[]) {
8750 			{ 0x14, 0x90170140 },
8751 			{ }
8752 		},
8753 		.chained = true,
8754 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8755 	},
8756 	[ALC289_FIXUP_DELL_SPK2] = {
8757 		.type = HDA_FIXUP_PINS,
8758 		.v.pins = (const struct hda_pintbl[]) {
8759 			{ 0x17, 0x90170130 }, /* bass spk */
8760 			{ }
8761 		},
8762 		.chained = true,
8763 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8764 	},
8765 	[ALC289_FIXUP_DUAL_SPK] = {
8766 		.type = HDA_FIXUP_FUNC,
8767 		.v.func = alc285_fixup_speaker2_to_dac1,
8768 		.chained = true,
8769 		.chain_id = ALC289_FIXUP_DELL_SPK2
8770 	},
8771 	[ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
8772 		.type = HDA_FIXUP_FUNC,
8773 		.v.func = alc285_fixup_speaker2_to_dac1,
8774 		.chained = true,
8775 		.chain_id = ALC289_FIXUP_DELL_SPK1
8776 	},
8777 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
8778 		.type = HDA_FIXUP_FUNC,
8779 		.v.func = alc285_fixup_speaker2_to_dac1,
8780 		.chained = true,
8781 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8782 	},
8783 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
8784 		.type = HDA_FIXUP_FUNC,
8785 		/* The GPIO must be pulled to initialize the AMP */
8786 		.v.func = alc_fixup_gpio4,
8787 		.chained = true,
8788 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8789 	},
8790 	[ALC294_FIXUP_ASUS_ALLY] = {
8791 		.type = HDA_FIXUP_FUNC,
8792 		.v.func = cs35l41_fixup_i2c_two,
8793 		.chained = true,
8794 		.chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
8795 	},
8796 	[ALC294_FIXUP_ASUS_ALLY_PINS] = {
8797 		.type = HDA_FIXUP_PINS,
8798 		.v.pins = (const struct hda_pintbl[]) {
8799 			{ 0x19, 0x03a11050 },
8800 			{ 0x1a, 0x03a11c30 },
8801 			{ 0x21, 0x03211420 },
8802 			{ }
8803 		},
8804 		.chained = true,
8805 		.chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
8806 	},
8807 	[ALC294_FIXUP_ASUS_ALLY_VERBS] = {
8808 		.type = HDA_FIXUP_VERBS,
8809 		.v.verbs = (const struct hda_verb[]) {
8810 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8811 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8812 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
8813 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
8814 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
8815 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
8816 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
8817 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
8818 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
8819 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
8820 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
8821 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
8822 			{ }
8823 		},
8824 		.chained = true,
8825 		.chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
8826 	},
8827 	[ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
8828 		.type = HDA_FIXUP_FUNC,
8829 		.v.func = alc285_fixup_speaker2_to_dac1,
8830 	},
8831 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8832 		.type = HDA_FIXUP_FUNC,
8833 		.v.func = alc285_fixup_thinkpad_x1_gen7,
8834 		.chained = true,
8835 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8836 	},
8837 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8838 		.type = HDA_FIXUP_FUNC,
8839 		.v.func = alc_fixup_headset_jack,
8840 		.chained = true,
8841 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8842 	},
8843 	[ALC294_FIXUP_ASUS_HPE] = {
8844 		.type = HDA_FIXUP_VERBS,
8845 		.v.verbs = (const struct hda_verb[]) {
8846 			/* Set EAPD high */
8847 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8848 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8849 			{ }
8850 		},
8851 		.chained = true,
8852 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8853 	},
8854 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
8855 		.type = HDA_FIXUP_PINS,
8856 		.v.pins = (const struct hda_pintbl[]) {
8857 			{ 0x19, 0x03a11050 }, /* front HP mic */
8858 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8859 			{ 0x21, 0x03211020 }, /* front HP out */
8860 			{ }
8861 		},
8862 		.chained = true,
8863 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8864 	},
8865 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
8866 		.type = HDA_FIXUP_VERBS,
8867 		.v.verbs = (const struct hda_verb[]) {
8868 			/* set 0x15 to HP-OUT ctrl */
8869 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8870 			/* unmute the 0x15 amp */
8871 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8872 			{ }
8873 		},
8874 		.chained = true,
8875 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
8876 	},
8877 	[ALC294_FIXUP_ASUS_GX502_HP] = {
8878 		.type = HDA_FIXUP_FUNC,
8879 		.v.func = alc294_fixup_gx502_hp,
8880 	},
8881 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
8882 		.type = HDA_FIXUP_PINS,
8883 		.v.pins = (const struct hda_pintbl[]) {
8884 			{ 0x19, 0x01a11050 }, /* rear HP mic */
8885 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8886 			{ 0x21, 0x012110f0 }, /* rear HP out */
8887 			{ }
8888 		},
8889 		.chained = true,
8890 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8891 	},
8892 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
8893 		.type = HDA_FIXUP_VERBS,
8894 		.v.verbs = (const struct hda_verb[]) {
8895 			/* set 0x15 to HP-OUT ctrl */
8896 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8897 			/* unmute the 0x15 amp */
8898 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8899 			/* set 0x1b to HP-OUT */
8900 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8901 			{ }
8902 		},
8903 		.chained = true,
8904 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
8905 	},
8906 	[ALC294_FIXUP_ASUS_GU502_HP] = {
8907 		.type = HDA_FIXUP_FUNC,
8908 		.v.func = alc294_fixup_gu502_hp,
8909 	},
8910 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
8911 		.type = HDA_FIXUP_PINS,
8912 		.v.pins = (const struct hda_pintbl[]) {
8913 				{ 0x19, 0x03a11050 }, /* front HP mic */
8914 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
8915 				{ 0x21, 0x03211420 }, /* front HP out */
8916 				{ }
8917 		},
8918 	},
8919 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
8920 		.type = HDA_FIXUP_PINS,
8921 		.v.pins = (const struct hda_pintbl[]) {
8922 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
8923 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
8924 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
8925 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
8926 			{ 0x21, 0x03211420 },
8927 			{ }
8928 		},
8929 	},
8930 	[ALC294_FIXUP_ASUS_COEF_1B] = {
8931 		.type = HDA_FIXUP_VERBS,
8932 		.v.verbs = (const struct hda_verb[]) {
8933 			/* Set bit 10 to correct noisy output after reboot from
8934 			 * Windows 10 (due to pop noise reduction?)
8935 			 */
8936 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8937 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8938 			{ }
8939 		},
8940 		.chained = true,
8941 		.chain_id = ALC289_FIXUP_ASUS_GA401,
8942 	},
8943 	[ALC285_FIXUP_HP_GPIO_LED] = {
8944 		.type = HDA_FIXUP_FUNC,
8945 		.v.func = alc285_fixup_hp_gpio_led,
8946 	},
8947 	[ALC285_FIXUP_HP_MUTE_LED] = {
8948 		.type = HDA_FIXUP_FUNC,
8949 		.v.func = alc285_fixup_hp_mute_led,
8950 	},
8951 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
8952 		.type = HDA_FIXUP_FUNC,
8953 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
8954 	},
8955 	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
8956 	    .type = HDA_FIXUP_FUNC,
8957 	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
8958 	},
8959 	[ALC236_FIXUP_HP_GPIO_LED] = {
8960 		.type = HDA_FIXUP_FUNC,
8961 		.v.func = alc236_fixup_hp_gpio_led,
8962 	},
8963 	[ALC236_FIXUP_HP_MUTE_LED] = {
8964 		.type = HDA_FIXUP_FUNC,
8965 		.v.func = alc236_fixup_hp_mute_led,
8966 	},
8967 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8968 		.type = HDA_FIXUP_FUNC,
8969 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
8970 	},
8971 	[ALC236_FIXUP_LENOVO_INV_DMIC] = {
8972 		.type = HDA_FIXUP_FUNC,
8973 		.v.func = alc_fixup_inv_dmic,
8974 		.chained = true,
8975 		.chain_id = ALC283_FIXUP_INT_MIC,
8976 	},
8977 	[ALC298_FIXUP_SAMSUNG_AMP] = {
8978 		.type = HDA_FIXUP_FUNC,
8979 		.v.func = alc298_fixup_samsung_amp,
8980 		.chained = true,
8981 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
8982 	},
8983 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8984 		.type = HDA_FIXUP_VERBS,
8985 		.v.verbs = (const struct hda_verb[]) {
8986 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8987 			{ }
8988 		},
8989 	},
8990 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8991 		.type = HDA_FIXUP_VERBS,
8992 		.v.verbs = (const struct hda_verb[]) {
8993 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8994 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
8995 			{ }
8996 		},
8997 	},
8998 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8999 		.type = HDA_FIXUP_PINS,
9000 		.v.pins = (const struct hda_pintbl[]) {
9001 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9002 			{ }
9003 		},
9004 		.chained = true,
9005 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9006 	},
9007 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
9008 		.type = HDA_FIXUP_PINS,
9009 		.v.pins = (const struct hda_pintbl[]) {
9010 			{ 0x14, 0x90100120 }, /* use as internal speaker */
9011 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
9012 			{ 0x1a, 0x01011020 }, /* use as line out */
9013 			{ },
9014 		},
9015 		.chained = true,
9016 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9017 	},
9018 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9019 		.type = HDA_FIXUP_PINS,
9020 		.v.pins = (const struct hda_pintbl[]) {
9021 			{ 0x18, 0x02a11030 }, /* use as headset mic */
9022 			{ }
9023 		},
9024 		.chained = true,
9025 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9026 	},
9027 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9028 		.type = HDA_FIXUP_PINS,
9029 		.v.pins = (const struct hda_pintbl[]) {
9030 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9031 			{ }
9032 		},
9033 		.chained = true,
9034 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9035 	},
9036 	[ALC289_FIXUP_ASUS_GA401] = {
9037 		.type = HDA_FIXUP_FUNC,
9038 		.v.func = alc289_fixup_asus_ga401,
9039 		.chained = true,
9040 		.chain_id = ALC289_FIXUP_ASUS_GA502,
9041 	},
9042 	[ALC289_FIXUP_ASUS_GA502] = {
9043 		.type = HDA_FIXUP_PINS,
9044 		.v.pins = (const struct hda_pintbl[]) {
9045 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9046 			{ }
9047 		},
9048 	},
9049 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9050 		.type = HDA_FIXUP_PINS,
9051 		.v.pins = (const struct hda_pintbl[]) {
9052 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9053 			{ }
9054 		},
9055 		.chained = true,
9056 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9057 	},
9058 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9059 		.type = HDA_FIXUP_FUNC,
9060 		.v.func = alc285_fixup_hp_gpio_amp_init,
9061 		.chained = true,
9062 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
9063 	},
9064 	[ALC269_FIXUP_CZC_B20] = {
9065 		.type = HDA_FIXUP_PINS,
9066 		.v.pins = (const struct hda_pintbl[]) {
9067 			{ 0x12, 0x411111f0 },
9068 			{ 0x14, 0x90170110 }, /* speaker */
9069 			{ 0x15, 0x032f1020 }, /* HP out */
9070 			{ 0x17, 0x411111f0 },
9071 			{ 0x18, 0x03ab1040 }, /* mic */
9072 			{ 0x19, 0xb7a7013f },
9073 			{ 0x1a, 0x0181305f },
9074 			{ 0x1b, 0x411111f0 },
9075 			{ 0x1d, 0x411111f0 },
9076 			{ 0x1e, 0x411111f0 },
9077 			{ }
9078 		},
9079 		.chain_id = ALC269_FIXUP_DMIC,
9080 	},
9081 	[ALC269_FIXUP_CZC_TMI] = {
9082 		.type = HDA_FIXUP_PINS,
9083 		.v.pins = (const struct hda_pintbl[]) {
9084 			{ 0x12, 0x4000c000 },
9085 			{ 0x14, 0x90170110 }, /* speaker */
9086 			{ 0x15, 0x0421401f }, /* HP out */
9087 			{ 0x17, 0x411111f0 },
9088 			{ 0x18, 0x04a19020 }, /* mic */
9089 			{ 0x19, 0x411111f0 },
9090 			{ 0x1a, 0x411111f0 },
9091 			{ 0x1b, 0x411111f0 },
9092 			{ 0x1d, 0x40448505 },
9093 			{ 0x1e, 0x411111f0 },
9094 			{ 0x20, 0x8000ffff },
9095 			{ }
9096 		},
9097 		.chain_id = ALC269_FIXUP_DMIC,
9098 	},
9099 	[ALC269_FIXUP_CZC_L101] = {
9100 		.type = HDA_FIXUP_PINS,
9101 		.v.pins = (const struct hda_pintbl[]) {
9102 			{ 0x12, 0x40000000 },
9103 			{ 0x14, 0x01014010 }, /* speaker */
9104 			{ 0x15, 0x411111f0 }, /* HP out */
9105 			{ 0x16, 0x411111f0 },
9106 			{ 0x18, 0x01a19020 }, /* mic */
9107 			{ 0x19, 0x02a19021 },
9108 			{ 0x1a, 0x0181302f },
9109 			{ 0x1b, 0x0221401f },
9110 			{ 0x1c, 0x411111f0 },
9111 			{ 0x1d, 0x4044c601 },
9112 			{ 0x1e, 0x411111f0 },
9113 			{ }
9114 		},
9115 		.chain_id = ALC269_FIXUP_DMIC,
9116 	},
9117 	[ALC269_FIXUP_LEMOTE_A1802] = {
9118 		.type = HDA_FIXUP_PINS,
9119 		.v.pins = (const struct hda_pintbl[]) {
9120 			{ 0x12, 0x40000000 },
9121 			{ 0x14, 0x90170110 }, /* speaker */
9122 			{ 0x17, 0x411111f0 },
9123 			{ 0x18, 0x03a19040 }, /* mic1 */
9124 			{ 0x19, 0x90a70130 }, /* mic2 */
9125 			{ 0x1a, 0x411111f0 },
9126 			{ 0x1b, 0x411111f0 },
9127 			{ 0x1d, 0x40489d2d },
9128 			{ 0x1e, 0x411111f0 },
9129 			{ 0x20, 0x0003ffff },
9130 			{ 0x21, 0x03214020 },
9131 			{ }
9132 		},
9133 		.chain_id = ALC269_FIXUP_DMIC,
9134 	},
9135 	[ALC269_FIXUP_LEMOTE_A190X] = {
9136 		.type = HDA_FIXUP_PINS,
9137 		.v.pins = (const struct hda_pintbl[]) {
9138 			{ 0x14, 0x99130110 }, /* speaker */
9139 			{ 0x15, 0x0121401f }, /* HP out */
9140 			{ 0x18, 0x01a19c20 }, /* rear  mic */
9141 			{ 0x19, 0x99a3092f }, /* front mic */
9142 			{ 0x1b, 0x0201401f }, /* front lineout */
9143 			{ }
9144 		},
9145 		.chain_id = ALC269_FIXUP_DMIC,
9146 	},
9147 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9148 		.type = HDA_FIXUP_PINS,
9149 		.v.pins = (const struct hda_pintbl[]) {
9150 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9151 			{ }
9152 		},
9153 		.chained = true,
9154 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9155 	},
9156 	[ALC256_FIXUP_INTEL_NUC10] = {
9157 		.type = HDA_FIXUP_PINS,
9158 		.v.pins = (const struct hda_pintbl[]) {
9159 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9160 			{ }
9161 		},
9162 		.chained = true,
9163 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9164 	},
9165 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9166 		.type = HDA_FIXUP_VERBS,
9167 		.v.verbs = (const struct hda_verb[]) {
9168 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9169 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9170 			{ }
9171 		},
9172 		.chained = true,
9173 		.chain_id = ALC289_FIXUP_ASUS_GA502
9174 	},
9175 	[ALC274_FIXUP_HP_MIC] = {
9176 		.type = HDA_FIXUP_VERBS,
9177 		.v.verbs = (const struct hda_verb[]) {
9178 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9179 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9180 			{ }
9181 		},
9182 	},
9183 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
9184 		.type = HDA_FIXUP_FUNC,
9185 		.v.func = alc274_fixup_hp_headset_mic,
9186 		.chained = true,
9187 		.chain_id = ALC274_FIXUP_HP_MIC
9188 	},
9189 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
9190 		.type = HDA_FIXUP_FUNC,
9191 		.v.func = alc274_fixup_hp_envy_gpio,
9192 	},
9193 	[ALC256_FIXUP_ASUS_HPE] = {
9194 		.type = HDA_FIXUP_VERBS,
9195 		.v.verbs = (const struct hda_verb[]) {
9196 			/* Set EAPD high */
9197 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9198 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9199 			{ }
9200 		},
9201 		.chained = true,
9202 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9203 	},
9204 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9205 		.type = HDA_FIXUP_FUNC,
9206 		.v.func = alc_fixup_headset_jack,
9207 		.chained = true,
9208 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9209 	},
9210 	[ALC287_FIXUP_HP_GPIO_LED] = {
9211 		.type = HDA_FIXUP_FUNC,
9212 		.v.func = alc287_fixup_hp_gpio_led,
9213 	},
9214 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
9215 		.type = HDA_FIXUP_FUNC,
9216 		.v.func = alc274_fixup_hp_headset_mic,
9217 	},
9218 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9219 		.type = HDA_FIXUP_FUNC,
9220 		.v.func = alc_fixup_no_int_mic,
9221 		.chained = true,
9222 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9223 	},
9224 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9225 		.type = HDA_FIXUP_PINS,
9226 		.v.pins = (const struct hda_pintbl[]) {
9227 			{ 0x1b, 0x411111f0 },
9228 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9229 			{ },
9230 		},
9231 		.chained = true,
9232 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9233 	},
9234 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9235 		.type = HDA_FIXUP_FUNC,
9236 		.v.func = alc269_fixup_limit_int_mic_boost,
9237 		.chained = true,
9238 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9239 	},
9240 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
9241 		.type = HDA_FIXUP_PINS,
9242 		.v.pins = (const struct hda_pintbl[]) {
9243 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9244 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
9245 			{ }
9246 		},
9247 		.chained = true,
9248 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9249 	},
9250 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9251 		.type = HDA_FIXUP_FUNC,
9252 		.v.func = alc285_fixup_ideapad_s740_coef,
9253 		.chained = true,
9254 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9255 	},
9256 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9257 		.type = HDA_FIXUP_FUNC,
9258 		.v.func = alc269_fixup_limit_int_mic_boost,
9259 		.chained = true,
9260 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9261 	},
9262 	[ALC295_FIXUP_ASUS_DACS] = {
9263 		.type = HDA_FIXUP_FUNC,
9264 		.v.func = alc295_fixup_asus_dacs,
9265 	},
9266 	[ALC295_FIXUP_HP_OMEN] = {
9267 		.type = HDA_FIXUP_PINS,
9268 		.v.pins = (const struct hda_pintbl[]) {
9269 			{ 0x12, 0xb7a60130 },
9270 			{ 0x13, 0x40000000 },
9271 			{ 0x14, 0x411111f0 },
9272 			{ 0x16, 0x411111f0 },
9273 			{ 0x17, 0x90170110 },
9274 			{ 0x18, 0x411111f0 },
9275 			{ 0x19, 0x02a11030 },
9276 			{ 0x1a, 0x411111f0 },
9277 			{ 0x1b, 0x04a19030 },
9278 			{ 0x1d, 0x40600001 },
9279 			{ 0x1e, 0x411111f0 },
9280 			{ 0x21, 0x03211020 },
9281 			{}
9282 		},
9283 		.chained = true,
9284 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9285 	},
9286 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
9287 		.type = HDA_FIXUP_FUNC,
9288 		.v.func = alc285_fixup_hp_spectre_x360,
9289 	},
9290 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9291 		.type = HDA_FIXUP_FUNC,
9292 		.v.func = alc285_fixup_hp_spectre_x360_eb1
9293 	},
9294 	[ALC285_FIXUP_HP_ENVY_X360] = {
9295 		.type = HDA_FIXUP_FUNC,
9296 		.v.func = alc285_fixup_hp_envy_x360,
9297 		.chained = true,
9298 		.chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9299 	},
9300 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9301 		.type = HDA_FIXUP_FUNC,
9302 		.v.func = alc285_fixup_ideapad_s740_coef,
9303 		.chained = true,
9304 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9305 	},
9306 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9307 		.type = HDA_FIXUP_FUNC,
9308 		.v.func = alc_fixup_no_shutup,
9309 		.chained = true,
9310 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
9311 	},
9312 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9313 		.type = HDA_FIXUP_PINS,
9314 		.v.pins = (const struct hda_pintbl[]) {
9315 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9316 			{ }
9317 		},
9318 		.chained = true,
9319 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9320 	},
9321 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9322 		.type = HDA_FIXUP_FUNC,
9323 		.v.func = alc269_fixup_limit_int_mic_boost,
9324 		.chained = true,
9325 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9326 	},
9327 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9328 		.type = HDA_FIXUP_FUNC,
9329 		.v.func = alc285_fixup_ideapad_s740_coef,
9330 		.chained = true,
9331 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9332 	},
9333 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9334 		.type = HDA_FIXUP_FUNC,
9335 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9336 		.chained = true,
9337 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9338 	},
9339 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9340 		.type = HDA_FIXUP_VERBS,
9341 		//.v.verbs = legion_15imhg05_coefs,
9342 		.v.verbs = (const struct hda_verb[]) {
9343 			 // set left speaker Legion 7i.
9344 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9345 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9346 
9347 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9348 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9349 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9350 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9351 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9352 
9353 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9354 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9355 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9356 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9357 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9358 
9359 			 // set right speaker Legion 7i.
9360 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9361 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9362 
9363 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9364 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9365 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9366 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9367 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9368 
9369 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9370 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9371 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9372 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9373 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9374 			 {}
9375 		},
9376 		.chained = true,
9377 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9378 	},
9379 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9380 		.type = HDA_FIXUP_FUNC,
9381 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9382 		.chained = true,
9383 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9384 	},
9385 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9386 		.type = HDA_FIXUP_VERBS,
9387 		.v.verbs = (const struct hda_verb[]) {
9388 			 // set left speaker Yoga 7i.
9389 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9390 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9391 
9392 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9393 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9394 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9395 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9396 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9397 
9398 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9399 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9400 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9401 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9402 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9403 
9404 			 // set right speaker Yoga 7i.
9405 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9406 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9407 
9408 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9409 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9410 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9411 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9412 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9413 
9414 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9415 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9416 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9417 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9418 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9419 			 {}
9420 		},
9421 		.chained = true,
9422 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9423 	},
9424 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
9425 		.type = HDA_FIXUP_FUNC,
9426 		.v.func = alc298_fixup_lenovo_c940_duet7,
9427 	},
9428 	[ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
9429 		.type = HDA_FIXUP_FUNC,
9430 		.v.func = alc287_fixup_lenovo_14irp8_duetitl,
9431 	},
9432 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9433 		.type = HDA_FIXUP_VERBS,
9434 		.v.verbs = (const struct hda_verb[]) {
9435 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9436 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9437 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9438 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9439 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9440 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9441 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9442 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9443 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9444 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9445 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9446 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9447 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9448 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9449 			{}
9450 		},
9451 		.chained = true,
9452 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9453 	},
9454 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9455 		.type = HDA_FIXUP_FUNC,
9456 		.v.func = alc256_fixup_set_coef_defaults,
9457 	},
9458 	[ALC245_FIXUP_HP_GPIO_LED] = {
9459 		.type = HDA_FIXUP_FUNC,
9460 		.v.func = alc245_fixup_hp_gpio_led,
9461 	},
9462 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9463 		.type = HDA_FIXUP_PINS,
9464 		.v.pins = (const struct hda_pintbl[]) {
9465 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9466 			{ }
9467 		},
9468 		.chained = true,
9469 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9470 	},
9471 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
9472 		.type = HDA_FIXUP_FUNC,
9473 		.v.func = alc233_fixup_no_audio_jack,
9474 	},
9475 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9476 		.type = HDA_FIXUP_FUNC,
9477 		.v.func = alc256_fixup_mic_no_presence_and_resume,
9478 		.chained = true,
9479 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9480 	},
9481 	[ALC287_FIXUP_LEGION_16ACHG6] = {
9482 		.type = HDA_FIXUP_FUNC,
9483 		.v.func = alc287_fixup_legion_16achg6_speakers,
9484 	},
9485 	[ALC287_FIXUP_CS35L41_I2C_2] = {
9486 		.type = HDA_FIXUP_FUNC,
9487 		.v.func = cs35l41_fixup_i2c_two,
9488 	},
9489 	[ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9490 		.type = HDA_FIXUP_FUNC,
9491 		.v.func = cs35l41_fixup_i2c_two,
9492 		.chained = true,
9493 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9494 	},
9495 	[ALC245_FIXUP_CS35L41_SPI_2] = {
9496 		.type = HDA_FIXUP_FUNC,
9497 		.v.func = cs35l41_fixup_spi_two,
9498 	},
9499 	[ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9500 		.type = HDA_FIXUP_FUNC,
9501 		.v.func = cs35l41_fixup_spi_two,
9502 		.chained = true,
9503 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9504 	},
9505 	[ALC245_FIXUP_CS35L41_SPI_4] = {
9506 		.type = HDA_FIXUP_FUNC,
9507 		.v.func = cs35l41_fixup_spi_four,
9508 	},
9509 	[ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9510 		.type = HDA_FIXUP_FUNC,
9511 		.v.func = cs35l41_fixup_spi_four,
9512 		.chained = true,
9513 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9514 	},
9515 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9516 		.type = HDA_FIXUP_VERBS,
9517 		.v.verbs = (const struct hda_verb[]) {
9518 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9519 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9520 			 { }
9521 		},
9522 		.chained = true,
9523 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9524 	},
9525 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9526 		.type = HDA_FIXUP_FUNC,
9527 		.v.func = alc_fixup_dell4_mic_no_presence_quiet,
9528 		.chained = true,
9529 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9530 	},
9531 	[ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9532 		.type = HDA_FIXUP_PINS,
9533 		.v.pins = (const struct hda_pintbl[]) {
9534 			{ 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9535 			{ }
9536 		},
9537 		.chained = true,
9538 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9539 	},
9540 	[ALC287_FIXUP_LEGION_16ITHG6] = {
9541 		.type = HDA_FIXUP_FUNC,
9542 		.v.func = alc287_fixup_legion_16ithg6_speakers,
9543 	},
9544 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9545 		.type = HDA_FIXUP_VERBS,
9546 		.v.verbs = (const struct hda_verb[]) {
9547 			// enable left speaker
9548 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9549 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9550 
9551 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9552 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9553 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9554 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9555 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9556 
9557 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9558 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9559 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9560 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9561 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9562 
9563 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9564 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9565 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9566 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9567 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9568 
9569 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9570 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9571 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9572 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9573 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9574 
9575 			// enable right speaker
9576 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9577 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9578 
9579 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9580 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9581 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9582 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9583 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9584 
9585 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9586 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9587 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9588 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9589 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9590 
9591 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9592 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9593 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9594 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9595 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9596 
9597 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9598 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9599 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9600 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9601 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9602 
9603 			{ },
9604 		},
9605 	},
9606 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9607 		.type = HDA_FIXUP_FUNC,
9608 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9609 		.chained = true,
9610 		.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9611 	},
9612 	[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
9613 		.type = HDA_FIXUP_FUNC,
9614 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9615 		.chained = true,
9616 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2,
9617 	},
9618 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
9619 		.type = HDA_FIXUP_FUNC,
9620 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
9621 		.chained = true,
9622 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9623 	},
9624 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
9625 		.type = HDA_FIXUP_PINS,
9626 		.v.func = alc1220_fixup_gb_dual_codecs,
9627 		.chained = true,
9628 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9629 	},
9630 	[ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
9631 		.type = HDA_FIXUP_FUNC,
9632 		.v.func = cs35l41_fixup_i2c_two,
9633 		.chained = true,
9634 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9635 	},
9636 	[ALC287_FIXUP_TAS2781_I2C] = {
9637 		.type = HDA_FIXUP_FUNC,
9638 		.v.func = tas2781_fixup_i2c,
9639 		.chained = true,
9640 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9641 	},
9642 	[ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
9643 		.type = HDA_FIXUP_FUNC,
9644 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9645 	},
9646 	[ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
9647 		.type = HDA_FIXUP_FUNC,
9648 		.v.func = alc245_fixup_hp_mute_led_coefbit,
9649 		.chained = true,
9650 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
9651 	},
9652 	[ALC287_FIXUP_THINKPAD_I2S_SPK] = {
9653 		.type = HDA_FIXUP_FUNC,
9654 		.v.func = alc287_fixup_bind_dacs,
9655 		.chained = true,
9656 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9657 	},
9658 	[ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
9659 		.type = HDA_FIXUP_FUNC,
9660 		.v.func = alc287_fixup_bind_dacs,
9661 		.chained = true,
9662 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
9663 	},
9664 	[ALC2XX_FIXUP_HEADSET_MIC] = {
9665 		.type = HDA_FIXUP_FUNC,
9666 		.v.func = alc_fixup_headset_mic,
9667 	},
9668 	[ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
9669 		.type = HDA_FIXUP_FUNC,
9670 		.v.func = cs35l41_fixup_spi_two,
9671 		.chained = true,
9672 		.chain_id = ALC289_FIXUP_DUAL_SPK
9673 	},
9674 	[ALC294_FIXUP_CS35L41_I2C_2] = {
9675 		.type = HDA_FIXUP_FUNC,
9676 		.v.func = cs35l41_fixup_i2c_two,
9677 	},
9678 };
9679 
9680 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
9681 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
9682 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9683 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
9684 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
9685 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9686 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9687 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
9688 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9689 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9690 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
9691 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9692 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
9693 	SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9694 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
9695 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
9696 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
9697 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
9698 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9699 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9700 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9701 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9702 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
9703 	SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9704 	SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9705 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
9706 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
9707 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
9708 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9709 	SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9710 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9711 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9712 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9713 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
9714 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9715 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9716 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9717 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
9718 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
9719 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9720 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9721 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9722 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
9723 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9724 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
9725 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
9726 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
9727 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
9728 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
9729 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9730 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
9731 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
9732 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9733 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9734 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9735 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9736 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9737 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
9738 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
9739 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
9740 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9741 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9742 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
9743 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9744 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
9745 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9746 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9747 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9748 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9749 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9750 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9751 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9752 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9753 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9754 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
9755 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
9756 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
9757 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
9758 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9759 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
9760 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
9761 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9762 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9763 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9764 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9765 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9766 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
9767 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
9768 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9769 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9770 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9771 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9772 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9773 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9774 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9775 	SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
9776 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
9777 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
9778 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
9779 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9780 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9781 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9782 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
9783 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9784 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9785 	SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9786 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9787 	SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9788 	SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9789 	SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9790 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9791 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9792 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9793 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9794 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9795 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9796 	SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9797 	SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9798 	SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9799 	SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9800 	SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9801 	SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9802 	SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9803 	SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9804 	SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9805 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9806 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9807 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9808 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
9809 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
9810 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9811 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9812 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9813 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9814 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9815 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9816 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9817 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9818 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9819 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9820 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9821 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9822 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9823 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9824 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9825 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9826 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9827 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9828 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
9829 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
9830 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9831 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9832 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9833 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9834 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9835 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9836 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9837 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9838 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9839 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9840 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9841 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9842 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9843 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9844 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9845 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9846 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9847 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9848 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9849 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9850 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9851 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9852 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9853 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9854 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9855 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9856 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9857 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9858 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9859 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9860 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9861 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9862 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9863 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9864 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
9865 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9866 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9867 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9868 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9869 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
9870 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9871 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
9872 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9873 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9874 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9875 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9876 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9877 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9878 	SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9879 	SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9880 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
9881 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9882 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
9883 	SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9884 	SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
9885 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9886 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9887 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9888 	SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9889 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
9890 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9891 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9892 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
9893 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9894 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9895 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
9896 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
9897 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
9898 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9899 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9900 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9901 	SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
9902 	SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9903 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
9904 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9905 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
9906 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
9907 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
9908 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
9909 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9910 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9911 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9912 	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9913 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
9914 	SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9915 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9916 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9917 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9918 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9919 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
9920 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
9921 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9922 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9923 	SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9924 	SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9925 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9926 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9927 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9928 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9929 	SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9930 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9931 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9932 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9933 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9934 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9935 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9936 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9937 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9938 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9939 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9940 	SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9941 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
9942 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
9943 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
9944 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9945 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
9946 	SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
9947 	SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
9948 	SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9949 	SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
9950 	SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9951 	SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9952 	SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9953 	SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9954 	SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9955 	SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9956 	SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9957 	SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
9958 	SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
9959 	SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9960 	SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9961 	SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9962 	SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
9963 	SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9964 	SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
9965 	SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
9966 	SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
9967 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
9968 	SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
9969 	SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
9970 	SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9971 	SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9972 	SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9973 	SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9974 	SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9975 	SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
9976 	SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9977 	SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
9978 	SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9979 	SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
9980 	SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
9981 	SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
9982 	SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
9983 	SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
9984 	SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9985 	SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9986 	SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9987 	SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9988 	SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9989 	SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
9990 	SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9991 	SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9992 	SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9993 	SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9994 	SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9995 	SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9996 	SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9997 	SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9998 	SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9999 	SND_PCI_QUIRK(0x103c, 0x8b5f, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10000 	SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10001 	SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10002 	SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10003 	SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10004 	SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10005 	SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10006 	SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
10007 	SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10008 	SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10009 	SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
10010 	SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10011 	SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
10012 	SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10013 	SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10014 	SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10015 	SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10016 	SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10017 	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10018 	SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10019 	SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10020 	SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10021 	SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10022 	SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10023 	SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10024 	SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10025 	SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10026 	SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10027 	SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10028 	SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10029 	SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10030 	SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10031 	SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10032 	SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10033 	SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10034 	SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10035 	SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10036 	SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10037 	SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10038 	SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10039 	SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10040 	SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10041 	SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10042 	SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10043 	SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10044 	SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10045 	SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10046 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10047 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10048 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10049 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10050 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10051 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10052 	SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10053 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10054 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10055 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10056 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10057 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10058 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10059 	SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10060 	SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10061 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10062 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10063 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10064 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10065 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10066 	SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650P", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10067 	SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10068 	SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10069 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10070 	SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10071 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10072 	SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA", ALC287_FIXUP_CS35L41_I2C_2),
10073 	SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10074 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10075 	SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10076 	SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10077 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10078 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10079 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10080 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10081 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10082 	SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally RC71L_RC71L", ALC294_FIXUP_ASUS_ALLY),
10083 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10084 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10085 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10086 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10087 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10088 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10089 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10090 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10091 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10092 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10093 	SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
10094 	SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10095 	SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10096 	SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10097 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10098 	SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
10099 	SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10100 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10101 	SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10102 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10103 	SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10104 	SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10105 	SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10106 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10107 	SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10108 	SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10109 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10110 	SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS ROG Strix G17 2023 (G713PV)", ALC287_FIXUP_CS35L41_I2C_2),
10111 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10112 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10113 	SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10114 	SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10115 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10116 	SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10117 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10118 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10119 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10120 	SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10121 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10122 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10123 	SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10124 	SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10125 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10126 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10127 	SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2),
10128 	SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10129 	SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10130 	SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10131 	SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10132 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10133 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10134 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10135 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10136 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10137 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10138 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10139 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10140 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10141 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10142 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10143 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10144 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10145 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10146 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10147 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10148 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10149 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10150 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10151 	SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10152 	SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10153 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10154 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10155 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10156 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10157 	SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10158 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10159 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10160 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10161 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10162 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10163 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10164 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10165 	SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10166 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10167 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10168 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10169 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10170 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10171 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10172 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10173 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10174 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10175 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10176 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10177 	SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10178 	SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10179 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10180 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10181 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10182 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10183 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10184 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10185 	SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10186 	SND_PCI_QUIRK(0x1558, 0x28c1, "Clevo V370VND", ALC2XX_FIXUP_HEADSET_MIC),
10187 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10188 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10189 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10190 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10191 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10192 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10193 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10194 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10195 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10196 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10197 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10198 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10199 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10200 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10201 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10202 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10203 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10204 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10205 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10206 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10207 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10208 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10209 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10210 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10211 	SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10212 	SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10213 	SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10214 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10215 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10216 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10217 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10218 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10219 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10220 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10221 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10222 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10223 	SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10224 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10225 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10226 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10227 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10228 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10229 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10230 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10231 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10232 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10233 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10234 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10235 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10236 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10237 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10238 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10239 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
10240 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10241 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10242 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10243 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10244 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10245 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10246 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10247 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10248 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10249 	SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10250 	SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10251 	SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10252 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10253 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10254 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10255 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10256 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10257 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10258 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
10259 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10260 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
10261 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
10262 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
10263 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
10264 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
10265 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
10266 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
10267 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
10268 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
10269 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
10270 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
10271 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
10272 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
10273 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
10274 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
10275 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10276 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10277 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10278 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
10279 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
10280 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10281 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10282 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10283 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
10284 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
10285 	SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
10286 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
10287 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10288 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10289 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
10290 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10291 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10292 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10293 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10294 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10295 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10296 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10297 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10298 	SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10299 	SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10300 	SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10301 	SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10302 	SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10303 	SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10304 	SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10305 	SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10306 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10307 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10308 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10309 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10310 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10311 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10312 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10313 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10314 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10315 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10316 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10317 	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
10318 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10319 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
10320 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10321 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
10322 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10323 	SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10324 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10325 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
10326 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10327 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10328 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
10329 	SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
10330 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10331 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10332 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10333 	SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
10334 	SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10335 	SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10336 	SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10337 	SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
10338 	SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
10339 	SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
10340 	SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10341 	SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10342 	SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10343 	SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10344 	SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
10345 	SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
10346 	SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
10347 	SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
10348 	SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
10349 	SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
10350 	SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
10351 	SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10352 	SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10353 	SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10354 	SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10355 	SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10356 	SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10357 	SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10358 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10359 	SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
10360 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
10361 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10362 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
10363 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10364 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
10365 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
10366 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10367 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
10368 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
10369 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
10370 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
10371 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
10372 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
10373 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
10374 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
10375 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10376 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10377 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10378 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10379 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10380 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10381 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10382 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
10383 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10384 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
10385 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
10386 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
10387 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10388 	SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
10389 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
10390 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
10391 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
10392 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
10393 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
10394 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
10395 	SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10396 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
10397 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
10398 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
10399 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
10400 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10401 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10402 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10403 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10404 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10405 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
10406 	SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10407 	SND_PCI_QUIRK(0x1d05, 0x1409, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10408 	SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10409 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10410 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
10411 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
10412 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
10413 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10414 	SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10415 	SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
10416 	SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
10417 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
10418 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
10419 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
10420 	SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
10421 	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10422 	SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10423 	SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10424 
10425 #if 0
10426 	/* Below is a quirk table taken from the old code.
10427 	 * Basically the device should work as is without the fixup table.
10428 	 * If BIOS doesn't give a proper info, enable the corresponding
10429 	 * fixup entry.
10430 	 */
10431 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
10432 		      ALC269_FIXUP_AMIC),
10433 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
10434 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
10435 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
10436 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
10437 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
10438 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
10439 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
10440 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
10441 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
10442 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
10443 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
10444 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
10445 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
10446 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
10447 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
10448 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
10449 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
10450 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
10451 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
10452 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
10453 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
10454 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
10455 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
10456 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
10457 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
10458 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
10459 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
10460 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
10461 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
10462 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
10463 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
10464 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
10465 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
10466 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
10467 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
10468 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
10469 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
10470 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
10471 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
10472 #endif
10473 	{}
10474 };
10475 
10476 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
10477 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
10478 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
10479 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
10480 	SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
10481 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
10482 	{}
10483 };
10484 
10485 static const struct hda_model_fixup alc269_fixup_models[] = {
10486 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
10487 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
10488 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
10489 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
10490 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
10491 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
10492 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
10493 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
10494 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
10495 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
10496 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10497 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
10498 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10499 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
10500 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
10501 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
10502 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
10503 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
10504 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
10505 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
10506 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
10507 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
10508 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
10509 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
10510 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10511 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
10512 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
10513 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
10514 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
10515 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
10516 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
10517 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
10518 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
10519 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
10520 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
10521 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
10522 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
10523 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
10524 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
10525 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
10526 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
10527 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
10528 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
10529 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
10530 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
10531 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
10532 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
10533 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
10534 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
10535 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
10536 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
10537 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
10538 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
10539 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
10540 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
10541 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
10542 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
10543 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
10544 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
10545 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
10546 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
10547 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
10548 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
10549 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
10550 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
10551 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
10552 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
10553 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
10554 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
10555 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
10556 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10557 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
10558 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
10559 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
10560 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
10561 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
10562 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
10563 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
10564 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
10565 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
10566 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
10567 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
10568 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
10569 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
10570 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
10571 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
10572 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
10573 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
10574 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
10575 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
10576 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
10577 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
10578 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
10579 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
10580 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
10581 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
10582 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
10583 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
10584 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
10585 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
10586 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
10587 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
10588 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
10589 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
10590 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
10591 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
10592 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
10593 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
10594 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
10595 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
10596 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
10597 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
10598 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
10599 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
10600 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
10601 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
10602 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
10603 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
10604 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
10605 	{.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
10606 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
10607 	{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
10608 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
10609 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
10610 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
10611 	{.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
10612 	{}
10613 };
10614 #define ALC225_STANDARD_PINS \
10615 	{0x21, 0x04211020}
10616 
10617 #define ALC256_STANDARD_PINS \
10618 	{0x12, 0x90a60140}, \
10619 	{0x14, 0x90170110}, \
10620 	{0x21, 0x02211020}
10621 
10622 #define ALC282_STANDARD_PINS \
10623 	{0x14, 0x90170110}
10624 
10625 #define ALC290_STANDARD_PINS \
10626 	{0x12, 0x99a30130}
10627 
10628 #define ALC292_STANDARD_PINS \
10629 	{0x14, 0x90170110}, \
10630 	{0x15, 0x0221401f}
10631 
10632 #define ALC295_STANDARD_PINS \
10633 	{0x12, 0xb7a60130}, \
10634 	{0x14, 0x90170110}, \
10635 	{0x21, 0x04211020}
10636 
10637 #define ALC298_STANDARD_PINS \
10638 	{0x12, 0x90a60130}, \
10639 	{0x21, 0x03211020}
10640 
10641 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
10642 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
10643 		{0x14, 0x01014020},
10644 		{0x17, 0x90170110},
10645 		{0x18, 0x02a11030},
10646 		{0x19, 0x0181303F},
10647 		{0x21, 0x0221102f}),
10648 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
10649 		{0x12, 0x90a601c0},
10650 		{0x14, 0x90171120},
10651 		{0x21, 0x02211030}),
10652 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10653 		{0x14, 0x90170110},
10654 		{0x1b, 0x90a70130},
10655 		{0x21, 0x03211020}),
10656 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10657 		{0x1a, 0x90a70130},
10658 		{0x1b, 0x90170110},
10659 		{0x21, 0x03211020}),
10660 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10661 		ALC225_STANDARD_PINS,
10662 		{0x12, 0xb7a60130},
10663 		{0x14, 0x901701a0}),
10664 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10665 		ALC225_STANDARD_PINS,
10666 		{0x12, 0xb7a60130},
10667 		{0x14, 0x901701b0}),
10668 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10669 		ALC225_STANDARD_PINS,
10670 		{0x12, 0xb7a60150},
10671 		{0x14, 0x901701a0}),
10672 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10673 		ALC225_STANDARD_PINS,
10674 		{0x12, 0xb7a60150},
10675 		{0x14, 0x901701b0}),
10676 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10677 		ALC225_STANDARD_PINS,
10678 		{0x12, 0xb7a60130},
10679 		{0x1b, 0x90170110}),
10680 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10681 		{0x1b, 0x01111010},
10682 		{0x1e, 0x01451130},
10683 		{0x21, 0x02211020}),
10684 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
10685 		{0x12, 0x90a60140},
10686 		{0x14, 0x90170110},
10687 		{0x19, 0x02a11030},
10688 		{0x21, 0x02211020}),
10689 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10690 		{0x14, 0x90170110},
10691 		{0x19, 0x02a11030},
10692 		{0x1a, 0x02a11040},
10693 		{0x1b, 0x01014020},
10694 		{0x21, 0x0221101f}),
10695 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10696 		{0x14, 0x90170110},
10697 		{0x19, 0x02a11030},
10698 		{0x1a, 0x02a11040},
10699 		{0x1b, 0x01011020},
10700 		{0x21, 0x0221101f}),
10701 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10702 		{0x14, 0x90170110},
10703 		{0x19, 0x02a11020},
10704 		{0x1a, 0x02a11030},
10705 		{0x21, 0x0221101f}),
10706 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
10707 		{0x21, 0x02211010}),
10708 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10709 		{0x14, 0x90170110},
10710 		{0x19, 0x02a11020},
10711 		{0x21, 0x02211030}),
10712 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
10713 		{0x14, 0x90170110},
10714 		{0x21, 0x02211020}),
10715 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10716 		{0x14, 0x90170130},
10717 		{0x21, 0x02211040}),
10718 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10719 		{0x12, 0x90a60140},
10720 		{0x14, 0x90170110},
10721 		{0x21, 0x02211020}),
10722 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10723 		{0x12, 0x90a60160},
10724 		{0x14, 0x90170120},
10725 		{0x21, 0x02211030}),
10726 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10727 		{0x14, 0x90170110},
10728 		{0x1b, 0x02011020},
10729 		{0x21, 0x0221101f}),
10730 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10731 		{0x14, 0x90170110},
10732 		{0x1b, 0x01011020},
10733 		{0x21, 0x0221101f}),
10734 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10735 		{0x14, 0x90170130},
10736 		{0x1b, 0x01014020},
10737 		{0x21, 0x0221103f}),
10738 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10739 		{0x14, 0x90170130},
10740 		{0x1b, 0x01011020},
10741 		{0x21, 0x0221103f}),
10742 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10743 		{0x14, 0x90170130},
10744 		{0x1b, 0x02011020},
10745 		{0x21, 0x0221103f}),
10746 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10747 		{0x14, 0x90170150},
10748 		{0x1b, 0x02011020},
10749 		{0x21, 0x0221105f}),
10750 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10751 		{0x14, 0x90170110},
10752 		{0x1b, 0x01014020},
10753 		{0x21, 0x0221101f}),
10754 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10755 		{0x12, 0x90a60160},
10756 		{0x14, 0x90170120},
10757 		{0x17, 0x90170140},
10758 		{0x21, 0x0321102f}),
10759 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10760 		{0x12, 0x90a60160},
10761 		{0x14, 0x90170130},
10762 		{0x21, 0x02211040}),
10763 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10764 		{0x12, 0x90a60160},
10765 		{0x14, 0x90170140},
10766 		{0x21, 0x02211050}),
10767 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10768 		{0x12, 0x90a60170},
10769 		{0x14, 0x90170120},
10770 		{0x21, 0x02211030}),
10771 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10772 		{0x12, 0x90a60170},
10773 		{0x14, 0x90170130},
10774 		{0x21, 0x02211040}),
10775 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10776 		{0x12, 0x90a60170},
10777 		{0x14, 0x90171130},
10778 		{0x21, 0x02211040}),
10779 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10780 		{0x12, 0x90a60170},
10781 		{0x14, 0x90170140},
10782 		{0x21, 0x02211050}),
10783 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10784 		{0x12, 0x90a60180},
10785 		{0x14, 0x90170130},
10786 		{0x21, 0x02211040}),
10787 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10788 		{0x12, 0x90a60180},
10789 		{0x14, 0x90170120},
10790 		{0x21, 0x02211030}),
10791 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10792 		{0x1b, 0x01011020},
10793 		{0x21, 0x02211010}),
10794 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10795 		{0x14, 0x90170110},
10796 		{0x1b, 0x90a70130},
10797 		{0x21, 0x04211020}),
10798 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10799 		{0x14, 0x90170110},
10800 		{0x1b, 0x90a70130},
10801 		{0x21, 0x03211020}),
10802 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10803 		{0x12, 0x90a60130},
10804 		{0x14, 0x90170110},
10805 		{0x21, 0x03211020}),
10806 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10807 		{0x12, 0x90a60130},
10808 		{0x14, 0x90170110},
10809 		{0x21, 0x04211020}),
10810 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10811 		{0x1a, 0x90a70130},
10812 		{0x1b, 0x90170110},
10813 		{0x21, 0x03211020}),
10814        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10815 		{0x14, 0x90170110},
10816 		{0x19, 0x02a11020},
10817 		{0x21, 0x0221101f}),
10818        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
10819 		{0x17, 0x90170110},
10820 		{0x19, 0x03a11030},
10821 		{0x21, 0x03211020}),
10822 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10823 		{0x12, 0x90a60130},
10824 		{0x14, 0x90170110},
10825 		{0x15, 0x0421101f},
10826 		{0x1a, 0x04a11020}),
10827 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10828 		{0x12, 0x90a60140},
10829 		{0x14, 0x90170110},
10830 		{0x15, 0x0421101f},
10831 		{0x18, 0x02811030},
10832 		{0x1a, 0x04a1103f},
10833 		{0x1b, 0x02011020}),
10834 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10835 		ALC282_STANDARD_PINS,
10836 		{0x12, 0x99a30130},
10837 		{0x19, 0x03a11020},
10838 		{0x21, 0x0321101f}),
10839 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10840 		ALC282_STANDARD_PINS,
10841 		{0x12, 0x99a30130},
10842 		{0x19, 0x03a11020},
10843 		{0x21, 0x03211040}),
10844 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10845 		ALC282_STANDARD_PINS,
10846 		{0x12, 0x99a30130},
10847 		{0x19, 0x03a11030},
10848 		{0x21, 0x03211020}),
10849 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10850 		ALC282_STANDARD_PINS,
10851 		{0x12, 0x99a30130},
10852 		{0x19, 0x04a11020},
10853 		{0x21, 0x0421101f}),
10854 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
10855 		ALC282_STANDARD_PINS,
10856 		{0x12, 0x90a60140},
10857 		{0x19, 0x04a11030},
10858 		{0x21, 0x04211020}),
10859 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10860 		ALC282_STANDARD_PINS,
10861 		{0x12, 0x90a609c0},
10862 		{0x18, 0x03a11830},
10863 		{0x19, 0x04a19831},
10864 		{0x1a, 0x0481303f},
10865 		{0x1b, 0x04211020},
10866 		{0x21, 0x0321101f}),
10867 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10868 		ALC282_STANDARD_PINS,
10869 		{0x12, 0x90a60940},
10870 		{0x18, 0x03a11830},
10871 		{0x19, 0x04a19831},
10872 		{0x1a, 0x0481303f},
10873 		{0x1b, 0x04211020},
10874 		{0x21, 0x0321101f}),
10875 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10876 		ALC282_STANDARD_PINS,
10877 		{0x12, 0x90a60130},
10878 		{0x21, 0x0321101f}),
10879 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10880 		{0x12, 0x90a60160},
10881 		{0x14, 0x90170120},
10882 		{0x21, 0x02211030}),
10883 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10884 		ALC282_STANDARD_PINS,
10885 		{0x12, 0x90a60130},
10886 		{0x19, 0x03a11020},
10887 		{0x21, 0x0321101f}),
10888 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10889 		{0x12, 0x90a60130},
10890 		{0x14, 0x90170110},
10891 		{0x19, 0x04a11040},
10892 		{0x21, 0x04211020}),
10893 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10894 		{0x14, 0x90170110},
10895 		{0x19, 0x04a11040},
10896 		{0x1d, 0x40600001},
10897 		{0x21, 0x04211020}),
10898 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10899 		{0x14, 0x90170110},
10900 		{0x19, 0x04a11040},
10901 		{0x21, 0x04211020}),
10902 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10903 		{0x14, 0x90170110},
10904 		{0x17, 0x90170111},
10905 		{0x19, 0x03a11030},
10906 		{0x21, 0x03211020}),
10907 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10908 		{0x17, 0x90170110},
10909 		{0x19, 0x03a11030},
10910 		{0x21, 0x03211020}),
10911 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10912 		{0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
10913 		{0x19, 0x04a11040},
10914 		{0x21, 0x04211020}),
10915 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
10916 		{0x12, 0x90a60130},
10917 		{0x17, 0x90170110},
10918 		{0x21, 0x02211020}),
10919 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
10920 		{0x12, 0x90a60120},
10921 		{0x14, 0x90170110},
10922 		{0x21, 0x0321101f}),
10923 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10924 		ALC290_STANDARD_PINS,
10925 		{0x15, 0x04211040},
10926 		{0x18, 0x90170112},
10927 		{0x1a, 0x04a11020}),
10928 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10929 		ALC290_STANDARD_PINS,
10930 		{0x15, 0x04211040},
10931 		{0x18, 0x90170110},
10932 		{0x1a, 0x04a11020}),
10933 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10934 		ALC290_STANDARD_PINS,
10935 		{0x15, 0x0421101f},
10936 		{0x1a, 0x04a11020}),
10937 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10938 		ALC290_STANDARD_PINS,
10939 		{0x15, 0x04211020},
10940 		{0x1a, 0x04a11040}),
10941 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10942 		ALC290_STANDARD_PINS,
10943 		{0x14, 0x90170110},
10944 		{0x15, 0x04211020},
10945 		{0x1a, 0x04a11040}),
10946 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10947 		ALC290_STANDARD_PINS,
10948 		{0x14, 0x90170110},
10949 		{0x15, 0x04211020},
10950 		{0x1a, 0x04a11020}),
10951 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10952 		ALC290_STANDARD_PINS,
10953 		{0x14, 0x90170110},
10954 		{0x15, 0x0421101f},
10955 		{0x1a, 0x04a11020}),
10956 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10957 		ALC292_STANDARD_PINS,
10958 		{0x12, 0x90a60140},
10959 		{0x16, 0x01014020},
10960 		{0x19, 0x01a19030}),
10961 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10962 		ALC292_STANDARD_PINS,
10963 		{0x12, 0x90a60140},
10964 		{0x16, 0x01014020},
10965 		{0x18, 0x02a19031},
10966 		{0x19, 0x01a1903e}),
10967 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
10968 		ALC292_STANDARD_PINS,
10969 		{0x12, 0x90a60140}),
10970 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10971 		ALC292_STANDARD_PINS,
10972 		{0x13, 0x90a60140},
10973 		{0x16, 0x21014020},
10974 		{0x19, 0x21a19030}),
10975 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10976 		ALC292_STANDARD_PINS,
10977 		{0x13, 0x90a60140}),
10978 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
10979 		{0x17, 0x90170110},
10980 		{0x21, 0x04211020}),
10981 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
10982 		{0x14, 0x90170110},
10983 		{0x1b, 0x90a70130},
10984 		{0x21, 0x04211020}),
10985 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10986 		{0x12, 0x90a60130},
10987 		{0x17, 0x90170110},
10988 		{0x21, 0x03211020}),
10989 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10990 		{0x12, 0x90a60130},
10991 		{0x17, 0x90170110},
10992 		{0x21, 0x04211020}),
10993 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10994 		{0x12, 0x90a60130},
10995 		{0x17, 0x90170110},
10996 		{0x21, 0x03211020}),
10997 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10998 		{0x12, 0x90a60120},
10999 		{0x17, 0x90170110},
11000 		{0x21, 0x04211030}),
11001 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11002 		{0x12, 0x90a60130},
11003 		{0x17, 0x90170110},
11004 		{0x21, 0x03211020}),
11005 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11006 		{0x12, 0x90a60130},
11007 		{0x17, 0x90170110},
11008 		{0x21, 0x03211020}),
11009 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11010 		ALC298_STANDARD_PINS,
11011 		{0x17, 0x90170110}),
11012 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11013 		ALC298_STANDARD_PINS,
11014 		{0x17, 0x90170140}),
11015 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11016 		ALC298_STANDARD_PINS,
11017 		{0x17, 0x90170150}),
11018 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11019 		{0x12, 0xb7a60140},
11020 		{0x13, 0xb7a60150},
11021 		{0x17, 0x90170110},
11022 		{0x1a, 0x03011020},
11023 		{0x21, 0x03211030}),
11024 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11025 		{0x12, 0xb7a60140},
11026 		{0x17, 0x90170110},
11027 		{0x1a, 0x03a11030},
11028 		{0x21, 0x03211020}),
11029 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11030 		ALC225_STANDARD_PINS,
11031 		{0x12, 0xb7a60130},
11032 		{0x17, 0x90170110}),
11033 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11034 		{0x14, 0x01014010},
11035 		{0x17, 0x90170120},
11036 		{0x18, 0x02a11030},
11037 		{0x19, 0x02a1103f},
11038 		{0x21, 0x0221101f}),
11039 	{}
11040 };
11041 
11042 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11043  * more machines, don't need to match all valid pins, just need to match
11044  * all the pins defined in the tbl. Just because of this reason, it is possible
11045  * that a single machine matches multiple tbls, so there is one limitation:
11046  *   at most one tbl is allowed to define for the same vendor and same codec
11047  */
11048 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11049 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11050 		{0x19, 0x40000000}),
11051 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11052 		{0x19, 0x40000000},
11053 		{0x1b, 0x40000000}),
11054 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
11055 		{0x19, 0x40000000},
11056 		{0x1b, 0x40000000}),
11057 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11058 		{0x19, 0x40000000},
11059 		{0x1a, 0x40000000}),
11060 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11061 		{0x19, 0x40000000},
11062 		{0x1a, 0x40000000}),
11063 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11064 		{0x19, 0x40000000},
11065 		{0x1a, 0x40000000}),
11066 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11067 		{0x19, 0x40000000}),
11068 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1558, "Clevo", ALC2XX_FIXUP_HEADSET_MIC,
11069 		{0x19, 0x40000000}),
11070 	{}
11071 };
11072 
alc269_fill_coef(struct hda_codec * codec)11073 static void alc269_fill_coef(struct hda_codec *codec)
11074 {
11075 	struct alc_spec *spec = codec->spec;
11076 	int val;
11077 
11078 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11079 		return;
11080 
11081 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11082 		alc_write_coef_idx(codec, 0xf, 0x960b);
11083 		alc_write_coef_idx(codec, 0xe, 0x8817);
11084 	}
11085 
11086 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11087 		alc_write_coef_idx(codec, 0xf, 0x960b);
11088 		alc_write_coef_idx(codec, 0xe, 0x8814);
11089 	}
11090 
11091 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11092 		/* Power up output pin */
11093 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11094 	}
11095 
11096 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11097 		val = alc_read_coef_idx(codec, 0xd);
11098 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11099 			/* Capless ramp up clock control */
11100 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
11101 		}
11102 		val = alc_read_coef_idx(codec, 0x17);
11103 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11104 			/* Class D power on reset */
11105 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
11106 		}
11107 	}
11108 
11109 	/* HP */
11110 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11111 }
11112 
11113 /*
11114  */
patch_alc269(struct hda_codec * codec)11115 static int patch_alc269(struct hda_codec *codec)
11116 {
11117 	struct alc_spec *spec;
11118 	int err;
11119 
11120 	err = alc_alloc_spec(codec, 0x0b);
11121 	if (err < 0)
11122 		return err;
11123 
11124 	spec = codec->spec;
11125 	spec->gen.shared_mic_vref_pin = 0x18;
11126 	codec->power_save_node = 0;
11127 	spec->en_3kpull_low = true;
11128 
11129 #ifdef CONFIG_PM
11130 	codec->patch_ops.suspend = alc269_suspend;
11131 	codec->patch_ops.resume = alc269_resume;
11132 #endif
11133 	spec->shutup = alc_default_shutup;
11134 	spec->init_hook = alc_default_init;
11135 
11136 	switch (codec->core.vendor_id) {
11137 	case 0x10ec0269:
11138 		spec->codec_variant = ALC269_TYPE_ALC269VA;
11139 		switch (alc_get_coef0(codec) & 0x00f0) {
11140 		case 0x0010:
11141 			if (codec->bus->pci &&
11142 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
11143 			    spec->cdefine.platform_type == 1)
11144 				err = alc_codec_rename(codec, "ALC271X");
11145 			spec->codec_variant = ALC269_TYPE_ALC269VB;
11146 			break;
11147 		case 0x0020:
11148 			if (codec->bus->pci &&
11149 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
11150 			    codec->bus->pci->subsystem_device == 0x21f3)
11151 				err = alc_codec_rename(codec, "ALC3202");
11152 			spec->codec_variant = ALC269_TYPE_ALC269VC;
11153 			break;
11154 		case 0x0030:
11155 			spec->codec_variant = ALC269_TYPE_ALC269VD;
11156 			break;
11157 		default:
11158 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
11159 		}
11160 		if (err < 0)
11161 			goto error;
11162 		spec->shutup = alc269_shutup;
11163 		spec->init_hook = alc269_fill_coef;
11164 		alc269_fill_coef(codec);
11165 		break;
11166 
11167 	case 0x10ec0280:
11168 	case 0x10ec0290:
11169 		spec->codec_variant = ALC269_TYPE_ALC280;
11170 		break;
11171 	case 0x10ec0282:
11172 		spec->codec_variant = ALC269_TYPE_ALC282;
11173 		spec->shutup = alc282_shutup;
11174 		spec->init_hook = alc282_init;
11175 		break;
11176 	case 0x10ec0233:
11177 	case 0x10ec0283:
11178 		spec->codec_variant = ALC269_TYPE_ALC283;
11179 		spec->shutup = alc283_shutup;
11180 		spec->init_hook = alc283_init;
11181 		break;
11182 	case 0x10ec0284:
11183 	case 0x10ec0292:
11184 		spec->codec_variant = ALC269_TYPE_ALC284;
11185 		break;
11186 	case 0x10ec0293:
11187 		spec->codec_variant = ALC269_TYPE_ALC293;
11188 		break;
11189 	case 0x10ec0286:
11190 	case 0x10ec0288:
11191 		spec->codec_variant = ALC269_TYPE_ALC286;
11192 		break;
11193 	case 0x10ec0298:
11194 		spec->codec_variant = ALC269_TYPE_ALC298;
11195 		break;
11196 	case 0x10ec0235:
11197 	case 0x10ec0255:
11198 		spec->codec_variant = ALC269_TYPE_ALC255;
11199 		spec->shutup = alc256_shutup;
11200 		spec->init_hook = alc256_init;
11201 		break;
11202 	case 0x10ec0230:
11203 	case 0x10ec0236:
11204 	case 0x10ec0256:
11205 	case 0x19e58326:
11206 		spec->codec_variant = ALC269_TYPE_ALC256;
11207 		spec->shutup = alc256_shutup;
11208 		spec->init_hook = alc256_init;
11209 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
11210 		if (codec->core.vendor_id == 0x10ec0236 &&
11211 		    codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
11212 			spec->en_3kpull_low = false;
11213 		break;
11214 	case 0x10ec0257:
11215 		spec->codec_variant = ALC269_TYPE_ALC257;
11216 		spec->shutup = alc256_shutup;
11217 		spec->init_hook = alc256_init;
11218 		spec->gen.mixer_nid = 0;
11219 		spec->en_3kpull_low = false;
11220 		break;
11221 	case 0x10ec0215:
11222 	case 0x10ec0245:
11223 	case 0x10ec0285:
11224 	case 0x10ec0289:
11225 		if (alc_get_coef0(codec) & 0x0010)
11226 			spec->codec_variant = ALC269_TYPE_ALC245;
11227 		else
11228 			spec->codec_variant = ALC269_TYPE_ALC215;
11229 		spec->shutup = alc225_shutup;
11230 		spec->init_hook = alc225_init;
11231 		spec->gen.mixer_nid = 0;
11232 		break;
11233 	case 0x10ec0225:
11234 	case 0x10ec0295:
11235 	case 0x10ec0299:
11236 		spec->codec_variant = ALC269_TYPE_ALC225;
11237 		spec->shutup = alc225_shutup;
11238 		spec->init_hook = alc225_init;
11239 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
11240 		break;
11241 	case 0x10ec0287:
11242 		spec->codec_variant = ALC269_TYPE_ALC287;
11243 		spec->shutup = alc225_shutup;
11244 		spec->init_hook = alc225_init;
11245 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
11246 		break;
11247 	case 0x10ec0234:
11248 	case 0x10ec0274:
11249 	case 0x10ec0294:
11250 		spec->codec_variant = ALC269_TYPE_ALC294;
11251 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
11252 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
11253 		spec->init_hook = alc294_init;
11254 		break;
11255 	case 0x10ec0300:
11256 		spec->codec_variant = ALC269_TYPE_ALC300;
11257 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
11258 		break;
11259 	case 0x10ec0623:
11260 		spec->codec_variant = ALC269_TYPE_ALC623;
11261 		break;
11262 	case 0x10ec0700:
11263 	case 0x10ec0701:
11264 	case 0x10ec0703:
11265 	case 0x10ec0711:
11266 		spec->codec_variant = ALC269_TYPE_ALC700;
11267 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
11268 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
11269 		spec->init_hook = alc294_init;
11270 		break;
11271 
11272 	}
11273 
11274 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
11275 		spec->has_alc5505_dsp = 1;
11276 		spec->init_hook = alc5505_dsp_init;
11277 	}
11278 
11279 	alc_pre_init(codec);
11280 
11281 	snd_hda_pick_fixup(codec, alc269_fixup_models,
11282 		       alc269_fixup_tbl, alc269_fixups);
11283 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
11284 	 * the quirk breaks the latter (bko#214101).
11285 	 * Clear the wrong entry.
11286 	 */
11287 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
11288 	    codec->core.vendor_id == 0x10ec0294) {
11289 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
11290 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
11291 	}
11292 
11293 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
11294 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
11295 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
11296 			   alc269_fixups);
11297 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11298 
11299 	alc_auto_parse_customize_define(codec);
11300 
11301 	if (has_cdefine_beep(codec))
11302 		spec->gen.beep_nid = 0x01;
11303 
11304 	/* automatic parse from the BIOS config */
11305 	err = alc269_parse_auto_config(codec);
11306 	if (err < 0)
11307 		goto error;
11308 
11309 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
11310 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
11311 		if (err < 0)
11312 			goto error;
11313 	}
11314 
11315 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11316 
11317 	return 0;
11318 
11319  error:
11320 	alc_free(codec);
11321 	return err;
11322 }
11323 
11324 /*
11325  * ALC861
11326  */
11327 
alc861_parse_auto_config(struct hda_codec * codec)11328 static int alc861_parse_auto_config(struct hda_codec *codec)
11329 {
11330 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11331 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
11332 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
11333 }
11334 
11335 /* Pin config fixes */
11336 enum {
11337 	ALC861_FIXUP_FSC_AMILO_PI1505,
11338 	ALC861_FIXUP_AMP_VREF_0F,
11339 	ALC861_FIXUP_NO_JACK_DETECT,
11340 	ALC861_FIXUP_ASUS_A6RP,
11341 	ALC660_FIXUP_ASUS_W7J,
11342 };
11343 
11344 /* 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)11345 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
11346 			const struct hda_fixup *fix, int action)
11347 {
11348 	struct alc_spec *spec = codec->spec;
11349 	unsigned int val;
11350 
11351 	if (action != HDA_FIXUP_ACT_INIT)
11352 		return;
11353 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
11354 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
11355 		val |= AC_PINCTL_IN_EN;
11356 	val |= AC_PINCTL_VREF_50;
11357 	snd_hda_set_pin_ctl(codec, 0x0f, val);
11358 	spec->gen.keep_vref_in_automute = 1;
11359 }
11360 
11361 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)11362 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
11363 				     const struct hda_fixup *fix, int action)
11364 {
11365 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11366 		codec->no_jack_detect = 1;
11367 }
11368 
11369 static const struct hda_fixup alc861_fixups[] = {
11370 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
11371 		.type = HDA_FIXUP_PINS,
11372 		.v.pins = (const struct hda_pintbl[]) {
11373 			{ 0x0b, 0x0221101f }, /* HP */
11374 			{ 0x0f, 0x90170310 }, /* speaker */
11375 			{ }
11376 		}
11377 	},
11378 	[ALC861_FIXUP_AMP_VREF_0F] = {
11379 		.type = HDA_FIXUP_FUNC,
11380 		.v.func = alc861_fixup_asus_amp_vref_0f,
11381 	},
11382 	[ALC861_FIXUP_NO_JACK_DETECT] = {
11383 		.type = HDA_FIXUP_FUNC,
11384 		.v.func = alc_fixup_no_jack_detect,
11385 	},
11386 	[ALC861_FIXUP_ASUS_A6RP] = {
11387 		.type = HDA_FIXUP_FUNC,
11388 		.v.func = alc861_fixup_asus_amp_vref_0f,
11389 		.chained = true,
11390 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
11391 	},
11392 	[ALC660_FIXUP_ASUS_W7J] = {
11393 		.type = HDA_FIXUP_VERBS,
11394 		.v.verbs = (const struct hda_verb[]) {
11395 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
11396 			 * for enabling outputs
11397 			 */
11398 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11399 			{ }
11400 		},
11401 	}
11402 };
11403 
11404 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
11405 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
11406 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
11407 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
11408 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
11409 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
11410 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
11411 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
11412 	{}
11413 };
11414 
11415 /*
11416  */
patch_alc861(struct hda_codec * codec)11417 static int patch_alc861(struct hda_codec *codec)
11418 {
11419 	struct alc_spec *spec;
11420 	int err;
11421 
11422 	err = alc_alloc_spec(codec, 0x15);
11423 	if (err < 0)
11424 		return err;
11425 
11426 	spec = codec->spec;
11427 	if (has_cdefine_beep(codec))
11428 		spec->gen.beep_nid = 0x23;
11429 
11430 #ifdef CONFIG_PM
11431 	spec->power_hook = alc_power_eapd;
11432 #endif
11433 
11434 	alc_pre_init(codec);
11435 
11436 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
11437 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11438 
11439 	/* automatic parse from the BIOS config */
11440 	err = alc861_parse_auto_config(codec);
11441 	if (err < 0)
11442 		goto error;
11443 
11444 	if (!spec->gen.no_analog) {
11445 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
11446 		if (err < 0)
11447 			goto error;
11448 	}
11449 
11450 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11451 
11452 	return 0;
11453 
11454  error:
11455 	alc_free(codec);
11456 	return err;
11457 }
11458 
11459 /*
11460  * ALC861-VD support
11461  *
11462  * Based on ALC882
11463  *
11464  * In addition, an independent DAC
11465  */
alc861vd_parse_auto_config(struct hda_codec * codec)11466 static int alc861vd_parse_auto_config(struct hda_codec *codec)
11467 {
11468 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
11469 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11470 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
11471 }
11472 
11473 enum {
11474 	ALC660VD_FIX_ASUS_GPIO1,
11475 	ALC861VD_FIX_DALLAS,
11476 };
11477 
11478 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)11479 static void alc861vd_fixup_dallas(struct hda_codec *codec,
11480 				  const struct hda_fixup *fix, int action)
11481 {
11482 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11483 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
11484 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
11485 	}
11486 }
11487 
11488 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11489 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
11490 				      const struct hda_fixup *fix, int action)
11491 {
11492 	struct alc_spec *spec = codec->spec;
11493 
11494 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
11495 		spec->gpio_mask |= 0x02;
11496 	alc_fixup_gpio(codec, action, 0x01);
11497 }
11498 
11499 static const struct hda_fixup alc861vd_fixups[] = {
11500 	[ALC660VD_FIX_ASUS_GPIO1] = {
11501 		.type = HDA_FIXUP_FUNC,
11502 		.v.func = alc660vd_fixup_asus_gpio1,
11503 	},
11504 	[ALC861VD_FIX_DALLAS] = {
11505 		.type = HDA_FIXUP_FUNC,
11506 		.v.func = alc861vd_fixup_dallas,
11507 	},
11508 };
11509 
11510 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
11511 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
11512 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
11513 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
11514 	{}
11515 };
11516 
11517 /*
11518  */
patch_alc861vd(struct hda_codec * codec)11519 static int patch_alc861vd(struct hda_codec *codec)
11520 {
11521 	struct alc_spec *spec;
11522 	int err;
11523 
11524 	err = alc_alloc_spec(codec, 0x0b);
11525 	if (err < 0)
11526 		return err;
11527 
11528 	spec = codec->spec;
11529 	if (has_cdefine_beep(codec))
11530 		spec->gen.beep_nid = 0x23;
11531 
11532 	spec->shutup = alc_eapd_shutup;
11533 
11534 	alc_pre_init(codec);
11535 
11536 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
11537 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11538 
11539 	/* automatic parse from the BIOS config */
11540 	err = alc861vd_parse_auto_config(codec);
11541 	if (err < 0)
11542 		goto error;
11543 
11544 	if (!spec->gen.no_analog) {
11545 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11546 		if (err < 0)
11547 			goto error;
11548 	}
11549 
11550 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11551 
11552 	return 0;
11553 
11554  error:
11555 	alc_free(codec);
11556 	return err;
11557 }
11558 
11559 /*
11560  * ALC662 support
11561  *
11562  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11563  * configuration.  Each pin widget can choose any input DACs and a mixer.
11564  * Each ADC is connected from a mixer of all inputs.  This makes possible
11565  * 6-channel independent captures.
11566  *
11567  * In addition, an independent DAC for the multi-playback (not used in this
11568  * driver yet).
11569  */
11570 
11571 /*
11572  * BIOS auto configuration
11573  */
11574 
alc662_parse_auto_config(struct hda_codec * codec)11575 static int alc662_parse_auto_config(struct hda_codec *codec)
11576 {
11577 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11578 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
11579 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11580 	const hda_nid_t *ssids;
11581 
11582 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
11583 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
11584 	    codec->core.vendor_id == 0x10ec0671)
11585 		ssids = alc663_ssids;
11586 	else
11587 		ssids = alc662_ssids;
11588 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
11589 }
11590 
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)11591 static void alc272_fixup_mario(struct hda_codec *codec,
11592 			       const struct hda_fixup *fix, int action)
11593 {
11594 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
11595 		return;
11596 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
11597 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
11598 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
11599 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11600 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
11601 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
11602 }
11603 
11604 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
11605 	{ .channels = 2,
11606 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
11607 	{ .channels = 4,
11608 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
11609 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
11610 	{ }
11611 };
11612 
11613 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)11614 static void alc_fixup_bass_chmap(struct hda_codec *codec,
11615 				    const struct hda_fixup *fix, int action)
11616 {
11617 	if (action == HDA_FIXUP_ACT_BUILD) {
11618 		struct alc_spec *spec = codec->spec;
11619 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
11620 	}
11621 }
11622 
11623 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)11624 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
11625 					  hda_nid_t nid,
11626 					  unsigned int power_state)
11627 {
11628 	struct alc_spec *spec = codec->spec;
11629 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
11630 		return AC_PWRST_D0;
11631 	return power_state;
11632 }
11633 
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11634 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
11635 				   const struct hda_fixup *fix, int action)
11636 {
11637 	struct alc_spec *spec = codec->spec;
11638 
11639 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
11640 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11641 		spec->mute_led_polarity = 1;
11642 		codec->power_filter = gpio_led_power_filter;
11643 	}
11644 }
11645 
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11646 static void alc662_usi_automute_hook(struct hda_codec *codec,
11647 					 struct hda_jack_callback *jack)
11648 {
11649 	struct alc_spec *spec = codec->spec;
11650 	int vref;
11651 	msleep(200);
11652 	snd_hda_gen_hp_automute(codec, jack);
11653 
11654 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
11655 	msleep(100);
11656 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11657 			    vref);
11658 }
11659 
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11660 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
11661 				     const struct hda_fixup *fix, int action)
11662 {
11663 	struct alc_spec *spec = codec->spec;
11664 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11665 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11666 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
11667 	}
11668 }
11669 
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)11670 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
11671 					struct hda_jack_callback *cb)
11672 {
11673 	/* surround speakers at 0x1b already get muted automatically when
11674 	 * headphones are plugged in, but we have to mute/unmute the remaining
11675 	 * channels manually:
11676 	 * 0x15 - front left/front right
11677 	 * 0x18 - front center/ LFE
11678 	 */
11679 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
11680 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
11681 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
11682 	} else {
11683 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
11684 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
11685 	}
11686 }
11687 
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)11688 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
11689 					const struct hda_fixup *fix, int action)
11690 {
11691     /* Pin 0x1b: shared headphones jack and surround speakers */
11692 	if (!is_jack_detectable(codec, 0x1b))
11693 		return;
11694 
11695 	switch (action) {
11696 	case HDA_FIXUP_ACT_PRE_PROBE:
11697 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
11698 				alc662_aspire_ethos_mute_speakers);
11699 		/* subwoofer needs an extra GPIO setting to become audible */
11700 		alc_setup_gpio(codec, 0x02);
11701 		break;
11702 	case HDA_FIXUP_ACT_INIT:
11703 		/* Make sure to start in a correct state, i.e. if
11704 		 * headphones have been plugged in before powering up the system
11705 		 */
11706 		alc662_aspire_ethos_mute_speakers(codec, NULL);
11707 		break;
11708 	}
11709 }
11710 
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)11711 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
11712 					     const struct hda_fixup *fix, int action)
11713 {
11714 	struct alc_spec *spec = codec->spec;
11715 
11716 	static const struct hda_pintbl pincfgs[] = {
11717 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
11718 		{ 0x1b, 0x0181304f },
11719 		{ }
11720 	};
11721 
11722 	switch (action) {
11723 	case HDA_FIXUP_ACT_PRE_PROBE:
11724 		spec->gen.mixer_nid = 0;
11725 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11726 		snd_hda_apply_pincfgs(codec, pincfgs);
11727 		break;
11728 	case HDA_FIXUP_ACT_INIT:
11729 		alc_write_coef_idx(codec, 0x19, 0xa054);
11730 		break;
11731 	}
11732 }
11733 
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11734 static void alc897_hp_automute_hook(struct hda_codec *codec,
11735 					 struct hda_jack_callback *jack)
11736 {
11737 	struct alc_spec *spec = codec->spec;
11738 	int vref;
11739 
11740 	snd_hda_gen_hp_automute(codec, jack);
11741 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
11742 	snd_hda_set_pin_ctl(codec, 0x1b, vref);
11743 }
11744 
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11745 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
11746 				     const struct hda_fixup *fix, int action)
11747 {
11748 	struct alc_spec *spec = codec->spec;
11749 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11750 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11751 		spec->no_shutup_pins = 1;
11752 	}
11753 	if (action == HDA_FIXUP_ACT_PROBE) {
11754 		snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
11755 	}
11756 }
11757 
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)11758 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
11759 				     const struct hda_fixup *fix, int action)
11760 {
11761 	struct alc_spec *spec = codec->spec;
11762 
11763 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11764 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11765 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11766 	}
11767 }
11768 
11769 static const struct coef_fw alc668_coefs[] = {
11770 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
11771 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
11772 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
11773 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
11774 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
11775 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
11776 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
11777 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
11778 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
11779 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
11780 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
11781 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
11782 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
11783 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
11784 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
11785 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
11786 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
11787 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
11788 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
11789 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
11790 	{}
11791 };
11792 
alc668_restore_default_value(struct hda_codec * codec)11793 static void alc668_restore_default_value(struct hda_codec *codec)
11794 {
11795 	alc_process_coef_fw(codec, alc668_coefs);
11796 }
11797 
11798 enum {
11799 	ALC662_FIXUP_ASPIRE,
11800 	ALC662_FIXUP_LED_GPIO1,
11801 	ALC662_FIXUP_IDEAPAD,
11802 	ALC272_FIXUP_MARIO,
11803 	ALC662_FIXUP_CZC_ET26,
11804 	ALC662_FIXUP_CZC_P10T,
11805 	ALC662_FIXUP_SKU_IGNORE,
11806 	ALC662_FIXUP_HP_RP5800,
11807 	ALC662_FIXUP_ASUS_MODE1,
11808 	ALC662_FIXUP_ASUS_MODE2,
11809 	ALC662_FIXUP_ASUS_MODE3,
11810 	ALC662_FIXUP_ASUS_MODE4,
11811 	ALC662_FIXUP_ASUS_MODE5,
11812 	ALC662_FIXUP_ASUS_MODE6,
11813 	ALC662_FIXUP_ASUS_MODE7,
11814 	ALC662_FIXUP_ASUS_MODE8,
11815 	ALC662_FIXUP_NO_JACK_DETECT,
11816 	ALC662_FIXUP_ZOTAC_Z68,
11817 	ALC662_FIXUP_INV_DMIC,
11818 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11819 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
11820 	ALC662_FIXUP_HEADSET_MODE,
11821 	ALC668_FIXUP_HEADSET_MODE,
11822 	ALC662_FIXUP_BASS_MODE4_CHMAP,
11823 	ALC662_FIXUP_BASS_16,
11824 	ALC662_FIXUP_BASS_1A,
11825 	ALC662_FIXUP_BASS_CHMAP,
11826 	ALC668_FIXUP_AUTO_MUTE,
11827 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
11828 	ALC668_FIXUP_DELL_XPS13,
11829 	ALC662_FIXUP_ASUS_Nx50,
11830 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11831 	ALC668_FIXUP_ASUS_Nx51,
11832 	ALC668_FIXUP_MIC_COEF,
11833 	ALC668_FIXUP_ASUS_G751,
11834 	ALC891_FIXUP_HEADSET_MODE,
11835 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11836 	ALC662_FIXUP_ACER_VERITON,
11837 	ALC892_FIXUP_ASROCK_MOBO,
11838 	ALC662_FIXUP_USI_FUNC,
11839 	ALC662_FIXUP_USI_HEADSET_MODE,
11840 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
11841 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
11842 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
11843 	ALC671_FIXUP_HP_HEADSET_MIC2,
11844 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
11845 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
11846 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
11847 	ALC668_FIXUP_HEADSET_MIC,
11848 	ALC668_FIXUP_MIC_DET_COEF,
11849 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
11850 	ALC897_FIXUP_HEADSET_MIC_PIN,
11851 	ALC897_FIXUP_HP_HSMIC_VERB,
11852 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
11853 	ALC897_FIXUP_HEADSET_MIC_PIN2,
11854 	ALC897_FIXUP_UNIS_H3C_X500S,
11855 	ALC897_FIXUP_HEADSET_MIC_PIN3,
11856 };
11857 
11858 static const struct hda_fixup alc662_fixups[] = {
11859 	[ALC662_FIXUP_ASPIRE] = {
11860 		.type = HDA_FIXUP_PINS,
11861 		.v.pins = (const struct hda_pintbl[]) {
11862 			{ 0x15, 0x99130112 }, /* subwoofer */
11863 			{ }
11864 		}
11865 	},
11866 	[ALC662_FIXUP_LED_GPIO1] = {
11867 		.type = HDA_FIXUP_FUNC,
11868 		.v.func = alc662_fixup_led_gpio1,
11869 	},
11870 	[ALC662_FIXUP_IDEAPAD] = {
11871 		.type = HDA_FIXUP_PINS,
11872 		.v.pins = (const struct hda_pintbl[]) {
11873 			{ 0x17, 0x99130112 }, /* subwoofer */
11874 			{ }
11875 		},
11876 		.chained = true,
11877 		.chain_id = ALC662_FIXUP_LED_GPIO1,
11878 	},
11879 	[ALC272_FIXUP_MARIO] = {
11880 		.type = HDA_FIXUP_FUNC,
11881 		.v.func = alc272_fixup_mario,
11882 	},
11883 	[ALC662_FIXUP_CZC_ET26] = {
11884 		.type = HDA_FIXUP_PINS,
11885 		.v.pins = (const struct hda_pintbl[]) {
11886 			{0x12, 0x403cc000},
11887 			{0x14, 0x90170110}, /* speaker */
11888 			{0x15, 0x411111f0},
11889 			{0x16, 0x411111f0},
11890 			{0x18, 0x01a19030}, /* mic */
11891 			{0x19, 0x90a7013f}, /* int-mic */
11892 			{0x1a, 0x01014020},
11893 			{0x1b, 0x0121401f},
11894 			{0x1c, 0x411111f0},
11895 			{0x1d, 0x411111f0},
11896 			{0x1e, 0x40478e35},
11897 			{}
11898 		},
11899 		.chained = true,
11900 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11901 	},
11902 	[ALC662_FIXUP_CZC_P10T] = {
11903 		.type = HDA_FIXUP_VERBS,
11904 		.v.verbs = (const struct hda_verb[]) {
11905 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
11906 			{}
11907 		}
11908 	},
11909 	[ALC662_FIXUP_SKU_IGNORE] = {
11910 		.type = HDA_FIXUP_FUNC,
11911 		.v.func = alc_fixup_sku_ignore,
11912 	},
11913 	[ALC662_FIXUP_HP_RP5800] = {
11914 		.type = HDA_FIXUP_PINS,
11915 		.v.pins = (const struct hda_pintbl[]) {
11916 			{ 0x14, 0x0221201f }, /* HP out */
11917 			{ }
11918 		},
11919 		.chained = true,
11920 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11921 	},
11922 	[ALC662_FIXUP_ASUS_MODE1] = {
11923 		.type = HDA_FIXUP_PINS,
11924 		.v.pins = (const struct hda_pintbl[]) {
11925 			{ 0x14, 0x99130110 }, /* speaker */
11926 			{ 0x18, 0x01a19c20 }, /* mic */
11927 			{ 0x19, 0x99a3092f }, /* int-mic */
11928 			{ 0x21, 0x0121401f }, /* HP out */
11929 			{ }
11930 		},
11931 		.chained = true,
11932 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11933 	},
11934 	[ALC662_FIXUP_ASUS_MODE2] = {
11935 		.type = HDA_FIXUP_PINS,
11936 		.v.pins = (const struct hda_pintbl[]) {
11937 			{ 0x14, 0x99130110 }, /* speaker */
11938 			{ 0x18, 0x01a19820 }, /* mic */
11939 			{ 0x19, 0x99a3092f }, /* int-mic */
11940 			{ 0x1b, 0x0121401f }, /* HP out */
11941 			{ }
11942 		},
11943 		.chained = true,
11944 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11945 	},
11946 	[ALC662_FIXUP_ASUS_MODE3] = {
11947 		.type = HDA_FIXUP_PINS,
11948 		.v.pins = (const struct hda_pintbl[]) {
11949 			{ 0x14, 0x99130110 }, /* speaker */
11950 			{ 0x15, 0x0121441f }, /* HP */
11951 			{ 0x18, 0x01a19840 }, /* mic */
11952 			{ 0x19, 0x99a3094f }, /* int-mic */
11953 			{ 0x21, 0x01211420 }, /* HP2 */
11954 			{ }
11955 		},
11956 		.chained = true,
11957 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11958 	},
11959 	[ALC662_FIXUP_ASUS_MODE4] = {
11960 		.type = HDA_FIXUP_PINS,
11961 		.v.pins = (const struct hda_pintbl[]) {
11962 			{ 0x14, 0x99130110 }, /* speaker */
11963 			{ 0x16, 0x99130111 }, /* speaker */
11964 			{ 0x18, 0x01a19840 }, /* mic */
11965 			{ 0x19, 0x99a3094f }, /* int-mic */
11966 			{ 0x21, 0x0121441f }, /* HP */
11967 			{ }
11968 		},
11969 		.chained = true,
11970 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11971 	},
11972 	[ALC662_FIXUP_ASUS_MODE5] = {
11973 		.type = HDA_FIXUP_PINS,
11974 		.v.pins = (const struct hda_pintbl[]) {
11975 			{ 0x14, 0x99130110 }, /* speaker */
11976 			{ 0x15, 0x0121441f }, /* HP */
11977 			{ 0x16, 0x99130111 }, /* speaker */
11978 			{ 0x18, 0x01a19840 }, /* mic */
11979 			{ 0x19, 0x99a3094f }, /* int-mic */
11980 			{ }
11981 		},
11982 		.chained = true,
11983 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11984 	},
11985 	[ALC662_FIXUP_ASUS_MODE6] = {
11986 		.type = HDA_FIXUP_PINS,
11987 		.v.pins = (const struct hda_pintbl[]) {
11988 			{ 0x14, 0x99130110 }, /* speaker */
11989 			{ 0x15, 0x01211420 }, /* HP2 */
11990 			{ 0x18, 0x01a19840 }, /* mic */
11991 			{ 0x19, 0x99a3094f }, /* int-mic */
11992 			{ 0x1b, 0x0121441f }, /* HP */
11993 			{ }
11994 		},
11995 		.chained = true,
11996 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11997 	},
11998 	[ALC662_FIXUP_ASUS_MODE7] = {
11999 		.type = HDA_FIXUP_PINS,
12000 		.v.pins = (const struct hda_pintbl[]) {
12001 			{ 0x14, 0x99130110 }, /* speaker */
12002 			{ 0x17, 0x99130111 }, /* speaker */
12003 			{ 0x18, 0x01a19840 }, /* mic */
12004 			{ 0x19, 0x99a3094f }, /* int-mic */
12005 			{ 0x1b, 0x01214020 }, /* HP */
12006 			{ 0x21, 0x0121401f }, /* HP */
12007 			{ }
12008 		},
12009 		.chained = true,
12010 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12011 	},
12012 	[ALC662_FIXUP_ASUS_MODE8] = {
12013 		.type = HDA_FIXUP_PINS,
12014 		.v.pins = (const struct hda_pintbl[]) {
12015 			{ 0x14, 0x99130110 }, /* speaker */
12016 			{ 0x12, 0x99a30970 }, /* int-mic */
12017 			{ 0x15, 0x01214020 }, /* HP */
12018 			{ 0x17, 0x99130111 }, /* speaker */
12019 			{ 0x18, 0x01a19840 }, /* mic */
12020 			{ 0x21, 0x0121401f }, /* HP */
12021 			{ }
12022 		},
12023 		.chained = true,
12024 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12025 	},
12026 	[ALC662_FIXUP_NO_JACK_DETECT] = {
12027 		.type = HDA_FIXUP_FUNC,
12028 		.v.func = alc_fixup_no_jack_detect,
12029 	},
12030 	[ALC662_FIXUP_ZOTAC_Z68] = {
12031 		.type = HDA_FIXUP_PINS,
12032 		.v.pins = (const struct hda_pintbl[]) {
12033 			{ 0x1b, 0x02214020 }, /* Front HP */
12034 			{ }
12035 		}
12036 	},
12037 	[ALC662_FIXUP_INV_DMIC] = {
12038 		.type = HDA_FIXUP_FUNC,
12039 		.v.func = alc_fixup_inv_dmic,
12040 	},
12041 	[ALC668_FIXUP_DELL_XPS13] = {
12042 		.type = HDA_FIXUP_FUNC,
12043 		.v.func = alc_fixup_dell_xps13,
12044 		.chained = true,
12045 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12046 	},
12047 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12048 		.type = HDA_FIXUP_FUNC,
12049 		.v.func = alc_fixup_disable_aamix,
12050 		.chained = true,
12051 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12052 	},
12053 	[ALC668_FIXUP_AUTO_MUTE] = {
12054 		.type = HDA_FIXUP_FUNC,
12055 		.v.func = alc_fixup_auto_mute_via_amp,
12056 		.chained = true,
12057 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12058 	},
12059 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12060 		.type = HDA_FIXUP_PINS,
12061 		.v.pins = (const struct hda_pintbl[]) {
12062 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12063 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12064 			{ }
12065 		},
12066 		.chained = true,
12067 		.chain_id = ALC662_FIXUP_HEADSET_MODE
12068 	},
12069 	[ALC662_FIXUP_HEADSET_MODE] = {
12070 		.type = HDA_FIXUP_FUNC,
12071 		.v.func = alc_fixup_headset_mode_alc662,
12072 	},
12073 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12074 		.type = HDA_FIXUP_PINS,
12075 		.v.pins = (const struct hda_pintbl[]) {
12076 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12077 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12078 			{ }
12079 		},
12080 		.chained = true,
12081 		.chain_id = ALC668_FIXUP_HEADSET_MODE
12082 	},
12083 	[ALC668_FIXUP_HEADSET_MODE] = {
12084 		.type = HDA_FIXUP_FUNC,
12085 		.v.func = alc_fixup_headset_mode_alc668,
12086 	},
12087 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12088 		.type = HDA_FIXUP_FUNC,
12089 		.v.func = alc_fixup_bass_chmap,
12090 		.chained = true,
12091 		.chain_id = ALC662_FIXUP_ASUS_MODE4
12092 	},
12093 	[ALC662_FIXUP_BASS_16] = {
12094 		.type = HDA_FIXUP_PINS,
12095 		.v.pins = (const struct hda_pintbl[]) {
12096 			{0x16, 0x80106111}, /* bass speaker */
12097 			{}
12098 		},
12099 		.chained = true,
12100 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12101 	},
12102 	[ALC662_FIXUP_BASS_1A] = {
12103 		.type = HDA_FIXUP_PINS,
12104 		.v.pins = (const struct hda_pintbl[]) {
12105 			{0x1a, 0x80106111}, /* bass speaker */
12106 			{}
12107 		},
12108 		.chained = true,
12109 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12110 	},
12111 	[ALC662_FIXUP_BASS_CHMAP] = {
12112 		.type = HDA_FIXUP_FUNC,
12113 		.v.func = alc_fixup_bass_chmap,
12114 	},
12115 	[ALC662_FIXUP_ASUS_Nx50] = {
12116 		.type = HDA_FIXUP_FUNC,
12117 		.v.func = alc_fixup_auto_mute_via_amp,
12118 		.chained = true,
12119 		.chain_id = ALC662_FIXUP_BASS_1A
12120 	},
12121 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12122 		.type = HDA_FIXUP_FUNC,
12123 		.v.func = alc_fixup_headset_mode_alc668,
12124 		.chain_id = ALC662_FIXUP_BASS_CHMAP
12125 	},
12126 	[ALC668_FIXUP_ASUS_Nx51] = {
12127 		.type = HDA_FIXUP_PINS,
12128 		.v.pins = (const struct hda_pintbl[]) {
12129 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12130 			{ 0x1a, 0x90170151 }, /* bass speaker */
12131 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12132 			{}
12133 		},
12134 		.chained = true,
12135 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12136 	},
12137 	[ALC668_FIXUP_MIC_COEF] = {
12138 		.type = HDA_FIXUP_VERBS,
12139 		.v.verbs = (const struct hda_verb[]) {
12140 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12141 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12142 			{}
12143 		},
12144 	},
12145 	[ALC668_FIXUP_ASUS_G751] = {
12146 		.type = HDA_FIXUP_PINS,
12147 		.v.pins = (const struct hda_pintbl[]) {
12148 			{ 0x16, 0x0421101f }, /* HP */
12149 			{}
12150 		},
12151 		.chained = true,
12152 		.chain_id = ALC668_FIXUP_MIC_COEF
12153 	},
12154 	[ALC891_FIXUP_HEADSET_MODE] = {
12155 		.type = HDA_FIXUP_FUNC,
12156 		.v.func = alc_fixup_headset_mode,
12157 	},
12158 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
12159 		.type = HDA_FIXUP_PINS,
12160 		.v.pins = (const struct hda_pintbl[]) {
12161 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12162 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12163 			{ }
12164 		},
12165 		.chained = true,
12166 		.chain_id = ALC891_FIXUP_HEADSET_MODE
12167 	},
12168 	[ALC662_FIXUP_ACER_VERITON] = {
12169 		.type = HDA_FIXUP_PINS,
12170 		.v.pins = (const struct hda_pintbl[]) {
12171 			{ 0x15, 0x50170120 }, /* no internal speaker */
12172 			{ }
12173 		}
12174 	},
12175 	[ALC892_FIXUP_ASROCK_MOBO] = {
12176 		.type = HDA_FIXUP_PINS,
12177 		.v.pins = (const struct hda_pintbl[]) {
12178 			{ 0x15, 0x40f000f0 }, /* disabled */
12179 			{ 0x16, 0x40f000f0 }, /* disabled */
12180 			{ }
12181 		}
12182 	},
12183 	[ALC662_FIXUP_USI_FUNC] = {
12184 		.type = HDA_FIXUP_FUNC,
12185 		.v.func = alc662_fixup_usi_headset_mic,
12186 	},
12187 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
12188 		.type = HDA_FIXUP_PINS,
12189 		.v.pins = (const struct hda_pintbl[]) {
12190 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
12191 			{ 0x18, 0x01a1903d },
12192 			{ }
12193 		},
12194 		.chained = true,
12195 		.chain_id = ALC662_FIXUP_USI_FUNC
12196 	},
12197 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
12198 		.type = HDA_FIXUP_FUNC,
12199 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
12200 	},
12201 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
12202 		.type = HDA_FIXUP_FUNC,
12203 		.v.func = alc662_fixup_aspire_ethos_hp,
12204 	},
12205 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
12206 		.type = HDA_FIXUP_PINS,
12207 		.v.pins = (const struct hda_pintbl[]) {
12208 			{ 0x15, 0x92130110 }, /* front speakers */
12209 			{ 0x18, 0x99130111 }, /* center/subwoofer */
12210 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
12211 			{ }
12212 		},
12213 		.chained = true,
12214 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
12215 	},
12216 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
12217 		.type = HDA_FIXUP_FUNC,
12218 		.v.func = alc671_fixup_hp_headset_mic2,
12219 	},
12220 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
12221 		.type = HDA_FIXUP_PINS,
12222 		.v.pins = (const struct hda_pintbl[]) {
12223 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
12224 			{ }
12225 		},
12226 		.chained = true,
12227 		.chain_id = ALC662_FIXUP_USI_FUNC
12228 	},
12229 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
12230 		.type = HDA_FIXUP_PINS,
12231 		.v.pins = (const struct hda_pintbl[]) {
12232 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12233 			{ 0x1b, 0x0221144f },
12234 			{ }
12235 		},
12236 		.chained = true,
12237 		.chain_id = ALC662_FIXUP_USI_FUNC
12238 	},
12239 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
12240 		.type = HDA_FIXUP_PINS,
12241 		.v.pins = (const struct hda_pintbl[]) {
12242 			{ 0x1b, 0x04a1112c },
12243 			{ }
12244 		},
12245 		.chained = true,
12246 		.chain_id = ALC668_FIXUP_HEADSET_MIC
12247 	},
12248 	[ALC668_FIXUP_HEADSET_MIC] = {
12249 		.type = HDA_FIXUP_FUNC,
12250 		.v.func = alc269_fixup_headset_mic,
12251 		.chained = true,
12252 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
12253 	},
12254 	[ALC668_FIXUP_MIC_DET_COEF] = {
12255 		.type = HDA_FIXUP_VERBS,
12256 		.v.verbs = (const struct hda_verb[]) {
12257 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
12258 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
12259 			{}
12260 		},
12261 	},
12262 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
12263 		.type = HDA_FIXUP_FUNC,
12264 		.v.func = alc897_fixup_lenovo_headset_mic,
12265 	},
12266 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
12267 		.type = HDA_FIXUP_PINS,
12268 		.v.pins = (const struct hda_pintbl[]) {
12269 			{ 0x1a, 0x03a11050 },
12270 			{ }
12271 		},
12272 		.chained = true,
12273 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
12274 	},
12275 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
12276 		.type = HDA_FIXUP_PINS,
12277 		.v.pins = (const struct hda_pintbl[]) {
12278 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
12279 			{ }
12280 		},
12281 	},
12282 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
12283 		.type = HDA_FIXUP_FUNC,
12284 		.v.func = alc897_fixup_lenovo_headset_mode,
12285 	},
12286 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
12287 		.type = HDA_FIXUP_PINS,
12288 		.v.pins = (const struct hda_pintbl[]) {
12289 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12290 			{ }
12291 		},
12292 		.chained = true,
12293 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
12294 	},
12295 	[ALC897_FIXUP_UNIS_H3C_X500S] = {
12296 		.type = HDA_FIXUP_VERBS,
12297 		.v.verbs = (const struct hda_verb[]) {
12298 			{ 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
12299 			{}
12300 		},
12301 	},
12302 	[ALC897_FIXUP_HEADSET_MIC_PIN3] = {
12303 		.type = HDA_FIXUP_PINS,
12304 		.v.pins = (const struct hda_pintbl[]) {
12305 			{ 0x19, 0x03a11050 }, /* use as headset mic */
12306 			{ }
12307 		},
12308 	},
12309 };
12310 
12311 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
12312 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
12313 	SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
12314 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
12315 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
12316 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
12317 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
12318 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
12319 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
12320 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
12321 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
12322 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
12323 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
12324 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12325 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12326 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
12327 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
12328 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
12329 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12330 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12331 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12332 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12333 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12334 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
12335 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12336 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12337 	SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12338 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
12339 	SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
12340 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
12341 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
12342 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
12343 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
12344 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
12345 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
12346 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
12347 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12348 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
12349 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
12350 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
12351 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
12352 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
12353 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
12354 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12355 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
12356 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
12357 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
12358 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
12359 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
12360 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
12361 	SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
12362 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
12363 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
12364 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
12365 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
12366 	SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12367 	SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12368 	SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
12369 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
12370 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
12371 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
12372 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
12373 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
12374 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
12375 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
12376 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
12377 	SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
12378 
12379 #if 0
12380 	/* Below is a quirk table taken from the old code.
12381 	 * Basically the device should work as is without the fixup table.
12382 	 * If BIOS doesn't give a proper info, enable the corresponding
12383 	 * fixup entry.
12384 	 */
12385 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
12386 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
12387 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
12388 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
12389 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12390 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12391 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12392 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
12393 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
12394 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12395 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
12396 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
12397 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
12398 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
12399 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
12400 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12401 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
12402 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
12403 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12404 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12405 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12406 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12407 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
12408 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
12409 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
12410 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12411 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
12412 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12413 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12414 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
12415 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12416 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12417 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
12418 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
12419 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
12420 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
12421 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
12422 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
12423 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
12424 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12425 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
12426 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
12427 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12428 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
12429 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
12430 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
12431 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
12432 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
12433 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12434 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
12435 #endif
12436 	{}
12437 };
12438 
12439 static const struct hda_model_fixup alc662_fixup_models[] = {
12440 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
12441 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
12442 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
12443 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
12444 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
12445 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
12446 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
12447 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
12448 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
12449 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
12450 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
12451 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
12452 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
12453 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
12454 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
12455 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
12456 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
12457 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
12458 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
12459 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
12460 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
12461 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
12462 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
12463 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
12464 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
12465 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
12466 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
12467 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
12468 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
12469 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
12470 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
12471 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
12472 	{.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
12473 	{}
12474 };
12475 
12476 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
12477 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12478 		{0x17, 0x02211010},
12479 		{0x18, 0x01a19030},
12480 		{0x1a, 0x01813040},
12481 		{0x21, 0x01014020}),
12482 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12483 		{0x16, 0x01813030},
12484 		{0x17, 0x02211010},
12485 		{0x18, 0x01a19040},
12486 		{0x21, 0x01014020}),
12487 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12488 		{0x14, 0x01014010},
12489 		{0x18, 0x01a19020},
12490 		{0x1a, 0x0181302f},
12491 		{0x1b, 0x0221401f}),
12492 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12493 		{0x12, 0x99a30130},
12494 		{0x14, 0x90170110},
12495 		{0x15, 0x0321101f},
12496 		{0x16, 0x03011020}),
12497 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12498 		{0x12, 0x99a30140},
12499 		{0x14, 0x90170110},
12500 		{0x15, 0x0321101f},
12501 		{0x16, 0x03011020}),
12502 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12503 		{0x12, 0x99a30150},
12504 		{0x14, 0x90170110},
12505 		{0x15, 0x0321101f},
12506 		{0x16, 0x03011020}),
12507 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12508 		{0x14, 0x90170110},
12509 		{0x15, 0x0321101f},
12510 		{0x16, 0x03011020}),
12511 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
12512 		{0x12, 0x90a60130},
12513 		{0x14, 0x90170110},
12514 		{0x15, 0x0321101f}),
12515 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12516 		{0x14, 0x01014010},
12517 		{0x17, 0x90170150},
12518 		{0x19, 0x02a11060},
12519 		{0x1b, 0x01813030},
12520 		{0x21, 0x02211020}),
12521 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12522 		{0x14, 0x01014010},
12523 		{0x18, 0x01a19040},
12524 		{0x1b, 0x01813030},
12525 		{0x21, 0x02211020}),
12526 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12527 		{0x14, 0x01014020},
12528 		{0x17, 0x90170110},
12529 		{0x18, 0x01a19050},
12530 		{0x1b, 0x01813040},
12531 		{0x21, 0x02211030}),
12532 	{}
12533 };
12534 
12535 /*
12536  */
patch_alc662(struct hda_codec * codec)12537 static int patch_alc662(struct hda_codec *codec)
12538 {
12539 	struct alc_spec *spec;
12540 	int err;
12541 
12542 	err = alc_alloc_spec(codec, 0x0b);
12543 	if (err < 0)
12544 		return err;
12545 
12546 	spec = codec->spec;
12547 
12548 	spec->shutup = alc_eapd_shutup;
12549 
12550 	/* handle multiple HPs as is */
12551 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
12552 
12553 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
12554 
12555 	switch (codec->core.vendor_id) {
12556 	case 0x10ec0668:
12557 		spec->init_hook = alc668_restore_default_value;
12558 		break;
12559 	}
12560 
12561 	alc_pre_init(codec);
12562 
12563 	snd_hda_pick_fixup(codec, alc662_fixup_models,
12564 		       alc662_fixup_tbl, alc662_fixups);
12565 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
12566 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12567 
12568 	alc_auto_parse_customize_define(codec);
12569 
12570 	if (has_cdefine_beep(codec))
12571 		spec->gen.beep_nid = 0x01;
12572 
12573 	if ((alc_get_coef0(codec) & (1 << 14)) &&
12574 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
12575 	    spec->cdefine.platform_type == 1) {
12576 		err = alc_codec_rename(codec, "ALC272X");
12577 		if (err < 0)
12578 			goto error;
12579 	}
12580 
12581 	/* automatic parse from the BIOS config */
12582 	err = alc662_parse_auto_config(codec);
12583 	if (err < 0)
12584 		goto error;
12585 
12586 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
12587 		switch (codec->core.vendor_id) {
12588 		case 0x10ec0662:
12589 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12590 			break;
12591 		case 0x10ec0272:
12592 		case 0x10ec0663:
12593 		case 0x10ec0665:
12594 		case 0x10ec0668:
12595 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12596 			break;
12597 		case 0x10ec0273:
12598 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
12599 			break;
12600 		}
12601 		if (err < 0)
12602 			goto error;
12603 	}
12604 
12605 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12606 
12607 	return 0;
12608 
12609  error:
12610 	alc_free(codec);
12611 	return err;
12612 }
12613 
12614 /*
12615  * ALC680 support
12616  */
12617 
alc680_parse_auto_config(struct hda_codec * codec)12618 static int alc680_parse_auto_config(struct hda_codec *codec)
12619 {
12620 	return alc_parse_auto_config(codec, NULL, NULL);
12621 }
12622 
12623 /*
12624  */
patch_alc680(struct hda_codec * codec)12625 static int patch_alc680(struct hda_codec *codec)
12626 {
12627 	int err;
12628 
12629 	/* ALC680 has no aa-loopback mixer */
12630 	err = alc_alloc_spec(codec, 0);
12631 	if (err < 0)
12632 		return err;
12633 
12634 	/* automatic parse from the BIOS config */
12635 	err = alc680_parse_auto_config(codec);
12636 	if (err < 0) {
12637 		alc_free(codec);
12638 		return err;
12639 	}
12640 
12641 	return 0;
12642 }
12643 
12644 /*
12645  * patch entries
12646  */
12647 static const struct hda_device_id snd_hda_id_realtek[] = {
12648 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
12649 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
12650 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
12651 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
12652 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
12653 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
12654 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
12655 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
12656 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
12657 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
12658 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
12659 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
12660 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
12661 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
12662 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
12663 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
12664 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
12665 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
12666 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
12667 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
12668 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
12669 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
12670 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
12671 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
12672 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
12673 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
12674 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
12675 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
12676 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
12677 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
12678 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
12679 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
12680 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
12681 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
12682 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
12683 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
12684 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
12685 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
12686 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
12687 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
12688 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
12689 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
12690 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
12691 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
12692 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
12693 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
12694 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
12695 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
12696 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
12697 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
12698 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
12699 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
12700 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
12701 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
12702 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
12703 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
12704 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
12705 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
12706 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
12707 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
12708 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
12709 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
12710 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
12711 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
12712 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
12713 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
12714 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
12715 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
12716 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
12717 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
12718 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
12719 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
12720 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
12721 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
12722 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
12723 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
12724 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
12725 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
12726 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
12727 	{} /* terminator */
12728 };
12729 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
12730 
12731 MODULE_LICENSE("GPL");
12732 MODULE_DESCRIPTION("Realtek HD-audio codec");
12733 
12734 static struct hda_codec_driver realtek_driver = {
12735 	.id = snd_hda_id_realtek,
12736 };
12737 
12738 module_hda_codec_driver(realtek_driver);
12739