1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Universal Interface for Intel High Definition Audio Codec
4  *
5  * HD audio interface patch for Realtek ALC codecs
6  *
7  * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8  *                    PeiSen Hou <pshou@realtek.com.tw>
9  *                    Takashi Iwai <tiwai@suse.de>
10  *                    Jonathan Woithe <jwoithe@just42.net>
11  */
12 
13 #include <linux/acpi.h>
14 #include <linux/cleanup.h>
15 #include <linux/init.h>
16 #include <linux/delay.h>
17 #include <linux/slab.h>
18 #include <linux/pci.h>
19 #include <linux/dmi.h>
20 #include <linux/module.h>
21 #include <linux/i2c.h>
22 #include <linux/input.h>
23 #include <linux/leds.h>
24 #include <linux/ctype.h>
25 #include <linux/spi/spi.h>
26 #include <sound/core.h>
27 #include <sound/jack.h>
28 #include <sound/hda_codec.h>
29 #include "hda_local.h"
30 #include "hda_auto_parser.h"
31 #include "hda_beep.h"
32 #include "hda_jack.h"
33 #include "hda_generic.h"
34 #include "hda_component.h"
35 
36 /* keep halting ALC5505 DSP, for power saving */
37 #define HALT_REALTEK_ALC5505
38 
39 /* extra amp-initialization sequence types */
40 enum {
41 	ALC_INIT_UNDEFINED,
42 	ALC_INIT_NONE,
43 	ALC_INIT_DEFAULT,
44 };
45 
46 enum {
47 	ALC_HEADSET_MODE_UNKNOWN,
48 	ALC_HEADSET_MODE_UNPLUGGED,
49 	ALC_HEADSET_MODE_HEADSET,
50 	ALC_HEADSET_MODE_MIC,
51 	ALC_HEADSET_MODE_HEADPHONE,
52 };
53 
54 enum {
55 	ALC_HEADSET_TYPE_UNKNOWN,
56 	ALC_HEADSET_TYPE_CTIA,
57 	ALC_HEADSET_TYPE_OMTP,
58 };
59 
60 enum {
61 	ALC_KEY_MICMUTE_INDEX,
62 };
63 
64 struct alc_customize_define {
65 	unsigned int  sku_cfg;
66 	unsigned char port_connectivity;
67 	unsigned char check_sum;
68 	unsigned char customization;
69 	unsigned char external_amp;
70 	unsigned int  enable_pcbeep:1;
71 	unsigned int  platform_type:1;
72 	unsigned int  swap:1;
73 	unsigned int  override:1;
74 	unsigned int  fixup:1; /* Means that this sku is set by driver, not read from hw */
75 };
76 
77 struct alc_coef_led {
78 	unsigned int idx;
79 	unsigned int mask;
80 	unsigned int on;
81 	unsigned int off;
82 };
83 
84 struct alc_spec {
85 	struct hda_gen_spec gen; /* must be at head */
86 
87 	/* codec parameterization */
88 	struct alc_customize_define cdefine;
89 	unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
90 
91 	/* GPIO bits */
92 	unsigned int gpio_mask;
93 	unsigned int gpio_dir;
94 	unsigned int gpio_data;
95 	bool gpio_write_delay;	/* add a delay before writing gpio_data */
96 
97 	/* mute LED for HP laptops, see vref_mute_led_set() */
98 	int mute_led_polarity;
99 	int micmute_led_polarity;
100 	hda_nid_t mute_led_nid;
101 	hda_nid_t cap_mute_led_nid;
102 
103 	unsigned int gpio_mute_led_mask;
104 	unsigned int gpio_mic_led_mask;
105 	struct alc_coef_led mute_led_coef;
106 	struct alc_coef_led mic_led_coef;
107 	struct mutex coef_mutex;
108 
109 	hda_nid_t headset_mic_pin;
110 	hda_nid_t headphone_mic_pin;
111 	int current_headset_mode;
112 	int current_headset_type;
113 
114 	/* hooks */
115 	void (*init_hook)(struct hda_codec *codec);
116 	void (*power_hook)(struct hda_codec *codec);
117 	void (*shutup)(struct hda_codec *codec);
118 
119 	int init_amp;
120 	int codec_variant;	/* flag for other variants */
121 	unsigned int has_alc5505_dsp:1;
122 	unsigned int no_depop_delay:1;
123 	unsigned int done_hp_init:1;
124 	unsigned int no_shutup_pins:1;
125 	unsigned int ultra_low_power:1;
126 	unsigned int has_hs_key:1;
127 	unsigned int no_internal_mic_pin:1;
128 	unsigned int en_3kpull_low:1;
129 	int num_speaker_amps;
130 
131 	/* for PLL fix */
132 	hda_nid_t pll_nid;
133 	unsigned int pll_coef_idx, pll_coef_bit;
134 	unsigned int coef0;
135 	struct input_dev *kb_dev;
136 	u8 alc_mute_keycode_map[1];
137 
138 	/* component binding */
139 	struct hda_component_parent comps;
140 };
141 
142 /*
143  * COEF access helper functions
144  */
145 
coef_mutex_lock(struct hda_codec * codec)146 static void coef_mutex_lock(struct hda_codec *codec)
147 {
148 	struct alc_spec *spec = codec->spec;
149 
150 	snd_hda_power_up_pm(codec);
151 	mutex_lock(&spec->coef_mutex);
152 }
153 
coef_mutex_unlock(struct hda_codec * codec)154 static void coef_mutex_unlock(struct hda_codec *codec)
155 {
156 	struct alc_spec *spec = codec->spec;
157 
158 	mutex_unlock(&spec->coef_mutex);
159 	snd_hda_power_down_pm(codec);
160 }
161 
__alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)162 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
163 				 unsigned int coef_idx)
164 {
165 	unsigned int val;
166 
167 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
168 	val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
169 	return val;
170 }
171 
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)172 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
173 			       unsigned int coef_idx)
174 {
175 	unsigned int val;
176 
177 	coef_mutex_lock(codec);
178 	val = __alc_read_coefex_idx(codec, nid, coef_idx);
179 	coef_mutex_unlock(codec);
180 	return val;
181 }
182 
183 #define alc_read_coef_idx(codec, coef_idx) \
184 	alc_read_coefex_idx(codec, 0x20, coef_idx)
185 
__alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)186 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
187 				   unsigned int coef_idx, unsigned int coef_val)
188 {
189 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
190 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
191 }
192 
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)193 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
194 				 unsigned int coef_idx, unsigned int coef_val)
195 {
196 	coef_mutex_lock(codec);
197 	__alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
198 	coef_mutex_unlock(codec);
199 }
200 
201 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
202 	alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
203 
__alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)204 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
205 				    unsigned int coef_idx, unsigned int mask,
206 				    unsigned int bits_set)
207 {
208 	unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
209 
210 	if (val != -1)
211 		__alc_write_coefex_idx(codec, nid, coef_idx,
212 				       (val & ~mask) | bits_set);
213 }
214 
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)215 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
216 				  unsigned int coef_idx, unsigned int mask,
217 				  unsigned int bits_set)
218 {
219 	coef_mutex_lock(codec);
220 	__alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
221 	coef_mutex_unlock(codec);
222 }
223 
224 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set)	\
225 	alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
226 
227 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)228 static unsigned int alc_get_coef0(struct hda_codec *codec)
229 {
230 	struct alc_spec *spec = codec->spec;
231 
232 	if (!spec->coef0)
233 		spec->coef0 = alc_read_coef_idx(codec, 0);
234 	return spec->coef0;
235 }
236 
237 /* coef writes/updates batch */
238 struct coef_fw {
239 	unsigned char nid;
240 	unsigned char idx;
241 	unsigned short mask;
242 	unsigned short val;
243 };
244 
245 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
246 	{ .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
247 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
248 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
249 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
250 
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)251 static void alc_process_coef_fw(struct hda_codec *codec,
252 				const struct coef_fw *fw)
253 {
254 	coef_mutex_lock(codec);
255 	for (; fw->nid; fw++) {
256 		if (fw->mask == (unsigned short)-1)
257 			__alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
258 		else
259 			__alc_update_coefex_idx(codec, fw->nid, fw->idx,
260 						fw->mask, fw->val);
261 	}
262 	coef_mutex_unlock(codec);
263 }
264 
265 /*
266  * GPIO setup tables, used in initialization
267  */
268 
269 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)270 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
271 {
272 	struct alc_spec *spec = codec->spec;
273 
274 	spec->gpio_mask |= mask;
275 	spec->gpio_dir |= mask;
276 	spec->gpio_data |= mask;
277 }
278 
alc_write_gpio_data(struct hda_codec * codec)279 static void alc_write_gpio_data(struct hda_codec *codec)
280 {
281 	struct alc_spec *spec = codec->spec;
282 
283 	snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
284 			    spec->gpio_data);
285 }
286 
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)287 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
288 				 bool on)
289 {
290 	struct alc_spec *spec = codec->spec;
291 	unsigned int oldval = spec->gpio_data;
292 
293 	if (on)
294 		spec->gpio_data |= mask;
295 	else
296 		spec->gpio_data &= ~mask;
297 	if (oldval != spec->gpio_data)
298 		alc_write_gpio_data(codec);
299 }
300 
alc_write_gpio(struct hda_codec * codec)301 static void alc_write_gpio(struct hda_codec *codec)
302 {
303 	struct alc_spec *spec = codec->spec;
304 
305 	if (!spec->gpio_mask)
306 		return;
307 
308 	snd_hda_codec_write(codec, codec->core.afg, 0,
309 			    AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
310 	snd_hda_codec_write(codec, codec->core.afg, 0,
311 			    AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
312 	if (spec->gpio_write_delay)
313 		msleep(1);
314 	alc_write_gpio_data(codec);
315 }
316 
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)317 static void alc_fixup_gpio(struct hda_codec *codec, int action,
318 			   unsigned int mask)
319 {
320 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
321 		alc_setup_gpio(codec, mask);
322 }
323 
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)324 static void alc_fixup_gpio1(struct hda_codec *codec,
325 			    const struct hda_fixup *fix, int action)
326 {
327 	alc_fixup_gpio(codec, action, 0x01);
328 }
329 
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)330 static void alc_fixup_gpio2(struct hda_codec *codec,
331 			    const struct hda_fixup *fix, int action)
332 {
333 	alc_fixup_gpio(codec, action, 0x02);
334 }
335 
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)336 static void alc_fixup_gpio3(struct hda_codec *codec,
337 			    const struct hda_fixup *fix, int action)
338 {
339 	alc_fixup_gpio(codec, action, 0x03);
340 }
341 
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)342 static void alc_fixup_gpio4(struct hda_codec *codec,
343 			    const struct hda_fixup *fix, int action)
344 {
345 	alc_fixup_gpio(codec, action, 0x04);
346 }
347 
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)348 static void alc_fixup_micmute_led(struct hda_codec *codec,
349 				  const struct hda_fixup *fix, int action)
350 {
351 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
352 		snd_hda_gen_add_micmute_led_cdev(codec, NULL);
353 }
354 
355 /*
356  * Fix hardware PLL issue
357  * On some codecs, the analog PLL gating control must be off while
358  * the default value is 1.
359  */
alc_fix_pll(struct hda_codec * codec)360 static void alc_fix_pll(struct hda_codec *codec)
361 {
362 	struct alc_spec *spec = codec->spec;
363 
364 	if (spec->pll_nid)
365 		alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
366 				      1 << spec->pll_coef_bit, 0);
367 }
368 
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)369 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
370 			     unsigned int coef_idx, unsigned int coef_bit)
371 {
372 	struct alc_spec *spec = codec->spec;
373 	spec->pll_nid = nid;
374 	spec->pll_coef_idx = coef_idx;
375 	spec->pll_coef_bit = coef_bit;
376 	alc_fix_pll(codec);
377 }
378 
379 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)380 static void alc_update_knob_master(struct hda_codec *codec,
381 				   struct hda_jack_callback *jack)
382 {
383 	unsigned int val;
384 	struct snd_kcontrol *kctl;
385 	struct snd_ctl_elem_value *uctl;
386 
387 	kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
388 	if (!kctl)
389 		return;
390 	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
391 	if (!uctl)
392 		return;
393 	val = snd_hda_codec_read(codec, jack->nid, 0,
394 				 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
395 	val &= HDA_AMP_VOLMASK;
396 	uctl->value.integer.value[0] = val;
397 	uctl->value.integer.value[1] = val;
398 	kctl->put(kctl, uctl);
399 	kfree(uctl);
400 }
401 
alc880_unsol_event(struct hda_codec * codec,unsigned int res)402 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
403 {
404 	/* For some reason, the res given from ALC880 is broken.
405 	   Here we adjust it properly. */
406 	snd_hda_jack_unsol_event(codec, res >> 2);
407 }
408 
409 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)410 static void alc_fill_eapd_coef(struct hda_codec *codec)
411 {
412 	int coef;
413 
414 	coef = alc_get_coef0(codec);
415 
416 	switch (codec->core.vendor_id) {
417 	case 0x10ec0262:
418 		alc_update_coef_idx(codec, 0x7, 0, 1<<5);
419 		break;
420 	case 0x10ec0267:
421 	case 0x10ec0268:
422 		alc_update_coef_idx(codec, 0x7, 0, 1<<13);
423 		break;
424 	case 0x10ec0269:
425 		if ((coef & 0x00f0) == 0x0010)
426 			alc_update_coef_idx(codec, 0xd, 0, 1<<14);
427 		if ((coef & 0x00f0) == 0x0020)
428 			alc_update_coef_idx(codec, 0x4, 1<<15, 0);
429 		if ((coef & 0x00f0) == 0x0030)
430 			alc_update_coef_idx(codec, 0x10, 1<<9, 0);
431 		break;
432 	case 0x10ec0280:
433 	case 0x10ec0284:
434 	case 0x10ec0290:
435 	case 0x10ec0292:
436 		alc_update_coef_idx(codec, 0x4, 1<<15, 0);
437 		break;
438 	case 0x10ec0225:
439 	case 0x10ec0295:
440 	case 0x10ec0299:
441 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
442 		fallthrough;
443 	case 0x10ec0215:
444 	case 0x10ec0236:
445 	case 0x10ec0245:
446 	case 0x10ec0256:
447 	case 0x10ec0257:
448 	case 0x10ec0285:
449 	case 0x10ec0289:
450 		alc_update_coef_idx(codec, 0x36, 1<<13, 0);
451 		fallthrough;
452 	case 0x10ec0230:
453 	case 0x10ec0233:
454 	case 0x10ec0235:
455 	case 0x10ec0255:
456 	case 0x19e58326:
457 	case 0x10ec0282:
458 	case 0x10ec0283:
459 	case 0x10ec0286:
460 	case 0x10ec0288:
461 	case 0x10ec0298:
462 	case 0x10ec0300:
463 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
464 		break;
465 	case 0x10ec0275:
466 		alc_update_coef_idx(codec, 0xe, 0, 1<<0);
467 		break;
468 	case 0x10ec0287:
469 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
470 		alc_write_coef_idx(codec, 0x8, 0x4ab7);
471 		break;
472 	case 0x10ec0293:
473 		alc_update_coef_idx(codec, 0xa, 1<<13, 0);
474 		break;
475 	case 0x10ec0234:
476 	case 0x10ec0274:
477 		alc_write_coef_idx(codec, 0x6e, 0x0c25);
478 		fallthrough;
479 	case 0x10ec0294:
480 	case 0x10ec0700:
481 	case 0x10ec0701:
482 	case 0x10ec0703:
483 	case 0x10ec0711:
484 		alc_update_coef_idx(codec, 0x10, 1<<15, 0);
485 		break;
486 	case 0x10ec0662:
487 		if ((coef & 0x00f0) == 0x0030)
488 			alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
489 		break;
490 	case 0x10ec0272:
491 	case 0x10ec0273:
492 	case 0x10ec0663:
493 	case 0x10ec0665:
494 	case 0x10ec0670:
495 	case 0x10ec0671:
496 	case 0x10ec0672:
497 		alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
498 		break;
499 	case 0x10ec0222:
500 	case 0x10ec0623:
501 		alc_update_coef_idx(codec, 0x19, 1<<13, 0);
502 		break;
503 	case 0x10ec0668:
504 		alc_update_coef_idx(codec, 0x7, 3<<13, 0);
505 		break;
506 	case 0x10ec0867:
507 		alc_update_coef_idx(codec, 0x4, 1<<10, 0);
508 		break;
509 	case 0x10ec0888:
510 		if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
511 			alc_update_coef_idx(codec, 0x7, 1<<5, 0);
512 		break;
513 	case 0x10ec0892:
514 	case 0x10ec0897:
515 		alc_update_coef_idx(codec, 0x7, 1<<5, 0);
516 		break;
517 	case 0x10ec0899:
518 	case 0x10ec0900:
519 	case 0x10ec0b00:
520 	case 0x10ec1168:
521 	case 0x10ec1220:
522 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
523 		break;
524 	}
525 }
526 
527 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)528 static void alc888_coef_init(struct hda_codec *codec)
529 {
530 	switch (alc_get_coef0(codec) & 0x00f0) {
531 	/* alc888-VA */
532 	case 0x00:
533 	/* alc888-VB */
534 	case 0x10:
535 		alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
536 		break;
537 	}
538 }
539 
540 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)541 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
542 {
543 	if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
544 		return;
545 	if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
546 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
547 				    on ? 2 : 0);
548 }
549 
550 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)551 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
552 {
553 	/* We currently only handle front, HP */
554 	static const hda_nid_t pins[] = {
555 		0x0f, 0x10, 0x14, 0x15, 0x17, 0
556 	};
557 	const hda_nid_t *p;
558 	for (p = pins; *p; p++)
559 		set_eapd(codec, *p, on);
560 }
561 
562 static int find_ext_mic_pin(struct hda_codec *codec);
563 
alc_headset_mic_no_shutup(struct hda_codec * codec)564 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
565 {
566 	const struct hda_pincfg *pin;
567 	int mic_pin = find_ext_mic_pin(codec);
568 	int i;
569 
570 	/* don't shut up pins when unloading the driver; otherwise it breaks
571 	 * the default pin setup at the next load of the driver
572 	 */
573 	if (codec->bus->shutdown)
574 		return;
575 
576 	snd_array_for_each(&codec->init_pins, i, pin) {
577 		/* use read here for syncing after issuing each verb */
578 		if (pin->nid != mic_pin)
579 			snd_hda_codec_read(codec, pin->nid, 0,
580 					AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
581 	}
582 
583 	codec->pins_shutup = 1;
584 }
585 
alc_shutup_pins(struct hda_codec * codec)586 static void alc_shutup_pins(struct hda_codec *codec)
587 {
588 	struct alc_spec *spec = codec->spec;
589 
590 	if (spec->no_shutup_pins)
591 		return;
592 
593 	switch (codec->core.vendor_id) {
594 	case 0x10ec0236:
595 	case 0x10ec0256:
596 	case 0x10ec0257:
597 	case 0x19e58326:
598 	case 0x10ec0283:
599 	case 0x10ec0285:
600 	case 0x10ec0286:
601 	case 0x10ec0287:
602 	case 0x10ec0288:
603 	case 0x10ec0295:
604 	case 0x10ec0298:
605 		alc_headset_mic_no_shutup(codec);
606 		break;
607 	default:
608 		snd_hda_shutup_pins(codec);
609 		break;
610 	}
611 }
612 
613 /* generic shutup callback;
614  * just turning off EAPD and a little pause for avoiding pop-noise
615  */
alc_eapd_shutup(struct hda_codec * codec)616 static void alc_eapd_shutup(struct hda_codec *codec)
617 {
618 	struct alc_spec *spec = codec->spec;
619 
620 	alc_auto_setup_eapd(codec, false);
621 	if (!spec->no_depop_delay)
622 		msleep(200);
623 	alc_shutup_pins(codec);
624 }
625 
626 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)627 static void alc_auto_init_amp(struct hda_codec *codec, int type)
628 {
629 	alc_auto_setup_eapd(codec, true);
630 	alc_write_gpio(codec);
631 	switch (type) {
632 	case ALC_INIT_DEFAULT:
633 		switch (codec->core.vendor_id) {
634 		case 0x10ec0260:
635 			alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
636 			break;
637 		case 0x10ec0880:
638 		case 0x10ec0882:
639 		case 0x10ec0883:
640 		case 0x10ec0885:
641 			alc_update_coef_idx(codec, 7, 0, 0x2030);
642 			break;
643 		case 0x10ec0888:
644 			alc888_coef_init(codec);
645 			break;
646 		}
647 		break;
648 	}
649 }
650 
651 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)652 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
653 {
654 	if (spec->gen.autocfg.hp_pins[0])
655 		return spec->gen.autocfg.hp_pins[0];
656 	if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
657 		return spec->gen.autocfg.line_out_pins[0];
658 	return 0;
659 }
660 
661 /*
662  * Realtek SSID verification
663  */
664 
665 /* Could be any non-zero and even value. When used as fixup, tells
666  * the driver to ignore any present sku defines.
667  */
668 #define ALC_FIXUP_SKU_IGNORE (2)
669 
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)670 static void alc_fixup_sku_ignore(struct hda_codec *codec,
671 				 const struct hda_fixup *fix, int action)
672 {
673 	struct alc_spec *spec = codec->spec;
674 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
675 		spec->cdefine.fixup = 1;
676 		spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
677 	}
678 }
679 
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)680 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
681 				    const struct hda_fixup *fix, int action)
682 {
683 	struct alc_spec *spec = codec->spec;
684 
685 	if (action == HDA_FIXUP_ACT_PROBE) {
686 		spec->no_depop_delay = 1;
687 		codec->depop_delay = 0;
688 	}
689 }
690 
alc_auto_parse_customize_define(struct hda_codec * codec)691 static int alc_auto_parse_customize_define(struct hda_codec *codec)
692 {
693 	unsigned int ass, tmp, i;
694 	unsigned nid = 0;
695 	struct alc_spec *spec = codec->spec;
696 
697 	spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
698 
699 	if (spec->cdefine.fixup) {
700 		ass = spec->cdefine.sku_cfg;
701 		if (ass == ALC_FIXUP_SKU_IGNORE)
702 			return -1;
703 		goto do_sku;
704 	}
705 
706 	if (!codec->bus->pci)
707 		return -1;
708 	ass = codec->core.subsystem_id & 0xffff;
709 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
710 		goto do_sku;
711 
712 	nid = 0x1d;
713 	if (codec->core.vendor_id == 0x10ec0260)
714 		nid = 0x17;
715 	ass = snd_hda_codec_get_pincfg(codec, nid);
716 
717 	if (!(ass & 1)) {
718 		codec_info(codec, "%s: SKU not ready 0x%08x\n",
719 			   codec->core.chip_name, ass);
720 		return -1;
721 	}
722 
723 	/* check sum */
724 	tmp = 0;
725 	for (i = 1; i < 16; i++) {
726 		if ((ass >> i) & 1)
727 			tmp++;
728 	}
729 	if (((ass >> 16) & 0xf) != tmp)
730 		return -1;
731 
732 	spec->cdefine.port_connectivity = ass >> 30;
733 	spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
734 	spec->cdefine.check_sum = (ass >> 16) & 0xf;
735 	spec->cdefine.customization = ass >> 8;
736 do_sku:
737 	spec->cdefine.sku_cfg = ass;
738 	spec->cdefine.external_amp = (ass & 0x38) >> 3;
739 	spec->cdefine.platform_type = (ass & 0x4) >> 2;
740 	spec->cdefine.swap = (ass & 0x2) >> 1;
741 	spec->cdefine.override = ass & 0x1;
742 
743 	codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
744 		   nid, spec->cdefine.sku_cfg);
745 	codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
746 		   spec->cdefine.port_connectivity);
747 	codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
748 	codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
749 	codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
750 	codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
751 	codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
752 	codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
753 	codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
754 
755 	return 0;
756 }
757 
758 /* 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)759 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
760 {
761 	int i;
762 	for (i = 0; i < nums; i++)
763 		if (list[i] == nid)
764 			return i;
765 	return -1;
766 }
767 /* 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)768 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
769 {
770 	return find_idx_in_nid_list(nid, list, nums) >= 0;
771 }
772 
773 /* check subsystem ID and set up device-specific initialization;
774  * return 1 if initialized, 0 if invalid SSID
775  */
776 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
777  *	31 ~ 16 :	Manufacture ID
778  *	15 ~ 8	:	SKU ID
779  *	7  ~ 0	:	Assembly ID
780  *	port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
781  */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)782 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
783 {
784 	unsigned int ass, tmp, i;
785 	unsigned nid;
786 	struct alc_spec *spec = codec->spec;
787 
788 	if (spec->cdefine.fixup) {
789 		ass = spec->cdefine.sku_cfg;
790 		if (ass == ALC_FIXUP_SKU_IGNORE)
791 			return 0;
792 		goto do_sku;
793 	}
794 
795 	ass = codec->core.subsystem_id & 0xffff;
796 	if (codec->bus->pci &&
797 	    ass != codec->bus->pci->subsystem_device && (ass & 1))
798 		goto do_sku;
799 
800 	/* invalid SSID, check the special NID pin defcfg instead */
801 	/*
802 	 * 31~30	: port connectivity
803 	 * 29~21	: reserve
804 	 * 20		: PCBEEP input
805 	 * 19~16	: Check sum (15:1)
806 	 * 15~1		: Custom
807 	 * 0		: override
808 	*/
809 	nid = 0x1d;
810 	if (codec->core.vendor_id == 0x10ec0260)
811 		nid = 0x17;
812 	ass = snd_hda_codec_get_pincfg(codec, nid);
813 	codec_dbg(codec,
814 		  "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
815 		   ass, nid);
816 	if (!(ass & 1))
817 		return 0;
818 	if ((ass >> 30) != 1)	/* no physical connection */
819 		return 0;
820 
821 	/* check sum */
822 	tmp = 0;
823 	for (i = 1; i < 16; i++) {
824 		if ((ass >> i) & 1)
825 			tmp++;
826 	}
827 	if (((ass >> 16) & 0xf) != tmp)
828 		return 0;
829 do_sku:
830 	codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
831 		   ass & 0xffff, codec->core.vendor_id);
832 	/*
833 	 * 0 : override
834 	 * 1 :	Swap Jack
835 	 * 2 : 0 --> Desktop, 1 --> Laptop
836 	 * 3~5 : External Amplifier control
837 	 * 7~6 : Reserved
838 	*/
839 	tmp = (ass & 0x38) >> 3;	/* external Amp control */
840 	if (spec->init_amp == ALC_INIT_UNDEFINED) {
841 		switch (tmp) {
842 		case 1:
843 			alc_setup_gpio(codec, 0x01);
844 			break;
845 		case 3:
846 			alc_setup_gpio(codec, 0x02);
847 			break;
848 		case 7:
849 			alc_setup_gpio(codec, 0x04);
850 			break;
851 		case 5:
852 		default:
853 			spec->init_amp = ALC_INIT_DEFAULT;
854 			break;
855 		}
856 	}
857 
858 	/* is laptop or Desktop and enable the function "Mute internal speaker
859 	 * when the external headphone out jack is plugged"
860 	 */
861 	if (!(ass & 0x8000))
862 		return 1;
863 	/*
864 	 * 10~8 : Jack location
865 	 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
866 	 * 14~13: Resvered
867 	 * 15   : 1 --> enable the function "Mute internal speaker
868 	 *	        when the external headphone out jack is plugged"
869 	 */
870 	if (!alc_get_hp_pin(spec)) {
871 		hda_nid_t nid;
872 		tmp = (ass >> 11) & 0x3;	/* HP to chassis */
873 		nid = ports[tmp];
874 		if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
875 				      spec->gen.autocfg.line_outs))
876 			return 1;
877 		spec->gen.autocfg.hp_pins[0] = nid;
878 	}
879 	return 1;
880 }
881 
882 /* Check the validity of ALC subsystem-id
883  * 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)884 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
885 {
886 	if (!alc_subsystem_id(codec, ports)) {
887 		struct alc_spec *spec = codec->spec;
888 		if (spec->init_amp == ALC_INIT_UNDEFINED) {
889 			codec_dbg(codec,
890 				  "realtek: Enable default setup for auto mode as fallback\n");
891 			spec->init_amp = ALC_INIT_DEFAULT;
892 		}
893 	}
894 }
895 
896 /* inverted digital-mic */
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)897 static void alc_fixup_inv_dmic(struct hda_codec *codec,
898 			       const struct hda_fixup *fix, int action)
899 {
900 	struct alc_spec *spec = codec->spec;
901 
902 	spec->gen.inv_dmic_split = 1;
903 }
904 
905 
alc_build_controls(struct hda_codec * codec)906 static int alc_build_controls(struct hda_codec *codec)
907 {
908 	int err;
909 
910 	err = snd_hda_gen_build_controls(codec);
911 	if (err < 0)
912 		return err;
913 
914 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
915 	return 0;
916 }
917 
918 
919 /*
920  * Common callbacks
921  */
922 
alc_pre_init(struct hda_codec * codec)923 static void alc_pre_init(struct hda_codec *codec)
924 {
925 	alc_fill_eapd_coef(codec);
926 }
927 
928 #define is_s3_resume(codec) \
929 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
930 #define is_s4_resume(codec) \
931 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
932 #define is_s4_suspend(codec) \
933 	((codec)->core.dev.power.power_state.event == PM_EVENT_FREEZE)
934 
alc_init(struct hda_codec * codec)935 static int alc_init(struct hda_codec *codec)
936 {
937 	struct alc_spec *spec = codec->spec;
938 
939 	/* hibernation resume needs the full chip initialization */
940 	if (is_s4_resume(codec))
941 		alc_pre_init(codec);
942 
943 	if (spec->init_hook)
944 		spec->init_hook(codec);
945 
946 	spec->gen.skip_verbs = 1; /* applied in below */
947 	snd_hda_gen_init(codec);
948 	alc_fix_pll(codec);
949 	alc_auto_init_amp(codec, spec->init_amp);
950 	snd_hda_apply_verbs(codec); /* apply verbs here after own init */
951 
952 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
953 
954 	return 0;
955 }
956 
957 /* forward declaration */
958 static const struct component_master_ops comp_master_ops;
959 
alc_free(struct hda_codec * codec)960 static void alc_free(struct hda_codec *codec)
961 {
962 	struct alc_spec *spec = codec->spec;
963 
964 	if (spec)
965 		hda_component_manager_free(&spec->comps, &comp_master_ops);
966 
967 	snd_hda_gen_free(codec);
968 }
969 
alc_shutup(struct hda_codec * codec)970 static inline void alc_shutup(struct hda_codec *codec)
971 {
972 	struct alc_spec *spec = codec->spec;
973 
974 	if (!snd_hda_get_bool_hint(codec, "shutup"))
975 		return; /* disabled explicitly by hints */
976 
977 	if (spec && spec->shutup)
978 		spec->shutup(codec);
979 	else
980 		alc_shutup_pins(codec);
981 }
982 
alc_power_eapd(struct hda_codec * codec)983 static void alc_power_eapd(struct hda_codec *codec)
984 {
985 	alc_auto_setup_eapd(codec, false);
986 }
987 
alc_suspend(struct hda_codec * codec)988 static int alc_suspend(struct hda_codec *codec)
989 {
990 	struct alc_spec *spec = codec->spec;
991 	alc_shutup(codec);
992 	if (spec && spec->power_hook)
993 		spec->power_hook(codec);
994 	return 0;
995 }
996 
alc_resume(struct hda_codec * codec)997 static int alc_resume(struct hda_codec *codec)
998 {
999 	struct alc_spec *spec = codec->spec;
1000 
1001 	if (!spec->no_depop_delay)
1002 		msleep(150); /* to avoid pop noise */
1003 	codec->patch_ops.init(codec);
1004 	snd_hda_regmap_sync(codec);
1005 	hda_call_check_power_status(codec, 0x01);
1006 	return 0;
1007 }
1008 
1009 /*
1010  */
1011 static const struct hda_codec_ops alc_patch_ops = {
1012 	.build_controls = alc_build_controls,
1013 	.build_pcms = snd_hda_gen_build_pcms,
1014 	.init = alc_init,
1015 	.free = alc_free,
1016 	.unsol_event = snd_hda_jack_unsol_event,
1017 	.resume = alc_resume,
1018 	.suspend = alc_suspend,
1019 	.check_power_status = snd_hda_gen_check_power_status,
1020 };
1021 
1022 
1023 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1024 
1025 /*
1026  * Rename codecs appropriately from COEF value or subvendor id
1027  */
1028 struct alc_codec_rename_table {
1029 	unsigned int vendor_id;
1030 	unsigned short coef_mask;
1031 	unsigned short coef_bits;
1032 	const char *name;
1033 };
1034 
1035 struct alc_codec_rename_pci_table {
1036 	unsigned int codec_vendor_id;
1037 	unsigned short pci_subvendor;
1038 	unsigned short pci_subdevice;
1039 	const char *name;
1040 };
1041 
1042 static const struct alc_codec_rename_table rename_tbl[] = {
1043 	{ 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1044 	{ 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1045 	{ 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1046 	{ 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1047 	{ 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1048 	{ 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1049 	{ 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1050 	{ 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1051 	{ 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1052 	{ 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1053 	{ 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1054 	{ 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1055 	{ 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1056 	{ 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1057 	{ 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1058 	{ 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1059 	{ 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1060 	{ } /* terminator */
1061 };
1062 
1063 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1064 	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
1065 	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
1066 	{ 0x10ec0283, 0x1028, 0, "ALC3223" },
1067 	{ 0x10ec0288, 0x1028, 0, "ALC3263" },
1068 	{ 0x10ec0292, 0x1028, 0, "ALC3226" },
1069 	{ 0x10ec0293, 0x1028, 0, "ALC3235" },
1070 	{ 0x10ec0255, 0x1028, 0, "ALC3234" },
1071 	{ 0x10ec0668, 0x1028, 0, "ALC3661" },
1072 	{ 0x10ec0275, 0x1028, 0, "ALC3260" },
1073 	{ 0x10ec0899, 0x1028, 0, "ALC3861" },
1074 	{ 0x10ec0298, 0x1028, 0, "ALC3266" },
1075 	{ 0x10ec0236, 0x1028, 0, "ALC3204" },
1076 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
1077 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
1078 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
1079 	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
1080 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
1081 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
1082 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
1083 	{ 0x10ec0233, 0x1043, 0, "ALC3236" },
1084 	{ 0x10ec0280, 0x103c, 0, "ALC3228" },
1085 	{ 0x10ec0282, 0x103c, 0, "ALC3227" },
1086 	{ 0x10ec0286, 0x103c, 0, "ALC3242" },
1087 	{ 0x10ec0290, 0x103c, 0, "ALC3241" },
1088 	{ 0x10ec0668, 0x103c, 0, "ALC3662" },
1089 	{ 0x10ec0283, 0x17aa, 0, "ALC3239" },
1090 	{ 0x10ec0292, 0x17aa, 0, "ALC3232" },
1091 	{ } /* terminator */
1092 };
1093 
alc_codec_rename_from_preset(struct hda_codec * codec)1094 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1095 {
1096 	const struct alc_codec_rename_table *p;
1097 	const struct alc_codec_rename_pci_table *q;
1098 
1099 	for (p = rename_tbl; p->vendor_id; p++) {
1100 		if (p->vendor_id != codec->core.vendor_id)
1101 			continue;
1102 		if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1103 			return alc_codec_rename(codec, p->name);
1104 	}
1105 
1106 	if (!codec->bus->pci)
1107 		return 0;
1108 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1109 		if (q->codec_vendor_id != codec->core.vendor_id)
1110 			continue;
1111 		if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1112 			continue;
1113 		if (!q->pci_subdevice ||
1114 		    q->pci_subdevice == codec->bus->pci->subsystem_device)
1115 			return alc_codec_rename(codec, q->name);
1116 	}
1117 
1118 	return 0;
1119 }
1120 
1121 
1122 /*
1123  * Digital-beep handlers
1124  */
1125 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1126 
1127 /* additional beep mixers; private_value will be overwritten */
1128 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1129 	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1130 	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1131 };
1132 
1133 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1134 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1135 			int idx, int dir)
1136 {
1137 	struct snd_kcontrol_new *knew;
1138 	unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1139 	int i;
1140 
1141 	for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1142 		knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1143 					    &alc_beep_mixer[i]);
1144 		if (!knew)
1145 			return -ENOMEM;
1146 		knew->private_value = beep_amp;
1147 	}
1148 	return 0;
1149 }
1150 
1151 static const struct snd_pci_quirk beep_allow_list[] = {
1152 	SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1153 	SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1154 	SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1155 	SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1156 	SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1157 	SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1158 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1159 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1160 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1161 	/* denylist -- no beep available */
1162 	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1163 	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1164 	{}
1165 };
1166 
has_cdefine_beep(struct hda_codec * codec)1167 static inline int has_cdefine_beep(struct hda_codec *codec)
1168 {
1169 	struct alc_spec *spec = codec->spec;
1170 	const struct snd_pci_quirk *q;
1171 	q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1172 	if (q)
1173 		return q->value;
1174 	return spec->cdefine.enable_pcbeep;
1175 }
1176 #else
1177 #define set_beep_amp(spec, nid, idx, dir)	0
1178 #define has_cdefine_beep(codec)		0
1179 #endif
1180 
1181 /* parse the BIOS configuration and set up the alc_spec */
1182 /* return 1 if successful, 0 if the proper config is not found,
1183  * or a negative error code
1184  */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1185 static int alc_parse_auto_config(struct hda_codec *codec,
1186 				 const hda_nid_t *ignore_nids,
1187 				 const hda_nid_t *ssid_nids)
1188 {
1189 	struct alc_spec *spec = codec->spec;
1190 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1191 	int err;
1192 
1193 	err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1194 				       spec->parse_flags);
1195 	if (err < 0)
1196 		return err;
1197 
1198 	if (ssid_nids)
1199 		alc_ssid_check(codec, ssid_nids);
1200 
1201 	err = snd_hda_gen_parse_auto_config(codec, cfg);
1202 	if (err < 0)
1203 		return err;
1204 
1205 	return 1;
1206 }
1207 
1208 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1209 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1210 {
1211 	struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1212 	int err;
1213 
1214 	if (!spec)
1215 		return -ENOMEM;
1216 	codec->spec = spec;
1217 	snd_hda_gen_spec_init(&spec->gen);
1218 	spec->gen.mixer_nid = mixer_nid;
1219 	spec->gen.own_eapd_ctl = 1;
1220 	codec->single_adc_amp = 1;
1221 	/* FIXME: do we need this for all Realtek codec models? */
1222 	codec->spdif_status_reset = 1;
1223 	codec->forced_resume = 1;
1224 	codec->patch_ops = alc_patch_ops;
1225 	mutex_init(&spec->coef_mutex);
1226 
1227 	err = alc_codec_rename_from_preset(codec);
1228 	if (err < 0) {
1229 		kfree(spec);
1230 		return err;
1231 	}
1232 	return 0;
1233 }
1234 
alc880_parse_auto_config(struct hda_codec * codec)1235 static int alc880_parse_auto_config(struct hda_codec *codec)
1236 {
1237 	static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1238 	static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1239 	return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1240 }
1241 
1242 /*
1243  * ALC880 fix-ups
1244  */
1245 enum {
1246 	ALC880_FIXUP_GPIO1,
1247 	ALC880_FIXUP_GPIO2,
1248 	ALC880_FIXUP_MEDION_RIM,
1249 	ALC880_FIXUP_LG,
1250 	ALC880_FIXUP_LG_LW25,
1251 	ALC880_FIXUP_W810,
1252 	ALC880_FIXUP_EAPD_COEF,
1253 	ALC880_FIXUP_TCL_S700,
1254 	ALC880_FIXUP_VOL_KNOB,
1255 	ALC880_FIXUP_FUJITSU,
1256 	ALC880_FIXUP_F1734,
1257 	ALC880_FIXUP_UNIWILL,
1258 	ALC880_FIXUP_UNIWILL_DIG,
1259 	ALC880_FIXUP_Z71V,
1260 	ALC880_FIXUP_ASUS_W5A,
1261 	ALC880_FIXUP_3ST_BASE,
1262 	ALC880_FIXUP_3ST,
1263 	ALC880_FIXUP_3ST_DIG,
1264 	ALC880_FIXUP_5ST_BASE,
1265 	ALC880_FIXUP_5ST,
1266 	ALC880_FIXUP_5ST_DIG,
1267 	ALC880_FIXUP_6ST_BASE,
1268 	ALC880_FIXUP_6ST,
1269 	ALC880_FIXUP_6ST_DIG,
1270 	ALC880_FIXUP_6ST_AUTOMUTE,
1271 };
1272 
1273 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1274 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1275 				  const struct hda_fixup *fix, int action)
1276 {
1277 	if (action == HDA_FIXUP_ACT_PROBE)
1278 		snd_hda_jack_detect_enable_callback(codec, 0x21,
1279 						    alc_update_knob_master);
1280 }
1281 
1282 static const struct hda_fixup alc880_fixups[] = {
1283 	[ALC880_FIXUP_GPIO1] = {
1284 		.type = HDA_FIXUP_FUNC,
1285 		.v.func = alc_fixup_gpio1,
1286 	},
1287 	[ALC880_FIXUP_GPIO2] = {
1288 		.type = HDA_FIXUP_FUNC,
1289 		.v.func = alc_fixup_gpio2,
1290 	},
1291 	[ALC880_FIXUP_MEDION_RIM] = {
1292 		.type = HDA_FIXUP_VERBS,
1293 		.v.verbs = (const struct hda_verb[]) {
1294 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1295 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1296 			{ }
1297 		},
1298 		.chained = true,
1299 		.chain_id = ALC880_FIXUP_GPIO2,
1300 	},
1301 	[ALC880_FIXUP_LG] = {
1302 		.type = HDA_FIXUP_PINS,
1303 		.v.pins = (const struct hda_pintbl[]) {
1304 			/* disable bogus unused pins */
1305 			{ 0x16, 0x411111f0 },
1306 			{ 0x18, 0x411111f0 },
1307 			{ 0x1a, 0x411111f0 },
1308 			{ }
1309 		}
1310 	},
1311 	[ALC880_FIXUP_LG_LW25] = {
1312 		.type = HDA_FIXUP_PINS,
1313 		.v.pins = (const struct hda_pintbl[]) {
1314 			{ 0x1a, 0x0181344f }, /* line-in */
1315 			{ 0x1b, 0x0321403f }, /* headphone */
1316 			{ }
1317 		}
1318 	},
1319 	[ALC880_FIXUP_W810] = {
1320 		.type = HDA_FIXUP_PINS,
1321 		.v.pins = (const struct hda_pintbl[]) {
1322 			/* disable bogus unused pins */
1323 			{ 0x17, 0x411111f0 },
1324 			{ }
1325 		},
1326 		.chained = true,
1327 		.chain_id = ALC880_FIXUP_GPIO2,
1328 	},
1329 	[ALC880_FIXUP_EAPD_COEF] = {
1330 		.type = HDA_FIXUP_VERBS,
1331 		.v.verbs = (const struct hda_verb[]) {
1332 			/* change to EAPD mode */
1333 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1334 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1335 			{}
1336 		},
1337 	},
1338 	[ALC880_FIXUP_TCL_S700] = {
1339 		.type = HDA_FIXUP_VERBS,
1340 		.v.verbs = (const struct hda_verb[]) {
1341 			/* change to EAPD mode */
1342 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1343 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3070 },
1344 			{}
1345 		},
1346 		.chained = true,
1347 		.chain_id = ALC880_FIXUP_GPIO2,
1348 	},
1349 	[ALC880_FIXUP_VOL_KNOB] = {
1350 		.type = HDA_FIXUP_FUNC,
1351 		.v.func = alc880_fixup_vol_knob,
1352 	},
1353 	[ALC880_FIXUP_FUJITSU] = {
1354 		/* override all pins as BIOS on old Amilo is broken */
1355 		.type = HDA_FIXUP_PINS,
1356 		.v.pins = (const struct hda_pintbl[]) {
1357 			{ 0x14, 0x0121401f }, /* HP */
1358 			{ 0x15, 0x99030120 }, /* speaker */
1359 			{ 0x16, 0x99030130 }, /* bass speaker */
1360 			{ 0x17, 0x411111f0 }, /* N/A */
1361 			{ 0x18, 0x411111f0 }, /* N/A */
1362 			{ 0x19, 0x01a19950 }, /* mic-in */
1363 			{ 0x1a, 0x411111f0 }, /* N/A */
1364 			{ 0x1b, 0x411111f0 }, /* N/A */
1365 			{ 0x1c, 0x411111f0 }, /* N/A */
1366 			{ 0x1d, 0x411111f0 }, /* N/A */
1367 			{ 0x1e, 0x01454140 }, /* SPDIF out */
1368 			{ }
1369 		},
1370 		.chained = true,
1371 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1372 	},
1373 	[ALC880_FIXUP_F1734] = {
1374 		/* almost compatible with FUJITSU, but no bass and SPDIF */
1375 		.type = HDA_FIXUP_PINS,
1376 		.v.pins = (const struct hda_pintbl[]) {
1377 			{ 0x14, 0x0121401f }, /* HP */
1378 			{ 0x15, 0x99030120 }, /* speaker */
1379 			{ 0x16, 0x411111f0 }, /* N/A */
1380 			{ 0x17, 0x411111f0 }, /* N/A */
1381 			{ 0x18, 0x411111f0 }, /* N/A */
1382 			{ 0x19, 0x01a19950 }, /* mic-in */
1383 			{ 0x1a, 0x411111f0 }, /* N/A */
1384 			{ 0x1b, 0x411111f0 }, /* N/A */
1385 			{ 0x1c, 0x411111f0 }, /* N/A */
1386 			{ 0x1d, 0x411111f0 }, /* N/A */
1387 			{ 0x1e, 0x411111f0 }, /* N/A */
1388 			{ }
1389 		},
1390 		.chained = true,
1391 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1392 	},
1393 	[ALC880_FIXUP_UNIWILL] = {
1394 		/* need to fix HP and speaker pins to be parsed correctly */
1395 		.type = HDA_FIXUP_PINS,
1396 		.v.pins = (const struct hda_pintbl[]) {
1397 			{ 0x14, 0x0121411f }, /* HP */
1398 			{ 0x15, 0x99030120 }, /* speaker */
1399 			{ 0x16, 0x99030130 }, /* bass speaker */
1400 			{ }
1401 		},
1402 	},
1403 	[ALC880_FIXUP_UNIWILL_DIG] = {
1404 		.type = HDA_FIXUP_PINS,
1405 		.v.pins = (const struct hda_pintbl[]) {
1406 			/* disable bogus unused pins */
1407 			{ 0x17, 0x411111f0 },
1408 			{ 0x19, 0x411111f0 },
1409 			{ 0x1b, 0x411111f0 },
1410 			{ 0x1f, 0x411111f0 },
1411 			{ }
1412 		}
1413 	},
1414 	[ALC880_FIXUP_Z71V] = {
1415 		.type = HDA_FIXUP_PINS,
1416 		.v.pins = (const struct hda_pintbl[]) {
1417 			/* set up the whole pins as BIOS is utterly broken */
1418 			{ 0x14, 0x99030120 }, /* speaker */
1419 			{ 0x15, 0x0121411f }, /* HP */
1420 			{ 0x16, 0x411111f0 }, /* N/A */
1421 			{ 0x17, 0x411111f0 }, /* N/A */
1422 			{ 0x18, 0x01a19950 }, /* mic-in */
1423 			{ 0x19, 0x411111f0 }, /* N/A */
1424 			{ 0x1a, 0x01813031 }, /* line-in */
1425 			{ 0x1b, 0x411111f0 }, /* N/A */
1426 			{ 0x1c, 0x411111f0 }, /* N/A */
1427 			{ 0x1d, 0x411111f0 }, /* N/A */
1428 			{ 0x1e, 0x0144111e }, /* SPDIF */
1429 			{ }
1430 		}
1431 	},
1432 	[ALC880_FIXUP_ASUS_W5A] = {
1433 		.type = HDA_FIXUP_PINS,
1434 		.v.pins = (const struct hda_pintbl[]) {
1435 			/* set up the whole pins as BIOS is utterly broken */
1436 			{ 0x14, 0x0121411f }, /* HP */
1437 			{ 0x15, 0x411111f0 }, /* N/A */
1438 			{ 0x16, 0x411111f0 }, /* N/A */
1439 			{ 0x17, 0x411111f0 }, /* N/A */
1440 			{ 0x18, 0x90a60160 }, /* mic */
1441 			{ 0x19, 0x411111f0 }, /* N/A */
1442 			{ 0x1a, 0x411111f0 }, /* N/A */
1443 			{ 0x1b, 0x411111f0 }, /* N/A */
1444 			{ 0x1c, 0x411111f0 }, /* N/A */
1445 			{ 0x1d, 0x411111f0 }, /* N/A */
1446 			{ 0x1e, 0xb743111e }, /* SPDIF out */
1447 			{ }
1448 		},
1449 		.chained = true,
1450 		.chain_id = ALC880_FIXUP_GPIO1,
1451 	},
1452 	[ALC880_FIXUP_3ST_BASE] = {
1453 		.type = HDA_FIXUP_PINS,
1454 		.v.pins = (const struct hda_pintbl[]) {
1455 			{ 0x14, 0x01014010 }, /* line-out */
1456 			{ 0x15, 0x411111f0 }, /* N/A */
1457 			{ 0x16, 0x411111f0 }, /* N/A */
1458 			{ 0x17, 0x411111f0 }, /* N/A */
1459 			{ 0x18, 0x01a19c30 }, /* mic-in */
1460 			{ 0x19, 0x0121411f }, /* HP */
1461 			{ 0x1a, 0x01813031 }, /* line-in */
1462 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1463 			{ 0x1c, 0x411111f0 }, /* N/A */
1464 			{ 0x1d, 0x411111f0 }, /* N/A */
1465 			/* 0x1e is filled in below */
1466 			{ 0x1f, 0x411111f0 }, /* N/A */
1467 			{ }
1468 		}
1469 	},
1470 	[ALC880_FIXUP_3ST] = {
1471 		.type = HDA_FIXUP_PINS,
1472 		.v.pins = (const struct hda_pintbl[]) {
1473 			{ 0x1e, 0x411111f0 }, /* N/A */
1474 			{ }
1475 		},
1476 		.chained = true,
1477 		.chain_id = ALC880_FIXUP_3ST_BASE,
1478 	},
1479 	[ALC880_FIXUP_3ST_DIG] = {
1480 		.type = HDA_FIXUP_PINS,
1481 		.v.pins = (const struct hda_pintbl[]) {
1482 			{ 0x1e, 0x0144111e }, /* SPDIF */
1483 			{ }
1484 		},
1485 		.chained = true,
1486 		.chain_id = ALC880_FIXUP_3ST_BASE,
1487 	},
1488 	[ALC880_FIXUP_5ST_BASE] = {
1489 		.type = HDA_FIXUP_PINS,
1490 		.v.pins = (const struct hda_pintbl[]) {
1491 			{ 0x14, 0x01014010 }, /* front */
1492 			{ 0x15, 0x411111f0 }, /* N/A */
1493 			{ 0x16, 0x01011411 }, /* CLFE */
1494 			{ 0x17, 0x01016412 }, /* surr */
1495 			{ 0x18, 0x01a19c30 }, /* mic-in */
1496 			{ 0x19, 0x0121411f }, /* HP */
1497 			{ 0x1a, 0x01813031 }, /* line-in */
1498 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1499 			{ 0x1c, 0x411111f0 }, /* N/A */
1500 			{ 0x1d, 0x411111f0 }, /* N/A */
1501 			/* 0x1e is filled in below */
1502 			{ 0x1f, 0x411111f0 }, /* N/A */
1503 			{ }
1504 		}
1505 	},
1506 	[ALC880_FIXUP_5ST] = {
1507 		.type = HDA_FIXUP_PINS,
1508 		.v.pins = (const struct hda_pintbl[]) {
1509 			{ 0x1e, 0x411111f0 }, /* N/A */
1510 			{ }
1511 		},
1512 		.chained = true,
1513 		.chain_id = ALC880_FIXUP_5ST_BASE,
1514 	},
1515 	[ALC880_FIXUP_5ST_DIG] = {
1516 		.type = HDA_FIXUP_PINS,
1517 		.v.pins = (const struct hda_pintbl[]) {
1518 			{ 0x1e, 0x0144111e }, /* SPDIF */
1519 			{ }
1520 		},
1521 		.chained = true,
1522 		.chain_id = ALC880_FIXUP_5ST_BASE,
1523 	},
1524 	[ALC880_FIXUP_6ST_BASE] = {
1525 		.type = HDA_FIXUP_PINS,
1526 		.v.pins = (const struct hda_pintbl[]) {
1527 			{ 0x14, 0x01014010 }, /* front */
1528 			{ 0x15, 0x01016412 }, /* surr */
1529 			{ 0x16, 0x01011411 }, /* CLFE */
1530 			{ 0x17, 0x01012414 }, /* side */
1531 			{ 0x18, 0x01a19c30 }, /* mic-in */
1532 			{ 0x19, 0x02a19c40 }, /* front-mic */
1533 			{ 0x1a, 0x01813031 }, /* line-in */
1534 			{ 0x1b, 0x0121411f }, /* HP */
1535 			{ 0x1c, 0x411111f0 }, /* N/A */
1536 			{ 0x1d, 0x411111f0 }, /* N/A */
1537 			/* 0x1e is filled in below */
1538 			{ 0x1f, 0x411111f0 }, /* N/A */
1539 			{ }
1540 		}
1541 	},
1542 	[ALC880_FIXUP_6ST] = {
1543 		.type = HDA_FIXUP_PINS,
1544 		.v.pins = (const struct hda_pintbl[]) {
1545 			{ 0x1e, 0x411111f0 }, /* N/A */
1546 			{ }
1547 		},
1548 		.chained = true,
1549 		.chain_id = ALC880_FIXUP_6ST_BASE,
1550 	},
1551 	[ALC880_FIXUP_6ST_DIG] = {
1552 		.type = HDA_FIXUP_PINS,
1553 		.v.pins = (const struct hda_pintbl[]) {
1554 			{ 0x1e, 0x0144111e }, /* SPDIF */
1555 			{ }
1556 		},
1557 		.chained = true,
1558 		.chain_id = ALC880_FIXUP_6ST_BASE,
1559 	},
1560 	[ALC880_FIXUP_6ST_AUTOMUTE] = {
1561 		.type = HDA_FIXUP_PINS,
1562 		.v.pins = (const struct hda_pintbl[]) {
1563 			{ 0x1b, 0x0121401f }, /* HP with jack detect */
1564 			{ }
1565 		},
1566 		.chained_before = true,
1567 		.chain_id = ALC880_FIXUP_6ST_BASE,
1568 	},
1569 };
1570 
1571 static const struct hda_quirk alc880_fixup_tbl[] = {
1572 	SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1573 	SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1574 	SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1575 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1576 	SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1577 	SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1578 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1579 	SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1580 	SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1581 	SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1582 	SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1583 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1584 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1585 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1586 	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1587 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1588 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1589 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1590 	SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1591 	SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1592 	SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1593 	SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1594 	SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1595 
1596 	/* Below is the copied entries from alc880_quirks.c.
1597 	 * It's not quite sure whether BIOS sets the correct pin-config table
1598 	 * on these machines, thus they are kept to be compatible with
1599 	 * the old static quirks.  Once when it's confirmed to work without
1600 	 * these overrides, it'd be better to remove.
1601 	 */
1602 	SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1603 	SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1604 	SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1605 	SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1606 	SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1607 	SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1608 	SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1609 	SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1610 	SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1611 	SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1612 	SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1613 	SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1614 	SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1615 	SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1616 	SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1617 	SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1618 	SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1619 	SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1620 	SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1621 	SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1622 	SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1623 	SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1624 	SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1625 	SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1626 	SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1627 	SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1628 	SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1629 	SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1630 	SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1631 	SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1632 	SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1633 	SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1634 	SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1635 	/* default Intel */
1636 	SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1637 	SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1638 	SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1639 	{}
1640 };
1641 
1642 static const struct hda_model_fixup alc880_fixup_models[] = {
1643 	{.id = ALC880_FIXUP_3ST, .name = "3stack"},
1644 	{.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1645 	{.id = ALC880_FIXUP_5ST, .name = "5stack"},
1646 	{.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1647 	{.id = ALC880_FIXUP_6ST, .name = "6stack"},
1648 	{.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1649 	{.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1650 	{}
1651 };
1652 
1653 
1654 /*
1655  * OK, here we have finally the patch for ALC880
1656  */
patch_alc880(struct hda_codec * codec)1657 static int patch_alc880(struct hda_codec *codec)
1658 {
1659 	struct alc_spec *spec;
1660 	int err;
1661 
1662 	err = alc_alloc_spec(codec, 0x0b);
1663 	if (err < 0)
1664 		return err;
1665 
1666 	spec = codec->spec;
1667 	spec->gen.need_dac_fix = 1;
1668 	spec->gen.beep_nid = 0x01;
1669 
1670 	codec->patch_ops.unsol_event = alc880_unsol_event;
1671 
1672 	alc_pre_init(codec);
1673 
1674 	snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1675 		       alc880_fixups);
1676 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1677 
1678 	/* automatic parse from the BIOS config */
1679 	err = alc880_parse_auto_config(codec);
1680 	if (err < 0)
1681 		goto error;
1682 
1683 	if (!spec->gen.no_analog) {
1684 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1685 		if (err < 0)
1686 			goto error;
1687 	}
1688 
1689 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1690 
1691 	return 0;
1692 
1693  error:
1694 	alc_free(codec);
1695 	return err;
1696 }
1697 
1698 
1699 /*
1700  * ALC260 support
1701  */
alc260_parse_auto_config(struct hda_codec * codec)1702 static int alc260_parse_auto_config(struct hda_codec *codec)
1703 {
1704 	static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1705 	static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1706 	return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1707 }
1708 
1709 /*
1710  * Pin config fixes
1711  */
1712 enum {
1713 	ALC260_FIXUP_HP_DC5750,
1714 	ALC260_FIXUP_HP_PIN_0F,
1715 	ALC260_FIXUP_COEF,
1716 	ALC260_FIXUP_GPIO1,
1717 	ALC260_FIXUP_GPIO1_TOGGLE,
1718 	ALC260_FIXUP_REPLACER,
1719 	ALC260_FIXUP_HP_B1900,
1720 	ALC260_FIXUP_KN1,
1721 	ALC260_FIXUP_FSC_S7020,
1722 	ALC260_FIXUP_FSC_S7020_JWSE,
1723 	ALC260_FIXUP_VAIO_PINS,
1724 };
1725 
alc260_gpio1_automute(struct hda_codec * codec)1726 static void alc260_gpio1_automute(struct hda_codec *codec)
1727 {
1728 	struct alc_spec *spec = codec->spec;
1729 
1730 	alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1731 }
1732 
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1733 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1734 				      const struct hda_fixup *fix, int action)
1735 {
1736 	struct alc_spec *spec = codec->spec;
1737 	if (action == HDA_FIXUP_ACT_PROBE) {
1738 		/* although the machine has only one output pin, we need to
1739 		 * toggle GPIO1 according to the jack state
1740 		 */
1741 		spec->gen.automute_hook = alc260_gpio1_automute;
1742 		spec->gen.detect_hp = 1;
1743 		spec->gen.automute_speaker = 1;
1744 		spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1745 		snd_hda_jack_detect_enable_callback(codec, 0x0f,
1746 						    snd_hda_gen_hp_automute);
1747 		alc_setup_gpio(codec, 0x01);
1748 	}
1749 }
1750 
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1751 static void alc260_fixup_kn1(struct hda_codec *codec,
1752 			     const struct hda_fixup *fix, int action)
1753 {
1754 	struct alc_spec *spec = codec->spec;
1755 	static const struct hda_pintbl pincfgs[] = {
1756 		{ 0x0f, 0x02214000 }, /* HP/speaker */
1757 		{ 0x12, 0x90a60160 }, /* int mic */
1758 		{ 0x13, 0x02a19000 }, /* ext mic */
1759 		{ 0x18, 0x01446000 }, /* SPDIF out */
1760 		/* disable bogus I/O pins */
1761 		{ 0x10, 0x411111f0 },
1762 		{ 0x11, 0x411111f0 },
1763 		{ 0x14, 0x411111f0 },
1764 		{ 0x15, 0x411111f0 },
1765 		{ 0x16, 0x411111f0 },
1766 		{ 0x17, 0x411111f0 },
1767 		{ 0x19, 0x411111f0 },
1768 		{ }
1769 	};
1770 
1771 	switch (action) {
1772 	case HDA_FIXUP_ACT_PRE_PROBE:
1773 		snd_hda_apply_pincfgs(codec, pincfgs);
1774 		spec->init_amp = ALC_INIT_NONE;
1775 		break;
1776 	}
1777 }
1778 
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1779 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1780 				   const struct hda_fixup *fix, int action)
1781 {
1782 	struct alc_spec *spec = codec->spec;
1783 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
1784 		spec->init_amp = ALC_INIT_NONE;
1785 }
1786 
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1787 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1788 				   const struct hda_fixup *fix, int action)
1789 {
1790 	struct alc_spec *spec = codec->spec;
1791 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1792 		spec->gen.add_jack_modes = 1;
1793 		spec->gen.hp_mic = 1;
1794 	}
1795 }
1796 
1797 static const struct hda_fixup alc260_fixups[] = {
1798 	[ALC260_FIXUP_HP_DC5750] = {
1799 		.type = HDA_FIXUP_PINS,
1800 		.v.pins = (const struct hda_pintbl[]) {
1801 			{ 0x11, 0x90130110 }, /* speaker */
1802 			{ }
1803 		}
1804 	},
1805 	[ALC260_FIXUP_HP_PIN_0F] = {
1806 		.type = HDA_FIXUP_PINS,
1807 		.v.pins = (const struct hda_pintbl[]) {
1808 			{ 0x0f, 0x01214000 }, /* HP */
1809 			{ }
1810 		}
1811 	},
1812 	[ALC260_FIXUP_COEF] = {
1813 		.type = HDA_FIXUP_VERBS,
1814 		.v.verbs = (const struct hda_verb[]) {
1815 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1816 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3040 },
1817 			{ }
1818 		},
1819 	},
1820 	[ALC260_FIXUP_GPIO1] = {
1821 		.type = HDA_FIXUP_FUNC,
1822 		.v.func = alc_fixup_gpio1,
1823 	},
1824 	[ALC260_FIXUP_GPIO1_TOGGLE] = {
1825 		.type = HDA_FIXUP_FUNC,
1826 		.v.func = alc260_fixup_gpio1_toggle,
1827 		.chained = true,
1828 		.chain_id = ALC260_FIXUP_HP_PIN_0F,
1829 	},
1830 	[ALC260_FIXUP_REPLACER] = {
1831 		.type = HDA_FIXUP_VERBS,
1832 		.v.verbs = (const struct hda_verb[]) {
1833 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1834 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3050 },
1835 			{ }
1836 		},
1837 		.chained = true,
1838 		.chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1839 	},
1840 	[ALC260_FIXUP_HP_B1900] = {
1841 		.type = HDA_FIXUP_FUNC,
1842 		.v.func = alc260_fixup_gpio1_toggle,
1843 		.chained = true,
1844 		.chain_id = ALC260_FIXUP_COEF,
1845 	},
1846 	[ALC260_FIXUP_KN1] = {
1847 		.type = HDA_FIXUP_FUNC,
1848 		.v.func = alc260_fixup_kn1,
1849 	},
1850 	[ALC260_FIXUP_FSC_S7020] = {
1851 		.type = HDA_FIXUP_FUNC,
1852 		.v.func = alc260_fixup_fsc_s7020,
1853 	},
1854 	[ALC260_FIXUP_FSC_S7020_JWSE] = {
1855 		.type = HDA_FIXUP_FUNC,
1856 		.v.func = alc260_fixup_fsc_s7020_jwse,
1857 		.chained = true,
1858 		.chain_id = ALC260_FIXUP_FSC_S7020,
1859 	},
1860 	[ALC260_FIXUP_VAIO_PINS] = {
1861 		.type = HDA_FIXUP_PINS,
1862 		.v.pins = (const struct hda_pintbl[]) {
1863 			/* Pin configs are missing completely on some VAIOs */
1864 			{ 0x0f, 0x01211020 },
1865 			{ 0x10, 0x0001003f },
1866 			{ 0x11, 0x411111f0 },
1867 			{ 0x12, 0x01a15930 },
1868 			{ 0x13, 0x411111f0 },
1869 			{ 0x14, 0x411111f0 },
1870 			{ 0x15, 0x411111f0 },
1871 			{ 0x16, 0x411111f0 },
1872 			{ 0x17, 0x411111f0 },
1873 			{ 0x18, 0x411111f0 },
1874 			{ 0x19, 0x411111f0 },
1875 			{ }
1876 		}
1877 	},
1878 };
1879 
1880 static const struct hda_quirk alc260_fixup_tbl[] = {
1881 	SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1882 	SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1883 	SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1884 	SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1885 	SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1886 	SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1887 	SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1888 	SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1889 	SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1890 	SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1891 	SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1892 	SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1893 	{}
1894 };
1895 
1896 static const struct hda_model_fixup alc260_fixup_models[] = {
1897 	{.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1898 	{.id = ALC260_FIXUP_COEF, .name = "coef"},
1899 	{.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1900 	{.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1901 	{}
1902 };
1903 
1904 /*
1905  */
patch_alc260(struct hda_codec * codec)1906 static int patch_alc260(struct hda_codec *codec)
1907 {
1908 	struct alc_spec *spec;
1909 	int err;
1910 
1911 	err = alc_alloc_spec(codec, 0x07);
1912 	if (err < 0)
1913 		return err;
1914 
1915 	spec = codec->spec;
1916 	/* as quite a few machines require HP amp for speaker outputs,
1917 	 * it's easier to enable it unconditionally; even if it's unneeded,
1918 	 * it's almost harmless.
1919 	 */
1920 	spec->gen.prefer_hp_amp = 1;
1921 	spec->gen.beep_nid = 0x01;
1922 
1923 	spec->shutup = alc_eapd_shutup;
1924 
1925 	alc_pre_init(codec);
1926 
1927 	snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1928 			   alc260_fixups);
1929 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1930 
1931 	/* automatic parse from the BIOS config */
1932 	err = alc260_parse_auto_config(codec);
1933 	if (err < 0)
1934 		goto error;
1935 
1936 	if (!spec->gen.no_analog) {
1937 		err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1938 		if (err < 0)
1939 			goto error;
1940 	}
1941 
1942 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1943 
1944 	return 0;
1945 
1946  error:
1947 	alc_free(codec);
1948 	return err;
1949 }
1950 
1951 
1952 /*
1953  * ALC882/883/885/888/889 support
1954  *
1955  * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1956  * configuration.  Each pin widget can choose any input DACs and a mixer.
1957  * Each ADC is connected from a mixer of all inputs.  This makes possible
1958  * 6-channel independent captures.
1959  *
1960  * In addition, an independent DAC for the multi-playback (not used in this
1961  * driver yet).
1962  */
1963 
1964 /*
1965  * Pin config fixes
1966  */
1967 enum {
1968 	ALC882_FIXUP_ABIT_AW9D_MAX,
1969 	ALC882_FIXUP_LENOVO_Y530,
1970 	ALC882_FIXUP_PB_M5210,
1971 	ALC882_FIXUP_ACER_ASPIRE_7736,
1972 	ALC882_FIXUP_ASUS_W90V,
1973 	ALC889_FIXUP_CD,
1974 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1975 	ALC889_FIXUP_VAIO_TT,
1976 	ALC888_FIXUP_EEE1601,
1977 	ALC886_FIXUP_EAPD,
1978 	ALC882_FIXUP_EAPD,
1979 	ALC883_FIXUP_EAPD,
1980 	ALC883_FIXUP_ACER_EAPD,
1981 	ALC882_FIXUP_GPIO1,
1982 	ALC882_FIXUP_GPIO2,
1983 	ALC882_FIXUP_GPIO3,
1984 	ALC889_FIXUP_COEF,
1985 	ALC882_FIXUP_ASUS_W2JC,
1986 	ALC882_FIXUP_ACER_ASPIRE_4930G,
1987 	ALC882_FIXUP_ACER_ASPIRE_8930G,
1988 	ALC882_FIXUP_ASPIRE_8930G_VERBS,
1989 	ALC885_FIXUP_MACPRO_GPIO,
1990 	ALC889_FIXUP_DAC_ROUTE,
1991 	ALC889_FIXUP_MBP_VREF,
1992 	ALC889_FIXUP_IMAC91_VREF,
1993 	ALC889_FIXUP_MBA11_VREF,
1994 	ALC889_FIXUP_MBA21_VREF,
1995 	ALC889_FIXUP_MP11_VREF,
1996 	ALC889_FIXUP_MP41_VREF,
1997 	ALC882_FIXUP_INV_DMIC,
1998 	ALC882_FIXUP_NO_PRIMARY_HP,
1999 	ALC887_FIXUP_ASUS_BASS,
2000 	ALC887_FIXUP_BASS_CHMAP,
2001 	ALC1220_FIXUP_GB_DUAL_CODECS,
2002 	ALC1220_FIXUP_GB_X570,
2003 	ALC1220_FIXUP_CLEVO_P950,
2004 	ALC1220_FIXUP_CLEVO_PB51ED,
2005 	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
2006 	ALC887_FIXUP_ASUS_AUDIO,
2007 	ALC887_FIXUP_ASUS_HMIC,
2008 	ALCS1200A_FIXUP_MIC_VREF,
2009 	ALC888VD_FIXUP_MIC_100VREF,
2010 };
2011 
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)2012 static void alc889_fixup_coef(struct hda_codec *codec,
2013 			      const struct hda_fixup *fix, int action)
2014 {
2015 	if (action != HDA_FIXUP_ACT_INIT)
2016 		return;
2017 	alc_update_coef_idx(codec, 7, 0, 0x2030);
2018 }
2019 
2020 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2021 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2022 				     const struct hda_fixup *fix, int action)
2023 {
2024 	struct alc_spec *spec = codec->spec;
2025 
2026 	spec->gpio_write_delay = true;
2027 	alc_fixup_gpio3(codec, fix, action);
2028 }
2029 
2030 /* Fix the connection of some pins for ALC889:
2031  * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2032  * work correctly (bko#42740)
2033  */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2034 static void alc889_fixup_dac_route(struct hda_codec *codec,
2035 				   const struct hda_fixup *fix, int action)
2036 {
2037 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2038 		/* fake the connections during parsing the tree */
2039 		static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2040 		static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2041 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2042 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2043 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2044 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2045 	} else if (action == HDA_FIXUP_ACT_PROBE) {
2046 		/* restore the connections */
2047 		static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2048 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2049 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2050 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2051 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2052 	}
2053 }
2054 
2055 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2056 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2057 				  const struct hda_fixup *fix, int action)
2058 {
2059 	static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2060 	struct alc_spec *spec = codec->spec;
2061 	int i;
2062 
2063 	if (action != HDA_FIXUP_ACT_INIT)
2064 		return;
2065 	for (i = 0; i < ARRAY_SIZE(nids); i++) {
2066 		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2067 		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2068 			continue;
2069 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2070 		val |= AC_PINCTL_VREF_80;
2071 		snd_hda_set_pin_ctl(codec, nids[i], val);
2072 		spec->gen.keep_vref_in_automute = 1;
2073 		break;
2074 	}
2075 }
2076 
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2077 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2078 				  const hda_nid_t *nids, int num_nids)
2079 {
2080 	struct alc_spec *spec = codec->spec;
2081 	int i;
2082 
2083 	for (i = 0; i < num_nids; i++) {
2084 		unsigned int val;
2085 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2086 		val |= AC_PINCTL_VREF_50;
2087 		snd_hda_set_pin_ctl(codec, nids[i], val);
2088 	}
2089 	spec->gen.keep_vref_in_automute = 1;
2090 }
2091 
2092 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2093 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2094 				     const struct hda_fixup *fix, int action)
2095 {
2096 	static const hda_nid_t nids[] = { 0x18, 0x1a };
2097 
2098 	if (action == HDA_FIXUP_ACT_INIT)
2099 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2100 }
2101 
2102 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2103 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2104 				    const struct hda_fixup *fix, int action)
2105 {
2106 	static const hda_nid_t nids[] = { 0x18 };
2107 
2108 	if (action == HDA_FIXUP_ACT_INIT)
2109 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2110 }
2111 
2112 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2113 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2114 				    const struct hda_fixup *fix, int action)
2115 {
2116 	static const hda_nid_t nids[] = { 0x18, 0x19 };
2117 
2118 	if (action == HDA_FIXUP_ACT_INIT)
2119 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2120 }
2121 
2122 /* Don't take HP output as primary
2123  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2124  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2125  */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2126 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2127 				       const struct hda_fixup *fix, int action)
2128 {
2129 	struct alc_spec *spec = codec->spec;
2130 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2131 		spec->gen.no_primary_hp = 1;
2132 		spec->gen.no_multi_io = 1;
2133 	}
2134 }
2135 
2136 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2137 				 const struct hda_fixup *fix, int action);
2138 
2139 /* For dual-codec configuration, we need to disable some features to avoid
2140  * conflicts of kctls and PCM streams
2141  */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2142 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2143 				  const struct hda_fixup *fix, int action)
2144 {
2145 	struct alc_spec *spec = codec->spec;
2146 
2147 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2148 		return;
2149 	/* disable vmaster */
2150 	spec->gen.suppress_vmaster = 1;
2151 	/* auto-mute and auto-mic switch don't work with multiple codecs */
2152 	spec->gen.suppress_auto_mute = 1;
2153 	spec->gen.suppress_auto_mic = 1;
2154 	/* disable aamix as well */
2155 	spec->gen.mixer_nid = 0;
2156 	/* add location prefix to avoid conflicts */
2157 	codec->force_pin_prefix = 1;
2158 }
2159 
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2160 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2161 		       const char *newname)
2162 {
2163 	struct snd_kcontrol *kctl;
2164 
2165 	kctl = snd_hda_find_mixer_ctl(codec, oldname);
2166 	if (kctl)
2167 		snd_ctl_rename(codec->card, kctl, newname);
2168 }
2169 
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2170 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2171 					 const struct hda_fixup *fix,
2172 					 int action)
2173 {
2174 	alc_fixup_dual_codecs(codec, fix, action);
2175 	switch (action) {
2176 	case HDA_FIXUP_ACT_PRE_PROBE:
2177 		/* override card longname to provide a unique UCM profile */
2178 		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2179 		break;
2180 	case HDA_FIXUP_ACT_BUILD:
2181 		/* rename Capture controls depending on the codec */
2182 		rename_ctl(codec, "Capture Volume",
2183 			   codec->addr == 0 ?
2184 			   "Rear-Panel Capture Volume" :
2185 			   "Front-Panel Capture Volume");
2186 		rename_ctl(codec, "Capture Switch",
2187 			   codec->addr == 0 ?
2188 			   "Rear-Panel Capture Switch" :
2189 			   "Front-Panel Capture Switch");
2190 		break;
2191 	}
2192 }
2193 
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2194 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2195 				     const struct hda_fixup *fix,
2196 				     int action)
2197 {
2198 	static const hda_nid_t conn1[] = { 0x0c };
2199 	static const struct coef_fw gb_x570_coefs[] = {
2200 		WRITE_COEF(0x07, 0x03c0),
2201 		WRITE_COEF(0x1a, 0x01c1),
2202 		WRITE_COEF(0x1b, 0x0202),
2203 		WRITE_COEF(0x43, 0x3005),
2204 		{}
2205 	};
2206 
2207 	switch (action) {
2208 	case HDA_FIXUP_ACT_PRE_PROBE:
2209 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2210 		snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2211 		break;
2212 	case HDA_FIXUP_ACT_INIT:
2213 		alc_process_coef_fw(codec, gb_x570_coefs);
2214 		break;
2215 	}
2216 }
2217 
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2218 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2219 				     const struct hda_fixup *fix,
2220 				     int action)
2221 {
2222 	static const hda_nid_t conn1[] = { 0x0c };
2223 
2224 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2225 		return;
2226 
2227 	alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2228 	/* We therefore want to make sure 0x14 (front headphone) and
2229 	 * 0x1b (speakers) use the stereo DAC 0x02
2230 	 */
2231 	snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2232 	snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2233 }
2234 
2235 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2236 				const struct hda_fixup *fix, int action);
2237 
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2238 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2239 				     const struct hda_fixup *fix,
2240 				     int action)
2241 {
2242 	alc1220_fixup_clevo_p950(codec, fix, action);
2243 	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2244 }
2245 
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2246 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2247 					 struct hda_jack_callback *jack)
2248 {
2249 	struct alc_spec *spec = codec->spec;
2250 	unsigned int vref;
2251 
2252 	snd_hda_gen_hp_automute(codec, jack);
2253 
2254 	if (spec->gen.hp_jack_present)
2255 		vref = AC_PINCTL_VREF_80;
2256 	else
2257 		vref = AC_PINCTL_VREF_HIZ;
2258 	snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2259 }
2260 
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2261 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2262 				     const struct hda_fixup *fix, int action)
2263 {
2264 	struct alc_spec *spec = codec->spec;
2265 	if (action != HDA_FIXUP_ACT_PROBE)
2266 		return;
2267 	snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2268 	spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2269 }
2270 
2271 static const struct hda_fixup alc882_fixups[] = {
2272 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
2273 		.type = HDA_FIXUP_PINS,
2274 		.v.pins = (const struct hda_pintbl[]) {
2275 			{ 0x15, 0x01080104 }, /* side */
2276 			{ 0x16, 0x01011012 }, /* rear */
2277 			{ 0x17, 0x01016011 }, /* clfe */
2278 			{ }
2279 		}
2280 	},
2281 	[ALC882_FIXUP_LENOVO_Y530] = {
2282 		.type = HDA_FIXUP_PINS,
2283 		.v.pins = (const struct hda_pintbl[]) {
2284 			{ 0x15, 0x99130112 }, /* rear int speakers */
2285 			{ 0x16, 0x99130111 }, /* subwoofer */
2286 			{ }
2287 		}
2288 	},
2289 	[ALC882_FIXUP_PB_M5210] = {
2290 		.type = HDA_FIXUP_PINCTLS,
2291 		.v.pins = (const struct hda_pintbl[]) {
2292 			{ 0x19, PIN_VREF50 },
2293 			{}
2294 		}
2295 	},
2296 	[ALC882_FIXUP_ACER_ASPIRE_7736] = {
2297 		.type = HDA_FIXUP_FUNC,
2298 		.v.func = alc_fixup_sku_ignore,
2299 	},
2300 	[ALC882_FIXUP_ASUS_W90V] = {
2301 		.type = HDA_FIXUP_PINS,
2302 		.v.pins = (const struct hda_pintbl[]) {
2303 			{ 0x16, 0x99130110 }, /* fix sequence for CLFE */
2304 			{ }
2305 		}
2306 	},
2307 	[ALC889_FIXUP_CD] = {
2308 		.type = HDA_FIXUP_PINS,
2309 		.v.pins = (const struct hda_pintbl[]) {
2310 			{ 0x1c, 0x993301f0 }, /* CD */
2311 			{ }
2312 		}
2313 	},
2314 	[ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2315 		.type = HDA_FIXUP_PINS,
2316 		.v.pins = (const struct hda_pintbl[]) {
2317 			{ 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2318 			{ }
2319 		},
2320 		.chained = true,
2321 		.chain_id = ALC889_FIXUP_CD,
2322 	},
2323 	[ALC889_FIXUP_VAIO_TT] = {
2324 		.type = HDA_FIXUP_PINS,
2325 		.v.pins = (const struct hda_pintbl[]) {
2326 			{ 0x17, 0x90170111 }, /* hidden surround speaker */
2327 			{ }
2328 		}
2329 	},
2330 	[ALC888_FIXUP_EEE1601] = {
2331 		.type = HDA_FIXUP_VERBS,
2332 		.v.verbs = (const struct hda_verb[]) {
2333 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2334 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x0838 },
2335 			{ }
2336 		}
2337 	},
2338 	[ALC886_FIXUP_EAPD] = {
2339 		.type = HDA_FIXUP_VERBS,
2340 		.v.verbs = (const struct hda_verb[]) {
2341 			/* change to EAPD mode */
2342 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2343 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2344 			{ }
2345 		}
2346 	},
2347 	[ALC882_FIXUP_EAPD] = {
2348 		.type = HDA_FIXUP_VERBS,
2349 		.v.verbs = (const struct hda_verb[]) {
2350 			/* change to EAPD mode */
2351 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2352 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2353 			{ }
2354 		}
2355 	},
2356 	[ALC883_FIXUP_EAPD] = {
2357 		.type = HDA_FIXUP_VERBS,
2358 		.v.verbs = (const struct hda_verb[]) {
2359 			/* change to EAPD mode */
2360 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2361 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2362 			{ }
2363 		}
2364 	},
2365 	[ALC883_FIXUP_ACER_EAPD] = {
2366 		.type = HDA_FIXUP_VERBS,
2367 		.v.verbs = (const struct hda_verb[]) {
2368 			/* eanable EAPD on Acer laptops */
2369 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2370 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2371 			{ }
2372 		}
2373 	},
2374 	[ALC882_FIXUP_GPIO1] = {
2375 		.type = HDA_FIXUP_FUNC,
2376 		.v.func = alc_fixup_gpio1,
2377 	},
2378 	[ALC882_FIXUP_GPIO2] = {
2379 		.type = HDA_FIXUP_FUNC,
2380 		.v.func = alc_fixup_gpio2,
2381 	},
2382 	[ALC882_FIXUP_GPIO3] = {
2383 		.type = HDA_FIXUP_FUNC,
2384 		.v.func = alc_fixup_gpio3,
2385 	},
2386 	[ALC882_FIXUP_ASUS_W2JC] = {
2387 		.type = HDA_FIXUP_FUNC,
2388 		.v.func = alc_fixup_gpio1,
2389 		.chained = true,
2390 		.chain_id = ALC882_FIXUP_EAPD,
2391 	},
2392 	[ALC889_FIXUP_COEF] = {
2393 		.type = HDA_FIXUP_FUNC,
2394 		.v.func = alc889_fixup_coef,
2395 	},
2396 	[ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2397 		.type = HDA_FIXUP_PINS,
2398 		.v.pins = (const struct hda_pintbl[]) {
2399 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2400 			{ 0x17, 0x99130112 }, /* surround speaker */
2401 			{ }
2402 		},
2403 		.chained = true,
2404 		.chain_id = ALC882_FIXUP_GPIO1,
2405 	},
2406 	[ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2407 		.type = HDA_FIXUP_PINS,
2408 		.v.pins = (const struct hda_pintbl[]) {
2409 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2410 			{ 0x1b, 0x99130112 }, /* surround speaker */
2411 			{ }
2412 		},
2413 		.chained = true,
2414 		.chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2415 	},
2416 	[ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2417 		/* additional init verbs for Acer Aspire 8930G */
2418 		.type = HDA_FIXUP_VERBS,
2419 		.v.verbs = (const struct hda_verb[]) {
2420 			/* Enable all DACs */
2421 			/* DAC DISABLE/MUTE 1? */
2422 			/*  setting bits 1-5 disables DAC nids 0x02-0x06
2423 			 *  apparently. Init=0x38 */
2424 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2425 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2426 			/* DAC DISABLE/MUTE 2? */
2427 			/*  some bit here disables the other DACs.
2428 			 *  Init=0x4900 */
2429 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2430 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2431 			/* DMIC fix
2432 			 * This laptop has a stereo digital microphone.
2433 			 * The mics are only 1cm apart which makes the stereo
2434 			 * useless. However, either the mic or the ALC889
2435 			 * makes the signal become a difference/sum signal
2436 			 * instead of standard stereo, which is annoying.
2437 			 * So instead we flip this bit which makes the
2438 			 * codec replicate the sum signal to both channels,
2439 			 * turning it into a normal mono mic.
2440 			 */
2441 			/* DMIC_CONTROL? Init value = 0x0001 */
2442 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2443 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2444 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2445 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2446 			{ }
2447 		},
2448 		.chained = true,
2449 		.chain_id = ALC882_FIXUP_GPIO1,
2450 	},
2451 	[ALC885_FIXUP_MACPRO_GPIO] = {
2452 		.type = HDA_FIXUP_FUNC,
2453 		.v.func = alc885_fixup_macpro_gpio,
2454 	},
2455 	[ALC889_FIXUP_DAC_ROUTE] = {
2456 		.type = HDA_FIXUP_FUNC,
2457 		.v.func = alc889_fixup_dac_route,
2458 	},
2459 	[ALC889_FIXUP_MBP_VREF] = {
2460 		.type = HDA_FIXUP_FUNC,
2461 		.v.func = alc889_fixup_mbp_vref,
2462 		.chained = true,
2463 		.chain_id = ALC882_FIXUP_GPIO1,
2464 	},
2465 	[ALC889_FIXUP_IMAC91_VREF] = {
2466 		.type = HDA_FIXUP_FUNC,
2467 		.v.func = alc889_fixup_imac91_vref,
2468 		.chained = true,
2469 		.chain_id = ALC882_FIXUP_GPIO1,
2470 	},
2471 	[ALC889_FIXUP_MBA11_VREF] = {
2472 		.type = HDA_FIXUP_FUNC,
2473 		.v.func = alc889_fixup_mba11_vref,
2474 		.chained = true,
2475 		.chain_id = ALC889_FIXUP_MBP_VREF,
2476 	},
2477 	[ALC889_FIXUP_MBA21_VREF] = {
2478 		.type = HDA_FIXUP_FUNC,
2479 		.v.func = alc889_fixup_mba21_vref,
2480 		.chained = true,
2481 		.chain_id = ALC889_FIXUP_MBP_VREF,
2482 	},
2483 	[ALC889_FIXUP_MP11_VREF] = {
2484 		.type = HDA_FIXUP_FUNC,
2485 		.v.func = alc889_fixup_mba11_vref,
2486 		.chained = true,
2487 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2488 	},
2489 	[ALC889_FIXUP_MP41_VREF] = {
2490 		.type = HDA_FIXUP_FUNC,
2491 		.v.func = alc889_fixup_mbp_vref,
2492 		.chained = true,
2493 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2494 	},
2495 	[ALC882_FIXUP_INV_DMIC] = {
2496 		.type = HDA_FIXUP_FUNC,
2497 		.v.func = alc_fixup_inv_dmic,
2498 	},
2499 	[ALC882_FIXUP_NO_PRIMARY_HP] = {
2500 		.type = HDA_FIXUP_FUNC,
2501 		.v.func = alc882_fixup_no_primary_hp,
2502 	},
2503 	[ALC887_FIXUP_ASUS_BASS] = {
2504 		.type = HDA_FIXUP_PINS,
2505 		.v.pins = (const struct hda_pintbl[]) {
2506 			{0x16, 0x99130130}, /* bass speaker */
2507 			{}
2508 		},
2509 		.chained = true,
2510 		.chain_id = ALC887_FIXUP_BASS_CHMAP,
2511 	},
2512 	[ALC887_FIXUP_BASS_CHMAP] = {
2513 		.type = HDA_FIXUP_FUNC,
2514 		.v.func = alc_fixup_bass_chmap,
2515 	},
2516 	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
2517 		.type = HDA_FIXUP_FUNC,
2518 		.v.func = alc1220_fixup_gb_dual_codecs,
2519 	},
2520 	[ALC1220_FIXUP_GB_X570] = {
2521 		.type = HDA_FIXUP_FUNC,
2522 		.v.func = alc1220_fixup_gb_x570,
2523 	},
2524 	[ALC1220_FIXUP_CLEVO_P950] = {
2525 		.type = HDA_FIXUP_FUNC,
2526 		.v.func = alc1220_fixup_clevo_p950,
2527 	},
2528 	[ALC1220_FIXUP_CLEVO_PB51ED] = {
2529 		.type = HDA_FIXUP_FUNC,
2530 		.v.func = alc1220_fixup_clevo_pb51ed,
2531 	},
2532 	[ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2533 		.type = HDA_FIXUP_PINS,
2534 		.v.pins = (const struct hda_pintbl[]) {
2535 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2536 			{}
2537 		},
2538 		.chained = true,
2539 		.chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2540 	},
2541 	[ALC887_FIXUP_ASUS_AUDIO] = {
2542 		.type = HDA_FIXUP_PINS,
2543 		.v.pins = (const struct hda_pintbl[]) {
2544 			{ 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2545 			{ 0x19, 0x22219420 },
2546 			{}
2547 		},
2548 	},
2549 	[ALC887_FIXUP_ASUS_HMIC] = {
2550 		.type = HDA_FIXUP_FUNC,
2551 		.v.func = alc887_fixup_asus_jack,
2552 		.chained = true,
2553 		.chain_id = ALC887_FIXUP_ASUS_AUDIO,
2554 	},
2555 	[ALCS1200A_FIXUP_MIC_VREF] = {
2556 		.type = HDA_FIXUP_PINCTLS,
2557 		.v.pins = (const struct hda_pintbl[]) {
2558 			{ 0x18, PIN_VREF50 }, /* rear mic */
2559 			{ 0x19, PIN_VREF50 }, /* front mic */
2560 			{}
2561 		}
2562 	},
2563 	[ALC888VD_FIXUP_MIC_100VREF] = {
2564 		.type = HDA_FIXUP_PINCTLS,
2565 		.v.pins = (const struct hda_pintbl[]) {
2566 			{ 0x18, PIN_VREF100 }, /* headset mic */
2567 			{}
2568 		}
2569 	},
2570 };
2571 
2572 static const struct hda_quirk alc882_fixup_tbl[] = {
2573 	SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2574 	SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2575 	SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2576 	SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2577 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2578 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2579 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2580 	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2581 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2582 	SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2583 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2584 	SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2585 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2586 	SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2587 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2588 	SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2589 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2590 	SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2591 	SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2592 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2593 	SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2594 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2595 	SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2596 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2597 	SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2598 	SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2599 	SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2600 	SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2601 	SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2602 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2603 	SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2604 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2605 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2606 	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2607 	SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2608 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2609 	SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2610 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2611 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2612 	SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2613 
2614 	/* All Apple entries are in codec SSIDs */
2615 	SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2616 	SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2617 	SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2618 	SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2619 	SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2620 	SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2621 	SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2622 	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2623 	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2624 	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2625 	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2626 	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2627 	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2628 	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2629 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2630 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2631 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2632 	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2633 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2634 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2635 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2636 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2637 
2638 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2639 	SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2640 	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2641 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2642 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2643 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2644 	SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2645 	SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2646 	SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2647 	SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2648 	SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2649 	SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2650 	SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2651 	SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2652 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2653 	SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2654 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2655 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2656 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2657 	SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 	SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 	SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 	SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2661 	SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2662 	SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2663 	SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2664 	SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2665 	SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2666 	SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2667 	SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2668 	SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2669 	SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2670 	SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2671 	SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2672 	SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2673 	SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2674 	SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2675 	SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2676 	SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2677 	SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2678 	SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2679 	SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2680 	SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2681 	SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2682 	SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2683 	SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2684 	SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2685 	SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2686 	SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2687 	SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2688 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2689 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2690 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2691 	SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2692 	{}
2693 };
2694 
2695 static const struct hda_model_fixup alc882_fixup_models[] = {
2696 	{.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2697 	{.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2698 	{.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2699 	{.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2700 	{.id = ALC889_FIXUP_CD, .name = "cd"},
2701 	{.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2702 	{.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2703 	{.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2704 	{.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2705 	{.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2706 	{.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2707 	{.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2708 	{.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2709 	{.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2710 	{.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2711 	{.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2712 	{.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2713 	{.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2714 	{.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2715 	{.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2716 	{.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2717 	{.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2718 	{.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2719 	{.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2720 	{.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2721 	{.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2722 	{.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2723 	{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2724 	{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2725 	{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2726 	{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2727 	{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2728 	{}
2729 };
2730 
2731 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2732 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2733 		{0x14, 0x01014010},
2734 		{0x15, 0x01011012},
2735 		{0x16, 0x01016011},
2736 		{0x18, 0x01a19040},
2737 		{0x19, 0x02a19050},
2738 		{0x1a, 0x0181304f},
2739 		{0x1b, 0x0221401f},
2740 		{0x1e, 0x01456130}),
2741 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2742 		{0x14, 0x01015010},
2743 		{0x15, 0x01011012},
2744 		{0x16, 0x01011011},
2745 		{0x18, 0x01a11040},
2746 		{0x19, 0x02a19050},
2747 		{0x1a, 0x0181104f},
2748 		{0x1b, 0x0221401f},
2749 		{0x1e, 0x01451130}),
2750 	{}
2751 };
2752 
2753 /*
2754  * BIOS auto configuration
2755  */
2756 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2757 static int alc882_parse_auto_config(struct hda_codec *codec)
2758 {
2759 	static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2760 	static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2761 	return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2762 }
2763 
2764 /*
2765  */
patch_alc882(struct hda_codec * codec)2766 static int patch_alc882(struct hda_codec *codec)
2767 {
2768 	struct alc_spec *spec;
2769 	int err;
2770 
2771 	err = alc_alloc_spec(codec, 0x0b);
2772 	if (err < 0)
2773 		return err;
2774 
2775 	spec = codec->spec;
2776 
2777 	switch (codec->core.vendor_id) {
2778 	case 0x10ec0882:
2779 	case 0x10ec0885:
2780 	case 0x10ec0900:
2781 	case 0x10ec0b00:
2782 	case 0x10ec1220:
2783 		break;
2784 	default:
2785 		/* ALC883 and variants */
2786 		alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2787 		break;
2788 	}
2789 
2790 	alc_pre_init(codec);
2791 
2792 	snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2793 		       alc882_fixups);
2794 	snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2795 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2796 
2797 	alc_auto_parse_customize_define(codec);
2798 
2799 	if (has_cdefine_beep(codec))
2800 		spec->gen.beep_nid = 0x01;
2801 
2802 	/* automatic parse from the BIOS config */
2803 	err = alc882_parse_auto_config(codec);
2804 	if (err < 0)
2805 		goto error;
2806 
2807 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2808 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2809 		if (err < 0)
2810 			goto error;
2811 	}
2812 
2813 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2814 
2815 	return 0;
2816 
2817  error:
2818 	alc_free(codec);
2819 	return err;
2820 }
2821 
2822 
2823 /*
2824  * ALC262 support
2825  */
alc262_parse_auto_config(struct hda_codec * codec)2826 static int alc262_parse_auto_config(struct hda_codec *codec)
2827 {
2828 	static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2829 	static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2830 	return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2831 }
2832 
2833 /*
2834  * Pin config fixes
2835  */
2836 enum {
2837 	ALC262_FIXUP_FSC_H270,
2838 	ALC262_FIXUP_FSC_S7110,
2839 	ALC262_FIXUP_HP_Z200,
2840 	ALC262_FIXUP_TYAN,
2841 	ALC262_FIXUP_LENOVO_3000,
2842 	ALC262_FIXUP_BENQ,
2843 	ALC262_FIXUP_BENQ_T31,
2844 	ALC262_FIXUP_INV_DMIC,
2845 	ALC262_FIXUP_INTEL_BAYLEYBAY,
2846 };
2847 
2848 static const struct hda_fixup alc262_fixups[] = {
2849 	[ALC262_FIXUP_FSC_H270] = {
2850 		.type = HDA_FIXUP_PINS,
2851 		.v.pins = (const struct hda_pintbl[]) {
2852 			{ 0x14, 0x99130110 }, /* speaker */
2853 			{ 0x15, 0x0221142f }, /* front HP */
2854 			{ 0x1b, 0x0121141f }, /* rear HP */
2855 			{ }
2856 		}
2857 	},
2858 	[ALC262_FIXUP_FSC_S7110] = {
2859 		.type = HDA_FIXUP_PINS,
2860 		.v.pins = (const struct hda_pintbl[]) {
2861 			{ 0x15, 0x90170110 }, /* speaker */
2862 			{ }
2863 		},
2864 		.chained = true,
2865 		.chain_id = ALC262_FIXUP_BENQ,
2866 	},
2867 	[ALC262_FIXUP_HP_Z200] = {
2868 		.type = HDA_FIXUP_PINS,
2869 		.v.pins = (const struct hda_pintbl[]) {
2870 			{ 0x16, 0x99130120 }, /* internal speaker */
2871 			{ }
2872 		}
2873 	},
2874 	[ALC262_FIXUP_TYAN] = {
2875 		.type = HDA_FIXUP_PINS,
2876 		.v.pins = (const struct hda_pintbl[]) {
2877 			{ 0x14, 0x1993e1f0 }, /* int AUX */
2878 			{ }
2879 		}
2880 	},
2881 	[ALC262_FIXUP_LENOVO_3000] = {
2882 		.type = HDA_FIXUP_PINCTLS,
2883 		.v.pins = (const struct hda_pintbl[]) {
2884 			{ 0x19, PIN_VREF50 },
2885 			{}
2886 		},
2887 		.chained = true,
2888 		.chain_id = ALC262_FIXUP_BENQ,
2889 	},
2890 	[ALC262_FIXUP_BENQ] = {
2891 		.type = HDA_FIXUP_VERBS,
2892 		.v.verbs = (const struct hda_verb[]) {
2893 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2894 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2895 			{}
2896 		}
2897 	},
2898 	[ALC262_FIXUP_BENQ_T31] = {
2899 		.type = HDA_FIXUP_VERBS,
2900 		.v.verbs = (const struct hda_verb[]) {
2901 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2902 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2903 			{}
2904 		}
2905 	},
2906 	[ALC262_FIXUP_INV_DMIC] = {
2907 		.type = HDA_FIXUP_FUNC,
2908 		.v.func = alc_fixup_inv_dmic,
2909 	},
2910 	[ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2911 		.type = HDA_FIXUP_FUNC,
2912 		.v.func = alc_fixup_no_depop_delay,
2913 	},
2914 };
2915 
2916 static const struct hda_quirk alc262_fixup_tbl[] = {
2917 	SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2918 	SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2919 	SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2920 	SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2921 	SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2922 	SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2923 	SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2924 	SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2925 	SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2926 	SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2927 	{}
2928 };
2929 
2930 static const struct hda_model_fixup alc262_fixup_models[] = {
2931 	{.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2932 	{.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2933 	{.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2934 	{.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2935 	{.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2936 	{.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2937 	{.id = ALC262_FIXUP_BENQ, .name = "benq"},
2938 	{.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2939 	{.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2940 	{}
2941 };
2942 
2943 /*
2944  */
patch_alc262(struct hda_codec * codec)2945 static int patch_alc262(struct hda_codec *codec)
2946 {
2947 	struct alc_spec *spec;
2948 	int err;
2949 
2950 	err = alc_alloc_spec(codec, 0x0b);
2951 	if (err < 0)
2952 		return err;
2953 
2954 	spec = codec->spec;
2955 	spec->gen.shared_mic_vref_pin = 0x18;
2956 
2957 	spec->shutup = alc_eapd_shutup;
2958 
2959 #if 0
2960 	/* pshou 07/11/05  set a zero PCM sample to DAC when FIFO is
2961 	 * under-run
2962 	 */
2963 	alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2964 #endif
2965 	alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2966 
2967 	alc_pre_init(codec);
2968 
2969 	snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2970 		       alc262_fixups);
2971 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2972 
2973 	alc_auto_parse_customize_define(codec);
2974 
2975 	if (has_cdefine_beep(codec))
2976 		spec->gen.beep_nid = 0x01;
2977 
2978 	/* automatic parse from the BIOS config */
2979 	err = alc262_parse_auto_config(codec);
2980 	if (err < 0)
2981 		goto error;
2982 
2983 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2984 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2985 		if (err < 0)
2986 			goto error;
2987 	}
2988 
2989 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2990 
2991 	return 0;
2992 
2993  error:
2994 	alc_free(codec);
2995 	return err;
2996 }
2997 
2998 /*
2999  *  ALC268
3000  */
3001 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)3002 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
3003 				  struct snd_ctl_elem_value *ucontrol)
3004 {
3005 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3006 	unsigned long pval;
3007 	int err;
3008 
3009 	mutex_lock(&codec->control_mutex);
3010 	pval = kcontrol->private_value;
3011 	kcontrol->private_value = (pval & ~0xff) | 0x0f;
3012 	err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3013 	if (err >= 0) {
3014 		kcontrol->private_value = (pval & ~0xff) | 0x10;
3015 		err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3016 	}
3017 	kcontrol->private_value = pval;
3018 	mutex_unlock(&codec->control_mutex);
3019 	return err;
3020 }
3021 
3022 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3023 	HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3024 	{
3025 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3026 		.name = "Beep Playback Switch",
3027 		.subdevice = HDA_SUBDEV_AMP_FLAG,
3028 		.info = snd_hda_mixer_amp_switch_info,
3029 		.get = snd_hda_mixer_amp_switch_get,
3030 		.put = alc268_beep_switch_put,
3031 		.private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3032 	},
3033 };
3034 
3035 /* set PCBEEP vol = 0, mute connections */
3036 static const struct hda_verb alc268_beep_init_verbs[] = {
3037 	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3038 	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3039 	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3040 	{ }
3041 };
3042 
3043 enum {
3044 	ALC268_FIXUP_INV_DMIC,
3045 	ALC268_FIXUP_HP_EAPD,
3046 	ALC268_FIXUP_SPDIF,
3047 };
3048 
3049 static const struct hda_fixup alc268_fixups[] = {
3050 	[ALC268_FIXUP_INV_DMIC] = {
3051 		.type = HDA_FIXUP_FUNC,
3052 		.v.func = alc_fixup_inv_dmic,
3053 	},
3054 	[ALC268_FIXUP_HP_EAPD] = {
3055 		.type = HDA_FIXUP_VERBS,
3056 		.v.verbs = (const struct hda_verb[]) {
3057 			{0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3058 			{}
3059 		}
3060 	},
3061 	[ALC268_FIXUP_SPDIF] = {
3062 		.type = HDA_FIXUP_PINS,
3063 		.v.pins = (const struct hda_pintbl[]) {
3064 			{ 0x1e, 0x014b1180 }, /* enable SPDIF out */
3065 			{}
3066 		}
3067 	},
3068 };
3069 
3070 static const struct hda_model_fixup alc268_fixup_models[] = {
3071 	{.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3072 	{.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3073 	{.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3074 	{}
3075 };
3076 
3077 static const struct hda_quirk alc268_fixup_tbl[] = {
3078 	SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3079 	SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3080 	/* below is codec SSID since multiple Toshiba laptops have the
3081 	 * same PCI SSID 1179:ff00
3082 	 */
3083 	SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3084 	{}
3085 };
3086 
3087 /*
3088  * BIOS auto configuration
3089  */
alc268_parse_auto_config(struct hda_codec * codec)3090 static int alc268_parse_auto_config(struct hda_codec *codec)
3091 {
3092 	static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3093 	return alc_parse_auto_config(codec, NULL, alc268_ssids);
3094 }
3095 
3096 /*
3097  */
patch_alc268(struct hda_codec * codec)3098 static int patch_alc268(struct hda_codec *codec)
3099 {
3100 	struct alc_spec *spec;
3101 	int i, err;
3102 
3103 	/* ALC268 has no aa-loopback mixer */
3104 	err = alc_alloc_spec(codec, 0);
3105 	if (err < 0)
3106 		return err;
3107 
3108 	spec = codec->spec;
3109 	if (has_cdefine_beep(codec))
3110 		spec->gen.beep_nid = 0x01;
3111 
3112 	spec->shutup = alc_eapd_shutup;
3113 
3114 	alc_pre_init(codec);
3115 
3116 	snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3117 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3118 
3119 	/* automatic parse from the BIOS config */
3120 	err = alc268_parse_auto_config(codec);
3121 	if (err < 0)
3122 		goto error;
3123 
3124 	if (err > 0 && !spec->gen.no_analog &&
3125 	    spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3126 		for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3127 			if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3128 						  &alc268_beep_mixer[i])) {
3129 				err = -ENOMEM;
3130 				goto error;
3131 			}
3132 		}
3133 		snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3134 		if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3135 			/* override the amp caps for beep generator */
3136 			snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3137 					  (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3138 					  (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3139 					  (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3140 					  (0 << AC_AMPCAP_MUTE_SHIFT));
3141 	}
3142 
3143 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3144 
3145 	return 0;
3146 
3147  error:
3148 	alc_free(codec);
3149 	return err;
3150 }
3151 
3152 /*
3153  * ALC269
3154  */
3155 
3156 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3157 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3158 };
3159 
3160 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3161 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3162 };
3163 
3164 /* different alc269-variants */
3165 enum {
3166 	ALC269_TYPE_ALC269VA,
3167 	ALC269_TYPE_ALC269VB,
3168 	ALC269_TYPE_ALC269VC,
3169 	ALC269_TYPE_ALC269VD,
3170 	ALC269_TYPE_ALC280,
3171 	ALC269_TYPE_ALC282,
3172 	ALC269_TYPE_ALC283,
3173 	ALC269_TYPE_ALC284,
3174 	ALC269_TYPE_ALC293,
3175 	ALC269_TYPE_ALC286,
3176 	ALC269_TYPE_ALC298,
3177 	ALC269_TYPE_ALC255,
3178 	ALC269_TYPE_ALC256,
3179 	ALC269_TYPE_ALC257,
3180 	ALC269_TYPE_ALC215,
3181 	ALC269_TYPE_ALC225,
3182 	ALC269_TYPE_ALC245,
3183 	ALC269_TYPE_ALC287,
3184 	ALC269_TYPE_ALC294,
3185 	ALC269_TYPE_ALC300,
3186 	ALC269_TYPE_ALC623,
3187 	ALC269_TYPE_ALC700,
3188 };
3189 
3190 /*
3191  * BIOS auto configuration
3192  */
alc269_parse_auto_config(struct hda_codec * codec)3193 static int alc269_parse_auto_config(struct hda_codec *codec)
3194 {
3195 	static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3196 	static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3197 	static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3198 	struct alc_spec *spec = codec->spec;
3199 	const hda_nid_t *ssids;
3200 
3201 	switch (spec->codec_variant) {
3202 	case ALC269_TYPE_ALC269VA:
3203 	case ALC269_TYPE_ALC269VC:
3204 	case ALC269_TYPE_ALC280:
3205 	case ALC269_TYPE_ALC284:
3206 	case ALC269_TYPE_ALC293:
3207 		ssids = alc269va_ssids;
3208 		break;
3209 	case ALC269_TYPE_ALC269VB:
3210 	case ALC269_TYPE_ALC269VD:
3211 	case ALC269_TYPE_ALC282:
3212 	case ALC269_TYPE_ALC283:
3213 	case ALC269_TYPE_ALC286:
3214 	case ALC269_TYPE_ALC298:
3215 	case ALC269_TYPE_ALC255:
3216 	case ALC269_TYPE_ALC256:
3217 	case ALC269_TYPE_ALC257:
3218 	case ALC269_TYPE_ALC215:
3219 	case ALC269_TYPE_ALC225:
3220 	case ALC269_TYPE_ALC245:
3221 	case ALC269_TYPE_ALC287:
3222 	case ALC269_TYPE_ALC294:
3223 	case ALC269_TYPE_ALC300:
3224 	case ALC269_TYPE_ALC623:
3225 	case ALC269_TYPE_ALC700:
3226 		ssids = alc269_ssids;
3227 		break;
3228 	default:
3229 		ssids = alc269_ssids;
3230 		break;
3231 	}
3232 
3233 	return alc_parse_auto_config(codec, alc269_ignore, ssids);
3234 }
3235 
3236 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3237 	{ SND_JACK_BTN_0, KEY_PLAYPAUSE },
3238 	{ SND_JACK_BTN_1, KEY_VOICECOMMAND },
3239 	{ SND_JACK_BTN_2, KEY_VOLUMEUP },
3240 	{ SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3241 	{}
3242 };
3243 
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3244 static void alc_headset_btn_callback(struct hda_codec *codec,
3245 				     struct hda_jack_callback *jack)
3246 {
3247 	int report = 0;
3248 
3249 	if (jack->unsol_res & (7 << 13))
3250 		report |= SND_JACK_BTN_0;
3251 
3252 	if (jack->unsol_res  & (1 << 16 | 3 << 8))
3253 		report |= SND_JACK_BTN_1;
3254 
3255 	/* Volume up key */
3256 	if (jack->unsol_res & (7 << 23))
3257 		report |= SND_JACK_BTN_2;
3258 
3259 	/* Volume down key */
3260 	if (jack->unsol_res & (7 << 10))
3261 		report |= SND_JACK_BTN_3;
3262 
3263 	snd_hda_jack_set_button_state(codec, jack->nid, report);
3264 }
3265 
alc_disable_headset_jack_key(struct hda_codec * codec)3266 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3267 {
3268 	struct alc_spec *spec = codec->spec;
3269 
3270 	if (!spec->has_hs_key)
3271 		return;
3272 
3273 	switch (codec->core.vendor_id) {
3274 	case 0x10ec0215:
3275 	case 0x10ec0225:
3276 	case 0x10ec0285:
3277 	case 0x10ec0287:
3278 	case 0x10ec0295:
3279 	case 0x10ec0289:
3280 	case 0x10ec0299:
3281 		alc_write_coef_idx(codec, 0x48, 0x0);
3282 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3283 		alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3284 		break;
3285 	case 0x10ec0230:
3286 	case 0x10ec0236:
3287 	case 0x10ec0256:
3288 	case 0x10ec0257:
3289 	case 0x19e58326:
3290 		alc_write_coef_idx(codec, 0x48, 0x0);
3291 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3292 		break;
3293 	}
3294 }
3295 
alc_enable_headset_jack_key(struct hda_codec * codec)3296 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3297 {
3298 	struct alc_spec *spec = codec->spec;
3299 
3300 	if (!spec->has_hs_key)
3301 		return;
3302 
3303 	switch (codec->core.vendor_id) {
3304 	case 0x10ec0215:
3305 	case 0x10ec0225:
3306 	case 0x10ec0285:
3307 	case 0x10ec0287:
3308 	case 0x10ec0295:
3309 	case 0x10ec0289:
3310 	case 0x10ec0299:
3311 		alc_write_coef_idx(codec, 0x48, 0xd011);
3312 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3313 		alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3314 		break;
3315 	case 0x10ec0230:
3316 	case 0x10ec0236:
3317 	case 0x10ec0256:
3318 	case 0x10ec0257:
3319 	case 0x19e58326:
3320 		alc_write_coef_idx(codec, 0x48, 0xd011);
3321 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3322 		break;
3323 	}
3324 }
3325 
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3326 static void alc_fixup_headset_jack(struct hda_codec *codec,
3327 				    const struct hda_fixup *fix, int action)
3328 {
3329 	struct alc_spec *spec = codec->spec;
3330 	hda_nid_t hp_pin;
3331 
3332 	switch (action) {
3333 	case HDA_FIXUP_ACT_PRE_PROBE:
3334 		spec->has_hs_key = 1;
3335 		snd_hda_jack_detect_enable_callback(codec, 0x55,
3336 						    alc_headset_btn_callback);
3337 		break;
3338 	case HDA_FIXUP_ACT_BUILD:
3339 		hp_pin = alc_get_hp_pin(spec);
3340 		if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3341 							alc_headset_btn_keymap,
3342 							hp_pin))
3343 			snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3344 					      false, SND_JACK_HEADSET,
3345 					      alc_headset_btn_keymap);
3346 
3347 		alc_enable_headset_jack_key(codec);
3348 		break;
3349 	}
3350 }
3351 
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3352 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3353 {
3354 	alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3355 }
3356 
alc269_shutup(struct hda_codec * codec)3357 static void alc269_shutup(struct hda_codec *codec)
3358 {
3359 	struct alc_spec *spec = codec->spec;
3360 
3361 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3362 		alc269vb_toggle_power_output(codec, 0);
3363 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3364 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3365 		msleep(150);
3366 	}
3367 	alc_shutup_pins(codec);
3368 }
3369 
3370 static const struct coef_fw alc282_coefs[] = {
3371 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3372 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3373 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3374 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3375 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3376 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3377 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3378 	WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3379 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3380 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3381 	WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3382 	UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3383 	WRITE_COEF(0x34, 0xa0c0), /* ANC */
3384 	UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3385 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3386 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3387 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3388 	WRITE_COEF(0x63, 0x2902), /* PLL */
3389 	WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3390 	WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3391 	WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3392 	WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3393 	UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3394 	WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3395 	UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3396 	WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3397 	WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3398 	UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3399 	WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3400 	{}
3401 };
3402 
alc282_restore_default_value(struct hda_codec * codec)3403 static void alc282_restore_default_value(struct hda_codec *codec)
3404 {
3405 	alc_process_coef_fw(codec, alc282_coefs);
3406 }
3407 
alc282_init(struct hda_codec * codec)3408 static void alc282_init(struct hda_codec *codec)
3409 {
3410 	struct alc_spec *spec = codec->spec;
3411 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3412 	bool hp_pin_sense;
3413 	int coef78;
3414 
3415 	alc282_restore_default_value(codec);
3416 
3417 	if (!hp_pin)
3418 		return;
3419 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3420 	coef78 = alc_read_coef_idx(codec, 0x78);
3421 
3422 	/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3423 	/* Headphone capless set to high power mode */
3424 	alc_write_coef_idx(codec, 0x78, 0x9004);
3425 
3426 	if (hp_pin_sense)
3427 		msleep(2);
3428 
3429 	snd_hda_codec_write(codec, hp_pin, 0,
3430 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3431 
3432 	if (hp_pin_sense)
3433 		msleep(85);
3434 
3435 	snd_hda_codec_write(codec, hp_pin, 0,
3436 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3437 
3438 	if (hp_pin_sense)
3439 		msleep(100);
3440 
3441 	/* Headphone capless set to normal mode */
3442 	alc_write_coef_idx(codec, 0x78, coef78);
3443 }
3444 
alc282_shutup(struct hda_codec * codec)3445 static void alc282_shutup(struct hda_codec *codec)
3446 {
3447 	struct alc_spec *spec = codec->spec;
3448 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3449 	bool hp_pin_sense;
3450 	int coef78;
3451 
3452 	if (!hp_pin) {
3453 		alc269_shutup(codec);
3454 		return;
3455 	}
3456 
3457 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3458 	coef78 = alc_read_coef_idx(codec, 0x78);
3459 	alc_write_coef_idx(codec, 0x78, 0x9004);
3460 
3461 	if (hp_pin_sense)
3462 		msleep(2);
3463 
3464 	snd_hda_codec_write(codec, hp_pin, 0,
3465 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3466 
3467 	if (hp_pin_sense)
3468 		msleep(85);
3469 
3470 	if (!spec->no_shutup_pins)
3471 		snd_hda_codec_write(codec, hp_pin, 0,
3472 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3473 
3474 	if (hp_pin_sense)
3475 		msleep(100);
3476 
3477 	alc_auto_setup_eapd(codec, false);
3478 	alc_shutup_pins(codec);
3479 	alc_write_coef_idx(codec, 0x78, coef78);
3480 }
3481 
3482 static const struct coef_fw alc283_coefs[] = {
3483 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3484 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3485 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3486 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3487 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3488 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3489 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3490 	WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3491 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3492 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3493 	WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3494 	UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3495 	WRITE_COEF(0x22, 0xa0c0), /* ANC */
3496 	UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3497 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3498 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3499 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3500 	WRITE_COEF(0x2e, 0x2902), /* PLL */
3501 	WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3502 	WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3503 	WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3504 	WRITE_COEF(0x36, 0x0), /* capless control 5 */
3505 	UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3506 	WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3507 	UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3508 	WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3509 	WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3510 	UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3511 	WRITE_COEF(0x49, 0x0), /* test mode */
3512 	UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3513 	UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3514 	WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3515 	UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3516 	{}
3517 };
3518 
alc283_restore_default_value(struct hda_codec * codec)3519 static void alc283_restore_default_value(struct hda_codec *codec)
3520 {
3521 	alc_process_coef_fw(codec, alc283_coefs);
3522 }
3523 
alc283_init(struct hda_codec * codec)3524 static void alc283_init(struct hda_codec *codec)
3525 {
3526 	struct alc_spec *spec = codec->spec;
3527 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3528 	bool hp_pin_sense;
3529 
3530 	alc283_restore_default_value(codec);
3531 
3532 	if (!hp_pin)
3533 		return;
3534 
3535 	msleep(30);
3536 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3537 
3538 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3539 	/* Headphone capless set to high power mode */
3540 	alc_write_coef_idx(codec, 0x43, 0x9004);
3541 
3542 	snd_hda_codec_write(codec, hp_pin, 0,
3543 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3544 
3545 	if (hp_pin_sense)
3546 		msleep(85);
3547 
3548 	snd_hda_codec_write(codec, hp_pin, 0,
3549 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3550 
3551 	if (hp_pin_sense)
3552 		msleep(85);
3553 	/* Index 0x46 Combo jack auto switch control 2 */
3554 	/* 3k pull low control for Headset jack. */
3555 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3556 	/* Headphone capless set to normal mode */
3557 	alc_write_coef_idx(codec, 0x43, 0x9614);
3558 }
3559 
alc283_shutup(struct hda_codec * codec)3560 static void alc283_shutup(struct hda_codec *codec)
3561 {
3562 	struct alc_spec *spec = codec->spec;
3563 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3564 	bool hp_pin_sense;
3565 
3566 	if (!hp_pin) {
3567 		alc269_shutup(codec);
3568 		return;
3569 	}
3570 
3571 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3572 
3573 	alc_write_coef_idx(codec, 0x43, 0x9004);
3574 
3575 	/*depop hp during suspend*/
3576 	alc_write_coef_idx(codec, 0x06, 0x2100);
3577 
3578 	snd_hda_codec_write(codec, hp_pin, 0,
3579 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3580 
3581 	if (hp_pin_sense)
3582 		msleep(100);
3583 
3584 	if (!spec->no_shutup_pins)
3585 		snd_hda_codec_write(codec, hp_pin, 0,
3586 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3587 
3588 	alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3589 
3590 	if (hp_pin_sense)
3591 		msleep(100);
3592 	alc_auto_setup_eapd(codec, false);
3593 	alc_shutup_pins(codec);
3594 	alc_write_coef_idx(codec, 0x43, 0x9614);
3595 }
3596 
alc256_init(struct hda_codec * codec)3597 static void alc256_init(struct hda_codec *codec)
3598 {
3599 	struct alc_spec *spec = codec->spec;
3600 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3601 	bool hp_pin_sense;
3602 
3603 	if (spec->ultra_low_power) {
3604 		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3605 		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3606 		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3607 		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3608 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3609 		msleep(30);
3610 	}
3611 
3612 	if (!hp_pin)
3613 		hp_pin = 0x21;
3614 
3615 	msleep(30);
3616 
3617 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3618 
3619 	if (hp_pin_sense) {
3620 		msleep(2);
3621 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3622 
3623 		snd_hda_codec_write(codec, hp_pin, 0,
3624 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3625 
3626 		msleep(75);
3627 
3628 		snd_hda_codec_write(codec, hp_pin, 0,
3629 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3630 
3631 		msleep(75);
3632 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3633 	}
3634 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3635 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3636 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3637 	/*
3638 	 * Expose headphone mic (or possibly Line In on some machines) instead
3639 	 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3640 	 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3641 	 * this register.
3642 	 */
3643 	alc_write_coef_idx(codec, 0x36, 0x5757);
3644 }
3645 
alc256_shutup(struct hda_codec * codec)3646 static void alc256_shutup(struct hda_codec *codec)
3647 {
3648 	struct alc_spec *spec = codec->spec;
3649 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3650 	bool hp_pin_sense;
3651 
3652 	if (!hp_pin)
3653 		hp_pin = 0x21;
3654 
3655 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3656 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3657 
3658 	if (hp_pin_sense) {
3659 		msleep(2);
3660 
3661 		snd_hda_codec_write(codec, hp_pin, 0,
3662 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3663 
3664 		msleep(75);
3665 
3666 	/* 3k pull low control for Headset jack. */
3667 	/* NOTE: call this before clearing the pin, otherwise codec stalls */
3668 	/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3669 	 * when booting with headset plugged. So skip setting it for the codec alc257
3670 	 */
3671 		if (spec->en_3kpull_low)
3672 			alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3673 
3674 		if (!spec->no_shutup_pins)
3675 			snd_hda_codec_write(codec, hp_pin, 0,
3676 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3677 
3678 		msleep(75);
3679 	}
3680 
3681 	alc_auto_setup_eapd(codec, false);
3682 	alc_shutup_pins(codec);
3683 	if (spec->ultra_low_power) {
3684 		msleep(50);
3685 		alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3686 		alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3687 		alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3688 		alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3689 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3690 		msleep(30);
3691 	}
3692 }
3693 
alc285_hp_init(struct hda_codec * codec)3694 static void alc285_hp_init(struct hda_codec *codec)
3695 {
3696 	struct alc_spec *spec = codec->spec;
3697 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3698 	int i, val;
3699 	int coef38, coef0d, coef36;
3700 
3701 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3702 	alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3703 	coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3704 	coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3705 	coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3706 	alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3707 	alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3708 
3709 	alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3710 
3711 	if (hp_pin)
3712 		snd_hda_codec_write(codec, hp_pin, 0,
3713 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3714 
3715 	msleep(130);
3716 	alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3717 	alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3718 
3719 	if (hp_pin)
3720 		snd_hda_codec_write(codec, hp_pin, 0,
3721 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3722 	msleep(10);
3723 	alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3724 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3725 	alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3726 	alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3727 
3728 	alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3729 	val = alc_read_coefex_idx(codec, 0x58, 0x00);
3730 	for (i = 0; i < 20 && val & 0x8000; i++) {
3731 		msleep(50);
3732 		val = alc_read_coefex_idx(codec, 0x58, 0x00);
3733 	} /* Wait for depop procedure finish  */
3734 
3735 	alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3736 	alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3737 	alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3738 	alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3739 
3740 	msleep(50);
3741 	alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3742 }
3743 
alc225_init(struct hda_codec * codec)3744 static void alc225_init(struct hda_codec *codec)
3745 {
3746 	struct alc_spec *spec = codec->spec;
3747 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3748 	bool hp1_pin_sense, hp2_pin_sense;
3749 
3750 	if (spec->ultra_low_power) {
3751 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3752 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3753 		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3754 		msleep(30);
3755 	}
3756 
3757 	if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3758 		spec->codec_variant != ALC269_TYPE_ALC245)
3759 		/* required only at boot or S3 and S4 resume time */
3760 		if (!spec->done_hp_init ||
3761 			is_s3_resume(codec) ||
3762 			is_s4_resume(codec)) {
3763 			alc285_hp_init(codec);
3764 			spec->done_hp_init = true;
3765 		}
3766 
3767 	if (!hp_pin)
3768 		hp_pin = 0x21;
3769 	msleep(30);
3770 
3771 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3772 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3773 
3774 	if (hp1_pin_sense || hp2_pin_sense) {
3775 		msleep(2);
3776 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3777 
3778 		if (hp1_pin_sense)
3779 			snd_hda_codec_write(codec, hp_pin, 0,
3780 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3781 		if (hp2_pin_sense)
3782 			snd_hda_codec_write(codec, 0x16, 0,
3783 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3784 		msleep(75);
3785 
3786 		if (hp1_pin_sense)
3787 			snd_hda_codec_write(codec, hp_pin, 0,
3788 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3789 		if (hp2_pin_sense)
3790 			snd_hda_codec_write(codec, 0x16, 0,
3791 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3792 
3793 		msleep(75);
3794 		alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3795 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3796 	}
3797 }
3798 
alc225_shutup(struct hda_codec * codec)3799 static void alc225_shutup(struct hda_codec *codec)
3800 {
3801 	struct alc_spec *spec = codec->spec;
3802 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3803 	bool hp1_pin_sense, hp2_pin_sense;
3804 
3805 	if (!hp_pin)
3806 		hp_pin = 0x21;
3807 
3808 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3809 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3810 
3811 	if (hp1_pin_sense || hp2_pin_sense) {
3812 		alc_disable_headset_jack_key(codec);
3813 		/* 3k pull low control for Headset jack. */
3814 		alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3815 		msleep(2);
3816 
3817 		if (hp1_pin_sense)
3818 			snd_hda_codec_write(codec, hp_pin, 0,
3819 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3820 		if (hp2_pin_sense)
3821 			snd_hda_codec_write(codec, 0x16, 0,
3822 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3823 
3824 		msleep(75);
3825 
3826 		if (hp1_pin_sense)
3827 			snd_hda_codec_write(codec, hp_pin, 0,
3828 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3829 		if (hp2_pin_sense)
3830 			snd_hda_codec_write(codec, 0x16, 0,
3831 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3832 
3833 		msleep(75);
3834 		alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3835 		alc_enable_headset_jack_key(codec);
3836 	}
3837 	alc_auto_setup_eapd(codec, false);
3838 	alc_shutup_pins(codec);
3839 	if (spec->ultra_low_power) {
3840 		msleep(50);
3841 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3842 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3843 		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3844 		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3845 		msleep(30);
3846 	}
3847 }
3848 
alc222_init(struct hda_codec * codec)3849 static void alc222_init(struct hda_codec *codec)
3850 {
3851 	struct alc_spec *spec = codec->spec;
3852 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3853 	bool hp1_pin_sense, hp2_pin_sense;
3854 
3855 	if (!hp_pin)
3856 		return;
3857 
3858 	msleep(30);
3859 
3860 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3861 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3862 
3863 	if (hp1_pin_sense || hp2_pin_sense) {
3864 		msleep(2);
3865 
3866 		if (hp1_pin_sense)
3867 			snd_hda_codec_write(codec, hp_pin, 0,
3868 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3869 		if (hp2_pin_sense)
3870 			snd_hda_codec_write(codec, 0x14, 0,
3871 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3872 		msleep(75);
3873 
3874 		if (hp1_pin_sense)
3875 			snd_hda_codec_write(codec, hp_pin, 0,
3876 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3877 		if (hp2_pin_sense)
3878 			snd_hda_codec_write(codec, 0x14, 0,
3879 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3880 
3881 		msleep(75);
3882 	}
3883 }
3884 
alc222_shutup(struct hda_codec * codec)3885 static void alc222_shutup(struct hda_codec *codec)
3886 {
3887 	struct alc_spec *spec = codec->spec;
3888 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3889 	bool hp1_pin_sense, hp2_pin_sense;
3890 
3891 	if (!hp_pin)
3892 		hp_pin = 0x21;
3893 
3894 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3895 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3896 
3897 	if (hp1_pin_sense || hp2_pin_sense) {
3898 		msleep(2);
3899 
3900 		if (hp1_pin_sense)
3901 			snd_hda_codec_write(codec, hp_pin, 0,
3902 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3903 		if (hp2_pin_sense)
3904 			snd_hda_codec_write(codec, 0x14, 0,
3905 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3906 
3907 		msleep(75);
3908 
3909 		if (hp1_pin_sense)
3910 			snd_hda_codec_write(codec, hp_pin, 0,
3911 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3912 		if (hp2_pin_sense)
3913 			snd_hda_codec_write(codec, 0x14, 0,
3914 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3915 
3916 		msleep(75);
3917 	}
3918 	alc_auto_setup_eapd(codec, false);
3919 	alc_shutup_pins(codec);
3920 }
3921 
alc_default_init(struct hda_codec * codec)3922 static void alc_default_init(struct hda_codec *codec)
3923 {
3924 	struct alc_spec *spec = codec->spec;
3925 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3926 	bool hp_pin_sense;
3927 
3928 	if (!hp_pin)
3929 		return;
3930 
3931 	msleep(30);
3932 
3933 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3934 
3935 	if (hp_pin_sense) {
3936 		msleep(2);
3937 
3938 		snd_hda_codec_write(codec, hp_pin, 0,
3939 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3940 
3941 		msleep(75);
3942 
3943 		snd_hda_codec_write(codec, hp_pin, 0,
3944 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3945 		msleep(75);
3946 	}
3947 }
3948 
alc_default_shutup(struct hda_codec * codec)3949 static void alc_default_shutup(struct hda_codec *codec)
3950 {
3951 	struct alc_spec *spec = codec->spec;
3952 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3953 	bool hp_pin_sense;
3954 
3955 	if (!hp_pin) {
3956 		alc269_shutup(codec);
3957 		return;
3958 	}
3959 
3960 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3961 
3962 	if (hp_pin_sense) {
3963 		msleep(2);
3964 
3965 		snd_hda_codec_write(codec, hp_pin, 0,
3966 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3967 
3968 		msleep(75);
3969 
3970 		if (!spec->no_shutup_pins)
3971 			snd_hda_codec_write(codec, hp_pin, 0,
3972 					    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3973 
3974 		msleep(75);
3975 	}
3976 	alc_auto_setup_eapd(codec, false);
3977 	alc_shutup_pins(codec);
3978 }
3979 
alc294_hp_init(struct hda_codec * codec)3980 static void alc294_hp_init(struct hda_codec *codec)
3981 {
3982 	struct alc_spec *spec = codec->spec;
3983 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3984 	int i, val;
3985 
3986 	if (!hp_pin)
3987 		return;
3988 
3989 	snd_hda_codec_write(codec, hp_pin, 0,
3990 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3991 
3992 	msleep(100);
3993 
3994 	if (!spec->no_shutup_pins)
3995 		snd_hda_codec_write(codec, hp_pin, 0,
3996 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3997 
3998 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3999 	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
4000 
4001 	/* Wait for depop procedure finish  */
4002 	val = alc_read_coefex_idx(codec, 0x58, 0x01);
4003 	for (i = 0; i < 20 && val & 0x0080; i++) {
4004 		msleep(50);
4005 		val = alc_read_coefex_idx(codec, 0x58, 0x01);
4006 	}
4007 	/* Set HP depop to auto mode */
4008 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
4009 	msleep(50);
4010 }
4011 
alc294_init(struct hda_codec * codec)4012 static void alc294_init(struct hda_codec *codec)
4013 {
4014 	struct alc_spec *spec = codec->spec;
4015 
4016 	/* required only at boot or S4 resume time */
4017 	if (!spec->done_hp_init ||
4018 	    codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
4019 		alc294_hp_init(codec);
4020 		spec->done_hp_init = true;
4021 	}
4022 	alc_default_init(codec);
4023 }
4024 
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)4025 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
4026 			     unsigned int val)
4027 {
4028 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
4029 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
4030 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
4031 }
4032 
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)4033 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
4034 {
4035 	unsigned int val;
4036 
4037 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
4038 	val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
4039 		& 0xffff;
4040 	val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
4041 		<< 16;
4042 	return val;
4043 }
4044 
alc5505_dsp_halt(struct hda_codec * codec)4045 static void alc5505_dsp_halt(struct hda_codec *codec)
4046 {
4047 	unsigned int val;
4048 
4049 	alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
4050 	alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
4051 	alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
4052 	alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
4053 	alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
4054 	alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
4055 	alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
4056 	val = alc5505_coef_get(codec, 0x6220);
4057 	alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
4058 }
4059 
alc5505_dsp_back_from_halt(struct hda_codec * codec)4060 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
4061 {
4062 	alc5505_coef_set(codec, 0x61b8, 0x04133302);
4063 	alc5505_coef_set(codec, 0x61b0, 0x00005b16);
4064 	alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
4065 	alc5505_coef_set(codec, 0x6230, 0xf80d4011);
4066 	alc5505_coef_set(codec, 0x6220, 0x2002010f);
4067 	alc5505_coef_set(codec, 0x880c, 0x00000004);
4068 }
4069 
alc5505_dsp_init(struct hda_codec * codec)4070 static void alc5505_dsp_init(struct hda_codec *codec)
4071 {
4072 	unsigned int val;
4073 
4074 	alc5505_dsp_halt(codec);
4075 	alc5505_dsp_back_from_halt(codec);
4076 	alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
4077 	alc5505_coef_set(codec, 0x61b0, 0x5b16);
4078 	alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
4079 	alc5505_coef_set(codec, 0x61b4, 0x04132b02);
4080 	alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
4081 	alc5505_coef_set(codec, 0x61b8, 0x041f3302);
4082 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
4083 	alc5505_coef_set(codec, 0x61b8, 0x041b3302);
4084 	alc5505_coef_set(codec, 0x61b8, 0x04173302);
4085 	alc5505_coef_set(codec, 0x61b8, 0x04163302);
4086 	alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4087 	alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4088 	alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4089 
4090 	val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4091 	if (val <= 3)
4092 		alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4093 	else
4094 		alc5505_coef_set(codec, 0x6220, 0x6002018f);
4095 
4096 	alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4097 	alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4098 	alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4099 	alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4100 	alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4101 	alc5505_coef_set(codec, 0x880c, 0x00000003);
4102 	alc5505_coef_set(codec, 0x880c, 0x00000010);
4103 
4104 #ifdef HALT_REALTEK_ALC5505
4105 	alc5505_dsp_halt(codec);
4106 #endif
4107 }
4108 
4109 #ifdef HALT_REALTEK_ALC5505
4110 #define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
4111 #define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
4112 #else
4113 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
4114 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
4115 #endif
4116 
alc269_suspend(struct hda_codec * codec)4117 static int alc269_suspend(struct hda_codec *codec)
4118 {
4119 	struct alc_spec *spec = codec->spec;
4120 
4121 	if (spec->has_alc5505_dsp)
4122 		alc5505_dsp_suspend(codec);
4123 
4124 	return alc_suspend(codec);
4125 }
4126 
alc269_resume(struct hda_codec * codec)4127 static int alc269_resume(struct hda_codec *codec)
4128 {
4129 	struct alc_spec *spec = codec->spec;
4130 
4131 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4132 		alc269vb_toggle_power_output(codec, 0);
4133 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4134 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
4135 		msleep(150);
4136 	}
4137 
4138 	codec->patch_ops.init(codec);
4139 
4140 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4141 		alc269vb_toggle_power_output(codec, 1);
4142 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4143 			(alc_get_coef0(codec) & 0x00ff) == 0x017) {
4144 		msleep(200);
4145 	}
4146 
4147 	snd_hda_regmap_sync(codec);
4148 	hda_call_check_power_status(codec, 0x01);
4149 
4150 	/* on some machine, the BIOS will clear the codec gpio data when enter
4151 	 * suspend, and won't restore the data after resume, so we restore it
4152 	 * in the driver.
4153 	 */
4154 	if (spec->gpio_data)
4155 		alc_write_gpio_data(codec);
4156 
4157 	if (spec->has_alc5505_dsp)
4158 		alc5505_dsp_resume(codec);
4159 
4160 	return 0;
4161 }
4162 
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4163 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4164 						 const struct hda_fixup *fix, int action)
4165 {
4166 	struct alc_spec *spec = codec->spec;
4167 
4168 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4169 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4170 }
4171 
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4172 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4173 						 const struct hda_fixup *fix,
4174 						 int action)
4175 {
4176 	unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4177 	unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4178 
4179 	if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4180 		snd_hda_codec_set_pincfg(codec, 0x19,
4181 			(cfg_headphone & ~AC_DEFCFG_DEVICE) |
4182 			(AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4183 }
4184 
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4185 static void alc269_fixup_hweq(struct hda_codec *codec,
4186 			       const struct hda_fixup *fix, int action)
4187 {
4188 	if (action == HDA_FIXUP_ACT_INIT)
4189 		alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4190 }
4191 
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4192 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4193 				       const struct hda_fixup *fix, int action)
4194 {
4195 	struct alc_spec *spec = codec->spec;
4196 
4197 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4198 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4199 }
4200 
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4201 static void alc271_fixup_dmic(struct hda_codec *codec,
4202 			      const struct hda_fixup *fix, int action)
4203 {
4204 	static const struct hda_verb verbs[] = {
4205 		{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4206 		{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4207 		{}
4208 	};
4209 	unsigned int cfg;
4210 
4211 	if (strcmp(codec->core.chip_name, "ALC271X") &&
4212 	    strcmp(codec->core.chip_name, "ALC269VB"))
4213 		return;
4214 	cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4215 	if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4216 		snd_hda_sequence_write(codec, verbs);
4217 }
4218 
4219 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4220 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4221 					  const struct hda_fixup *fix,
4222 					  int action)
4223 {
4224 	if (action == HDA_FIXUP_ACT_INIT)
4225 		alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4226 }
4227 
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4228 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4229 				 const struct hda_fixup *fix, int action)
4230 {
4231 	struct alc_spec *spec = codec->spec;
4232 
4233 	if (action != HDA_FIXUP_ACT_PROBE)
4234 		return;
4235 
4236 	/* Due to a hardware problem on Lenovo Ideadpad, we need to
4237 	 * fix the sample rate of analog I/O to 44.1kHz
4238 	 */
4239 	spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4240 	spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4241 }
4242 
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4243 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4244 				     const struct hda_fixup *fix, int action)
4245 {
4246 	/* The digital-mic unit sends PDM (differential signal) instead of
4247 	 * the standard PCM, thus you can't record a valid mono stream as is.
4248 	 * Below is a workaround specific to ALC269 to control the dmic
4249 	 * signal source as mono.
4250 	 */
4251 	if (action == HDA_FIXUP_ACT_INIT)
4252 		alc_update_coef_idx(codec, 0x07, 0, 0x80);
4253 }
4254 
alc269_quanta_automute(struct hda_codec * codec)4255 static void alc269_quanta_automute(struct hda_codec *codec)
4256 {
4257 	snd_hda_gen_update_outputs(codec);
4258 
4259 	alc_write_coef_idx(codec, 0x0c, 0x680);
4260 	alc_write_coef_idx(codec, 0x0c, 0x480);
4261 }
4262 
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4263 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4264 				     const struct hda_fixup *fix, int action)
4265 {
4266 	struct alc_spec *spec = codec->spec;
4267 	if (action != HDA_FIXUP_ACT_PROBE)
4268 		return;
4269 	spec->gen.automute_hook = alc269_quanta_automute;
4270 }
4271 
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4272 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4273 					 struct hda_jack_callback *jack)
4274 {
4275 	struct alc_spec *spec = codec->spec;
4276 	int vref;
4277 	msleep(200);
4278 	snd_hda_gen_hp_automute(codec, jack);
4279 
4280 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4281 	msleep(100);
4282 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4283 			    vref);
4284 	msleep(500);
4285 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4286 			    vref);
4287 }
4288 
4289 /*
4290  * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4291  */
4292 struct hda_alc298_mbxinit {
4293 	unsigned char value_0x23;
4294 	unsigned char value_0x25;
4295 };
4296 
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4297 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4298 					 const struct hda_alc298_mbxinit *initval,
4299 					 bool first)
4300 {
4301 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4302 	alc_write_coef_idx(codec, 0x26, 0xb000);
4303 
4304 	if (first)
4305 		snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4306 
4307 	snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4308 	alc_write_coef_idx(codec, 0x26, 0xf000);
4309 	alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4310 
4311 	if (initval->value_0x23 != 0x1e)
4312 		alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4313 
4314 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4315 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4316 }
4317 
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4318 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4319 					   const struct hda_fixup *fix,
4320 					   int action)
4321 {
4322 	/* Initialization magic */
4323 	static const struct hda_alc298_mbxinit dac_init[] = {
4324 		{0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4325 		{0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4326 		{0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4327 		{0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4328 		{0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4329 		{0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4330 		{0x2f, 0x00},
4331 		{0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4332 		{0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4333 		{0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4334 		{}
4335 	};
4336 	const struct hda_alc298_mbxinit *seq;
4337 
4338 	if (action != HDA_FIXUP_ACT_INIT)
4339 		return;
4340 
4341 	/* Start */
4342 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4343 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4344 	alc_write_coef_idx(codec, 0x26, 0xf000);
4345 	alc_write_coef_idx(codec, 0x22, 0x31);
4346 	alc_write_coef_idx(codec, 0x23, 0x0b);
4347 	alc_write_coef_idx(codec, 0x25, 0x00);
4348 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4349 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4350 
4351 	for (seq = dac_init; seq->value_0x23; seq++)
4352 		alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4353 }
4354 
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4355 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4356 				     const struct hda_fixup *fix, int action)
4357 {
4358 	struct alc_spec *spec = codec->spec;
4359 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4360 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4361 		spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4362 	}
4363 }
4364 
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4365 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4366 				bool polarity, bool on)
4367 {
4368 	unsigned int pinval;
4369 
4370 	if (!pin)
4371 		return;
4372 	if (polarity)
4373 		on = !on;
4374 	pinval = snd_hda_codec_get_pin_target(codec, pin);
4375 	pinval &= ~AC_PINCTL_VREFEN;
4376 	pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4377 	/* temporarily power up/down for setting VREF */
4378 	snd_hda_power_up_pm(codec);
4379 	snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4380 	snd_hda_power_down_pm(codec);
4381 }
4382 
4383 /* 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)4384 static int vref_mute_led_set(struct led_classdev *led_cdev,
4385 			     enum led_brightness brightness)
4386 {
4387 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4388 	struct alc_spec *spec = codec->spec;
4389 
4390 	alc_update_vref_led(codec, spec->mute_led_nid,
4391 			    spec->mute_led_polarity, brightness);
4392 	return 0;
4393 }
4394 
4395 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4396 static unsigned int led_power_filter(struct hda_codec *codec,
4397 						  hda_nid_t nid,
4398 						  unsigned int power_state)
4399 {
4400 	struct alc_spec *spec = codec->spec;
4401 
4402 	if (power_state != AC_PWRST_D3 || nid == 0 ||
4403 	    (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4404 		return power_state;
4405 
4406 	/* Set pin ctl again, it might have just been set to 0 */
4407 	snd_hda_set_pin_ctl(codec, nid,
4408 			    snd_hda_codec_get_pin_target(codec, nid));
4409 
4410 	return snd_hda_gen_path_power_filter(codec, nid, power_state);
4411 }
4412 
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4413 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4414 				     const struct hda_fixup *fix, int action)
4415 {
4416 	struct alc_spec *spec = codec->spec;
4417 	const struct dmi_device *dev = NULL;
4418 
4419 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4420 		return;
4421 
4422 	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4423 		int pol, pin;
4424 		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4425 			continue;
4426 		if (pin < 0x0a || pin >= 0x10)
4427 			break;
4428 		spec->mute_led_polarity = pol;
4429 		spec->mute_led_nid = pin - 0x0a + 0x18;
4430 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4431 		codec->power_filter = led_power_filter;
4432 		codec_dbg(codec,
4433 			  "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4434 			   spec->mute_led_polarity);
4435 		break;
4436 	}
4437 }
4438 
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4439 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4440 					  const struct hda_fixup *fix,
4441 					  int action, hda_nid_t pin)
4442 {
4443 	struct alc_spec *spec = codec->spec;
4444 
4445 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4446 		spec->mute_led_polarity = 0;
4447 		spec->mute_led_nid = pin;
4448 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4449 		codec->power_filter = led_power_filter;
4450 	}
4451 }
4452 
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4453 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4454 				const struct hda_fixup *fix, int action)
4455 {
4456 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4457 }
4458 
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4459 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4460 				const struct hda_fixup *fix, int action)
4461 {
4462 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4463 }
4464 
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4465 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4466 				const struct hda_fixup *fix, int action)
4467 {
4468 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4469 }
4470 
4471 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4472 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4473 				int polarity, bool enabled)
4474 {
4475 	if (polarity)
4476 		enabled = !enabled;
4477 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4478 }
4479 
4480 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4481 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4482 			     enum led_brightness brightness)
4483 {
4484 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4485 	struct alc_spec *spec = codec->spec;
4486 
4487 	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4488 			    spec->mute_led_polarity, !brightness);
4489 	return 0;
4490 }
4491 
4492 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4493 static int micmute_led_set(struct led_classdev *led_cdev,
4494 			   enum led_brightness brightness)
4495 {
4496 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4497 	struct alc_spec *spec = codec->spec;
4498 
4499 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4500 			    spec->micmute_led_polarity, !brightness);
4501 	return 0;
4502 }
4503 
4504 /* 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)4505 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4506 				  int action,
4507 				  unsigned int mute_mask,
4508 				  unsigned int micmute_mask)
4509 {
4510 	struct alc_spec *spec = codec->spec;
4511 
4512 	alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4513 
4514 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4515 		return;
4516 	if (mute_mask) {
4517 		spec->gpio_mute_led_mask = mute_mask;
4518 		snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4519 	}
4520 	if (micmute_mask) {
4521 		spec->gpio_mic_led_mask = micmute_mask;
4522 		snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4523 	}
4524 }
4525 
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4526 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4527 				const struct hda_fixup *fix, int action)
4528 {
4529 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4530 }
4531 
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4532 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4533 				const struct hda_fixup *fix, int action)
4534 {
4535 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4536 }
4537 
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4538 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4539 				const struct hda_fixup *fix, int action)
4540 {
4541 	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4542 }
4543 
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4544 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4545 				const struct hda_fixup *fix, int action)
4546 {
4547 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4548 }
4549 
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4550 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4551 				const struct hda_fixup *fix, int action)
4552 {
4553 	alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4554 }
4555 
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4556 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4557 				const struct hda_fixup *fix, int action)
4558 {
4559 	struct alc_spec *spec = codec->spec;
4560 
4561 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4562 		spec->micmute_led_polarity = 1;
4563 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4564 }
4565 
4566 /* 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)4567 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4568 				enum led_brightness brightness)
4569 {
4570 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4571 	struct alc_spec *spec = codec->spec;
4572 
4573 	alc_update_vref_led(codec, spec->cap_mute_led_nid,
4574 			    spec->micmute_led_polarity, brightness);
4575 	return 0;
4576 }
4577 
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4578 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4579 				const struct hda_fixup *fix, int action)
4580 {
4581 	struct alc_spec *spec = codec->spec;
4582 
4583 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4584 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4585 		/* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4586 		 * enable headphone amp
4587 		 */
4588 		spec->gpio_mask |= 0x10;
4589 		spec->gpio_dir |= 0x10;
4590 		spec->cap_mute_led_nid = 0x18;
4591 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4592 		codec->power_filter = led_power_filter;
4593 	}
4594 }
4595 
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4596 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4597 				   const struct hda_fixup *fix, int action)
4598 {
4599 	struct alc_spec *spec = codec->spec;
4600 
4601 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4602 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4603 		spec->cap_mute_led_nid = 0x18;
4604 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4605 		codec->power_filter = led_power_filter;
4606 	}
4607 }
4608 
4609 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4610  * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4611  */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4612 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4613 				     const struct hda_fixup *fix, int action)
4614 {
4615 	struct alc_spec *spec = codec->spec;
4616 
4617 	switch (action) {
4618 	case HDA_FIXUP_ACT_PRE_PROBE:
4619 		spec->gpio_mask |= 0x01;
4620 		spec->gpio_dir |= 0x01;
4621 		break;
4622 	case HDA_FIXUP_ACT_INIT:
4623 		/* need to toggle GPIO to enable the amp */
4624 		alc_update_gpio_data(codec, 0x01, true);
4625 		msleep(100);
4626 		alc_update_gpio_data(codec, 0x01, false);
4627 		break;
4628 	}
4629 }
4630 
4631 /* 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)4632 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4633 				    struct hda_codec *codec,
4634 				    struct snd_pcm_substream *substream,
4635 				    int action)
4636 {
4637 	switch (action) {
4638 	case HDA_GEN_PCM_ACT_PREPARE:
4639 		alc_update_gpio_data(codec, 0x04, true);
4640 		break;
4641 	case HDA_GEN_PCM_ACT_CLEANUP:
4642 		alc_update_gpio_data(codec, 0x04, false);
4643 		break;
4644 	}
4645 }
4646 
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4647 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4648 				      const struct hda_fixup *fix,
4649 				      int action)
4650 {
4651 	struct alc_spec *spec = codec->spec;
4652 
4653 	if (action == HDA_FIXUP_ACT_PROBE) {
4654 		spec->gpio_mask |= 0x04;
4655 		spec->gpio_dir |= 0x04;
4656 		spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4657 	}
4658 }
4659 
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4660 static void alc_update_coef_led(struct hda_codec *codec,
4661 				struct alc_coef_led *led,
4662 				bool polarity, bool on)
4663 {
4664 	if (polarity)
4665 		on = !on;
4666 	/* temporarily power up/down for setting COEF bit */
4667 	alc_update_coef_idx(codec, led->idx, led->mask,
4668 			    on ? led->on : led->off);
4669 }
4670 
4671 /* 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)4672 static int coef_mute_led_set(struct led_classdev *led_cdev,
4673 			     enum led_brightness brightness)
4674 {
4675 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4676 	struct alc_spec *spec = codec->spec;
4677 
4678 	alc_update_coef_led(codec, &spec->mute_led_coef,
4679 			    spec->mute_led_polarity, brightness);
4680 	return 0;
4681 }
4682 
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4683 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4684 					  const struct hda_fixup *fix,
4685 					  int action)
4686 {
4687 	struct alc_spec *spec = codec->spec;
4688 
4689 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4690 		spec->mute_led_polarity = 0;
4691 		spec->mute_led_coef.idx = 0x0b;
4692 		spec->mute_led_coef.mask = 1 << 3;
4693 		spec->mute_led_coef.on = 1 << 3;
4694 		spec->mute_led_coef.off = 0;
4695 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4696 	}
4697 }
4698 
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4699 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4700 					  const struct hda_fixup *fix,
4701 					  int action)
4702 {
4703 	struct alc_spec *spec = codec->spec;
4704 
4705 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4706 		spec->mute_led_polarity = 0;
4707 		spec->mute_led_coef.idx = 0x34;
4708 		spec->mute_led_coef.mask = 1 << 5;
4709 		spec->mute_led_coef.on = 0;
4710 		spec->mute_led_coef.off = 1 << 5;
4711 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4712 	}
4713 }
4714 
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4715 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4716 					  const struct hda_fixup *fix, int action)
4717 {
4718 	struct alc_spec *spec = codec->spec;
4719 
4720 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4721 		spec->mute_led_polarity = 0;
4722 		spec->mute_led_coef.idx = 0x07;
4723 		spec->mute_led_coef.mask = 1;
4724 		spec->mute_led_coef.on = 1;
4725 		spec->mute_led_coef.off = 0;
4726 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4727 	}
4728 }
4729 
alc245_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4730 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4731 					  const struct hda_fixup *fix,
4732 					  int action)
4733 {
4734 	struct alc_spec *spec = codec->spec;
4735 
4736 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4737 		spec->mute_led_polarity = 0;
4738 		spec->mute_led_coef.idx = 0x0b;
4739 		spec->mute_led_coef.mask = 3 << 2;
4740 		spec->mute_led_coef.on = 2 << 2;
4741 		spec->mute_led_coef.off = 1 << 2;
4742 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4743 	}
4744 }
4745 
alc245_fixup_hp_mute_led_v1_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4746 static void alc245_fixup_hp_mute_led_v1_coefbit(struct hda_codec *codec,
4747 					  const struct hda_fixup *fix,
4748 					  int action)
4749 {
4750 	struct alc_spec *spec = codec->spec;
4751 
4752 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4753 		spec->mute_led_polarity = 0;
4754 		spec->mute_led_coef.idx = 0x0b;
4755 		spec->mute_led_coef.mask = 1 << 3;
4756 		spec->mute_led_coef.on = 1 << 3;
4757 		spec->mute_led_coef.off = 0;
4758 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4759 	}
4760 }
4761 
4762 /* 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)4763 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4764 				enum led_brightness brightness)
4765 {
4766 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4767 	struct alc_spec *spec = codec->spec;
4768 
4769 	alc_update_coef_led(codec, &spec->mic_led_coef,
4770 			    spec->micmute_led_polarity, brightness);
4771 	return 0;
4772 }
4773 
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4774 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4775 				const struct hda_fixup *fix, int action)
4776 {
4777 	struct alc_spec *spec = codec->spec;
4778 
4779 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4780 		spec->mic_led_coef.idx = 0x19;
4781 		spec->mic_led_coef.mask = 1 << 13;
4782 		spec->mic_led_coef.on = 1 << 13;
4783 		spec->mic_led_coef.off = 0;
4784 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4785 	}
4786 }
4787 
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4788 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4789 				const struct hda_fixup *fix, int action)
4790 {
4791 	struct alc_spec *spec = codec->spec;
4792 
4793 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4794 		spec->micmute_led_polarity = 1;
4795 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4796 }
4797 
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4798 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4799 				const struct hda_fixup *fix, int action)
4800 {
4801 	struct alc_spec *spec = codec->spec;
4802 
4803 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4804 		spec->mic_led_coef.idx = 0x35;
4805 		spec->mic_led_coef.mask = 3 << 2;
4806 		spec->mic_led_coef.on = 2 << 2;
4807 		spec->mic_led_coef.off = 1 << 2;
4808 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4809 	}
4810 }
4811 
alc295_fixup_hp_mute_led_coefbit11(struct hda_codec * codec,const struct hda_fixup * fix,int action)4812 static void alc295_fixup_hp_mute_led_coefbit11(struct hda_codec *codec,
4813 				const struct hda_fixup *fix, int action)
4814 {
4815 	struct alc_spec *spec = codec->spec;
4816 
4817 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4818 		spec->mute_led_polarity = 0;
4819 		spec->mute_led_coef.idx = 0xb;
4820 		spec->mute_led_coef.mask = 3 << 3;
4821 		spec->mute_led_coef.on = 1 << 3;
4822 		spec->mute_led_coef.off = 1 << 4;
4823 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4824 	}
4825 }
4826 
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4827 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4828 				const struct hda_fixup *fix, int action)
4829 {
4830 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4831 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4832 }
4833 
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4834 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4835 				const struct hda_fixup *fix, int action)
4836 {
4837 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4838 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4839 }
4840 
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4841 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4842 				const struct hda_fixup *fix, int action)
4843 {
4844 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4845 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4846 }
4847 
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4848 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4849 				const struct hda_fixup *fix, int action)
4850 {
4851 	struct alc_spec *spec = codec->spec;
4852 
4853 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4854 		spec->cap_mute_led_nid = 0x1a;
4855 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4856 		codec->power_filter = led_power_filter;
4857 	}
4858 }
4859 
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4860 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4861 				const struct hda_fixup *fix, int action)
4862 {
4863 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4864 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4865 }
4866 
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4867 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4868 						  const unsigned short coefs[2])
4869 {
4870 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4871 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4872 	alc_write_coef_idx(codec, 0x26, 0xb011);
4873 }
4874 
4875 struct alc298_samsung_amp_desc {
4876 	unsigned char nid;
4877 	unsigned short init_seq[2][2];
4878 };
4879 
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4880 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4881 				     const struct hda_fixup *fix, int action)
4882 {
4883 	int i, j;
4884 	static const unsigned short init_seq[][2] = {
4885 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4886 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4887 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4888 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4889 	};
4890 	static const struct alc298_samsung_amp_desc amps[] = {
4891 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4892 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4893 	};
4894 
4895 	if (action != HDA_FIXUP_ACT_INIT)
4896 		return;
4897 
4898 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4899 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4900 
4901 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4902 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4903 
4904 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4905 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4906 	}
4907 }
4908 
4909 struct alc298_samsung_v2_amp_desc {
4910 	unsigned short nid;
4911 	int init_seq_size;
4912 	unsigned short init_seq[18][2];
4913 };
4914 
4915 static const struct alc298_samsung_v2_amp_desc
4916 alc298_samsung_v2_amp_desc_tbl[] = {
4917 	{ 0x38, 18, {
4918 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4919 		{ 0x201b, 0x0001 }, { 0x201d, 0x0001 }, { 0x201f, 0x00fe },
4920 		{ 0x2021, 0x0000 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4921 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4922 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x2399, 0x0003 },
4923 		{ 0x23a4, 0x00b5 }, { 0x23a5, 0x0001 }, { 0x23ba, 0x0094 }
4924 	}},
4925 	{ 0x39, 18, {
4926 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4927 		{ 0x201b, 0x0002 }, { 0x201d, 0x0002 }, { 0x201f, 0x00fd },
4928 		{ 0x2021, 0x0001 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4929 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4930 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x2399, 0x0003 },
4931 		{ 0x23a4, 0x00b5 }, { 0x23a5, 0x0001 }, { 0x23ba, 0x0094 }
4932 	}},
4933 	{ 0x3c, 15, {
4934 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4935 		{ 0x201b, 0x0001 }, { 0x201d, 0x0001 }, { 0x201f, 0x00fe },
4936 		{ 0x2021, 0x0000 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4937 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4938 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x23ba, 0x008d }
4939 	}},
4940 	{ 0x3d, 15, {
4941 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4942 		{ 0x201b, 0x0002 }, { 0x201d, 0x0002 }, { 0x201f, 0x00fd },
4943 		{ 0x2021, 0x0001 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4944 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4945 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x23ba, 0x008d }
4946 	}}
4947 };
4948 
alc298_samsung_v2_enable_amps(struct hda_codec * codec)4949 static void alc298_samsung_v2_enable_amps(struct hda_codec *codec)
4950 {
4951 	struct alc_spec *spec = codec->spec;
4952 	static const unsigned short enable_seq[][2] = {
4953 		{ 0x203a, 0x0081 }, { 0x23ff, 0x0001 },
4954 	};
4955 	int i, j;
4956 
4957 	for (i = 0; i < spec->num_speaker_amps; i++) {
4958 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4959 		for (j = 0; j < ARRAY_SIZE(enable_seq); j++)
4960 			alc298_samsung_write_coef_pack(codec, enable_seq[j]);
4961 		codec_dbg(codec, "alc298_samsung_v2: Enabled speaker amp 0x%02x\n",
4962 				alc298_samsung_v2_amp_desc_tbl[i].nid);
4963 	}
4964 }
4965 
alc298_samsung_v2_disable_amps(struct hda_codec * codec)4966 static void alc298_samsung_v2_disable_amps(struct hda_codec *codec)
4967 {
4968 	struct alc_spec *spec = codec->spec;
4969 	static const unsigned short disable_seq[][2] = {
4970 		{ 0x23ff, 0x0000 }, { 0x203a, 0x0080 },
4971 	};
4972 	int i, j;
4973 
4974 	for (i = 0; i < spec->num_speaker_amps; i++) {
4975 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4976 		for (j = 0; j < ARRAY_SIZE(disable_seq); j++)
4977 			alc298_samsung_write_coef_pack(codec, disable_seq[j]);
4978 		codec_dbg(codec, "alc298_samsung_v2: Disabled speaker amp 0x%02x\n",
4979 				alc298_samsung_v2_amp_desc_tbl[i].nid);
4980 	}
4981 }
4982 
alc298_samsung_v2_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)4983 static void alc298_samsung_v2_playback_hook(struct hda_pcm_stream *hinfo,
4984 				struct hda_codec *codec,
4985 				struct snd_pcm_substream *substream,
4986 				int action)
4987 {
4988 	/* Dynamically enable/disable speaker amps before and after playback */
4989 	if (action == HDA_GEN_PCM_ACT_OPEN)
4990 		alc298_samsung_v2_enable_amps(codec);
4991 	if (action == HDA_GEN_PCM_ACT_CLOSE)
4992 		alc298_samsung_v2_disable_amps(codec);
4993 }
4994 
alc298_samsung_v2_init_amps(struct hda_codec * codec,int num_speaker_amps)4995 static void alc298_samsung_v2_init_amps(struct hda_codec *codec,
4996 				int num_speaker_amps)
4997 {
4998 	struct alc_spec *spec = codec->spec;
4999 	int i, j;
5000 
5001 	/* Set spec's num_speaker_amps before doing anything else */
5002 	spec->num_speaker_amps = num_speaker_amps;
5003 
5004 	/* Disable speaker amps before init to prevent any physical damage */
5005 	alc298_samsung_v2_disable_amps(codec);
5006 
5007 	/* Initialize the speaker amps */
5008 	for (i = 0; i < spec->num_speaker_amps; i++) {
5009 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
5010 		for (j = 0; j < alc298_samsung_v2_amp_desc_tbl[i].init_seq_size; j++) {
5011 			alc298_samsung_write_coef_pack(codec,
5012 					alc298_samsung_v2_amp_desc_tbl[i].init_seq[j]);
5013 		}
5014 		alc_write_coef_idx(codec, 0x89, 0x0);
5015 		codec_dbg(codec, "alc298_samsung_v2: Initialized speaker amp 0x%02x\n",
5016 				alc298_samsung_v2_amp_desc_tbl[i].nid);
5017 	}
5018 
5019 	/* register hook to enable speaker amps only when they are needed */
5020 	spec->gen.pcm_playback_hook = alc298_samsung_v2_playback_hook;
5021 }
5022 
alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec * codec,const struct hda_fixup * fix,int action)5023 static void alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec *codec,
5024 				const struct hda_fixup *fix, int action)
5025 {
5026 	if (action == HDA_FIXUP_ACT_PROBE)
5027 		alc298_samsung_v2_init_amps(codec, 2);
5028 }
5029 
alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec * codec,const struct hda_fixup * fix,int action)5030 static void alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec *codec,
5031 				const struct hda_fixup *fix, int action)
5032 {
5033 	if (action == HDA_FIXUP_ACT_PROBE)
5034 		alc298_samsung_v2_init_amps(codec, 4);
5035 }
5036 
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)5037 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
5038 				   struct hda_jack_callback *event)
5039 {
5040 	struct alc_spec *spec = codec->spec;
5041 
5042 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
5043 	   send both key on and key off event for every interrupt. */
5044 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
5045 	input_sync(spec->kb_dev);
5046 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
5047 	input_sync(spec->kb_dev);
5048 }
5049 
alc_register_micmute_input_device(struct hda_codec * codec)5050 static int alc_register_micmute_input_device(struct hda_codec *codec)
5051 {
5052 	struct alc_spec *spec = codec->spec;
5053 	int i;
5054 
5055 	spec->kb_dev = input_allocate_device();
5056 	if (!spec->kb_dev) {
5057 		codec_err(codec, "Out of memory (input_allocate_device)\n");
5058 		return -ENOMEM;
5059 	}
5060 
5061 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
5062 
5063 	spec->kb_dev->name = "Microphone Mute Button";
5064 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
5065 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
5066 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
5067 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
5068 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
5069 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
5070 
5071 	if (input_register_device(spec->kb_dev)) {
5072 		codec_err(codec, "input_register_device failed\n");
5073 		input_free_device(spec->kb_dev);
5074 		spec->kb_dev = NULL;
5075 		return -ENOMEM;
5076 	}
5077 
5078 	return 0;
5079 }
5080 
5081 /* GPIO1 = set according to SKU external amp
5082  * GPIO2 = mic mute hotkey
5083  * GPIO3 = mute LED
5084  * GPIO4 = mic mute LED
5085  */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)5086 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
5087 					     const struct hda_fixup *fix, int action)
5088 {
5089 	struct alc_spec *spec = codec->spec;
5090 
5091 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
5092 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5093 		spec->init_amp = ALC_INIT_DEFAULT;
5094 		if (alc_register_micmute_input_device(codec) != 0)
5095 			return;
5096 
5097 		spec->gpio_mask |= 0x06;
5098 		spec->gpio_dir |= 0x02;
5099 		spec->gpio_data |= 0x02;
5100 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
5101 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
5102 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
5103 						    gpio2_mic_hotkey_event);
5104 		return;
5105 	}
5106 
5107 	if (!spec->kb_dev)
5108 		return;
5109 
5110 	switch (action) {
5111 	case HDA_FIXUP_ACT_FREE:
5112 		input_unregister_device(spec->kb_dev);
5113 		spec->kb_dev = NULL;
5114 	}
5115 }
5116 
5117 /* Line2 = mic mute hotkey
5118  * GPIO2 = mic mute LED
5119  */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)5120 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
5121 					     const struct hda_fixup *fix, int action)
5122 {
5123 	struct alc_spec *spec = codec->spec;
5124 
5125 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
5126 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5127 		spec->init_amp = ALC_INIT_DEFAULT;
5128 		if (alc_register_micmute_input_device(codec) != 0)
5129 			return;
5130 
5131 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
5132 						    gpio2_mic_hotkey_event);
5133 		return;
5134 	}
5135 
5136 	if (!spec->kb_dev)
5137 		return;
5138 
5139 	switch (action) {
5140 	case HDA_FIXUP_ACT_FREE:
5141 		input_unregister_device(spec->kb_dev);
5142 		spec->kb_dev = NULL;
5143 	}
5144 }
5145 
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)5146 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
5147 				const struct hda_fixup *fix, int action)
5148 {
5149 	struct alc_spec *spec = codec->spec;
5150 
5151 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
5152 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5153 		spec->cap_mute_led_nid = 0x18;
5154 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
5155 	}
5156 }
5157 
alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)5158 static void alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec *codec,
5159 				const struct hda_fixup *fix, int action)
5160 {
5161 	struct alc_spec *spec = codec->spec;
5162 
5163 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
5164 		spec->micmute_led_polarity = 1;
5165 	alc233_fixup_lenovo_line2_mic_hotkey(codec, fix, action);
5166 }
5167 
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)5168 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
5169 {
5170 	if (delay <= 0)
5171 		delay = 75;
5172 	snd_hda_codec_write(codec, 0x21, 0,
5173 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5174 	msleep(delay);
5175 	snd_hda_codec_write(codec, 0x21, 0,
5176 		    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5177 	msleep(delay);
5178 }
5179 
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)5180 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
5181 {
5182 	if (delay <= 0)
5183 		delay = 75;
5184 	snd_hda_codec_write(codec, 0x21, 0,
5185 		    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5186 	msleep(delay);
5187 	snd_hda_codec_write(codec, 0x21, 0,
5188 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5189 	msleep(delay);
5190 }
5191 
5192 static const struct coef_fw alc225_pre_hsmode[] = {
5193 	UPDATE_COEF(0x4a, 1<<8, 0),
5194 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
5195 	UPDATE_COEF(0x63, 3<<14, 3<<14),
5196 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
5197 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
5198 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
5199 	UPDATE_COEF(0x4a, 3<<10, 0),
5200 	{}
5201 };
5202 
alc_headset_mode_unplugged(struct hda_codec * codec)5203 static void alc_headset_mode_unplugged(struct hda_codec *codec)
5204 {
5205 	struct alc_spec *spec = codec->spec;
5206 	static const struct coef_fw coef0255[] = {
5207 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
5208 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5209 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5210 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5211 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
5212 		{}
5213 	};
5214 	static const struct coef_fw coef0256[] = {
5215 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
5216 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5217 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5218 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
5219 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5220 		{}
5221 	};
5222 	static const struct coef_fw coef0233[] = {
5223 		WRITE_COEF(0x1b, 0x0c0b),
5224 		WRITE_COEF(0x45, 0xc429),
5225 		UPDATE_COEF(0x35, 0x4000, 0),
5226 		WRITE_COEF(0x06, 0x2104),
5227 		WRITE_COEF(0x1a, 0x0001),
5228 		WRITE_COEF(0x26, 0x0004),
5229 		WRITE_COEF(0x32, 0x42a3),
5230 		{}
5231 	};
5232 	static const struct coef_fw coef0288[] = {
5233 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5234 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5235 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5236 		UPDATE_COEF(0x66, 0x0008, 0),
5237 		UPDATE_COEF(0x67, 0x2000, 0),
5238 		{}
5239 	};
5240 	static const struct coef_fw coef0298[] = {
5241 		UPDATE_COEF(0x19, 0x1300, 0x0300),
5242 		{}
5243 	};
5244 	static const struct coef_fw coef0292[] = {
5245 		WRITE_COEF(0x76, 0x000e),
5246 		WRITE_COEF(0x6c, 0x2400),
5247 		WRITE_COEF(0x18, 0x7308),
5248 		WRITE_COEF(0x6b, 0xc429),
5249 		{}
5250 	};
5251 	static const struct coef_fw coef0293[] = {
5252 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5253 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5254 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5255 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5256 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5257 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5258 		{}
5259 	};
5260 	static const struct coef_fw coef0668[] = {
5261 		WRITE_COEF(0x15, 0x0d40),
5262 		WRITE_COEF(0xb7, 0x802b),
5263 		{}
5264 	};
5265 	static const struct coef_fw coef0225[] = {
5266 		UPDATE_COEF(0x63, 3<<14, 0),
5267 		{}
5268 	};
5269 	static const struct coef_fw coef0274[] = {
5270 		UPDATE_COEF(0x4a, 0x0100, 0),
5271 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5272 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
5273 		UPDATE_COEF(0x4a, 0x0010, 0),
5274 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5275 		WRITE_COEF(0x45, 0x5289),
5276 		UPDATE_COEF(0x4a, 0x0c00, 0),
5277 		{}
5278 	};
5279 
5280 	if (spec->no_internal_mic_pin) {
5281 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5282 		return;
5283 	}
5284 
5285 	switch (codec->core.vendor_id) {
5286 	case 0x10ec0255:
5287 		alc_process_coef_fw(codec, coef0255);
5288 		break;
5289 	case 0x10ec0230:
5290 	case 0x10ec0236:
5291 	case 0x10ec0256:
5292 	case 0x19e58326:
5293 		alc_hp_mute_disable(codec, 75);
5294 		alc_process_coef_fw(codec, coef0256);
5295 		break;
5296 	case 0x10ec0234:
5297 	case 0x10ec0274:
5298 	case 0x10ec0294:
5299 		alc_process_coef_fw(codec, coef0274);
5300 		break;
5301 	case 0x10ec0233:
5302 	case 0x10ec0283:
5303 		alc_process_coef_fw(codec, coef0233);
5304 		break;
5305 	case 0x10ec0286:
5306 	case 0x10ec0288:
5307 		alc_process_coef_fw(codec, coef0288);
5308 		break;
5309 	case 0x10ec0298:
5310 		alc_process_coef_fw(codec, coef0298);
5311 		alc_process_coef_fw(codec, coef0288);
5312 		break;
5313 	case 0x10ec0292:
5314 		alc_process_coef_fw(codec, coef0292);
5315 		break;
5316 	case 0x10ec0293:
5317 		alc_process_coef_fw(codec, coef0293);
5318 		break;
5319 	case 0x10ec0668:
5320 		alc_process_coef_fw(codec, coef0668);
5321 		break;
5322 	case 0x10ec0215:
5323 	case 0x10ec0225:
5324 	case 0x10ec0285:
5325 	case 0x10ec0295:
5326 	case 0x10ec0289:
5327 	case 0x10ec0299:
5328 		alc_hp_mute_disable(codec, 75);
5329 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5330 		alc_process_coef_fw(codec, coef0225);
5331 		break;
5332 	case 0x10ec0867:
5333 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5334 		break;
5335 	}
5336 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5337 }
5338 
5339 
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5340 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5341 				    hda_nid_t mic_pin)
5342 {
5343 	static const struct coef_fw coef0255[] = {
5344 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5345 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5346 		{}
5347 	};
5348 	static const struct coef_fw coef0256[] = {
5349 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5350 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5351 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5352 		{}
5353 	};
5354 	static const struct coef_fw coef0233[] = {
5355 		UPDATE_COEF(0x35, 0, 1<<14),
5356 		WRITE_COEF(0x06, 0x2100),
5357 		WRITE_COEF(0x1a, 0x0021),
5358 		WRITE_COEF(0x26, 0x008c),
5359 		{}
5360 	};
5361 	static const struct coef_fw coef0288[] = {
5362 		UPDATE_COEF(0x4f, 0x00c0, 0),
5363 		UPDATE_COEF(0x50, 0x2000, 0),
5364 		UPDATE_COEF(0x56, 0x0006, 0),
5365 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5366 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5367 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5368 		{}
5369 	};
5370 	static const struct coef_fw coef0292[] = {
5371 		WRITE_COEF(0x19, 0xa208),
5372 		WRITE_COEF(0x2e, 0xacf0),
5373 		{}
5374 	};
5375 	static const struct coef_fw coef0293[] = {
5376 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5377 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5378 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5379 		{}
5380 	};
5381 	static const struct coef_fw coef0688[] = {
5382 		WRITE_COEF(0xb7, 0x802b),
5383 		WRITE_COEF(0xb5, 0x1040),
5384 		UPDATE_COEF(0xc3, 0, 1<<12),
5385 		{}
5386 	};
5387 	static const struct coef_fw coef0225[] = {
5388 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5389 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5390 		UPDATE_COEF(0x63, 3<<14, 0),
5391 		{}
5392 	};
5393 	static const struct coef_fw coef0274[] = {
5394 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5395 		UPDATE_COEF(0x4a, 0x0010, 0),
5396 		UPDATE_COEF(0x6b, 0xf000, 0),
5397 		{}
5398 	};
5399 
5400 	switch (codec->core.vendor_id) {
5401 	case 0x10ec0255:
5402 		alc_write_coef_idx(codec, 0x45, 0xc489);
5403 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5404 		alc_process_coef_fw(codec, coef0255);
5405 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5406 		break;
5407 	case 0x10ec0230:
5408 	case 0x10ec0236:
5409 	case 0x10ec0256:
5410 	case 0x19e58326:
5411 		alc_write_coef_idx(codec, 0x45, 0xc489);
5412 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5413 		alc_process_coef_fw(codec, coef0256);
5414 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5415 		break;
5416 	case 0x10ec0234:
5417 	case 0x10ec0274:
5418 	case 0x10ec0294:
5419 		alc_write_coef_idx(codec, 0x45, 0x4689);
5420 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5421 		alc_process_coef_fw(codec, coef0274);
5422 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5423 		break;
5424 	case 0x10ec0233:
5425 	case 0x10ec0283:
5426 		alc_write_coef_idx(codec, 0x45, 0xc429);
5427 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5428 		alc_process_coef_fw(codec, coef0233);
5429 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5430 		break;
5431 	case 0x10ec0286:
5432 	case 0x10ec0288:
5433 	case 0x10ec0298:
5434 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5435 		alc_process_coef_fw(codec, coef0288);
5436 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5437 		break;
5438 	case 0x10ec0292:
5439 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5440 		alc_process_coef_fw(codec, coef0292);
5441 		break;
5442 	case 0x10ec0293:
5443 		/* Set to TRS mode */
5444 		alc_write_coef_idx(codec, 0x45, 0xc429);
5445 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5446 		alc_process_coef_fw(codec, coef0293);
5447 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5448 		break;
5449 	case 0x10ec0867:
5450 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5451 		fallthrough;
5452 	case 0x10ec0221:
5453 	case 0x10ec0662:
5454 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5455 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5456 		break;
5457 	case 0x10ec0668:
5458 		alc_write_coef_idx(codec, 0x11, 0x0001);
5459 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5460 		alc_process_coef_fw(codec, coef0688);
5461 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5462 		break;
5463 	case 0x10ec0215:
5464 	case 0x10ec0225:
5465 	case 0x10ec0285:
5466 	case 0x10ec0295:
5467 	case 0x10ec0289:
5468 	case 0x10ec0299:
5469 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5470 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5471 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5472 		alc_process_coef_fw(codec, coef0225);
5473 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5474 		break;
5475 	}
5476 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5477 }
5478 
alc_headset_mode_default(struct hda_codec * codec)5479 static void alc_headset_mode_default(struct hda_codec *codec)
5480 {
5481 	static const struct coef_fw coef0225[] = {
5482 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5483 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5484 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5485 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5486 		UPDATE_COEF(0x63, 3<<14, 0),
5487 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5488 		{}
5489 	};
5490 	static const struct coef_fw coef0255[] = {
5491 		WRITE_COEF(0x45, 0xc089),
5492 		WRITE_COEF(0x45, 0xc489),
5493 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5494 		WRITE_COEF(0x49, 0x0049),
5495 		{}
5496 	};
5497 	static const struct coef_fw coef0256[] = {
5498 		WRITE_COEF(0x45, 0xc489),
5499 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5500 		WRITE_COEF(0x49, 0x0049),
5501 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5502 		WRITE_COEF(0x06, 0x6100),
5503 		{}
5504 	};
5505 	static const struct coef_fw coef0233[] = {
5506 		WRITE_COEF(0x06, 0x2100),
5507 		WRITE_COEF(0x32, 0x4ea3),
5508 		{}
5509 	};
5510 	static const struct coef_fw coef0288[] = {
5511 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5512 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5513 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5514 		UPDATE_COEF(0x66, 0x0008, 0),
5515 		UPDATE_COEF(0x67, 0x2000, 0),
5516 		{}
5517 	};
5518 	static const struct coef_fw coef0292[] = {
5519 		WRITE_COEF(0x76, 0x000e),
5520 		WRITE_COEF(0x6c, 0x2400),
5521 		WRITE_COEF(0x6b, 0xc429),
5522 		WRITE_COEF(0x18, 0x7308),
5523 		{}
5524 	};
5525 	static const struct coef_fw coef0293[] = {
5526 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5527 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5528 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5529 		{}
5530 	};
5531 	static const struct coef_fw coef0688[] = {
5532 		WRITE_COEF(0x11, 0x0041),
5533 		WRITE_COEF(0x15, 0x0d40),
5534 		WRITE_COEF(0xb7, 0x802b),
5535 		{}
5536 	};
5537 	static const struct coef_fw coef0274[] = {
5538 		WRITE_COEF(0x45, 0x4289),
5539 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5540 		UPDATE_COEF(0x6b, 0x0f00, 0),
5541 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5542 		{}
5543 	};
5544 
5545 	switch (codec->core.vendor_id) {
5546 	case 0x10ec0215:
5547 	case 0x10ec0225:
5548 	case 0x10ec0285:
5549 	case 0x10ec0295:
5550 	case 0x10ec0289:
5551 	case 0x10ec0299:
5552 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5553 		alc_process_coef_fw(codec, coef0225);
5554 		alc_hp_enable_unmute(codec, 75);
5555 		break;
5556 	case 0x10ec0255:
5557 		alc_process_coef_fw(codec, coef0255);
5558 		break;
5559 	case 0x10ec0230:
5560 	case 0x10ec0236:
5561 	case 0x10ec0256:
5562 	case 0x19e58326:
5563 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5564 		alc_write_coef_idx(codec, 0x45, 0xc089);
5565 		msleep(50);
5566 		alc_process_coef_fw(codec, coef0256);
5567 		alc_hp_enable_unmute(codec, 75);
5568 		break;
5569 	case 0x10ec0234:
5570 	case 0x10ec0274:
5571 	case 0x10ec0294:
5572 		alc_process_coef_fw(codec, coef0274);
5573 		break;
5574 	case 0x10ec0233:
5575 	case 0x10ec0283:
5576 		alc_process_coef_fw(codec, coef0233);
5577 		break;
5578 	case 0x10ec0286:
5579 	case 0x10ec0288:
5580 	case 0x10ec0298:
5581 		alc_process_coef_fw(codec, coef0288);
5582 		break;
5583 	case 0x10ec0292:
5584 		alc_process_coef_fw(codec, coef0292);
5585 		break;
5586 	case 0x10ec0293:
5587 		alc_process_coef_fw(codec, coef0293);
5588 		break;
5589 	case 0x10ec0668:
5590 		alc_process_coef_fw(codec, coef0688);
5591 		break;
5592 	case 0x10ec0867:
5593 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5594 		break;
5595 	}
5596 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5597 }
5598 
5599 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5600 static void alc_headset_mode_ctia(struct hda_codec *codec)
5601 {
5602 	int val;
5603 
5604 	static const struct coef_fw coef0255[] = {
5605 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5606 		WRITE_COEF(0x1b, 0x0c2b),
5607 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5608 		{}
5609 	};
5610 	static const struct coef_fw coef0256[] = {
5611 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5612 		WRITE_COEF(0x1b, 0x0e6b),
5613 		{}
5614 	};
5615 	static const struct coef_fw coef0233[] = {
5616 		WRITE_COEF(0x45, 0xd429),
5617 		WRITE_COEF(0x1b, 0x0c2b),
5618 		WRITE_COEF(0x32, 0x4ea3),
5619 		{}
5620 	};
5621 	static const struct coef_fw coef0288[] = {
5622 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5623 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5624 		UPDATE_COEF(0x66, 0x0008, 0),
5625 		UPDATE_COEF(0x67, 0x2000, 0),
5626 		{}
5627 	};
5628 	static const struct coef_fw coef0292[] = {
5629 		WRITE_COEF(0x6b, 0xd429),
5630 		WRITE_COEF(0x76, 0x0008),
5631 		WRITE_COEF(0x18, 0x7388),
5632 		{}
5633 	};
5634 	static const struct coef_fw coef0293[] = {
5635 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5636 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5637 		{}
5638 	};
5639 	static const struct coef_fw coef0688[] = {
5640 		WRITE_COEF(0x11, 0x0001),
5641 		WRITE_COEF(0x15, 0x0d60),
5642 		WRITE_COEF(0xc3, 0x0000),
5643 		{}
5644 	};
5645 	static const struct coef_fw coef0225_1[] = {
5646 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5647 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5648 		{}
5649 	};
5650 	static const struct coef_fw coef0225_2[] = {
5651 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5652 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5653 		{}
5654 	};
5655 
5656 	switch (codec->core.vendor_id) {
5657 	case 0x10ec0255:
5658 		alc_process_coef_fw(codec, coef0255);
5659 		break;
5660 	case 0x10ec0230:
5661 	case 0x10ec0236:
5662 	case 0x10ec0256:
5663 	case 0x19e58326:
5664 		alc_process_coef_fw(codec, coef0256);
5665 		alc_hp_enable_unmute(codec, 75);
5666 		break;
5667 	case 0x10ec0234:
5668 	case 0x10ec0274:
5669 	case 0x10ec0294:
5670 		alc_write_coef_idx(codec, 0x45, 0xd689);
5671 		break;
5672 	case 0x10ec0233:
5673 	case 0x10ec0283:
5674 		alc_process_coef_fw(codec, coef0233);
5675 		break;
5676 	case 0x10ec0298:
5677 		val = alc_read_coef_idx(codec, 0x50);
5678 		if (val & (1 << 12)) {
5679 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5680 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5681 			msleep(300);
5682 		} else {
5683 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5684 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5685 			msleep(300);
5686 		}
5687 		break;
5688 	case 0x10ec0286:
5689 	case 0x10ec0288:
5690 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5691 		msleep(300);
5692 		alc_process_coef_fw(codec, coef0288);
5693 		break;
5694 	case 0x10ec0292:
5695 		alc_process_coef_fw(codec, coef0292);
5696 		break;
5697 	case 0x10ec0293:
5698 		alc_process_coef_fw(codec, coef0293);
5699 		break;
5700 	case 0x10ec0668:
5701 		alc_process_coef_fw(codec, coef0688);
5702 		break;
5703 	case 0x10ec0215:
5704 	case 0x10ec0225:
5705 	case 0x10ec0285:
5706 	case 0x10ec0295:
5707 	case 0x10ec0289:
5708 	case 0x10ec0299:
5709 		val = alc_read_coef_idx(codec, 0x45);
5710 		if (val & (1 << 9))
5711 			alc_process_coef_fw(codec, coef0225_2);
5712 		else
5713 			alc_process_coef_fw(codec, coef0225_1);
5714 		alc_hp_enable_unmute(codec, 75);
5715 		break;
5716 	case 0x10ec0867:
5717 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5718 		break;
5719 	}
5720 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5721 }
5722 
5723 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5724 static void alc_headset_mode_omtp(struct hda_codec *codec)
5725 {
5726 	static const struct coef_fw coef0255[] = {
5727 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5728 		WRITE_COEF(0x1b, 0x0c2b),
5729 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5730 		{}
5731 	};
5732 	static const struct coef_fw coef0256[] = {
5733 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5734 		WRITE_COEF(0x1b, 0x0e6b),
5735 		{}
5736 	};
5737 	static const struct coef_fw coef0233[] = {
5738 		WRITE_COEF(0x45, 0xe429),
5739 		WRITE_COEF(0x1b, 0x0c2b),
5740 		WRITE_COEF(0x32, 0x4ea3),
5741 		{}
5742 	};
5743 	static const struct coef_fw coef0288[] = {
5744 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5745 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5746 		UPDATE_COEF(0x66, 0x0008, 0),
5747 		UPDATE_COEF(0x67, 0x2000, 0),
5748 		{}
5749 	};
5750 	static const struct coef_fw coef0292[] = {
5751 		WRITE_COEF(0x6b, 0xe429),
5752 		WRITE_COEF(0x76, 0x0008),
5753 		WRITE_COEF(0x18, 0x7388),
5754 		{}
5755 	};
5756 	static const struct coef_fw coef0293[] = {
5757 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5758 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5759 		{}
5760 	};
5761 	static const struct coef_fw coef0688[] = {
5762 		WRITE_COEF(0x11, 0x0001),
5763 		WRITE_COEF(0x15, 0x0d50),
5764 		WRITE_COEF(0xc3, 0x0000),
5765 		{}
5766 	};
5767 	static const struct coef_fw coef0225[] = {
5768 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5769 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5770 		{}
5771 	};
5772 
5773 	switch (codec->core.vendor_id) {
5774 	case 0x10ec0255:
5775 		alc_process_coef_fw(codec, coef0255);
5776 		break;
5777 	case 0x10ec0230:
5778 	case 0x10ec0236:
5779 	case 0x10ec0256:
5780 	case 0x19e58326:
5781 		alc_process_coef_fw(codec, coef0256);
5782 		alc_hp_enable_unmute(codec, 75);
5783 		break;
5784 	case 0x10ec0234:
5785 	case 0x10ec0274:
5786 	case 0x10ec0294:
5787 		alc_write_coef_idx(codec, 0x45, 0xe689);
5788 		break;
5789 	case 0x10ec0233:
5790 	case 0x10ec0283:
5791 		alc_process_coef_fw(codec, coef0233);
5792 		break;
5793 	case 0x10ec0298:
5794 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5795 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5796 		msleep(300);
5797 		break;
5798 	case 0x10ec0286:
5799 	case 0x10ec0288:
5800 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5801 		msleep(300);
5802 		alc_process_coef_fw(codec, coef0288);
5803 		break;
5804 	case 0x10ec0292:
5805 		alc_process_coef_fw(codec, coef0292);
5806 		break;
5807 	case 0x10ec0293:
5808 		alc_process_coef_fw(codec, coef0293);
5809 		break;
5810 	case 0x10ec0668:
5811 		alc_process_coef_fw(codec, coef0688);
5812 		break;
5813 	case 0x10ec0215:
5814 	case 0x10ec0225:
5815 	case 0x10ec0285:
5816 	case 0x10ec0295:
5817 	case 0x10ec0289:
5818 	case 0x10ec0299:
5819 		alc_process_coef_fw(codec, coef0225);
5820 		alc_hp_enable_unmute(codec, 75);
5821 		break;
5822 	}
5823 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5824 }
5825 
alc_determine_headset_type(struct hda_codec * codec)5826 static void alc_determine_headset_type(struct hda_codec *codec)
5827 {
5828 	int val;
5829 	bool is_ctia = false;
5830 	struct alc_spec *spec = codec->spec;
5831 	static const struct coef_fw coef0255[] = {
5832 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5833 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5834  conteol) */
5835 		{}
5836 	};
5837 	static const struct coef_fw coef0288[] = {
5838 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5839 		{}
5840 	};
5841 	static const struct coef_fw coef0298[] = {
5842 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5843 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5844 		UPDATE_COEF(0x66, 0x0008, 0),
5845 		UPDATE_COEF(0x67, 0x2000, 0),
5846 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5847 		{}
5848 	};
5849 	static const struct coef_fw coef0293[] = {
5850 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5851 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5852 		{}
5853 	};
5854 	static const struct coef_fw coef0688[] = {
5855 		WRITE_COEF(0x11, 0x0001),
5856 		WRITE_COEF(0xb7, 0x802b),
5857 		WRITE_COEF(0x15, 0x0d60),
5858 		WRITE_COEF(0xc3, 0x0c00),
5859 		{}
5860 	};
5861 	static const struct coef_fw coef0274[] = {
5862 		UPDATE_COEF(0x4a, 0x0010, 0),
5863 		UPDATE_COEF(0x4a, 0x8000, 0),
5864 		WRITE_COEF(0x45, 0xd289),
5865 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5866 		{}
5867 	};
5868 
5869 	if (spec->no_internal_mic_pin) {
5870 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5871 		return;
5872 	}
5873 
5874 	switch (codec->core.vendor_id) {
5875 	case 0x10ec0255:
5876 		alc_process_coef_fw(codec, coef0255);
5877 		msleep(300);
5878 		val = alc_read_coef_idx(codec, 0x46);
5879 		is_ctia = (val & 0x0070) == 0x0070;
5880 		break;
5881 	case 0x10ec0230:
5882 	case 0x10ec0236:
5883 	case 0x10ec0256:
5884 	case 0x19e58326:
5885 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5886 		alc_write_coef_idx(codec, 0x06, 0x6104);
5887 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5888 
5889 		alc_process_coef_fw(codec, coef0255);
5890 		msleep(300);
5891 		val = alc_read_coef_idx(codec, 0x46);
5892 		is_ctia = (val & 0x0070) == 0x0070;
5893 		if (!is_ctia) {
5894 			alc_write_coef_idx(codec, 0x45, 0xe089);
5895 			msleep(100);
5896 			val = alc_read_coef_idx(codec, 0x46);
5897 			if ((val & 0x0070) == 0x0070)
5898 				is_ctia = false;
5899 			else
5900 				is_ctia = true;
5901 		}
5902 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5903 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5904 		break;
5905 	case 0x10ec0234:
5906 	case 0x10ec0274:
5907 	case 0x10ec0294:
5908 		alc_process_coef_fw(codec, coef0274);
5909 		msleep(850);
5910 		val = alc_read_coef_idx(codec, 0x46);
5911 		is_ctia = (val & 0x00f0) == 0x00f0;
5912 		break;
5913 	case 0x10ec0233:
5914 	case 0x10ec0283:
5915 		alc_write_coef_idx(codec, 0x45, 0xd029);
5916 		msleep(300);
5917 		val = alc_read_coef_idx(codec, 0x46);
5918 		is_ctia = (val & 0x0070) == 0x0070;
5919 		break;
5920 	case 0x10ec0298:
5921 		snd_hda_codec_write(codec, 0x21, 0,
5922 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5923 		msleep(100);
5924 		snd_hda_codec_write(codec, 0x21, 0,
5925 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5926 		msleep(200);
5927 
5928 		val = alc_read_coef_idx(codec, 0x50);
5929 		if (val & (1 << 12)) {
5930 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5931 			alc_process_coef_fw(codec, coef0288);
5932 			msleep(350);
5933 			val = alc_read_coef_idx(codec, 0x50);
5934 			is_ctia = (val & 0x0070) == 0x0070;
5935 		} else {
5936 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5937 			alc_process_coef_fw(codec, coef0288);
5938 			msleep(350);
5939 			val = alc_read_coef_idx(codec, 0x50);
5940 			is_ctia = (val & 0x0070) == 0x0070;
5941 		}
5942 		alc_process_coef_fw(codec, coef0298);
5943 		snd_hda_codec_write(codec, 0x21, 0,
5944 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5945 		msleep(75);
5946 		snd_hda_codec_write(codec, 0x21, 0,
5947 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5948 		break;
5949 	case 0x10ec0286:
5950 	case 0x10ec0288:
5951 		alc_process_coef_fw(codec, coef0288);
5952 		msleep(350);
5953 		val = alc_read_coef_idx(codec, 0x50);
5954 		is_ctia = (val & 0x0070) == 0x0070;
5955 		break;
5956 	case 0x10ec0292:
5957 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5958 		msleep(300);
5959 		val = alc_read_coef_idx(codec, 0x6c);
5960 		is_ctia = (val & 0x001c) == 0x001c;
5961 		break;
5962 	case 0x10ec0293:
5963 		alc_process_coef_fw(codec, coef0293);
5964 		msleep(300);
5965 		val = alc_read_coef_idx(codec, 0x46);
5966 		is_ctia = (val & 0x0070) == 0x0070;
5967 		break;
5968 	case 0x10ec0668:
5969 		alc_process_coef_fw(codec, coef0688);
5970 		msleep(300);
5971 		val = alc_read_coef_idx(codec, 0xbe);
5972 		is_ctia = (val & 0x1c02) == 0x1c02;
5973 		break;
5974 	case 0x10ec0215:
5975 	case 0x10ec0225:
5976 	case 0x10ec0285:
5977 	case 0x10ec0295:
5978 	case 0x10ec0289:
5979 	case 0x10ec0299:
5980 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5981 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5982 		val = alc_read_coef_idx(codec, 0x45);
5983 		if (val & (1 << 9)) {
5984 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5985 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5986 			msleep(800);
5987 			val = alc_read_coef_idx(codec, 0x46);
5988 			is_ctia = (val & 0x00f0) == 0x00f0;
5989 		} else {
5990 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5991 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5992 			msleep(800);
5993 			val = alc_read_coef_idx(codec, 0x46);
5994 			is_ctia = (val & 0x00f0) == 0x00f0;
5995 		}
5996 		if (!is_ctia) {
5997 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5998 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5999 			msleep(100);
6000 			val = alc_read_coef_idx(codec, 0x46);
6001 			if ((val & 0x00f0) == 0x00f0)
6002 				is_ctia = false;
6003 			else
6004 				is_ctia = true;
6005 		}
6006 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
6007 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
6008 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
6009 		break;
6010 	case 0x10ec0867:
6011 		is_ctia = true;
6012 		break;
6013 	}
6014 
6015 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
6016 		  str_yes_no(is_ctia));
6017 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
6018 }
6019 
alc_update_headset_mode(struct hda_codec * codec)6020 static void alc_update_headset_mode(struct hda_codec *codec)
6021 {
6022 	struct alc_spec *spec = codec->spec;
6023 
6024 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
6025 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
6026 
6027 	int new_headset_mode;
6028 
6029 	if (!snd_hda_jack_detect(codec, hp_pin))
6030 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
6031 	else if (mux_pin == spec->headset_mic_pin)
6032 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
6033 	else if (mux_pin == spec->headphone_mic_pin)
6034 		new_headset_mode = ALC_HEADSET_MODE_MIC;
6035 	else
6036 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
6037 
6038 	if (new_headset_mode == spec->current_headset_mode) {
6039 		snd_hda_gen_update_outputs(codec);
6040 		return;
6041 	}
6042 
6043 	switch (new_headset_mode) {
6044 	case ALC_HEADSET_MODE_UNPLUGGED:
6045 		alc_headset_mode_unplugged(codec);
6046 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
6047 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
6048 		spec->gen.hp_jack_present = false;
6049 		break;
6050 	case ALC_HEADSET_MODE_HEADSET:
6051 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
6052 			alc_determine_headset_type(codec);
6053 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
6054 			alc_headset_mode_ctia(codec);
6055 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
6056 			alc_headset_mode_omtp(codec);
6057 		spec->gen.hp_jack_present = true;
6058 		break;
6059 	case ALC_HEADSET_MODE_MIC:
6060 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
6061 		spec->gen.hp_jack_present = false;
6062 		break;
6063 	case ALC_HEADSET_MODE_HEADPHONE:
6064 		alc_headset_mode_default(codec);
6065 		spec->gen.hp_jack_present = true;
6066 		break;
6067 	}
6068 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
6069 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
6070 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
6071 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
6072 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
6073 						  PIN_VREFHIZ);
6074 	}
6075 	spec->current_headset_mode = new_headset_mode;
6076 
6077 	snd_hda_gen_update_outputs(codec);
6078 }
6079 
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)6080 static void alc_update_headset_mode_hook(struct hda_codec *codec,
6081 					 struct snd_kcontrol *kcontrol,
6082 					 struct snd_ctl_elem_value *ucontrol)
6083 {
6084 	alc_update_headset_mode(codec);
6085 }
6086 
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)6087 static void alc_update_headset_jack_cb(struct hda_codec *codec,
6088 				       struct hda_jack_callback *jack)
6089 {
6090 	snd_hda_gen_hp_automute(codec, jack);
6091 	alc_update_headset_mode(codec);
6092 }
6093 
alc_probe_headset_mode(struct hda_codec * codec)6094 static void alc_probe_headset_mode(struct hda_codec *codec)
6095 {
6096 	int i;
6097 	struct alc_spec *spec = codec->spec;
6098 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6099 
6100 	/* Find mic pins */
6101 	for (i = 0; i < cfg->num_inputs; i++) {
6102 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
6103 			spec->headset_mic_pin = cfg->inputs[i].pin;
6104 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
6105 			spec->headphone_mic_pin = cfg->inputs[i].pin;
6106 	}
6107 
6108 	WARN_ON(spec->gen.cap_sync_hook);
6109 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
6110 	spec->gen.automute_hook = alc_update_headset_mode;
6111 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
6112 }
6113 
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)6114 static void alc_fixup_headset_mode(struct hda_codec *codec,
6115 				const struct hda_fixup *fix, int action)
6116 {
6117 	struct alc_spec *spec = codec->spec;
6118 
6119 	switch (action) {
6120 	case HDA_FIXUP_ACT_PRE_PROBE:
6121 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
6122 		break;
6123 	case HDA_FIXUP_ACT_PROBE:
6124 		alc_probe_headset_mode(codec);
6125 		break;
6126 	case HDA_FIXUP_ACT_INIT:
6127 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
6128 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
6129 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
6130 		}
6131 		alc_update_headset_mode(codec);
6132 		break;
6133 	}
6134 }
6135 
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6136 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
6137 				const struct hda_fixup *fix, int action)
6138 {
6139 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6140 		struct alc_spec *spec = codec->spec;
6141 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6142 	}
6143 	else
6144 		alc_fixup_headset_mode(codec, fix, action);
6145 }
6146 
alc255_set_default_jack_type(struct hda_codec * codec)6147 static void alc255_set_default_jack_type(struct hda_codec *codec)
6148 {
6149 	/* Set to iphone type */
6150 	static const struct coef_fw alc255fw[] = {
6151 		WRITE_COEF(0x1b, 0x880b),
6152 		WRITE_COEF(0x45, 0xd089),
6153 		WRITE_COEF(0x1b, 0x080b),
6154 		WRITE_COEF(0x46, 0x0004),
6155 		WRITE_COEF(0x1b, 0x0c0b),
6156 		{}
6157 	};
6158 	static const struct coef_fw alc256fw[] = {
6159 		WRITE_COEF(0x1b, 0x884b),
6160 		WRITE_COEF(0x45, 0xd089),
6161 		WRITE_COEF(0x1b, 0x084b),
6162 		WRITE_COEF(0x46, 0x0004),
6163 		WRITE_COEF(0x1b, 0x0c4b),
6164 		{}
6165 	};
6166 	switch (codec->core.vendor_id) {
6167 	case 0x10ec0255:
6168 		alc_process_coef_fw(codec, alc255fw);
6169 		break;
6170 	case 0x10ec0230:
6171 	case 0x10ec0236:
6172 	case 0x10ec0256:
6173 	case 0x19e58326:
6174 		alc_process_coef_fw(codec, alc256fw);
6175 		break;
6176 	}
6177 	msleep(30);
6178 }
6179 
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)6180 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
6181 				const struct hda_fixup *fix, int action)
6182 {
6183 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6184 		alc255_set_default_jack_type(codec);
6185 	}
6186 	alc_fixup_headset_mode(codec, fix, action);
6187 }
6188 
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6189 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
6190 				const struct hda_fixup *fix, int action)
6191 {
6192 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6193 		struct alc_spec *spec = codec->spec;
6194 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6195 		alc255_set_default_jack_type(codec);
6196 	}
6197 	else
6198 		alc_fixup_headset_mode(codec, fix, action);
6199 }
6200 
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)6201 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
6202 				       struct hda_jack_callback *jack)
6203 {
6204 	struct alc_spec *spec = codec->spec;
6205 
6206 	alc_update_headset_jack_cb(codec, jack);
6207 	/* Headset Mic enable or disable, only for Dell Dino */
6208 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
6209 }
6210 
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)6211 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
6212 				const struct hda_fixup *fix, int action)
6213 {
6214 	alc_fixup_headset_mode(codec, fix, action);
6215 	if (action == HDA_FIXUP_ACT_PROBE) {
6216 		struct alc_spec *spec = codec->spec;
6217 		/* toggled via hp_automute_hook */
6218 		spec->gpio_mask |= 0x40;
6219 		spec->gpio_dir |= 0x40;
6220 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
6221 	}
6222 }
6223 
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6224 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
6225 					const struct hda_fixup *fix, int action)
6226 {
6227 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6228 		struct alc_spec *spec = codec->spec;
6229 		spec->gen.auto_mute_via_amp = 1;
6230 	}
6231 }
6232 
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)6233 static void alc_fixup_no_shutup(struct hda_codec *codec,
6234 				const struct hda_fixup *fix, int action)
6235 {
6236 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6237 		struct alc_spec *spec = codec->spec;
6238 		spec->no_shutup_pins = 1;
6239 	}
6240 }
6241 
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)6242 static void alc_fixup_disable_aamix(struct hda_codec *codec,
6243 				    const struct hda_fixup *fix, int action)
6244 {
6245 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6246 		struct alc_spec *spec = codec->spec;
6247 		/* Disable AA-loopback as it causes white noise */
6248 		spec->gen.mixer_nid = 0;
6249 	}
6250 }
6251 
6252 /* 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)6253 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6254 				  const struct hda_fixup *fix, int action)
6255 {
6256 	static const struct hda_pintbl pincfgs[] = {
6257 		{ 0x16, 0x21211010 }, /* dock headphone */
6258 		{ 0x19, 0x21a11010 }, /* dock mic */
6259 		{ }
6260 	};
6261 	struct alc_spec *spec = codec->spec;
6262 
6263 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6264 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6265 		codec->power_save_node = 0; /* avoid click noises */
6266 		snd_hda_apply_pincfgs(codec, pincfgs);
6267 	}
6268 }
6269 
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6270 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6271 				  const struct hda_fixup *fix, int action)
6272 {
6273 	static const struct hda_pintbl pincfgs[] = {
6274 		{ 0x17, 0x21211010 }, /* dock headphone */
6275 		{ 0x19, 0x21a11010 }, /* dock mic */
6276 		{ }
6277 	};
6278 	struct alc_spec *spec = codec->spec;
6279 
6280 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6281 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6282 		snd_hda_apply_pincfgs(codec, pincfgs);
6283 	} else if (action == HDA_FIXUP_ACT_INIT) {
6284 		/* Enable DOCK device */
6285 		snd_hda_codec_write(codec, 0x17, 0,
6286 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6287 		/* Enable DOCK device */
6288 		snd_hda_codec_write(codec, 0x19, 0,
6289 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6290 	}
6291 }
6292 
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6293 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6294 				  const struct hda_fixup *fix, int action)
6295 {
6296 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6297 	 * the speaker output becomes too low by some reason on Thinkpads with
6298 	 * ALC298 codec
6299 	 */
6300 	static const hda_nid_t preferred_pairs[] = {
6301 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6302 		0
6303 	};
6304 	struct alc_spec *spec = codec->spec;
6305 
6306 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6307 		spec->gen.preferred_dacs = preferred_pairs;
6308 }
6309 
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6310 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6311 				   const struct hda_fixup *fix, int action)
6312 {
6313 	static const hda_nid_t preferred_pairs[] = {
6314 		0x17, 0x02, 0x21, 0x03, 0
6315 	};
6316 	struct alc_spec *spec = codec->spec;
6317 
6318 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6319 		spec->gen.preferred_dacs = preferred_pairs;
6320 }
6321 
alc_shutup_dell_xps13(struct hda_codec * codec)6322 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6323 {
6324 	struct alc_spec *spec = codec->spec;
6325 	int hp_pin = alc_get_hp_pin(spec);
6326 
6327 	/* Prevent pop noises when headphones are plugged in */
6328 	snd_hda_codec_write(codec, hp_pin, 0,
6329 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6330 	msleep(20);
6331 }
6332 
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6333 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6334 				const struct hda_fixup *fix, int action)
6335 {
6336 	struct alc_spec *spec = codec->spec;
6337 	struct hda_input_mux *imux = &spec->gen.input_mux;
6338 	int i;
6339 
6340 	switch (action) {
6341 	case HDA_FIXUP_ACT_PRE_PROBE:
6342 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6343 		 * it causes a click noise at start up
6344 		 */
6345 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6346 		spec->shutup = alc_shutup_dell_xps13;
6347 		break;
6348 	case HDA_FIXUP_ACT_PROBE:
6349 		/* Make the internal mic the default input source. */
6350 		for (i = 0; i < imux->num_items; i++) {
6351 			if (spec->gen.imux_pins[i] == 0x12) {
6352 				spec->gen.cur_mux[0] = i;
6353 				break;
6354 			}
6355 		}
6356 		break;
6357 	}
6358 }
6359 
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6360 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6361 				const struct hda_fixup *fix, int action)
6362 {
6363 	struct alc_spec *spec = codec->spec;
6364 
6365 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6366 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6367 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6368 
6369 		/* Disable boost for mic-in permanently. (This code is only called
6370 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6371 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6372 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6373 	} else
6374 		alc_fixup_headset_mode(codec, fix, action);
6375 }
6376 
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6377 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6378 				const struct hda_fixup *fix, int action)
6379 {
6380 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6381 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6382 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6383 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6384 	}
6385 	alc_fixup_headset_mode(codec, fix, action);
6386 }
6387 
6388 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6389 static int find_ext_mic_pin(struct hda_codec *codec)
6390 {
6391 	struct alc_spec *spec = codec->spec;
6392 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6393 	hda_nid_t nid;
6394 	unsigned int defcfg;
6395 	int i;
6396 
6397 	for (i = 0; i < cfg->num_inputs; i++) {
6398 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6399 			continue;
6400 		nid = cfg->inputs[i].pin;
6401 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6402 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6403 			continue;
6404 		return nid;
6405 	}
6406 
6407 	return 0;
6408 }
6409 
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6410 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6411 				    const struct hda_fixup *fix,
6412 				    int action)
6413 {
6414 	struct alc_spec *spec = codec->spec;
6415 
6416 	if (action == HDA_FIXUP_ACT_PROBE) {
6417 		int mic_pin = find_ext_mic_pin(codec);
6418 		int hp_pin = alc_get_hp_pin(spec);
6419 
6420 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6421 			return;
6422 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6423 	}
6424 }
6425 
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6426 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6427 					     const struct hda_fixup *fix,
6428 					     int action)
6429 {
6430 	struct alc_spec *spec = codec->spec;
6431 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6432 	int i;
6433 
6434 	/* The mic boosts on level 2 and 3 are too noisy
6435 	   on the internal mic input.
6436 	   Therefore limit the boost to 0 or 1. */
6437 
6438 	if (action != HDA_FIXUP_ACT_PROBE)
6439 		return;
6440 
6441 	for (i = 0; i < cfg->num_inputs; i++) {
6442 		hda_nid_t nid = cfg->inputs[i].pin;
6443 		unsigned int defcfg;
6444 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6445 			continue;
6446 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6447 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6448 			continue;
6449 
6450 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6451 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6452 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6453 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6454 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6455 	}
6456 }
6457 
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6458 static void alc283_hp_automute_hook(struct hda_codec *codec,
6459 				    struct hda_jack_callback *jack)
6460 {
6461 	struct alc_spec *spec = codec->spec;
6462 	int vref;
6463 
6464 	msleep(200);
6465 	snd_hda_gen_hp_automute(codec, jack);
6466 
6467 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6468 
6469 	msleep(600);
6470 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6471 			    vref);
6472 }
6473 
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6474 static void alc283_fixup_chromebook(struct hda_codec *codec,
6475 				    const struct hda_fixup *fix, int action)
6476 {
6477 	struct alc_spec *spec = codec->spec;
6478 
6479 	switch (action) {
6480 	case HDA_FIXUP_ACT_PRE_PROBE:
6481 		snd_hda_override_wcaps(codec, 0x03, 0);
6482 		/* Disable AA-loopback as it causes white noise */
6483 		spec->gen.mixer_nid = 0;
6484 		break;
6485 	case HDA_FIXUP_ACT_INIT:
6486 		/* MIC2-VREF control */
6487 		/* Set to manual mode */
6488 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6489 		/* Enable Line1 input control by verb */
6490 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6491 		break;
6492 	}
6493 }
6494 
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6495 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6496 				    const struct hda_fixup *fix, int action)
6497 {
6498 	struct alc_spec *spec = codec->spec;
6499 
6500 	switch (action) {
6501 	case HDA_FIXUP_ACT_PRE_PROBE:
6502 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6503 		break;
6504 	case HDA_FIXUP_ACT_INIT:
6505 		/* MIC2-VREF control */
6506 		/* Set to manual mode */
6507 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6508 		break;
6509 	}
6510 }
6511 
6512 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6513 static void asus_tx300_automute(struct hda_codec *codec)
6514 {
6515 	struct alc_spec *spec = codec->spec;
6516 	snd_hda_gen_update_outputs(codec);
6517 	if (snd_hda_jack_detect(codec, 0x1b))
6518 		spec->gen.mute_bits |= (1ULL << 0x14);
6519 }
6520 
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6521 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6522 				    const struct hda_fixup *fix, int action)
6523 {
6524 	struct alc_spec *spec = codec->spec;
6525 	static const struct hda_pintbl dock_pins[] = {
6526 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6527 		{}
6528 	};
6529 
6530 	switch (action) {
6531 	case HDA_FIXUP_ACT_PRE_PROBE:
6532 		spec->init_amp = ALC_INIT_DEFAULT;
6533 		/* TX300 needs to set up GPIO2 for the speaker amp */
6534 		alc_setup_gpio(codec, 0x04);
6535 		snd_hda_apply_pincfgs(codec, dock_pins);
6536 		spec->gen.auto_mute_via_amp = 1;
6537 		spec->gen.automute_hook = asus_tx300_automute;
6538 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6539 						    snd_hda_gen_hp_automute);
6540 		break;
6541 	case HDA_FIXUP_ACT_PROBE:
6542 		spec->init_amp = ALC_INIT_DEFAULT;
6543 		break;
6544 	case HDA_FIXUP_ACT_BUILD:
6545 		/* this is a bit tricky; give more sane names for the main
6546 		 * (tablet) speaker and the dock speaker, respectively
6547 		 */
6548 		rename_ctl(codec, "Speaker Playback Switch",
6549 			   "Dock Speaker Playback Switch");
6550 		rename_ctl(codec, "Bass Speaker Playback Switch",
6551 			   "Speaker Playback Switch");
6552 		break;
6553 	}
6554 }
6555 
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6556 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6557 				       const struct hda_fixup *fix, int action)
6558 {
6559 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6560 		/* DAC node 0x03 is giving mono output. We therefore want to
6561 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6562 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6563 		static const hda_nid_t conn1[] = { 0x0c };
6564 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6565 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6566 	}
6567 }
6568 
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6569 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6570 					const struct hda_fixup *fix, int action)
6571 {
6572 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6573 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6574 		   we can't adjust the speaker's volume since this node does not has
6575 		   Amp-out capability. we change the speaker's route to:
6576 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6577 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6578 		   speaker's volume now. */
6579 
6580 		static const hda_nid_t conn1[] = { 0x0c };
6581 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6582 	}
6583 }
6584 
6585 /* 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)6586 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6587 				      const struct hda_fixup *fix, int action)
6588 {
6589 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6590 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6591 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6592 	}
6593 }
6594 
6595 /* 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)6596 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6597 					  const struct hda_fixup *fix, int action)
6598 {
6599 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6600 		static const hda_nid_t conn[] = { 0x02 };
6601 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6602 	}
6603 }
6604 
6605 /* disable DAC3 (0x06) selection on NID 0x15 - share Speaker/Bass Speaker DAC 0x03 */
alc294_fixup_bass_speaker_15(struct hda_codec * codec,const struct hda_fixup * fix,int action)6606 static void alc294_fixup_bass_speaker_15(struct hda_codec *codec,
6607 					 const struct hda_fixup *fix, int action)
6608 {
6609 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6610 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6611 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
6612 	}
6613 }
6614 
6615 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6616 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6617 					  struct hda_jack_callback *jack)
6618 {
6619 	struct alc_spec *spec = codec->spec;
6620 
6621 	snd_hda_gen_hp_automute(codec, jack);
6622 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6623 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6624 			    !spec->gen.hp_jack_present);
6625 }
6626 
6627 /* Manage GPIOs for HP EliteBook Folio 9480m.
6628  *
6629  * GPIO4 is the headphone amplifier power control
6630  * GPIO3 is the audio output mute indicator LED
6631  */
6632 
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6633 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6634 				  const struct hda_fixup *fix,
6635 				  int action)
6636 {
6637 	struct alc_spec *spec = codec->spec;
6638 
6639 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6640 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6641 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6642 		spec->gpio_mask |= 0x10;
6643 		spec->gpio_dir |= 0x10;
6644 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6645 	}
6646 }
6647 
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6648 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6649 				   const struct hda_fixup *fix,
6650 				   int action)
6651 {
6652 	struct alc_spec *spec = codec->spec;
6653 
6654 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6655 		spec->gpio_mask |= 0x04;
6656 		spec->gpio_dir |= 0x04;
6657 		/* set data bit low */
6658 	}
6659 }
6660 
6661 /* Quirk for Thinkpad X1 7th and 8th Gen
6662  * The following fixed routing needed
6663  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6664  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6665  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6666  */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6667 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6668 					  const struct hda_fixup *fix, int action)
6669 {
6670 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6671 	static const hda_nid_t preferred_pairs[] = {
6672 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6673 	};
6674 	struct alc_spec *spec = codec->spec;
6675 
6676 	switch (action) {
6677 	case HDA_FIXUP_ACT_PRE_PROBE:
6678 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6679 		spec->gen.preferred_dacs = preferred_pairs;
6680 		break;
6681 	case HDA_FIXUP_ACT_BUILD:
6682 		/* The generic parser creates somewhat unintuitive volume ctls
6683 		 * with the fixed routing above, and the shared DAC2 may be
6684 		 * confusing for PA.
6685 		 * Rename those to unique names so that PA doesn't touch them
6686 		 * and use only Master volume.
6687 		 */
6688 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6689 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6690 		break;
6691 	}
6692 }
6693 
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6694 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6695 					 const struct hda_fixup *fix,
6696 					 int action)
6697 {
6698 	alc_fixup_dual_codecs(codec, fix, action);
6699 	switch (action) {
6700 	case HDA_FIXUP_ACT_PRE_PROBE:
6701 		/* override card longname to provide a unique UCM profile */
6702 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6703 		break;
6704 	case HDA_FIXUP_ACT_BUILD:
6705 		/* rename Capture controls depending on the codec */
6706 		rename_ctl(codec, "Capture Volume",
6707 			   codec->addr == 0 ?
6708 			   "Rear-Panel Capture Volume" :
6709 			   "Front-Panel Capture Volume");
6710 		rename_ctl(codec, "Capture Switch",
6711 			   codec->addr == 0 ?
6712 			   "Rear-Panel Capture Switch" :
6713 			   "Front-Panel Capture Switch");
6714 		break;
6715 	}
6716 }
6717 
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6718 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6719 				      const struct hda_fixup *fix, int action)
6720 {
6721 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6722 		return;
6723 
6724 	codec->power_save_node = 1;
6725 }
6726 
6727 /* 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)6728 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6729 				    const struct hda_fixup *fix, int action)
6730 {
6731 	struct alc_spec *spec = codec->spec;
6732 	static const hda_nid_t preferred_pairs[] = {
6733 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6734 		0
6735 	};
6736 
6737 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6738 		return;
6739 
6740 	spec->gen.preferred_dacs = preferred_pairs;
6741 	spec->gen.auto_mute_via_amp = 1;
6742 	codec->power_save_node = 0;
6743 }
6744 
6745 /* avoid DAC 0x06 for speaker switch 0x17; it has no volume control */
alc274_fixup_hp_aio_bind_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6746 static void alc274_fixup_hp_aio_bind_dacs(struct hda_codec *codec,
6747 				    const struct hda_fixup *fix, int action)
6748 {
6749 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6750 	/* The speaker is routed to the Node 0x06 by a mistake, thus the
6751 	 * speaker's volume can't be adjusted since the node doesn't have
6752 	 * Amp-out capability. Assure the speaker and lineout pin to be
6753 	 * coupled with DAC NID 0x02.
6754 	 */
6755 	static const hda_nid_t preferred_pairs[] = {
6756 		0x16, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6757 	};
6758 	struct alc_spec *spec = codec->spec;
6759 
6760 	snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6761 	spec->gen.preferred_dacs = preferred_pairs;
6762 }
6763 
6764 /* 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)6765 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6766 				    const struct hda_fixup *fix, int action)
6767 {
6768 	static const hda_nid_t preferred_pairs[] = {
6769 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6770 	};
6771 	struct alc_spec *spec = codec->spec;
6772 
6773 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6774 		spec->gen.preferred_dacs = preferred_pairs;
6775 }
6776 
6777 /* 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)6778 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6779 			      const struct hda_fixup *fix, int action)
6780 {
6781 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6782 		return;
6783 
6784 	snd_hda_override_wcaps(codec, 0x03, 0);
6785 }
6786 
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6787 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6788 {
6789 	switch (codec->core.vendor_id) {
6790 	case 0x10ec0274:
6791 	case 0x10ec0294:
6792 	case 0x10ec0225:
6793 	case 0x10ec0295:
6794 	case 0x10ec0299:
6795 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6796 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6797 		break;
6798 	case 0x10ec0230:
6799 	case 0x10ec0235:
6800 	case 0x10ec0236:
6801 	case 0x10ec0255:
6802 	case 0x10ec0256:
6803 	case 0x10ec0257:
6804 	case 0x19e58326:
6805 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6806 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6807 		break;
6808 	}
6809 }
6810 
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6811 static void alc295_fixup_chromebook(struct hda_codec *codec,
6812 				    const struct hda_fixup *fix, int action)
6813 {
6814 	struct alc_spec *spec = codec->spec;
6815 
6816 	switch (action) {
6817 	case HDA_FIXUP_ACT_PRE_PROBE:
6818 		spec->ultra_low_power = true;
6819 		break;
6820 	case HDA_FIXUP_ACT_INIT:
6821 		alc_combo_jack_hp_jd_restart(codec);
6822 		break;
6823 	}
6824 }
6825 
alc256_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6826 static void alc256_fixup_chromebook(struct hda_codec *codec,
6827 				    const struct hda_fixup *fix, int action)
6828 {
6829 	struct alc_spec *spec = codec->spec;
6830 
6831 	switch (action) {
6832 	case HDA_FIXUP_ACT_PRE_PROBE:
6833 		if (codec->core.subsystem_id == 0x10280d76)
6834 			spec->gen.suppress_auto_mute = 0;
6835 		else
6836 			spec->gen.suppress_auto_mute = 1;
6837 		spec->gen.suppress_auto_mic = 1;
6838 		spec->en_3kpull_low = false;
6839 		break;
6840 	}
6841 }
6842 
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6843 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6844 				  const struct hda_fixup *fix, int action)
6845 {
6846 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6847 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6848 }
6849 
6850 
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6851 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6852 					struct hda_jack_callback *cb)
6853 {
6854 	/* The Windows driver sets the codec up in a very different way where
6855 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6856 	 */
6857 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6858 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6859 	else
6860 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6861 }
6862 
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6863 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6864 					const struct hda_fixup *fix, int action)
6865 {
6866 	/* Pin 0x21: headphones/headset mic */
6867 	if (!is_jack_detectable(codec, 0x21))
6868 		return;
6869 
6870 	switch (action) {
6871 	case HDA_FIXUP_ACT_PRE_PROBE:
6872 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6873 				alc294_gx502_toggle_output);
6874 		break;
6875 	case HDA_FIXUP_ACT_INIT:
6876 		/* Make sure to start in a correct state, i.e. if
6877 		 * headphones have been plugged in before powering up the system
6878 		 */
6879 		alc294_gx502_toggle_output(codec, NULL);
6880 		break;
6881 	}
6882 }
6883 
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6884 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6885 				       struct hda_jack_callback *cb)
6886 {
6887 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6888 	 * responsible from changes between speakers and headphones
6889 	 */
6890 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6891 		alc_write_coef_idx(codec, 0x10, 0x8420);
6892 	else
6893 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6894 }
6895 
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6896 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6897 				  const struct hda_fixup *fix, int action)
6898 {
6899 	if (!is_jack_detectable(codec, 0x21))
6900 		return;
6901 
6902 	switch (action) {
6903 	case HDA_FIXUP_ACT_PRE_PROBE:
6904 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6905 				alc294_gu502_toggle_output);
6906 		break;
6907 	case HDA_FIXUP_ACT_INIT:
6908 		alc294_gu502_toggle_output(codec, NULL);
6909 		break;
6910 	}
6911 }
6912 
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6913 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6914 			      const struct hda_fixup *fix, int action)
6915 {
6916 	if (action != HDA_FIXUP_ACT_INIT)
6917 		return;
6918 
6919 	msleep(100);
6920 	alc_write_coef_idx(codec, 0x65, 0x0);
6921 }
6922 
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6923 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6924 				    const struct hda_fixup *fix, int action)
6925 {
6926 	switch (action) {
6927 	case HDA_FIXUP_ACT_INIT:
6928 		alc_combo_jack_hp_jd_restart(codec);
6929 		break;
6930 	}
6931 }
6932 
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6933 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6934 				    const struct hda_fixup *fix, int action)
6935 {
6936 	struct alc_spec *spec = codec->spec;
6937 
6938 	switch (action) {
6939 	case HDA_FIXUP_ACT_PRE_PROBE:
6940 		/* Mic RING SLEEVE swap for combo jack */
6941 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6942 		spec->no_internal_mic_pin = true;
6943 		break;
6944 	case HDA_FIXUP_ACT_INIT:
6945 		alc_combo_jack_hp_jd_restart(codec);
6946 		break;
6947 	}
6948 }
6949 
6950 /* GPIO1 = amplifier on/off
6951  * GPIO3 = mic mute LED
6952  */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6953 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6954 					  const struct hda_fixup *fix, int action)
6955 {
6956 	static const hda_nid_t conn[] = { 0x02 };
6957 
6958 	struct alc_spec *spec = codec->spec;
6959 	static const struct hda_pintbl pincfgs[] = {
6960 		{ 0x14, 0x90170110 },  /* front/high speakers */
6961 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6962 		{ }
6963 	};
6964 
6965 	//enable micmute led
6966 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6967 
6968 	switch (action) {
6969 	case HDA_FIXUP_ACT_PRE_PROBE:
6970 		spec->micmute_led_polarity = 1;
6971 		/* needed for amp of back speakers */
6972 		spec->gpio_mask |= 0x01;
6973 		spec->gpio_dir |= 0x01;
6974 		snd_hda_apply_pincfgs(codec, pincfgs);
6975 		/* share DAC to have unified volume control */
6976 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6977 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6978 		break;
6979 	case HDA_FIXUP_ACT_INIT:
6980 		/* need to toggle GPIO to enable the amp of back speakers */
6981 		alc_update_gpio_data(codec, 0x01, true);
6982 		msleep(100);
6983 		alc_update_gpio_data(codec, 0x01, false);
6984 		break;
6985 	}
6986 }
6987 
6988 /* GPIO1 = amplifier on/off */
alc285_fixup_hp_spectre_x360_df1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6989 static void alc285_fixup_hp_spectre_x360_df1(struct hda_codec *codec,
6990 					     const struct hda_fixup *fix,
6991 					     int action)
6992 {
6993 	struct alc_spec *spec = codec->spec;
6994 	static const hda_nid_t conn[] = { 0x02 };
6995 	static const struct hda_pintbl pincfgs[] = {
6996 		{ 0x14, 0x90170110 },  /* front/high speakers */
6997 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6998 		{ }
6999 	};
7000 
7001 	// enable mute led
7002 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
7003 
7004 	switch (action) {
7005 	case HDA_FIXUP_ACT_PRE_PROBE:
7006 		/* needed for amp of back speakers */
7007 		spec->gpio_mask |= 0x01;
7008 		spec->gpio_dir |= 0x01;
7009 		snd_hda_apply_pincfgs(codec, pincfgs);
7010 		/* share DAC to have unified volume control */
7011 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
7012 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7013 		break;
7014 	case HDA_FIXUP_ACT_INIT:
7015 		/* need to toggle GPIO to enable the amp of back speakers */
7016 		alc_update_gpio_data(codec, 0x01, true);
7017 		msleep(100);
7018 		alc_update_gpio_data(codec, 0x01, false);
7019 		break;
7020 	}
7021 }
7022 
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)7023 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
7024 					  const struct hda_fixup *fix, int action)
7025 {
7026 	static const hda_nid_t conn[] = { 0x02 };
7027 	static const struct hda_pintbl pincfgs[] = {
7028 		{ 0x14, 0x90170110 },  /* rear speaker */
7029 		{ }
7030 	};
7031 
7032 	switch (action) {
7033 	case HDA_FIXUP_ACT_PRE_PROBE:
7034 		snd_hda_apply_pincfgs(codec, pincfgs);
7035 		/* force front speaker to DAC1 */
7036 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7037 		break;
7038 	}
7039 }
7040 
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)7041 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
7042 				      const struct hda_fixup *fix,
7043 				      int action)
7044 {
7045 	static const struct coef_fw coefs[] = {
7046 		WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
7047 		WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
7048 		WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
7049 		WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
7050 		WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
7051 		WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
7052 		WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
7053 		WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
7054 		WRITE_COEF(0x6e, 0x1005), { }
7055 	};
7056 
7057 	static const struct hda_pintbl pincfgs[] = {
7058 		{ 0x12, 0xb7a60130 },  /* Internal microphone*/
7059 		{ 0x14, 0x90170150 },  /* B&O soundbar speakers */
7060 		{ 0x17, 0x90170153 },  /* Side speakers */
7061 		{ 0x19, 0x03a11040 },  /* Headset microphone */
7062 		{ }
7063 	};
7064 
7065 	switch (action) {
7066 	case HDA_FIXUP_ACT_PRE_PROBE:
7067 		snd_hda_apply_pincfgs(codec, pincfgs);
7068 
7069 		/* Fixes volume control problem for side speakers */
7070 		alc295_fixup_disable_dac3(codec, fix, action);
7071 
7072 		/* Fixes no sound from headset speaker */
7073 		snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
7074 
7075 		/* Auto-enable headset mic when plugged */
7076 		snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
7077 
7078 		/* Headset mic volume enhancement */
7079 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
7080 		break;
7081 	case HDA_FIXUP_ACT_INIT:
7082 		alc_process_coef_fw(codec, coefs);
7083 		break;
7084 	case HDA_FIXUP_ACT_BUILD:
7085 		rename_ctl(codec, "Bass Speaker Playback Volume",
7086 			   "B&O-Tuned Playback Volume");
7087 		rename_ctl(codec, "Front Playback Switch",
7088 			   "B&O Soundbar Playback Switch");
7089 		rename_ctl(codec, "Bass Speaker Playback Switch",
7090 			   "Side Speaker Playback Switch");
7091 		break;
7092 	}
7093 }
7094 
alc285_fixup_hp_beep(struct hda_codec * codec,const struct hda_fixup * fix,int action)7095 static void alc285_fixup_hp_beep(struct hda_codec *codec,
7096 				 const struct hda_fixup *fix, int action)
7097 {
7098 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7099 		codec->beep_just_power_on = true;
7100 	} else  if (action == HDA_FIXUP_ACT_INIT) {
7101 #ifdef CONFIG_SND_HDA_INPUT_BEEP
7102 		/*
7103 		 * Just enable loopback to internal speaker and headphone jack.
7104 		 * Disable amplification to get about the same beep volume as
7105 		 * was on pure BIOS setup before loading the driver.
7106 		 */
7107 		alc_update_coef_idx(codec, 0x36, 0x7070, BIT(13));
7108 
7109 		snd_hda_enable_beep_device(codec, 1);
7110 
7111 #if !IS_ENABLED(CONFIG_INPUT_PCSPKR)
7112 		dev_warn_once(hda_codec_dev(codec),
7113 			      "enable CONFIG_INPUT_PCSPKR to get PC beeps\n");
7114 #endif
7115 #endif
7116 	}
7117 }
7118 
7119 /* for hda_fixup_thinkpad_acpi() */
7120 #include "thinkpad_helper.c"
7121 
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)7122 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
7123 				    const struct hda_fixup *fix, int action)
7124 {
7125 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
7126 	hda_fixup_thinkpad_acpi(codec, fix, action);
7127 }
7128 
7129 /* for hda_fixup_ideapad_acpi() */
7130 #include "ideapad_hotkey_led_helper.c"
7131 
alc_fixup_ideapad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)7132 static void alc_fixup_ideapad_acpi(struct hda_codec *codec,
7133 				   const struct hda_fixup *fix, int action)
7134 {
7135 	hda_fixup_ideapad_acpi(codec, fix, action);
7136 }
7137 
7138 /* 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)7139 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
7140 						  const struct hda_fixup *fix,
7141 						  int action)
7142 {
7143 	struct alc_spec *spec = codec->spec;
7144 
7145 	switch (action) {
7146 	case HDA_FIXUP_ACT_PRE_PROBE:
7147 		spec->gen.suppress_auto_mute = 1;
7148 		break;
7149 	}
7150 }
7151 
comp_acpi_device_notify(acpi_handle handle,u32 event,void * data)7152 static void comp_acpi_device_notify(acpi_handle handle, u32 event, void *data)
7153 {
7154 	struct hda_codec *cdc = data;
7155 	struct alc_spec *spec = cdc->spec;
7156 
7157 	codec_info(cdc, "ACPI Notification %d\n", event);
7158 
7159 	hda_component_acpi_device_notify(&spec->comps, handle, event, data);
7160 }
7161 
comp_bind(struct device * dev)7162 static int comp_bind(struct device *dev)
7163 {
7164 	struct hda_codec *cdc = dev_to_hda_codec(dev);
7165 	struct alc_spec *spec = cdc->spec;
7166 	int ret;
7167 
7168 	ret = hda_component_manager_bind(cdc, &spec->comps);
7169 	if (ret)
7170 		return ret;
7171 
7172 	return hda_component_manager_bind_acpi_notifications(cdc,
7173 							     &spec->comps,
7174 							     comp_acpi_device_notify, cdc);
7175 }
7176 
comp_unbind(struct device * dev)7177 static void comp_unbind(struct device *dev)
7178 {
7179 	struct hda_codec *cdc = dev_to_hda_codec(dev);
7180 	struct alc_spec *spec = cdc->spec;
7181 
7182 	hda_component_manager_unbind_acpi_notifications(cdc, &spec->comps, comp_acpi_device_notify);
7183 	hda_component_manager_unbind(cdc, &spec->comps);
7184 }
7185 
7186 static const struct component_master_ops comp_master_ops = {
7187 	.bind = comp_bind,
7188 	.unbind = comp_unbind,
7189 };
7190 
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)7191 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
7192 				       struct snd_pcm_substream *sub, int action)
7193 {
7194 	struct alc_spec *spec = cdc->spec;
7195 
7196 	hda_component_manager_playback_hook(&spec->comps, action);
7197 }
7198 
comp_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,const char * match_str,int count)7199 static void comp_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
7200 			       const char *hid, const char *match_str, int count)
7201 {
7202 	struct alc_spec *spec = cdc->spec;
7203 	int ret;
7204 
7205 	switch (action) {
7206 	case HDA_FIXUP_ACT_PRE_PROBE:
7207 		ret = hda_component_manager_init(cdc, &spec->comps, count, bus, hid,
7208 						 match_str, &comp_master_ops);
7209 		if (ret)
7210 			return;
7211 
7212 		spec->gen.pcm_playback_hook = comp_generic_playback_hook;
7213 		break;
7214 	case HDA_FIXUP_ACT_FREE:
7215 		hda_component_manager_free(&spec->comps, &comp_master_ops);
7216 		break;
7217 	}
7218 }
7219 
find_cirrus_companion_amps(struct hda_codec * cdc)7220 static void find_cirrus_companion_amps(struct hda_codec *cdc)
7221 {
7222 	struct device *dev = hda_codec_dev(cdc);
7223 	struct acpi_device *adev;
7224 	struct fwnode_handle *fwnode __free(fwnode_handle) = NULL;
7225 	const char *bus = NULL;
7226 	static const struct {
7227 		const char *hid;
7228 		const char *name;
7229 	} acpi_ids[] = {{ "CSC3554", "cs35l54-hda" },
7230 			{ "CSC3556", "cs35l56-hda" },
7231 			{ "CSC3557", "cs35l57-hda" }};
7232 	char *match;
7233 	int i, count = 0, count_devindex = 0;
7234 
7235 	for (i = 0; i < ARRAY_SIZE(acpi_ids); ++i) {
7236 		adev = acpi_dev_get_first_match_dev(acpi_ids[i].hid, NULL, -1);
7237 		if (adev)
7238 			break;
7239 	}
7240 	if (!adev) {
7241 		codec_dbg(cdc, "Did not find ACPI entry for a Cirrus Amp\n");
7242 		return;
7243 	}
7244 
7245 	count = i2c_acpi_client_count(adev);
7246 	if (count > 0) {
7247 		bus = "i2c";
7248 	} else {
7249 		count = acpi_spi_count_resources(adev);
7250 		if (count > 0)
7251 			bus = "spi";
7252 	}
7253 
7254 	fwnode = fwnode_handle_get(acpi_fwnode_handle(adev));
7255 	acpi_dev_put(adev);
7256 
7257 	if (!bus) {
7258 		codec_err(cdc, "Did not find any buses for %s\n", acpi_ids[i].hid);
7259 		return;
7260 	}
7261 
7262 	if (!fwnode) {
7263 		codec_err(cdc, "Could not get fwnode for %s\n", acpi_ids[i].hid);
7264 		return;
7265 	}
7266 
7267 	/*
7268 	 * When available the cirrus,dev-index property is an accurate
7269 	 * count of the amps in a system and is used in preference to
7270 	 * the count of bus devices that can contain additional address
7271 	 * alias entries.
7272 	 */
7273 	count_devindex = fwnode_property_count_u32(fwnode, "cirrus,dev-index");
7274 	if (count_devindex > 0)
7275 		count = count_devindex;
7276 
7277 	match = devm_kasprintf(dev, GFP_KERNEL, "-%%s:00-%s.%%d", acpi_ids[i].name);
7278 	if (!match)
7279 		return;
7280 	codec_info(cdc, "Found %d %s on %s (%s)\n", count, acpi_ids[i].hid, bus, match);
7281 	comp_generic_fixup(cdc, HDA_FIXUP_ACT_PRE_PROBE, bus, acpi_ids[i].hid, match, count);
7282 }
7283 
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7284 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7285 {
7286 	comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
7287 }
7288 
cs35l41_fixup_i2c_four(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7289 static void cs35l41_fixup_i2c_four(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7290 {
7291 	comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
7292 }
7293 
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)7294 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7295 {
7296 	comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
7297 }
7298 
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)7299 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7300 {
7301 	comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
7302 }
7303 
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7304 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7305 						 int action)
7306 {
7307 	comp_generic_fixup(cdc, action, "i2c", "CLSA0100", "-%s:00-cs35l41-hda.%d", 2);
7308 }
7309 
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7310 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7311 						 int action)
7312 {
7313 	comp_generic_fixup(cdc, action, "i2c", "CLSA0101", "-%s:00-cs35l41-hda.%d", 2);
7314 }
7315 
alc285_fixup_asus_ga403u(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7316 static void alc285_fixup_asus_ga403u(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7317 {
7318 	/*
7319 	 * The same SSID has been re-used in different hardware, they have
7320 	 * different codecs and the newer GA403U has a ALC285.
7321 	 */
7322 	if (cdc->core.vendor_id != 0x10ec0285)
7323 		alc_fixup_inv_dmic(cdc, fix, action);
7324 }
7325 
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7326 static void tas2781_fixup_i2c(struct hda_codec *cdc,
7327 	const struct hda_fixup *fix, int action)
7328 {
7329 	comp_generic_fixup(cdc, action, "i2c", "TIAS2781", "-%s:00", 1);
7330 }
7331 
tas2781_fixup_spi(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7332 static void tas2781_fixup_spi(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7333 {
7334 	comp_generic_fixup(cdc, action, "spi", "TXNW2781", "-%s:00-tas2781-hda.%d", 2);
7335 }
7336 
yoga7_14arb7_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7337 static void yoga7_14arb7_fixup_i2c(struct hda_codec *cdc,
7338 	const struct hda_fixup *fix, int action)
7339 {
7340 	comp_generic_fixup(cdc, action, "i2c", "INT8866", "-%s:00", 1);
7341 }
7342 
alc256_fixup_acer_sfg16_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)7343 static void alc256_fixup_acer_sfg16_micmute_led(struct hda_codec *codec,
7344 	const struct hda_fixup *fix, int action)
7345 {
7346 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
7347 }
7348 
7349 
7350 /* for alc295_fixup_hp_top_speakers */
7351 #include "hp_x360_helper.c"
7352 
7353 /* for alc285_fixup_ideapad_s740_coef() */
7354 #include "ideapad_s740_helper.c"
7355 
7356 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
7357 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
7358 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
7359 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
7360 	{}
7361 };
7362 
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)7363 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
7364 					   const struct hda_fixup *fix,
7365 					   int action)
7366 {
7367 	/*
7368 	 * A certain other OS sets these coeffs to different values. On at least
7369 	 * one TongFang barebone these settings might survive even a cold
7370 	 * reboot. So to restore a clean slate the values are explicitly reset
7371 	 * to default here. Without this, the external microphone is always in a
7372 	 * plugged-in state, while the internal microphone is always in an
7373 	 * unplugged state, breaking the ability to use the internal microphone.
7374 	 */
7375 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7376 }
7377 
7378 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7379 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7380 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7381 	WRITE_COEF(0x49, 0x0149),
7382 	{}
7383 };
7384 
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7385 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7386 				       const struct hda_fixup *fix,
7387 				       int action)
7388 {
7389 	/*
7390 	 * The audio jack input and output is not detected on the ASRock NUC Box
7391 	 * 1100 series when cold booting without this fix. Warm rebooting from a
7392 	 * certain other OS makes the audio functional, as COEF settings are
7393 	 * preserved in this case. This fix sets these altered COEF values as
7394 	 * the default.
7395 	 */
7396 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7397 }
7398 
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7399 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7400 						    const struct hda_fixup *fix,
7401 						    int action)
7402 {
7403 	/*
7404 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7405 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7406 	 * needs an additional quirk for sound working after suspend and resume.
7407 	 */
7408 	if (codec->core.vendor_id == 0x10ec0256) {
7409 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7410 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7411 	} else {
7412 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7413 	}
7414 }
7415 
alc256_decrease_headphone_amp_val(struct hda_codec * codec,const struct hda_fixup * fix,int action)7416 static void alc256_decrease_headphone_amp_val(struct hda_codec *codec,
7417 					      const struct hda_fixup *fix, int action)
7418 {
7419 	u32 caps;
7420 	u8 nsteps, offs;
7421 
7422 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7423 		return;
7424 
7425 	caps = query_amp_caps(codec, 0x3, HDA_OUTPUT);
7426 	nsteps = ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) - 10;
7427 	offs = ((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT) - 10;
7428 	caps &= ~AC_AMPCAP_NUM_STEPS & ~AC_AMPCAP_OFFSET;
7429 	caps |= (nsteps << AC_AMPCAP_NUM_STEPS_SHIFT) | (offs << AC_AMPCAP_OFFSET_SHIFT);
7430 
7431 	if (snd_hda_override_amp_caps(codec, 0x3, HDA_OUTPUT, caps))
7432 		codec_warn(codec, "failed to override amp caps for NID 0x3\n");
7433 }
7434 
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7435 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7436 						  const struct hda_fixup *fix,
7437 						  int action)
7438 {
7439 	struct alc_spec *spec = codec->spec;
7440 	struct hda_input_mux *imux = &spec->gen.input_mux;
7441 	int i;
7442 
7443 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
7444 
7445 	switch (action) {
7446 	case HDA_FIXUP_ACT_PRE_PROBE:
7447 		/**
7448 		 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7449 		 * to Hi-Z to avoid pop noises at startup and when plugging and
7450 		 * unplugging headphones.
7451 		 */
7452 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7453 		snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7454 		break;
7455 	case HDA_FIXUP_ACT_PROBE:
7456 		/**
7457 		 * Make the internal mic (0x12) the default input source to
7458 		 * prevent pop noises on cold boot.
7459 		 */
7460 		for (i = 0; i < imux->num_items; i++) {
7461 			if (spec->gen.imux_pins[i] == 0x12) {
7462 				spec->gen.cur_mux[0] = i;
7463 				break;
7464 			}
7465 		}
7466 		break;
7467 	}
7468 }
7469 
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7470 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7471 					  const struct hda_fixup *fix, int action)
7472 {
7473 	/*
7474 	 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7475 	 * unconnected.
7476 	 */
7477 	static const struct hda_pintbl pincfgs[] = {
7478 		{ 0x17, 0x90170121 },
7479 		{ }
7480 	};
7481 	/*
7482 	 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7483 	 * DAC 0x02 and 0x03 would be fine.
7484 	 */
7485 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7486 	/*
7487 	 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7488 	 * Headphones (0x21) are connected to DAC 0x03.
7489 	 */
7490 	static const hda_nid_t preferred_pairs[] = {
7491 		0x14, 0x02,
7492 		0x17, 0x02,
7493 		0x21, 0x03,
7494 		0
7495 	};
7496 	struct alc_spec *spec = codec->spec;
7497 
7498 	switch (action) {
7499 	case HDA_FIXUP_ACT_PRE_PROBE:
7500 		snd_hda_apply_pincfgs(codec, pincfgs);
7501 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7502 		spec->gen.preferred_dacs = preferred_pairs;
7503 		break;
7504 	}
7505 }
7506 
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7507 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7508 					  const struct hda_fixup *fix, int action)
7509 {
7510 	static const struct hda_pintbl pincfgs[] = {
7511 		{ 0x14, 0x90170151 },
7512 		{ 0x17, 0x90170150 },
7513 		{ }
7514 	};
7515 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7516 	static const hda_nid_t preferred_pairs[] = {
7517 		0x14, 0x02,
7518 		0x17, 0x03,
7519 		0x21, 0x02,
7520 		0
7521 	};
7522 	struct alc_spec *spec = codec->spec;
7523 
7524 	alc_fixup_no_shutup(codec, fix, action);
7525 
7526 	switch (action) {
7527 	case HDA_FIXUP_ACT_PRE_PROBE:
7528 		snd_hda_apply_pincfgs(codec, pincfgs);
7529 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7530 		spec->gen.preferred_dacs = preferred_pairs;
7531 		break;
7532 	}
7533 }
7534 
7535 /* 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)7536 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7537 				    const struct hda_fixup *fix, int action)
7538 {
7539 	struct alc_spec *spec = codec->spec;
7540 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7541 	static const hda_nid_t preferred_pairs[] = {
7542 		0x17, 0x02, 0x21, 0x03, 0
7543 	};
7544 
7545 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7546 		return;
7547 
7548 	snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7549 	spec->gen.preferred_dacs = preferred_pairs;
7550 	spec->gen.auto_mute_via_amp = 1;
7551 	if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7552 		snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7553 					0x0); /* Make sure 0x14 was disable */
7554 	}
7555 }
7556 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7557 static void alc_fixup_headset_mic(struct hda_codec *codec,
7558 				   const struct hda_fixup *fix, int action)
7559 {
7560 	struct alc_spec *spec = codec->spec;
7561 	static const struct hda_pintbl pincfgs[] = {
7562 		{ 0x19, 0x03a1103c },
7563 		{ }
7564 	};
7565 
7566 	switch (action) {
7567 	case HDA_FIXUP_ACT_PRE_PROBE:
7568 		snd_hda_apply_pincfgs(codec, pincfgs);
7569 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7570 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7571 		break;
7572 	}
7573 }
7574 
alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec * codec,const struct hda_fixup * fix,int action)7575 static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec,
7576 					  const struct hda_fixup *fix, int action)
7577 {
7578 	/*
7579 	 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
7580 	 * unconnected.
7581 	 * The Pin Complex 0x17 for the bass speakers has the lowest association
7582 	 * and sequence values so shift it up a bit to squeeze 0x14 in.
7583 	 */
7584 	static const struct hda_pintbl pincfgs[] = {
7585 		{ 0x14, 0x90170110 }, // top/treble
7586 		{ 0x17, 0x90170111 }, // bottom/bass
7587 		{ }
7588 	};
7589 
7590 	/*
7591 	 * Force DAC 0x02 for the bass speakers 0x17.
7592 	 */
7593 	static const hda_nid_t conn[] = { 0x02 };
7594 
7595 	switch (action) {
7596 	case HDA_FIXUP_ACT_PRE_PROBE:
7597 		snd_hda_apply_pincfgs(codec, pincfgs);
7598 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7599 		break;
7600 	}
7601 
7602 	cs35l41_fixup_i2c_two(codec, fix, action);
7603 	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7604 	alc245_fixup_hp_gpio_led(codec, fix, action);
7605 }
7606 
7607 /* some changes for Spectre x360 16, 2024 model */
alc245_fixup_hp_spectre_x360_16_aa0xxx(struct hda_codec * codec,const struct hda_fixup * fix,int action)7608 static void alc245_fixup_hp_spectre_x360_16_aa0xxx(struct hda_codec *codec,
7609 					  const struct hda_fixup *fix, int action)
7610 {
7611 	/*
7612 	 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
7613 	 * unconnected.
7614 	 * The Pin Complex 0x17 for the bass speakers has the lowest association
7615 	 * and sequence values so shift it up a bit to squeeze 0x14 in.
7616 	 */
7617 	struct alc_spec *spec = codec->spec;
7618 	static const struct hda_pintbl pincfgs[] = {
7619 		{ 0x14, 0x90170110 }, // top/treble
7620 		{ 0x17, 0x90170111 }, // bottom/bass
7621 		{ }
7622 	};
7623 
7624 	/*
7625 	 * Force DAC 0x02 for the bass speakers 0x17.
7626 	 */
7627 	static const hda_nid_t conn[] = { 0x02 };
7628 
7629 	switch (action) {
7630 	case HDA_FIXUP_ACT_PRE_PROBE:
7631 		/* needed for amp of back speakers */
7632 		spec->gpio_mask |= 0x01;
7633 		spec->gpio_dir |= 0x01;
7634 		snd_hda_apply_pincfgs(codec, pincfgs);
7635 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7636 		break;
7637 	case HDA_FIXUP_ACT_INIT:
7638 		/* need to toggle GPIO to enable the amp of back speakers */
7639 		alc_update_gpio_data(codec, 0x01, true);
7640 		msleep(100);
7641 		alc_update_gpio_data(codec, 0x01, false);
7642 		break;
7643 	}
7644 
7645 	cs35l41_fixup_i2c_two(codec, fix, action);
7646 	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7647 	alc245_fixup_hp_gpio_led(codec, fix, action);
7648 }
7649 
alc245_fixup_hp_zbook_firefly_g12a(struct hda_codec * codec,const struct hda_fixup * fix,int action)7650 static void alc245_fixup_hp_zbook_firefly_g12a(struct hda_codec *codec,
7651 					  const struct hda_fixup *fix, int action)
7652 {
7653 	struct alc_spec *spec = codec->spec;
7654 	static const hda_nid_t conn[] = { 0x02 };
7655 
7656 	switch (action) {
7657 	case HDA_FIXUP_ACT_PRE_PROBE:
7658 		spec->gen.auto_mute_via_amp = 1;
7659 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7660 		break;
7661 	}
7662 
7663 	cs35l41_fixup_i2c_two(codec, fix, action);
7664 	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7665 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
7666 }
7667 
7668 /*
7669  * ALC287 PCM hooks
7670  */
alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)7671 static void alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream *hinfo,
7672 				   struct hda_codec *codec,
7673 				   struct snd_pcm_substream *substream,
7674 				   int action)
7675 {
7676 	switch (action) {
7677 	case HDA_GEN_PCM_ACT_OPEN:
7678 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x954f); /* write gpio3 to high */
7679 		break;
7680 	case HDA_GEN_PCM_ACT_CLOSE:
7681 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7682 		break;
7683 	}
7684 }
7685 
alc287_s4_power_gpio3_default(struct hda_codec * codec)7686 static void alc287_s4_power_gpio3_default(struct hda_codec *codec)
7687 {
7688 	if (is_s4_suspend(codec)) {
7689 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7690 	}
7691 }
7692 
alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec * codec,const struct hda_fixup * fix,int action)7693 static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec,
7694 			       const struct hda_fixup *fix, int action)
7695 {
7696 	struct alc_spec *spec = codec->spec;
7697 	static const struct coef_fw coefs[] = {
7698 		WRITE_COEF(0x24, 0x0013), WRITE_COEF(0x25, 0x0000), WRITE_COEF(0x26, 0xC300),
7699 		WRITE_COEF(0x28, 0x0001), WRITE_COEF(0x29, 0xb023),
7700 		WRITE_COEF(0x24, 0x0013), WRITE_COEF(0x25, 0x0000), WRITE_COEF(0x26, 0xC301),
7701 		WRITE_COEF(0x28, 0x0001), WRITE_COEF(0x29, 0xb023),
7702 	};
7703 
7704 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7705 		return;
7706 	alc_update_coef_idx(codec, 0x10, 1<<11, 1<<11);
7707 	alc_process_coef_fw(codec, coefs);
7708 	spec->power_hook = alc287_s4_power_gpio3_default;
7709 	spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook;
7710 }
7711 
7712 /*
7713  * Clear COEF 0x0d (PCBEEP passthrough) bit 0x40 where BIOS sets it wrongly
7714  * at PM resume
7715  */
alc283_fixup_dell_hp_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7716 static void alc283_fixup_dell_hp_resume(struct hda_codec *codec,
7717 					const struct hda_fixup *fix, int action)
7718 {
7719 	if (action == HDA_FIXUP_ACT_INIT)
7720 		alc_write_coef_idx(codec, 0xd, 0x2800);
7721 }
7722 
7723 enum {
7724 	ALC269_FIXUP_GPIO2,
7725 	ALC269_FIXUP_SONY_VAIO,
7726 	ALC275_FIXUP_SONY_VAIO_GPIO2,
7727 	ALC269_FIXUP_DELL_M101Z,
7728 	ALC269_FIXUP_SKU_IGNORE,
7729 	ALC269_FIXUP_ASUS_G73JW,
7730 	ALC269_FIXUP_ASUS_N7601ZM_PINS,
7731 	ALC269_FIXUP_ASUS_N7601ZM,
7732 	ALC269_FIXUP_LENOVO_EAPD,
7733 	ALC275_FIXUP_SONY_HWEQ,
7734 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
7735 	ALC271_FIXUP_DMIC,
7736 	ALC269_FIXUP_PCM_44K,
7737 	ALC269_FIXUP_STEREO_DMIC,
7738 	ALC269_FIXUP_HEADSET_MIC,
7739 	ALC269_FIXUP_QUANTA_MUTE,
7740 	ALC269_FIXUP_LIFEBOOK,
7741 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
7742 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
7743 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7744 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7745 	ALC269_FIXUP_AMIC,
7746 	ALC269_FIXUP_DMIC,
7747 	ALC269VB_FIXUP_AMIC,
7748 	ALC269VB_FIXUP_DMIC,
7749 	ALC269_FIXUP_HP_MUTE_LED,
7750 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
7751 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
7752 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
7753 	ALC269_FIXUP_HP_GPIO_LED,
7754 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
7755 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
7756 	ALC269_FIXUP_INV_DMIC,
7757 	ALC269_FIXUP_LENOVO_DOCK,
7758 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7759 	ALC269_FIXUP_NO_SHUTUP,
7760 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7761 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7762 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7763 	ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7764 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7765 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7766 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7767 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7768 	ALC269_FIXUP_HEADSET_MODE,
7769 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7770 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7771 	ALC269_FIXUP_ASUS_X101_FUNC,
7772 	ALC269_FIXUP_ASUS_X101_VERB,
7773 	ALC269_FIXUP_ASUS_X101,
7774 	ALC271_FIXUP_AMIC_MIC2,
7775 	ALC271_FIXUP_HP_GATE_MIC_JACK,
7776 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7777 	ALC269_FIXUP_ACER_AC700,
7778 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7779 	ALC269VB_FIXUP_ASUS_ZENBOOK,
7780 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7781 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7782 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7783 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
7784 	ALC283_FIXUP_CHROME_BOOK,
7785 	ALC283_FIXUP_SENSE_COMBO_JACK,
7786 	ALC282_FIXUP_ASUS_TX300,
7787 	ALC283_FIXUP_INT_MIC,
7788 	ALC290_FIXUP_MONO_SPEAKERS,
7789 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7790 	ALC290_FIXUP_SUBWOOFER,
7791 	ALC290_FIXUP_SUBWOOFER_HSJACK,
7792 	ALC295_FIXUP_HP_MUTE_LED_COEFBIT11,
7793 	ALC269_FIXUP_THINKPAD_ACPI,
7794 	ALC269_FIXUP_LENOVO_XPAD_ACPI,
7795 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7796 	ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
7797 	ALC269VC_FIXUP_INFINIX_Y4_MAX,
7798 	ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7799 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7800 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7801 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7802 	ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7803 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7804 	ALC255_FIXUP_HEADSET_MODE,
7805 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7806 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7807 	ALC292_FIXUP_TPT440_DOCK,
7808 	ALC292_FIXUP_TPT440,
7809 	ALC283_FIXUP_HEADSET_MIC,
7810 	ALC255_FIXUP_MIC_MUTE_LED,
7811 	ALC282_FIXUP_ASPIRE_V5_PINS,
7812 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
7813 	ALC280_FIXUP_HP_GPIO4,
7814 	ALC286_FIXUP_HP_GPIO_LED,
7815 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7816 	ALC280_FIXUP_HP_DOCK_PINS,
7817 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7818 	ALC280_FIXUP_HP_9480M,
7819 	ALC245_FIXUP_HP_X360_AMP,
7820 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7821 	ALC285_FIXUP_HP_SPECTRE_X360_DF1,
7822 	ALC285_FIXUP_HP_ENVY_X360,
7823 	ALC288_FIXUP_DELL_HEADSET_MODE,
7824 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7825 	ALC288_FIXUP_DELL_XPS_13,
7826 	ALC288_FIXUP_DISABLE_AAMIX,
7827 	ALC292_FIXUP_DELL_E7X_AAMIX,
7828 	ALC292_FIXUP_DELL_E7X,
7829 	ALC292_FIXUP_DISABLE_AAMIX,
7830 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7831 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7832 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7833 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7834 	ALC275_FIXUP_DELL_XPS,
7835 	ALC293_FIXUP_LENOVO_SPK_NOISE,
7836 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7837 	ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED,
7838 	ALC255_FIXUP_DELL_SPK_NOISE,
7839 	ALC225_FIXUP_DISABLE_MIC_VREF,
7840 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7841 	ALC295_FIXUP_DISABLE_DAC3,
7842 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
7843 	ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7844 	ALC285_FIXUP_ASUS_HEADSET_MIC,
7845 	ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7846 	ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7847 	ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7848 	ALC280_FIXUP_HP_HEADSET_MIC,
7849 	ALC221_FIXUP_HP_FRONT_MIC,
7850 	ALC292_FIXUP_TPT460,
7851 	ALC298_FIXUP_SPK_VOLUME,
7852 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
7853 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7854 	ALC269_FIXUP_ATIV_BOOK_8,
7855 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7856 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7857 	ALC256_FIXUP_ASUS_HEADSET_MODE,
7858 	ALC256_FIXUP_ASUS_MIC,
7859 	ALC256_FIXUP_ASUS_AIO_GPIO2,
7860 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7861 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7862 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
7863 	ALC233_FIXUP_ACER_HEADSET_MIC,
7864 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
7865 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7866 	ALC225_FIXUP_S3_POP_NOISE,
7867 	ALC700_FIXUP_INTEL_REFERENCE,
7868 	ALC274_FIXUP_DELL_BIND_DACS,
7869 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7870 	ALC298_FIXUP_TPT470_DOCK_FIX,
7871 	ALC298_FIXUP_TPT470_DOCK,
7872 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7873 	ALC255_FIXUP_DELL_HEADSET_MIC,
7874 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7875 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
7876 	ALC295_FIXUP_HP_X360,
7877 	ALC221_FIXUP_HP_HEADSET_MIC,
7878 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7879 	ALC295_FIXUP_HP_AUTO_MUTE,
7880 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7881 	ALC294_FIXUP_ASUS_MIC,
7882 	ALC294_FIXUP_ASUS_HEADSET_MIC,
7883 	ALC294_FIXUP_ASUS_SPK,
7884 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7885 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7886 	ALC255_FIXUP_ACER_HEADSET_MIC,
7887 	ALC295_FIXUP_CHROME_BOOK,
7888 	ALC225_FIXUP_HEADSET_JACK,
7889 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7890 	ALC225_FIXUP_WYSE_AUTO_MUTE,
7891 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7892 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7893 	ALC256_FIXUP_ASUS_HEADSET_MIC,
7894 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7895 	ALC255_FIXUP_PREDATOR_SUBWOOFER,
7896 	ALC299_FIXUP_PREDATOR_SPK,
7897 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7898 	ALC289_FIXUP_DELL_SPK1,
7899 	ALC289_FIXUP_DELL_SPK2,
7900 	ALC289_FIXUP_DUAL_SPK,
7901 	ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7902 	ALC294_FIXUP_SPK2_TO_DAC1,
7903 	ALC294_FIXUP_ASUS_DUAL_SPK,
7904 	ALC285_FIXUP_THINKPAD_X1_GEN7,
7905 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7906 	ALC294_FIXUP_ASUS_ALLY,
7907 	ALC294_FIXUP_ASUS_ALLY_PINS,
7908 	ALC294_FIXUP_ASUS_ALLY_VERBS,
7909 	ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7910 	ALC294_FIXUP_ASUS_HPE,
7911 	ALC294_FIXUP_ASUS_COEF_1B,
7912 	ALC294_FIXUP_ASUS_GX502_HP,
7913 	ALC294_FIXUP_ASUS_GX502_PINS,
7914 	ALC294_FIXUP_ASUS_GX502_VERBS,
7915 	ALC294_FIXUP_ASUS_GU502_HP,
7916 	ALC294_FIXUP_ASUS_GU502_PINS,
7917 	ALC294_FIXUP_ASUS_GU502_VERBS,
7918 	ALC294_FIXUP_ASUS_G513_PINS,
7919 	ALC285_FIXUP_ASUS_G533Z_PINS,
7920 	ALC285_FIXUP_HP_GPIO_LED,
7921 	ALC285_FIXUP_HP_MUTE_LED,
7922 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7923 	ALC285_FIXUP_HP_BEEP_MICMUTE_LED,
7924 	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7925 	ALC236_FIXUP_HP_GPIO_LED,
7926 	ALC236_FIXUP_HP_MUTE_LED,
7927 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7928 	ALC236_FIXUP_LENOVO_INV_DMIC,
7929 	ALC298_FIXUP_SAMSUNG_AMP,
7930 	ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS,
7931 	ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS,
7932 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7933 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7934 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7935 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7936 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
7937 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7938 	ALC289_FIXUP_ASUS_GA401,
7939 	ALC289_FIXUP_ASUS_GA502,
7940 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7941 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
7942 	ALC269_FIXUP_CZC_B20,
7943 	ALC269_FIXUP_CZC_TMI,
7944 	ALC269_FIXUP_CZC_L101,
7945 	ALC269_FIXUP_LEMOTE_A1802,
7946 	ALC269_FIXUP_LEMOTE_A190X,
7947 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
7948 	ALC233_FIXUP_INTEL_NUC8_DMIC,
7949 	ALC233_FIXUP_INTEL_NUC8_BOOST,
7950 	ALC256_FIXUP_INTEL_NUC10,
7951 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7952 	ALC274_FIXUP_HP_MIC,
7953 	ALC274_FIXUP_HP_HEADSET_MIC,
7954 	ALC274_FIXUP_HP_ENVY_GPIO,
7955 	ALC274_FIXUP_ASUS_ZEN_AIO_27,
7956 	ALC256_FIXUP_ASUS_HPE,
7957 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7958 	ALC287_FIXUP_HP_GPIO_LED,
7959 	ALC256_FIXUP_HP_HEADSET_MIC,
7960 	ALC245_FIXUP_HP_GPIO_LED,
7961 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7962 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7963 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7964 	ALC256_FIXUP_ACER_HEADSET_MIC,
7965 	ALC285_FIXUP_IDEAPAD_S740_COEF,
7966 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7967 	ALC295_FIXUP_ASUS_DACS,
7968 	ALC295_FIXUP_HP_OMEN,
7969 	ALC285_FIXUP_HP_SPECTRE_X360,
7970 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7971 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7972 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7973 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7974 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7975 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7976 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7977 	ALC298_FIXUP_LENOVO_C940_DUET7,
7978 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
7979 	ALC256_FIXUP_SET_COEF_DEFAULTS,
7980 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7981 	ALC233_FIXUP_NO_AUDIO_JACK,
7982 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7983 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7984 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7985 	ALC287_FIXUP_LEGION_16ACHG6,
7986 	ALC287_FIXUP_CS35L41_I2C_2,
7987 	ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7988 	ALC287_FIXUP_CS35L41_I2C_4,
7989 	ALC245_FIXUP_CS35L41_SPI_2,
7990 	ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7991 	ALC245_FIXUP_CS35L41_SPI_4,
7992 	ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7993 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7994 	ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7995 	ALC287_FIXUP_LEGION_16ITHG6,
7996 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7997 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7998 	ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7999 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
8000 	ALC236_FIXUP_DELL_DUAL_CODECS,
8001 	ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
8002 	ALC287_FIXUP_TAS2781_I2C,
8003 	ALC245_FIXUP_TAS2781_SPI_2,
8004 	ALC287_FIXUP_YOGA7_14ARB7_I2C,
8005 	ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
8006 	ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT,
8007 	ALC245_FIXUP_HP_X360_MUTE_LEDS,
8008 	ALC287_FIXUP_THINKPAD_I2S_SPK,
8009 	ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
8010 	ALC2XX_FIXUP_HEADSET_MIC,
8011 	ALC289_FIXUP_DELL_CS35L41_SPI_2,
8012 	ALC294_FIXUP_CS35L41_I2C_2,
8013 	ALC256_FIXUP_ACER_SFG16_MICMUTE_LED,
8014 	ALC256_FIXUP_HEADPHONE_AMP_VOL,
8015 	ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX,
8016 	ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX,
8017 	ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A,
8018 	ALC285_FIXUP_ASUS_GA403U,
8019 	ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC,
8020 	ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1,
8021 	ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
8022 	ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1,
8023 	ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318,
8024 	ALC256_FIXUP_CHROME_BOOK,
8025 	ALC245_FIXUP_CLEVO_NOISY_MIC,
8026 	ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE,
8027 	ALC233_FIXUP_MEDION_MTL_SPK,
8028 	ALC294_FIXUP_BASS_SPEAKER_15,
8029 	ALC283_FIXUP_DELL_HP_RESUME,
8030 	ALC294_FIXUP_ASUS_CS35L41_SPI_2,
8031 	ALC274_FIXUP_HP_AIO_BIND_DACS,
8032 };
8033 
8034 /* A special fixup for Lenovo C940 and Yoga Duet 7;
8035  * both have the very same PCI SSID, and we need to apply different fixups
8036  * depending on the codec ID
8037  */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)8038 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
8039 					   const struct hda_fixup *fix,
8040 					   int action)
8041 {
8042 	int id;
8043 
8044 	if (codec->core.vendor_id == 0x10ec0298)
8045 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
8046 	else
8047 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
8048 	__snd_hda_apply_fixup(codec, id, action, 0);
8049 }
8050 
8051 static const struct hda_fixup alc269_fixups[] = {
8052 	[ALC269_FIXUP_GPIO2] = {
8053 		.type = HDA_FIXUP_FUNC,
8054 		.v.func = alc_fixup_gpio2,
8055 	},
8056 	[ALC269_FIXUP_SONY_VAIO] = {
8057 		.type = HDA_FIXUP_PINCTLS,
8058 		.v.pins = (const struct hda_pintbl[]) {
8059 			{0x19, PIN_VREFGRD},
8060 			{}
8061 		}
8062 	},
8063 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
8064 		.type = HDA_FIXUP_FUNC,
8065 		.v.func = alc275_fixup_gpio4_off,
8066 		.chained = true,
8067 		.chain_id = ALC269_FIXUP_SONY_VAIO
8068 	},
8069 	[ALC269_FIXUP_DELL_M101Z] = {
8070 		.type = HDA_FIXUP_VERBS,
8071 		.v.verbs = (const struct hda_verb[]) {
8072 			/* Enables internal speaker */
8073 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
8074 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
8075 			{}
8076 		}
8077 	},
8078 	[ALC269_FIXUP_SKU_IGNORE] = {
8079 		.type = HDA_FIXUP_FUNC,
8080 		.v.func = alc_fixup_sku_ignore,
8081 	},
8082 	[ALC269_FIXUP_ASUS_G73JW] = {
8083 		.type = HDA_FIXUP_PINS,
8084 		.v.pins = (const struct hda_pintbl[]) {
8085 			{ 0x17, 0x99130111 }, /* subwoofer */
8086 			{ }
8087 		}
8088 	},
8089 	[ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
8090 		.type = HDA_FIXUP_PINS,
8091 		.v.pins = (const struct hda_pintbl[]) {
8092 			{ 0x19, 0x03A11050 },
8093 			{ 0x1a, 0x03A11C30 },
8094 			{ 0x21, 0x03211420 },
8095 			{ }
8096 		}
8097 	},
8098 	[ALC269_FIXUP_ASUS_N7601ZM] = {
8099 		.type = HDA_FIXUP_VERBS,
8100 		.v.verbs = (const struct hda_verb[]) {
8101 			{0x20, AC_VERB_SET_COEF_INDEX, 0x62},
8102 			{0x20, AC_VERB_SET_PROC_COEF, 0xa007},
8103 			{0x20, AC_VERB_SET_COEF_INDEX, 0x10},
8104 			{0x20, AC_VERB_SET_PROC_COEF, 0x8420},
8105 			{0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
8106 			{0x20, AC_VERB_SET_PROC_COEF, 0x7774},
8107 			{ }
8108 		},
8109 		.chained = true,
8110 		.chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
8111 	},
8112 	[ALC269_FIXUP_LENOVO_EAPD] = {
8113 		.type = HDA_FIXUP_VERBS,
8114 		.v.verbs = (const struct hda_verb[]) {
8115 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
8116 			{}
8117 		}
8118 	},
8119 	[ALC275_FIXUP_SONY_HWEQ] = {
8120 		.type = HDA_FIXUP_FUNC,
8121 		.v.func = alc269_fixup_hweq,
8122 		.chained = true,
8123 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
8124 	},
8125 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
8126 		.type = HDA_FIXUP_FUNC,
8127 		.v.func = alc_fixup_disable_aamix,
8128 		.chained = true,
8129 		.chain_id = ALC269_FIXUP_SONY_VAIO
8130 	},
8131 	[ALC271_FIXUP_DMIC] = {
8132 		.type = HDA_FIXUP_FUNC,
8133 		.v.func = alc271_fixup_dmic,
8134 	},
8135 	[ALC269_FIXUP_PCM_44K] = {
8136 		.type = HDA_FIXUP_FUNC,
8137 		.v.func = alc269_fixup_pcm_44k,
8138 		.chained = true,
8139 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
8140 	},
8141 	[ALC269_FIXUP_STEREO_DMIC] = {
8142 		.type = HDA_FIXUP_FUNC,
8143 		.v.func = alc269_fixup_stereo_dmic,
8144 	},
8145 	[ALC269_FIXUP_HEADSET_MIC] = {
8146 		.type = HDA_FIXUP_FUNC,
8147 		.v.func = alc269_fixup_headset_mic,
8148 	},
8149 	[ALC269_FIXUP_QUANTA_MUTE] = {
8150 		.type = HDA_FIXUP_FUNC,
8151 		.v.func = alc269_fixup_quanta_mute,
8152 	},
8153 	[ALC269_FIXUP_LIFEBOOK] = {
8154 		.type = HDA_FIXUP_PINS,
8155 		.v.pins = (const struct hda_pintbl[]) {
8156 			{ 0x1a, 0x2101103f }, /* dock line-out */
8157 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
8158 			{ }
8159 		},
8160 		.chained = true,
8161 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
8162 	},
8163 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
8164 		.type = HDA_FIXUP_PINS,
8165 		.v.pins = (const struct hda_pintbl[]) {
8166 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
8167 			{ }
8168 		},
8169 	},
8170 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
8171 		.type = HDA_FIXUP_PINS,
8172 		.v.pins = (const struct hda_pintbl[]) {
8173 			{ 0x21, 0x0221102f }, /* HP out */
8174 			{ }
8175 		},
8176 	},
8177 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
8178 		.type = HDA_FIXUP_FUNC,
8179 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
8180 	},
8181 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
8182 		.type = HDA_FIXUP_FUNC,
8183 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
8184 	},
8185 	[ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13] = {
8186 		.type = HDA_FIXUP_PINS,
8187 		.v.pins = (const struct hda_pintbl[]) {
8188 			{ 0x14, 0x90170151 }, /* use as internal speaker (LFE) */
8189 			{ 0x1b, 0x90170152 }, /* use as internal speaker (back) */
8190 			{ }
8191 		},
8192 		.chained = true,
8193 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8194 	},
8195 	[ALC269VC_FIXUP_INFINIX_Y4_MAX] = {
8196 		.type = HDA_FIXUP_PINS,
8197 		.v.pins = (const struct hda_pintbl[]) {
8198 			{ 0x1b, 0x90170150 }, /* use as internal speaker */
8199 			{ }
8200 		},
8201 		.chained = true,
8202 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8203 	},
8204 	[ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
8205 		.type = HDA_FIXUP_PINS,
8206 		.v.pins = (const struct hda_pintbl[]) {
8207 			{ 0x18, 0x03a19020 }, /* headset mic */
8208 			{ 0x1b, 0x90170150 }, /* speaker */
8209 			{ }
8210 		},
8211 	},
8212 	[ALC269_FIXUP_AMIC] = {
8213 		.type = HDA_FIXUP_PINS,
8214 		.v.pins = (const struct hda_pintbl[]) {
8215 			{ 0x14, 0x99130110 }, /* speaker */
8216 			{ 0x15, 0x0121401f }, /* HP out */
8217 			{ 0x18, 0x01a19c20 }, /* mic */
8218 			{ 0x19, 0x99a3092f }, /* int-mic */
8219 			{ }
8220 		},
8221 	},
8222 	[ALC269_FIXUP_DMIC] = {
8223 		.type = HDA_FIXUP_PINS,
8224 		.v.pins = (const struct hda_pintbl[]) {
8225 			{ 0x12, 0x99a3092f }, /* int-mic */
8226 			{ 0x14, 0x99130110 }, /* speaker */
8227 			{ 0x15, 0x0121401f }, /* HP out */
8228 			{ 0x18, 0x01a19c20 }, /* mic */
8229 			{ }
8230 		},
8231 	},
8232 	[ALC269VB_FIXUP_AMIC] = {
8233 		.type = HDA_FIXUP_PINS,
8234 		.v.pins = (const struct hda_pintbl[]) {
8235 			{ 0x14, 0x99130110 }, /* speaker */
8236 			{ 0x18, 0x01a19c20 }, /* mic */
8237 			{ 0x19, 0x99a3092f }, /* int-mic */
8238 			{ 0x21, 0x0121401f }, /* HP out */
8239 			{ }
8240 		},
8241 	},
8242 	[ALC269VB_FIXUP_DMIC] = {
8243 		.type = HDA_FIXUP_PINS,
8244 		.v.pins = (const struct hda_pintbl[]) {
8245 			{ 0x12, 0x99a3092f }, /* int-mic */
8246 			{ 0x14, 0x99130110 }, /* speaker */
8247 			{ 0x18, 0x01a19c20 }, /* mic */
8248 			{ 0x21, 0x0121401f }, /* HP out */
8249 			{ }
8250 		},
8251 	},
8252 	[ALC269_FIXUP_HP_MUTE_LED] = {
8253 		.type = HDA_FIXUP_FUNC,
8254 		.v.func = alc269_fixup_hp_mute_led,
8255 	},
8256 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
8257 		.type = HDA_FIXUP_FUNC,
8258 		.v.func = alc269_fixup_hp_mute_led_mic1,
8259 	},
8260 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
8261 		.type = HDA_FIXUP_FUNC,
8262 		.v.func = alc269_fixup_hp_mute_led_mic2,
8263 	},
8264 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
8265 		.type = HDA_FIXUP_FUNC,
8266 		.v.func = alc269_fixup_hp_mute_led_mic3,
8267 		.chained = true,
8268 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
8269 	},
8270 	[ALC269_FIXUP_HP_GPIO_LED] = {
8271 		.type = HDA_FIXUP_FUNC,
8272 		.v.func = alc269_fixup_hp_gpio_led,
8273 	},
8274 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
8275 		.type = HDA_FIXUP_FUNC,
8276 		.v.func = alc269_fixup_hp_gpio_mic1_led,
8277 	},
8278 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
8279 		.type = HDA_FIXUP_FUNC,
8280 		.v.func = alc269_fixup_hp_line1_mic1_led,
8281 	},
8282 	[ALC269_FIXUP_INV_DMIC] = {
8283 		.type = HDA_FIXUP_FUNC,
8284 		.v.func = alc_fixup_inv_dmic,
8285 	},
8286 	[ALC269_FIXUP_NO_SHUTUP] = {
8287 		.type = HDA_FIXUP_FUNC,
8288 		.v.func = alc_fixup_no_shutup,
8289 	},
8290 	[ALC269_FIXUP_LENOVO_DOCK] = {
8291 		.type = HDA_FIXUP_PINS,
8292 		.v.pins = (const struct hda_pintbl[]) {
8293 			{ 0x19, 0x23a11040 }, /* dock mic */
8294 			{ 0x1b, 0x2121103f }, /* dock headphone */
8295 			{ }
8296 		},
8297 		.chained = true,
8298 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
8299 	},
8300 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
8301 		.type = HDA_FIXUP_FUNC,
8302 		.v.func = alc269_fixup_limit_int_mic_boost,
8303 		.chained = true,
8304 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
8305 	},
8306 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
8307 		.type = HDA_FIXUP_FUNC,
8308 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
8309 		.chained = true,
8310 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8311 	},
8312 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8313 		.type = HDA_FIXUP_PINS,
8314 		.v.pins = (const struct hda_pintbl[]) {
8315 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8316 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8317 			{ }
8318 		},
8319 		.chained = true,
8320 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8321 	},
8322 	[ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8323 		.type = HDA_FIXUP_FUNC,
8324 		.v.func = alc269_fixup_limit_int_mic_boost,
8325 		.chained = true,
8326 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8327 	},
8328 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8329 		.type = HDA_FIXUP_PINS,
8330 		.v.pins = (const struct hda_pintbl[]) {
8331 			{ 0x16, 0x21014020 }, /* dock line out */
8332 			{ 0x19, 0x21a19030 }, /* dock mic */
8333 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8334 			{ }
8335 		},
8336 		.chained = true,
8337 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8338 	},
8339 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
8340 		.type = HDA_FIXUP_PINS,
8341 		.v.pins = (const struct hda_pintbl[]) {
8342 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8343 			{ }
8344 		},
8345 		.chained = true,
8346 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8347 	},
8348 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
8349 		.type = HDA_FIXUP_PINS,
8350 		.v.pins = (const struct hda_pintbl[]) {
8351 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8352 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8353 			{ }
8354 		},
8355 		.chained = true,
8356 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8357 	},
8358 	[ALC269_FIXUP_HEADSET_MODE] = {
8359 		.type = HDA_FIXUP_FUNC,
8360 		.v.func = alc_fixup_headset_mode,
8361 		.chained = true,
8362 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8363 	},
8364 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8365 		.type = HDA_FIXUP_FUNC,
8366 		.v.func = alc_fixup_headset_mode_no_hp_mic,
8367 	},
8368 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
8369 		.type = HDA_FIXUP_PINS,
8370 		.v.pins = (const struct hda_pintbl[]) {
8371 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
8372 			{ }
8373 		},
8374 		.chained = true,
8375 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8376 	},
8377 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
8378 		.type = HDA_FIXUP_PINS,
8379 		.v.pins = (const struct hda_pintbl[]) {
8380 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8381 			{ }
8382 		},
8383 		.chained = true,
8384 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8385 	},
8386 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8387 		.type = HDA_FIXUP_PINS,
8388 		.v.pins = (const struct hda_pintbl[]) {
8389 			{0x12, 0x90a60130},
8390 			{0x13, 0x40000000},
8391 			{0x14, 0x90170110},
8392 			{0x18, 0x411111f0},
8393 			{0x19, 0x04a11040},
8394 			{0x1a, 0x411111f0},
8395 			{0x1b, 0x90170112},
8396 			{0x1d, 0x40759a05},
8397 			{0x1e, 0x411111f0},
8398 			{0x21, 0x04211020},
8399 			{ }
8400 		},
8401 		.chained = true,
8402 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8403 	},
8404 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
8405 		.type = HDA_FIXUP_FUNC,
8406 		.v.func = alc298_fixup_huawei_mbx_stereo,
8407 		.chained = true,
8408 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8409 	},
8410 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
8411 		.type = HDA_FIXUP_FUNC,
8412 		.v.func = alc269_fixup_x101_headset_mic,
8413 	},
8414 	[ALC269_FIXUP_ASUS_X101_VERB] = {
8415 		.type = HDA_FIXUP_VERBS,
8416 		.v.verbs = (const struct hda_verb[]) {
8417 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
8418 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8419 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
8420 			{ }
8421 		},
8422 		.chained = true,
8423 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
8424 	},
8425 	[ALC269_FIXUP_ASUS_X101] = {
8426 		.type = HDA_FIXUP_PINS,
8427 		.v.pins = (const struct hda_pintbl[]) {
8428 			{ 0x18, 0x04a1182c }, /* Headset mic */
8429 			{ }
8430 		},
8431 		.chained = true,
8432 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
8433 	},
8434 	[ALC271_FIXUP_AMIC_MIC2] = {
8435 		.type = HDA_FIXUP_PINS,
8436 		.v.pins = (const struct hda_pintbl[]) {
8437 			{ 0x14, 0x99130110 }, /* speaker */
8438 			{ 0x19, 0x01a19c20 }, /* mic */
8439 			{ 0x1b, 0x99a7012f }, /* int-mic */
8440 			{ 0x21, 0x0121401f }, /* HP out */
8441 			{ }
8442 		},
8443 	},
8444 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
8445 		.type = HDA_FIXUP_FUNC,
8446 		.v.func = alc271_hp_gate_mic_jack,
8447 		.chained = true,
8448 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
8449 	},
8450 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
8451 		.type = HDA_FIXUP_FUNC,
8452 		.v.func = alc269_fixup_limit_int_mic_boost,
8453 		.chained = true,
8454 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
8455 	},
8456 	[ALC269_FIXUP_ACER_AC700] = {
8457 		.type = HDA_FIXUP_PINS,
8458 		.v.pins = (const struct hda_pintbl[]) {
8459 			{ 0x12, 0x99a3092f }, /* int-mic */
8460 			{ 0x14, 0x99130110 }, /* speaker */
8461 			{ 0x18, 0x03a11c20 }, /* mic */
8462 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
8463 			{ 0x21, 0x0321101f }, /* HP out */
8464 			{ }
8465 		},
8466 		.chained = true,
8467 		.chain_id = ALC271_FIXUP_DMIC,
8468 	},
8469 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
8470 		.type = HDA_FIXUP_FUNC,
8471 		.v.func = alc269_fixup_limit_int_mic_boost,
8472 		.chained = true,
8473 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8474 	},
8475 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
8476 		.type = HDA_FIXUP_FUNC,
8477 		.v.func = alc269_fixup_limit_int_mic_boost,
8478 		.chained = true,
8479 		.chain_id = ALC269VB_FIXUP_DMIC,
8480 	},
8481 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
8482 		.type = HDA_FIXUP_VERBS,
8483 		.v.verbs = (const struct hda_verb[]) {
8484 			/* class-D output amp +5dB */
8485 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
8486 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
8487 			{}
8488 		},
8489 		.chained = true,
8490 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
8491 	},
8492 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8493 		.type = HDA_FIXUP_PINS,
8494 		.v.pins = (const struct hda_pintbl[]) {
8495 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
8496 			{ }
8497 		},
8498 		.chained = true,
8499 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8500 	},
8501 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
8502 		.type = HDA_FIXUP_FUNC,
8503 		.v.func = alc269_fixup_limit_int_mic_boost,
8504 		.chained = true,
8505 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
8506 	},
8507 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
8508 		.type = HDA_FIXUP_PINS,
8509 		.v.pins = (const struct hda_pintbl[]) {
8510 			{ 0x12, 0x99a3092f }, /* int-mic */
8511 			{ 0x18, 0x03a11d20 }, /* mic */
8512 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
8513 			{ }
8514 		},
8515 	},
8516 	[ALC283_FIXUP_CHROME_BOOK] = {
8517 		.type = HDA_FIXUP_FUNC,
8518 		.v.func = alc283_fixup_chromebook,
8519 	},
8520 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
8521 		.type = HDA_FIXUP_FUNC,
8522 		.v.func = alc283_fixup_sense_combo_jack,
8523 		.chained = true,
8524 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
8525 	},
8526 	[ALC282_FIXUP_ASUS_TX300] = {
8527 		.type = HDA_FIXUP_FUNC,
8528 		.v.func = alc282_fixup_asus_tx300,
8529 	},
8530 	[ALC283_FIXUP_INT_MIC] = {
8531 		.type = HDA_FIXUP_VERBS,
8532 		.v.verbs = (const struct hda_verb[]) {
8533 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
8534 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
8535 			{ }
8536 		},
8537 		.chained = true,
8538 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8539 	},
8540 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
8541 		.type = HDA_FIXUP_PINS,
8542 		.v.pins = (const struct hda_pintbl[]) {
8543 			{ 0x17, 0x90170112 }, /* subwoofer */
8544 			{ }
8545 		},
8546 		.chained = true,
8547 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
8548 	},
8549 	[ALC290_FIXUP_SUBWOOFER] = {
8550 		.type = HDA_FIXUP_PINS,
8551 		.v.pins = (const struct hda_pintbl[]) {
8552 			{ 0x17, 0x90170112 }, /* subwoofer */
8553 			{ }
8554 		},
8555 		.chained = true,
8556 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
8557 	},
8558 	[ALC290_FIXUP_MONO_SPEAKERS] = {
8559 		.type = HDA_FIXUP_FUNC,
8560 		.v.func = alc290_fixup_mono_speakers,
8561 	},
8562 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8563 		.type = HDA_FIXUP_FUNC,
8564 		.v.func = alc290_fixup_mono_speakers,
8565 		.chained = true,
8566 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8567 	},
8568 	[ALC269_FIXUP_THINKPAD_ACPI] = {
8569 		.type = HDA_FIXUP_FUNC,
8570 		.v.func = alc_fixup_thinkpad_acpi,
8571 		.chained = true,
8572 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
8573 	},
8574 	[ALC269_FIXUP_LENOVO_XPAD_ACPI] = {
8575 		.type = HDA_FIXUP_FUNC,
8576 		.v.func = alc_fixup_ideapad_acpi,
8577 		.chained = true,
8578 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8579 	},
8580 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8581 		.type = HDA_FIXUP_FUNC,
8582 		.v.func = alc_fixup_inv_dmic,
8583 		.chained = true,
8584 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8585 	},
8586 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8587 		.type = HDA_FIXUP_PINS,
8588 		.v.pins = (const struct hda_pintbl[]) {
8589 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8590 			{ }
8591 		},
8592 		.chained = true,
8593 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8594 	},
8595 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8596 		.type = HDA_FIXUP_PINS,
8597 		.v.pins = (const struct hda_pintbl[]) {
8598 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8599 			{ }
8600 		},
8601 		.chained = true,
8602 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8603 	},
8604 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8605 		.type = HDA_FIXUP_PINS,
8606 		.v.pins = (const struct hda_pintbl[]) {
8607 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8608 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8609 			{ }
8610 		},
8611 		.chained = true,
8612 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8613 	},
8614 	[ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8615 		.type = HDA_FIXUP_FUNC,
8616 		.v.func = alc269_fixup_limit_int_mic_boost,
8617 		.chained = true,
8618 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8619 	},
8620 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8621 		.type = HDA_FIXUP_PINS,
8622 		.v.pins = (const struct hda_pintbl[]) {
8623 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8624 			{ }
8625 		},
8626 		.chained = true,
8627 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8628 	},
8629 	[ALC255_FIXUP_HEADSET_MODE] = {
8630 		.type = HDA_FIXUP_FUNC,
8631 		.v.func = alc_fixup_headset_mode_alc255,
8632 		.chained = true,
8633 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8634 	},
8635 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8636 		.type = HDA_FIXUP_FUNC,
8637 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8638 	},
8639 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8640 		.type = HDA_FIXUP_PINS,
8641 		.v.pins = (const struct hda_pintbl[]) {
8642 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8643 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8644 			{ }
8645 		},
8646 		.chained = true,
8647 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8648 	},
8649 	[ALC292_FIXUP_TPT440_DOCK] = {
8650 		.type = HDA_FIXUP_FUNC,
8651 		.v.func = alc_fixup_tpt440_dock,
8652 		.chained = true,
8653 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8654 	},
8655 	[ALC292_FIXUP_TPT440] = {
8656 		.type = HDA_FIXUP_FUNC,
8657 		.v.func = alc_fixup_disable_aamix,
8658 		.chained = true,
8659 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
8660 	},
8661 	[ALC283_FIXUP_HEADSET_MIC] = {
8662 		.type = HDA_FIXUP_PINS,
8663 		.v.pins = (const struct hda_pintbl[]) {
8664 			{ 0x19, 0x04a110f0 },
8665 			{ },
8666 		},
8667 	},
8668 	[ALC255_FIXUP_MIC_MUTE_LED] = {
8669 		.type = HDA_FIXUP_FUNC,
8670 		.v.func = alc_fixup_micmute_led,
8671 	},
8672 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
8673 		.type = HDA_FIXUP_PINS,
8674 		.v.pins = (const struct hda_pintbl[]) {
8675 			{ 0x12, 0x90a60130 },
8676 			{ 0x14, 0x90170110 },
8677 			{ 0x17, 0x40000008 },
8678 			{ 0x18, 0x411111f0 },
8679 			{ 0x19, 0x01a1913c },
8680 			{ 0x1a, 0x411111f0 },
8681 			{ 0x1b, 0x411111f0 },
8682 			{ 0x1d, 0x40f89b2d },
8683 			{ 0x1e, 0x411111f0 },
8684 			{ 0x21, 0x0321101f },
8685 			{ },
8686 		},
8687 	},
8688 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8689 		.type = HDA_FIXUP_FUNC,
8690 		.v.func = alc269vb_fixup_aspire_e1_coef,
8691 	},
8692 	[ALC280_FIXUP_HP_GPIO4] = {
8693 		.type = HDA_FIXUP_FUNC,
8694 		.v.func = alc280_fixup_hp_gpio4,
8695 	},
8696 	[ALC286_FIXUP_HP_GPIO_LED] = {
8697 		.type = HDA_FIXUP_FUNC,
8698 		.v.func = alc286_fixup_hp_gpio_led,
8699 	},
8700 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8701 		.type = HDA_FIXUP_FUNC,
8702 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8703 	},
8704 	[ALC280_FIXUP_HP_DOCK_PINS] = {
8705 		.type = HDA_FIXUP_PINS,
8706 		.v.pins = (const struct hda_pintbl[]) {
8707 			{ 0x1b, 0x21011020 }, /* line-out */
8708 			{ 0x1a, 0x01a1903c }, /* headset mic */
8709 			{ 0x18, 0x2181103f }, /* line-in */
8710 			{ },
8711 		},
8712 		.chained = true,
8713 		.chain_id = ALC280_FIXUP_HP_GPIO4
8714 	},
8715 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8716 		.type = HDA_FIXUP_PINS,
8717 		.v.pins = (const struct hda_pintbl[]) {
8718 			{ 0x1b, 0x21011020 }, /* line-out */
8719 			{ 0x18, 0x2181103f }, /* line-in */
8720 			{ },
8721 		},
8722 		.chained = true,
8723 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8724 	},
8725 	[ALC280_FIXUP_HP_9480M] = {
8726 		.type = HDA_FIXUP_FUNC,
8727 		.v.func = alc280_fixup_hp_9480m,
8728 	},
8729 	[ALC245_FIXUP_HP_X360_AMP] = {
8730 		.type = HDA_FIXUP_FUNC,
8731 		.v.func = alc245_fixup_hp_x360_amp,
8732 		.chained = true,
8733 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
8734 	},
8735 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
8736 		.type = HDA_FIXUP_FUNC,
8737 		.v.func = alc_fixup_headset_mode_dell_alc288,
8738 		.chained = true,
8739 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8740 	},
8741 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8742 		.type = HDA_FIXUP_PINS,
8743 		.v.pins = (const struct hda_pintbl[]) {
8744 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8745 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8746 			{ }
8747 		},
8748 		.chained = true,
8749 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8750 	},
8751 	[ALC288_FIXUP_DISABLE_AAMIX] = {
8752 		.type = HDA_FIXUP_FUNC,
8753 		.v.func = alc_fixup_disable_aamix,
8754 		.chained = true,
8755 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8756 	},
8757 	[ALC288_FIXUP_DELL_XPS_13] = {
8758 		.type = HDA_FIXUP_FUNC,
8759 		.v.func = alc_fixup_dell_xps13,
8760 		.chained = true,
8761 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
8762 	},
8763 	[ALC292_FIXUP_DISABLE_AAMIX] = {
8764 		.type = HDA_FIXUP_FUNC,
8765 		.v.func = alc_fixup_disable_aamix,
8766 		.chained = true,
8767 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8768 	},
8769 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8770 		.type = HDA_FIXUP_FUNC,
8771 		.v.func = alc_fixup_disable_aamix,
8772 		.chained = true,
8773 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8774 	},
8775 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
8776 		.type = HDA_FIXUP_FUNC,
8777 		.v.func = alc_fixup_dell_xps13,
8778 		.chained = true,
8779 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
8780 	},
8781 	[ALC292_FIXUP_DELL_E7X] = {
8782 		.type = HDA_FIXUP_FUNC,
8783 		.v.func = alc_fixup_micmute_led,
8784 		/* micmute fixup must be applied at last */
8785 		.chained_before = true,
8786 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8787 	},
8788 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8789 		.type = HDA_FIXUP_PINS,
8790 		.v.pins = (const struct hda_pintbl[]) {
8791 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8792 			{ }
8793 		},
8794 		.chained_before = true,
8795 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8796 	},
8797 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8798 		.type = HDA_FIXUP_PINS,
8799 		.v.pins = (const struct hda_pintbl[]) {
8800 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8801 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8802 			{ }
8803 		},
8804 		.chained = true,
8805 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8806 	},
8807 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8808 		.type = HDA_FIXUP_PINS,
8809 		.v.pins = (const struct hda_pintbl[]) {
8810 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8811 			{ }
8812 		},
8813 		.chained = true,
8814 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8815 	},
8816 	[ALC275_FIXUP_DELL_XPS] = {
8817 		.type = HDA_FIXUP_VERBS,
8818 		.v.verbs = (const struct hda_verb[]) {
8819 			/* Enables internal speaker */
8820 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8821 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8822 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8823 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8824 			{}
8825 		}
8826 	},
8827 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8828 		.type = HDA_FIXUP_FUNC,
8829 		.v.func = alc_fixup_disable_aamix,
8830 		.chained = true,
8831 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8832 	},
8833 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8834 		.type = HDA_FIXUP_FUNC,
8835 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8836 	},
8837 	[ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED] = {
8838 		.type = HDA_FIXUP_FUNC,
8839 		.v.func = alc233_fixup_lenovo_low_en_micmute_led,
8840 	},
8841 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8842 		.type = HDA_FIXUP_FUNC,
8843 		.v.func = alc_fixup_inv_dmic,
8844 		.chained = true,
8845 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8846 	},
8847 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8848 		.type = HDA_FIXUP_FUNC,
8849 		.v.func = alc269_fixup_limit_int_mic_boost
8850 	},
8851 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
8852 		.type = HDA_FIXUP_FUNC,
8853 		.v.func = alc_fixup_disable_aamix,
8854 		.chained = true,
8855 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8856 	},
8857 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
8858 		.type = HDA_FIXUP_FUNC,
8859 		.v.func = alc_fixup_disable_mic_vref,
8860 		.chained = true,
8861 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8862 	},
8863 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8864 		.type = HDA_FIXUP_VERBS,
8865 		.v.verbs = (const struct hda_verb[]) {
8866 			/* Disable pass-through path for FRONT 14h */
8867 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8868 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8869 			{}
8870 		},
8871 		.chained = true,
8872 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8873 	},
8874 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
8875 		.type = HDA_FIXUP_FUNC,
8876 		.v.func = alc_fixup_disable_aamix,
8877 		.chained = true,
8878 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
8879 	},
8880 	[ALC221_FIXUP_HP_FRONT_MIC] = {
8881 		.type = HDA_FIXUP_PINS,
8882 		.v.pins = (const struct hda_pintbl[]) {
8883 			{ 0x19, 0x02a19020 }, /* Front Mic */
8884 			{ }
8885 		},
8886 	},
8887 	[ALC292_FIXUP_TPT460] = {
8888 		.type = HDA_FIXUP_FUNC,
8889 		.v.func = alc_fixup_tpt440_dock,
8890 		.chained = true,
8891 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8892 	},
8893 	[ALC298_FIXUP_SPK_VOLUME] = {
8894 		.type = HDA_FIXUP_FUNC,
8895 		.v.func = alc298_fixup_speaker_volume,
8896 		.chained = true,
8897 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8898 	},
8899 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8900 		.type = HDA_FIXUP_FUNC,
8901 		.v.func = alc298_fixup_speaker_volume,
8902 	},
8903 	[ALC295_FIXUP_DISABLE_DAC3] = {
8904 		.type = HDA_FIXUP_FUNC,
8905 		.v.func = alc295_fixup_disable_dac3,
8906 	},
8907 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8908 		.type = HDA_FIXUP_FUNC,
8909 		.v.func = alc285_fixup_speaker2_to_dac1,
8910 		.chained = true,
8911 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8912 	},
8913 	[ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8914 		.type = HDA_FIXUP_FUNC,
8915 		.v.func = alc285_fixup_speaker2_to_dac1,
8916 		.chained = true,
8917 		.chain_id = ALC245_FIXUP_CS35L41_SPI_2
8918 	},
8919 	[ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8920 		.type = HDA_FIXUP_PINS,
8921 		.v.pins = (const struct hda_pintbl[]) {
8922 			{ 0x19, 0x03a11050 },
8923 			{ 0x1b, 0x03a11c30 },
8924 			{ }
8925 		},
8926 		.chained = true,
8927 		.chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8928 	},
8929 	[ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8930 		.type = HDA_FIXUP_PINS,
8931 		.v.pins = (const struct hda_pintbl[]) {
8932 			{ 0x14, 0x90170120 },
8933 			{ }
8934 		},
8935 		.chained = true,
8936 		.chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8937 	},
8938 	[ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8939 		.type = HDA_FIXUP_FUNC,
8940 		.v.func = alc285_fixup_speaker2_to_dac1,
8941 		.chained = true,
8942 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2
8943 	},
8944 	[ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8945 		.type = HDA_FIXUP_PINS,
8946 		.v.pins = (const struct hda_pintbl[]) {
8947 			{ 0x19, 0x03a11050 },
8948 			{ 0x1b, 0x03a11c30 },
8949 			{ }
8950 		},
8951 		.chained = true,
8952 		.chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8953 	},
8954 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8955 		.type = HDA_FIXUP_PINS,
8956 		.v.pins = (const struct hda_pintbl[]) {
8957 			{ 0x1b, 0x90170151 },
8958 			{ }
8959 		},
8960 		.chained = true,
8961 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8962 	},
8963 	[ALC269_FIXUP_ATIV_BOOK_8] = {
8964 		.type = HDA_FIXUP_FUNC,
8965 		.v.func = alc_fixup_auto_mute_via_amp,
8966 		.chained = true,
8967 		.chain_id = ALC269_FIXUP_NO_SHUTUP
8968 	},
8969 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8970 		.type = HDA_FIXUP_PINS,
8971 		.v.pins = (const struct hda_pintbl[]) {
8972 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8973 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8974 			{ }
8975 		},
8976 		.chained = true,
8977 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8978 	},
8979 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8980 		.type = HDA_FIXUP_PINS,
8981 		.v.pins = (const struct hda_pintbl[]) {
8982 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8983 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8984 			{ }
8985 		},
8986 		.chained = true,
8987 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8988 	},
8989 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8990 		.type = HDA_FIXUP_FUNC,
8991 		.v.func = alc_fixup_headset_mode,
8992 	},
8993 	[ALC256_FIXUP_ASUS_MIC] = {
8994 		.type = HDA_FIXUP_PINS,
8995 		.v.pins = (const struct hda_pintbl[]) {
8996 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8997 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8998 			{ }
8999 		},
9000 		.chained = true,
9001 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9002 	},
9003 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
9004 		.type = HDA_FIXUP_FUNC,
9005 		/* Set up GPIO2 for the speaker amp */
9006 		.v.func = alc_fixup_gpio4,
9007 	},
9008 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9009 		.type = HDA_FIXUP_PINS,
9010 		.v.pins = (const struct hda_pintbl[]) {
9011 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9012 			{ }
9013 		},
9014 		.chained = true,
9015 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9016 	},
9017 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
9018 		.type = HDA_FIXUP_VERBS,
9019 		.v.verbs = (const struct hda_verb[]) {
9020 			/* Enables internal speaker */
9021 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
9022 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
9023 			{}
9024 		},
9025 		.chained = true,
9026 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
9027 	},
9028 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
9029 		.type = HDA_FIXUP_FUNC,
9030 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
9031 		.chained = true,
9032 		.chain_id = ALC269_FIXUP_GPIO2
9033 	},
9034 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
9035 		.type = HDA_FIXUP_VERBS,
9036 		.v.verbs = (const struct hda_verb[]) {
9037 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9038 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9039 			{ }
9040 		},
9041 		.chained = true,
9042 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
9043 	},
9044 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
9045 		.type = HDA_FIXUP_PINS,
9046 		.v.pins = (const struct hda_pintbl[]) {
9047 			/* Change the mic location from front to right, otherwise there are
9048 			   two front mics with the same name, pulseaudio can't handle them.
9049 			   This is just a temporary workaround, after applying this fixup,
9050 			   there will be one "Front Mic" and one "Mic" in this machine.
9051 			 */
9052 			{ 0x1a, 0x04a19040 },
9053 			{ }
9054 		},
9055 	},
9056 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
9057 		.type = HDA_FIXUP_PINS,
9058 		.v.pins = (const struct hda_pintbl[]) {
9059 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
9060 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
9061 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
9062 			{ 0x1b, 0x02011020 },
9063 			{ }
9064 		},
9065 		.chained = true,
9066 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
9067 	},
9068 	[ALC225_FIXUP_S3_POP_NOISE] = {
9069 		.type = HDA_FIXUP_FUNC,
9070 		.v.func = alc225_fixup_s3_pop_noise,
9071 		.chained = true,
9072 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9073 	},
9074 	[ALC700_FIXUP_INTEL_REFERENCE] = {
9075 		.type = HDA_FIXUP_VERBS,
9076 		.v.verbs = (const struct hda_verb[]) {
9077 			/* Enables internal speaker */
9078 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
9079 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
9080 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
9081 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
9082 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
9083 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
9084 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
9085 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
9086 			{}
9087 		}
9088 	},
9089 	[ALC274_FIXUP_DELL_BIND_DACS] = {
9090 		.type = HDA_FIXUP_FUNC,
9091 		.v.func = alc274_fixup_bind_dacs,
9092 		.chained = true,
9093 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
9094 	},
9095 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
9096 		.type = HDA_FIXUP_PINS,
9097 		.v.pins = (const struct hda_pintbl[]) {
9098 			{ 0x1b, 0x0401102f },
9099 			{ }
9100 		},
9101 		.chained = true,
9102 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
9103 	},
9104 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
9105 		.type = HDA_FIXUP_FUNC,
9106 		.v.func = alc_fixup_tpt470_dock,
9107 		.chained = true,
9108 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
9109 	},
9110 	[ALC298_FIXUP_TPT470_DOCK] = {
9111 		.type = HDA_FIXUP_FUNC,
9112 		.v.func = alc_fixup_tpt470_dacs,
9113 		.chained = true,
9114 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
9115 	},
9116 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
9117 		.type = HDA_FIXUP_PINS,
9118 		.v.pins = (const struct hda_pintbl[]) {
9119 			{ 0x14, 0x0201101f },
9120 			{ }
9121 		},
9122 		.chained = true,
9123 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9124 	},
9125 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
9126 		.type = HDA_FIXUP_PINS,
9127 		.v.pins = (const struct hda_pintbl[]) {
9128 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9129 			{ }
9130 		},
9131 		.chained = true,
9132 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9133 	},
9134 	[ALC295_FIXUP_HP_X360] = {
9135 		.type = HDA_FIXUP_FUNC,
9136 		.v.func = alc295_fixup_hp_top_speakers,
9137 		.chained = true,
9138 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
9139 	},
9140 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
9141 		.type = HDA_FIXUP_PINS,
9142 		.v.pins = (const struct hda_pintbl[]) {
9143 			{ 0x19, 0x0181313f},
9144 			{ }
9145 		},
9146 		.chained = true,
9147 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9148 	},
9149 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
9150 		.type = HDA_FIXUP_FUNC,
9151 		.v.func = alc285_fixup_invalidate_dacs,
9152 		.chained = true,
9153 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9154 	},
9155 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
9156 		.type = HDA_FIXUP_FUNC,
9157 		.v.func = alc_fixup_auto_mute_via_amp,
9158 	},
9159 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
9160 		.type = HDA_FIXUP_PINS,
9161 		.v.pins = (const struct hda_pintbl[]) {
9162 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9163 			{ }
9164 		},
9165 		.chained = true,
9166 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9167 	},
9168 	[ALC294_FIXUP_ASUS_MIC] = {
9169 		.type = HDA_FIXUP_PINS,
9170 		.v.pins = (const struct hda_pintbl[]) {
9171 			{ 0x13, 0x90a60160 }, /* use as internal mic */
9172 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
9173 			{ }
9174 		},
9175 		.chained = true,
9176 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9177 	},
9178 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
9179 		.type = HDA_FIXUP_PINS,
9180 		.v.pins = (const struct hda_pintbl[]) {
9181 			{ 0x19, 0x01a1103c }, /* use as headset mic */
9182 			{ }
9183 		},
9184 		.chained = true,
9185 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9186 	},
9187 	[ALC294_FIXUP_ASUS_SPK] = {
9188 		.type = HDA_FIXUP_VERBS,
9189 		.v.verbs = (const struct hda_verb[]) {
9190 			/* Set EAPD high */
9191 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
9192 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
9193 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9194 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
9195 			{ }
9196 		},
9197 		.chained = true,
9198 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9199 	},
9200 	[ALC295_FIXUP_CHROME_BOOK] = {
9201 		.type = HDA_FIXUP_FUNC,
9202 		.v.func = alc295_fixup_chromebook,
9203 		.chained = true,
9204 		.chain_id = ALC225_FIXUP_HEADSET_JACK
9205 	},
9206 	[ALC225_FIXUP_HEADSET_JACK] = {
9207 		.type = HDA_FIXUP_FUNC,
9208 		.v.func = alc_fixup_headset_jack,
9209 	},
9210 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9211 		.type = HDA_FIXUP_PINS,
9212 		.v.pins = (const struct hda_pintbl[]) {
9213 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9214 			{ }
9215 		},
9216 		.chained = true,
9217 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9218 	},
9219 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
9220 		.type = HDA_FIXUP_VERBS,
9221 		.v.verbs = (const struct hda_verb[]) {
9222 			/* Disable PCBEEP-IN passthrough */
9223 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
9224 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
9225 			{ }
9226 		},
9227 		.chained = true,
9228 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
9229 	},
9230 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
9231 		.type = HDA_FIXUP_PINS,
9232 		.v.pins = (const struct hda_pintbl[]) {
9233 			{ 0x19, 0x03a11130 },
9234 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
9235 			{ }
9236 		},
9237 		.chained = true,
9238 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
9239 	},
9240 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
9241 		.type = HDA_FIXUP_PINS,
9242 		.v.pins = (const struct hda_pintbl[]) {
9243 			{ 0x16, 0x01011020 }, /* Rear Line out */
9244 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
9245 			{ }
9246 		},
9247 		.chained = true,
9248 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
9249 	},
9250 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
9251 		.type = HDA_FIXUP_FUNC,
9252 		.v.func = alc_fixup_auto_mute_via_amp,
9253 		.chained = true,
9254 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
9255 	},
9256 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
9257 		.type = HDA_FIXUP_FUNC,
9258 		.v.func = alc_fixup_disable_mic_vref,
9259 		.chained = true,
9260 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9261 	},
9262 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
9263 		.type = HDA_FIXUP_VERBS,
9264 		.v.verbs = (const struct hda_verb[]) {
9265 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
9266 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
9267 			{ }
9268 		},
9269 		.chained = true,
9270 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
9271 	},
9272 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
9273 		.type = HDA_FIXUP_PINS,
9274 		.v.pins = (const struct hda_pintbl[]) {
9275 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9276 			{ }
9277 		},
9278 		.chained = true,
9279 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9280 	},
9281 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9282 		.type = HDA_FIXUP_PINS,
9283 		.v.pins = (const struct hda_pintbl[]) {
9284 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
9285 			{ }
9286 		},
9287 		.chained = true,
9288 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9289 	},
9290 	[ALC255_FIXUP_PREDATOR_SUBWOOFER] = {
9291 		.type = HDA_FIXUP_PINS,
9292 		.v.pins = (const struct hda_pintbl[]) {
9293 			{ 0x17, 0x90170151 }, /* use as internal speaker (LFE) */
9294 			{ 0x1b, 0x90170152 } /* use as internal speaker (back) */
9295 		}
9296 	},
9297 	[ALC299_FIXUP_PREDATOR_SPK] = {
9298 		.type = HDA_FIXUP_PINS,
9299 		.v.pins = (const struct hda_pintbl[]) {
9300 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
9301 			{ }
9302 		}
9303 	},
9304 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
9305 		.type = HDA_FIXUP_PINS,
9306 		.v.pins = (const struct hda_pintbl[]) {
9307 			{ 0x19, 0x04a11040 },
9308 			{ 0x21, 0x04211020 },
9309 			{ }
9310 		},
9311 		.chained = true,
9312 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9313 	},
9314 	[ALC289_FIXUP_DELL_SPK1] = {
9315 		.type = HDA_FIXUP_PINS,
9316 		.v.pins = (const struct hda_pintbl[]) {
9317 			{ 0x14, 0x90170140 },
9318 			{ }
9319 		},
9320 		.chained = true,
9321 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
9322 	},
9323 	[ALC289_FIXUP_DELL_SPK2] = {
9324 		.type = HDA_FIXUP_PINS,
9325 		.v.pins = (const struct hda_pintbl[]) {
9326 			{ 0x17, 0x90170130 }, /* bass spk */
9327 			{ }
9328 		},
9329 		.chained = true,
9330 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
9331 	},
9332 	[ALC289_FIXUP_DUAL_SPK] = {
9333 		.type = HDA_FIXUP_FUNC,
9334 		.v.func = alc285_fixup_speaker2_to_dac1,
9335 		.chained = true,
9336 		.chain_id = ALC289_FIXUP_DELL_SPK2
9337 	},
9338 	[ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
9339 		.type = HDA_FIXUP_FUNC,
9340 		.v.func = alc285_fixup_speaker2_to_dac1,
9341 		.chained = true,
9342 		.chain_id = ALC289_FIXUP_DELL_SPK1
9343 	},
9344 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
9345 		.type = HDA_FIXUP_FUNC,
9346 		.v.func = alc285_fixup_speaker2_to_dac1,
9347 		.chained = true,
9348 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9349 	},
9350 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
9351 		.type = HDA_FIXUP_FUNC,
9352 		/* The GPIO must be pulled to initialize the AMP */
9353 		.v.func = alc_fixup_gpio4,
9354 		.chained = true,
9355 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
9356 	},
9357 	[ALC294_FIXUP_ASUS_ALLY] = {
9358 		.type = HDA_FIXUP_FUNC,
9359 		.v.func = cs35l41_fixup_i2c_two,
9360 		.chained = true,
9361 		.chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
9362 	},
9363 	[ALC294_FIXUP_ASUS_ALLY_PINS] = {
9364 		.type = HDA_FIXUP_PINS,
9365 		.v.pins = (const struct hda_pintbl[]) {
9366 			{ 0x19, 0x03a11050 },
9367 			{ 0x1a, 0x03a11c30 },
9368 			{ 0x21, 0x03211420 },
9369 			{ }
9370 		},
9371 		.chained = true,
9372 		.chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
9373 	},
9374 	[ALC294_FIXUP_ASUS_ALLY_VERBS] = {
9375 		.type = HDA_FIXUP_VERBS,
9376 		.v.verbs = (const struct hda_verb[]) {
9377 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9378 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9379 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
9380 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
9381 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
9382 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
9383 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
9384 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
9385 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
9386 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
9387 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
9388 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
9389 			{ }
9390 		},
9391 		.chained = true,
9392 		.chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
9393 	},
9394 	[ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
9395 		.type = HDA_FIXUP_FUNC,
9396 		.v.func = alc285_fixup_speaker2_to_dac1,
9397 	},
9398 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
9399 		.type = HDA_FIXUP_FUNC,
9400 		.v.func = alc285_fixup_thinkpad_x1_gen7,
9401 		.chained = true,
9402 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9403 	},
9404 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
9405 		.type = HDA_FIXUP_FUNC,
9406 		.v.func = alc_fixup_headset_jack,
9407 		.chained = true,
9408 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
9409 	},
9410 	[ALC294_FIXUP_ASUS_HPE] = {
9411 		.type = HDA_FIXUP_VERBS,
9412 		.v.verbs = (const struct hda_verb[]) {
9413 			/* Set EAPD high */
9414 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9415 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
9416 			{ }
9417 		},
9418 		.chained = true,
9419 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9420 	},
9421 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
9422 		.type = HDA_FIXUP_PINS,
9423 		.v.pins = (const struct hda_pintbl[]) {
9424 			{ 0x19, 0x03a11050 }, /* front HP mic */
9425 			{ 0x1a, 0x01a11830 }, /* rear external mic */
9426 			{ 0x21, 0x03211020 }, /* front HP out */
9427 			{ }
9428 		},
9429 		.chained = true,
9430 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
9431 	},
9432 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
9433 		.type = HDA_FIXUP_VERBS,
9434 		.v.verbs = (const struct hda_verb[]) {
9435 			/* set 0x15 to HP-OUT ctrl */
9436 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9437 			/* unmute the 0x15 amp */
9438 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
9439 			{ }
9440 		},
9441 		.chained = true,
9442 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
9443 	},
9444 	[ALC294_FIXUP_ASUS_GX502_HP] = {
9445 		.type = HDA_FIXUP_FUNC,
9446 		.v.func = alc294_fixup_gx502_hp,
9447 	},
9448 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
9449 		.type = HDA_FIXUP_PINS,
9450 		.v.pins = (const struct hda_pintbl[]) {
9451 			{ 0x19, 0x01a11050 }, /* rear HP mic */
9452 			{ 0x1a, 0x01a11830 }, /* rear external mic */
9453 			{ 0x21, 0x012110f0 }, /* rear HP out */
9454 			{ }
9455 		},
9456 		.chained = true,
9457 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
9458 	},
9459 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
9460 		.type = HDA_FIXUP_VERBS,
9461 		.v.verbs = (const struct hda_verb[]) {
9462 			/* set 0x15 to HP-OUT ctrl */
9463 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9464 			/* unmute the 0x15 amp */
9465 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
9466 			/* set 0x1b to HP-OUT */
9467 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9468 			{ }
9469 		},
9470 		.chained = true,
9471 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
9472 	},
9473 	[ALC294_FIXUP_ASUS_GU502_HP] = {
9474 		.type = HDA_FIXUP_FUNC,
9475 		.v.func = alc294_fixup_gu502_hp,
9476 	},
9477 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
9478 		.type = HDA_FIXUP_PINS,
9479 		.v.pins = (const struct hda_pintbl[]) {
9480 				{ 0x19, 0x03a11050 }, /* front HP mic */
9481 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
9482 				{ 0x21, 0x03211420 }, /* front HP out */
9483 				{ }
9484 		},
9485 	},
9486 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
9487 		.type = HDA_FIXUP_PINS,
9488 		.v.pins = (const struct hda_pintbl[]) {
9489 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
9490 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
9491 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
9492 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
9493 			{ 0x21, 0x03211420 },
9494 			{ }
9495 		},
9496 	},
9497 	[ALC294_FIXUP_ASUS_COEF_1B] = {
9498 		.type = HDA_FIXUP_VERBS,
9499 		.v.verbs = (const struct hda_verb[]) {
9500 			/* Set bit 10 to correct noisy output after reboot from
9501 			 * Windows 10 (due to pop noise reduction?)
9502 			 */
9503 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
9504 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
9505 			{ }
9506 		},
9507 		.chained = true,
9508 		.chain_id = ALC289_FIXUP_ASUS_GA401,
9509 	},
9510 	[ALC285_FIXUP_HP_GPIO_LED] = {
9511 		.type = HDA_FIXUP_FUNC,
9512 		.v.func = alc285_fixup_hp_gpio_led,
9513 	},
9514 	[ALC285_FIXUP_HP_MUTE_LED] = {
9515 		.type = HDA_FIXUP_FUNC,
9516 		.v.func = alc285_fixup_hp_mute_led,
9517 	},
9518 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
9519 		.type = HDA_FIXUP_FUNC,
9520 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
9521 	},
9522 	[ALC285_FIXUP_HP_BEEP_MICMUTE_LED] = {
9523 		.type = HDA_FIXUP_FUNC,
9524 		.v.func = alc285_fixup_hp_beep,
9525 		.chained = true,
9526 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9527 	},
9528 	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
9529 	    .type = HDA_FIXUP_FUNC,
9530 	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
9531 	},
9532 	[ALC236_FIXUP_HP_GPIO_LED] = {
9533 		.type = HDA_FIXUP_FUNC,
9534 		.v.func = alc236_fixup_hp_gpio_led,
9535 	},
9536 	[ALC236_FIXUP_HP_MUTE_LED] = {
9537 		.type = HDA_FIXUP_FUNC,
9538 		.v.func = alc236_fixup_hp_mute_led,
9539 	},
9540 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
9541 		.type = HDA_FIXUP_FUNC,
9542 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
9543 	},
9544 	[ALC236_FIXUP_LENOVO_INV_DMIC] = {
9545 		.type = HDA_FIXUP_FUNC,
9546 		.v.func = alc_fixup_inv_dmic,
9547 		.chained = true,
9548 		.chain_id = ALC283_FIXUP_INT_MIC,
9549 	},
9550 	[ALC295_FIXUP_HP_MUTE_LED_COEFBIT11] = {
9551 		.type = HDA_FIXUP_FUNC,
9552 		.v.func = alc295_fixup_hp_mute_led_coefbit11,
9553 	},
9554 	[ALC298_FIXUP_SAMSUNG_AMP] = {
9555 		.type = HDA_FIXUP_FUNC,
9556 		.v.func = alc298_fixup_samsung_amp,
9557 		.chained = true,
9558 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
9559 	},
9560 	[ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS] = {
9561 		.type = HDA_FIXUP_FUNC,
9562 		.v.func = alc298_fixup_samsung_amp_v2_2_amps
9563 	},
9564 	[ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS] = {
9565 		.type = HDA_FIXUP_FUNC,
9566 		.v.func = alc298_fixup_samsung_amp_v2_4_amps
9567 	},
9568 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9569 		.type = HDA_FIXUP_VERBS,
9570 		.v.verbs = (const struct hda_verb[]) {
9571 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
9572 			{ }
9573 		},
9574 	},
9575 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9576 		.type = HDA_FIXUP_VERBS,
9577 		.v.verbs = (const struct hda_verb[]) {
9578 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
9579 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
9580 			{ }
9581 		},
9582 	},
9583 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9584 		.type = HDA_FIXUP_PINS,
9585 		.v.pins = (const struct hda_pintbl[]) {
9586 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9587 			{ }
9588 		},
9589 		.chained = true,
9590 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9591 	},
9592 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
9593 		.type = HDA_FIXUP_PINS,
9594 		.v.pins = (const struct hda_pintbl[]) {
9595 			{ 0x14, 0x90100120 }, /* use as internal speaker */
9596 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
9597 			{ 0x1a, 0x01011020 }, /* use as line out */
9598 			{ },
9599 		},
9600 		.chained = true,
9601 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9602 	},
9603 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9604 		.type = HDA_FIXUP_PINS,
9605 		.v.pins = (const struct hda_pintbl[]) {
9606 			{ 0x18, 0x02a11030 }, /* use as headset mic */
9607 			{ }
9608 		},
9609 		.chained = true,
9610 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9611 	},
9612 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9613 		.type = HDA_FIXUP_PINS,
9614 		.v.pins = (const struct hda_pintbl[]) {
9615 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9616 			{ }
9617 		},
9618 		.chained = true,
9619 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9620 	},
9621 	[ALC289_FIXUP_ASUS_GA401] = {
9622 		.type = HDA_FIXUP_FUNC,
9623 		.v.func = alc289_fixup_asus_ga401,
9624 		.chained = true,
9625 		.chain_id = ALC289_FIXUP_ASUS_GA502,
9626 	},
9627 	[ALC289_FIXUP_ASUS_GA502] = {
9628 		.type = HDA_FIXUP_PINS,
9629 		.v.pins = (const struct hda_pintbl[]) {
9630 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9631 			{ }
9632 		},
9633 	},
9634 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9635 		.type = HDA_FIXUP_PINS,
9636 		.v.pins = (const struct hda_pintbl[]) {
9637 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9638 			{ }
9639 		},
9640 		.chained = true,
9641 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9642 	},
9643 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9644 		.type = HDA_FIXUP_FUNC,
9645 		.v.func = alc285_fixup_hp_gpio_amp_init,
9646 		.chained = true,
9647 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
9648 	},
9649 	[ALC269_FIXUP_CZC_B20] = {
9650 		.type = HDA_FIXUP_PINS,
9651 		.v.pins = (const struct hda_pintbl[]) {
9652 			{ 0x12, 0x411111f0 },
9653 			{ 0x14, 0x90170110 }, /* speaker */
9654 			{ 0x15, 0x032f1020 }, /* HP out */
9655 			{ 0x17, 0x411111f0 },
9656 			{ 0x18, 0x03ab1040 }, /* mic */
9657 			{ 0x19, 0xb7a7013f },
9658 			{ 0x1a, 0x0181305f },
9659 			{ 0x1b, 0x411111f0 },
9660 			{ 0x1d, 0x411111f0 },
9661 			{ 0x1e, 0x411111f0 },
9662 			{ }
9663 		},
9664 		.chain_id = ALC269_FIXUP_DMIC,
9665 	},
9666 	[ALC269_FIXUP_CZC_TMI] = {
9667 		.type = HDA_FIXUP_PINS,
9668 		.v.pins = (const struct hda_pintbl[]) {
9669 			{ 0x12, 0x4000c000 },
9670 			{ 0x14, 0x90170110 }, /* speaker */
9671 			{ 0x15, 0x0421401f }, /* HP out */
9672 			{ 0x17, 0x411111f0 },
9673 			{ 0x18, 0x04a19020 }, /* mic */
9674 			{ 0x19, 0x411111f0 },
9675 			{ 0x1a, 0x411111f0 },
9676 			{ 0x1b, 0x411111f0 },
9677 			{ 0x1d, 0x40448505 },
9678 			{ 0x1e, 0x411111f0 },
9679 			{ 0x20, 0x8000ffff },
9680 			{ }
9681 		},
9682 		.chain_id = ALC269_FIXUP_DMIC,
9683 	},
9684 	[ALC269_FIXUP_CZC_L101] = {
9685 		.type = HDA_FIXUP_PINS,
9686 		.v.pins = (const struct hda_pintbl[]) {
9687 			{ 0x12, 0x40000000 },
9688 			{ 0x14, 0x01014010 }, /* speaker */
9689 			{ 0x15, 0x411111f0 }, /* HP out */
9690 			{ 0x16, 0x411111f0 },
9691 			{ 0x18, 0x01a19020 }, /* mic */
9692 			{ 0x19, 0x02a19021 },
9693 			{ 0x1a, 0x0181302f },
9694 			{ 0x1b, 0x0221401f },
9695 			{ 0x1c, 0x411111f0 },
9696 			{ 0x1d, 0x4044c601 },
9697 			{ 0x1e, 0x411111f0 },
9698 			{ }
9699 		},
9700 		.chain_id = ALC269_FIXUP_DMIC,
9701 	},
9702 	[ALC269_FIXUP_LEMOTE_A1802] = {
9703 		.type = HDA_FIXUP_PINS,
9704 		.v.pins = (const struct hda_pintbl[]) {
9705 			{ 0x12, 0x40000000 },
9706 			{ 0x14, 0x90170110 }, /* speaker */
9707 			{ 0x17, 0x411111f0 },
9708 			{ 0x18, 0x03a19040 }, /* mic1 */
9709 			{ 0x19, 0x90a70130 }, /* mic2 */
9710 			{ 0x1a, 0x411111f0 },
9711 			{ 0x1b, 0x411111f0 },
9712 			{ 0x1d, 0x40489d2d },
9713 			{ 0x1e, 0x411111f0 },
9714 			{ 0x20, 0x0003ffff },
9715 			{ 0x21, 0x03214020 },
9716 			{ }
9717 		},
9718 		.chain_id = ALC269_FIXUP_DMIC,
9719 	},
9720 	[ALC269_FIXUP_LEMOTE_A190X] = {
9721 		.type = HDA_FIXUP_PINS,
9722 		.v.pins = (const struct hda_pintbl[]) {
9723 			{ 0x14, 0x99130110 }, /* speaker */
9724 			{ 0x15, 0x0121401f }, /* HP out */
9725 			{ 0x18, 0x01a19c20 }, /* rear  mic */
9726 			{ 0x19, 0x99a3092f }, /* front mic */
9727 			{ 0x1b, 0x0201401f }, /* front lineout */
9728 			{ }
9729 		},
9730 		.chain_id = ALC269_FIXUP_DMIC,
9731 	},
9732 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9733 		.type = HDA_FIXUP_PINS,
9734 		.v.pins = (const struct hda_pintbl[]) {
9735 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9736 			{ }
9737 		},
9738 		.chained = true,
9739 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9740 	},
9741 	[ALC256_FIXUP_INTEL_NUC10] = {
9742 		.type = HDA_FIXUP_PINS,
9743 		.v.pins = (const struct hda_pintbl[]) {
9744 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9745 			{ }
9746 		},
9747 		.chained = true,
9748 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9749 	},
9750 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9751 		.type = HDA_FIXUP_VERBS,
9752 		.v.verbs = (const struct hda_verb[]) {
9753 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9754 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9755 			{ }
9756 		},
9757 		.chained = true,
9758 		.chain_id = ALC289_FIXUP_ASUS_GA502
9759 	},
9760 	[ALC274_FIXUP_HP_MIC] = {
9761 		.type = HDA_FIXUP_VERBS,
9762 		.v.verbs = (const struct hda_verb[]) {
9763 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9764 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9765 			{ }
9766 		},
9767 	},
9768 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
9769 		.type = HDA_FIXUP_FUNC,
9770 		.v.func = alc274_fixup_hp_headset_mic,
9771 		.chained = true,
9772 		.chain_id = ALC274_FIXUP_HP_MIC
9773 	},
9774 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
9775 		.type = HDA_FIXUP_FUNC,
9776 		.v.func = alc274_fixup_hp_envy_gpio,
9777 	},
9778 	[ALC274_FIXUP_ASUS_ZEN_AIO_27] = {
9779 		.type = HDA_FIXUP_VERBS,
9780 		.v.verbs = (const struct hda_verb[]) {
9781 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x10 },
9782 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc420 },
9783 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
9784 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
9785 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
9786 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0249 },
9787 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
9788 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x202b },
9789 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x62 },
9790 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa007 },
9791 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
9792 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5060 },
9793 			{}
9794 		},
9795 		.chained = true,
9796 		.chain_id = ALC2XX_FIXUP_HEADSET_MIC,
9797 	},
9798 	[ALC256_FIXUP_ASUS_HPE] = {
9799 		.type = HDA_FIXUP_VERBS,
9800 		.v.verbs = (const struct hda_verb[]) {
9801 			/* Set EAPD high */
9802 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9803 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9804 			{ }
9805 		},
9806 		.chained = true,
9807 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9808 	},
9809 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9810 		.type = HDA_FIXUP_FUNC,
9811 		.v.func = alc_fixup_headset_jack,
9812 		.chained = true,
9813 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9814 	},
9815 	[ALC287_FIXUP_HP_GPIO_LED] = {
9816 		.type = HDA_FIXUP_FUNC,
9817 		.v.func = alc287_fixup_hp_gpio_led,
9818 	},
9819 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
9820 		.type = HDA_FIXUP_FUNC,
9821 		.v.func = alc274_fixup_hp_headset_mic,
9822 	},
9823 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9824 		.type = HDA_FIXUP_FUNC,
9825 		.v.func = alc_fixup_no_int_mic,
9826 		.chained = true,
9827 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9828 	},
9829 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9830 		.type = HDA_FIXUP_PINS,
9831 		.v.pins = (const struct hda_pintbl[]) {
9832 			{ 0x1b, 0x411111f0 },
9833 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9834 			{ },
9835 		},
9836 		.chained = true,
9837 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9838 	},
9839 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9840 		.type = HDA_FIXUP_FUNC,
9841 		.v.func = alc269_fixup_limit_int_mic_boost,
9842 		.chained = true,
9843 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9844 	},
9845 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
9846 		.type = HDA_FIXUP_PINS,
9847 		.v.pins = (const struct hda_pintbl[]) {
9848 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9849 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
9850 			{ }
9851 		},
9852 		.chained = true,
9853 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9854 	},
9855 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9856 		.type = HDA_FIXUP_FUNC,
9857 		.v.func = alc285_fixup_ideapad_s740_coef,
9858 		.chained = true,
9859 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9860 	},
9861 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9862 		.type = HDA_FIXUP_FUNC,
9863 		.v.func = alc269_fixup_limit_int_mic_boost,
9864 		.chained = true,
9865 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9866 	},
9867 	[ALC295_FIXUP_ASUS_DACS] = {
9868 		.type = HDA_FIXUP_FUNC,
9869 		.v.func = alc295_fixup_asus_dacs,
9870 	},
9871 	[ALC295_FIXUP_HP_OMEN] = {
9872 		.type = HDA_FIXUP_PINS,
9873 		.v.pins = (const struct hda_pintbl[]) {
9874 			{ 0x12, 0xb7a60130 },
9875 			{ 0x13, 0x40000000 },
9876 			{ 0x14, 0x411111f0 },
9877 			{ 0x16, 0x411111f0 },
9878 			{ 0x17, 0x90170110 },
9879 			{ 0x18, 0x411111f0 },
9880 			{ 0x19, 0x02a11030 },
9881 			{ 0x1a, 0x411111f0 },
9882 			{ 0x1b, 0x04a19030 },
9883 			{ 0x1d, 0x40600001 },
9884 			{ 0x1e, 0x411111f0 },
9885 			{ 0x21, 0x03211020 },
9886 			{}
9887 		},
9888 		.chained = true,
9889 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9890 	},
9891 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
9892 		.type = HDA_FIXUP_FUNC,
9893 		.v.func = alc285_fixup_hp_spectre_x360,
9894 	},
9895 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9896 		.type = HDA_FIXUP_FUNC,
9897 		.v.func = alc285_fixup_hp_spectre_x360_eb1
9898 	},
9899 	[ALC285_FIXUP_HP_SPECTRE_X360_DF1] = {
9900 		.type = HDA_FIXUP_FUNC,
9901 		.v.func = alc285_fixup_hp_spectre_x360_df1
9902 	},
9903 	[ALC285_FIXUP_HP_ENVY_X360] = {
9904 		.type = HDA_FIXUP_FUNC,
9905 		.v.func = alc285_fixup_hp_envy_x360,
9906 		.chained = true,
9907 		.chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9908 	},
9909 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9910 		.type = HDA_FIXUP_FUNC,
9911 		.v.func = alc285_fixup_ideapad_s740_coef,
9912 		.chained = true,
9913 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9914 	},
9915 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9916 		.type = HDA_FIXUP_FUNC,
9917 		.v.func = alc_fixup_no_shutup,
9918 		.chained = true,
9919 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
9920 	},
9921 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9922 		.type = HDA_FIXUP_PINS,
9923 		.v.pins = (const struct hda_pintbl[]) {
9924 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9925 			{ }
9926 		},
9927 		.chained = true,
9928 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9929 	},
9930 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9931 		.type = HDA_FIXUP_FUNC,
9932 		.v.func = alc269_fixup_limit_int_mic_boost,
9933 		.chained = true,
9934 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9935 	},
9936 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9937 		.type = HDA_FIXUP_FUNC,
9938 		.v.func = alc285_fixup_ideapad_s740_coef,
9939 		.chained = true,
9940 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9941 	},
9942 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9943 		.type = HDA_FIXUP_FUNC,
9944 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9945 		.chained = true,
9946 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9947 	},
9948 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9949 		.type = HDA_FIXUP_VERBS,
9950 		//.v.verbs = legion_15imhg05_coefs,
9951 		.v.verbs = (const struct hda_verb[]) {
9952 			 // set left speaker Legion 7i.
9953 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9954 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9955 
9956 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9957 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9958 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9959 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9960 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9961 
9962 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9963 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9964 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9965 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9966 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9967 
9968 			 // set right speaker Legion 7i.
9969 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9970 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9971 
9972 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9973 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9974 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9975 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9976 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9977 
9978 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9979 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9980 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9981 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9982 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9983 			 {}
9984 		},
9985 		.chained = true,
9986 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9987 	},
9988 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9989 		.type = HDA_FIXUP_FUNC,
9990 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9991 		.chained = true,
9992 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9993 	},
9994 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9995 		.type = HDA_FIXUP_VERBS,
9996 		.v.verbs = (const struct hda_verb[]) {
9997 			 // set left speaker Yoga 7i.
9998 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9999 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
10000 
10001 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10002 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
10003 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10004 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
10005 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10006 
10007 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10008 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10009 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10010 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10011 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10012 
10013 			 // set right speaker Yoga 7i.
10014 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10015 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
10016 
10017 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10018 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
10019 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10020 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
10021 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10022 
10023 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10024 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10025 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10026 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10027 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10028 			 {}
10029 		},
10030 		.chained = true,
10031 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
10032 	},
10033 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
10034 		.type = HDA_FIXUP_FUNC,
10035 		.v.func = alc298_fixup_lenovo_c940_duet7,
10036 	},
10037 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
10038 		.type = HDA_FIXUP_VERBS,
10039 		.v.verbs = (const struct hda_verb[]) {
10040 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10041 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
10042 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10043 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10044 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10045 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10046 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10047 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10048 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
10049 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10050 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10051 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10052 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10053 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10054 			{}
10055 		},
10056 		.chained = true,
10057 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
10058 	},
10059 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
10060 		.type = HDA_FIXUP_FUNC,
10061 		.v.func = alc256_fixup_set_coef_defaults,
10062 	},
10063 	[ALC245_FIXUP_HP_GPIO_LED] = {
10064 		.type = HDA_FIXUP_FUNC,
10065 		.v.func = alc245_fixup_hp_gpio_led,
10066 	},
10067 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
10068 		.type = HDA_FIXUP_PINS,
10069 		.v.pins = (const struct hda_pintbl[]) {
10070 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
10071 			{ }
10072 		},
10073 		.chained = true,
10074 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
10075 	},
10076 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
10077 		.type = HDA_FIXUP_FUNC,
10078 		.v.func = alc233_fixup_no_audio_jack,
10079 	},
10080 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
10081 		.type = HDA_FIXUP_FUNC,
10082 		.v.func = alc256_fixup_mic_no_presence_and_resume,
10083 		.chained = true,
10084 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
10085 	},
10086 	[ALC287_FIXUP_LEGION_16ACHG6] = {
10087 		.type = HDA_FIXUP_FUNC,
10088 		.v.func = alc287_fixup_legion_16achg6_speakers,
10089 	},
10090 	[ALC287_FIXUP_CS35L41_I2C_2] = {
10091 		.type = HDA_FIXUP_FUNC,
10092 		.v.func = cs35l41_fixup_i2c_two,
10093 	},
10094 	[ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
10095 		.type = HDA_FIXUP_FUNC,
10096 		.v.func = cs35l41_fixup_i2c_two,
10097 		.chained = true,
10098 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
10099 	},
10100 	[ALC287_FIXUP_CS35L41_I2C_4] = {
10101 		.type = HDA_FIXUP_FUNC,
10102 		.v.func = cs35l41_fixup_i2c_four,
10103 	},
10104 	[ALC245_FIXUP_CS35L41_SPI_2] = {
10105 		.type = HDA_FIXUP_FUNC,
10106 		.v.func = cs35l41_fixup_spi_two,
10107 	},
10108 	[ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
10109 		.type = HDA_FIXUP_FUNC,
10110 		.v.func = cs35l41_fixup_spi_two,
10111 		.chained = true,
10112 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
10113 	},
10114 	[ALC245_FIXUP_CS35L41_SPI_4] = {
10115 		.type = HDA_FIXUP_FUNC,
10116 		.v.func = cs35l41_fixup_spi_four,
10117 	},
10118 	[ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
10119 		.type = HDA_FIXUP_FUNC,
10120 		.v.func = cs35l41_fixup_spi_four,
10121 		.chained = true,
10122 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
10123 	},
10124 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
10125 		.type = HDA_FIXUP_VERBS,
10126 		.v.verbs = (const struct hda_verb[]) {
10127 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
10128 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
10129 			 { }
10130 		},
10131 		.chained = true,
10132 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
10133 	},
10134 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
10135 		.type = HDA_FIXUP_FUNC,
10136 		.v.func = alc_fixup_dell4_mic_no_presence_quiet,
10137 		.chained = true,
10138 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10139 	},
10140 	[ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
10141 		.type = HDA_FIXUP_PINS,
10142 		.v.pins = (const struct hda_pintbl[]) {
10143 			{ 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
10144 			{ }
10145 		},
10146 		.chained = true,
10147 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
10148 	},
10149 	[ALC287_FIXUP_LEGION_16ITHG6] = {
10150 		.type = HDA_FIXUP_FUNC,
10151 		.v.func = alc287_fixup_legion_16ithg6_speakers,
10152 	},
10153 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
10154 		.type = HDA_FIXUP_VERBS,
10155 		.v.verbs = (const struct hda_verb[]) {
10156 			// enable left speaker
10157 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10158 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
10159 
10160 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10161 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
10162 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10163 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
10164 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10165 
10166 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10167 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
10168 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10169 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
10170 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10171 
10172 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10173 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
10174 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10175 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
10176 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10177 
10178 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10179 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10180 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10181 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10182 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10183 
10184 			// enable right speaker
10185 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10186 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
10187 
10188 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10189 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
10190 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10191 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
10192 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10193 
10194 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10195 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
10196 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10197 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
10198 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10199 
10200 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10201 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
10202 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10203 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
10204 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10205 
10206 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10207 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10208 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10209 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10210 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10211 
10212 			{ },
10213 		},
10214 	},
10215 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
10216 		.type = HDA_FIXUP_FUNC,
10217 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
10218 		.chained = true,
10219 		.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
10220 	},
10221 	[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
10222 		.type = HDA_FIXUP_FUNC,
10223 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
10224 		.chained = true,
10225 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2,
10226 	},
10227 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
10228 		.type = HDA_FIXUP_FUNC,
10229 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
10230 		.chained = true,
10231 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10232 	},
10233 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
10234 		.type = HDA_FIXUP_PINS,
10235 		.v.func = alc1220_fixup_gb_dual_codecs,
10236 		.chained = true,
10237 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10238 	},
10239 	[ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
10240 		.type = HDA_FIXUP_FUNC,
10241 		.v.func = cs35l41_fixup_i2c_two,
10242 		.chained = true,
10243 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10244 	},
10245 	[ALC287_FIXUP_TAS2781_I2C] = {
10246 		.type = HDA_FIXUP_FUNC,
10247 		.v.func = tas2781_fixup_i2c,
10248 		.chained = true,
10249 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10250 	},
10251 	[ALC245_FIXUP_TAS2781_SPI_2] = {
10252 		.type = HDA_FIXUP_FUNC,
10253 		.v.func = tas2781_fixup_spi,
10254 		.chained = true,
10255 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
10256 	},
10257 	[ALC287_FIXUP_YOGA7_14ARB7_I2C] = {
10258 		.type = HDA_FIXUP_FUNC,
10259 		.v.func = yoga7_14arb7_fixup_i2c,
10260 		.chained = true,
10261 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10262 	},
10263 	[ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
10264 		.type = HDA_FIXUP_FUNC,
10265 		.v.func = alc245_fixup_hp_mute_led_coefbit,
10266 	},
10267 	[ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT] = {
10268 		.type = HDA_FIXUP_FUNC,
10269 		.v.func = alc245_fixup_hp_mute_led_v1_coefbit,
10270 	},
10271 	[ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
10272 		.type = HDA_FIXUP_FUNC,
10273 		.v.func = alc245_fixup_hp_mute_led_coefbit,
10274 		.chained = true,
10275 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
10276 	},
10277 	[ALC287_FIXUP_THINKPAD_I2S_SPK] = {
10278 		.type = HDA_FIXUP_FUNC,
10279 		.v.func = alc287_fixup_bind_dacs,
10280 		.chained = true,
10281 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10282 	},
10283 	[ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
10284 		.type = HDA_FIXUP_FUNC,
10285 		.v.func = alc287_fixup_bind_dacs,
10286 		.chained = true,
10287 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
10288 	},
10289 	[ALC2XX_FIXUP_HEADSET_MIC] = {
10290 		.type = HDA_FIXUP_FUNC,
10291 		.v.func = alc_fixup_headset_mic,
10292 	},
10293 	[ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
10294 		.type = HDA_FIXUP_FUNC,
10295 		.v.func = cs35l41_fixup_spi_two,
10296 		.chained = true,
10297 		.chain_id = ALC289_FIXUP_DUAL_SPK
10298 	},
10299 	[ALC294_FIXUP_CS35L41_I2C_2] = {
10300 		.type = HDA_FIXUP_FUNC,
10301 		.v.func = cs35l41_fixup_i2c_two,
10302 	},
10303 	[ALC256_FIXUP_ACER_SFG16_MICMUTE_LED] = {
10304 		.type = HDA_FIXUP_FUNC,
10305 		.v.func = alc256_fixup_acer_sfg16_micmute_led,
10306 	},
10307 	[ALC256_FIXUP_HEADPHONE_AMP_VOL] = {
10308 		.type = HDA_FIXUP_FUNC,
10309 		.v.func = alc256_decrease_headphone_amp_val,
10310 	},
10311 	[ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX] = {
10312 		.type = HDA_FIXUP_FUNC,
10313 		.v.func = alc245_fixup_hp_spectre_x360_eu0xxx,
10314 	},
10315 	[ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX] = {
10316 		.type = HDA_FIXUP_FUNC,
10317 		.v.func = alc245_fixup_hp_spectre_x360_16_aa0xxx,
10318 	},
10319 	[ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A] = {
10320 		.type = HDA_FIXUP_FUNC,
10321 		.v.func = alc245_fixup_hp_zbook_firefly_g12a,
10322 	},
10323 	[ALC285_FIXUP_ASUS_GA403U] = {
10324 		.type = HDA_FIXUP_FUNC,
10325 		.v.func = alc285_fixup_asus_ga403u,
10326 	},
10327 	[ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC] = {
10328 		.type = HDA_FIXUP_PINS,
10329 		.v.pins = (const struct hda_pintbl[]) {
10330 			{ 0x19, 0x03a11050 },
10331 			{ 0x1b, 0x03a11c30 },
10332 			{ }
10333 		},
10334 		.chained = true,
10335 		.chain_id = ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1
10336 	},
10337 	[ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1] = {
10338 		.type = HDA_FIXUP_FUNC,
10339 		.v.func = alc285_fixup_speaker2_to_dac1,
10340 		.chained = true,
10341 		.chain_id = ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
10342 	},
10343 	[ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC] = {
10344 		.type = HDA_FIXUP_PINS,
10345 		.v.pins = (const struct hda_pintbl[]) {
10346 			{ 0x19, 0x03a11050 },
10347 			{ 0x1b, 0x03a11c30 },
10348 			{ }
10349 		},
10350 	},
10351 	[ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1] = {
10352 		.type = HDA_FIXUP_FUNC,
10353 		.v.func = alc285_fixup_speaker2_to_dac1,
10354 		.chained = true,
10355 		.chain_id = ALC285_FIXUP_ASUS_GA403U,
10356 	},
10357 	[ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318] = {
10358 		.type = HDA_FIXUP_FUNC,
10359 		.v.func = alc287_fixup_lenovo_thinkpad_with_alc1318,
10360 		.chained = true,
10361 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
10362 	},
10363 	[ALC256_FIXUP_CHROME_BOOK] = {
10364 		.type = HDA_FIXUP_FUNC,
10365 		.v.func = alc256_fixup_chromebook,
10366 		.chained = true,
10367 		.chain_id = ALC225_FIXUP_HEADSET_JACK
10368 	},
10369 	[ALC245_FIXUP_CLEVO_NOISY_MIC] = {
10370 		.type = HDA_FIXUP_FUNC,
10371 		.v.func = alc269_fixup_limit_int_mic_boost,
10372 		.chained = true,
10373 		.chain_id = ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
10374 	},
10375 	[ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE] = {
10376 		.type = HDA_FIXUP_PINS,
10377 		.v.pins = (const struct hda_pintbl[]) {
10378 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10379 			{ 0x1b, 0x20a11040 }, /* dock mic */
10380 			{ }
10381 		},
10382 		.chained = true,
10383 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
10384 	},
10385 	[ALC233_FIXUP_MEDION_MTL_SPK] = {
10386 		.type = HDA_FIXUP_PINS,
10387 		.v.pins = (const struct hda_pintbl[]) {
10388 			{ 0x1b, 0x90170110 },
10389 			{ }
10390 		},
10391 	},
10392 	[ALC294_FIXUP_BASS_SPEAKER_15] = {
10393 		.type = HDA_FIXUP_FUNC,
10394 		.v.func = alc294_fixup_bass_speaker_15,
10395 	},
10396 	[ALC283_FIXUP_DELL_HP_RESUME] = {
10397 		.type = HDA_FIXUP_FUNC,
10398 		.v.func = alc283_fixup_dell_hp_resume,
10399 	},
10400 	[ALC294_FIXUP_ASUS_CS35L41_SPI_2] = {
10401 		.type = HDA_FIXUP_FUNC,
10402 		.v.func = cs35l41_fixup_spi_two,
10403 		.chained = true,
10404 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC,
10405 	},
10406 	[ALC274_FIXUP_HP_AIO_BIND_DACS] = {
10407 		.type = HDA_FIXUP_FUNC,
10408 		.v.func = alc274_fixup_hp_aio_bind_dacs,
10409 	},
10410 };
10411 
10412 static const struct hda_quirk alc269_fixup_tbl[] = {
10413 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
10414 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
10415 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
10416 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
10417 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10418 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
10419 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
10420 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10421 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10422 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
10423 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10424 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
10425 	SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10426 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
10427 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
10428 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
10429 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
10430 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10431 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10432 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10433 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
10434 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
10435 	SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10436 	SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10437 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
10438 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10439 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
10440 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
10441 	SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10442 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10443 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10444 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10445 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
10446 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10447 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10448 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10449 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
10450 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
10451 	SND_PCI_QUIRK(0x1025, 0x1360, "Acer Aspire A115", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10452 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10453 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10454 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10455 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
10456 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10457 	SND_PCI_QUIRK(0x1025, 0x159c, "Acer Nitro 5 AN515-58", ALC2XX_FIXUP_HEADSET_MIC),
10458 	SND_PCI_QUIRK(0x1025, 0x169a, "Acer Swift SFG16", ALC256_FIXUP_ACER_SFG16_MICMUTE_LED),
10459 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
10460 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
10461 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
10462 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
10463 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
10464 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
10465 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
10466 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
10467 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10468 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10469 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10470 	SND_PCI_QUIRK(0x1028, 0x0604, "Dell Venue 11 Pro 7130", ALC283_FIXUP_DELL_HP_RESUME),
10471 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
10472 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
10473 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
10474 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
10475 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
10476 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10477 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10478 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
10479 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
10480 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
10481 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
10482 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10483 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10484 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10485 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10486 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10487 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10488 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10489 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
10490 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
10491 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
10492 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
10493 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
10494 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
10495 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
10496 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
10497 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10498 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10499 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
10500 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
10501 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
10502 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
10503 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
10504 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10505 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
10506 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
10507 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
10508 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
10509 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
10510 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
10511 	SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
10512 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
10513 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
10514 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
10515 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10516 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10517 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
10518 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
10519 	SND_PCI_QUIRK(0x1028, 0x0b27, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
10520 	SND_PCI_QUIRK(0x1028, 0x0b28, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
10521 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10522 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10523 	SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10524 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10525 	SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10526 	SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10527 	SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10528 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
10529 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
10530 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
10531 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
10532 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
10533 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
10534 	SND_PCI_QUIRK(0x1028, 0x0c28, "Dell Inspiron 16 Plus 7630", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10535 	SND_PCI_QUIRK(0x1028, 0x0c4d, "Dell", ALC287_FIXUP_CS35L41_I2C_4),
10536 	SND_PCI_QUIRK(0x1028, 0x0c94, "Dell Polaris 3 metal", ALC287_FIXUP_TAS2781_I2C),
10537 	SND_PCI_QUIRK(0x1028, 0x0c96, "Dell Polaris 2in1", ALC287_FIXUP_TAS2781_I2C),
10538 	SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10539 	SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10540 	SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10541 	SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10542 	SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10543 	SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10544 	SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10545 	SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10546 	SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10547 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10548 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10549 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
10550 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
10551 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
10552 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10553 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10554 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10555 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10556 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
10557 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10558 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10559 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10560 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10561 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10562 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10563 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10564 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10565 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10566 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10567 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10568 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10569 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10570 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
10571 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
10572 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10573 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10574 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10575 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10576 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10577 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10578 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10579 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10580 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
10581 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10582 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
10583 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10584 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
10585 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10586 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10587 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10588 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10589 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10590 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10591 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10592 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10593 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10594 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10595 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10596 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10597 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10598 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10599 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
10600 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10601 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10602 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10603 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10604 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10605 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10606 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
10607 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10608 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10609 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
10610 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
10611 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
10612 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
10613 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
10614 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10615 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10616 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10617 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10618 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10619 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10620 	SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10621 	SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10622 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
10623 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10624 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
10625 	SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10626 	SND_PCI_QUIRK(0x103c, 0x85c6, "HP Pavilion x360 Convertible 14-dy1xxx", ALC295_FIXUP_HP_MUTE_LED_COEFBIT11),
10627 	SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
10628 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10629 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10630 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10631 	SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10632 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
10633 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10634 	SND_PCI_QUIRK(0x103c, 0x863e, "HP Spectre x360 15-df1xxx", ALC285_FIXUP_HP_SPECTRE_X360_DF1),
10635 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10636 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
10637 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10638 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10639 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
10640 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
10641 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
10642 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10643 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10644 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10645 	SND_PCI_QUIRK(0x103c, 0x8760, "HP EliteBook 8{4,5}5 G7", ALC285_FIXUP_HP_BEEP_MICMUTE_LED),
10646 	SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10647 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
10648 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10649 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
10650 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10651 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
10652 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10653 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10654 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10655 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10656 	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10657 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
10658 	SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10659 	SND_PCI_QUIRK(0x103c, 0x87df, "HP ProBook 430 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10660 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10661 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10662 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10663 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10664 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
10665 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
10666 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10667 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10668 	SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10669 	SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10670 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10671 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10672 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10673 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10674 	SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10675 	SND_PCI_QUIRK(0x103c, 0x881e, "HP Laptop 15s-du3xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10676 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10677 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10678 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10679 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10680 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10681 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10682 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10683 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10684 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10685 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10686 	SND_PCI_QUIRK(0x103c, 0x887c, "HP Laptop 14s-fq1xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10687 	SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10688 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
10689 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
10690 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
10691 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10692 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
10693 	SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
10694 	SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
10695 	SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10696 	SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
10697 	SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10698 	SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10699 	SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10700 	SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10701 	SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10702 	SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10703 	SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10704 	SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
10705 	SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
10706 	SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10707 	SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10708 	SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10709 	SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
10710 	SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10711 	SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
10712 	SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
10713 	SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
10714 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
10715 	SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
10716 	SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
10717 	SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10718 	SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10719 	SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10720 	SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10721 	SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10722 	SND_PCI_QUIRK(0x103c, 0x89e7, "HP Elite x2 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10723 	SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
10724 	SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10725 	SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10726 	SND_PCI_QUIRK(0x103c, 0x8a28, "HP Envy 13", ALC287_FIXUP_CS35L41_I2C_2),
10727 	SND_PCI_QUIRK(0x103c, 0x8a29, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10728 	SND_PCI_QUIRK(0x103c, 0x8a2a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10729 	SND_PCI_QUIRK(0x103c, 0x8a2b, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10730 	SND_PCI_QUIRK(0x103c, 0x8a2c, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10731 	SND_PCI_QUIRK(0x103c, 0x8a2d, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10732 	SND_PCI_QUIRK(0x103c, 0x8a2e, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10733 	SND_PCI_QUIRK(0x103c, 0x8a30, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10734 	SND_PCI_QUIRK(0x103c, 0x8a31, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10735 	SND_PCI_QUIRK(0x103c, 0x8a6e, "HP EDNA 360", ALC287_FIXUP_CS35L41_I2C_4),
10736 	SND_PCI_QUIRK(0x103c, 0x8a74, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10737 	SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10738 	SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
10739 	SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
10740 	SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
10741 	SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
10742 	SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
10743 	SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10744 	SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10745 	SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10746 	SND_PCI_QUIRK(0x103c, 0x8ad8, "HP 800 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10747 	SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10748 	SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10749 	SND_PCI_QUIRK(0x103c, 0x8b3a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10750 	SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
10751 	SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10752 	SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10753 	SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10754 	SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10755 	SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10756 	SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10757 	SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10758 	SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10759 	SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10760 	SND_PCI_QUIRK(0x103c, 0x8b5f, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10761 	SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10762 	SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10763 	SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10764 	SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10765 	SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10766 	SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10767 	SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
10768 	SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10769 	SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10770 	SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
10771 	SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10772 	SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
10773 	SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10774 	SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10775 	SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10776 	SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10777 	SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10778 	SND_PCI_QUIRK(0x103c, 0x8bb3, "HP Slim OMEN", ALC287_FIXUP_CS35L41_I2C_2),
10779 	SND_PCI_QUIRK(0x103c, 0x8bb4, "HP Slim OMEN", ALC287_FIXUP_CS35L41_I2C_2),
10780 	SND_PCI_QUIRK(0x103c, 0x8bcd, "HP Omen 16-xd0xxx", ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT),
10781 	SND_PCI_QUIRK(0x103c, 0x8bdd, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10782 	SND_PCI_QUIRK(0x103c, 0x8bde, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10783 	SND_PCI_QUIRK(0x103c, 0x8bdf, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10784 	SND_PCI_QUIRK(0x103c, 0x8be0, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10785 	SND_PCI_QUIRK(0x103c, 0x8be1, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10786 	SND_PCI_QUIRK(0x103c, 0x8be2, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10787 	SND_PCI_QUIRK(0x103c, 0x8be3, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10788 	SND_PCI_QUIRK(0x103c, 0x8be5, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10789 	SND_PCI_QUIRK(0x103c, 0x8be6, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10790 	SND_PCI_QUIRK(0x103c, 0x8be7, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10791 	SND_PCI_QUIRK(0x103c, 0x8be8, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10792 	SND_PCI_QUIRK(0x103c, 0x8be9, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10793 	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10794 	SND_PCI_QUIRK(0x103c, 0x8c15, "HP Spectre x360 2-in-1 Laptop 14-eu0xxx", ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX),
10795 	SND_PCI_QUIRK(0x103c, 0x8c16, "HP Spectre x360 2-in-1 Laptop 16-aa0xxx", ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX),
10796 	SND_PCI_QUIRK(0x103c, 0x8c17, "HP Spectre 16", ALC287_FIXUP_CS35L41_I2C_2),
10797 	SND_PCI_QUIRK(0x103c, 0x8c21, "HP Pavilion Plus Laptop 14-ey0XXX", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10798 	SND_PCI_QUIRK(0x103c, 0x8c30, "HP Victus 15-fb1xxx", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10799 	SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10800 	SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10801 	SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10802 	SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10803 	SND_PCI_QUIRK(0x103c, 0x8c4d, "HP Omen", ALC287_FIXUP_CS35L41_I2C_2),
10804 	SND_PCI_QUIRK(0x103c, 0x8c4e, "HP Omen", ALC287_FIXUP_CS35L41_I2C_2),
10805 	SND_PCI_QUIRK(0x103c, 0x8c4f, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10806 	SND_PCI_QUIRK(0x103c, 0x8c50, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10807 	SND_PCI_QUIRK(0x103c, 0x8c51, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10808 	SND_PCI_QUIRK(0x103c, 0x8c52, "HP EliteBook 1040 G11", ALC285_FIXUP_HP_GPIO_LED),
10809 	SND_PCI_QUIRK(0x103c, 0x8c53, "HP Elite x360 1040 2-in-1 G11", ALC285_FIXUP_HP_GPIO_LED),
10810 	SND_PCI_QUIRK(0x103c, 0x8c66, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10811 	SND_PCI_QUIRK(0x103c, 0x8c67, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10812 	SND_PCI_QUIRK(0x103c, 0x8c68, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10813 	SND_PCI_QUIRK(0x103c, 0x8c6a, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10814 	SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10815 	SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10816 	SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10817 	SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10818 	SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10819 	SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10820 	SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10821 	SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10822 	SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10823 	SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10824 	SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10825 	SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10826 	SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10827 	SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10828 	SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10829 	SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10830 	SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10831 	SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10832 	SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10833 	SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10834 	SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10835 	SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10836 	SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10837 	SND_PCI_QUIRK(0x103c, 0x8caf, "HP Elite mt645 G8 Mobile Thin Client", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10838 	SND_PCI_QUIRK(0x103c, 0x8cbd, "HP Pavilion Aero Laptop 13-bg0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10839 	SND_PCI_QUIRK(0x103c, 0x8cdd, "HP Spectre", ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX),
10840 	SND_PCI_QUIRK(0x103c, 0x8cde, "HP OmniBook Ultra Flip Laptop 14t", ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX),
10841 	SND_PCI_QUIRK(0x103c, 0x8cdf, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10842 	SND_PCI_QUIRK(0x103c, 0x8ce0, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10843 	SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10844 	SND_PCI_QUIRK(0x103c, 0x8d01, "HP ZBook Power 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10845 	SND_PCI_QUIRK(0x103c, 0x8d18, "HP EliteStudio 8 AIO", ALC274_FIXUP_HP_AIO_BIND_DACS),
10846 	SND_PCI_QUIRK(0x103c, 0x8d84, "HP EliteBook X G1i", ALC285_FIXUP_HP_GPIO_LED),
10847 	SND_PCI_QUIRK(0x103c, 0x8d85, "HP EliteBook 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10848 	SND_PCI_QUIRK(0x103c, 0x8d86, "HP Elite X360 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10849 	SND_PCI_QUIRK(0x103c, 0x8d8c, "HP EliteBook 13 G12", ALC285_FIXUP_HP_GPIO_LED),
10850 	SND_PCI_QUIRK(0x103c, 0x8d8d, "HP Elite X360 13 G12", ALC285_FIXUP_HP_GPIO_LED),
10851 	SND_PCI_QUIRK(0x103c, 0x8d8e, "HP EliteBook 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10852 	SND_PCI_QUIRK(0x103c, 0x8d8f, "HP EliteBook 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10853 	SND_PCI_QUIRK(0x103c, 0x8d90, "HP EliteBook 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10854 	SND_PCI_QUIRK(0x103c, 0x8d91, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10855 	SND_PCI_QUIRK(0x103c, 0x8d92, "HP ZBook Firefly 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10856 	SND_PCI_QUIRK(0x103c, 0x8d9b, "HP 17 Turbine OmniBook 7 UMA", ALC287_FIXUP_CS35L41_I2C_2),
10857 	SND_PCI_QUIRK(0x103c, 0x8d9c, "HP 17 Turbine OmniBook 7 DIS", ALC287_FIXUP_CS35L41_I2C_2),
10858 	SND_PCI_QUIRK(0x103c, 0x8d9d, "HP 17 Turbine OmniBook X UMA", ALC287_FIXUP_CS35L41_I2C_2),
10859 	SND_PCI_QUIRK(0x103c, 0x8d9e, "HP 17 Turbine OmniBook X DIS", ALC287_FIXUP_CS35L41_I2C_2),
10860 	SND_PCI_QUIRK(0x103c, 0x8d9f, "HP 14 Cadet (x360)", ALC287_FIXUP_CS35L41_I2C_2),
10861 	SND_PCI_QUIRK(0x103c, 0x8da0, "HP 16 Clipper OmniBook 7(X360)", ALC287_FIXUP_CS35L41_I2C_2),
10862 	SND_PCI_QUIRK(0x103c, 0x8da1, "HP 16 Clipper OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10863 	SND_PCI_QUIRK(0x103c, 0x8da7, "HP 14 Enstrom OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10864 	SND_PCI_QUIRK(0x103c, 0x8da8, "HP 16 Piston OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10865 	SND_PCI_QUIRK(0x103c, 0x8dd4, "HP EliteStudio 8 AIO", ALC274_FIXUP_HP_AIO_BIND_DACS),
10866 	SND_PCI_QUIRK(0x103c, 0x8de8, "HP Gemtree", ALC245_FIXUP_TAS2781_SPI_2),
10867 	SND_PCI_QUIRK(0x103c, 0x8de9, "HP Gemtree", ALC245_FIXUP_TAS2781_SPI_2),
10868 	SND_PCI_QUIRK(0x103c, 0x8dec, "HP EliteBook 640 G12", ALC236_FIXUP_HP_GPIO_LED),
10869 	SND_PCI_QUIRK(0x103c, 0x8ded, "HP EliteBook 640 G12", ALC236_FIXUP_HP_GPIO_LED),
10870 	SND_PCI_QUIRK(0x103c, 0x8dee, "HP EliteBook 660 G12", ALC236_FIXUP_HP_GPIO_LED),
10871 	SND_PCI_QUIRK(0x103c, 0x8def, "HP EliteBook 660 G12", ALC236_FIXUP_HP_GPIO_LED),
10872 	SND_PCI_QUIRK(0x103c, 0x8df0, "HP EliteBook 630 G12", ALC236_FIXUP_HP_GPIO_LED),
10873 	SND_PCI_QUIRK(0x103c, 0x8df1, "HP EliteBook 630 G12", ALC236_FIXUP_HP_GPIO_LED),
10874 	SND_PCI_QUIRK(0x103c, 0x8dfc, "HP EliteBook 645 G12", ALC236_FIXUP_HP_GPIO_LED),
10875 	SND_PCI_QUIRK(0x103c, 0x8dfe, "HP EliteBook 665 G12", ALC236_FIXUP_HP_GPIO_LED),
10876 	SND_PCI_QUIRK(0x103c, 0x8e11, "HP Trekker", ALC287_FIXUP_CS35L41_I2C_2),
10877 	SND_PCI_QUIRK(0x103c, 0x8e12, "HP Trekker", ALC287_FIXUP_CS35L41_I2C_2),
10878 	SND_PCI_QUIRK(0x103c, 0x8e13, "HP Trekker", ALC287_FIXUP_CS35L41_I2C_2),
10879 	SND_PCI_QUIRK(0x103c, 0x8e14, "HP ZBook Firefly 14 G12", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10880 	SND_PCI_QUIRK(0x103c, 0x8e15, "HP ZBook Firefly 14 G12", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10881 	SND_PCI_QUIRK(0x103c, 0x8e16, "HP ZBook Firefly 14 G12", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10882 	SND_PCI_QUIRK(0x103c, 0x8e17, "HP ZBook Firefly 14 G12", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10883 	SND_PCI_QUIRK(0x103c, 0x8e18, "HP ZBook Firefly 14 G12A", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10884 	SND_PCI_QUIRK(0x103c, 0x8e19, "HP ZBook Firefly 14 G12A", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10885 	SND_PCI_QUIRK(0x103c, 0x8e1a, "HP ZBook Firefly 14 G12A", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10886 	SND_PCI_QUIRK(0x103c, 0x8e1b, "HP EliteBook G12", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10887 	SND_PCI_QUIRK(0x103c, 0x8e1c, "HP EliteBook G12", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10888 	SND_PCI_QUIRK(0x103c, 0x8e1d, "HP ZBook X Gli 16 G12", ALC236_FIXUP_HP_GPIO_LED),
10889 	SND_PCI_QUIRK(0x103c, 0x8e2c, "HP EliteBook 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10890 	SND_PCI_QUIRK(0x103c, 0x8e36, "HP 14 Enstrom OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10891 	SND_PCI_QUIRK(0x103c, 0x8e37, "HP 16 Piston OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10892 	SND_PCI_QUIRK(0x103c, 0x8e3a, "HP Agusta", ALC287_FIXUP_CS35L41_I2C_2),
10893 	SND_PCI_QUIRK(0x103c, 0x8e3b, "HP Agusta", ALC287_FIXUP_CS35L41_I2C_2),
10894 	SND_PCI_QUIRK(0x103c, 0x8e60, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2),
10895 	SND_PCI_QUIRK(0x103c, 0x8e61, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2),
10896 	SND_PCI_QUIRK(0x103c, 0x8e62, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2),
10897 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10898 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10899 	SND_PCI_QUIRK(0x1043, 0x1054, "ASUS G614FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2),
10900 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10901 	SND_PCI_QUIRK(0x1043, 0x106f, "ASUS VivoBook X515UA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10902 	SND_PCI_QUIRK(0x1043, 0x1074, "ASUS G614PH/PM/PP", ALC287_FIXUP_CS35L41_I2C_2),
10903 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10904 	SND_PCI_QUIRK(0x1043, 0x10a4, "ASUS TP3407SA", ALC287_FIXUP_TAS2781_I2C),
10905 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10906 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10907 	SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10908 	SND_PCI_QUIRK(0x1043, 0x1154, "ASUS TP3607SH", ALC287_FIXUP_TAS2781_I2C),
10909 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10910 	SND_PCI_QUIRK(0x1043, 0x1194, "ASUS UM3406KA", ALC287_FIXUP_CS35L41_I2C_2),
10911 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10912 	SND_PCI_QUIRK(0x1043, 0x1204, "ASUS Strix G615JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C),
10913 	SND_PCI_QUIRK(0x1043, 0x1214, "ASUS Strix G615LH_LM_LP", ALC287_FIXUP_TAS2781_I2C),
10914 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10915 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10916 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10917 	SND_PCI_QUIRK(0x1043, 0x1294, "ASUS B3405CVA", ALC245_FIXUP_CS35L41_SPI_2),
10918 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10919 	SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10920 	SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10921 	SND_PCI_QUIRK(0x1043, 0x12b4, "ASUS B3405CCA / P3405CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10922 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10923 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10924 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10925 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10926 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10927 	SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVV", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10928 	SND_PCI_QUIRK(0x1043, 0x1460, "Asus VivoBook 15", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10929 	SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X/GA402N", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10930 	SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604VI/VC/VE/VG/VJ/VQ/VU/VV/VY/VZ", ALC285_FIXUP_ASUS_HEADSET_MIC),
10931 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603VQ/VU/VV/VJ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10932 	SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601VV/VU/VJ/VQ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10933 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G614JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10934 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS G513PI/PU/PV", ALC287_FIXUP_CS35L41_I2C_2),
10935 	SND_PCI_QUIRK(0x1043, 0x14f2, "ASUS VivoBook X515JA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10936 	SND_PCI_QUIRK(0x1043, 0x1503, "ASUS G733PY/PZ/PZV/PYV", ALC287_FIXUP_CS35L41_I2C_2),
10937 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10938 	SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA/XJ/XQ/XU/XV/XI", ALC287_FIXUP_CS35L41_I2C_2),
10939 	SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301VV/VQ/VU/VJ/VA/VC/VE/VVC/VQC/VUC/VJC/VEC/VCC", ALC285_FIXUP_ASUS_HEADSET_MIC),
10940 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10941 	SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZI/ZJ/ZQ/ZU/ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10942 	SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10943 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10944 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10945 	SND_PCI_QUIRK(0x1043, 0x16d3, "ASUS UX5304VA", ALC245_FIXUP_CS35L41_SPI_2),
10946 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10947 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS UX7602VI/BZ", ALC245_FIXUP_CS35L41_SPI_2),
10948 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10949 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10950 	SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally NR2301L/X", ALC294_FIXUP_ASUS_ALLY),
10951 	SND_PCI_QUIRK(0x1043, 0x1863, "ASUS UX6404VI/VV", ALC245_FIXUP_CS35L41_SPI_2),
10952 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10953 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10954 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10955 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10956 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10957 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10958 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10959 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10960 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10961 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10962 	SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10963 	SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10964 	SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10965 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10966 	SND_PCI_QUIRK(0x1043, 0x1b13, "ASUS U41SV/GA403U", ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC),
10967 	SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10968 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10969 	SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10970 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10971 	SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10972 	SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10973 	SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10974 	SND_PCI_QUIRK(0x1043, 0x1c63, "ASUS GU605M", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10975 	SND_PCI_QUIRK(0x1043, 0x1c80, "ASUS VivoBook TP401", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10976 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10977 	SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JU/JV/JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10978 	SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JY/JZ/JI/JG", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10979 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10980 	SND_PCI_QUIRK(0x1043, 0x1ccf, "ASUS G814JU/JV/JI", ALC245_FIXUP_CS35L41_SPI_2),
10981 	SND_PCI_QUIRK(0x1043, 0x1cdf, "ASUS G814JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10982 	SND_PCI_QUIRK(0x1043, 0x1cef, "ASUS G834JY/JZ/JI/JG", ALC285_FIXUP_ASUS_HEADSET_MIC),
10983 	SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS G713PI/PU/PV/PVN", ALC287_FIXUP_CS35L41_I2C_2),
10984 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10985 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10986 	SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10987 	SND_PCI_QUIRK(0x1043, 0x1df3, "ASUS UM5606WA", ALC294_FIXUP_BASS_SPEAKER_15),
10988 	SND_PCI_QUIRK(0x1043, 0x1264, "ASUS UM5606KA", ALC294_FIXUP_BASS_SPEAKER_15),
10989 	SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10990 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10991 	SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10992 	SND_PCI_QUIRK(0x1043, 0x1e1f, "ASUS Vivobook 15 X1504VAP", ALC2XX_FIXUP_HEADSET_MIC),
10993 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10994 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10995 	SND_PCI_QUIRK(0x1043, 0x1e63, "ASUS H7606W", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10996 	SND_PCI_QUIRK(0x1043, 0x1e83, "ASUS GA605W", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10997 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10998 	SND_PCI_QUIRK(0x1043, 0x1eb3, "ASUS Ally RCLA72", ALC287_FIXUP_TAS2781_I2C),
10999 	SND_PCI_QUIRK(0x1043, 0x1ed3, "ASUS HN7306W", ALC287_FIXUP_CS35L41_I2C_2),
11000 	SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
11001 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
11002 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
11003 	SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
11004 	SND_PCI_QUIRK(0x1043, 0x1f1f, "ASUS H7604JI/JV/J3D", ALC245_FIXUP_CS35L41_SPI_2),
11005 	SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
11006 	SND_PCI_QUIRK(0x1043, 0x1f63, "ASUS P5405CSA", ALC245_FIXUP_CS35L41_SPI_2),
11007 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
11008 	SND_PCI_QUIRK(0x1043, 0x1fb3, "ASUS ROG Flow Z13 GZ302EA", ALC287_FIXUP_CS35L41_I2C_2),
11009 	SND_PCI_QUIRK(0x1043, 0x3011, "ASUS B5605CVA", ALC245_FIXUP_CS35L41_SPI_2),
11010 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
11011 	SND_PCI_QUIRK(0x1043, 0x3061, "ASUS B3405CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
11012 	SND_PCI_QUIRK(0x1043, 0x3071, "ASUS B5405CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
11013 	SND_PCI_QUIRK(0x1043, 0x30c1, "ASUS B3605CCA / P3605CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
11014 	SND_PCI_QUIRK(0x1043, 0x30d1, "ASUS B5405CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
11015 	SND_PCI_QUIRK(0x1043, 0x30e1, "ASUS B5605CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
11016 	SND_PCI_QUIRK(0x1043, 0x31d0, "ASUS Zen AIO 27 Z272SD_A272SD", ALC274_FIXUP_ASUS_ZEN_AIO_27),
11017 	SND_PCI_QUIRK(0x1043, 0x31e1, "ASUS B5605CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
11018 	SND_PCI_QUIRK(0x1043, 0x31f1, "ASUS B3605CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
11019 	SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
11020 	SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
11021 	SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
11022 	SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
11023 	SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
11024 	SND_PCI_QUIRK(0x1043, 0x3d78, "ASUS GA603KH", ALC287_FIXUP_CS35L41_I2C_2),
11025 	SND_PCI_QUIRK(0x1043, 0x3d88, "ASUS GA603KM", ALC287_FIXUP_CS35L41_I2C_2),
11026 	SND_PCI_QUIRK(0x1043, 0x3e00, "ASUS G814FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2),
11027 	SND_PCI_QUIRK(0x1043, 0x3e20, "ASUS G814PH/PM/PP", ALC287_FIXUP_CS35L41_I2C_2),
11028 	SND_PCI_QUIRK(0x1043, 0x3e30, "ASUS TP3607SA", ALC287_FIXUP_TAS2781_I2C),
11029 	SND_PCI_QUIRK(0x1043, 0x3ee0, "ASUS Strix G815_JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C),
11030 	SND_PCI_QUIRK(0x1043, 0x3ef0, "ASUS Strix G635LR_LW_LX", ALC287_FIXUP_TAS2781_I2C),
11031 	SND_PCI_QUIRK(0x1043, 0x3f00, "ASUS Strix G815LH_LM_LP", ALC287_FIXUP_TAS2781_I2C),
11032 	SND_PCI_QUIRK(0x1043, 0x3f10, "ASUS Strix G835LR_LW_LX", ALC287_FIXUP_TAS2781_I2C),
11033 	SND_PCI_QUIRK(0x1043, 0x3f20, "ASUS Strix G615LR_LW", ALC287_FIXUP_TAS2781_I2C),
11034 	SND_PCI_QUIRK(0x1043, 0x3f30, "ASUS Strix G815LR_LW", ALC287_FIXUP_TAS2781_I2C),
11035 	SND_PCI_QUIRK(0x1043, 0x3fd0, "ASUS B3605CVA", ALC245_FIXUP_CS35L41_SPI_2),
11036 	SND_PCI_QUIRK(0x1043, 0x3ff0, "ASUS B5405CVA", ALC245_FIXUP_CS35L41_SPI_2),
11037 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
11038 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
11039 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
11040 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
11041 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
11042 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
11043 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
11044 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
11045 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
11046 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
11047 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
11048 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
11049 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
11050 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
11051 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
11052 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
11053 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
11054 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
11055 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
11056 	SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
11057 	SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11058 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
11059 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
11060 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
11061 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
11062 	SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
11063 	SND_PCI_QUIRK(0x10ec, 0x12f6, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
11064 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
11065 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
11066 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
11067 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
11068 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
11069 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
11070 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
11071 	SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
11072 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
11073 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
11074 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
11075 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
11076 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
11077 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
11078 	SND_PCI_QUIRK(0x144d, 0xca06, "Samsung Galaxy Book3 360 (NP730QFG)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
11079 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
11080 	SND_PCI_QUIRK(0x144d, 0xc870, "Samsung Galaxy Book2 Pro (NP950XED)", ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS),
11081 	SND_PCI_QUIRK(0x144d, 0xc872, "Samsung Galaxy Book2 Pro (NP950XEE)", ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS),
11082 	SND_PCI_QUIRK(0x144d, 0xc886, "Samsung Galaxy Book3 Pro (NP964XFG)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11083 	SND_PCI_QUIRK(0x144d, 0xc1ca, "Samsung Galaxy Book3 Pro 360 (NP960QFG)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11084 	SND_PCI_QUIRK(0x144d, 0xc1cc, "Samsung Galaxy Book3 Ultra (NT960XFH)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11085 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
11086 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
11087 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
11088 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
11089 	SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
11090 	SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11091 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11092 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11093 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11094 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11095 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11096 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11097 	SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11098 	SND_PCI_QUIRK(0x1558, 0x28c1, "Clevo V370VND", ALC2XX_FIXUP_HEADSET_MIC),
11099 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11100 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11101 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11102 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11103 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11104 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11105 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11106 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11107 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11108 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11109 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11110 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11111 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11112 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11113 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11114 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11115 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11116 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11117 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11118 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11119 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11120 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11121 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11122 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11123 	SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11124 	SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11125 	SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11126 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11127 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11128 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11129 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11130 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11131 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11132 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11133 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11134 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11135 	SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11136 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11137 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11138 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11139 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11140 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11141 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11142 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11143 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
11144 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
11145 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
11146 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11147 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11148 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11149 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11150 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11151 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
11152 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11153 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11154 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11155 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11156 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11157 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11158 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11159 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11160 	SND_PCI_QUIRK(0x1558, 0xa554, "VAIO VJFH52", ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE),
11161 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11162 	SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11163 	SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11164 	SND_PCI_QUIRK(0x1558, 0xa741, "Clevo V54x_6x_TNE", ALC245_FIXUP_CLEVO_NOISY_MIC),
11165 	SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC245_FIXUP_CLEVO_NOISY_MIC),
11166 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11167 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11168 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11169 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11170 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11171 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11172 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
11173 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
11174 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
11175 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
11176 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
11177 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
11178 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
11179 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
11180 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
11181 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
11182 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
11183 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
11184 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
11185 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
11186 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
11187 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
11188 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
11189 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
11190 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
11191 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11192 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
11193 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
11194 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
11195 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11196 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11197 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
11198 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
11199 	SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
11200 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
11201 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11202 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11203 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
11204 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11205 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11206 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11207 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11208 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
11209 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
11210 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
11211 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
11212 	SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11213 	SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11214 	SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11215 	SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11216 	SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11217 	SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11218 	SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11219 	SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11220 	SND_PCI_QUIRK(0x17aa, 0x231e, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
11221 	SND_PCI_QUIRK(0x17aa, 0x231f, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
11222 	SND_PCI_QUIRK(0x17aa, 0x2326, "Hera2", ALC287_FIXUP_TAS2781_I2C),
11223 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
11224 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
11225 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11226 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11227 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11228 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11229 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11230 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11231 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11232 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11233 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
11234 	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
11235 	SND_PCI_QUIRK(0x17aa, 0x3384, "ThinkCentre M90a PRO", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11236 	SND_PCI_QUIRK(0x17aa, 0x3386, "ThinkCentre M90a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11237 	SND_PCI_QUIRK(0x17aa, 0x3387, "ThinkCentre M70a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11238 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11239 	HDA_CODEC_QUIRK(0x17aa, 0x3802, "DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11240 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8", ALC287_FIXUP_TAS2781_I2C),
11241 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
11242 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
11243 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
11244 	HDA_CODEC_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
11245 	SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11246 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
11247 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
11248 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11249 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
11250 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
11251 	SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
11252 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11253 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11254 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11255 	SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
11256 	SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
11257 	SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
11258 	SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11259 	HDA_CODEC_QUIRK(0x17aa, 0x386e, "Legion Y9000X 2022 IAH7", ALC287_FIXUP_CS35L41_I2C_2),
11260 	SND_PCI_QUIRK(0x17aa, 0x386e, "Yoga Pro 7 14ARP8", ALC285_FIXUP_SPEAKER2_TO_DAC1),
11261 	HDA_CODEC_QUIRK(0x17aa, 0x38a8, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C), /* this must match before PCI SSID 17aa:386f below */
11262 	SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7i 16IAX7", ALC287_FIXUP_CS35L41_I2C_2),
11263 	SND_PCI_QUIRK(0x17aa, 0x3870, "Lenovo Yoga 7 14ARB7", ALC287_FIXUP_YOGA7_14ARB7_I2C),
11264 	SND_PCI_QUIRK(0x17aa, 0x3877, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
11265 	SND_PCI_QUIRK(0x17aa, 0x3878, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
11266 	SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
11267 	SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
11268 	SND_PCI_QUIRK(0x17aa, 0x387f, "Yoga S780-16 pro dual LX", ALC287_FIXUP_TAS2781_I2C),
11269 	SND_PCI_QUIRK(0x17aa, 0x3880, "Yoga S780-16 pro dual YC", ALC287_FIXUP_TAS2781_I2C),
11270 	SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
11271 	SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11272 	SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11273 	SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
11274 	SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11275 	SND_PCI_QUIRK(0x17aa, 0x38a5, "Y580P AMD dual", ALC287_FIXUP_TAS2781_I2C),
11276 	SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
11277 	SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
11278 	SND_PCI_QUIRK(0x17aa, 0x38a9, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11279 	SND_PCI_QUIRK(0x17aa, 0x38ab, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11280 	SND_PCI_QUIRK(0x17aa, 0x38b4, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
11281 	SND_PCI_QUIRK(0x17aa, 0x38b5, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
11282 	SND_PCI_QUIRK(0x17aa, 0x38b6, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
11283 	SND_PCI_QUIRK(0x17aa, 0x38b7, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
11284 	SND_PCI_QUIRK(0x17aa, 0x38b8, "Yoga S780-14.5 proX AMD YC Dual", ALC287_FIXUP_TAS2781_I2C),
11285 	SND_PCI_QUIRK(0x17aa, 0x38b9, "Yoga S780-14.5 proX AMD LX Dual", ALC287_FIXUP_TAS2781_I2C),
11286 	SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
11287 	SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
11288 	SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
11289 	SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
11290 	SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
11291 	SND_PCI_QUIRK(0x17aa, 0x38c7, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
11292 	SND_PCI_QUIRK(0x17aa, 0x38c8, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
11293 	SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11294 	SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
11295 	SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
11296 	SND_PCI_QUIRK(0x17aa, 0x38d3, "Yoga S990-16 Pro IMH YC Dual", ALC287_FIXUP_TAS2781_I2C),
11297 	SND_PCI_QUIRK(0x17aa, 0x38d4, "Yoga S990-16 Pro IMH VECO Dual", ALC287_FIXUP_TAS2781_I2C),
11298 	SND_PCI_QUIRK(0x17aa, 0x38d5, "Yoga S990-16 Pro IMH YC Quad", ALC287_FIXUP_TAS2781_I2C),
11299 	SND_PCI_QUIRK(0x17aa, 0x38d6, "Yoga S990-16 Pro IMH VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11300 	SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
11301 	SND_PCI_QUIRK(0x17aa, 0x38df, "Yoga Y990 Intel YC Dual", ALC287_FIXUP_TAS2781_I2C),
11302 	SND_PCI_QUIRK(0x17aa, 0x38e0, "Yoga Y990 Intel VECO Dual", ALC287_FIXUP_TAS2781_I2C),
11303 	SND_PCI_QUIRK(0x17aa, 0x38f8, "Yoga Book 9i", ALC287_FIXUP_TAS2781_I2C),
11304 	SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11305 	SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11306 	SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11307 	SND_PCI_QUIRK(0x17aa, 0x38fd, "ThinkBook plus Gen5 Hybrid", ALC287_FIXUP_TAS2781_I2C),
11308 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11309 	SND_PCI_QUIRK(0x17aa, 0x390d, "Lenovo Yoga Pro 7 14ASP10", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11310 	SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
11311 	SND_PCI_QUIRK(0x17aa, 0x391f, "Yoga S990-16 pro Quad YC Quad", ALC287_FIXUP_TAS2781_I2C),
11312 	SND_PCI_QUIRK(0x17aa, 0x3920, "Yoga S990-16 pro Quad VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11313 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
11314 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11315 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
11316 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11317 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
11318 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
11319 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11320 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
11321 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
11322 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
11323 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
11324 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
11325 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
11326 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
11327 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
11328 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11329 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11330 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11331 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
11332 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11333 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11334 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11335 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
11336 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
11337 	SND_PCI_QUIRK(0x1849, 0x0269, "Positivo Master C6400", ALC269VB_FIXUP_ASUS_ZENBOOK),
11338 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
11339 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
11340 	SND_PCI_QUIRK(0x1854, 0x0440, "LG CQ6", ALC256_FIXUP_HEADPHONE_AMP_VOL),
11341 	SND_PCI_QUIRK(0x1854, 0x0441, "LG CQ6 AIO", ALC256_FIXUP_HEADPHONE_AMP_VOL),
11342 	SND_PCI_QUIRK(0x1854, 0x0488, "LG gram 16 (16Z90R)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11343 	SND_PCI_QUIRK(0x1854, 0x048a, "LG gram 17 (17ZD90R)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11344 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
11345 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
11346 	SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
11347 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
11348 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
11349 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
11350 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
11351 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
11352 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
11353 	SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11354 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
11355 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
11356 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
11357 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
11358 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11359 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11360 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11361 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
11362 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
11363 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
11364 	SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
11365 	SND_PCI_QUIRK(0x1d05, 0x1409, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
11366 	SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
11367 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
11368 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
11369 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
11370 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
11371 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
11372 	SND_PCI_QUIRK(0x1f66, 0x0105, "Ayaneo Portable Game Player", ALC287_FIXUP_CS35L41_I2C_2),
11373 	SND_PCI_QUIRK(0x2014, 0x800a, "Positivo ARN50", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11374 	SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11375 	SND_PCI_QUIRK(0x2782, 0x0228, "Infinix ZERO BOOK 13", ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13),
11376 	SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
11377 	SND_PCI_QUIRK(0x2782, 0x1701, "Infinix Y4 Max", ALC269VC_FIXUP_INFINIX_Y4_MAX),
11378 	SND_PCI_QUIRK(0x2782, 0x1705, "MEDION E15433", ALC269VC_FIXUP_INFINIX_Y4_MAX),
11379 	SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
11380 	SND_PCI_QUIRK(0x2782, 0x4900, "MEDION E15443", ALC233_FIXUP_MEDION_MTL_SPK),
11381 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
11382 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
11383 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
11384 	SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
11385 	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11386 	SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11387 	SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11388 	SND_PCI_QUIRK(0xf111, 0x000c, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11389 
11390 #if 0
11391 	/* Below is a quirk table taken from the old code.
11392 	 * Basically the device should work as is without the fixup table.
11393 	 * If BIOS doesn't give a proper info, enable the corresponding
11394 	 * fixup entry.
11395 	 */
11396 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
11397 		      ALC269_FIXUP_AMIC),
11398 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
11399 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
11400 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
11401 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
11402 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
11403 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
11404 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
11405 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
11406 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
11407 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
11408 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
11409 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
11410 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
11411 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
11412 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
11413 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
11414 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
11415 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
11416 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
11417 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
11418 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
11419 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
11420 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
11421 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
11422 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
11423 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
11424 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
11425 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
11426 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
11427 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
11428 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
11429 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
11430 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
11431 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
11432 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
11433 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
11434 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
11435 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
11436 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
11437 #endif
11438 	{}
11439 };
11440 
11441 static const struct hda_quirk alc269_fixup_vendor_tbl[] = {
11442 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
11443 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
11444 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
11445 	SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo XPAD", ALC269_FIXUP_LENOVO_XPAD_ACPI),
11446 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
11447 	{}
11448 };
11449 
11450 static const struct hda_model_fixup alc269_fixup_models[] = {
11451 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
11452 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
11453 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
11454 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
11455 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
11456 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
11457 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
11458 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
11459 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
11460 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
11461 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11462 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
11463 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
11464 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
11465 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
11466 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
11467 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
11468 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
11469 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
11470 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
11471 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
11472 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
11473 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
11474 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
11475 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
11476 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
11477 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
11478 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
11479 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
11480 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
11481 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
11482 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
11483 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
11484 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
11485 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
11486 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
11487 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
11488 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
11489 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
11490 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
11491 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
11492 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
11493 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
11494 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
11495 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
11496 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
11497 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
11498 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
11499 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
11500 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
11501 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
11502 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
11503 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
11504 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
11505 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
11506 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
11507 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
11508 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
11509 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
11510 	{.id = ALC269_FIXUP_LENOVO_XPAD_ACPI, .name = "lenovo-xpad-led"},
11511 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
11512 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
11513 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
11514 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
11515 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
11516 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
11517 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
11518 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
11519 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
11520 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
11521 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
11522 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11523 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
11524 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
11525 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
11526 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
11527 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
11528 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
11529 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
11530 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
11531 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
11532 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
11533 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
11534 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
11535 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
11536 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
11537 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
11538 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
11539 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
11540 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
11541 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
11542 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
11543 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
11544 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
11545 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
11546 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
11547 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
11548 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
11549 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
11550 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
11551 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
11552 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
11553 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
11554 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
11555 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
11556 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
11557 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
11558 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
11559 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
11560 	{.id = ALC256_FIXUP_CHROME_BOOK, .name = "alc-2024y-chromebook"},
11561 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
11562 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
11563 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
11564 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
11565 	{.id = ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS, .name = "alc298-samsung-amp-v2-2-amps"},
11566 	{.id = ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS, .name = "alc298-samsung-amp-v2-4-amps"},
11567 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
11568 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
11569 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
11570 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
11571 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
11572 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
11573 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
11574 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_DF1, .name = "alc285-hp-spectre-x360-df1"},
11575 	{.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
11576 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
11577 	{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
11578 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
11579 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
11580 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
11581 	{.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
11582 	{.id = ALC2XX_FIXUP_HEADSET_MIC, .name = "alc2xx-fixup-headset-mic"},
11583 	{}
11584 };
11585 #define ALC225_STANDARD_PINS \
11586 	{0x21, 0x04211020}
11587 
11588 #define ALC256_STANDARD_PINS \
11589 	{0x12, 0x90a60140}, \
11590 	{0x14, 0x90170110}, \
11591 	{0x21, 0x02211020}
11592 
11593 #define ALC282_STANDARD_PINS \
11594 	{0x14, 0x90170110}
11595 
11596 #define ALC290_STANDARD_PINS \
11597 	{0x12, 0x99a30130}
11598 
11599 #define ALC292_STANDARD_PINS \
11600 	{0x14, 0x90170110}, \
11601 	{0x15, 0x0221401f}
11602 
11603 #define ALC295_STANDARD_PINS \
11604 	{0x12, 0xb7a60130}, \
11605 	{0x14, 0x90170110}, \
11606 	{0x21, 0x04211020}
11607 
11608 #define ALC298_STANDARD_PINS \
11609 	{0x12, 0x90a60130}, \
11610 	{0x21, 0x03211020}
11611 
11612 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
11613 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
11614 		{0x14, 0x01014020},
11615 		{0x17, 0x90170110},
11616 		{0x18, 0x02a11030},
11617 		{0x19, 0x0181303F},
11618 		{0x21, 0x0221102f}),
11619 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
11620 		{0x12, 0x90a601c0},
11621 		{0x14, 0x90171120},
11622 		{0x21, 0x02211030}),
11623 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
11624 		{0x14, 0x90170110},
11625 		{0x1b, 0x90a70130},
11626 		{0x21, 0x03211020}),
11627 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
11628 		{0x1a, 0x90a70130},
11629 		{0x1b, 0x90170110},
11630 		{0x21, 0x03211020}),
11631 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11632 		ALC225_STANDARD_PINS,
11633 		{0x12, 0xb7a60130},
11634 		{0x14, 0x901701a0}),
11635 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11636 		ALC225_STANDARD_PINS,
11637 		{0x12, 0xb7a60130},
11638 		{0x14, 0x901701b0}),
11639 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11640 		ALC225_STANDARD_PINS,
11641 		{0x12, 0xb7a60150},
11642 		{0x14, 0x901701a0}),
11643 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11644 		ALC225_STANDARD_PINS,
11645 		{0x12, 0xb7a60150},
11646 		{0x14, 0x901701b0}),
11647 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11648 		ALC225_STANDARD_PINS,
11649 		{0x12, 0xb7a60130},
11650 		{0x1b, 0x90170110}),
11651 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11652 		{0x1b, 0x01111010},
11653 		{0x1e, 0x01451130},
11654 		{0x21, 0x02211020}),
11655 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
11656 		{0x12, 0x90a60140},
11657 		{0x14, 0x90170110},
11658 		{0x19, 0x02a11030},
11659 		{0x21, 0x02211020}),
11660 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11661 		{0x14, 0x90170110},
11662 		{0x19, 0x02a11030},
11663 		{0x1a, 0x02a11040},
11664 		{0x1b, 0x01014020},
11665 		{0x21, 0x0221101f}),
11666 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11667 		{0x14, 0x90170110},
11668 		{0x19, 0x02a11030},
11669 		{0x1a, 0x02a11040},
11670 		{0x1b, 0x01011020},
11671 		{0x21, 0x0221101f}),
11672 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11673 		{0x14, 0x90170110},
11674 		{0x19, 0x02a11020},
11675 		{0x1a, 0x02a11030},
11676 		{0x21, 0x0221101f}),
11677 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
11678 		{0x21, 0x02211010}),
11679 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
11680 		{0x14, 0x90170110},
11681 		{0x19, 0x02a11020},
11682 		{0x21, 0x02211030}),
11683 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
11684 		{0x14, 0x90170110},
11685 		{0x21, 0x02211020}),
11686 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11687 		{0x14, 0x90170130},
11688 		{0x21, 0x02211040}),
11689 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11690 		{0x12, 0x90a60140},
11691 		{0x14, 0x90170110},
11692 		{0x21, 0x02211020}),
11693 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11694 		{0x12, 0x90a60160},
11695 		{0x14, 0x90170120},
11696 		{0x21, 0x02211030}),
11697 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11698 		{0x14, 0x90170110},
11699 		{0x1b, 0x02011020},
11700 		{0x21, 0x0221101f}),
11701 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11702 		{0x14, 0x90170110},
11703 		{0x1b, 0x01011020},
11704 		{0x21, 0x0221101f}),
11705 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11706 		{0x14, 0x90170130},
11707 		{0x1b, 0x01014020},
11708 		{0x21, 0x0221103f}),
11709 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11710 		{0x14, 0x90170130},
11711 		{0x1b, 0x01011020},
11712 		{0x21, 0x0221103f}),
11713 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11714 		{0x14, 0x90170130},
11715 		{0x1b, 0x02011020},
11716 		{0x21, 0x0221103f}),
11717 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11718 		{0x14, 0x90170150},
11719 		{0x1b, 0x02011020},
11720 		{0x21, 0x0221105f}),
11721 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11722 		{0x14, 0x90170110},
11723 		{0x1b, 0x01014020},
11724 		{0x21, 0x0221101f}),
11725 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11726 		{0x12, 0x90a60160},
11727 		{0x14, 0x90170120},
11728 		{0x17, 0x90170140},
11729 		{0x21, 0x0321102f}),
11730 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11731 		{0x12, 0x90a60160},
11732 		{0x14, 0x90170130},
11733 		{0x21, 0x02211040}),
11734 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11735 		{0x12, 0x90a60160},
11736 		{0x14, 0x90170140},
11737 		{0x21, 0x02211050}),
11738 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11739 		{0x12, 0x90a60170},
11740 		{0x14, 0x90170120},
11741 		{0x21, 0x02211030}),
11742 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11743 		{0x12, 0x90a60170},
11744 		{0x14, 0x90170130},
11745 		{0x21, 0x02211040}),
11746 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11747 		{0x12, 0x90a60170},
11748 		{0x14, 0x90171130},
11749 		{0x21, 0x02211040}),
11750 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11751 		{0x12, 0x90a60170},
11752 		{0x14, 0x90170140},
11753 		{0x21, 0x02211050}),
11754 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11755 		{0x12, 0x90a60180},
11756 		{0x14, 0x90170130},
11757 		{0x21, 0x02211040}),
11758 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11759 		{0x12, 0x90a60180},
11760 		{0x14, 0x90170120},
11761 		{0x21, 0x02211030}),
11762 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11763 		{0x1b, 0x01011020},
11764 		{0x21, 0x02211010}),
11765 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
11766 		{0x14, 0x90170110},
11767 		{0x1b, 0x90a70130},
11768 		{0x21, 0x04211020}),
11769 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
11770 		{0x14, 0x90170110},
11771 		{0x1b, 0x90a70130},
11772 		{0x21, 0x03211020}),
11773 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11774 		{0x12, 0x90a60130},
11775 		{0x14, 0x90170110},
11776 		{0x21, 0x03211020}),
11777 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11778 		{0x12, 0x90a60130},
11779 		{0x14, 0x90170110},
11780 		{0x21, 0x04211020}),
11781 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11782 		{0x1a, 0x90a70130},
11783 		{0x1b, 0x90170110},
11784 		{0x21, 0x03211020}),
11785        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
11786 		{0x14, 0x90170110},
11787 		{0x19, 0x02a11020},
11788 		{0x21, 0x0221101f}),
11789        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
11790 		{0x17, 0x90170110},
11791 		{0x19, 0x03a11030},
11792 		{0x21, 0x03211020}),
11793 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
11794 		{0x12, 0x90a60130},
11795 		{0x14, 0x90170110},
11796 		{0x15, 0x0421101f},
11797 		{0x1a, 0x04a11020}),
11798 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
11799 		{0x12, 0x90a60140},
11800 		{0x14, 0x90170110},
11801 		{0x15, 0x0421101f},
11802 		{0x18, 0x02811030},
11803 		{0x1a, 0x04a1103f},
11804 		{0x1b, 0x02011020}),
11805 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11806 		ALC282_STANDARD_PINS,
11807 		{0x12, 0x99a30130},
11808 		{0x19, 0x03a11020},
11809 		{0x21, 0x0321101f}),
11810 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11811 		ALC282_STANDARD_PINS,
11812 		{0x12, 0x99a30130},
11813 		{0x19, 0x03a11020},
11814 		{0x21, 0x03211040}),
11815 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11816 		ALC282_STANDARD_PINS,
11817 		{0x12, 0x99a30130},
11818 		{0x19, 0x03a11030},
11819 		{0x21, 0x03211020}),
11820 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11821 		ALC282_STANDARD_PINS,
11822 		{0x12, 0x99a30130},
11823 		{0x19, 0x04a11020},
11824 		{0x21, 0x0421101f}),
11825 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
11826 		ALC282_STANDARD_PINS,
11827 		{0x12, 0x90a60140},
11828 		{0x19, 0x04a11030},
11829 		{0x21, 0x04211020}),
11830 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11831 		ALC282_STANDARD_PINS,
11832 		{0x12, 0x90a609c0},
11833 		{0x18, 0x03a11830},
11834 		{0x19, 0x04a19831},
11835 		{0x1a, 0x0481303f},
11836 		{0x1b, 0x04211020},
11837 		{0x21, 0x0321101f}),
11838 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11839 		ALC282_STANDARD_PINS,
11840 		{0x12, 0x90a60940},
11841 		{0x18, 0x03a11830},
11842 		{0x19, 0x04a19831},
11843 		{0x1a, 0x0481303f},
11844 		{0x1b, 0x04211020},
11845 		{0x21, 0x0321101f}),
11846 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11847 		ALC282_STANDARD_PINS,
11848 		{0x12, 0x90a60130},
11849 		{0x21, 0x0321101f}),
11850 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11851 		{0x12, 0x90a60160},
11852 		{0x14, 0x90170120},
11853 		{0x21, 0x02211030}),
11854 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11855 		ALC282_STANDARD_PINS,
11856 		{0x12, 0x90a60130},
11857 		{0x19, 0x03a11020},
11858 		{0x21, 0x0321101f}),
11859 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11860 		{0x12, 0x90a60130},
11861 		{0x14, 0x90170110},
11862 		{0x19, 0x04a11040},
11863 		{0x21, 0x04211020}),
11864 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11865 		{0x14, 0x90170110},
11866 		{0x19, 0x04a11040},
11867 		{0x1d, 0x40600001},
11868 		{0x21, 0x04211020}),
11869 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
11870 		{0x14, 0x90170110},
11871 		{0x19, 0x04a11040},
11872 		{0x21, 0x04211020}),
11873 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
11874 		{0x14, 0x90170110},
11875 		{0x17, 0x90170111},
11876 		{0x19, 0x03a11030},
11877 		{0x21, 0x03211020}),
11878 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11879 		{0x17, 0x90170110},
11880 		{0x19, 0x03a11030},
11881 		{0x21, 0x03211020}),
11882 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11883 		{0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
11884 		{0x19, 0x04a11040},
11885 		{0x21, 0x04211020}),
11886 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
11887 		{0x12, 0x90a60130},
11888 		{0x17, 0x90170110},
11889 		{0x21, 0x02211020}),
11890 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
11891 		{0x12, 0x90a60120},
11892 		{0x14, 0x90170110},
11893 		{0x21, 0x0321101f}),
11894 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11895 		ALC290_STANDARD_PINS,
11896 		{0x15, 0x04211040},
11897 		{0x18, 0x90170112},
11898 		{0x1a, 0x04a11020}),
11899 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11900 		ALC290_STANDARD_PINS,
11901 		{0x15, 0x04211040},
11902 		{0x18, 0x90170110},
11903 		{0x1a, 0x04a11020}),
11904 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11905 		ALC290_STANDARD_PINS,
11906 		{0x15, 0x0421101f},
11907 		{0x1a, 0x04a11020}),
11908 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11909 		ALC290_STANDARD_PINS,
11910 		{0x15, 0x04211020},
11911 		{0x1a, 0x04a11040}),
11912 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11913 		ALC290_STANDARD_PINS,
11914 		{0x14, 0x90170110},
11915 		{0x15, 0x04211020},
11916 		{0x1a, 0x04a11040}),
11917 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11918 		ALC290_STANDARD_PINS,
11919 		{0x14, 0x90170110},
11920 		{0x15, 0x04211020},
11921 		{0x1a, 0x04a11020}),
11922 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11923 		ALC290_STANDARD_PINS,
11924 		{0x14, 0x90170110},
11925 		{0x15, 0x0421101f},
11926 		{0x1a, 0x04a11020}),
11927 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11928 		ALC292_STANDARD_PINS,
11929 		{0x12, 0x90a60140},
11930 		{0x16, 0x01014020},
11931 		{0x19, 0x01a19030}),
11932 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11933 		ALC292_STANDARD_PINS,
11934 		{0x12, 0x90a60140},
11935 		{0x16, 0x01014020},
11936 		{0x18, 0x02a19031},
11937 		{0x19, 0x01a1903e}),
11938 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
11939 		ALC292_STANDARD_PINS,
11940 		{0x12, 0x90a60140}),
11941 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11942 		ALC292_STANDARD_PINS,
11943 		{0x13, 0x90a60140},
11944 		{0x16, 0x21014020},
11945 		{0x19, 0x21a19030}),
11946 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11947 		ALC292_STANDARD_PINS,
11948 		{0x13, 0x90a60140}),
11949 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
11950 		{0x17, 0x90170110},
11951 		{0x21, 0x04211020}),
11952 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
11953 		{0x14, 0x90170110},
11954 		{0x1b, 0x90a70130},
11955 		{0x21, 0x04211020}),
11956 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11957 		{0x12, 0x90a60130},
11958 		{0x17, 0x90170110},
11959 		{0x21, 0x03211020}),
11960 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11961 		{0x12, 0x90a60130},
11962 		{0x17, 0x90170110},
11963 		{0x21, 0x04211020}),
11964 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11965 		{0x12, 0x90a60130},
11966 		{0x17, 0x90170110},
11967 		{0x21, 0x03211020}),
11968 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11969 		{0x12, 0x90a60120},
11970 		{0x17, 0x90170110},
11971 		{0x21, 0x04211030}),
11972 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11973 		{0x12, 0x90a60130},
11974 		{0x17, 0x90170110},
11975 		{0x21, 0x03211020}),
11976 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11977 		{0x12, 0x90a60130},
11978 		{0x17, 0x90170110},
11979 		{0x21, 0x03211020}),
11980 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11981 		ALC298_STANDARD_PINS,
11982 		{0x17, 0x90170110}),
11983 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11984 		ALC298_STANDARD_PINS,
11985 		{0x17, 0x90170140}),
11986 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11987 		ALC298_STANDARD_PINS,
11988 		{0x17, 0x90170150}),
11989 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11990 		{0x12, 0xb7a60140},
11991 		{0x13, 0xb7a60150},
11992 		{0x17, 0x90170110},
11993 		{0x1a, 0x03011020},
11994 		{0x21, 0x03211030}),
11995 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11996 		{0x12, 0xb7a60140},
11997 		{0x17, 0x90170110},
11998 		{0x1a, 0x03a11030},
11999 		{0x21, 0x03211020}),
12000 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
12001 		ALC225_STANDARD_PINS,
12002 		{0x12, 0xb7a60130},
12003 		{0x17, 0x90170110}),
12004 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
12005 		{0x14, 0x01014010},
12006 		{0x17, 0x90170120},
12007 		{0x18, 0x02a11030},
12008 		{0x19, 0x02a1103f},
12009 		{0x21, 0x0221101f}),
12010 	{}
12011 };
12012 
12013 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
12014  * more machines, don't need to match all valid pins, just need to match
12015  * all the pins defined in the tbl. Just because of this reason, it is possible
12016  * that a single machine matches multiple tbls, so there is one limitation:
12017  *   at most one tbl is allowed to define for the same vendor and same codec
12018  */
12019 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
12020 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
12021 		{0x19, 0x40000000}),
12022 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
12023 		{0x19, 0x40000000},
12024 		{0x1b, 0x40000000}),
12025 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
12026 		{0x19, 0x40000000},
12027 		{0x1b, 0x40000000}),
12028 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
12029 		{0x19, 0x40000000},
12030 		{0x1a, 0x40000000}),
12031 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
12032 		{0x19, 0x40000000},
12033 		{0x1a, 0x40000000}),
12034 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
12035 		{0x19, 0x40000000},
12036 		{0x1a, 0x40000000}),
12037 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
12038 		{0x19, 0x40000000}),
12039 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1558, "Clevo", ALC2XX_FIXUP_HEADSET_MIC,
12040 		{0x19, 0x40000000}),
12041 	{}
12042 };
12043 
alc269_fill_coef(struct hda_codec * codec)12044 static void alc269_fill_coef(struct hda_codec *codec)
12045 {
12046 	struct alc_spec *spec = codec->spec;
12047 	int val;
12048 
12049 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
12050 		return;
12051 
12052 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
12053 		alc_write_coef_idx(codec, 0xf, 0x960b);
12054 		alc_write_coef_idx(codec, 0xe, 0x8817);
12055 	}
12056 
12057 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
12058 		alc_write_coef_idx(codec, 0xf, 0x960b);
12059 		alc_write_coef_idx(codec, 0xe, 0x8814);
12060 	}
12061 
12062 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
12063 		/* Power up output pin */
12064 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
12065 	}
12066 
12067 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
12068 		val = alc_read_coef_idx(codec, 0xd);
12069 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
12070 			/* Capless ramp up clock control */
12071 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
12072 		}
12073 		val = alc_read_coef_idx(codec, 0x17);
12074 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
12075 			/* Class D power on reset */
12076 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
12077 		}
12078 	}
12079 
12080 	/* HP */
12081 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
12082 }
12083 
12084 /*
12085  */
patch_alc269(struct hda_codec * codec)12086 static int patch_alc269(struct hda_codec *codec)
12087 {
12088 	struct alc_spec *spec;
12089 	int err;
12090 
12091 	err = alc_alloc_spec(codec, 0x0b);
12092 	if (err < 0)
12093 		return err;
12094 
12095 	spec = codec->spec;
12096 	spec->gen.shared_mic_vref_pin = 0x18;
12097 	codec->power_save_node = 0;
12098 	spec->en_3kpull_low = true;
12099 
12100 	codec->patch_ops.suspend = alc269_suspend;
12101 	codec->patch_ops.resume = alc269_resume;
12102 	spec->shutup = alc_default_shutup;
12103 	spec->init_hook = alc_default_init;
12104 
12105 	switch (codec->core.vendor_id) {
12106 	case 0x10ec0269:
12107 		spec->codec_variant = ALC269_TYPE_ALC269VA;
12108 		switch (alc_get_coef0(codec) & 0x00f0) {
12109 		case 0x0010:
12110 			if (codec->bus->pci &&
12111 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
12112 			    spec->cdefine.platform_type == 1)
12113 				err = alc_codec_rename(codec, "ALC271X");
12114 			spec->codec_variant = ALC269_TYPE_ALC269VB;
12115 			break;
12116 		case 0x0020:
12117 			if (codec->bus->pci &&
12118 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
12119 			    codec->bus->pci->subsystem_device == 0x21f3)
12120 				err = alc_codec_rename(codec, "ALC3202");
12121 			spec->codec_variant = ALC269_TYPE_ALC269VC;
12122 			break;
12123 		case 0x0030:
12124 			spec->codec_variant = ALC269_TYPE_ALC269VD;
12125 			break;
12126 		default:
12127 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
12128 		}
12129 		if (err < 0)
12130 			goto error;
12131 		spec->shutup = alc269_shutup;
12132 		spec->init_hook = alc269_fill_coef;
12133 		alc269_fill_coef(codec);
12134 		break;
12135 
12136 	case 0x10ec0280:
12137 	case 0x10ec0290:
12138 		spec->codec_variant = ALC269_TYPE_ALC280;
12139 		break;
12140 	case 0x10ec0282:
12141 		spec->codec_variant = ALC269_TYPE_ALC282;
12142 		spec->shutup = alc282_shutup;
12143 		spec->init_hook = alc282_init;
12144 		break;
12145 	case 0x10ec0233:
12146 	case 0x10ec0283:
12147 		spec->codec_variant = ALC269_TYPE_ALC283;
12148 		spec->shutup = alc283_shutup;
12149 		spec->init_hook = alc283_init;
12150 		break;
12151 	case 0x10ec0284:
12152 	case 0x10ec0292:
12153 		spec->codec_variant = ALC269_TYPE_ALC284;
12154 		break;
12155 	case 0x10ec0293:
12156 		spec->codec_variant = ALC269_TYPE_ALC293;
12157 		break;
12158 	case 0x10ec0286:
12159 	case 0x10ec0288:
12160 		spec->codec_variant = ALC269_TYPE_ALC286;
12161 		break;
12162 	case 0x10ec0298:
12163 		spec->codec_variant = ALC269_TYPE_ALC298;
12164 		break;
12165 	case 0x10ec0235:
12166 	case 0x10ec0255:
12167 		spec->codec_variant = ALC269_TYPE_ALC255;
12168 		spec->shutup = alc256_shutup;
12169 		spec->init_hook = alc256_init;
12170 		break;
12171 	case 0x10ec0230:
12172 	case 0x10ec0236:
12173 	case 0x10ec0256:
12174 	case 0x19e58326:
12175 		spec->codec_variant = ALC269_TYPE_ALC256;
12176 		spec->shutup = alc256_shutup;
12177 		spec->init_hook = alc256_init;
12178 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
12179 		if (codec->core.vendor_id == 0x10ec0236 &&
12180 		    codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
12181 			spec->en_3kpull_low = false;
12182 		break;
12183 	case 0x10ec0257:
12184 		spec->codec_variant = ALC269_TYPE_ALC257;
12185 		spec->shutup = alc256_shutup;
12186 		spec->init_hook = alc256_init;
12187 		spec->gen.mixer_nid = 0;
12188 		spec->en_3kpull_low = false;
12189 		break;
12190 	case 0x10ec0215:
12191 	case 0x10ec0245:
12192 	case 0x10ec0285:
12193 	case 0x10ec0289:
12194 		if (alc_get_coef0(codec) & 0x0010)
12195 			spec->codec_variant = ALC269_TYPE_ALC245;
12196 		else
12197 			spec->codec_variant = ALC269_TYPE_ALC215;
12198 		spec->shutup = alc225_shutup;
12199 		spec->init_hook = alc225_init;
12200 		spec->gen.mixer_nid = 0;
12201 		break;
12202 	case 0x10ec0225:
12203 	case 0x10ec0295:
12204 	case 0x10ec0299:
12205 		spec->codec_variant = ALC269_TYPE_ALC225;
12206 		spec->shutup = alc225_shutup;
12207 		spec->init_hook = alc225_init;
12208 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
12209 		break;
12210 	case 0x10ec0287:
12211 		spec->codec_variant = ALC269_TYPE_ALC287;
12212 		spec->shutup = alc225_shutup;
12213 		spec->init_hook = alc225_init;
12214 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
12215 		break;
12216 	case 0x10ec0234:
12217 	case 0x10ec0274:
12218 	case 0x10ec0294:
12219 		spec->codec_variant = ALC269_TYPE_ALC294;
12220 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
12221 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
12222 		spec->init_hook = alc294_init;
12223 		break;
12224 	case 0x10ec0300:
12225 		spec->codec_variant = ALC269_TYPE_ALC300;
12226 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
12227 		break;
12228 	case 0x10ec0222:
12229 	case 0x10ec0623:
12230 		spec->codec_variant = ALC269_TYPE_ALC623;
12231 		spec->shutup = alc222_shutup;
12232 		spec->init_hook = alc222_init;
12233 		break;
12234 	case 0x10ec0700:
12235 	case 0x10ec0701:
12236 	case 0x10ec0703:
12237 	case 0x10ec0711:
12238 		spec->codec_variant = ALC269_TYPE_ALC700;
12239 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
12240 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
12241 		spec->init_hook = alc294_init;
12242 		break;
12243 
12244 	}
12245 
12246 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
12247 		spec->has_alc5505_dsp = 1;
12248 		spec->init_hook = alc5505_dsp_init;
12249 	}
12250 
12251 	alc_pre_init(codec);
12252 
12253 	snd_hda_pick_fixup(codec, alc269_fixup_models,
12254 		       alc269_fixup_tbl, alc269_fixups);
12255 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
12256 	 * the quirk breaks the latter (bko#214101).
12257 	 * Clear the wrong entry.
12258 	 */
12259 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
12260 	    codec->core.vendor_id == 0x10ec0294) {
12261 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
12262 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
12263 	}
12264 
12265 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
12266 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
12267 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
12268 			   alc269_fixups);
12269 
12270 	/*
12271 	 * Check whether ACPI describes companion amplifiers that require
12272 	 * component binding
12273 	 */
12274 	find_cirrus_companion_amps(codec);
12275 
12276 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12277 
12278 	alc_auto_parse_customize_define(codec);
12279 
12280 	if (has_cdefine_beep(codec))
12281 		spec->gen.beep_nid = 0x01;
12282 
12283 	/* automatic parse from the BIOS config */
12284 	err = alc269_parse_auto_config(codec);
12285 	if (err < 0)
12286 		goto error;
12287 
12288 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
12289 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
12290 		if (err < 0)
12291 			goto error;
12292 	}
12293 
12294 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12295 
12296 	return 0;
12297 
12298  error:
12299 	alc_free(codec);
12300 	return err;
12301 }
12302 
12303 /*
12304  * ALC861
12305  */
12306 
alc861_parse_auto_config(struct hda_codec * codec)12307 static int alc861_parse_auto_config(struct hda_codec *codec)
12308 {
12309 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
12310 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
12311 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
12312 }
12313 
12314 /* Pin config fixes */
12315 enum {
12316 	ALC861_FIXUP_FSC_AMILO_PI1505,
12317 	ALC861_FIXUP_AMP_VREF_0F,
12318 	ALC861_FIXUP_NO_JACK_DETECT,
12319 	ALC861_FIXUP_ASUS_A6RP,
12320 	ALC660_FIXUP_ASUS_W7J,
12321 };
12322 
12323 /* 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)12324 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
12325 			const struct hda_fixup *fix, int action)
12326 {
12327 	struct alc_spec *spec = codec->spec;
12328 	unsigned int val;
12329 
12330 	if (action != HDA_FIXUP_ACT_INIT)
12331 		return;
12332 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
12333 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
12334 		val |= AC_PINCTL_IN_EN;
12335 	val |= AC_PINCTL_VREF_50;
12336 	snd_hda_set_pin_ctl(codec, 0x0f, val);
12337 	spec->gen.keep_vref_in_automute = 1;
12338 }
12339 
12340 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)12341 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
12342 				     const struct hda_fixup *fix, int action)
12343 {
12344 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
12345 		codec->no_jack_detect = 1;
12346 }
12347 
12348 static const struct hda_fixup alc861_fixups[] = {
12349 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
12350 		.type = HDA_FIXUP_PINS,
12351 		.v.pins = (const struct hda_pintbl[]) {
12352 			{ 0x0b, 0x0221101f }, /* HP */
12353 			{ 0x0f, 0x90170310 }, /* speaker */
12354 			{ }
12355 		}
12356 	},
12357 	[ALC861_FIXUP_AMP_VREF_0F] = {
12358 		.type = HDA_FIXUP_FUNC,
12359 		.v.func = alc861_fixup_asus_amp_vref_0f,
12360 	},
12361 	[ALC861_FIXUP_NO_JACK_DETECT] = {
12362 		.type = HDA_FIXUP_FUNC,
12363 		.v.func = alc_fixup_no_jack_detect,
12364 	},
12365 	[ALC861_FIXUP_ASUS_A6RP] = {
12366 		.type = HDA_FIXUP_FUNC,
12367 		.v.func = alc861_fixup_asus_amp_vref_0f,
12368 		.chained = true,
12369 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
12370 	},
12371 	[ALC660_FIXUP_ASUS_W7J] = {
12372 		.type = HDA_FIXUP_VERBS,
12373 		.v.verbs = (const struct hda_verb[]) {
12374 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
12375 			 * for enabling outputs
12376 			 */
12377 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12378 			{ }
12379 		},
12380 	}
12381 };
12382 
12383 static const struct hda_quirk alc861_fixup_tbl[] = {
12384 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
12385 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
12386 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
12387 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
12388 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
12389 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
12390 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
12391 	{}
12392 };
12393 
12394 /*
12395  */
patch_alc861(struct hda_codec * codec)12396 static int patch_alc861(struct hda_codec *codec)
12397 {
12398 	struct alc_spec *spec;
12399 	int err;
12400 
12401 	err = alc_alloc_spec(codec, 0x15);
12402 	if (err < 0)
12403 		return err;
12404 
12405 	spec = codec->spec;
12406 	if (has_cdefine_beep(codec))
12407 		spec->gen.beep_nid = 0x23;
12408 
12409 	spec->power_hook = alc_power_eapd;
12410 
12411 	alc_pre_init(codec);
12412 
12413 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
12414 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12415 
12416 	/* automatic parse from the BIOS config */
12417 	err = alc861_parse_auto_config(codec);
12418 	if (err < 0)
12419 		goto error;
12420 
12421 	if (!spec->gen.no_analog) {
12422 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
12423 		if (err < 0)
12424 			goto error;
12425 	}
12426 
12427 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12428 
12429 	return 0;
12430 
12431  error:
12432 	alc_free(codec);
12433 	return err;
12434 }
12435 
12436 /*
12437  * ALC861-VD support
12438  *
12439  * Based on ALC882
12440  *
12441  * In addition, an independent DAC
12442  */
alc861vd_parse_auto_config(struct hda_codec * codec)12443 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12444 {
12445 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12446 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
12447 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
12448 }
12449 
12450 enum {
12451 	ALC660VD_FIX_ASUS_GPIO1,
12452 	ALC861VD_FIX_DALLAS,
12453 };
12454 
12455 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)12456 static void alc861vd_fixup_dallas(struct hda_codec *codec,
12457 				  const struct hda_fixup *fix, int action)
12458 {
12459 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12460 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
12461 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
12462 	}
12463 }
12464 
12465 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)12466 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
12467 				      const struct hda_fixup *fix, int action)
12468 {
12469 	struct alc_spec *spec = codec->spec;
12470 
12471 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
12472 		spec->gpio_mask |= 0x02;
12473 	alc_fixup_gpio(codec, action, 0x01);
12474 }
12475 
12476 static const struct hda_fixup alc861vd_fixups[] = {
12477 	[ALC660VD_FIX_ASUS_GPIO1] = {
12478 		.type = HDA_FIXUP_FUNC,
12479 		.v.func = alc660vd_fixup_asus_gpio1,
12480 	},
12481 	[ALC861VD_FIX_DALLAS] = {
12482 		.type = HDA_FIXUP_FUNC,
12483 		.v.func = alc861vd_fixup_dallas,
12484 	},
12485 };
12486 
12487 static const struct hda_quirk alc861vd_fixup_tbl[] = {
12488 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
12489 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
12490 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
12491 	{}
12492 };
12493 
12494 /*
12495  */
patch_alc861vd(struct hda_codec * codec)12496 static int patch_alc861vd(struct hda_codec *codec)
12497 {
12498 	struct alc_spec *spec;
12499 	int err;
12500 
12501 	err = alc_alloc_spec(codec, 0x0b);
12502 	if (err < 0)
12503 		return err;
12504 
12505 	spec = codec->spec;
12506 	if (has_cdefine_beep(codec))
12507 		spec->gen.beep_nid = 0x23;
12508 
12509 	spec->shutup = alc_eapd_shutup;
12510 
12511 	alc_pre_init(codec);
12512 
12513 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
12514 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12515 
12516 	/* automatic parse from the BIOS config */
12517 	err = alc861vd_parse_auto_config(codec);
12518 	if (err < 0)
12519 		goto error;
12520 
12521 	if (!spec->gen.no_analog) {
12522 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12523 		if (err < 0)
12524 			goto error;
12525 	}
12526 
12527 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12528 
12529 	return 0;
12530 
12531  error:
12532 	alc_free(codec);
12533 	return err;
12534 }
12535 
12536 /*
12537  * ALC662 support
12538  *
12539  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12540  * configuration.  Each pin widget can choose any input DACs and a mixer.
12541  * Each ADC is connected from a mixer of all inputs.  This makes possible
12542  * 6-channel independent captures.
12543  *
12544  * In addition, an independent DAC for the multi-playback (not used in this
12545  * driver yet).
12546  */
12547 
12548 /*
12549  * BIOS auto configuration
12550  */
12551 
alc662_parse_auto_config(struct hda_codec * codec)12552 static int alc662_parse_auto_config(struct hda_codec *codec)
12553 {
12554 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
12555 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
12556 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
12557 	const hda_nid_t *ssids;
12558 
12559 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
12560 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
12561 	    codec->core.vendor_id == 0x10ec0671)
12562 		ssids = alc663_ssids;
12563 	else
12564 		ssids = alc662_ssids;
12565 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
12566 }
12567 
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)12568 static void alc272_fixup_mario(struct hda_codec *codec,
12569 			       const struct hda_fixup *fix, int action)
12570 {
12571 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
12572 		return;
12573 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
12574 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
12575 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
12576 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12577 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
12578 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
12579 }
12580 
12581 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
12582 	{ .channels = 2,
12583 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
12584 	{ .channels = 4,
12585 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
12586 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
12587 	{ }
12588 };
12589 
12590 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)12591 static void alc_fixup_bass_chmap(struct hda_codec *codec,
12592 				    const struct hda_fixup *fix, int action)
12593 {
12594 	if (action == HDA_FIXUP_ACT_BUILD) {
12595 		struct alc_spec *spec = codec->spec;
12596 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
12597 	}
12598 }
12599 
12600 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)12601 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
12602 					  hda_nid_t nid,
12603 					  unsigned int power_state)
12604 {
12605 	struct alc_spec *spec = codec->spec;
12606 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
12607 		return AC_PWRST_D0;
12608 	return power_state;
12609 }
12610 
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)12611 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
12612 				   const struct hda_fixup *fix, int action)
12613 {
12614 	struct alc_spec *spec = codec->spec;
12615 
12616 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
12617 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12618 		spec->mute_led_polarity = 1;
12619 		codec->power_filter = gpio_led_power_filter;
12620 	}
12621 }
12622 
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)12623 static void alc662_usi_automute_hook(struct hda_codec *codec,
12624 					 struct hda_jack_callback *jack)
12625 {
12626 	struct alc_spec *spec = codec->spec;
12627 	int vref;
12628 	msleep(200);
12629 	snd_hda_gen_hp_automute(codec, jack);
12630 
12631 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
12632 	msleep(100);
12633 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
12634 			    vref);
12635 }
12636 
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)12637 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
12638 				     const struct hda_fixup *fix, int action)
12639 {
12640 	struct alc_spec *spec = codec->spec;
12641 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12642 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12643 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
12644 	}
12645 }
12646 
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)12647 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
12648 					struct hda_jack_callback *cb)
12649 {
12650 	/* surround speakers at 0x1b already get muted automatically when
12651 	 * headphones are plugged in, but we have to mute/unmute the remaining
12652 	 * channels manually:
12653 	 * 0x15 - front left/front right
12654 	 * 0x18 - front center/ LFE
12655 	 */
12656 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
12657 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
12658 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
12659 	} else {
12660 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
12661 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
12662 	}
12663 }
12664 
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)12665 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
12666 					const struct hda_fixup *fix, int action)
12667 {
12668     /* Pin 0x1b: shared headphones jack and surround speakers */
12669 	if (!is_jack_detectable(codec, 0x1b))
12670 		return;
12671 
12672 	switch (action) {
12673 	case HDA_FIXUP_ACT_PRE_PROBE:
12674 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
12675 				alc662_aspire_ethos_mute_speakers);
12676 		/* subwoofer needs an extra GPIO setting to become audible */
12677 		alc_setup_gpio(codec, 0x02);
12678 		break;
12679 	case HDA_FIXUP_ACT_INIT:
12680 		/* Make sure to start in a correct state, i.e. if
12681 		 * headphones have been plugged in before powering up the system
12682 		 */
12683 		alc662_aspire_ethos_mute_speakers(codec, NULL);
12684 		break;
12685 	}
12686 }
12687 
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)12688 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
12689 					     const struct hda_fixup *fix, int action)
12690 {
12691 	struct alc_spec *spec = codec->spec;
12692 
12693 	static const struct hda_pintbl pincfgs[] = {
12694 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
12695 		{ 0x1b, 0x0181304f },
12696 		{ }
12697 	};
12698 
12699 	switch (action) {
12700 	case HDA_FIXUP_ACT_PRE_PROBE:
12701 		spec->gen.mixer_nid = 0;
12702 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12703 		snd_hda_apply_pincfgs(codec, pincfgs);
12704 		break;
12705 	case HDA_FIXUP_ACT_INIT:
12706 		alc_write_coef_idx(codec, 0x19, 0xa054);
12707 		break;
12708 	}
12709 }
12710 
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)12711 static void alc897_hp_automute_hook(struct hda_codec *codec,
12712 					 struct hda_jack_callback *jack)
12713 {
12714 	struct alc_spec *spec = codec->spec;
12715 	int vref;
12716 
12717 	snd_hda_gen_hp_automute(codec, jack);
12718 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
12719 	snd_hda_set_pin_ctl(codec, 0x1b, vref);
12720 }
12721 
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)12722 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
12723 				     const struct hda_fixup *fix, int action)
12724 {
12725 	struct alc_spec *spec = codec->spec;
12726 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12727 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
12728 		spec->no_shutup_pins = 1;
12729 	}
12730 	if (action == HDA_FIXUP_ACT_PROBE) {
12731 		snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
12732 	}
12733 }
12734 
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)12735 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
12736 				     const struct hda_fixup *fix, int action)
12737 {
12738 	struct alc_spec *spec = codec->spec;
12739 
12740 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12741 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12742 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
12743 	}
12744 }
12745 
12746 static const struct coef_fw alc668_coefs[] = {
12747 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
12748 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
12749 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
12750 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
12751 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
12752 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
12753 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
12754 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
12755 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
12756 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
12757 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
12758 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
12759 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
12760 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
12761 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
12762 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
12763 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
12764 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
12765 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
12766 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
12767 	{}
12768 };
12769 
alc668_restore_default_value(struct hda_codec * codec)12770 static void alc668_restore_default_value(struct hda_codec *codec)
12771 {
12772 	alc_process_coef_fw(codec, alc668_coefs);
12773 }
12774 
12775 enum {
12776 	ALC662_FIXUP_ASPIRE,
12777 	ALC662_FIXUP_LED_GPIO1,
12778 	ALC662_FIXUP_IDEAPAD,
12779 	ALC272_FIXUP_MARIO,
12780 	ALC662_FIXUP_CZC_ET26,
12781 	ALC662_FIXUP_CZC_P10T,
12782 	ALC662_FIXUP_SKU_IGNORE,
12783 	ALC662_FIXUP_HP_RP5800,
12784 	ALC662_FIXUP_ASUS_MODE1,
12785 	ALC662_FIXUP_ASUS_MODE2,
12786 	ALC662_FIXUP_ASUS_MODE3,
12787 	ALC662_FIXUP_ASUS_MODE4,
12788 	ALC662_FIXUP_ASUS_MODE5,
12789 	ALC662_FIXUP_ASUS_MODE6,
12790 	ALC662_FIXUP_ASUS_MODE7,
12791 	ALC662_FIXUP_ASUS_MODE8,
12792 	ALC662_FIXUP_NO_JACK_DETECT,
12793 	ALC662_FIXUP_ZOTAC_Z68,
12794 	ALC662_FIXUP_INV_DMIC,
12795 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12796 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
12797 	ALC662_FIXUP_HEADSET_MODE,
12798 	ALC668_FIXUP_HEADSET_MODE,
12799 	ALC662_FIXUP_BASS_MODE4_CHMAP,
12800 	ALC662_FIXUP_BASS_16,
12801 	ALC662_FIXUP_BASS_1A,
12802 	ALC662_FIXUP_BASS_CHMAP,
12803 	ALC668_FIXUP_AUTO_MUTE,
12804 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
12805 	ALC668_FIXUP_DELL_XPS13,
12806 	ALC662_FIXUP_ASUS_Nx50,
12807 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12808 	ALC668_FIXUP_ASUS_Nx51,
12809 	ALC668_FIXUP_MIC_COEF,
12810 	ALC668_FIXUP_ASUS_G751,
12811 	ALC891_FIXUP_HEADSET_MODE,
12812 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12813 	ALC662_FIXUP_ACER_VERITON,
12814 	ALC892_FIXUP_ASROCK_MOBO,
12815 	ALC662_FIXUP_USI_FUNC,
12816 	ALC662_FIXUP_USI_HEADSET_MODE,
12817 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
12818 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
12819 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
12820 	ALC671_FIXUP_HP_HEADSET_MIC2,
12821 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
12822 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
12823 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
12824 	ALC668_FIXUP_HEADSET_MIC,
12825 	ALC668_FIXUP_MIC_DET_COEF,
12826 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
12827 	ALC897_FIXUP_HEADSET_MIC_PIN,
12828 	ALC897_FIXUP_HP_HSMIC_VERB,
12829 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
12830 	ALC897_FIXUP_HEADSET_MIC_PIN2,
12831 	ALC897_FIXUP_UNIS_H3C_X500S,
12832 	ALC897_FIXUP_HEADSET_MIC_PIN3,
12833 };
12834 
12835 static const struct hda_fixup alc662_fixups[] = {
12836 	[ALC662_FIXUP_ASPIRE] = {
12837 		.type = HDA_FIXUP_PINS,
12838 		.v.pins = (const struct hda_pintbl[]) {
12839 			{ 0x15, 0x99130112 }, /* subwoofer */
12840 			{ }
12841 		}
12842 	},
12843 	[ALC662_FIXUP_LED_GPIO1] = {
12844 		.type = HDA_FIXUP_FUNC,
12845 		.v.func = alc662_fixup_led_gpio1,
12846 	},
12847 	[ALC662_FIXUP_IDEAPAD] = {
12848 		.type = HDA_FIXUP_PINS,
12849 		.v.pins = (const struct hda_pintbl[]) {
12850 			{ 0x17, 0x99130112 }, /* subwoofer */
12851 			{ }
12852 		},
12853 		.chained = true,
12854 		.chain_id = ALC662_FIXUP_LED_GPIO1,
12855 	},
12856 	[ALC272_FIXUP_MARIO] = {
12857 		.type = HDA_FIXUP_FUNC,
12858 		.v.func = alc272_fixup_mario,
12859 	},
12860 	[ALC662_FIXUP_CZC_ET26] = {
12861 		.type = HDA_FIXUP_PINS,
12862 		.v.pins = (const struct hda_pintbl[]) {
12863 			{0x12, 0x403cc000},
12864 			{0x14, 0x90170110}, /* speaker */
12865 			{0x15, 0x411111f0},
12866 			{0x16, 0x411111f0},
12867 			{0x18, 0x01a19030}, /* mic */
12868 			{0x19, 0x90a7013f}, /* int-mic */
12869 			{0x1a, 0x01014020},
12870 			{0x1b, 0x0121401f},
12871 			{0x1c, 0x411111f0},
12872 			{0x1d, 0x411111f0},
12873 			{0x1e, 0x40478e35},
12874 			{}
12875 		},
12876 		.chained = true,
12877 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12878 	},
12879 	[ALC662_FIXUP_CZC_P10T] = {
12880 		.type = HDA_FIXUP_VERBS,
12881 		.v.verbs = (const struct hda_verb[]) {
12882 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
12883 			{}
12884 		}
12885 	},
12886 	[ALC662_FIXUP_SKU_IGNORE] = {
12887 		.type = HDA_FIXUP_FUNC,
12888 		.v.func = alc_fixup_sku_ignore,
12889 	},
12890 	[ALC662_FIXUP_HP_RP5800] = {
12891 		.type = HDA_FIXUP_PINS,
12892 		.v.pins = (const struct hda_pintbl[]) {
12893 			{ 0x14, 0x0221201f }, /* HP out */
12894 			{ }
12895 		},
12896 		.chained = true,
12897 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12898 	},
12899 	[ALC662_FIXUP_ASUS_MODE1] = {
12900 		.type = HDA_FIXUP_PINS,
12901 		.v.pins = (const struct hda_pintbl[]) {
12902 			{ 0x14, 0x99130110 }, /* speaker */
12903 			{ 0x18, 0x01a19c20 }, /* mic */
12904 			{ 0x19, 0x99a3092f }, /* int-mic */
12905 			{ 0x21, 0x0121401f }, /* HP out */
12906 			{ }
12907 		},
12908 		.chained = true,
12909 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12910 	},
12911 	[ALC662_FIXUP_ASUS_MODE2] = {
12912 		.type = HDA_FIXUP_PINS,
12913 		.v.pins = (const struct hda_pintbl[]) {
12914 			{ 0x14, 0x99130110 }, /* speaker */
12915 			{ 0x18, 0x01a19820 }, /* mic */
12916 			{ 0x19, 0x99a3092f }, /* int-mic */
12917 			{ 0x1b, 0x0121401f }, /* HP out */
12918 			{ }
12919 		},
12920 		.chained = true,
12921 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12922 	},
12923 	[ALC662_FIXUP_ASUS_MODE3] = {
12924 		.type = HDA_FIXUP_PINS,
12925 		.v.pins = (const struct hda_pintbl[]) {
12926 			{ 0x14, 0x99130110 }, /* speaker */
12927 			{ 0x15, 0x0121441f }, /* HP */
12928 			{ 0x18, 0x01a19840 }, /* mic */
12929 			{ 0x19, 0x99a3094f }, /* int-mic */
12930 			{ 0x21, 0x01211420 }, /* HP2 */
12931 			{ }
12932 		},
12933 		.chained = true,
12934 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12935 	},
12936 	[ALC662_FIXUP_ASUS_MODE4] = {
12937 		.type = HDA_FIXUP_PINS,
12938 		.v.pins = (const struct hda_pintbl[]) {
12939 			{ 0x14, 0x99130110 }, /* speaker */
12940 			{ 0x16, 0x99130111 }, /* speaker */
12941 			{ 0x18, 0x01a19840 }, /* mic */
12942 			{ 0x19, 0x99a3094f }, /* int-mic */
12943 			{ 0x21, 0x0121441f }, /* HP */
12944 			{ }
12945 		},
12946 		.chained = true,
12947 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12948 	},
12949 	[ALC662_FIXUP_ASUS_MODE5] = {
12950 		.type = HDA_FIXUP_PINS,
12951 		.v.pins = (const struct hda_pintbl[]) {
12952 			{ 0x14, 0x99130110 }, /* speaker */
12953 			{ 0x15, 0x0121441f }, /* HP */
12954 			{ 0x16, 0x99130111 }, /* speaker */
12955 			{ 0x18, 0x01a19840 }, /* mic */
12956 			{ 0x19, 0x99a3094f }, /* int-mic */
12957 			{ }
12958 		},
12959 		.chained = true,
12960 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12961 	},
12962 	[ALC662_FIXUP_ASUS_MODE6] = {
12963 		.type = HDA_FIXUP_PINS,
12964 		.v.pins = (const struct hda_pintbl[]) {
12965 			{ 0x14, 0x99130110 }, /* speaker */
12966 			{ 0x15, 0x01211420 }, /* HP2 */
12967 			{ 0x18, 0x01a19840 }, /* mic */
12968 			{ 0x19, 0x99a3094f }, /* int-mic */
12969 			{ 0x1b, 0x0121441f }, /* HP */
12970 			{ }
12971 		},
12972 		.chained = true,
12973 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12974 	},
12975 	[ALC662_FIXUP_ASUS_MODE7] = {
12976 		.type = HDA_FIXUP_PINS,
12977 		.v.pins = (const struct hda_pintbl[]) {
12978 			{ 0x14, 0x99130110 }, /* speaker */
12979 			{ 0x17, 0x99130111 }, /* speaker */
12980 			{ 0x18, 0x01a19840 }, /* mic */
12981 			{ 0x19, 0x99a3094f }, /* int-mic */
12982 			{ 0x1b, 0x01214020 }, /* HP */
12983 			{ 0x21, 0x0121401f }, /* HP */
12984 			{ }
12985 		},
12986 		.chained = true,
12987 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12988 	},
12989 	[ALC662_FIXUP_ASUS_MODE8] = {
12990 		.type = HDA_FIXUP_PINS,
12991 		.v.pins = (const struct hda_pintbl[]) {
12992 			{ 0x14, 0x99130110 }, /* speaker */
12993 			{ 0x12, 0x99a30970 }, /* int-mic */
12994 			{ 0x15, 0x01214020 }, /* HP */
12995 			{ 0x17, 0x99130111 }, /* speaker */
12996 			{ 0x18, 0x01a19840 }, /* mic */
12997 			{ 0x21, 0x0121401f }, /* HP */
12998 			{ }
12999 		},
13000 		.chained = true,
13001 		.chain_id = ALC662_FIXUP_SKU_IGNORE
13002 	},
13003 	[ALC662_FIXUP_NO_JACK_DETECT] = {
13004 		.type = HDA_FIXUP_FUNC,
13005 		.v.func = alc_fixup_no_jack_detect,
13006 	},
13007 	[ALC662_FIXUP_ZOTAC_Z68] = {
13008 		.type = HDA_FIXUP_PINS,
13009 		.v.pins = (const struct hda_pintbl[]) {
13010 			{ 0x1b, 0x02214020 }, /* Front HP */
13011 			{ }
13012 		}
13013 	},
13014 	[ALC662_FIXUP_INV_DMIC] = {
13015 		.type = HDA_FIXUP_FUNC,
13016 		.v.func = alc_fixup_inv_dmic,
13017 	},
13018 	[ALC668_FIXUP_DELL_XPS13] = {
13019 		.type = HDA_FIXUP_FUNC,
13020 		.v.func = alc_fixup_dell_xps13,
13021 		.chained = true,
13022 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
13023 	},
13024 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
13025 		.type = HDA_FIXUP_FUNC,
13026 		.v.func = alc_fixup_disable_aamix,
13027 		.chained = true,
13028 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
13029 	},
13030 	[ALC668_FIXUP_AUTO_MUTE] = {
13031 		.type = HDA_FIXUP_FUNC,
13032 		.v.func = alc_fixup_auto_mute_via_amp,
13033 		.chained = true,
13034 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
13035 	},
13036 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
13037 		.type = HDA_FIXUP_PINS,
13038 		.v.pins = (const struct hda_pintbl[]) {
13039 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
13040 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
13041 			{ }
13042 		},
13043 		.chained = true,
13044 		.chain_id = ALC662_FIXUP_HEADSET_MODE
13045 	},
13046 	[ALC662_FIXUP_HEADSET_MODE] = {
13047 		.type = HDA_FIXUP_FUNC,
13048 		.v.func = alc_fixup_headset_mode_alc662,
13049 	},
13050 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
13051 		.type = HDA_FIXUP_PINS,
13052 		.v.pins = (const struct hda_pintbl[]) {
13053 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
13054 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
13055 			{ }
13056 		},
13057 		.chained = true,
13058 		.chain_id = ALC668_FIXUP_HEADSET_MODE
13059 	},
13060 	[ALC668_FIXUP_HEADSET_MODE] = {
13061 		.type = HDA_FIXUP_FUNC,
13062 		.v.func = alc_fixup_headset_mode_alc668,
13063 	},
13064 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
13065 		.type = HDA_FIXUP_FUNC,
13066 		.v.func = alc_fixup_bass_chmap,
13067 		.chained = true,
13068 		.chain_id = ALC662_FIXUP_ASUS_MODE4
13069 	},
13070 	[ALC662_FIXUP_BASS_16] = {
13071 		.type = HDA_FIXUP_PINS,
13072 		.v.pins = (const struct hda_pintbl[]) {
13073 			{0x16, 0x80106111}, /* bass speaker */
13074 			{}
13075 		},
13076 		.chained = true,
13077 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
13078 	},
13079 	[ALC662_FIXUP_BASS_1A] = {
13080 		.type = HDA_FIXUP_PINS,
13081 		.v.pins = (const struct hda_pintbl[]) {
13082 			{0x1a, 0x80106111}, /* bass speaker */
13083 			{}
13084 		},
13085 		.chained = true,
13086 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
13087 	},
13088 	[ALC662_FIXUP_BASS_CHMAP] = {
13089 		.type = HDA_FIXUP_FUNC,
13090 		.v.func = alc_fixup_bass_chmap,
13091 	},
13092 	[ALC662_FIXUP_ASUS_Nx50] = {
13093 		.type = HDA_FIXUP_FUNC,
13094 		.v.func = alc_fixup_auto_mute_via_amp,
13095 		.chained = true,
13096 		.chain_id = ALC662_FIXUP_BASS_1A
13097 	},
13098 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
13099 		.type = HDA_FIXUP_FUNC,
13100 		.v.func = alc_fixup_headset_mode_alc668,
13101 		.chain_id = ALC662_FIXUP_BASS_CHMAP
13102 	},
13103 	[ALC668_FIXUP_ASUS_Nx51] = {
13104 		.type = HDA_FIXUP_PINS,
13105 		.v.pins = (const struct hda_pintbl[]) {
13106 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
13107 			{ 0x1a, 0x90170151 }, /* bass speaker */
13108 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
13109 			{}
13110 		},
13111 		.chained = true,
13112 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
13113 	},
13114 	[ALC668_FIXUP_MIC_COEF] = {
13115 		.type = HDA_FIXUP_VERBS,
13116 		.v.verbs = (const struct hda_verb[]) {
13117 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
13118 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
13119 			{}
13120 		},
13121 	},
13122 	[ALC668_FIXUP_ASUS_G751] = {
13123 		.type = HDA_FIXUP_PINS,
13124 		.v.pins = (const struct hda_pintbl[]) {
13125 			{ 0x16, 0x0421101f }, /* HP */
13126 			{}
13127 		},
13128 		.chained = true,
13129 		.chain_id = ALC668_FIXUP_MIC_COEF
13130 	},
13131 	[ALC891_FIXUP_HEADSET_MODE] = {
13132 		.type = HDA_FIXUP_FUNC,
13133 		.v.func = alc_fixup_headset_mode,
13134 	},
13135 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
13136 		.type = HDA_FIXUP_PINS,
13137 		.v.pins = (const struct hda_pintbl[]) {
13138 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
13139 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
13140 			{ }
13141 		},
13142 		.chained = true,
13143 		.chain_id = ALC891_FIXUP_HEADSET_MODE
13144 	},
13145 	[ALC662_FIXUP_ACER_VERITON] = {
13146 		.type = HDA_FIXUP_PINS,
13147 		.v.pins = (const struct hda_pintbl[]) {
13148 			{ 0x15, 0x50170120 }, /* no internal speaker */
13149 			{ }
13150 		}
13151 	},
13152 	[ALC892_FIXUP_ASROCK_MOBO] = {
13153 		.type = HDA_FIXUP_PINS,
13154 		.v.pins = (const struct hda_pintbl[]) {
13155 			{ 0x15, 0x40f000f0 }, /* disabled */
13156 			{ 0x16, 0x40f000f0 }, /* disabled */
13157 			{ }
13158 		}
13159 	},
13160 	[ALC662_FIXUP_USI_FUNC] = {
13161 		.type = HDA_FIXUP_FUNC,
13162 		.v.func = alc662_fixup_usi_headset_mic,
13163 	},
13164 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
13165 		.type = HDA_FIXUP_PINS,
13166 		.v.pins = (const struct hda_pintbl[]) {
13167 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
13168 			{ 0x18, 0x01a1903d },
13169 			{ }
13170 		},
13171 		.chained = true,
13172 		.chain_id = ALC662_FIXUP_USI_FUNC
13173 	},
13174 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
13175 		.type = HDA_FIXUP_FUNC,
13176 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
13177 	},
13178 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
13179 		.type = HDA_FIXUP_FUNC,
13180 		.v.func = alc662_fixup_aspire_ethos_hp,
13181 	},
13182 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
13183 		.type = HDA_FIXUP_PINS,
13184 		.v.pins = (const struct hda_pintbl[]) {
13185 			{ 0x15, 0x92130110 }, /* front speakers */
13186 			{ 0x18, 0x99130111 }, /* center/subwoofer */
13187 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
13188 			{ }
13189 		},
13190 		.chained = true,
13191 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
13192 	},
13193 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
13194 		.type = HDA_FIXUP_FUNC,
13195 		.v.func = alc671_fixup_hp_headset_mic2,
13196 	},
13197 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
13198 		.type = HDA_FIXUP_PINS,
13199 		.v.pins = (const struct hda_pintbl[]) {
13200 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
13201 			{ }
13202 		},
13203 		.chained = true,
13204 		.chain_id = ALC662_FIXUP_USI_FUNC
13205 	},
13206 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
13207 		.type = HDA_FIXUP_PINS,
13208 		.v.pins = (const struct hda_pintbl[]) {
13209 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
13210 			{ 0x1b, 0x0221144f },
13211 			{ }
13212 		},
13213 		.chained = true,
13214 		.chain_id = ALC662_FIXUP_USI_FUNC
13215 	},
13216 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
13217 		.type = HDA_FIXUP_PINS,
13218 		.v.pins = (const struct hda_pintbl[]) {
13219 			{ 0x1b, 0x04a1112c },
13220 			{ }
13221 		},
13222 		.chained = true,
13223 		.chain_id = ALC668_FIXUP_HEADSET_MIC
13224 	},
13225 	[ALC668_FIXUP_HEADSET_MIC] = {
13226 		.type = HDA_FIXUP_FUNC,
13227 		.v.func = alc269_fixup_headset_mic,
13228 		.chained = true,
13229 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
13230 	},
13231 	[ALC668_FIXUP_MIC_DET_COEF] = {
13232 		.type = HDA_FIXUP_VERBS,
13233 		.v.verbs = (const struct hda_verb[]) {
13234 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
13235 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
13236 			{}
13237 		},
13238 	},
13239 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
13240 		.type = HDA_FIXUP_FUNC,
13241 		.v.func = alc897_fixup_lenovo_headset_mic,
13242 	},
13243 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
13244 		.type = HDA_FIXUP_PINS,
13245 		.v.pins = (const struct hda_pintbl[]) {
13246 			{ 0x1a, 0x03a11050 },
13247 			{ }
13248 		},
13249 		.chained = true,
13250 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
13251 	},
13252 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
13253 		.type = HDA_FIXUP_PINS,
13254 		.v.pins = (const struct hda_pintbl[]) {
13255 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
13256 			{ }
13257 		},
13258 	},
13259 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
13260 		.type = HDA_FIXUP_FUNC,
13261 		.v.func = alc897_fixup_lenovo_headset_mode,
13262 	},
13263 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
13264 		.type = HDA_FIXUP_PINS,
13265 		.v.pins = (const struct hda_pintbl[]) {
13266 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
13267 			{ }
13268 		},
13269 		.chained = true,
13270 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
13271 	},
13272 	[ALC897_FIXUP_UNIS_H3C_X500S] = {
13273 		.type = HDA_FIXUP_VERBS,
13274 		.v.verbs = (const struct hda_verb[]) {
13275 			{ 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
13276 			{}
13277 		},
13278 	},
13279 	[ALC897_FIXUP_HEADSET_MIC_PIN3] = {
13280 		.type = HDA_FIXUP_PINS,
13281 		.v.pins = (const struct hda_pintbl[]) {
13282 			{ 0x19, 0x03a11050 }, /* use as headset mic */
13283 			{ }
13284 		},
13285 	},
13286 };
13287 
13288 static const struct hda_quirk alc662_fixup_tbl[] = {
13289 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
13290 	SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
13291 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
13292 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
13293 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
13294 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
13295 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
13296 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
13297 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
13298 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
13299 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
13300 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
13301 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13302 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13303 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
13304 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
13305 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
13306 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13307 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13308 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13309 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13310 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13311 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
13312 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13313 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13314 	SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13315 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
13316 	SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
13317 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
13318 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
13319 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
13320 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
13321 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
13322 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
13323 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
13324 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
13325 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
13326 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
13327 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
13328 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
13329 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
13330 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
13331 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
13332 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
13333 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
13334 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
13335 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
13336 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
13337 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
13338 	SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
13339 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
13340 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
13341 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
13342 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
13343 	SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
13344 	SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
13345 	SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
13346 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
13347 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
13348 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
13349 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
13350 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
13351 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
13352 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
13353 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
13354 	SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
13355 
13356 #if 0
13357 	/* Below is a quirk table taken from the old code.
13358 	 * Basically the device should work as is without the fixup table.
13359 	 * If BIOS doesn't give a proper info, enable the corresponding
13360 	 * fixup entry.
13361 	 */
13362 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
13363 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
13364 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
13365 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
13366 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13367 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13368 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13369 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
13370 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
13371 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13372 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
13373 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
13374 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
13375 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
13376 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
13377 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13378 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
13379 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
13380 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13381 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13382 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13383 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13384 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
13385 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
13386 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
13387 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13388 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
13389 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13390 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13391 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
13392 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13393 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13394 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
13395 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
13396 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
13397 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
13398 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
13399 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
13400 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
13401 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13402 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
13403 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
13404 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13405 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
13406 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
13407 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
13408 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
13409 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
13410 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13411 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
13412 #endif
13413 	{}
13414 };
13415 
13416 static const struct hda_model_fixup alc662_fixup_models[] = {
13417 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
13418 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
13419 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
13420 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
13421 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
13422 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
13423 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
13424 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
13425 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
13426 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
13427 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
13428 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
13429 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
13430 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
13431 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
13432 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
13433 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
13434 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
13435 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
13436 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
13437 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
13438 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
13439 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
13440 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
13441 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
13442 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
13443 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
13444 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
13445 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
13446 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
13447 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
13448 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
13449 	{.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
13450 	{}
13451 };
13452 
13453 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
13454 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
13455 		{0x17, 0x02211010},
13456 		{0x18, 0x01a19030},
13457 		{0x1a, 0x01813040},
13458 		{0x21, 0x01014020}),
13459 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
13460 		{0x16, 0x01813030},
13461 		{0x17, 0x02211010},
13462 		{0x18, 0x01a19040},
13463 		{0x21, 0x01014020}),
13464 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
13465 		{0x14, 0x01014010},
13466 		{0x18, 0x01a19020},
13467 		{0x1a, 0x0181302f},
13468 		{0x1b, 0x0221401f}),
13469 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13470 		{0x12, 0x99a30130},
13471 		{0x14, 0x90170110},
13472 		{0x15, 0x0321101f},
13473 		{0x16, 0x03011020}),
13474 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13475 		{0x12, 0x99a30140},
13476 		{0x14, 0x90170110},
13477 		{0x15, 0x0321101f},
13478 		{0x16, 0x03011020}),
13479 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13480 		{0x12, 0x99a30150},
13481 		{0x14, 0x90170110},
13482 		{0x15, 0x0321101f},
13483 		{0x16, 0x03011020}),
13484 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13485 		{0x14, 0x90170110},
13486 		{0x15, 0x0321101f},
13487 		{0x16, 0x03011020}),
13488 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
13489 		{0x12, 0x90a60130},
13490 		{0x14, 0x90170110},
13491 		{0x15, 0x0321101f}),
13492 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13493 		{0x14, 0x01014010},
13494 		{0x17, 0x90170150},
13495 		{0x19, 0x02a11060},
13496 		{0x1b, 0x01813030},
13497 		{0x21, 0x02211020}),
13498 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13499 		{0x14, 0x01014010},
13500 		{0x18, 0x01a19040},
13501 		{0x1b, 0x01813030},
13502 		{0x21, 0x02211020}),
13503 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13504 		{0x14, 0x01014020},
13505 		{0x17, 0x90170110},
13506 		{0x18, 0x01a19050},
13507 		{0x1b, 0x01813040},
13508 		{0x21, 0x02211030}),
13509 	{}
13510 };
13511 
13512 /*
13513  */
patch_alc662(struct hda_codec * codec)13514 static int patch_alc662(struct hda_codec *codec)
13515 {
13516 	struct alc_spec *spec;
13517 	int err;
13518 
13519 	err = alc_alloc_spec(codec, 0x0b);
13520 	if (err < 0)
13521 		return err;
13522 
13523 	spec = codec->spec;
13524 
13525 	spec->shutup = alc_eapd_shutup;
13526 
13527 	/* handle multiple HPs as is */
13528 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
13529 
13530 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
13531 
13532 	switch (codec->core.vendor_id) {
13533 	case 0x10ec0668:
13534 		spec->init_hook = alc668_restore_default_value;
13535 		break;
13536 	}
13537 
13538 	alc_pre_init(codec);
13539 
13540 	snd_hda_pick_fixup(codec, alc662_fixup_models,
13541 		       alc662_fixup_tbl, alc662_fixups);
13542 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
13543 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
13544 
13545 	alc_auto_parse_customize_define(codec);
13546 
13547 	if (has_cdefine_beep(codec))
13548 		spec->gen.beep_nid = 0x01;
13549 
13550 	if ((alc_get_coef0(codec) & (1 << 14)) &&
13551 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
13552 	    spec->cdefine.platform_type == 1) {
13553 		err = alc_codec_rename(codec, "ALC272X");
13554 		if (err < 0)
13555 			goto error;
13556 	}
13557 
13558 	/* automatic parse from the BIOS config */
13559 	err = alc662_parse_auto_config(codec);
13560 	if (err < 0)
13561 		goto error;
13562 
13563 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
13564 		switch (codec->core.vendor_id) {
13565 		case 0x10ec0662:
13566 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13567 			break;
13568 		case 0x10ec0272:
13569 		case 0x10ec0663:
13570 		case 0x10ec0665:
13571 		case 0x10ec0668:
13572 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13573 			break;
13574 		case 0x10ec0273:
13575 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
13576 			break;
13577 		}
13578 		if (err < 0)
13579 			goto error;
13580 	}
13581 
13582 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
13583 
13584 	return 0;
13585 
13586  error:
13587 	alc_free(codec);
13588 	return err;
13589 }
13590 
13591 /*
13592  * ALC680 support
13593  */
13594 
alc680_parse_auto_config(struct hda_codec * codec)13595 static int alc680_parse_auto_config(struct hda_codec *codec)
13596 {
13597 	return alc_parse_auto_config(codec, NULL, NULL);
13598 }
13599 
13600 /*
13601  */
patch_alc680(struct hda_codec * codec)13602 static int patch_alc680(struct hda_codec *codec)
13603 {
13604 	int err;
13605 
13606 	/* ALC680 has no aa-loopback mixer */
13607 	err = alc_alloc_spec(codec, 0);
13608 	if (err < 0)
13609 		return err;
13610 
13611 	/* automatic parse from the BIOS config */
13612 	err = alc680_parse_auto_config(codec);
13613 	if (err < 0) {
13614 		alc_free(codec);
13615 		return err;
13616 	}
13617 
13618 	return 0;
13619 }
13620 
13621 /*
13622  * patch entries
13623  */
13624 static const struct hda_device_id snd_hda_id_realtek[] = {
13625 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
13626 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
13627 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
13628 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
13629 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
13630 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
13631 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
13632 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
13633 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
13634 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
13635 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
13636 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
13637 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
13638 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
13639 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
13640 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
13641 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
13642 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
13643 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
13644 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
13645 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
13646 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
13647 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
13648 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
13649 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
13650 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
13651 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
13652 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
13653 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
13654 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
13655 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
13656 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
13657 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
13658 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
13659 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
13660 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
13661 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
13662 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
13663 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
13664 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
13665 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
13666 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
13667 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
13668 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
13669 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
13670 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
13671 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
13672 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
13673 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
13674 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
13675 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
13676 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
13677 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
13678 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
13679 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
13680 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
13681 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
13682 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
13683 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
13684 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
13685 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
13686 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
13687 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
13688 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
13689 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
13690 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
13691 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
13692 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
13693 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
13694 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
13695 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
13696 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
13697 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
13698 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
13699 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
13700 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
13701 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
13702 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
13703 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
13704 	{} /* terminator */
13705 };
13706 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
13707 
13708 MODULE_LICENSE("GPL");
13709 MODULE_DESCRIPTION("Realtek HD-audio codec");
13710 MODULE_IMPORT_NS("SND_HDA_SCODEC_COMPONENT");
13711 
13712 static struct hda_codec_driver realtek_driver = {
13713 	.id = snd_hda_id_realtek,
13714 };
13715 
13716 module_hda_codec_driver(realtek_driver);
13717