xref: /linux/sound/pci/hda/patch_realtek.c (revision f4915933947c71f08ed1c5a6c9b4fdbe735e18cf)
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 0x10ec0285:
445 	case 0x10ec0289:
446 		alc_update_coef_idx(codec, 0x36, 1<<13, 0);
447 		fallthrough;
448 	case 0x10ec0230:
449 	case 0x10ec0233:
450 	case 0x10ec0235:
451 	case 0x10ec0236:
452 	case 0x10ec0245:
453 	case 0x10ec0255:
454 	case 0x10ec0256:
455 	case 0x19e58326:
456 	case 0x10ec0257:
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 
4746 /* 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)4747 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4748 				enum led_brightness brightness)
4749 {
4750 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4751 	struct alc_spec *spec = codec->spec;
4752 
4753 	alc_update_coef_led(codec, &spec->mic_led_coef,
4754 			    spec->micmute_led_polarity, brightness);
4755 	return 0;
4756 }
4757 
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4758 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4759 				const struct hda_fixup *fix, int action)
4760 {
4761 	struct alc_spec *spec = codec->spec;
4762 
4763 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4764 		spec->mic_led_coef.idx = 0x19;
4765 		spec->mic_led_coef.mask = 1 << 13;
4766 		spec->mic_led_coef.on = 1 << 13;
4767 		spec->mic_led_coef.off = 0;
4768 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4769 	}
4770 }
4771 
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4772 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4773 				const struct hda_fixup *fix, int action)
4774 {
4775 	struct alc_spec *spec = codec->spec;
4776 
4777 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4778 		spec->micmute_led_polarity = 1;
4779 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4780 }
4781 
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4782 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4783 				const struct hda_fixup *fix, int action)
4784 {
4785 	struct alc_spec *spec = codec->spec;
4786 
4787 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4788 		spec->mic_led_coef.idx = 0x35;
4789 		spec->mic_led_coef.mask = 3 << 2;
4790 		spec->mic_led_coef.on = 2 << 2;
4791 		spec->mic_led_coef.off = 1 << 2;
4792 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4793 	}
4794 }
4795 
alc295_fixup_hp_mute_led_coefbit11(struct hda_codec * codec,const struct hda_fixup * fix,int action)4796 static void alc295_fixup_hp_mute_led_coefbit11(struct hda_codec *codec,
4797 				const struct hda_fixup *fix, int action)
4798 {
4799 	struct alc_spec *spec = codec->spec;
4800 
4801 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4802 		spec->mute_led_polarity = 0;
4803 		spec->mute_led_coef.idx = 0xb;
4804 		spec->mute_led_coef.mask = 3 << 3;
4805 		spec->mute_led_coef.on = 1 << 3;
4806 		spec->mute_led_coef.off = 1 << 4;
4807 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4808 	}
4809 }
4810 
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4811 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4812 				const struct hda_fixup *fix, int action)
4813 {
4814 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4815 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4816 }
4817 
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4818 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4819 				const struct hda_fixup *fix, int action)
4820 {
4821 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4822 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4823 }
4824 
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4825 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4826 				const struct hda_fixup *fix, int action)
4827 {
4828 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4829 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4830 }
4831 
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4832 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4833 				const struct hda_fixup *fix, int action)
4834 {
4835 	struct alc_spec *spec = codec->spec;
4836 
4837 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4838 		spec->cap_mute_led_nid = 0x1a;
4839 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4840 		codec->power_filter = led_power_filter;
4841 	}
4842 }
4843 
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4844 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4845 				const struct hda_fixup *fix, int action)
4846 {
4847 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4848 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4849 }
4850 
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4851 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4852 						  const unsigned short coefs[2])
4853 {
4854 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4855 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4856 	alc_write_coef_idx(codec, 0x26, 0xb011);
4857 }
4858 
4859 struct alc298_samsung_amp_desc {
4860 	unsigned char nid;
4861 	unsigned short init_seq[2][2];
4862 };
4863 
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4864 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4865 				     const struct hda_fixup *fix, int action)
4866 {
4867 	int i, j;
4868 	static const unsigned short init_seq[][2] = {
4869 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4870 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4871 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4872 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4873 	};
4874 	static const struct alc298_samsung_amp_desc amps[] = {
4875 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4876 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4877 	};
4878 
4879 	if (action != HDA_FIXUP_ACT_INIT)
4880 		return;
4881 
4882 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4883 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4884 
4885 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4886 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4887 
4888 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4889 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4890 	}
4891 }
4892 
4893 struct alc298_samsung_v2_amp_desc {
4894 	unsigned short nid;
4895 	int init_seq_size;
4896 	unsigned short init_seq[18][2];
4897 };
4898 
4899 static const struct alc298_samsung_v2_amp_desc
4900 alc298_samsung_v2_amp_desc_tbl[] = {
4901 	{ 0x38, 18, {
4902 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4903 		{ 0x201b, 0x0001 }, { 0x201d, 0x0001 }, { 0x201f, 0x00fe },
4904 		{ 0x2021, 0x0000 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4905 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4906 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x2399, 0x0003 },
4907 		{ 0x23a4, 0x00b5 }, { 0x23a5, 0x0001 }, { 0x23ba, 0x0094 }
4908 	}},
4909 	{ 0x39, 18, {
4910 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4911 		{ 0x201b, 0x0002 }, { 0x201d, 0x0002 }, { 0x201f, 0x00fd },
4912 		{ 0x2021, 0x0001 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4913 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4914 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x2399, 0x0003 },
4915 		{ 0x23a4, 0x00b5 }, { 0x23a5, 0x0001 }, { 0x23ba, 0x0094 }
4916 	}},
4917 	{ 0x3c, 15, {
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 }, { 0x23ba, 0x008d }
4923 	}},
4924 	{ 0x3d, 15, {
4925 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4926 		{ 0x201b, 0x0002 }, { 0x201d, 0x0002 }, { 0x201f, 0x00fd },
4927 		{ 0x2021, 0x0001 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4928 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4929 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x23ba, 0x008d }
4930 	}}
4931 };
4932 
alc298_samsung_v2_enable_amps(struct hda_codec * codec)4933 static void alc298_samsung_v2_enable_amps(struct hda_codec *codec)
4934 {
4935 	struct alc_spec *spec = codec->spec;
4936 	static const unsigned short enable_seq[][2] = {
4937 		{ 0x203a, 0x0081 }, { 0x23ff, 0x0001 },
4938 	};
4939 	int i, j;
4940 
4941 	for (i = 0; i < spec->num_speaker_amps; i++) {
4942 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4943 		for (j = 0; j < ARRAY_SIZE(enable_seq); j++)
4944 			alc298_samsung_write_coef_pack(codec, enable_seq[j]);
4945 		codec_dbg(codec, "alc298_samsung_v2: Enabled speaker amp 0x%02x\n",
4946 				alc298_samsung_v2_amp_desc_tbl[i].nid);
4947 	}
4948 }
4949 
alc298_samsung_v2_disable_amps(struct hda_codec * codec)4950 static void alc298_samsung_v2_disable_amps(struct hda_codec *codec)
4951 {
4952 	struct alc_spec *spec = codec->spec;
4953 	static const unsigned short disable_seq[][2] = {
4954 		{ 0x23ff, 0x0000 }, { 0x203a, 0x0080 },
4955 	};
4956 	int i, j;
4957 
4958 	for (i = 0; i < spec->num_speaker_amps; i++) {
4959 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4960 		for (j = 0; j < ARRAY_SIZE(disable_seq); j++)
4961 			alc298_samsung_write_coef_pack(codec, disable_seq[j]);
4962 		codec_dbg(codec, "alc298_samsung_v2: Disabled speaker amp 0x%02x\n",
4963 				alc298_samsung_v2_amp_desc_tbl[i].nid);
4964 	}
4965 }
4966 
alc298_samsung_v2_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)4967 static void alc298_samsung_v2_playback_hook(struct hda_pcm_stream *hinfo,
4968 				struct hda_codec *codec,
4969 				struct snd_pcm_substream *substream,
4970 				int action)
4971 {
4972 	/* Dynamically enable/disable speaker amps before and after playback */
4973 	if (action == HDA_GEN_PCM_ACT_OPEN)
4974 		alc298_samsung_v2_enable_amps(codec);
4975 	if (action == HDA_GEN_PCM_ACT_CLOSE)
4976 		alc298_samsung_v2_disable_amps(codec);
4977 }
4978 
alc298_samsung_v2_init_amps(struct hda_codec * codec,int num_speaker_amps)4979 static void alc298_samsung_v2_init_amps(struct hda_codec *codec,
4980 				int num_speaker_amps)
4981 {
4982 	struct alc_spec *spec = codec->spec;
4983 	int i, j;
4984 
4985 	/* Set spec's num_speaker_amps before doing anything else */
4986 	spec->num_speaker_amps = num_speaker_amps;
4987 
4988 	/* Disable speaker amps before init to prevent any physical damage */
4989 	alc298_samsung_v2_disable_amps(codec);
4990 
4991 	/* Initialize the speaker amps */
4992 	for (i = 0; i < spec->num_speaker_amps; i++) {
4993 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4994 		for (j = 0; j < alc298_samsung_v2_amp_desc_tbl[i].init_seq_size; j++) {
4995 			alc298_samsung_write_coef_pack(codec,
4996 					alc298_samsung_v2_amp_desc_tbl[i].init_seq[j]);
4997 		}
4998 		alc_write_coef_idx(codec, 0x89, 0x0);
4999 		codec_dbg(codec, "alc298_samsung_v2: Initialized speaker amp 0x%02x\n",
5000 				alc298_samsung_v2_amp_desc_tbl[i].nid);
5001 	}
5002 
5003 	/* register hook to enable speaker amps only when they are needed */
5004 	spec->gen.pcm_playback_hook = alc298_samsung_v2_playback_hook;
5005 }
5006 
alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec * codec,const struct hda_fixup * fix,int action)5007 static void alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec *codec,
5008 				const struct hda_fixup *fix, int action)
5009 {
5010 	if (action == HDA_FIXUP_ACT_PROBE)
5011 		alc298_samsung_v2_init_amps(codec, 2);
5012 }
5013 
alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec * codec,const struct hda_fixup * fix,int action)5014 static void alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec *codec,
5015 				const struct hda_fixup *fix, int action)
5016 {
5017 	if (action == HDA_FIXUP_ACT_PROBE)
5018 		alc298_samsung_v2_init_amps(codec, 4);
5019 }
5020 
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)5021 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
5022 				   struct hda_jack_callback *event)
5023 {
5024 	struct alc_spec *spec = codec->spec;
5025 
5026 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
5027 	   send both key on and key off event for every interrupt. */
5028 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
5029 	input_sync(spec->kb_dev);
5030 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
5031 	input_sync(spec->kb_dev);
5032 }
5033 
alc_register_micmute_input_device(struct hda_codec * codec)5034 static int alc_register_micmute_input_device(struct hda_codec *codec)
5035 {
5036 	struct alc_spec *spec = codec->spec;
5037 	int i;
5038 
5039 	spec->kb_dev = input_allocate_device();
5040 	if (!spec->kb_dev) {
5041 		codec_err(codec, "Out of memory (input_allocate_device)\n");
5042 		return -ENOMEM;
5043 	}
5044 
5045 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
5046 
5047 	spec->kb_dev->name = "Microphone Mute Button";
5048 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
5049 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
5050 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
5051 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
5052 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
5053 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
5054 
5055 	if (input_register_device(spec->kb_dev)) {
5056 		codec_err(codec, "input_register_device failed\n");
5057 		input_free_device(spec->kb_dev);
5058 		spec->kb_dev = NULL;
5059 		return -ENOMEM;
5060 	}
5061 
5062 	return 0;
5063 }
5064 
5065 /* GPIO1 = set according to SKU external amp
5066  * GPIO2 = mic mute hotkey
5067  * GPIO3 = mute LED
5068  * GPIO4 = mic mute LED
5069  */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)5070 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
5071 					     const struct hda_fixup *fix, int action)
5072 {
5073 	struct alc_spec *spec = codec->spec;
5074 
5075 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
5076 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5077 		spec->init_amp = ALC_INIT_DEFAULT;
5078 		if (alc_register_micmute_input_device(codec) != 0)
5079 			return;
5080 
5081 		spec->gpio_mask |= 0x06;
5082 		spec->gpio_dir |= 0x02;
5083 		spec->gpio_data |= 0x02;
5084 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
5085 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
5086 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
5087 						    gpio2_mic_hotkey_event);
5088 		return;
5089 	}
5090 
5091 	if (!spec->kb_dev)
5092 		return;
5093 
5094 	switch (action) {
5095 	case HDA_FIXUP_ACT_FREE:
5096 		input_unregister_device(spec->kb_dev);
5097 		spec->kb_dev = NULL;
5098 	}
5099 }
5100 
5101 /* Line2 = mic mute hotkey
5102  * GPIO2 = mic mute LED
5103  */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)5104 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
5105 					     const struct hda_fixup *fix, int action)
5106 {
5107 	struct alc_spec *spec = codec->spec;
5108 
5109 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
5110 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5111 		spec->init_amp = ALC_INIT_DEFAULT;
5112 		if (alc_register_micmute_input_device(codec) != 0)
5113 			return;
5114 
5115 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
5116 						    gpio2_mic_hotkey_event);
5117 		return;
5118 	}
5119 
5120 	if (!spec->kb_dev)
5121 		return;
5122 
5123 	switch (action) {
5124 	case HDA_FIXUP_ACT_FREE:
5125 		input_unregister_device(spec->kb_dev);
5126 		spec->kb_dev = NULL;
5127 	}
5128 }
5129 
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)5130 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
5131 				const struct hda_fixup *fix, int action)
5132 {
5133 	struct alc_spec *spec = codec->spec;
5134 
5135 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
5136 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5137 		spec->cap_mute_led_nid = 0x18;
5138 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
5139 	}
5140 }
5141 
alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)5142 static void alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec *codec,
5143 				const struct hda_fixup *fix, int action)
5144 {
5145 	struct alc_spec *spec = codec->spec;
5146 
5147 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
5148 		spec->micmute_led_polarity = 1;
5149 	alc233_fixup_lenovo_line2_mic_hotkey(codec, fix, action);
5150 }
5151 
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)5152 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
5153 {
5154 	if (delay <= 0)
5155 		delay = 75;
5156 	snd_hda_codec_write(codec, 0x21, 0,
5157 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5158 	msleep(delay);
5159 	snd_hda_codec_write(codec, 0x21, 0,
5160 		    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5161 	msleep(delay);
5162 }
5163 
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)5164 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
5165 {
5166 	if (delay <= 0)
5167 		delay = 75;
5168 	snd_hda_codec_write(codec, 0x21, 0,
5169 		    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5170 	msleep(delay);
5171 	snd_hda_codec_write(codec, 0x21, 0,
5172 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5173 	msleep(delay);
5174 }
5175 
5176 static const struct coef_fw alc225_pre_hsmode[] = {
5177 	UPDATE_COEF(0x4a, 1<<8, 0),
5178 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
5179 	UPDATE_COEF(0x63, 3<<14, 3<<14),
5180 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
5181 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
5182 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
5183 	UPDATE_COEF(0x4a, 3<<10, 0),
5184 	{}
5185 };
5186 
alc_headset_mode_unplugged(struct hda_codec * codec)5187 static void alc_headset_mode_unplugged(struct hda_codec *codec)
5188 {
5189 	struct alc_spec *spec = codec->spec;
5190 	static const struct coef_fw coef0255[] = {
5191 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
5192 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5193 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5194 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5195 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
5196 		{}
5197 	};
5198 	static const struct coef_fw coef0256[] = {
5199 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
5200 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5201 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5202 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
5203 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5204 		{}
5205 	};
5206 	static const struct coef_fw coef0233[] = {
5207 		WRITE_COEF(0x1b, 0x0c0b),
5208 		WRITE_COEF(0x45, 0xc429),
5209 		UPDATE_COEF(0x35, 0x4000, 0),
5210 		WRITE_COEF(0x06, 0x2104),
5211 		WRITE_COEF(0x1a, 0x0001),
5212 		WRITE_COEF(0x26, 0x0004),
5213 		WRITE_COEF(0x32, 0x42a3),
5214 		{}
5215 	};
5216 	static const struct coef_fw coef0288[] = {
5217 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5218 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5219 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5220 		UPDATE_COEF(0x66, 0x0008, 0),
5221 		UPDATE_COEF(0x67, 0x2000, 0),
5222 		{}
5223 	};
5224 	static const struct coef_fw coef0298[] = {
5225 		UPDATE_COEF(0x19, 0x1300, 0x0300),
5226 		{}
5227 	};
5228 	static const struct coef_fw coef0292[] = {
5229 		WRITE_COEF(0x76, 0x000e),
5230 		WRITE_COEF(0x6c, 0x2400),
5231 		WRITE_COEF(0x18, 0x7308),
5232 		WRITE_COEF(0x6b, 0xc429),
5233 		{}
5234 	};
5235 	static const struct coef_fw coef0293[] = {
5236 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5237 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5238 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5239 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5240 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5241 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5242 		{}
5243 	};
5244 	static const struct coef_fw coef0668[] = {
5245 		WRITE_COEF(0x15, 0x0d40),
5246 		WRITE_COEF(0xb7, 0x802b),
5247 		{}
5248 	};
5249 	static const struct coef_fw coef0225[] = {
5250 		UPDATE_COEF(0x63, 3<<14, 0),
5251 		{}
5252 	};
5253 	static const struct coef_fw coef0274[] = {
5254 		UPDATE_COEF(0x4a, 0x0100, 0),
5255 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5256 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
5257 		UPDATE_COEF(0x4a, 0x0010, 0),
5258 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5259 		WRITE_COEF(0x45, 0x5289),
5260 		UPDATE_COEF(0x4a, 0x0c00, 0),
5261 		{}
5262 	};
5263 
5264 	if (spec->no_internal_mic_pin) {
5265 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5266 		return;
5267 	}
5268 
5269 	switch (codec->core.vendor_id) {
5270 	case 0x10ec0255:
5271 		alc_process_coef_fw(codec, coef0255);
5272 		break;
5273 	case 0x10ec0230:
5274 	case 0x10ec0236:
5275 	case 0x10ec0256:
5276 	case 0x19e58326:
5277 		alc_hp_mute_disable(codec, 75);
5278 		alc_process_coef_fw(codec, coef0256);
5279 		break;
5280 	case 0x10ec0234:
5281 	case 0x10ec0274:
5282 	case 0x10ec0294:
5283 		alc_process_coef_fw(codec, coef0274);
5284 		break;
5285 	case 0x10ec0233:
5286 	case 0x10ec0283:
5287 		alc_process_coef_fw(codec, coef0233);
5288 		break;
5289 	case 0x10ec0286:
5290 	case 0x10ec0288:
5291 		alc_process_coef_fw(codec, coef0288);
5292 		break;
5293 	case 0x10ec0298:
5294 		alc_process_coef_fw(codec, coef0298);
5295 		alc_process_coef_fw(codec, coef0288);
5296 		break;
5297 	case 0x10ec0292:
5298 		alc_process_coef_fw(codec, coef0292);
5299 		break;
5300 	case 0x10ec0293:
5301 		alc_process_coef_fw(codec, coef0293);
5302 		break;
5303 	case 0x10ec0668:
5304 		alc_process_coef_fw(codec, coef0668);
5305 		break;
5306 	case 0x10ec0215:
5307 	case 0x10ec0225:
5308 	case 0x10ec0285:
5309 	case 0x10ec0295:
5310 	case 0x10ec0289:
5311 	case 0x10ec0299:
5312 		alc_hp_mute_disable(codec, 75);
5313 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5314 		alc_process_coef_fw(codec, coef0225);
5315 		break;
5316 	case 0x10ec0867:
5317 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5318 		break;
5319 	}
5320 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5321 }
5322 
5323 
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5324 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5325 				    hda_nid_t mic_pin)
5326 {
5327 	static const struct coef_fw coef0255[] = {
5328 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5329 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5330 		{}
5331 	};
5332 	static const struct coef_fw coef0256[] = {
5333 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5334 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5335 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5336 		{}
5337 	};
5338 	static const struct coef_fw coef0233[] = {
5339 		UPDATE_COEF(0x35, 0, 1<<14),
5340 		WRITE_COEF(0x06, 0x2100),
5341 		WRITE_COEF(0x1a, 0x0021),
5342 		WRITE_COEF(0x26, 0x008c),
5343 		{}
5344 	};
5345 	static const struct coef_fw coef0288[] = {
5346 		UPDATE_COEF(0x4f, 0x00c0, 0),
5347 		UPDATE_COEF(0x50, 0x2000, 0),
5348 		UPDATE_COEF(0x56, 0x0006, 0),
5349 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5350 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5351 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5352 		{}
5353 	};
5354 	static const struct coef_fw coef0292[] = {
5355 		WRITE_COEF(0x19, 0xa208),
5356 		WRITE_COEF(0x2e, 0xacf0),
5357 		{}
5358 	};
5359 	static const struct coef_fw coef0293[] = {
5360 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5361 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5362 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5363 		{}
5364 	};
5365 	static const struct coef_fw coef0688[] = {
5366 		WRITE_COEF(0xb7, 0x802b),
5367 		WRITE_COEF(0xb5, 0x1040),
5368 		UPDATE_COEF(0xc3, 0, 1<<12),
5369 		{}
5370 	};
5371 	static const struct coef_fw coef0225[] = {
5372 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5373 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5374 		UPDATE_COEF(0x63, 3<<14, 0),
5375 		{}
5376 	};
5377 	static const struct coef_fw coef0274[] = {
5378 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5379 		UPDATE_COEF(0x4a, 0x0010, 0),
5380 		UPDATE_COEF(0x6b, 0xf000, 0),
5381 		{}
5382 	};
5383 
5384 	switch (codec->core.vendor_id) {
5385 	case 0x10ec0255:
5386 		alc_write_coef_idx(codec, 0x45, 0xc489);
5387 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5388 		alc_process_coef_fw(codec, coef0255);
5389 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5390 		break;
5391 	case 0x10ec0230:
5392 	case 0x10ec0236:
5393 	case 0x10ec0256:
5394 	case 0x19e58326:
5395 		alc_write_coef_idx(codec, 0x45, 0xc489);
5396 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5397 		alc_process_coef_fw(codec, coef0256);
5398 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5399 		break;
5400 	case 0x10ec0234:
5401 	case 0x10ec0274:
5402 	case 0x10ec0294:
5403 		alc_write_coef_idx(codec, 0x45, 0x4689);
5404 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5405 		alc_process_coef_fw(codec, coef0274);
5406 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5407 		break;
5408 	case 0x10ec0233:
5409 	case 0x10ec0283:
5410 		alc_write_coef_idx(codec, 0x45, 0xc429);
5411 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5412 		alc_process_coef_fw(codec, coef0233);
5413 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5414 		break;
5415 	case 0x10ec0286:
5416 	case 0x10ec0288:
5417 	case 0x10ec0298:
5418 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5419 		alc_process_coef_fw(codec, coef0288);
5420 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5421 		break;
5422 	case 0x10ec0292:
5423 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5424 		alc_process_coef_fw(codec, coef0292);
5425 		break;
5426 	case 0x10ec0293:
5427 		/* Set to TRS mode */
5428 		alc_write_coef_idx(codec, 0x45, 0xc429);
5429 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5430 		alc_process_coef_fw(codec, coef0293);
5431 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5432 		break;
5433 	case 0x10ec0867:
5434 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5435 		fallthrough;
5436 	case 0x10ec0221:
5437 	case 0x10ec0662:
5438 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5439 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5440 		break;
5441 	case 0x10ec0668:
5442 		alc_write_coef_idx(codec, 0x11, 0x0001);
5443 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5444 		alc_process_coef_fw(codec, coef0688);
5445 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5446 		break;
5447 	case 0x10ec0215:
5448 	case 0x10ec0225:
5449 	case 0x10ec0285:
5450 	case 0x10ec0295:
5451 	case 0x10ec0289:
5452 	case 0x10ec0299:
5453 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5454 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5455 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5456 		alc_process_coef_fw(codec, coef0225);
5457 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5458 		break;
5459 	}
5460 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5461 }
5462 
alc_headset_mode_default(struct hda_codec * codec)5463 static void alc_headset_mode_default(struct hda_codec *codec)
5464 {
5465 	static const struct coef_fw coef0225[] = {
5466 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5467 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5468 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5469 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5470 		UPDATE_COEF(0x63, 3<<14, 0),
5471 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5472 		{}
5473 	};
5474 	static const struct coef_fw coef0255[] = {
5475 		WRITE_COEF(0x45, 0xc089),
5476 		WRITE_COEF(0x45, 0xc489),
5477 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5478 		WRITE_COEF(0x49, 0x0049),
5479 		{}
5480 	};
5481 	static const struct coef_fw coef0256[] = {
5482 		WRITE_COEF(0x45, 0xc489),
5483 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5484 		WRITE_COEF(0x49, 0x0049),
5485 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5486 		WRITE_COEF(0x06, 0x6100),
5487 		{}
5488 	};
5489 	static const struct coef_fw coef0233[] = {
5490 		WRITE_COEF(0x06, 0x2100),
5491 		WRITE_COEF(0x32, 0x4ea3),
5492 		{}
5493 	};
5494 	static const struct coef_fw coef0288[] = {
5495 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5496 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5497 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5498 		UPDATE_COEF(0x66, 0x0008, 0),
5499 		UPDATE_COEF(0x67, 0x2000, 0),
5500 		{}
5501 	};
5502 	static const struct coef_fw coef0292[] = {
5503 		WRITE_COEF(0x76, 0x000e),
5504 		WRITE_COEF(0x6c, 0x2400),
5505 		WRITE_COEF(0x6b, 0xc429),
5506 		WRITE_COEF(0x18, 0x7308),
5507 		{}
5508 	};
5509 	static const struct coef_fw coef0293[] = {
5510 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5511 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5512 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5513 		{}
5514 	};
5515 	static const struct coef_fw coef0688[] = {
5516 		WRITE_COEF(0x11, 0x0041),
5517 		WRITE_COEF(0x15, 0x0d40),
5518 		WRITE_COEF(0xb7, 0x802b),
5519 		{}
5520 	};
5521 	static const struct coef_fw coef0274[] = {
5522 		WRITE_COEF(0x45, 0x4289),
5523 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5524 		UPDATE_COEF(0x6b, 0x0f00, 0),
5525 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5526 		{}
5527 	};
5528 
5529 	switch (codec->core.vendor_id) {
5530 	case 0x10ec0215:
5531 	case 0x10ec0225:
5532 	case 0x10ec0285:
5533 	case 0x10ec0295:
5534 	case 0x10ec0289:
5535 	case 0x10ec0299:
5536 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5537 		alc_process_coef_fw(codec, coef0225);
5538 		alc_hp_enable_unmute(codec, 75);
5539 		break;
5540 	case 0x10ec0255:
5541 		alc_process_coef_fw(codec, coef0255);
5542 		break;
5543 	case 0x10ec0230:
5544 	case 0x10ec0236:
5545 	case 0x10ec0256:
5546 	case 0x19e58326:
5547 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5548 		alc_write_coef_idx(codec, 0x45, 0xc089);
5549 		msleep(50);
5550 		alc_process_coef_fw(codec, coef0256);
5551 		alc_hp_enable_unmute(codec, 75);
5552 		break;
5553 	case 0x10ec0234:
5554 	case 0x10ec0274:
5555 	case 0x10ec0294:
5556 		alc_process_coef_fw(codec, coef0274);
5557 		break;
5558 	case 0x10ec0233:
5559 	case 0x10ec0283:
5560 		alc_process_coef_fw(codec, coef0233);
5561 		break;
5562 	case 0x10ec0286:
5563 	case 0x10ec0288:
5564 	case 0x10ec0298:
5565 		alc_process_coef_fw(codec, coef0288);
5566 		break;
5567 	case 0x10ec0292:
5568 		alc_process_coef_fw(codec, coef0292);
5569 		break;
5570 	case 0x10ec0293:
5571 		alc_process_coef_fw(codec, coef0293);
5572 		break;
5573 	case 0x10ec0668:
5574 		alc_process_coef_fw(codec, coef0688);
5575 		break;
5576 	case 0x10ec0867:
5577 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5578 		break;
5579 	}
5580 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5581 }
5582 
5583 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5584 static void alc_headset_mode_ctia(struct hda_codec *codec)
5585 {
5586 	int val;
5587 
5588 	static const struct coef_fw coef0255[] = {
5589 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5590 		WRITE_COEF(0x1b, 0x0c2b),
5591 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5592 		{}
5593 	};
5594 	static const struct coef_fw coef0256[] = {
5595 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5596 		WRITE_COEF(0x1b, 0x0e6b),
5597 		{}
5598 	};
5599 	static const struct coef_fw coef0233[] = {
5600 		WRITE_COEF(0x45, 0xd429),
5601 		WRITE_COEF(0x1b, 0x0c2b),
5602 		WRITE_COEF(0x32, 0x4ea3),
5603 		{}
5604 	};
5605 	static const struct coef_fw coef0288[] = {
5606 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5607 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5608 		UPDATE_COEF(0x66, 0x0008, 0),
5609 		UPDATE_COEF(0x67, 0x2000, 0),
5610 		{}
5611 	};
5612 	static const struct coef_fw coef0292[] = {
5613 		WRITE_COEF(0x6b, 0xd429),
5614 		WRITE_COEF(0x76, 0x0008),
5615 		WRITE_COEF(0x18, 0x7388),
5616 		{}
5617 	};
5618 	static const struct coef_fw coef0293[] = {
5619 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5620 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5621 		{}
5622 	};
5623 	static const struct coef_fw coef0688[] = {
5624 		WRITE_COEF(0x11, 0x0001),
5625 		WRITE_COEF(0x15, 0x0d60),
5626 		WRITE_COEF(0xc3, 0x0000),
5627 		{}
5628 	};
5629 	static const struct coef_fw coef0225_1[] = {
5630 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5631 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5632 		{}
5633 	};
5634 	static const struct coef_fw coef0225_2[] = {
5635 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5636 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5637 		{}
5638 	};
5639 
5640 	switch (codec->core.vendor_id) {
5641 	case 0x10ec0255:
5642 		alc_process_coef_fw(codec, coef0255);
5643 		break;
5644 	case 0x10ec0230:
5645 	case 0x10ec0236:
5646 	case 0x10ec0256:
5647 	case 0x19e58326:
5648 		alc_process_coef_fw(codec, coef0256);
5649 		alc_hp_enable_unmute(codec, 75);
5650 		break;
5651 	case 0x10ec0234:
5652 	case 0x10ec0274:
5653 	case 0x10ec0294:
5654 		alc_write_coef_idx(codec, 0x45, 0xd689);
5655 		break;
5656 	case 0x10ec0233:
5657 	case 0x10ec0283:
5658 		alc_process_coef_fw(codec, coef0233);
5659 		break;
5660 	case 0x10ec0298:
5661 		val = alc_read_coef_idx(codec, 0x50);
5662 		if (val & (1 << 12)) {
5663 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5664 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5665 			msleep(300);
5666 		} else {
5667 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5668 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5669 			msleep(300);
5670 		}
5671 		break;
5672 	case 0x10ec0286:
5673 	case 0x10ec0288:
5674 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5675 		msleep(300);
5676 		alc_process_coef_fw(codec, coef0288);
5677 		break;
5678 	case 0x10ec0292:
5679 		alc_process_coef_fw(codec, coef0292);
5680 		break;
5681 	case 0x10ec0293:
5682 		alc_process_coef_fw(codec, coef0293);
5683 		break;
5684 	case 0x10ec0668:
5685 		alc_process_coef_fw(codec, coef0688);
5686 		break;
5687 	case 0x10ec0215:
5688 	case 0x10ec0225:
5689 	case 0x10ec0285:
5690 	case 0x10ec0295:
5691 	case 0x10ec0289:
5692 	case 0x10ec0299:
5693 		val = alc_read_coef_idx(codec, 0x45);
5694 		if (val & (1 << 9))
5695 			alc_process_coef_fw(codec, coef0225_2);
5696 		else
5697 			alc_process_coef_fw(codec, coef0225_1);
5698 		alc_hp_enable_unmute(codec, 75);
5699 		break;
5700 	case 0x10ec0867:
5701 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5702 		break;
5703 	}
5704 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5705 }
5706 
5707 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5708 static void alc_headset_mode_omtp(struct hda_codec *codec)
5709 {
5710 	static const struct coef_fw coef0255[] = {
5711 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5712 		WRITE_COEF(0x1b, 0x0c2b),
5713 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5714 		{}
5715 	};
5716 	static const struct coef_fw coef0256[] = {
5717 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5718 		WRITE_COEF(0x1b, 0x0e6b),
5719 		{}
5720 	};
5721 	static const struct coef_fw coef0233[] = {
5722 		WRITE_COEF(0x45, 0xe429),
5723 		WRITE_COEF(0x1b, 0x0c2b),
5724 		WRITE_COEF(0x32, 0x4ea3),
5725 		{}
5726 	};
5727 	static const struct coef_fw coef0288[] = {
5728 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5729 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5730 		UPDATE_COEF(0x66, 0x0008, 0),
5731 		UPDATE_COEF(0x67, 0x2000, 0),
5732 		{}
5733 	};
5734 	static const struct coef_fw coef0292[] = {
5735 		WRITE_COEF(0x6b, 0xe429),
5736 		WRITE_COEF(0x76, 0x0008),
5737 		WRITE_COEF(0x18, 0x7388),
5738 		{}
5739 	};
5740 	static const struct coef_fw coef0293[] = {
5741 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5742 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5743 		{}
5744 	};
5745 	static const struct coef_fw coef0688[] = {
5746 		WRITE_COEF(0x11, 0x0001),
5747 		WRITE_COEF(0x15, 0x0d50),
5748 		WRITE_COEF(0xc3, 0x0000),
5749 		{}
5750 	};
5751 	static const struct coef_fw coef0225[] = {
5752 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5753 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5754 		{}
5755 	};
5756 
5757 	switch (codec->core.vendor_id) {
5758 	case 0x10ec0255:
5759 		alc_process_coef_fw(codec, coef0255);
5760 		break;
5761 	case 0x10ec0230:
5762 	case 0x10ec0236:
5763 	case 0x10ec0256:
5764 	case 0x19e58326:
5765 		alc_process_coef_fw(codec, coef0256);
5766 		alc_hp_enable_unmute(codec, 75);
5767 		break;
5768 	case 0x10ec0234:
5769 	case 0x10ec0274:
5770 	case 0x10ec0294:
5771 		alc_write_coef_idx(codec, 0x45, 0xe689);
5772 		break;
5773 	case 0x10ec0233:
5774 	case 0x10ec0283:
5775 		alc_process_coef_fw(codec, coef0233);
5776 		break;
5777 	case 0x10ec0298:
5778 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5779 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5780 		msleep(300);
5781 		break;
5782 	case 0x10ec0286:
5783 	case 0x10ec0288:
5784 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5785 		msleep(300);
5786 		alc_process_coef_fw(codec, coef0288);
5787 		break;
5788 	case 0x10ec0292:
5789 		alc_process_coef_fw(codec, coef0292);
5790 		break;
5791 	case 0x10ec0293:
5792 		alc_process_coef_fw(codec, coef0293);
5793 		break;
5794 	case 0x10ec0668:
5795 		alc_process_coef_fw(codec, coef0688);
5796 		break;
5797 	case 0x10ec0215:
5798 	case 0x10ec0225:
5799 	case 0x10ec0285:
5800 	case 0x10ec0295:
5801 	case 0x10ec0289:
5802 	case 0x10ec0299:
5803 		alc_process_coef_fw(codec, coef0225);
5804 		alc_hp_enable_unmute(codec, 75);
5805 		break;
5806 	}
5807 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5808 }
5809 
alc_determine_headset_type(struct hda_codec * codec)5810 static void alc_determine_headset_type(struct hda_codec *codec)
5811 {
5812 	int val;
5813 	bool is_ctia = false;
5814 	struct alc_spec *spec = codec->spec;
5815 	static const struct coef_fw coef0255[] = {
5816 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5817 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5818  conteol) */
5819 		{}
5820 	};
5821 	static const struct coef_fw coef0288[] = {
5822 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5823 		{}
5824 	};
5825 	static const struct coef_fw coef0298[] = {
5826 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5827 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5828 		UPDATE_COEF(0x66, 0x0008, 0),
5829 		UPDATE_COEF(0x67, 0x2000, 0),
5830 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5831 		{}
5832 	};
5833 	static const struct coef_fw coef0293[] = {
5834 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5835 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5836 		{}
5837 	};
5838 	static const struct coef_fw coef0688[] = {
5839 		WRITE_COEF(0x11, 0x0001),
5840 		WRITE_COEF(0xb7, 0x802b),
5841 		WRITE_COEF(0x15, 0x0d60),
5842 		WRITE_COEF(0xc3, 0x0c00),
5843 		{}
5844 	};
5845 	static const struct coef_fw coef0274[] = {
5846 		UPDATE_COEF(0x4a, 0x0010, 0),
5847 		UPDATE_COEF(0x4a, 0x8000, 0),
5848 		WRITE_COEF(0x45, 0xd289),
5849 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5850 		{}
5851 	};
5852 
5853 	if (spec->no_internal_mic_pin) {
5854 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5855 		return;
5856 	}
5857 
5858 	switch (codec->core.vendor_id) {
5859 	case 0x10ec0255:
5860 		alc_process_coef_fw(codec, coef0255);
5861 		msleep(300);
5862 		val = alc_read_coef_idx(codec, 0x46);
5863 		is_ctia = (val & 0x0070) == 0x0070;
5864 		break;
5865 	case 0x10ec0230:
5866 	case 0x10ec0236:
5867 	case 0x10ec0256:
5868 	case 0x19e58326:
5869 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5870 		alc_write_coef_idx(codec, 0x06, 0x6104);
5871 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5872 
5873 		alc_process_coef_fw(codec, coef0255);
5874 		msleep(300);
5875 		val = alc_read_coef_idx(codec, 0x46);
5876 		is_ctia = (val & 0x0070) == 0x0070;
5877 		if (!is_ctia) {
5878 			alc_write_coef_idx(codec, 0x45, 0xe089);
5879 			msleep(100);
5880 			val = alc_read_coef_idx(codec, 0x46);
5881 			if ((val & 0x0070) == 0x0070)
5882 				is_ctia = false;
5883 			else
5884 				is_ctia = true;
5885 		}
5886 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5887 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5888 		break;
5889 	case 0x10ec0234:
5890 	case 0x10ec0274:
5891 	case 0x10ec0294:
5892 		alc_process_coef_fw(codec, coef0274);
5893 		msleep(850);
5894 		val = alc_read_coef_idx(codec, 0x46);
5895 		is_ctia = (val & 0x00f0) == 0x00f0;
5896 		break;
5897 	case 0x10ec0233:
5898 	case 0x10ec0283:
5899 		alc_write_coef_idx(codec, 0x45, 0xd029);
5900 		msleep(300);
5901 		val = alc_read_coef_idx(codec, 0x46);
5902 		is_ctia = (val & 0x0070) == 0x0070;
5903 		break;
5904 	case 0x10ec0298:
5905 		snd_hda_codec_write(codec, 0x21, 0,
5906 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5907 		msleep(100);
5908 		snd_hda_codec_write(codec, 0x21, 0,
5909 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5910 		msleep(200);
5911 
5912 		val = alc_read_coef_idx(codec, 0x50);
5913 		if (val & (1 << 12)) {
5914 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5915 			alc_process_coef_fw(codec, coef0288);
5916 			msleep(350);
5917 			val = alc_read_coef_idx(codec, 0x50);
5918 			is_ctia = (val & 0x0070) == 0x0070;
5919 		} else {
5920 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5921 			alc_process_coef_fw(codec, coef0288);
5922 			msleep(350);
5923 			val = alc_read_coef_idx(codec, 0x50);
5924 			is_ctia = (val & 0x0070) == 0x0070;
5925 		}
5926 		alc_process_coef_fw(codec, coef0298);
5927 		snd_hda_codec_write(codec, 0x21, 0,
5928 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5929 		msleep(75);
5930 		snd_hda_codec_write(codec, 0x21, 0,
5931 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5932 		break;
5933 	case 0x10ec0286:
5934 	case 0x10ec0288:
5935 		alc_process_coef_fw(codec, coef0288);
5936 		msleep(350);
5937 		val = alc_read_coef_idx(codec, 0x50);
5938 		is_ctia = (val & 0x0070) == 0x0070;
5939 		break;
5940 	case 0x10ec0292:
5941 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5942 		msleep(300);
5943 		val = alc_read_coef_idx(codec, 0x6c);
5944 		is_ctia = (val & 0x001c) == 0x001c;
5945 		break;
5946 	case 0x10ec0293:
5947 		alc_process_coef_fw(codec, coef0293);
5948 		msleep(300);
5949 		val = alc_read_coef_idx(codec, 0x46);
5950 		is_ctia = (val & 0x0070) == 0x0070;
5951 		break;
5952 	case 0x10ec0668:
5953 		alc_process_coef_fw(codec, coef0688);
5954 		msleep(300);
5955 		val = alc_read_coef_idx(codec, 0xbe);
5956 		is_ctia = (val & 0x1c02) == 0x1c02;
5957 		break;
5958 	case 0x10ec0215:
5959 	case 0x10ec0225:
5960 	case 0x10ec0285:
5961 	case 0x10ec0295:
5962 	case 0x10ec0289:
5963 	case 0x10ec0299:
5964 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5965 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5966 		val = alc_read_coef_idx(codec, 0x45);
5967 		if (val & (1 << 9)) {
5968 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5969 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5970 			msleep(800);
5971 			val = alc_read_coef_idx(codec, 0x46);
5972 			is_ctia = (val & 0x00f0) == 0x00f0;
5973 		} else {
5974 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5975 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5976 			msleep(800);
5977 			val = alc_read_coef_idx(codec, 0x46);
5978 			is_ctia = (val & 0x00f0) == 0x00f0;
5979 		}
5980 		if (!is_ctia) {
5981 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5982 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5983 			msleep(100);
5984 			val = alc_read_coef_idx(codec, 0x46);
5985 			if ((val & 0x00f0) == 0x00f0)
5986 				is_ctia = false;
5987 			else
5988 				is_ctia = true;
5989 		}
5990 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5991 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5992 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5993 		break;
5994 	case 0x10ec0867:
5995 		is_ctia = true;
5996 		break;
5997 	}
5998 
5999 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
6000 		  str_yes_no(is_ctia));
6001 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
6002 }
6003 
alc_update_headset_mode(struct hda_codec * codec)6004 static void alc_update_headset_mode(struct hda_codec *codec)
6005 {
6006 	struct alc_spec *spec = codec->spec;
6007 
6008 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
6009 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
6010 
6011 	int new_headset_mode;
6012 
6013 	if (!snd_hda_jack_detect(codec, hp_pin))
6014 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
6015 	else if (mux_pin == spec->headset_mic_pin)
6016 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
6017 	else if (mux_pin == spec->headphone_mic_pin)
6018 		new_headset_mode = ALC_HEADSET_MODE_MIC;
6019 	else
6020 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
6021 
6022 	if (new_headset_mode == spec->current_headset_mode) {
6023 		snd_hda_gen_update_outputs(codec);
6024 		return;
6025 	}
6026 
6027 	switch (new_headset_mode) {
6028 	case ALC_HEADSET_MODE_UNPLUGGED:
6029 		alc_headset_mode_unplugged(codec);
6030 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
6031 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
6032 		spec->gen.hp_jack_present = false;
6033 		break;
6034 	case ALC_HEADSET_MODE_HEADSET:
6035 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
6036 			alc_determine_headset_type(codec);
6037 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
6038 			alc_headset_mode_ctia(codec);
6039 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
6040 			alc_headset_mode_omtp(codec);
6041 		spec->gen.hp_jack_present = true;
6042 		break;
6043 	case ALC_HEADSET_MODE_MIC:
6044 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
6045 		spec->gen.hp_jack_present = false;
6046 		break;
6047 	case ALC_HEADSET_MODE_HEADPHONE:
6048 		alc_headset_mode_default(codec);
6049 		spec->gen.hp_jack_present = true;
6050 		break;
6051 	}
6052 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
6053 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
6054 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
6055 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
6056 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
6057 						  PIN_VREFHIZ);
6058 	}
6059 	spec->current_headset_mode = new_headset_mode;
6060 
6061 	snd_hda_gen_update_outputs(codec);
6062 }
6063 
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)6064 static void alc_update_headset_mode_hook(struct hda_codec *codec,
6065 					 struct snd_kcontrol *kcontrol,
6066 					 struct snd_ctl_elem_value *ucontrol)
6067 {
6068 	alc_update_headset_mode(codec);
6069 }
6070 
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)6071 static void alc_update_headset_jack_cb(struct hda_codec *codec,
6072 				       struct hda_jack_callback *jack)
6073 {
6074 	snd_hda_gen_hp_automute(codec, jack);
6075 	alc_update_headset_mode(codec);
6076 }
6077 
alc_probe_headset_mode(struct hda_codec * codec)6078 static void alc_probe_headset_mode(struct hda_codec *codec)
6079 {
6080 	int i;
6081 	struct alc_spec *spec = codec->spec;
6082 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6083 
6084 	/* Find mic pins */
6085 	for (i = 0; i < cfg->num_inputs; i++) {
6086 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
6087 			spec->headset_mic_pin = cfg->inputs[i].pin;
6088 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
6089 			spec->headphone_mic_pin = cfg->inputs[i].pin;
6090 	}
6091 
6092 	WARN_ON(spec->gen.cap_sync_hook);
6093 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
6094 	spec->gen.automute_hook = alc_update_headset_mode;
6095 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
6096 }
6097 
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)6098 static void alc_fixup_headset_mode(struct hda_codec *codec,
6099 				const struct hda_fixup *fix, int action)
6100 {
6101 	struct alc_spec *spec = codec->spec;
6102 
6103 	switch (action) {
6104 	case HDA_FIXUP_ACT_PRE_PROBE:
6105 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
6106 		break;
6107 	case HDA_FIXUP_ACT_PROBE:
6108 		alc_probe_headset_mode(codec);
6109 		break;
6110 	case HDA_FIXUP_ACT_INIT:
6111 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
6112 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
6113 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
6114 		}
6115 		alc_update_headset_mode(codec);
6116 		break;
6117 	}
6118 }
6119 
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6120 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
6121 				const struct hda_fixup *fix, int action)
6122 {
6123 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6124 		struct alc_spec *spec = codec->spec;
6125 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6126 	}
6127 	else
6128 		alc_fixup_headset_mode(codec, fix, action);
6129 }
6130 
alc255_set_default_jack_type(struct hda_codec * codec)6131 static void alc255_set_default_jack_type(struct hda_codec *codec)
6132 {
6133 	/* Set to iphone type */
6134 	static const struct coef_fw alc255fw[] = {
6135 		WRITE_COEF(0x1b, 0x880b),
6136 		WRITE_COEF(0x45, 0xd089),
6137 		WRITE_COEF(0x1b, 0x080b),
6138 		WRITE_COEF(0x46, 0x0004),
6139 		WRITE_COEF(0x1b, 0x0c0b),
6140 		{}
6141 	};
6142 	static const struct coef_fw alc256fw[] = {
6143 		WRITE_COEF(0x1b, 0x884b),
6144 		WRITE_COEF(0x45, 0xd089),
6145 		WRITE_COEF(0x1b, 0x084b),
6146 		WRITE_COEF(0x46, 0x0004),
6147 		WRITE_COEF(0x1b, 0x0c4b),
6148 		{}
6149 	};
6150 	switch (codec->core.vendor_id) {
6151 	case 0x10ec0255:
6152 		alc_process_coef_fw(codec, alc255fw);
6153 		break;
6154 	case 0x10ec0230:
6155 	case 0x10ec0236:
6156 	case 0x10ec0256:
6157 	case 0x19e58326:
6158 		alc_process_coef_fw(codec, alc256fw);
6159 		break;
6160 	}
6161 	msleep(30);
6162 }
6163 
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)6164 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
6165 				const struct hda_fixup *fix, int action)
6166 {
6167 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6168 		alc255_set_default_jack_type(codec);
6169 	}
6170 	alc_fixup_headset_mode(codec, fix, action);
6171 }
6172 
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6173 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
6174 				const struct hda_fixup *fix, int action)
6175 {
6176 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6177 		struct alc_spec *spec = codec->spec;
6178 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6179 		alc255_set_default_jack_type(codec);
6180 	}
6181 	else
6182 		alc_fixup_headset_mode(codec, fix, action);
6183 }
6184 
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)6185 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
6186 				       struct hda_jack_callback *jack)
6187 {
6188 	struct alc_spec *spec = codec->spec;
6189 
6190 	alc_update_headset_jack_cb(codec, jack);
6191 	/* Headset Mic enable or disable, only for Dell Dino */
6192 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
6193 }
6194 
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)6195 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
6196 				const struct hda_fixup *fix, int action)
6197 {
6198 	alc_fixup_headset_mode(codec, fix, action);
6199 	if (action == HDA_FIXUP_ACT_PROBE) {
6200 		struct alc_spec *spec = codec->spec;
6201 		/* toggled via hp_automute_hook */
6202 		spec->gpio_mask |= 0x40;
6203 		spec->gpio_dir |= 0x40;
6204 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
6205 	}
6206 }
6207 
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6208 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
6209 					const struct hda_fixup *fix, int action)
6210 {
6211 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6212 		struct alc_spec *spec = codec->spec;
6213 		spec->gen.auto_mute_via_amp = 1;
6214 	}
6215 }
6216 
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)6217 static void alc_fixup_no_shutup(struct hda_codec *codec,
6218 				const struct hda_fixup *fix, int action)
6219 {
6220 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6221 		struct alc_spec *spec = codec->spec;
6222 		spec->no_shutup_pins = 1;
6223 	}
6224 }
6225 
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)6226 static void alc_fixup_disable_aamix(struct hda_codec *codec,
6227 				    const struct hda_fixup *fix, int action)
6228 {
6229 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6230 		struct alc_spec *spec = codec->spec;
6231 		/* Disable AA-loopback as it causes white noise */
6232 		spec->gen.mixer_nid = 0;
6233 	}
6234 }
6235 
6236 /* 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)6237 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6238 				  const struct hda_fixup *fix, int action)
6239 {
6240 	static const struct hda_pintbl pincfgs[] = {
6241 		{ 0x16, 0x21211010 }, /* dock headphone */
6242 		{ 0x19, 0x21a11010 }, /* dock mic */
6243 		{ }
6244 	};
6245 	struct alc_spec *spec = codec->spec;
6246 
6247 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6248 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6249 		codec->power_save_node = 0; /* avoid click noises */
6250 		snd_hda_apply_pincfgs(codec, pincfgs);
6251 	}
6252 }
6253 
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6254 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6255 				  const struct hda_fixup *fix, int action)
6256 {
6257 	static const struct hda_pintbl pincfgs[] = {
6258 		{ 0x17, 0x21211010 }, /* dock headphone */
6259 		{ 0x19, 0x21a11010 }, /* dock mic */
6260 		{ }
6261 	};
6262 	struct alc_spec *spec = codec->spec;
6263 
6264 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6265 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6266 		snd_hda_apply_pincfgs(codec, pincfgs);
6267 	} else if (action == HDA_FIXUP_ACT_INIT) {
6268 		/* Enable DOCK device */
6269 		snd_hda_codec_write(codec, 0x17, 0,
6270 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6271 		/* Enable DOCK device */
6272 		snd_hda_codec_write(codec, 0x19, 0,
6273 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6274 	}
6275 }
6276 
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6277 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6278 				  const struct hda_fixup *fix, int action)
6279 {
6280 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6281 	 * the speaker output becomes too low by some reason on Thinkpads with
6282 	 * ALC298 codec
6283 	 */
6284 	static const hda_nid_t preferred_pairs[] = {
6285 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6286 		0
6287 	};
6288 	struct alc_spec *spec = codec->spec;
6289 
6290 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6291 		spec->gen.preferred_dacs = preferred_pairs;
6292 }
6293 
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6294 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6295 				   const struct hda_fixup *fix, int action)
6296 {
6297 	static const hda_nid_t preferred_pairs[] = {
6298 		0x17, 0x02, 0x21, 0x03, 0
6299 	};
6300 	struct alc_spec *spec = codec->spec;
6301 
6302 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6303 		spec->gen.preferred_dacs = preferred_pairs;
6304 }
6305 
alc_shutup_dell_xps13(struct hda_codec * codec)6306 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6307 {
6308 	struct alc_spec *spec = codec->spec;
6309 	int hp_pin = alc_get_hp_pin(spec);
6310 
6311 	/* Prevent pop noises when headphones are plugged in */
6312 	snd_hda_codec_write(codec, hp_pin, 0,
6313 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6314 	msleep(20);
6315 }
6316 
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6317 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6318 				const struct hda_fixup *fix, int action)
6319 {
6320 	struct alc_spec *spec = codec->spec;
6321 	struct hda_input_mux *imux = &spec->gen.input_mux;
6322 	int i;
6323 
6324 	switch (action) {
6325 	case HDA_FIXUP_ACT_PRE_PROBE:
6326 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6327 		 * it causes a click noise at start up
6328 		 */
6329 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6330 		spec->shutup = alc_shutup_dell_xps13;
6331 		break;
6332 	case HDA_FIXUP_ACT_PROBE:
6333 		/* Make the internal mic the default input source. */
6334 		for (i = 0; i < imux->num_items; i++) {
6335 			if (spec->gen.imux_pins[i] == 0x12) {
6336 				spec->gen.cur_mux[0] = i;
6337 				break;
6338 			}
6339 		}
6340 		break;
6341 	}
6342 }
6343 
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6344 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6345 				const struct hda_fixup *fix, int action)
6346 {
6347 	struct alc_spec *spec = codec->spec;
6348 
6349 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6350 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6351 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6352 
6353 		/* Disable boost for mic-in permanently. (This code is only called
6354 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6355 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6356 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6357 	} else
6358 		alc_fixup_headset_mode(codec, fix, action);
6359 }
6360 
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6361 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6362 				const struct hda_fixup *fix, int action)
6363 {
6364 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6365 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6366 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6367 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6368 	}
6369 	alc_fixup_headset_mode(codec, fix, action);
6370 }
6371 
6372 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6373 static int find_ext_mic_pin(struct hda_codec *codec)
6374 {
6375 	struct alc_spec *spec = codec->spec;
6376 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6377 	hda_nid_t nid;
6378 	unsigned int defcfg;
6379 	int i;
6380 
6381 	for (i = 0; i < cfg->num_inputs; i++) {
6382 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6383 			continue;
6384 		nid = cfg->inputs[i].pin;
6385 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6386 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6387 			continue;
6388 		return nid;
6389 	}
6390 
6391 	return 0;
6392 }
6393 
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6394 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6395 				    const struct hda_fixup *fix,
6396 				    int action)
6397 {
6398 	struct alc_spec *spec = codec->spec;
6399 
6400 	if (action == HDA_FIXUP_ACT_PROBE) {
6401 		int mic_pin = find_ext_mic_pin(codec);
6402 		int hp_pin = alc_get_hp_pin(spec);
6403 
6404 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6405 			return;
6406 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6407 	}
6408 }
6409 
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6410 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6411 					     const struct hda_fixup *fix,
6412 					     int action)
6413 {
6414 	struct alc_spec *spec = codec->spec;
6415 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6416 	int i;
6417 
6418 	/* The mic boosts on level 2 and 3 are too noisy
6419 	   on the internal mic input.
6420 	   Therefore limit the boost to 0 or 1. */
6421 
6422 	if (action != HDA_FIXUP_ACT_PROBE)
6423 		return;
6424 
6425 	for (i = 0; i < cfg->num_inputs; i++) {
6426 		hda_nid_t nid = cfg->inputs[i].pin;
6427 		unsigned int defcfg;
6428 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6429 			continue;
6430 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6431 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6432 			continue;
6433 
6434 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6435 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6436 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6437 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6438 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6439 	}
6440 }
6441 
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6442 static void alc283_hp_automute_hook(struct hda_codec *codec,
6443 				    struct hda_jack_callback *jack)
6444 {
6445 	struct alc_spec *spec = codec->spec;
6446 	int vref;
6447 
6448 	msleep(200);
6449 	snd_hda_gen_hp_automute(codec, jack);
6450 
6451 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6452 
6453 	msleep(600);
6454 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6455 			    vref);
6456 }
6457 
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6458 static void alc283_fixup_chromebook(struct hda_codec *codec,
6459 				    const struct hda_fixup *fix, int action)
6460 {
6461 	struct alc_spec *spec = codec->spec;
6462 
6463 	switch (action) {
6464 	case HDA_FIXUP_ACT_PRE_PROBE:
6465 		snd_hda_override_wcaps(codec, 0x03, 0);
6466 		/* Disable AA-loopback as it causes white noise */
6467 		spec->gen.mixer_nid = 0;
6468 		break;
6469 	case HDA_FIXUP_ACT_INIT:
6470 		/* MIC2-VREF control */
6471 		/* Set to manual mode */
6472 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6473 		/* Enable Line1 input control by verb */
6474 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6475 		break;
6476 	}
6477 }
6478 
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6479 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6480 				    const struct hda_fixup *fix, int action)
6481 {
6482 	struct alc_spec *spec = codec->spec;
6483 
6484 	switch (action) {
6485 	case HDA_FIXUP_ACT_PRE_PROBE:
6486 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6487 		break;
6488 	case HDA_FIXUP_ACT_INIT:
6489 		/* MIC2-VREF control */
6490 		/* Set to manual mode */
6491 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6492 		break;
6493 	}
6494 }
6495 
6496 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6497 static void asus_tx300_automute(struct hda_codec *codec)
6498 {
6499 	struct alc_spec *spec = codec->spec;
6500 	snd_hda_gen_update_outputs(codec);
6501 	if (snd_hda_jack_detect(codec, 0x1b))
6502 		spec->gen.mute_bits |= (1ULL << 0x14);
6503 }
6504 
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6505 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6506 				    const struct hda_fixup *fix, int action)
6507 {
6508 	struct alc_spec *spec = codec->spec;
6509 	static const struct hda_pintbl dock_pins[] = {
6510 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6511 		{}
6512 	};
6513 
6514 	switch (action) {
6515 	case HDA_FIXUP_ACT_PRE_PROBE:
6516 		spec->init_amp = ALC_INIT_DEFAULT;
6517 		/* TX300 needs to set up GPIO2 for the speaker amp */
6518 		alc_setup_gpio(codec, 0x04);
6519 		snd_hda_apply_pincfgs(codec, dock_pins);
6520 		spec->gen.auto_mute_via_amp = 1;
6521 		spec->gen.automute_hook = asus_tx300_automute;
6522 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6523 						    snd_hda_gen_hp_automute);
6524 		break;
6525 	case HDA_FIXUP_ACT_PROBE:
6526 		spec->init_amp = ALC_INIT_DEFAULT;
6527 		break;
6528 	case HDA_FIXUP_ACT_BUILD:
6529 		/* this is a bit tricky; give more sane names for the main
6530 		 * (tablet) speaker and the dock speaker, respectively
6531 		 */
6532 		rename_ctl(codec, "Speaker Playback Switch",
6533 			   "Dock Speaker Playback Switch");
6534 		rename_ctl(codec, "Bass Speaker Playback Switch",
6535 			   "Speaker Playback Switch");
6536 		break;
6537 	}
6538 }
6539 
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6540 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6541 				       const struct hda_fixup *fix, int action)
6542 {
6543 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6544 		/* DAC node 0x03 is giving mono output. We therefore want to
6545 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6546 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6547 		static const hda_nid_t conn1[] = { 0x0c };
6548 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6549 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6550 	}
6551 }
6552 
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6553 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6554 					const struct hda_fixup *fix, int action)
6555 {
6556 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6557 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6558 		   we can't adjust the speaker's volume since this node does not has
6559 		   Amp-out capability. we change the speaker's route to:
6560 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6561 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6562 		   speaker's volume now. */
6563 
6564 		static const hda_nid_t conn1[] = { 0x0c };
6565 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6566 	}
6567 }
6568 
6569 /* 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)6570 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6571 				      const struct hda_fixup *fix, int action)
6572 {
6573 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6574 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6575 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6576 	}
6577 }
6578 
6579 /* 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)6580 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6581 					  const struct hda_fixup *fix, int action)
6582 {
6583 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6584 		static const hda_nid_t conn[] = { 0x02 };
6585 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6586 	}
6587 }
6588 
6589 /* 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)6590 static void alc294_fixup_bass_speaker_15(struct hda_codec *codec,
6591 					 const struct hda_fixup *fix, int action)
6592 {
6593 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6594 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6595 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
6596 	}
6597 }
6598 
6599 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6600 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6601 					  struct hda_jack_callback *jack)
6602 {
6603 	struct alc_spec *spec = codec->spec;
6604 
6605 	snd_hda_gen_hp_automute(codec, jack);
6606 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6607 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6608 			    !spec->gen.hp_jack_present);
6609 }
6610 
6611 /* Manage GPIOs for HP EliteBook Folio 9480m.
6612  *
6613  * GPIO4 is the headphone amplifier power control
6614  * GPIO3 is the audio output mute indicator LED
6615  */
6616 
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6617 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6618 				  const struct hda_fixup *fix,
6619 				  int action)
6620 {
6621 	struct alc_spec *spec = codec->spec;
6622 
6623 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6624 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6625 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6626 		spec->gpio_mask |= 0x10;
6627 		spec->gpio_dir |= 0x10;
6628 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6629 	}
6630 }
6631 
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6632 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6633 				   const struct hda_fixup *fix,
6634 				   int action)
6635 {
6636 	struct alc_spec *spec = codec->spec;
6637 
6638 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6639 		spec->gpio_mask |= 0x04;
6640 		spec->gpio_dir |= 0x04;
6641 		/* set data bit low */
6642 	}
6643 }
6644 
6645 /* Quirk for Thinkpad X1 7th and 8th Gen
6646  * The following fixed routing needed
6647  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6648  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6649  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6650  */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6651 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6652 					  const struct hda_fixup *fix, int action)
6653 {
6654 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6655 	static const hda_nid_t preferred_pairs[] = {
6656 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6657 	};
6658 	struct alc_spec *spec = codec->spec;
6659 
6660 	switch (action) {
6661 	case HDA_FIXUP_ACT_PRE_PROBE:
6662 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6663 		spec->gen.preferred_dacs = preferred_pairs;
6664 		break;
6665 	case HDA_FIXUP_ACT_BUILD:
6666 		/* The generic parser creates somewhat unintuitive volume ctls
6667 		 * with the fixed routing above, and the shared DAC2 may be
6668 		 * confusing for PA.
6669 		 * Rename those to unique names so that PA doesn't touch them
6670 		 * and use only Master volume.
6671 		 */
6672 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6673 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6674 		break;
6675 	}
6676 }
6677 
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6678 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6679 					 const struct hda_fixup *fix,
6680 					 int action)
6681 {
6682 	alc_fixup_dual_codecs(codec, fix, action);
6683 	switch (action) {
6684 	case HDA_FIXUP_ACT_PRE_PROBE:
6685 		/* override card longname to provide a unique UCM profile */
6686 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6687 		break;
6688 	case HDA_FIXUP_ACT_BUILD:
6689 		/* rename Capture controls depending on the codec */
6690 		rename_ctl(codec, "Capture Volume",
6691 			   codec->addr == 0 ?
6692 			   "Rear-Panel Capture Volume" :
6693 			   "Front-Panel Capture Volume");
6694 		rename_ctl(codec, "Capture Switch",
6695 			   codec->addr == 0 ?
6696 			   "Rear-Panel Capture Switch" :
6697 			   "Front-Panel Capture Switch");
6698 		break;
6699 	}
6700 }
6701 
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6702 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6703 				      const struct hda_fixup *fix, int action)
6704 {
6705 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6706 		return;
6707 
6708 	codec->power_save_node = 1;
6709 }
6710 
6711 /* 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)6712 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6713 				    const struct hda_fixup *fix, int action)
6714 {
6715 	struct alc_spec *spec = codec->spec;
6716 	static const hda_nid_t preferred_pairs[] = {
6717 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6718 		0
6719 	};
6720 
6721 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6722 		return;
6723 
6724 	spec->gen.preferred_dacs = preferred_pairs;
6725 	spec->gen.auto_mute_via_amp = 1;
6726 	codec->power_save_node = 0;
6727 }
6728 
6729 /* 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)6730 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6731 				    const struct hda_fixup *fix, int action)
6732 {
6733 	static const hda_nid_t preferred_pairs[] = {
6734 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6735 	};
6736 	struct alc_spec *spec = codec->spec;
6737 
6738 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6739 		spec->gen.preferred_dacs = preferred_pairs;
6740 }
6741 
6742 /* 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)6743 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6744 			      const struct hda_fixup *fix, int action)
6745 {
6746 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6747 		return;
6748 
6749 	snd_hda_override_wcaps(codec, 0x03, 0);
6750 }
6751 
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6752 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6753 {
6754 	switch (codec->core.vendor_id) {
6755 	case 0x10ec0274:
6756 	case 0x10ec0294:
6757 	case 0x10ec0225:
6758 	case 0x10ec0295:
6759 	case 0x10ec0299:
6760 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6761 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6762 		break;
6763 	case 0x10ec0230:
6764 	case 0x10ec0235:
6765 	case 0x10ec0236:
6766 	case 0x10ec0255:
6767 	case 0x10ec0256:
6768 	case 0x10ec0257:
6769 	case 0x19e58326:
6770 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6771 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6772 		break;
6773 	}
6774 }
6775 
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6776 static void alc295_fixup_chromebook(struct hda_codec *codec,
6777 				    const struct hda_fixup *fix, int action)
6778 {
6779 	struct alc_spec *spec = codec->spec;
6780 
6781 	switch (action) {
6782 	case HDA_FIXUP_ACT_PRE_PROBE:
6783 		spec->ultra_low_power = true;
6784 		break;
6785 	case HDA_FIXUP_ACT_INIT:
6786 		alc_combo_jack_hp_jd_restart(codec);
6787 		break;
6788 	}
6789 }
6790 
alc256_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6791 static void alc256_fixup_chromebook(struct hda_codec *codec,
6792 				    const struct hda_fixup *fix, int action)
6793 {
6794 	struct alc_spec *spec = codec->spec;
6795 
6796 	switch (action) {
6797 	case HDA_FIXUP_ACT_PRE_PROBE:
6798 		spec->gen.suppress_auto_mute = 1;
6799 		spec->gen.suppress_auto_mic = 1;
6800 		spec->en_3kpull_low = false;
6801 		break;
6802 	}
6803 }
6804 
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6805 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6806 				  const struct hda_fixup *fix, int action)
6807 {
6808 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6809 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6810 }
6811 
6812 
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6813 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6814 					struct hda_jack_callback *cb)
6815 {
6816 	/* The Windows driver sets the codec up in a very different way where
6817 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6818 	 */
6819 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6820 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6821 	else
6822 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6823 }
6824 
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6825 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6826 					const struct hda_fixup *fix, int action)
6827 {
6828 	/* Pin 0x21: headphones/headset mic */
6829 	if (!is_jack_detectable(codec, 0x21))
6830 		return;
6831 
6832 	switch (action) {
6833 	case HDA_FIXUP_ACT_PRE_PROBE:
6834 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6835 				alc294_gx502_toggle_output);
6836 		break;
6837 	case HDA_FIXUP_ACT_INIT:
6838 		/* Make sure to start in a correct state, i.e. if
6839 		 * headphones have been plugged in before powering up the system
6840 		 */
6841 		alc294_gx502_toggle_output(codec, NULL);
6842 		break;
6843 	}
6844 }
6845 
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6846 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6847 				       struct hda_jack_callback *cb)
6848 {
6849 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6850 	 * responsible from changes between speakers and headphones
6851 	 */
6852 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6853 		alc_write_coef_idx(codec, 0x10, 0x8420);
6854 	else
6855 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6856 }
6857 
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6858 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6859 				  const struct hda_fixup *fix, int action)
6860 {
6861 	if (!is_jack_detectable(codec, 0x21))
6862 		return;
6863 
6864 	switch (action) {
6865 	case HDA_FIXUP_ACT_PRE_PROBE:
6866 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6867 				alc294_gu502_toggle_output);
6868 		break;
6869 	case HDA_FIXUP_ACT_INIT:
6870 		alc294_gu502_toggle_output(codec, NULL);
6871 		break;
6872 	}
6873 }
6874 
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6875 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6876 			      const struct hda_fixup *fix, int action)
6877 {
6878 	if (action != HDA_FIXUP_ACT_INIT)
6879 		return;
6880 
6881 	msleep(100);
6882 	alc_write_coef_idx(codec, 0x65, 0x0);
6883 }
6884 
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6885 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6886 				    const struct hda_fixup *fix, int action)
6887 {
6888 	switch (action) {
6889 	case HDA_FIXUP_ACT_INIT:
6890 		alc_combo_jack_hp_jd_restart(codec);
6891 		break;
6892 	}
6893 }
6894 
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6895 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6896 				    const struct hda_fixup *fix, int action)
6897 {
6898 	struct alc_spec *spec = codec->spec;
6899 
6900 	switch (action) {
6901 	case HDA_FIXUP_ACT_PRE_PROBE:
6902 		/* Mic RING SLEEVE swap for combo jack */
6903 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6904 		spec->no_internal_mic_pin = true;
6905 		break;
6906 	case HDA_FIXUP_ACT_INIT:
6907 		alc_combo_jack_hp_jd_restart(codec);
6908 		break;
6909 	}
6910 }
6911 
6912 /* GPIO1 = amplifier on/off
6913  * GPIO3 = mic mute LED
6914  */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6915 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6916 					  const struct hda_fixup *fix, int action)
6917 {
6918 	static const hda_nid_t conn[] = { 0x02 };
6919 
6920 	struct alc_spec *spec = codec->spec;
6921 	static const struct hda_pintbl pincfgs[] = {
6922 		{ 0x14, 0x90170110 },  /* front/high speakers */
6923 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6924 		{ }
6925 	};
6926 
6927 	//enable micmute led
6928 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6929 
6930 	switch (action) {
6931 	case HDA_FIXUP_ACT_PRE_PROBE:
6932 		spec->micmute_led_polarity = 1;
6933 		/* needed for amp of back speakers */
6934 		spec->gpio_mask |= 0x01;
6935 		spec->gpio_dir |= 0x01;
6936 		snd_hda_apply_pincfgs(codec, pincfgs);
6937 		/* share DAC to have unified volume control */
6938 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6939 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6940 		break;
6941 	case HDA_FIXUP_ACT_INIT:
6942 		/* need to toggle GPIO to enable the amp of back speakers */
6943 		alc_update_gpio_data(codec, 0x01, true);
6944 		msleep(100);
6945 		alc_update_gpio_data(codec, 0x01, false);
6946 		break;
6947 	}
6948 }
6949 
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6950 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6951 					  const struct hda_fixup *fix, int action)
6952 {
6953 	static const hda_nid_t conn[] = { 0x02 };
6954 	static const struct hda_pintbl pincfgs[] = {
6955 		{ 0x14, 0x90170110 },  /* rear speaker */
6956 		{ }
6957 	};
6958 
6959 	switch (action) {
6960 	case HDA_FIXUP_ACT_PRE_PROBE:
6961 		snd_hda_apply_pincfgs(codec, pincfgs);
6962 		/* force front speaker to DAC1 */
6963 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6964 		break;
6965 	}
6966 }
6967 
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6968 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6969 				      const struct hda_fixup *fix,
6970 				      int action)
6971 {
6972 	static const struct coef_fw coefs[] = {
6973 		WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6974 		WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6975 		WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6976 		WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6977 		WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6978 		WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6979 		WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6980 		WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6981 		WRITE_COEF(0x6e, 0x1005), { }
6982 	};
6983 
6984 	static const struct hda_pintbl pincfgs[] = {
6985 		{ 0x12, 0xb7a60130 },  /* Internal microphone*/
6986 		{ 0x14, 0x90170150 },  /* B&O soundbar speakers */
6987 		{ 0x17, 0x90170153 },  /* Side speakers */
6988 		{ 0x19, 0x03a11040 },  /* Headset microphone */
6989 		{ }
6990 	};
6991 
6992 	switch (action) {
6993 	case HDA_FIXUP_ACT_PRE_PROBE:
6994 		snd_hda_apply_pincfgs(codec, pincfgs);
6995 
6996 		/* Fixes volume control problem for side speakers */
6997 		alc295_fixup_disable_dac3(codec, fix, action);
6998 
6999 		/* Fixes no sound from headset speaker */
7000 		snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
7001 
7002 		/* Auto-enable headset mic when plugged */
7003 		snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
7004 
7005 		/* Headset mic volume enhancement */
7006 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
7007 		break;
7008 	case HDA_FIXUP_ACT_INIT:
7009 		alc_process_coef_fw(codec, coefs);
7010 		break;
7011 	case HDA_FIXUP_ACT_BUILD:
7012 		rename_ctl(codec, "Bass Speaker Playback Volume",
7013 			   "B&O-Tuned Playback Volume");
7014 		rename_ctl(codec, "Front Playback Switch",
7015 			   "B&O Soundbar Playback Switch");
7016 		rename_ctl(codec, "Bass Speaker Playback Switch",
7017 			   "Side Speaker Playback Switch");
7018 		break;
7019 	}
7020 }
7021 
alc285_fixup_hp_beep(struct hda_codec * codec,const struct hda_fixup * fix,int action)7022 static void alc285_fixup_hp_beep(struct hda_codec *codec,
7023 				 const struct hda_fixup *fix, int action)
7024 {
7025 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7026 		codec->beep_just_power_on = true;
7027 	} else  if (action == HDA_FIXUP_ACT_INIT) {
7028 #ifdef CONFIG_SND_HDA_INPUT_BEEP
7029 		/*
7030 		 * Just enable loopback to internal speaker and headphone jack.
7031 		 * Disable amplification to get about the same beep volume as
7032 		 * was on pure BIOS setup before loading the driver.
7033 		 */
7034 		alc_update_coef_idx(codec, 0x36, 0x7070, BIT(13));
7035 
7036 		snd_hda_enable_beep_device(codec, 1);
7037 
7038 #if !IS_ENABLED(CONFIG_INPUT_PCSPKR)
7039 		dev_warn_once(hda_codec_dev(codec),
7040 			      "enable CONFIG_INPUT_PCSPKR to get PC beeps\n");
7041 #endif
7042 #endif
7043 	}
7044 }
7045 
7046 /* for hda_fixup_thinkpad_acpi() */
7047 #include "thinkpad_helper.c"
7048 
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)7049 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
7050 				    const struct hda_fixup *fix, int action)
7051 {
7052 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
7053 	hda_fixup_thinkpad_acpi(codec, fix, action);
7054 }
7055 
7056 /* for hda_fixup_ideapad_acpi() */
7057 #include "ideapad_hotkey_led_helper.c"
7058 
alc_fixup_ideapad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)7059 static void alc_fixup_ideapad_acpi(struct hda_codec *codec,
7060 				   const struct hda_fixup *fix, int action)
7061 {
7062 	hda_fixup_ideapad_acpi(codec, fix, action);
7063 }
7064 
7065 /* 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)7066 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
7067 						  const struct hda_fixup *fix,
7068 						  int action)
7069 {
7070 	struct alc_spec *spec = codec->spec;
7071 
7072 	switch (action) {
7073 	case HDA_FIXUP_ACT_PRE_PROBE:
7074 		spec->gen.suppress_auto_mute = 1;
7075 		break;
7076 	}
7077 }
7078 
comp_acpi_device_notify(acpi_handle handle,u32 event,void * data)7079 static void comp_acpi_device_notify(acpi_handle handle, u32 event, void *data)
7080 {
7081 	struct hda_codec *cdc = data;
7082 	struct alc_spec *spec = cdc->spec;
7083 
7084 	codec_info(cdc, "ACPI Notification %d\n", event);
7085 
7086 	hda_component_acpi_device_notify(&spec->comps, handle, event, data);
7087 }
7088 
comp_bind(struct device * dev)7089 static int comp_bind(struct device *dev)
7090 {
7091 	struct hda_codec *cdc = dev_to_hda_codec(dev);
7092 	struct alc_spec *spec = cdc->spec;
7093 	int ret;
7094 
7095 	ret = hda_component_manager_bind(cdc, &spec->comps);
7096 	if (ret)
7097 		return ret;
7098 
7099 	return hda_component_manager_bind_acpi_notifications(cdc,
7100 							     &spec->comps,
7101 							     comp_acpi_device_notify, cdc);
7102 }
7103 
comp_unbind(struct device * dev)7104 static void comp_unbind(struct device *dev)
7105 {
7106 	struct hda_codec *cdc = dev_to_hda_codec(dev);
7107 	struct alc_spec *spec = cdc->spec;
7108 
7109 	hda_component_manager_unbind_acpi_notifications(cdc, &spec->comps, comp_acpi_device_notify);
7110 	hda_component_manager_unbind(cdc, &spec->comps);
7111 }
7112 
7113 static const struct component_master_ops comp_master_ops = {
7114 	.bind = comp_bind,
7115 	.unbind = comp_unbind,
7116 };
7117 
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)7118 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
7119 				       struct snd_pcm_substream *sub, int action)
7120 {
7121 	struct alc_spec *spec = cdc->spec;
7122 
7123 	hda_component_manager_playback_hook(&spec->comps, action);
7124 }
7125 
comp_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,const char * match_str,int count)7126 static void comp_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
7127 			       const char *hid, const char *match_str, int count)
7128 {
7129 	struct alc_spec *spec = cdc->spec;
7130 	int ret;
7131 
7132 	switch (action) {
7133 	case HDA_FIXUP_ACT_PRE_PROBE:
7134 		ret = hda_component_manager_init(cdc, &spec->comps, count, bus, hid,
7135 						 match_str, &comp_master_ops);
7136 		if (ret)
7137 			return;
7138 
7139 		spec->gen.pcm_playback_hook = comp_generic_playback_hook;
7140 		break;
7141 	case HDA_FIXUP_ACT_FREE:
7142 		hda_component_manager_free(&spec->comps, &comp_master_ops);
7143 		break;
7144 	}
7145 }
7146 
find_cirrus_companion_amps(struct hda_codec * cdc)7147 static void find_cirrus_companion_amps(struct hda_codec *cdc)
7148 {
7149 	struct device *dev = hda_codec_dev(cdc);
7150 	struct acpi_device *adev;
7151 	struct fwnode_handle *fwnode __free(fwnode_handle) = NULL;
7152 	const char *bus = NULL;
7153 	static const struct {
7154 		const char *hid;
7155 		const char *name;
7156 	} acpi_ids[] = {{ "CSC3554", "cs35l54-hda" },
7157 			{ "CSC3556", "cs35l56-hda" },
7158 			{ "CSC3557", "cs35l57-hda" }};
7159 	char *match;
7160 	int i, count = 0, count_devindex = 0;
7161 
7162 	for (i = 0; i < ARRAY_SIZE(acpi_ids); ++i) {
7163 		adev = acpi_dev_get_first_match_dev(acpi_ids[i].hid, NULL, -1);
7164 		if (adev)
7165 			break;
7166 	}
7167 	if (!adev) {
7168 		codec_dbg(cdc, "Did not find ACPI entry for a Cirrus Amp\n");
7169 		return;
7170 	}
7171 
7172 	count = i2c_acpi_client_count(adev);
7173 	if (count > 0) {
7174 		bus = "i2c";
7175 	} else {
7176 		count = acpi_spi_count_resources(adev);
7177 		if (count > 0)
7178 			bus = "spi";
7179 	}
7180 
7181 	fwnode = fwnode_handle_get(acpi_fwnode_handle(adev));
7182 	acpi_dev_put(adev);
7183 
7184 	if (!bus) {
7185 		codec_err(cdc, "Did not find any buses for %s\n", acpi_ids[i].hid);
7186 		return;
7187 	}
7188 
7189 	if (!fwnode) {
7190 		codec_err(cdc, "Could not get fwnode for %s\n", acpi_ids[i].hid);
7191 		return;
7192 	}
7193 
7194 	/*
7195 	 * When available the cirrus,dev-index property is an accurate
7196 	 * count of the amps in a system and is used in preference to
7197 	 * the count of bus devices that can contain additional address
7198 	 * alias entries.
7199 	 */
7200 	count_devindex = fwnode_property_count_u32(fwnode, "cirrus,dev-index");
7201 	if (count_devindex > 0)
7202 		count = count_devindex;
7203 
7204 	match = devm_kasprintf(dev, GFP_KERNEL, "-%%s:00-%s.%%d", acpi_ids[i].name);
7205 	if (!match)
7206 		return;
7207 	codec_info(cdc, "Found %d %s on %s (%s)\n", count, acpi_ids[i].hid, bus, match);
7208 	comp_generic_fixup(cdc, HDA_FIXUP_ACT_PRE_PROBE, bus, acpi_ids[i].hid, match, count);
7209 }
7210 
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7211 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7212 {
7213 	comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
7214 }
7215 
cs35l41_fixup_i2c_four(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7216 static void cs35l41_fixup_i2c_four(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7217 {
7218 	comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
7219 }
7220 
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)7221 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7222 {
7223 	comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
7224 }
7225 
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)7226 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7227 {
7228 	comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
7229 }
7230 
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7231 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7232 						 int action)
7233 {
7234 	comp_generic_fixup(cdc, action, "i2c", "CLSA0100", "-%s:00-cs35l41-hda.%d", 2);
7235 }
7236 
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7237 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7238 						 int action)
7239 {
7240 	comp_generic_fixup(cdc, action, "i2c", "CLSA0101", "-%s:00-cs35l41-hda.%d", 2);
7241 }
7242 
alc285_fixup_asus_ga403u(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7243 static void alc285_fixup_asus_ga403u(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7244 {
7245 	/*
7246 	 * The same SSID has been re-used in different hardware, they have
7247 	 * different codecs and the newer GA403U has a ALC285.
7248 	 */
7249 	if (cdc->core.vendor_id != 0x10ec0285)
7250 		alc_fixup_inv_dmic(cdc, fix, action);
7251 }
7252 
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7253 static void tas2781_fixup_i2c(struct hda_codec *cdc,
7254 	const struct hda_fixup *fix, int action)
7255 {
7256 	comp_generic_fixup(cdc, action, "i2c", "TIAS2781", "-%s:00", 1);
7257 }
7258 
tas2781_fixup_spi(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7259 static void tas2781_fixup_spi(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7260 {
7261 	comp_generic_fixup(cdc, action, "spi", "TXNW2781", "-%s:00-tas2781-hda.%d", 2);
7262 }
7263 
yoga7_14arb7_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7264 static void yoga7_14arb7_fixup_i2c(struct hda_codec *cdc,
7265 	const struct hda_fixup *fix, int action)
7266 {
7267 	comp_generic_fixup(cdc, action, "i2c", "INT8866", "-%s:00", 1);
7268 }
7269 
alc256_fixup_acer_sfg16_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)7270 static void alc256_fixup_acer_sfg16_micmute_led(struct hda_codec *codec,
7271 	const struct hda_fixup *fix, int action)
7272 {
7273 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
7274 }
7275 
7276 
7277 /* for alc295_fixup_hp_top_speakers */
7278 #include "hp_x360_helper.c"
7279 
7280 /* for alc285_fixup_ideapad_s740_coef() */
7281 #include "ideapad_s740_helper.c"
7282 
7283 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
7284 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
7285 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
7286 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
7287 	{}
7288 };
7289 
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)7290 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
7291 					   const struct hda_fixup *fix,
7292 					   int action)
7293 {
7294 	/*
7295 	 * A certain other OS sets these coeffs to different values. On at least
7296 	 * one TongFang barebone these settings might survive even a cold
7297 	 * reboot. So to restore a clean slate the values are explicitly reset
7298 	 * to default here. Without this, the external microphone is always in a
7299 	 * plugged-in state, while the internal microphone is always in an
7300 	 * unplugged state, breaking the ability to use the internal microphone.
7301 	 */
7302 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7303 }
7304 
7305 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7306 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7307 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7308 	WRITE_COEF(0x49, 0x0149),
7309 	{}
7310 };
7311 
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7312 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7313 				       const struct hda_fixup *fix,
7314 				       int action)
7315 {
7316 	/*
7317 	 * The audio jack input and output is not detected on the ASRock NUC Box
7318 	 * 1100 series when cold booting without this fix. Warm rebooting from a
7319 	 * certain other OS makes the audio functional, as COEF settings are
7320 	 * preserved in this case. This fix sets these altered COEF values as
7321 	 * the default.
7322 	 */
7323 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7324 }
7325 
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7326 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7327 						    const struct hda_fixup *fix,
7328 						    int action)
7329 {
7330 	/*
7331 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7332 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7333 	 * needs an additional quirk for sound working after suspend and resume.
7334 	 */
7335 	if (codec->core.vendor_id == 0x10ec0256) {
7336 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7337 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7338 	} else {
7339 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7340 	}
7341 }
7342 
alc256_decrease_headphone_amp_val(struct hda_codec * codec,const struct hda_fixup * fix,int action)7343 static void alc256_decrease_headphone_amp_val(struct hda_codec *codec,
7344 					      const struct hda_fixup *fix, int action)
7345 {
7346 	u32 caps;
7347 	u8 nsteps, offs;
7348 
7349 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7350 		return;
7351 
7352 	caps = query_amp_caps(codec, 0x3, HDA_OUTPUT);
7353 	nsteps = ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) - 10;
7354 	offs = ((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT) - 10;
7355 	caps &= ~AC_AMPCAP_NUM_STEPS & ~AC_AMPCAP_OFFSET;
7356 	caps |= (nsteps << AC_AMPCAP_NUM_STEPS_SHIFT) | (offs << AC_AMPCAP_OFFSET_SHIFT);
7357 
7358 	if (snd_hda_override_amp_caps(codec, 0x3, HDA_OUTPUT, caps))
7359 		codec_warn(codec, "failed to override amp caps for NID 0x3\n");
7360 }
7361 
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7362 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7363 						  const struct hda_fixup *fix,
7364 						  int action)
7365 {
7366 	struct alc_spec *spec = codec->spec;
7367 	struct hda_input_mux *imux = &spec->gen.input_mux;
7368 	int i;
7369 
7370 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
7371 
7372 	switch (action) {
7373 	case HDA_FIXUP_ACT_PRE_PROBE:
7374 		/**
7375 		 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7376 		 * to Hi-Z to avoid pop noises at startup and when plugging and
7377 		 * unplugging headphones.
7378 		 */
7379 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7380 		snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7381 		break;
7382 	case HDA_FIXUP_ACT_PROBE:
7383 		/**
7384 		 * Make the internal mic (0x12) the default input source to
7385 		 * prevent pop noises on cold boot.
7386 		 */
7387 		for (i = 0; i < imux->num_items; i++) {
7388 			if (spec->gen.imux_pins[i] == 0x12) {
7389 				spec->gen.cur_mux[0] = i;
7390 				break;
7391 			}
7392 		}
7393 		break;
7394 	}
7395 }
7396 
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7397 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7398 					  const struct hda_fixup *fix, int action)
7399 {
7400 	/*
7401 	 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7402 	 * unconnected.
7403 	 */
7404 	static const struct hda_pintbl pincfgs[] = {
7405 		{ 0x17, 0x90170121 },
7406 		{ }
7407 	};
7408 	/*
7409 	 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7410 	 * DAC 0x02 and 0x03 would be fine.
7411 	 */
7412 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7413 	/*
7414 	 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7415 	 * Headphones (0x21) are connected to DAC 0x03.
7416 	 */
7417 	static const hda_nid_t preferred_pairs[] = {
7418 		0x14, 0x02,
7419 		0x17, 0x02,
7420 		0x21, 0x03,
7421 		0
7422 	};
7423 	struct alc_spec *spec = codec->spec;
7424 
7425 	switch (action) {
7426 	case HDA_FIXUP_ACT_PRE_PROBE:
7427 		snd_hda_apply_pincfgs(codec, pincfgs);
7428 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7429 		spec->gen.preferred_dacs = preferred_pairs;
7430 		break;
7431 	}
7432 }
7433 
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7434 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7435 					  const struct hda_fixup *fix, int action)
7436 {
7437 	static const struct hda_pintbl pincfgs[] = {
7438 		{ 0x14, 0x90170151 },
7439 		{ 0x17, 0x90170150 },
7440 		{ }
7441 	};
7442 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7443 	static const hda_nid_t preferred_pairs[] = {
7444 		0x14, 0x02,
7445 		0x17, 0x03,
7446 		0x21, 0x02,
7447 		0
7448 	};
7449 	struct alc_spec *spec = codec->spec;
7450 
7451 	alc_fixup_no_shutup(codec, fix, action);
7452 
7453 	switch (action) {
7454 	case HDA_FIXUP_ACT_PRE_PROBE:
7455 		snd_hda_apply_pincfgs(codec, pincfgs);
7456 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7457 		spec->gen.preferred_dacs = preferred_pairs;
7458 		break;
7459 	}
7460 }
7461 
7462 /* 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)7463 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7464 				    const struct hda_fixup *fix, int action)
7465 {
7466 	struct alc_spec *spec = codec->spec;
7467 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7468 	static const hda_nid_t preferred_pairs[] = {
7469 		0x17, 0x02, 0x21, 0x03, 0
7470 	};
7471 
7472 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7473 		return;
7474 
7475 	snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7476 	spec->gen.preferred_dacs = preferred_pairs;
7477 	spec->gen.auto_mute_via_amp = 1;
7478 	if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7479 		snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7480 					0x0); /* Make sure 0x14 was disable */
7481 	}
7482 }
7483 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7484 static void alc_fixup_headset_mic(struct hda_codec *codec,
7485 				   const struct hda_fixup *fix, int action)
7486 {
7487 	struct alc_spec *spec = codec->spec;
7488 	static const struct hda_pintbl pincfgs[] = {
7489 		{ 0x19, 0x03a1103c },
7490 		{ }
7491 	};
7492 
7493 	switch (action) {
7494 	case HDA_FIXUP_ACT_PRE_PROBE:
7495 		snd_hda_apply_pincfgs(codec, pincfgs);
7496 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7497 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7498 		break;
7499 	}
7500 }
7501 
alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec * codec,const struct hda_fixup * fix,int action)7502 static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec,
7503 					  const struct hda_fixup *fix, int action)
7504 {
7505 	/*
7506 	 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
7507 	 * unconnected.
7508 	 * The Pin Complex 0x17 for the bass speakers has the lowest association
7509 	 * and sequence values so shift it up a bit to squeeze 0x14 in.
7510 	 */
7511 	static const struct hda_pintbl pincfgs[] = {
7512 		{ 0x14, 0x90170110 }, // top/treble
7513 		{ 0x17, 0x90170111 }, // bottom/bass
7514 		{ }
7515 	};
7516 
7517 	/*
7518 	 * Force DAC 0x02 for the bass speakers 0x17.
7519 	 */
7520 	static const hda_nid_t conn[] = { 0x02 };
7521 
7522 	switch (action) {
7523 	case HDA_FIXUP_ACT_PRE_PROBE:
7524 		snd_hda_apply_pincfgs(codec, pincfgs);
7525 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7526 		break;
7527 	}
7528 
7529 	cs35l41_fixup_i2c_two(codec, fix, action);
7530 	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7531 	alc245_fixup_hp_gpio_led(codec, fix, action);
7532 }
7533 
7534 /* 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)7535 static void alc245_fixup_hp_spectre_x360_16_aa0xxx(struct hda_codec *codec,
7536 					  const struct hda_fixup *fix, int action)
7537 {
7538 	/*
7539 	 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
7540 	 * unconnected.
7541 	 * The Pin Complex 0x17 for the bass speakers has the lowest association
7542 	 * and sequence values so shift it up a bit to squeeze 0x14 in.
7543 	 */
7544 	struct alc_spec *spec = codec->spec;
7545 	static const struct hda_pintbl pincfgs[] = {
7546 		{ 0x14, 0x90170110 }, // top/treble
7547 		{ 0x17, 0x90170111 }, // bottom/bass
7548 		{ }
7549 	};
7550 
7551 	/*
7552 	 * Force DAC 0x02 for the bass speakers 0x17.
7553 	 */
7554 	static const hda_nid_t conn[] = { 0x02 };
7555 
7556 	switch (action) {
7557 	case HDA_FIXUP_ACT_PRE_PROBE:
7558 		/* needed for amp of back speakers */
7559 		spec->gpio_mask |= 0x01;
7560 		spec->gpio_dir |= 0x01;
7561 		snd_hda_apply_pincfgs(codec, pincfgs);
7562 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7563 		break;
7564 	case HDA_FIXUP_ACT_INIT:
7565 		/* need to toggle GPIO to enable the amp of back speakers */
7566 		alc_update_gpio_data(codec, 0x01, true);
7567 		msleep(100);
7568 		alc_update_gpio_data(codec, 0x01, false);
7569 		break;
7570 	}
7571 
7572 	cs35l41_fixup_i2c_two(codec, fix, action);
7573 	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7574 	alc245_fixup_hp_gpio_led(codec, fix, action);
7575 }
7576 
7577 /*
7578  * ALC287 PCM hooks
7579  */
alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)7580 static void alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream *hinfo,
7581 				   struct hda_codec *codec,
7582 				   struct snd_pcm_substream *substream,
7583 				   int action)
7584 {
7585 	switch (action) {
7586 	case HDA_GEN_PCM_ACT_OPEN:
7587 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x954f); /* write gpio3 to high */
7588 		break;
7589 	case HDA_GEN_PCM_ACT_CLOSE:
7590 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7591 		break;
7592 	}
7593 }
7594 
alc287_s4_power_gpio3_default(struct hda_codec * codec)7595 static void alc287_s4_power_gpio3_default(struct hda_codec *codec)
7596 {
7597 	if (is_s4_suspend(codec)) {
7598 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7599 	}
7600 }
7601 
alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec * codec,const struct hda_fixup * fix,int action)7602 static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec,
7603 			       const struct hda_fixup *fix, int action)
7604 {
7605 	struct alc_spec *spec = codec->spec;
7606 	static const struct coef_fw coefs[] = {
7607 		WRITE_COEF(0x24, 0x0013), WRITE_COEF(0x25, 0x0000), WRITE_COEF(0x26, 0xC300),
7608 		WRITE_COEF(0x28, 0x0001), WRITE_COEF(0x29, 0xb023),
7609 		WRITE_COEF(0x24, 0x0013), WRITE_COEF(0x25, 0x0000), WRITE_COEF(0x26, 0xC301),
7610 		WRITE_COEF(0x28, 0x0001), WRITE_COEF(0x29, 0xb023),
7611 	};
7612 
7613 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7614 		return;
7615 	alc_update_coef_idx(codec, 0x10, 1<<11, 1<<11);
7616 	alc_process_coef_fw(codec, coefs);
7617 	spec->power_hook = alc287_s4_power_gpio3_default;
7618 	spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook;
7619 }
7620 
7621 /*
7622  * Clear COEF 0x0d (PCBEEP passthrough) bit 0x40 where BIOS sets it wrongly
7623  * at PM resume
7624  */
alc283_fixup_dell_hp_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7625 static void alc283_fixup_dell_hp_resume(struct hda_codec *codec,
7626 					const struct hda_fixup *fix, int action)
7627 {
7628 	if (action == HDA_FIXUP_ACT_INIT)
7629 		alc_write_coef_idx(codec, 0xd, 0x2800);
7630 }
7631 
7632 enum {
7633 	ALC269_FIXUP_GPIO2,
7634 	ALC269_FIXUP_SONY_VAIO,
7635 	ALC275_FIXUP_SONY_VAIO_GPIO2,
7636 	ALC269_FIXUP_DELL_M101Z,
7637 	ALC269_FIXUP_SKU_IGNORE,
7638 	ALC269_FIXUP_ASUS_G73JW,
7639 	ALC269_FIXUP_ASUS_N7601ZM_PINS,
7640 	ALC269_FIXUP_ASUS_N7601ZM,
7641 	ALC269_FIXUP_LENOVO_EAPD,
7642 	ALC275_FIXUP_SONY_HWEQ,
7643 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
7644 	ALC271_FIXUP_DMIC,
7645 	ALC269_FIXUP_PCM_44K,
7646 	ALC269_FIXUP_STEREO_DMIC,
7647 	ALC269_FIXUP_HEADSET_MIC,
7648 	ALC269_FIXUP_QUANTA_MUTE,
7649 	ALC269_FIXUP_LIFEBOOK,
7650 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
7651 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
7652 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7653 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7654 	ALC269_FIXUP_AMIC,
7655 	ALC269_FIXUP_DMIC,
7656 	ALC269VB_FIXUP_AMIC,
7657 	ALC269VB_FIXUP_DMIC,
7658 	ALC269_FIXUP_HP_MUTE_LED,
7659 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
7660 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
7661 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
7662 	ALC269_FIXUP_HP_GPIO_LED,
7663 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
7664 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
7665 	ALC269_FIXUP_INV_DMIC,
7666 	ALC269_FIXUP_LENOVO_DOCK,
7667 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7668 	ALC269_FIXUP_NO_SHUTUP,
7669 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7670 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7671 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7672 	ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7673 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7674 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7675 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7676 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7677 	ALC269_FIXUP_HEADSET_MODE,
7678 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7679 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7680 	ALC269_FIXUP_ASUS_X101_FUNC,
7681 	ALC269_FIXUP_ASUS_X101_VERB,
7682 	ALC269_FIXUP_ASUS_X101,
7683 	ALC271_FIXUP_AMIC_MIC2,
7684 	ALC271_FIXUP_HP_GATE_MIC_JACK,
7685 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7686 	ALC269_FIXUP_ACER_AC700,
7687 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7688 	ALC269VB_FIXUP_ASUS_ZENBOOK,
7689 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7690 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7691 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7692 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
7693 	ALC283_FIXUP_CHROME_BOOK,
7694 	ALC283_FIXUP_SENSE_COMBO_JACK,
7695 	ALC282_FIXUP_ASUS_TX300,
7696 	ALC283_FIXUP_INT_MIC,
7697 	ALC290_FIXUP_MONO_SPEAKERS,
7698 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7699 	ALC290_FIXUP_SUBWOOFER,
7700 	ALC290_FIXUP_SUBWOOFER_HSJACK,
7701 	ALC295_FIXUP_HP_MUTE_LED_COEFBIT11,
7702 	ALC269_FIXUP_THINKPAD_ACPI,
7703 	ALC269_FIXUP_LENOVO_XPAD_ACPI,
7704 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7705 	ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
7706 	ALC269VC_FIXUP_INFINIX_Y4_MAX,
7707 	ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7708 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7709 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7710 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7711 	ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7712 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7713 	ALC255_FIXUP_HEADSET_MODE,
7714 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7715 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7716 	ALC292_FIXUP_TPT440_DOCK,
7717 	ALC292_FIXUP_TPT440,
7718 	ALC283_FIXUP_HEADSET_MIC,
7719 	ALC255_FIXUP_MIC_MUTE_LED,
7720 	ALC282_FIXUP_ASPIRE_V5_PINS,
7721 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
7722 	ALC280_FIXUP_HP_GPIO4,
7723 	ALC286_FIXUP_HP_GPIO_LED,
7724 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7725 	ALC280_FIXUP_HP_DOCK_PINS,
7726 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7727 	ALC280_FIXUP_HP_9480M,
7728 	ALC245_FIXUP_HP_X360_AMP,
7729 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7730 	ALC285_FIXUP_HP_ENVY_X360,
7731 	ALC288_FIXUP_DELL_HEADSET_MODE,
7732 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7733 	ALC288_FIXUP_DELL_XPS_13,
7734 	ALC288_FIXUP_DISABLE_AAMIX,
7735 	ALC292_FIXUP_DELL_E7X_AAMIX,
7736 	ALC292_FIXUP_DELL_E7X,
7737 	ALC292_FIXUP_DISABLE_AAMIX,
7738 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7739 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7740 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7741 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7742 	ALC275_FIXUP_DELL_XPS,
7743 	ALC293_FIXUP_LENOVO_SPK_NOISE,
7744 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7745 	ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED,
7746 	ALC255_FIXUP_DELL_SPK_NOISE,
7747 	ALC225_FIXUP_DISABLE_MIC_VREF,
7748 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7749 	ALC295_FIXUP_DISABLE_DAC3,
7750 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
7751 	ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7752 	ALC285_FIXUP_ASUS_HEADSET_MIC,
7753 	ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7754 	ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7755 	ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7756 	ALC280_FIXUP_HP_HEADSET_MIC,
7757 	ALC221_FIXUP_HP_FRONT_MIC,
7758 	ALC292_FIXUP_TPT460,
7759 	ALC298_FIXUP_SPK_VOLUME,
7760 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
7761 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7762 	ALC269_FIXUP_ATIV_BOOK_8,
7763 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7764 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7765 	ALC256_FIXUP_ASUS_HEADSET_MODE,
7766 	ALC256_FIXUP_ASUS_MIC,
7767 	ALC256_FIXUP_ASUS_AIO_GPIO2,
7768 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7769 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7770 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
7771 	ALC233_FIXUP_ACER_HEADSET_MIC,
7772 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
7773 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7774 	ALC225_FIXUP_S3_POP_NOISE,
7775 	ALC700_FIXUP_INTEL_REFERENCE,
7776 	ALC274_FIXUP_DELL_BIND_DACS,
7777 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7778 	ALC298_FIXUP_TPT470_DOCK_FIX,
7779 	ALC298_FIXUP_TPT470_DOCK,
7780 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7781 	ALC255_FIXUP_DELL_HEADSET_MIC,
7782 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7783 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
7784 	ALC295_FIXUP_HP_X360,
7785 	ALC221_FIXUP_HP_HEADSET_MIC,
7786 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7787 	ALC295_FIXUP_HP_AUTO_MUTE,
7788 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7789 	ALC294_FIXUP_ASUS_MIC,
7790 	ALC294_FIXUP_ASUS_HEADSET_MIC,
7791 	ALC294_FIXUP_ASUS_SPK,
7792 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7793 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7794 	ALC255_FIXUP_ACER_HEADSET_MIC,
7795 	ALC295_FIXUP_CHROME_BOOK,
7796 	ALC225_FIXUP_HEADSET_JACK,
7797 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7798 	ALC225_FIXUP_WYSE_AUTO_MUTE,
7799 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7800 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7801 	ALC256_FIXUP_ASUS_HEADSET_MIC,
7802 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7803 	ALC255_FIXUP_PREDATOR_SUBWOOFER,
7804 	ALC299_FIXUP_PREDATOR_SPK,
7805 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7806 	ALC289_FIXUP_DELL_SPK1,
7807 	ALC289_FIXUP_DELL_SPK2,
7808 	ALC289_FIXUP_DUAL_SPK,
7809 	ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7810 	ALC294_FIXUP_SPK2_TO_DAC1,
7811 	ALC294_FIXUP_ASUS_DUAL_SPK,
7812 	ALC285_FIXUP_THINKPAD_X1_GEN7,
7813 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7814 	ALC294_FIXUP_ASUS_ALLY,
7815 	ALC294_FIXUP_ASUS_ALLY_PINS,
7816 	ALC294_FIXUP_ASUS_ALLY_VERBS,
7817 	ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7818 	ALC294_FIXUP_ASUS_HPE,
7819 	ALC294_FIXUP_ASUS_COEF_1B,
7820 	ALC294_FIXUP_ASUS_GX502_HP,
7821 	ALC294_FIXUP_ASUS_GX502_PINS,
7822 	ALC294_FIXUP_ASUS_GX502_VERBS,
7823 	ALC294_FIXUP_ASUS_GU502_HP,
7824 	ALC294_FIXUP_ASUS_GU502_PINS,
7825 	ALC294_FIXUP_ASUS_GU502_VERBS,
7826 	ALC294_FIXUP_ASUS_G513_PINS,
7827 	ALC285_FIXUP_ASUS_G533Z_PINS,
7828 	ALC285_FIXUP_HP_GPIO_LED,
7829 	ALC285_FIXUP_HP_MUTE_LED,
7830 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7831 	ALC285_FIXUP_HP_BEEP_MICMUTE_LED,
7832 	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7833 	ALC236_FIXUP_HP_GPIO_LED,
7834 	ALC236_FIXUP_HP_MUTE_LED,
7835 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7836 	ALC236_FIXUP_LENOVO_INV_DMIC,
7837 	ALC298_FIXUP_SAMSUNG_AMP,
7838 	ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS,
7839 	ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS,
7840 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7841 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7842 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7843 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7844 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
7845 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7846 	ALC289_FIXUP_ASUS_GA401,
7847 	ALC289_FIXUP_ASUS_GA502,
7848 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7849 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
7850 	ALC269_FIXUP_CZC_B20,
7851 	ALC269_FIXUP_CZC_TMI,
7852 	ALC269_FIXUP_CZC_L101,
7853 	ALC269_FIXUP_LEMOTE_A1802,
7854 	ALC269_FIXUP_LEMOTE_A190X,
7855 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
7856 	ALC233_FIXUP_INTEL_NUC8_DMIC,
7857 	ALC233_FIXUP_INTEL_NUC8_BOOST,
7858 	ALC256_FIXUP_INTEL_NUC10,
7859 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7860 	ALC274_FIXUP_HP_MIC,
7861 	ALC274_FIXUP_HP_HEADSET_MIC,
7862 	ALC274_FIXUP_HP_ENVY_GPIO,
7863 	ALC274_FIXUP_ASUS_ZEN_AIO_27,
7864 	ALC256_FIXUP_ASUS_HPE,
7865 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7866 	ALC287_FIXUP_HP_GPIO_LED,
7867 	ALC256_FIXUP_HP_HEADSET_MIC,
7868 	ALC245_FIXUP_HP_GPIO_LED,
7869 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7870 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7871 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7872 	ALC256_FIXUP_ACER_HEADSET_MIC,
7873 	ALC285_FIXUP_IDEAPAD_S740_COEF,
7874 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7875 	ALC295_FIXUP_ASUS_DACS,
7876 	ALC295_FIXUP_HP_OMEN,
7877 	ALC285_FIXUP_HP_SPECTRE_X360,
7878 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7879 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7880 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7881 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7882 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7883 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7884 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7885 	ALC298_FIXUP_LENOVO_C940_DUET7,
7886 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
7887 	ALC256_FIXUP_SET_COEF_DEFAULTS,
7888 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7889 	ALC233_FIXUP_NO_AUDIO_JACK,
7890 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7891 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7892 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7893 	ALC287_FIXUP_LEGION_16ACHG6,
7894 	ALC287_FIXUP_CS35L41_I2C_2,
7895 	ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7896 	ALC287_FIXUP_CS35L41_I2C_4,
7897 	ALC245_FIXUP_CS35L41_SPI_2,
7898 	ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7899 	ALC245_FIXUP_CS35L41_SPI_4,
7900 	ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7901 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7902 	ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7903 	ALC287_FIXUP_LEGION_16ITHG6,
7904 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7905 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7906 	ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7907 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7908 	ALC236_FIXUP_DELL_DUAL_CODECS,
7909 	ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7910 	ALC287_FIXUP_TAS2781_I2C,
7911 	ALC245_FIXUP_TAS2781_SPI_2,
7912 	ALC287_FIXUP_YOGA7_14ARB7_I2C,
7913 	ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7914 	ALC245_FIXUP_HP_X360_MUTE_LEDS,
7915 	ALC287_FIXUP_THINKPAD_I2S_SPK,
7916 	ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7917 	ALC2XX_FIXUP_HEADSET_MIC,
7918 	ALC289_FIXUP_DELL_CS35L41_SPI_2,
7919 	ALC294_FIXUP_CS35L41_I2C_2,
7920 	ALC256_FIXUP_ACER_SFG16_MICMUTE_LED,
7921 	ALC256_FIXUP_HEADPHONE_AMP_VOL,
7922 	ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX,
7923 	ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX,
7924 	ALC285_FIXUP_ASUS_GA403U,
7925 	ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC,
7926 	ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1,
7927 	ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
7928 	ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1,
7929 	ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318,
7930 	ALC256_FIXUP_CHROME_BOOK,
7931 	ALC245_FIXUP_CLEVO_NOISY_MIC,
7932 	ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE,
7933 	ALC233_FIXUP_MEDION_MTL_SPK,
7934 	ALC294_FIXUP_BASS_SPEAKER_15,
7935 	ALC283_FIXUP_DELL_HP_RESUME,
7936 };
7937 
7938 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7939  * both have the very same PCI SSID, and we need to apply different fixups
7940  * depending on the codec ID
7941  */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)7942 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7943 					   const struct hda_fixup *fix,
7944 					   int action)
7945 {
7946 	int id;
7947 
7948 	if (codec->core.vendor_id == 0x10ec0298)
7949 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7950 	else
7951 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7952 	__snd_hda_apply_fixup(codec, id, action, 0);
7953 }
7954 
7955 static const struct hda_fixup alc269_fixups[] = {
7956 	[ALC269_FIXUP_GPIO2] = {
7957 		.type = HDA_FIXUP_FUNC,
7958 		.v.func = alc_fixup_gpio2,
7959 	},
7960 	[ALC269_FIXUP_SONY_VAIO] = {
7961 		.type = HDA_FIXUP_PINCTLS,
7962 		.v.pins = (const struct hda_pintbl[]) {
7963 			{0x19, PIN_VREFGRD},
7964 			{}
7965 		}
7966 	},
7967 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7968 		.type = HDA_FIXUP_FUNC,
7969 		.v.func = alc275_fixup_gpio4_off,
7970 		.chained = true,
7971 		.chain_id = ALC269_FIXUP_SONY_VAIO
7972 	},
7973 	[ALC269_FIXUP_DELL_M101Z] = {
7974 		.type = HDA_FIXUP_VERBS,
7975 		.v.verbs = (const struct hda_verb[]) {
7976 			/* Enables internal speaker */
7977 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
7978 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7979 			{}
7980 		}
7981 	},
7982 	[ALC269_FIXUP_SKU_IGNORE] = {
7983 		.type = HDA_FIXUP_FUNC,
7984 		.v.func = alc_fixup_sku_ignore,
7985 	},
7986 	[ALC269_FIXUP_ASUS_G73JW] = {
7987 		.type = HDA_FIXUP_PINS,
7988 		.v.pins = (const struct hda_pintbl[]) {
7989 			{ 0x17, 0x99130111 }, /* subwoofer */
7990 			{ }
7991 		}
7992 	},
7993 	[ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7994 		.type = HDA_FIXUP_PINS,
7995 		.v.pins = (const struct hda_pintbl[]) {
7996 			{ 0x19, 0x03A11050 },
7997 			{ 0x1a, 0x03A11C30 },
7998 			{ 0x21, 0x03211420 },
7999 			{ }
8000 		}
8001 	},
8002 	[ALC269_FIXUP_ASUS_N7601ZM] = {
8003 		.type = HDA_FIXUP_VERBS,
8004 		.v.verbs = (const struct hda_verb[]) {
8005 			{0x20, AC_VERB_SET_COEF_INDEX, 0x62},
8006 			{0x20, AC_VERB_SET_PROC_COEF, 0xa007},
8007 			{0x20, AC_VERB_SET_COEF_INDEX, 0x10},
8008 			{0x20, AC_VERB_SET_PROC_COEF, 0x8420},
8009 			{0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
8010 			{0x20, AC_VERB_SET_PROC_COEF, 0x7774},
8011 			{ }
8012 		},
8013 		.chained = true,
8014 		.chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
8015 	},
8016 	[ALC269_FIXUP_LENOVO_EAPD] = {
8017 		.type = HDA_FIXUP_VERBS,
8018 		.v.verbs = (const struct hda_verb[]) {
8019 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
8020 			{}
8021 		}
8022 	},
8023 	[ALC275_FIXUP_SONY_HWEQ] = {
8024 		.type = HDA_FIXUP_FUNC,
8025 		.v.func = alc269_fixup_hweq,
8026 		.chained = true,
8027 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
8028 	},
8029 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
8030 		.type = HDA_FIXUP_FUNC,
8031 		.v.func = alc_fixup_disable_aamix,
8032 		.chained = true,
8033 		.chain_id = ALC269_FIXUP_SONY_VAIO
8034 	},
8035 	[ALC271_FIXUP_DMIC] = {
8036 		.type = HDA_FIXUP_FUNC,
8037 		.v.func = alc271_fixup_dmic,
8038 	},
8039 	[ALC269_FIXUP_PCM_44K] = {
8040 		.type = HDA_FIXUP_FUNC,
8041 		.v.func = alc269_fixup_pcm_44k,
8042 		.chained = true,
8043 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
8044 	},
8045 	[ALC269_FIXUP_STEREO_DMIC] = {
8046 		.type = HDA_FIXUP_FUNC,
8047 		.v.func = alc269_fixup_stereo_dmic,
8048 	},
8049 	[ALC269_FIXUP_HEADSET_MIC] = {
8050 		.type = HDA_FIXUP_FUNC,
8051 		.v.func = alc269_fixup_headset_mic,
8052 	},
8053 	[ALC269_FIXUP_QUANTA_MUTE] = {
8054 		.type = HDA_FIXUP_FUNC,
8055 		.v.func = alc269_fixup_quanta_mute,
8056 	},
8057 	[ALC269_FIXUP_LIFEBOOK] = {
8058 		.type = HDA_FIXUP_PINS,
8059 		.v.pins = (const struct hda_pintbl[]) {
8060 			{ 0x1a, 0x2101103f }, /* dock line-out */
8061 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
8062 			{ }
8063 		},
8064 		.chained = true,
8065 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
8066 	},
8067 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
8068 		.type = HDA_FIXUP_PINS,
8069 		.v.pins = (const struct hda_pintbl[]) {
8070 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
8071 			{ }
8072 		},
8073 	},
8074 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
8075 		.type = HDA_FIXUP_PINS,
8076 		.v.pins = (const struct hda_pintbl[]) {
8077 			{ 0x21, 0x0221102f }, /* HP out */
8078 			{ }
8079 		},
8080 	},
8081 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
8082 		.type = HDA_FIXUP_FUNC,
8083 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
8084 	},
8085 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
8086 		.type = HDA_FIXUP_FUNC,
8087 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
8088 	},
8089 	[ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13] = {
8090 		.type = HDA_FIXUP_PINS,
8091 		.v.pins = (const struct hda_pintbl[]) {
8092 			{ 0x14, 0x90170151 }, /* use as internal speaker (LFE) */
8093 			{ 0x1b, 0x90170152 }, /* use as internal speaker (back) */
8094 			{ }
8095 		},
8096 		.chained = true,
8097 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8098 	},
8099 	[ALC269VC_FIXUP_INFINIX_Y4_MAX] = {
8100 		.type = HDA_FIXUP_PINS,
8101 		.v.pins = (const struct hda_pintbl[]) {
8102 			{ 0x1b, 0x90170150 }, /* use as internal speaker */
8103 			{ }
8104 		},
8105 		.chained = true,
8106 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8107 	},
8108 	[ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
8109 		.type = HDA_FIXUP_PINS,
8110 		.v.pins = (const struct hda_pintbl[]) {
8111 			{ 0x18, 0x03a19020 }, /* headset mic */
8112 			{ 0x1b, 0x90170150 }, /* speaker */
8113 			{ }
8114 		},
8115 	},
8116 	[ALC269_FIXUP_AMIC] = {
8117 		.type = HDA_FIXUP_PINS,
8118 		.v.pins = (const struct hda_pintbl[]) {
8119 			{ 0x14, 0x99130110 }, /* speaker */
8120 			{ 0x15, 0x0121401f }, /* HP out */
8121 			{ 0x18, 0x01a19c20 }, /* mic */
8122 			{ 0x19, 0x99a3092f }, /* int-mic */
8123 			{ }
8124 		},
8125 	},
8126 	[ALC269_FIXUP_DMIC] = {
8127 		.type = HDA_FIXUP_PINS,
8128 		.v.pins = (const struct hda_pintbl[]) {
8129 			{ 0x12, 0x99a3092f }, /* int-mic */
8130 			{ 0x14, 0x99130110 }, /* speaker */
8131 			{ 0x15, 0x0121401f }, /* HP out */
8132 			{ 0x18, 0x01a19c20 }, /* mic */
8133 			{ }
8134 		},
8135 	},
8136 	[ALC269VB_FIXUP_AMIC] = {
8137 		.type = HDA_FIXUP_PINS,
8138 		.v.pins = (const struct hda_pintbl[]) {
8139 			{ 0x14, 0x99130110 }, /* speaker */
8140 			{ 0x18, 0x01a19c20 }, /* mic */
8141 			{ 0x19, 0x99a3092f }, /* int-mic */
8142 			{ 0x21, 0x0121401f }, /* HP out */
8143 			{ }
8144 		},
8145 	},
8146 	[ALC269VB_FIXUP_DMIC] = {
8147 		.type = HDA_FIXUP_PINS,
8148 		.v.pins = (const struct hda_pintbl[]) {
8149 			{ 0x12, 0x99a3092f }, /* int-mic */
8150 			{ 0x14, 0x99130110 }, /* speaker */
8151 			{ 0x18, 0x01a19c20 }, /* mic */
8152 			{ 0x21, 0x0121401f }, /* HP out */
8153 			{ }
8154 		},
8155 	},
8156 	[ALC269_FIXUP_HP_MUTE_LED] = {
8157 		.type = HDA_FIXUP_FUNC,
8158 		.v.func = alc269_fixup_hp_mute_led,
8159 	},
8160 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
8161 		.type = HDA_FIXUP_FUNC,
8162 		.v.func = alc269_fixup_hp_mute_led_mic1,
8163 	},
8164 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
8165 		.type = HDA_FIXUP_FUNC,
8166 		.v.func = alc269_fixup_hp_mute_led_mic2,
8167 	},
8168 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
8169 		.type = HDA_FIXUP_FUNC,
8170 		.v.func = alc269_fixup_hp_mute_led_mic3,
8171 		.chained = true,
8172 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
8173 	},
8174 	[ALC269_FIXUP_HP_GPIO_LED] = {
8175 		.type = HDA_FIXUP_FUNC,
8176 		.v.func = alc269_fixup_hp_gpio_led,
8177 	},
8178 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
8179 		.type = HDA_FIXUP_FUNC,
8180 		.v.func = alc269_fixup_hp_gpio_mic1_led,
8181 	},
8182 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
8183 		.type = HDA_FIXUP_FUNC,
8184 		.v.func = alc269_fixup_hp_line1_mic1_led,
8185 	},
8186 	[ALC269_FIXUP_INV_DMIC] = {
8187 		.type = HDA_FIXUP_FUNC,
8188 		.v.func = alc_fixup_inv_dmic,
8189 	},
8190 	[ALC269_FIXUP_NO_SHUTUP] = {
8191 		.type = HDA_FIXUP_FUNC,
8192 		.v.func = alc_fixup_no_shutup,
8193 	},
8194 	[ALC269_FIXUP_LENOVO_DOCK] = {
8195 		.type = HDA_FIXUP_PINS,
8196 		.v.pins = (const struct hda_pintbl[]) {
8197 			{ 0x19, 0x23a11040 }, /* dock mic */
8198 			{ 0x1b, 0x2121103f }, /* dock headphone */
8199 			{ }
8200 		},
8201 		.chained = true,
8202 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
8203 	},
8204 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
8205 		.type = HDA_FIXUP_FUNC,
8206 		.v.func = alc269_fixup_limit_int_mic_boost,
8207 		.chained = true,
8208 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
8209 	},
8210 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
8211 		.type = HDA_FIXUP_FUNC,
8212 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
8213 		.chained = true,
8214 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8215 	},
8216 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8217 		.type = HDA_FIXUP_PINS,
8218 		.v.pins = (const struct hda_pintbl[]) {
8219 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8220 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8221 			{ }
8222 		},
8223 		.chained = true,
8224 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8225 	},
8226 	[ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8227 		.type = HDA_FIXUP_FUNC,
8228 		.v.func = alc269_fixup_limit_int_mic_boost,
8229 		.chained = true,
8230 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8231 	},
8232 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8233 		.type = HDA_FIXUP_PINS,
8234 		.v.pins = (const struct hda_pintbl[]) {
8235 			{ 0x16, 0x21014020 }, /* dock line out */
8236 			{ 0x19, 0x21a19030 }, /* dock mic */
8237 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8238 			{ }
8239 		},
8240 		.chained = true,
8241 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8242 	},
8243 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
8244 		.type = HDA_FIXUP_PINS,
8245 		.v.pins = (const struct hda_pintbl[]) {
8246 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8247 			{ }
8248 		},
8249 		.chained = true,
8250 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8251 	},
8252 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
8253 		.type = HDA_FIXUP_PINS,
8254 		.v.pins = (const struct hda_pintbl[]) {
8255 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8256 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8257 			{ }
8258 		},
8259 		.chained = true,
8260 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8261 	},
8262 	[ALC269_FIXUP_HEADSET_MODE] = {
8263 		.type = HDA_FIXUP_FUNC,
8264 		.v.func = alc_fixup_headset_mode,
8265 		.chained = true,
8266 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8267 	},
8268 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8269 		.type = HDA_FIXUP_FUNC,
8270 		.v.func = alc_fixup_headset_mode_no_hp_mic,
8271 	},
8272 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
8273 		.type = HDA_FIXUP_PINS,
8274 		.v.pins = (const struct hda_pintbl[]) {
8275 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
8276 			{ }
8277 		},
8278 		.chained = true,
8279 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8280 	},
8281 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
8282 		.type = HDA_FIXUP_PINS,
8283 		.v.pins = (const struct hda_pintbl[]) {
8284 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8285 			{ }
8286 		},
8287 		.chained = true,
8288 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8289 	},
8290 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8291 		.type = HDA_FIXUP_PINS,
8292 		.v.pins = (const struct hda_pintbl[]) {
8293 			{0x12, 0x90a60130},
8294 			{0x13, 0x40000000},
8295 			{0x14, 0x90170110},
8296 			{0x18, 0x411111f0},
8297 			{0x19, 0x04a11040},
8298 			{0x1a, 0x411111f0},
8299 			{0x1b, 0x90170112},
8300 			{0x1d, 0x40759a05},
8301 			{0x1e, 0x411111f0},
8302 			{0x21, 0x04211020},
8303 			{ }
8304 		},
8305 		.chained = true,
8306 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8307 	},
8308 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
8309 		.type = HDA_FIXUP_FUNC,
8310 		.v.func = alc298_fixup_huawei_mbx_stereo,
8311 		.chained = true,
8312 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8313 	},
8314 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
8315 		.type = HDA_FIXUP_FUNC,
8316 		.v.func = alc269_fixup_x101_headset_mic,
8317 	},
8318 	[ALC269_FIXUP_ASUS_X101_VERB] = {
8319 		.type = HDA_FIXUP_VERBS,
8320 		.v.verbs = (const struct hda_verb[]) {
8321 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
8322 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8323 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
8324 			{ }
8325 		},
8326 		.chained = true,
8327 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
8328 	},
8329 	[ALC269_FIXUP_ASUS_X101] = {
8330 		.type = HDA_FIXUP_PINS,
8331 		.v.pins = (const struct hda_pintbl[]) {
8332 			{ 0x18, 0x04a1182c }, /* Headset mic */
8333 			{ }
8334 		},
8335 		.chained = true,
8336 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
8337 	},
8338 	[ALC271_FIXUP_AMIC_MIC2] = {
8339 		.type = HDA_FIXUP_PINS,
8340 		.v.pins = (const struct hda_pintbl[]) {
8341 			{ 0x14, 0x99130110 }, /* speaker */
8342 			{ 0x19, 0x01a19c20 }, /* mic */
8343 			{ 0x1b, 0x99a7012f }, /* int-mic */
8344 			{ 0x21, 0x0121401f }, /* HP out */
8345 			{ }
8346 		},
8347 	},
8348 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
8349 		.type = HDA_FIXUP_FUNC,
8350 		.v.func = alc271_hp_gate_mic_jack,
8351 		.chained = true,
8352 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
8353 	},
8354 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
8355 		.type = HDA_FIXUP_FUNC,
8356 		.v.func = alc269_fixup_limit_int_mic_boost,
8357 		.chained = true,
8358 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
8359 	},
8360 	[ALC269_FIXUP_ACER_AC700] = {
8361 		.type = HDA_FIXUP_PINS,
8362 		.v.pins = (const struct hda_pintbl[]) {
8363 			{ 0x12, 0x99a3092f }, /* int-mic */
8364 			{ 0x14, 0x99130110 }, /* speaker */
8365 			{ 0x18, 0x03a11c20 }, /* mic */
8366 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
8367 			{ 0x21, 0x0321101f }, /* HP out */
8368 			{ }
8369 		},
8370 		.chained = true,
8371 		.chain_id = ALC271_FIXUP_DMIC,
8372 	},
8373 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
8374 		.type = HDA_FIXUP_FUNC,
8375 		.v.func = alc269_fixup_limit_int_mic_boost,
8376 		.chained = true,
8377 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8378 	},
8379 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
8380 		.type = HDA_FIXUP_FUNC,
8381 		.v.func = alc269_fixup_limit_int_mic_boost,
8382 		.chained = true,
8383 		.chain_id = ALC269VB_FIXUP_DMIC,
8384 	},
8385 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
8386 		.type = HDA_FIXUP_VERBS,
8387 		.v.verbs = (const struct hda_verb[]) {
8388 			/* class-D output amp +5dB */
8389 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
8390 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
8391 			{}
8392 		},
8393 		.chained = true,
8394 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
8395 	},
8396 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8397 		.type = HDA_FIXUP_PINS,
8398 		.v.pins = (const struct hda_pintbl[]) {
8399 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
8400 			{ }
8401 		},
8402 		.chained = true,
8403 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8404 	},
8405 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
8406 		.type = HDA_FIXUP_FUNC,
8407 		.v.func = alc269_fixup_limit_int_mic_boost,
8408 		.chained = true,
8409 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
8410 	},
8411 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
8412 		.type = HDA_FIXUP_PINS,
8413 		.v.pins = (const struct hda_pintbl[]) {
8414 			{ 0x12, 0x99a3092f }, /* int-mic */
8415 			{ 0x18, 0x03a11d20 }, /* mic */
8416 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
8417 			{ }
8418 		},
8419 	},
8420 	[ALC283_FIXUP_CHROME_BOOK] = {
8421 		.type = HDA_FIXUP_FUNC,
8422 		.v.func = alc283_fixup_chromebook,
8423 	},
8424 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
8425 		.type = HDA_FIXUP_FUNC,
8426 		.v.func = alc283_fixup_sense_combo_jack,
8427 		.chained = true,
8428 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
8429 	},
8430 	[ALC282_FIXUP_ASUS_TX300] = {
8431 		.type = HDA_FIXUP_FUNC,
8432 		.v.func = alc282_fixup_asus_tx300,
8433 	},
8434 	[ALC283_FIXUP_INT_MIC] = {
8435 		.type = HDA_FIXUP_VERBS,
8436 		.v.verbs = (const struct hda_verb[]) {
8437 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
8438 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
8439 			{ }
8440 		},
8441 		.chained = true,
8442 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8443 	},
8444 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
8445 		.type = HDA_FIXUP_PINS,
8446 		.v.pins = (const struct hda_pintbl[]) {
8447 			{ 0x17, 0x90170112 }, /* subwoofer */
8448 			{ }
8449 		},
8450 		.chained = true,
8451 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
8452 	},
8453 	[ALC290_FIXUP_SUBWOOFER] = {
8454 		.type = HDA_FIXUP_PINS,
8455 		.v.pins = (const struct hda_pintbl[]) {
8456 			{ 0x17, 0x90170112 }, /* subwoofer */
8457 			{ }
8458 		},
8459 		.chained = true,
8460 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
8461 	},
8462 	[ALC290_FIXUP_MONO_SPEAKERS] = {
8463 		.type = HDA_FIXUP_FUNC,
8464 		.v.func = alc290_fixup_mono_speakers,
8465 	},
8466 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8467 		.type = HDA_FIXUP_FUNC,
8468 		.v.func = alc290_fixup_mono_speakers,
8469 		.chained = true,
8470 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8471 	},
8472 	[ALC269_FIXUP_THINKPAD_ACPI] = {
8473 		.type = HDA_FIXUP_FUNC,
8474 		.v.func = alc_fixup_thinkpad_acpi,
8475 		.chained = true,
8476 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
8477 	},
8478 	[ALC269_FIXUP_LENOVO_XPAD_ACPI] = {
8479 		.type = HDA_FIXUP_FUNC,
8480 		.v.func = alc_fixup_ideapad_acpi,
8481 		.chained = true,
8482 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8483 	},
8484 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8485 		.type = HDA_FIXUP_FUNC,
8486 		.v.func = alc_fixup_inv_dmic,
8487 		.chained = true,
8488 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8489 	},
8490 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8491 		.type = HDA_FIXUP_PINS,
8492 		.v.pins = (const struct hda_pintbl[]) {
8493 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8494 			{ }
8495 		},
8496 		.chained = true,
8497 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8498 	},
8499 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8500 		.type = HDA_FIXUP_PINS,
8501 		.v.pins = (const struct hda_pintbl[]) {
8502 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8503 			{ }
8504 		},
8505 		.chained = true,
8506 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8507 	},
8508 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8509 		.type = HDA_FIXUP_PINS,
8510 		.v.pins = (const struct hda_pintbl[]) {
8511 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8512 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8513 			{ }
8514 		},
8515 		.chained = true,
8516 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8517 	},
8518 	[ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8519 		.type = HDA_FIXUP_FUNC,
8520 		.v.func = alc269_fixup_limit_int_mic_boost,
8521 		.chained = true,
8522 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8523 	},
8524 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8525 		.type = HDA_FIXUP_PINS,
8526 		.v.pins = (const struct hda_pintbl[]) {
8527 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8528 			{ }
8529 		},
8530 		.chained = true,
8531 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8532 	},
8533 	[ALC255_FIXUP_HEADSET_MODE] = {
8534 		.type = HDA_FIXUP_FUNC,
8535 		.v.func = alc_fixup_headset_mode_alc255,
8536 		.chained = true,
8537 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8538 	},
8539 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8540 		.type = HDA_FIXUP_FUNC,
8541 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8542 	},
8543 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8544 		.type = HDA_FIXUP_PINS,
8545 		.v.pins = (const struct hda_pintbl[]) {
8546 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8547 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8548 			{ }
8549 		},
8550 		.chained = true,
8551 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8552 	},
8553 	[ALC292_FIXUP_TPT440_DOCK] = {
8554 		.type = HDA_FIXUP_FUNC,
8555 		.v.func = alc_fixup_tpt440_dock,
8556 		.chained = true,
8557 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8558 	},
8559 	[ALC292_FIXUP_TPT440] = {
8560 		.type = HDA_FIXUP_FUNC,
8561 		.v.func = alc_fixup_disable_aamix,
8562 		.chained = true,
8563 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
8564 	},
8565 	[ALC283_FIXUP_HEADSET_MIC] = {
8566 		.type = HDA_FIXUP_PINS,
8567 		.v.pins = (const struct hda_pintbl[]) {
8568 			{ 0x19, 0x04a110f0 },
8569 			{ },
8570 		},
8571 	},
8572 	[ALC255_FIXUP_MIC_MUTE_LED] = {
8573 		.type = HDA_FIXUP_FUNC,
8574 		.v.func = alc_fixup_micmute_led,
8575 	},
8576 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
8577 		.type = HDA_FIXUP_PINS,
8578 		.v.pins = (const struct hda_pintbl[]) {
8579 			{ 0x12, 0x90a60130 },
8580 			{ 0x14, 0x90170110 },
8581 			{ 0x17, 0x40000008 },
8582 			{ 0x18, 0x411111f0 },
8583 			{ 0x19, 0x01a1913c },
8584 			{ 0x1a, 0x411111f0 },
8585 			{ 0x1b, 0x411111f0 },
8586 			{ 0x1d, 0x40f89b2d },
8587 			{ 0x1e, 0x411111f0 },
8588 			{ 0x21, 0x0321101f },
8589 			{ },
8590 		},
8591 	},
8592 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8593 		.type = HDA_FIXUP_FUNC,
8594 		.v.func = alc269vb_fixup_aspire_e1_coef,
8595 	},
8596 	[ALC280_FIXUP_HP_GPIO4] = {
8597 		.type = HDA_FIXUP_FUNC,
8598 		.v.func = alc280_fixup_hp_gpio4,
8599 	},
8600 	[ALC286_FIXUP_HP_GPIO_LED] = {
8601 		.type = HDA_FIXUP_FUNC,
8602 		.v.func = alc286_fixup_hp_gpio_led,
8603 	},
8604 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8605 		.type = HDA_FIXUP_FUNC,
8606 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8607 	},
8608 	[ALC280_FIXUP_HP_DOCK_PINS] = {
8609 		.type = HDA_FIXUP_PINS,
8610 		.v.pins = (const struct hda_pintbl[]) {
8611 			{ 0x1b, 0x21011020 }, /* line-out */
8612 			{ 0x1a, 0x01a1903c }, /* headset mic */
8613 			{ 0x18, 0x2181103f }, /* line-in */
8614 			{ },
8615 		},
8616 		.chained = true,
8617 		.chain_id = ALC280_FIXUP_HP_GPIO4
8618 	},
8619 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8620 		.type = HDA_FIXUP_PINS,
8621 		.v.pins = (const struct hda_pintbl[]) {
8622 			{ 0x1b, 0x21011020 }, /* line-out */
8623 			{ 0x18, 0x2181103f }, /* line-in */
8624 			{ },
8625 		},
8626 		.chained = true,
8627 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8628 	},
8629 	[ALC280_FIXUP_HP_9480M] = {
8630 		.type = HDA_FIXUP_FUNC,
8631 		.v.func = alc280_fixup_hp_9480m,
8632 	},
8633 	[ALC245_FIXUP_HP_X360_AMP] = {
8634 		.type = HDA_FIXUP_FUNC,
8635 		.v.func = alc245_fixup_hp_x360_amp,
8636 		.chained = true,
8637 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
8638 	},
8639 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
8640 		.type = HDA_FIXUP_FUNC,
8641 		.v.func = alc_fixup_headset_mode_dell_alc288,
8642 		.chained = true,
8643 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8644 	},
8645 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8646 		.type = HDA_FIXUP_PINS,
8647 		.v.pins = (const struct hda_pintbl[]) {
8648 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8649 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8650 			{ }
8651 		},
8652 		.chained = true,
8653 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8654 	},
8655 	[ALC288_FIXUP_DISABLE_AAMIX] = {
8656 		.type = HDA_FIXUP_FUNC,
8657 		.v.func = alc_fixup_disable_aamix,
8658 		.chained = true,
8659 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8660 	},
8661 	[ALC288_FIXUP_DELL_XPS_13] = {
8662 		.type = HDA_FIXUP_FUNC,
8663 		.v.func = alc_fixup_dell_xps13,
8664 		.chained = true,
8665 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
8666 	},
8667 	[ALC292_FIXUP_DISABLE_AAMIX] = {
8668 		.type = HDA_FIXUP_FUNC,
8669 		.v.func = alc_fixup_disable_aamix,
8670 		.chained = true,
8671 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8672 	},
8673 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8674 		.type = HDA_FIXUP_FUNC,
8675 		.v.func = alc_fixup_disable_aamix,
8676 		.chained = true,
8677 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8678 	},
8679 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
8680 		.type = HDA_FIXUP_FUNC,
8681 		.v.func = alc_fixup_dell_xps13,
8682 		.chained = true,
8683 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
8684 	},
8685 	[ALC292_FIXUP_DELL_E7X] = {
8686 		.type = HDA_FIXUP_FUNC,
8687 		.v.func = alc_fixup_micmute_led,
8688 		/* micmute fixup must be applied at last */
8689 		.chained_before = true,
8690 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8691 	},
8692 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8693 		.type = HDA_FIXUP_PINS,
8694 		.v.pins = (const struct hda_pintbl[]) {
8695 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8696 			{ }
8697 		},
8698 		.chained_before = true,
8699 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8700 	},
8701 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8702 		.type = HDA_FIXUP_PINS,
8703 		.v.pins = (const struct hda_pintbl[]) {
8704 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8705 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8706 			{ }
8707 		},
8708 		.chained = true,
8709 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8710 	},
8711 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8712 		.type = HDA_FIXUP_PINS,
8713 		.v.pins = (const struct hda_pintbl[]) {
8714 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8715 			{ }
8716 		},
8717 		.chained = true,
8718 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8719 	},
8720 	[ALC275_FIXUP_DELL_XPS] = {
8721 		.type = HDA_FIXUP_VERBS,
8722 		.v.verbs = (const struct hda_verb[]) {
8723 			/* Enables internal speaker */
8724 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8725 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8726 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8727 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8728 			{}
8729 		}
8730 	},
8731 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8732 		.type = HDA_FIXUP_FUNC,
8733 		.v.func = alc_fixup_disable_aamix,
8734 		.chained = true,
8735 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8736 	},
8737 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8738 		.type = HDA_FIXUP_FUNC,
8739 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8740 	},
8741 	[ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED] = {
8742 		.type = HDA_FIXUP_FUNC,
8743 		.v.func = alc233_fixup_lenovo_low_en_micmute_led,
8744 	},
8745 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8746 		.type = HDA_FIXUP_FUNC,
8747 		.v.func = alc_fixup_inv_dmic,
8748 		.chained = true,
8749 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8750 	},
8751 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8752 		.type = HDA_FIXUP_FUNC,
8753 		.v.func = alc269_fixup_limit_int_mic_boost
8754 	},
8755 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
8756 		.type = HDA_FIXUP_FUNC,
8757 		.v.func = alc_fixup_disable_aamix,
8758 		.chained = true,
8759 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8760 	},
8761 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
8762 		.type = HDA_FIXUP_FUNC,
8763 		.v.func = alc_fixup_disable_mic_vref,
8764 		.chained = true,
8765 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8766 	},
8767 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8768 		.type = HDA_FIXUP_VERBS,
8769 		.v.verbs = (const struct hda_verb[]) {
8770 			/* Disable pass-through path for FRONT 14h */
8771 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8772 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8773 			{}
8774 		},
8775 		.chained = true,
8776 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8777 	},
8778 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
8779 		.type = HDA_FIXUP_FUNC,
8780 		.v.func = alc_fixup_disable_aamix,
8781 		.chained = true,
8782 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
8783 	},
8784 	[ALC221_FIXUP_HP_FRONT_MIC] = {
8785 		.type = HDA_FIXUP_PINS,
8786 		.v.pins = (const struct hda_pintbl[]) {
8787 			{ 0x19, 0x02a19020 }, /* Front Mic */
8788 			{ }
8789 		},
8790 	},
8791 	[ALC292_FIXUP_TPT460] = {
8792 		.type = HDA_FIXUP_FUNC,
8793 		.v.func = alc_fixup_tpt440_dock,
8794 		.chained = true,
8795 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8796 	},
8797 	[ALC298_FIXUP_SPK_VOLUME] = {
8798 		.type = HDA_FIXUP_FUNC,
8799 		.v.func = alc298_fixup_speaker_volume,
8800 		.chained = true,
8801 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8802 	},
8803 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8804 		.type = HDA_FIXUP_FUNC,
8805 		.v.func = alc298_fixup_speaker_volume,
8806 	},
8807 	[ALC295_FIXUP_DISABLE_DAC3] = {
8808 		.type = HDA_FIXUP_FUNC,
8809 		.v.func = alc295_fixup_disable_dac3,
8810 	},
8811 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8812 		.type = HDA_FIXUP_FUNC,
8813 		.v.func = alc285_fixup_speaker2_to_dac1,
8814 		.chained = true,
8815 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8816 	},
8817 	[ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8818 		.type = HDA_FIXUP_FUNC,
8819 		.v.func = alc285_fixup_speaker2_to_dac1,
8820 		.chained = true,
8821 		.chain_id = ALC245_FIXUP_CS35L41_SPI_2
8822 	},
8823 	[ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8824 		.type = HDA_FIXUP_PINS,
8825 		.v.pins = (const struct hda_pintbl[]) {
8826 			{ 0x19, 0x03a11050 },
8827 			{ 0x1b, 0x03a11c30 },
8828 			{ }
8829 		},
8830 		.chained = true,
8831 		.chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8832 	},
8833 	[ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8834 		.type = HDA_FIXUP_PINS,
8835 		.v.pins = (const struct hda_pintbl[]) {
8836 			{ 0x14, 0x90170120 },
8837 			{ }
8838 		},
8839 		.chained = true,
8840 		.chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8841 	},
8842 	[ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8843 		.type = HDA_FIXUP_FUNC,
8844 		.v.func = alc285_fixup_speaker2_to_dac1,
8845 		.chained = true,
8846 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2
8847 	},
8848 	[ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8849 		.type = HDA_FIXUP_PINS,
8850 		.v.pins = (const struct hda_pintbl[]) {
8851 			{ 0x19, 0x03a11050 },
8852 			{ 0x1b, 0x03a11c30 },
8853 			{ }
8854 		},
8855 		.chained = true,
8856 		.chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8857 	},
8858 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8859 		.type = HDA_FIXUP_PINS,
8860 		.v.pins = (const struct hda_pintbl[]) {
8861 			{ 0x1b, 0x90170151 },
8862 			{ }
8863 		},
8864 		.chained = true,
8865 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8866 	},
8867 	[ALC269_FIXUP_ATIV_BOOK_8] = {
8868 		.type = HDA_FIXUP_FUNC,
8869 		.v.func = alc_fixup_auto_mute_via_amp,
8870 		.chained = true,
8871 		.chain_id = ALC269_FIXUP_NO_SHUTUP
8872 	},
8873 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8874 		.type = HDA_FIXUP_PINS,
8875 		.v.pins = (const struct hda_pintbl[]) {
8876 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8877 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8878 			{ }
8879 		},
8880 		.chained = true,
8881 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8882 	},
8883 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8884 		.type = HDA_FIXUP_PINS,
8885 		.v.pins = (const struct hda_pintbl[]) {
8886 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8887 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8888 			{ }
8889 		},
8890 		.chained = true,
8891 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8892 	},
8893 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8894 		.type = HDA_FIXUP_FUNC,
8895 		.v.func = alc_fixup_headset_mode,
8896 	},
8897 	[ALC256_FIXUP_ASUS_MIC] = {
8898 		.type = HDA_FIXUP_PINS,
8899 		.v.pins = (const struct hda_pintbl[]) {
8900 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8901 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8902 			{ }
8903 		},
8904 		.chained = true,
8905 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8906 	},
8907 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8908 		.type = HDA_FIXUP_FUNC,
8909 		/* Set up GPIO2 for the speaker amp */
8910 		.v.func = alc_fixup_gpio4,
8911 	},
8912 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8913 		.type = HDA_FIXUP_PINS,
8914 		.v.pins = (const struct hda_pintbl[]) {
8915 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8916 			{ }
8917 		},
8918 		.chained = true,
8919 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8920 	},
8921 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8922 		.type = HDA_FIXUP_VERBS,
8923 		.v.verbs = (const struct hda_verb[]) {
8924 			/* Enables internal speaker */
8925 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8926 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8927 			{}
8928 		},
8929 		.chained = true,
8930 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8931 	},
8932 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8933 		.type = HDA_FIXUP_FUNC,
8934 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8935 		.chained = true,
8936 		.chain_id = ALC269_FIXUP_GPIO2
8937 	},
8938 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
8939 		.type = HDA_FIXUP_VERBS,
8940 		.v.verbs = (const struct hda_verb[]) {
8941 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8942 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8943 			{ }
8944 		},
8945 		.chained = true,
8946 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8947 	},
8948 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8949 		.type = HDA_FIXUP_PINS,
8950 		.v.pins = (const struct hda_pintbl[]) {
8951 			/* Change the mic location from front to right, otherwise there are
8952 			   two front mics with the same name, pulseaudio can't handle them.
8953 			   This is just a temporary workaround, after applying this fixup,
8954 			   there will be one "Front Mic" and one "Mic" in this machine.
8955 			 */
8956 			{ 0x1a, 0x04a19040 },
8957 			{ }
8958 		},
8959 	},
8960 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8961 		.type = HDA_FIXUP_PINS,
8962 		.v.pins = (const struct hda_pintbl[]) {
8963 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
8964 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8965 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8966 			{ 0x1b, 0x02011020 },
8967 			{ }
8968 		},
8969 		.chained = true,
8970 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
8971 	},
8972 	[ALC225_FIXUP_S3_POP_NOISE] = {
8973 		.type = HDA_FIXUP_FUNC,
8974 		.v.func = alc225_fixup_s3_pop_noise,
8975 		.chained = true,
8976 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8977 	},
8978 	[ALC700_FIXUP_INTEL_REFERENCE] = {
8979 		.type = HDA_FIXUP_VERBS,
8980 		.v.verbs = (const struct hda_verb[]) {
8981 			/* Enables internal speaker */
8982 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8983 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8984 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8985 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8986 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8987 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8988 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8989 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8990 			{}
8991 		}
8992 	},
8993 	[ALC274_FIXUP_DELL_BIND_DACS] = {
8994 		.type = HDA_FIXUP_FUNC,
8995 		.v.func = alc274_fixup_bind_dacs,
8996 		.chained = true,
8997 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8998 	},
8999 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
9000 		.type = HDA_FIXUP_PINS,
9001 		.v.pins = (const struct hda_pintbl[]) {
9002 			{ 0x1b, 0x0401102f },
9003 			{ }
9004 		},
9005 		.chained = true,
9006 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
9007 	},
9008 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
9009 		.type = HDA_FIXUP_FUNC,
9010 		.v.func = alc_fixup_tpt470_dock,
9011 		.chained = true,
9012 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
9013 	},
9014 	[ALC298_FIXUP_TPT470_DOCK] = {
9015 		.type = HDA_FIXUP_FUNC,
9016 		.v.func = alc_fixup_tpt470_dacs,
9017 		.chained = true,
9018 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
9019 	},
9020 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
9021 		.type = HDA_FIXUP_PINS,
9022 		.v.pins = (const struct hda_pintbl[]) {
9023 			{ 0x14, 0x0201101f },
9024 			{ }
9025 		},
9026 		.chained = true,
9027 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9028 	},
9029 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
9030 		.type = HDA_FIXUP_PINS,
9031 		.v.pins = (const struct hda_pintbl[]) {
9032 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9033 			{ }
9034 		},
9035 		.chained = true,
9036 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9037 	},
9038 	[ALC295_FIXUP_HP_X360] = {
9039 		.type = HDA_FIXUP_FUNC,
9040 		.v.func = alc295_fixup_hp_top_speakers,
9041 		.chained = true,
9042 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
9043 	},
9044 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
9045 		.type = HDA_FIXUP_PINS,
9046 		.v.pins = (const struct hda_pintbl[]) {
9047 			{ 0x19, 0x0181313f},
9048 			{ }
9049 		},
9050 		.chained = true,
9051 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9052 	},
9053 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
9054 		.type = HDA_FIXUP_FUNC,
9055 		.v.func = alc285_fixup_invalidate_dacs,
9056 		.chained = true,
9057 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9058 	},
9059 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
9060 		.type = HDA_FIXUP_FUNC,
9061 		.v.func = alc_fixup_auto_mute_via_amp,
9062 	},
9063 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
9064 		.type = HDA_FIXUP_PINS,
9065 		.v.pins = (const struct hda_pintbl[]) {
9066 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9067 			{ }
9068 		},
9069 		.chained = true,
9070 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9071 	},
9072 	[ALC294_FIXUP_ASUS_MIC] = {
9073 		.type = HDA_FIXUP_PINS,
9074 		.v.pins = (const struct hda_pintbl[]) {
9075 			{ 0x13, 0x90a60160 }, /* use as internal mic */
9076 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
9077 			{ }
9078 		},
9079 		.chained = true,
9080 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9081 	},
9082 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
9083 		.type = HDA_FIXUP_PINS,
9084 		.v.pins = (const struct hda_pintbl[]) {
9085 			{ 0x19, 0x01a1103c }, /* use as headset mic */
9086 			{ }
9087 		},
9088 		.chained = true,
9089 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9090 	},
9091 	[ALC294_FIXUP_ASUS_SPK] = {
9092 		.type = HDA_FIXUP_VERBS,
9093 		.v.verbs = (const struct hda_verb[]) {
9094 			/* Set EAPD high */
9095 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
9096 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
9097 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9098 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
9099 			{ }
9100 		},
9101 		.chained = true,
9102 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9103 	},
9104 	[ALC295_FIXUP_CHROME_BOOK] = {
9105 		.type = HDA_FIXUP_FUNC,
9106 		.v.func = alc295_fixup_chromebook,
9107 		.chained = true,
9108 		.chain_id = ALC225_FIXUP_HEADSET_JACK
9109 	},
9110 	[ALC225_FIXUP_HEADSET_JACK] = {
9111 		.type = HDA_FIXUP_FUNC,
9112 		.v.func = alc_fixup_headset_jack,
9113 	},
9114 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9115 		.type = HDA_FIXUP_PINS,
9116 		.v.pins = (const struct hda_pintbl[]) {
9117 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9118 			{ }
9119 		},
9120 		.chained = true,
9121 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9122 	},
9123 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
9124 		.type = HDA_FIXUP_VERBS,
9125 		.v.verbs = (const struct hda_verb[]) {
9126 			/* Disable PCBEEP-IN passthrough */
9127 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
9128 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
9129 			{ }
9130 		},
9131 		.chained = true,
9132 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
9133 	},
9134 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
9135 		.type = HDA_FIXUP_PINS,
9136 		.v.pins = (const struct hda_pintbl[]) {
9137 			{ 0x19, 0x03a11130 },
9138 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
9139 			{ }
9140 		},
9141 		.chained = true,
9142 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
9143 	},
9144 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
9145 		.type = HDA_FIXUP_PINS,
9146 		.v.pins = (const struct hda_pintbl[]) {
9147 			{ 0x16, 0x01011020 }, /* Rear Line out */
9148 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
9149 			{ }
9150 		},
9151 		.chained = true,
9152 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
9153 	},
9154 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
9155 		.type = HDA_FIXUP_FUNC,
9156 		.v.func = alc_fixup_auto_mute_via_amp,
9157 		.chained = true,
9158 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
9159 	},
9160 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
9161 		.type = HDA_FIXUP_FUNC,
9162 		.v.func = alc_fixup_disable_mic_vref,
9163 		.chained = true,
9164 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9165 	},
9166 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
9167 		.type = HDA_FIXUP_VERBS,
9168 		.v.verbs = (const struct hda_verb[]) {
9169 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
9170 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
9171 			{ }
9172 		},
9173 		.chained = true,
9174 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
9175 	},
9176 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
9177 		.type = HDA_FIXUP_PINS,
9178 		.v.pins = (const struct hda_pintbl[]) {
9179 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9180 			{ }
9181 		},
9182 		.chained = true,
9183 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9184 	},
9185 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9186 		.type = HDA_FIXUP_PINS,
9187 		.v.pins = (const struct hda_pintbl[]) {
9188 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
9189 			{ }
9190 		},
9191 		.chained = true,
9192 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9193 	},
9194 	[ALC255_FIXUP_PREDATOR_SUBWOOFER] = {
9195 		.type = HDA_FIXUP_PINS,
9196 		.v.pins = (const struct hda_pintbl[]) {
9197 			{ 0x17, 0x90170151 }, /* use as internal speaker (LFE) */
9198 			{ 0x1b, 0x90170152 } /* use as internal speaker (back) */
9199 		}
9200 	},
9201 	[ALC299_FIXUP_PREDATOR_SPK] = {
9202 		.type = HDA_FIXUP_PINS,
9203 		.v.pins = (const struct hda_pintbl[]) {
9204 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
9205 			{ }
9206 		}
9207 	},
9208 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
9209 		.type = HDA_FIXUP_PINS,
9210 		.v.pins = (const struct hda_pintbl[]) {
9211 			{ 0x19, 0x04a11040 },
9212 			{ 0x21, 0x04211020 },
9213 			{ }
9214 		},
9215 		.chained = true,
9216 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9217 	},
9218 	[ALC289_FIXUP_DELL_SPK1] = {
9219 		.type = HDA_FIXUP_PINS,
9220 		.v.pins = (const struct hda_pintbl[]) {
9221 			{ 0x14, 0x90170140 },
9222 			{ }
9223 		},
9224 		.chained = true,
9225 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
9226 	},
9227 	[ALC289_FIXUP_DELL_SPK2] = {
9228 		.type = HDA_FIXUP_PINS,
9229 		.v.pins = (const struct hda_pintbl[]) {
9230 			{ 0x17, 0x90170130 }, /* bass spk */
9231 			{ }
9232 		},
9233 		.chained = true,
9234 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
9235 	},
9236 	[ALC289_FIXUP_DUAL_SPK] = {
9237 		.type = HDA_FIXUP_FUNC,
9238 		.v.func = alc285_fixup_speaker2_to_dac1,
9239 		.chained = true,
9240 		.chain_id = ALC289_FIXUP_DELL_SPK2
9241 	},
9242 	[ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
9243 		.type = HDA_FIXUP_FUNC,
9244 		.v.func = alc285_fixup_speaker2_to_dac1,
9245 		.chained = true,
9246 		.chain_id = ALC289_FIXUP_DELL_SPK1
9247 	},
9248 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
9249 		.type = HDA_FIXUP_FUNC,
9250 		.v.func = alc285_fixup_speaker2_to_dac1,
9251 		.chained = true,
9252 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9253 	},
9254 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
9255 		.type = HDA_FIXUP_FUNC,
9256 		/* The GPIO must be pulled to initialize the AMP */
9257 		.v.func = alc_fixup_gpio4,
9258 		.chained = true,
9259 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
9260 	},
9261 	[ALC294_FIXUP_ASUS_ALLY] = {
9262 		.type = HDA_FIXUP_FUNC,
9263 		.v.func = cs35l41_fixup_i2c_two,
9264 		.chained = true,
9265 		.chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
9266 	},
9267 	[ALC294_FIXUP_ASUS_ALLY_PINS] = {
9268 		.type = HDA_FIXUP_PINS,
9269 		.v.pins = (const struct hda_pintbl[]) {
9270 			{ 0x19, 0x03a11050 },
9271 			{ 0x1a, 0x03a11c30 },
9272 			{ 0x21, 0x03211420 },
9273 			{ }
9274 		},
9275 		.chained = true,
9276 		.chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
9277 	},
9278 	[ALC294_FIXUP_ASUS_ALLY_VERBS] = {
9279 		.type = HDA_FIXUP_VERBS,
9280 		.v.verbs = (const struct hda_verb[]) {
9281 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9282 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9283 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
9284 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
9285 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
9286 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
9287 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
9288 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
9289 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
9290 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
9291 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
9292 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
9293 			{ }
9294 		},
9295 		.chained = true,
9296 		.chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
9297 	},
9298 	[ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
9299 		.type = HDA_FIXUP_FUNC,
9300 		.v.func = alc285_fixup_speaker2_to_dac1,
9301 	},
9302 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
9303 		.type = HDA_FIXUP_FUNC,
9304 		.v.func = alc285_fixup_thinkpad_x1_gen7,
9305 		.chained = true,
9306 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9307 	},
9308 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
9309 		.type = HDA_FIXUP_FUNC,
9310 		.v.func = alc_fixup_headset_jack,
9311 		.chained = true,
9312 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
9313 	},
9314 	[ALC294_FIXUP_ASUS_HPE] = {
9315 		.type = HDA_FIXUP_VERBS,
9316 		.v.verbs = (const struct hda_verb[]) {
9317 			/* Set EAPD high */
9318 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9319 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
9320 			{ }
9321 		},
9322 		.chained = true,
9323 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9324 	},
9325 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
9326 		.type = HDA_FIXUP_PINS,
9327 		.v.pins = (const struct hda_pintbl[]) {
9328 			{ 0x19, 0x03a11050 }, /* front HP mic */
9329 			{ 0x1a, 0x01a11830 }, /* rear external mic */
9330 			{ 0x21, 0x03211020 }, /* front HP out */
9331 			{ }
9332 		},
9333 		.chained = true,
9334 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
9335 	},
9336 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
9337 		.type = HDA_FIXUP_VERBS,
9338 		.v.verbs = (const struct hda_verb[]) {
9339 			/* set 0x15 to HP-OUT ctrl */
9340 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9341 			/* unmute the 0x15 amp */
9342 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
9343 			{ }
9344 		},
9345 		.chained = true,
9346 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
9347 	},
9348 	[ALC294_FIXUP_ASUS_GX502_HP] = {
9349 		.type = HDA_FIXUP_FUNC,
9350 		.v.func = alc294_fixup_gx502_hp,
9351 	},
9352 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
9353 		.type = HDA_FIXUP_PINS,
9354 		.v.pins = (const struct hda_pintbl[]) {
9355 			{ 0x19, 0x01a11050 }, /* rear HP mic */
9356 			{ 0x1a, 0x01a11830 }, /* rear external mic */
9357 			{ 0x21, 0x012110f0 }, /* rear HP out */
9358 			{ }
9359 		},
9360 		.chained = true,
9361 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
9362 	},
9363 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
9364 		.type = HDA_FIXUP_VERBS,
9365 		.v.verbs = (const struct hda_verb[]) {
9366 			/* set 0x15 to HP-OUT ctrl */
9367 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9368 			/* unmute the 0x15 amp */
9369 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
9370 			/* set 0x1b to HP-OUT */
9371 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9372 			{ }
9373 		},
9374 		.chained = true,
9375 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
9376 	},
9377 	[ALC294_FIXUP_ASUS_GU502_HP] = {
9378 		.type = HDA_FIXUP_FUNC,
9379 		.v.func = alc294_fixup_gu502_hp,
9380 	},
9381 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
9382 		.type = HDA_FIXUP_PINS,
9383 		.v.pins = (const struct hda_pintbl[]) {
9384 				{ 0x19, 0x03a11050 }, /* front HP mic */
9385 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
9386 				{ 0x21, 0x03211420 }, /* front HP out */
9387 				{ }
9388 		},
9389 	},
9390 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
9391 		.type = HDA_FIXUP_PINS,
9392 		.v.pins = (const struct hda_pintbl[]) {
9393 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
9394 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
9395 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
9396 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
9397 			{ 0x21, 0x03211420 },
9398 			{ }
9399 		},
9400 	},
9401 	[ALC294_FIXUP_ASUS_COEF_1B] = {
9402 		.type = HDA_FIXUP_VERBS,
9403 		.v.verbs = (const struct hda_verb[]) {
9404 			/* Set bit 10 to correct noisy output after reboot from
9405 			 * Windows 10 (due to pop noise reduction?)
9406 			 */
9407 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
9408 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
9409 			{ }
9410 		},
9411 		.chained = true,
9412 		.chain_id = ALC289_FIXUP_ASUS_GA401,
9413 	},
9414 	[ALC285_FIXUP_HP_GPIO_LED] = {
9415 		.type = HDA_FIXUP_FUNC,
9416 		.v.func = alc285_fixup_hp_gpio_led,
9417 	},
9418 	[ALC285_FIXUP_HP_MUTE_LED] = {
9419 		.type = HDA_FIXUP_FUNC,
9420 		.v.func = alc285_fixup_hp_mute_led,
9421 	},
9422 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
9423 		.type = HDA_FIXUP_FUNC,
9424 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
9425 	},
9426 	[ALC285_FIXUP_HP_BEEP_MICMUTE_LED] = {
9427 		.type = HDA_FIXUP_FUNC,
9428 		.v.func = alc285_fixup_hp_beep,
9429 		.chained = true,
9430 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9431 	},
9432 	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
9433 	    .type = HDA_FIXUP_FUNC,
9434 	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
9435 	},
9436 	[ALC236_FIXUP_HP_GPIO_LED] = {
9437 		.type = HDA_FIXUP_FUNC,
9438 		.v.func = alc236_fixup_hp_gpio_led,
9439 	},
9440 	[ALC236_FIXUP_HP_MUTE_LED] = {
9441 		.type = HDA_FIXUP_FUNC,
9442 		.v.func = alc236_fixup_hp_mute_led,
9443 	},
9444 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
9445 		.type = HDA_FIXUP_FUNC,
9446 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
9447 	},
9448 	[ALC236_FIXUP_LENOVO_INV_DMIC] = {
9449 		.type = HDA_FIXUP_FUNC,
9450 		.v.func = alc_fixup_inv_dmic,
9451 		.chained = true,
9452 		.chain_id = ALC283_FIXUP_INT_MIC,
9453 	},
9454 	[ALC295_FIXUP_HP_MUTE_LED_COEFBIT11] = {
9455 		.type = HDA_FIXUP_FUNC,
9456 		.v.func = alc295_fixup_hp_mute_led_coefbit11,
9457 	},
9458 	[ALC298_FIXUP_SAMSUNG_AMP] = {
9459 		.type = HDA_FIXUP_FUNC,
9460 		.v.func = alc298_fixup_samsung_amp,
9461 		.chained = true,
9462 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
9463 	},
9464 	[ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS] = {
9465 		.type = HDA_FIXUP_FUNC,
9466 		.v.func = alc298_fixup_samsung_amp_v2_2_amps
9467 	},
9468 	[ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS] = {
9469 		.type = HDA_FIXUP_FUNC,
9470 		.v.func = alc298_fixup_samsung_amp_v2_4_amps
9471 	},
9472 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9473 		.type = HDA_FIXUP_VERBS,
9474 		.v.verbs = (const struct hda_verb[]) {
9475 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
9476 			{ }
9477 		},
9478 	},
9479 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9480 		.type = HDA_FIXUP_VERBS,
9481 		.v.verbs = (const struct hda_verb[]) {
9482 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
9483 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
9484 			{ }
9485 		},
9486 	},
9487 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9488 		.type = HDA_FIXUP_PINS,
9489 		.v.pins = (const struct hda_pintbl[]) {
9490 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9491 			{ }
9492 		},
9493 		.chained = true,
9494 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9495 	},
9496 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
9497 		.type = HDA_FIXUP_PINS,
9498 		.v.pins = (const struct hda_pintbl[]) {
9499 			{ 0x14, 0x90100120 }, /* use as internal speaker */
9500 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
9501 			{ 0x1a, 0x01011020 }, /* use as line out */
9502 			{ },
9503 		},
9504 		.chained = true,
9505 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9506 	},
9507 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9508 		.type = HDA_FIXUP_PINS,
9509 		.v.pins = (const struct hda_pintbl[]) {
9510 			{ 0x18, 0x02a11030 }, /* use as headset mic */
9511 			{ }
9512 		},
9513 		.chained = true,
9514 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9515 	},
9516 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9517 		.type = HDA_FIXUP_PINS,
9518 		.v.pins = (const struct hda_pintbl[]) {
9519 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9520 			{ }
9521 		},
9522 		.chained = true,
9523 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9524 	},
9525 	[ALC289_FIXUP_ASUS_GA401] = {
9526 		.type = HDA_FIXUP_FUNC,
9527 		.v.func = alc289_fixup_asus_ga401,
9528 		.chained = true,
9529 		.chain_id = ALC289_FIXUP_ASUS_GA502,
9530 	},
9531 	[ALC289_FIXUP_ASUS_GA502] = {
9532 		.type = HDA_FIXUP_PINS,
9533 		.v.pins = (const struct hda_pintbl[]) {
9534 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9535 			{ }
9536 		},
9537 	},
9538 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9539 		.type = HDA_FIXUP_PINS,
9540 		.v.pins = (const struct hda_pintbl[]) {
9541 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9542 			{ }
9543 		},
9544 		.chained = true,
9545 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9546 	},
9547 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9548 		.type = HDA_FIXUP_FUNC,
9549 		.v.func = alc285_fixup_hp_gpio_amp_init,
9550 		.chained = true,
9551 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
9552 	},
9553 	[ALC269_FIXUP_CZC_B20] = {
9554 		.type = HDA_FIXUP_PINS,
9555 		.v.pins = (const struct hda_pintbl[]) {
9556 			{ 0x12, 0x411111f0 },
9557 			{ 0x14, 0x90170110 }, /* speaker */
9558 			{ 0x15, 0x032f1020 }, /* HP out */
9559 			{ 0x17, 0x411111f0 },
9560 			{ 0x18, 0x03ab1040 }, /* mic */
9561 			{ 0x19, 0xb7a7013f },
9562 			{ 0x1a, 0x0181305f },
9563 			{ 0x1b, 0x411111f0 },
9564 			{ 0x1d, 0x411111f0 },
9565 			{ 0x1e, 0x411111f0 },
9566 			{ }
9567 		},
9568 		.chain_id = ALC269_FIXUP_DMIC,
9569 	},
9570 	[ALC269_FIXUP_CZC_TMI] = {
9571 		.type = HDA_FIXUP_PINS,
9572 		.v.pins = (const struct hda_pintbl[]) {
9573 			{ 0x12, 0x4000c000 },
9574 			{ 0x14, 0x90170110 }, /* speaker */
9575 			{ 0x15, 0x0421401f }, /* HP out */
9576 			{ 0x17, 0x411111f0 },
9577 			{ 0x18, 0x04a19020 }, /* mic */
9578 			{ 0x19, 0x411111f0 },
9579 			{ 0x1a, 0x411111f0 },
9580 			{ 0x1b, 0x411111f0 },
9581 			{ 0x1d, 0x40448505 },
9582 			{ 0x1e, 0x411111f0 },
9583 			{ 0x20, 0x8000ffff },
9584 			{ }
9585 		},
9586 		.chain_id = ALC269_FIXUP_DMIC,
9587 	},
9588 	[ALC269_FIXUP_CZC_L101] = {
9589 		.type = HDA_FIXUP_PINS,
9590 		.v.pins = (const struct hda_pintbl[]) {
9591 			{ 0x12, 0x40000000 },
9592 			{ 0x14, 0x01014010 }, /* speaker */
9593 			{ 0x15, 0x411111f0 }, /* HP out */
9594 			{ 0x16, 0x411111f0 },
9595 			{ 0x18, 0x01a19020 }, /* mic */
9596 			{ 0x19, 0x02a19021 },
9597 			{ 0x1a, 0x0181302f },
9598 			{ 0x1b, 0x0221401f },
9599 			{ 0x1c, 0x411111f0 },
9600 			{ 0x1d, 0x4044c601 },
9601 			{ 0x1e, 0x411111f0 },
9602 			{ }
9603 		},
9604 		.chain_id = ALC269_FIXUP_DMIC,
9605 	},
9606 	[ALC269_FIXUP_LEMOTE_A1802] = {
9607 		.type = HDA_FIXUP_PINS,
9608 		.v.pins = (const struct hda_pintbl[]) {
9609 			{ 0x12, 0x40000000 },
9610 			{ 0x14, 0x90170110 }, /* speaker */
9611 			{ 0x17, 0x411111f0 },
9612 			{ 0x18, 0x03a19040 }, /* mic1 */
9613 			{ 0x19, 0x90a70130 }, /* mic2 */
9614 			{ 0x1a, 0x411111f0 },
9615 			{ 0x1b, 0x411111f0 },
9616 			{ 0x1d, 0x40489d2d },
9617 			{ 0x1e, 0x411111f0 },
9618 			{ 0x20, 0x0003ffff },
9619 			{ 0x21, 0x03214020 },
9620 			{ }
9621 		},
9622 		.chain_id = ALC269_FIXUP_DMIC,
9623 	},
9624 	[ALC269_FIXUP_LEMOTE_A190X] = {
9625 		.type = HDA_FIXUP_PINS,
9626 		.v.pins = (const struct hda_pintbl[]) {
9627 			{ 0x14, 0x99130110 }, /* speaker */
9628 			{ 0x15, 0x0121401f }, /* HP out */
9629 			{ 0x18, 0x01a19c20 }, /* rear  mic */
9630 			{ 0x19, 0x99a3092f }, /* front mic */
9631 			{ 0x1b, 0x0201401f }, /* front lineout */
9632 			{ }
9633 		},
9634 		.chain_id = ALC269_FIXUP_DMIC,
9635 	},
9636 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9637 		.type = HDA_FIXUP_PINS,
9638 		.v.pins = (const struct hda_pintbl[]) {
9639 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9640 			{ }
9641 		},
9642 		.chained = true,
9643 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9644 	},
9645 	[ALC256_FIXUP_INTEL_NUC10] = {
9646 		.type = HDA_FIXUP_PINS,
9647 		.v.pins = (const struct hda_pintbl[]) {
9648 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9649 			{ }
9650 		},
9651 		.chained = true,
9652 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9653 	},
9654 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9655 		.type = HDA_FIXUP_VERBS,
9656 		.v.verbs = (const struct hda_verb[]) {
9657 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9658 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9659 			{ }
9660 		},
9661 		.chained = true,
9662 		.chain_id = ALC289_FIXUP_ASUS_GA502
9663 	},
9664 	[ALC274_FIXUP_HP_MIC] = {
9665 		.type = HDA_FIXUP_VERBS,
9666 		.v.verbs = (const struct hda_verb[]) {
9667 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9668 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9669 			{ }
9670 		},
9671 	},
9672 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
9673 		.type = HDA_FIXUP_FUNC,
9674 		.v.func = alc274_fixup_hp_headset_mic,
9675 		.chained = true,
9676 		.chain_id = ALC274_FIXUP_HP_MIC
9677 	},
9678 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
9679 		.type = HDA_FIXUP_FUNC,
9680 		.v.func = alc274_fixup_hp_envy_gpio,
9681 	},
9682 	[ALC274_FIXUP_ASUS_ZEN_AIO_27] = {
9683 		.type = HDA_FIXUP_VERBS,
9684 		.v.verbs = (const struct hda_verb[]) {
9685 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x10 },
9686 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc420 },
9687 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
9688 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
9689 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
9690 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0249 },
9691 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
9692 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x202b },
9693 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x62 },
9694 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa007 },
9695 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
9696 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5060 },
9697 			{}
9698 		},
9699 		.chained = true,
9700 		.chain_id = ALC2XX_FIXUP_HEADSET_MIC,
9701 	},
9702 	[ALC256_FIXUP_ASUS_HPE] = {
9703 		.type = HDA_FIXUP_VERBS,
9704 		.v.verbs = (const struct hda_verb[]) {
9705 			/* Set EAPD high */
9706 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9707 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9708 			{ }
9709 		},
9710 		.chained = true,
9711 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9712 	},
9713 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9714 		.type = HDA_FIXUP_FUNC,
9715 		.v.func = alc_fixup_headset_jack,
9716 		.chained = true,
9717 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9718 	},
9719 	[ALC287_FIXUP_HP_GPIO_LED] = {
9720 		.type = HDA_FIXUP_FUNC,
9721 		.v.func = alc287_fixup_hp_gpio_led,
9722 	},
9723 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
9724 		.type = HDA_FIXUP_FUNC,
9725 		.v.func = alc274_fixup_hp_headset_mic,
9726 	},
9727 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9728 		.type = HDA_FIXUP_FUNC,
9729 		.v.func = alc_fixup_no_int_mic,
9730 		.chained = true,
9731 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9732 	},
9733 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9734 		.type = HDA_FIXUP_PINS,
9735 		.v.pins = (const struct hda_pintbl[]) {
9736 			{ 0x1b, 0x411111f0 },
9737 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9738 			{ },
9739 		},
9740 		.chained = true,
9741 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9742 	},
9743 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9744 		.type = HDA_FIXUP_FUNC,
9745 		.v.func = alc269_fixup_limit_int_mic_boost,
9746 		.chained = true,
9747 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9748 	},
9749 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
9750 		.type = HDA_FIXUP_PINS,
9751 		.v.pins = (const struct hda_pintbl[]) {
9752 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9753 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
9754 			{ }
9755 		},
9756 		.chained = true,
9757 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9758 	},
9759 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9760 		.type = HDA_FIXUP_FUNC,
9761 		.v.func = alc285_fixup_ideapad_s740_coef,
9762 		.chained = true,
9763 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9764 	},
9765 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9766 		.type = HDA_FIXUP_FUNC,
9767 		.v.func = alc269_fixup_limit_int_mic_boost,
9768 		.chained = true,
9769 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9770 	},
9771 	[ALC295_FIXUP_ASUS_DACS] = {
9772 		.type = HDA_FIXUP_FUNC,
9773 		.v.func = alc295_fixup_asus_dacs,
9774 	},
9775 	[ALC295_FIXUP_HP_OMEN] = {
9776 		.type = HDA_FIXUP_PINS,
9777 		.v.pins = (const struct hda_pintbl[]) {
9778 			{ 0x12, 0xb7a60130 },
9779 			{ 0x13, 0x40000000 },
9780 			{ 0x14, 0x411111f0 },
9781 			{ 0x16, 0x411111f0 },
9782 			{ 0x17, 0x90170110 },
9783 			{ 0x18, 0x411111f0 },
9784 			{ 0x19, 0x02a11030 },
9785 			{ 0x1a, 0x411111f0 },
9786 			{ 0x1b, 0x04a19030 },
9787 			{ 0x1d, 0x40600001 },
9788 			{ 0x1e, 0x411111f0 },
9789 			{ 0x21, 0x03211020 },
9790 			{}
9791 		},
9792 		.chained = true,
9793 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9794 	},
9795 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
9796 		.type = HDA_FIXUP_FUNC,
9797 		.v.func = alc285_fixup_hp_spectre_x360,
9798 	},
9799 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9800 		.type = HDA_FIXUP_FUNC,
9801 		.v.func = alc285_fixup_hp_spectre_x360_eb1
9802 	},
9803 	[ALC285_FIXUP_HP_ENVY_X360] = {
9804 		.type = HDA_FIXUP_FUNC,
9805 		.v.func = alc285_fixup_hp_envy_x360,
9806 		.chained = true,
9807 		.chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9808 	},
9809 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9810 		.type = HDA_FIXUP_FUNC,
9811 		.v.func = alc285_fixup_ideapad_s740_coef,
9812 		.chained = true,
9813 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9814 	},
9815 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9816 		.type = HDA_FIXUP_FUNC,
9817 		.v.func = alc_fixup_no_shutup,
9818 		.chained = true,
9819 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
9820 	},
9821 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9822 		.type = HDA_FIXUP_PINS,
9823 		.v.pins = (const struct hda_pintbl[]) {
9824 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9825 			{ }
9826 		},
9827 		.chained = true,
9828 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9829 	},
9830 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9831 		.type = HDA_FIXUP_FUNC,
9832 		.v.func = alc269_fixup_limit_int_mic_boost,
9833 		.chained = true,
9834 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9835 	},
9836 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9837 		.type = HDA_FIXUP_FUNC,
9838 		.v.func = alc285_fixup_ideapad_s740_coef,
9839 		.chained = true,
9840 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9841 	},
9842 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9843 		.type = HDA_FIXUP_FUNC,
9844 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9845 		.chained = true,
9846 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9847 	},
9848 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9849 		.type = HDA_FIXUP_VERBS,
9850 		//.v.verbs = legion_15imhg05_coefs,
9851 		.v.verbs = (const struct hda_verb[]) {
9852 			 // set left speaker Legion 7i.
9853 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9854 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9855 
9856 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9857 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9858 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9859 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9860 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9861 
9862 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9863 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9864 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9865 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9866 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9867 
9868 			 // set right speaker Legion 7i.
9869 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9870 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9871 
9872 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9873 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9874 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9875 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9876 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9877 
9878 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9879 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9880 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9881 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9882 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9883 			 {}
9884 		},
9885 		.chained = true,
9886 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9887 	},
9888 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9889 		.type = HDA_FIXUP_FUNC,
9890 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9891 		.chained = true,
9892 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9893 	},
9894 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9895 		.type = HDA_FIXUP_VERBS,
9896 		.v.verbs = (const struct hda_verb[]) {
9897 			 // set left speaker Yoga 7i.
9898 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9899 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9900 
9901 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9902 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9903 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9904 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9905 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9906 
9907 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9908 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9909 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9910 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9911 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9912 
9913 			 // set right speaker Yoga 7i.
9914 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9915 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9916 
9917 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9918 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9919 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9920 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9921 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9922 
9923 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9924 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9925 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9926 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9927 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9928 			 {}
9929 		},
9930 		.chained = true,
9931 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9932 	},
9933 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
9934 		.type = HDA_FIXUP_FUNC,
9935 		.v.func = alc298_fixup_lenovo_c940_duet7,
9936 	},
9937 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9938 		.type = HDA_FIXUP_VERBS,
9939 		.v.verbs = (const struct hda_verb[]) {
9940 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9941 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9942 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9943 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9944 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9945 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9946 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9947 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9948 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9949 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9950 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9951 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9952 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9953 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9954 			{}
9955 		},
9956 		.chained = true,
9957 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9958 	},
9959 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9960 		.type = HDA_FIXUP_FUNC,
9961 		.v.func = alc256_fixup_set_coef_defaults,
9962 	},
9963 	[ALC245_FIXUP_HP_GPIO_LED] = {
9964 		.type = HDA_FIXUP_FUNC,
9965 		.v.func = alc245_fixup_hp_gpio_led,
9966 	},
9967 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9968 		.type = HDA_FIXUP_PINS,
9969 		.v.pins = (const struct hda_pintbl[]) {
9970 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9971 			{ }
9972 		},
9973 		.chained = true,
9974 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9975 	},
9976 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
9977 		.type = HDA_FIXUP_FUNC,
9978 		.v.func = alc233_fixup_no_audio_jack,
9979 	},
9980 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9981 		.type = HDA_FIXUP_FUNC,
9982 		.v.func = alc256_fixup_mic_no_presence_and_resume,
9983 		.chained = true,
9984 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9985 	},
9986 	[ALC287_FIXUP_LEGION_16ACHG6] = {
9987 		.type = HDA_FIXUP_FUNC,
9988 		.v.func = alc287_fixup_legion_16achg6_speakers,
9989 	},
9990 	[ALC287_FIXUP_CS35L41_I2C_2] = {
9991 		.type = HDA_FIXUP_FUNC,
9992 		.v.func = cs35l41_fixup_i2c_two,
9993 	},
9994 	[ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9995 		.type = HDA_FIXUP_FUNC,
9996 		.v.func = cs35l41_fixup_i2c_two,
9997 		.chained = true,
9998 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9999 	},
10000 	[ALC287_FIXUP_CS35L41_I2C_4] = {
10001 		.type = HDA_FIXUP_FUNC,
10002 		.v.func = cs35l41_fixup_i2c_four,
10003 	},
10004 	[ALC245_FIXUP_CS35L41_SPI_2] = {
10005 		.type = HDA_FIXUP_FUNC,
10006 		.v.func = cs35l41_fixup_spi_two,
10007 	},
10008 	[ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
10009 		.type = HDA_FIXUP_FUNC,
10010 		.v.func = cs35l41_fixup_spi_two,
10011 		.chained = true,
10012 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
10013 	},
10014 	[ALC245_FIXUP_CS35L41_SPI_4] = {
10015 		.type = HDA_FIXUP_FUNC,
10016 		.v.func = cs35l41_fixup_spi_four,
10017 	},
10018 	[ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
10019 		.type = HDA_FIXUP_FUNC,
10020 		.v.func = cs35l41_fixup_spi_four,
10021 		.chained = true,
10022 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
10023 	},
10024 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
10025 		.type = HDA_FIXUP_VERBS,
10026 		.v.verbs = (const struct hda_verb[]) {
10027 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
10028 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
10029 			 { }
10030 		},
10031 		.chained = true,
10032 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
10033 	},
10034 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
10035 		.type = HDA_FIXUP_FUNC,
10036 		.v.func = alc_fixup_dell4_mic_no_presence_quiet,
10037 		.chained = true,
10038 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10039 	},
10040 	[ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
10041 		.type = HDA_FIXUP_PINS,
10042 		.v.pins = (const struct hda_pintbl[]) {
10043 			{ 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
10044 			{ }
10045 		},
10046 		.chained = true,
10047 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
10048 	},
10049 	[ALC287_FIXUP_LEGION_16ITHG6] = {
10050 		.type = HDA_FIXUP_FUNC,
10051 		.v.func = alc287_fixup_legion_16ithg6_speakers,
10052 	},
10053 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
10054 		.type = HDA_FIXUP_VERBS,
10055 		.v.verbs = (const struct hda_verb[]) {
10056 			// enable left speaker
10057 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10058 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
10059 
10060 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10061 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
10062 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10063 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
10064 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10065 
10066 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10067 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
10068 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10069 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
10070 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10071 
10072 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10073 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
10074 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10075 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
10076 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10077 
10078 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10079 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10080 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10081 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10082 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10083 
10084 			// enable right speaker
10085 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10086 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
10087 
10088 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10089 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
10090 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10091 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
10092 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10093 
10094 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10095 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
10096 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10097 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
10098 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10099 
10100 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10101 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
10102 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10103 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
10104 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10105 
10106 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10107 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10108 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10109 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10110 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10111 
10112 			{ },
10113 		},
10114 	},
10115 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
10116 		.type = HDA_FIXUP_FUNC,
10117 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
10118 		.chained = true,
10119 		.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
10120 	},
10121 	[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
10122 		.type = HDA_FIXUP_FUNC,
10123 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
10124 		.chained = true,
10125 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2,
10126 	},
10127 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
10128 		.type = HDA_FIXUP_FUNC,
10129 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
10130 		.chained = true,
10131 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10132 	},
10133 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
10134 		.type = HDA_FIXUP_PINS,
10135 		.v.func = alc1220_fixup_gb_dual_codecs,
10136 		.chained = true,
10137 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10138 	},
10139 	[ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
10140 		.type = HDA_FIXUP_FUNC,
10141 		.v.func = cs35l41_fixup_i2c_two,
10142 		.chained = true,
10143 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10144 	},
10145 	[ALC287_FIXUP_TAS2781_I2C] = {
10146 		.type = HDA_FIXUP_FUNC,
10147 		.v.func = tas2781_fixup_i2c,
10148 		.chained = true,
10149 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10150 	},
10151 	[ALC245_FIXUP_TAS2781_SPI_2] = {
10152 		.type = HDA_FIXUP_FUNC,
10153 		.v.func = tas2781_fixup_spi,
10154 		.chained = true,
10155 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
10156 	},
10157 	[ALC287_FIXUP_YOGA7_14ARB7_I2C] = {
10158 		.type = HDA_FIXUP_FUNC,
10159 		.v.func = yoga7_14arb7_fixup_i2c,
10160 		.chained = true,
10161 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10162 	},
10163 	[ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
10164 		.type = HDA_FIXUP_FUNC,
10165 		.v.func = alc245_fixup_hp_mute_led_coefbit,
10166 	},
10167 	[ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
10168 		.type = HDA_FIXUP_FUNC,
10169 		.v.func = alc245_fixup_hp_mute_led_coefbit,
10170 		.chained = true,
10171 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
10172 	},
10173 	[ALC287_FIXUP_THINKPAD_I2S_SPK] = {
10174 		.type = HDA_FIXUP_FUNC,
10175 		.v.func = alc287_fixup_bind_dacs,
10176 		.chained = true,
10177 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10178 	},
10179 	[ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
10180 		.type = HDA_FIXUP_FUNC,
10181 		.v.func = alc287_fixup_bind_dacs,
10182 		.chained = true,
10183 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
10184 	},
10185 	[ALC2XX_FIXUP_HEADSET_MIC] = {
10186 		.type = HDA_FIXUP_FUNC,
10187 		.v.func = alc_fixup_headset_mic,
10188 	},
10189 	[ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
10190 		.type = HDA_FIXUP_FUNC,
10191 		.v.func = cs35l41_fixup_spi_two,
10192 		.chained = true,
10193 		.chain_id = ALC289_FIXUP_DUAL_SPK
10194 	},
10195 	[ALC294_FIXUP_CS35L41_I2C_2] = {
10196 		.type = HDA_FIXUP_FUNC,
10197 		.v.func = cs35l41_fixup_i2c_two,
10198 	},
10199 	[ALC256_FIXUP_ACER_SFG16_MICMUTE_LED] = {
10200 		.type = HDA_FIXUP_FUNC,
10201 		.v.func = alc256_fixup_acer_sfg16_micmute_led,
10202 	},
10203 	[ALC256_FIXUP_HEADPHONE_AMP_VOL] = {
10204 		.type = HDA_FIXUP_FUNC,
10205 		.v.func = alc256_decrease_headphone_amp_val,
10206 	},
10207 	[ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX] = {
10208 		.type = HDA_FIXUP_FUNC,
10209 		.v.func = alc245_fixup_hp_spectre_x360_eu0xxx,
10210 	},
10211 	[ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX] = {
10212 		.type = HDA_FIXUP_FUNC,
10213 		.v.func = alc245_fixup_hp_spectre_x360_16_aa0xxx,
10214 	},
10215 	[ALC285_FIXUP_ASUS_GA403U] = {
10216 		.type = HDA_FIXUP_FUNC,
10217 		.v.func = alc285_fixup_asus_ga403u,
10218 	},
10219 	[ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC] = {
10220 		.type = HDA_FIXUP_PINS,
10221 		.v.pins = (const struct hda_pintbl[]) {
10222 			{ 0x19, 0x03a11050 },
10223 			{ 0x1b, 0x03a11c30 },
10224 			{ }
10225 		},
10226 		.chained = true,
10227 		.chain_id = ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1
10228 	},
10229 	[ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1] = {
10230 		.type = HDA_FIXUP_FUNC,
10231 		.v.func = alc285_fixup_speaker2_to_dac1,
10232 		.chained = true,
10233 		.chain_id = ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
10234 	},
10235 	[ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC] = {
10236 		.type = HDA_FIXUP_PINS,
10237 		.v.pins = (const struct hda_pintbl[]) {
10238 			{ 0x19, 0x03a11050 },
10239 			{ 0x1b, 0x03a11c30 },
10240 			{ }
10241 		},
10242 	},
10243 	[ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1] = {
10244 		.type = HDA_FIXUP_FUNC,
10245 		.v.func = alc285_fixup_speaker2_to_dac1,
10246 		.chained = true,
10247 		.chain_id = ALC285_FIXUP_ASUS_GA403U,
10248 	},
10249 	[ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318] = {
10250 		.type = HDA_FIXUP_FUNC,
10251 		.v.func = alc287_fixup_lenovo_thinkpad_with_alc1318,
10252 		.chained = true,
10253 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
10254 	},
10255 	[ALC256_FIXUP_CHROME_BOOK] = {
10256 		.type = HDA_FIXUP_FUNC,
10257 		.v.func = alc256_fixup_chromebook,
10258 		.chained = true,
10259 		.chain_id = ALC225_FIXUP_HEADSET_JACK
10260 	},
10261 	[ALC245_FIXUP_CLEVO_NOISY_MIC] = {
10262 		.type = HDA_FIXUP_FUNC,
10263 		.v.func = alc269_fixup_limit_int_mic_boost,
10264 		.chained = true,
10265 		.chain_id = ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
10266 	},
10267 	[ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE] = {
10268 		.type = HDA_FIXUP_PINS,
10269 		.v.pins = (const struct hda_pintbl[]) {
10270 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10271 			{ 0x1b, 0x20a11040 }, /* dock mic */
10272 			{ }
10273 		},
10274 		.chained = true,
10275 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
10276 	},
10277 	[ALC233_FIXUP_MEDION_MTL_SPK] = {
10278 		.type = HDA_FIXUP_PINS,
10279 		.v.pins = (const struct hda_pintbl[]) {
10280 			{ 0x1b, 0x90170110 },
10281 			{ }
10282 		},
10283 	},
10284 	[ALC294_FIXUP_BASS_SPEAKER_15] = {
10285 		.type = HDA_FIXUP_FUNC,
10286 		.v.func = alc294_fixup_bass_speaker_15,
10287 	},
10288 	[ALC283_FIXUP_DELL_HP_RESUME] = {
10289 		.type = HDA_FIXUP_FUNC,
10290 		.v.func = alc283_fixup_dell_hp_resume,
10291 	},
10292 };
10293 
10294 static const struct hda_quirk alc269_fixup_tbl[] = {
10295 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
10296 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
10297 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
10298 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
10299 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10300 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
10301 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
10302 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10303 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10304 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
10305 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10306 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
10307 	SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10308 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
10309 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
10310 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
10311 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
10312 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10313 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10314 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10315 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
10316 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
10317 	SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10318 	SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10319 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
10320 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10321 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
10322 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
10323 	SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10324 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10325 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10326 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10327 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
10328 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10329 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10330 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10331 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
10332 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
10333 	SND_PCI_QUIRK(0x1025, 0x1360, "Acer Aspire A115", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10334 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10335 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10336 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10337 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
10338 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10339 	SND_PCI_QUIRK(0x1025, 0x159c, "Acer Nitro 5 AN515-58", ALC2XX_FIXUP_HEADSET_MIC),
10340 	SND_PCI_QUIRK(0x1025, 0x169a, "Acer Swift SFG16", ALC256_FIXUP_ACER_SFG16_MICMUTE_LED),
10341 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
10342 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
10343 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
10344 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
10345 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
10346 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
10347 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
10348 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
10349 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10350 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10351 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10352 	SND_PCI_QUIRK(0x1028, 0x0604, "Dell Venue 11 Pro 7130", ALC283_FIXUP_DELL_HP_RESUME),
10353 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
10354 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
10355 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
10356 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
10357 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
10358 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10359 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10360 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
10361 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
10362 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
10363 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
10364 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10365 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10366 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10367 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10368 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10369 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10370 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10371 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
10372 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
10373 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
10374 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
10375 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
10376 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
10377 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
10378 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
10379 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10380 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10381 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
10382 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
10383 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
10384 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
10385 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
10386 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10387 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
10388 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
10389 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
10390 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
10391 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
10392 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
10393 	SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
10394 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
10395 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
10396 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
10397 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10398 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10399 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
10400 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
10401 	SND_PCI_QUIRK(0x1028, 0x0b27, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
10402 	SND_PCI_QUIRK(0x1028, 0x0b28, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
10403 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10404 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10405 	SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10406 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10407 	SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10408 	SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10409 	SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10410 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
10411 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
10412 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
10413 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
10414 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
10415 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
10416 	SND_PCI_QUIRK(0x1028, 0x0c28, "Dell Inspiron 16 Plus 7630", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10417 	SND_PCI_QUIRK(0x1028, 0x0c4d, "Dell", ALC287_FIXUP_CS35L41_I2C_4),
10418 	SND_PCI_QUIRK(0x1028, 0x0c94, "Dell Polaris 3 metal", ALC287_FIXUP_TAS2781_I2C),
10419 	SND_PCI_QUIRK(0x1028, 0x0c96, "Dell Polaris 2in1", ALC287_FIXUP_TAS2781_I2C),
10420 	SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10421 	SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10422 	SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10423 	SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10424 	SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10425 	SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10426 	SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10427 	SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10428 	SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10429 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10430 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10431 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
10432 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
10433 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
10434 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10435 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10436 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10437 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10438 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
10439 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10440 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10441 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10442 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10443 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10444 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10445 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10446 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10447 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10448 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10449 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10450 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10451 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10452 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
10453 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
10454 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10455 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10456 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10457 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10458 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10459 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10460 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10461 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10462 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
10463 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10464 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
10465 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10466 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
10467 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10468 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10469 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10470 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10471 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10472 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10473 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10474 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10475 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10476 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10477 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10478 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10479 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10480 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10481 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
10482 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10483 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10484 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10485 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10486 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10487 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10488 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
10489 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10490 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10491 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
10492 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
10493 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
10494 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
10495 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
10496 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10497 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10498 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10499 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10500 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10501 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10502 	SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10503 	SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10504 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
10505 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10506 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
10507 	SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10508 	SND_PCI_QUIRK(0x103c, 0x85c6, "HP Pavilion x360 Convertible 14-dy1xxx", ALC295_FIXUP_HP_MUTE_LED_COEFBIT11),
10509 	SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
10510 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10511 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10512 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10513 	SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10514 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
10515 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10516 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10517 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
10518 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10519 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10520 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
10521 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
10522 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
10523 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10524 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10525 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10526 	SND_PCI_QUIRK(0x103c, 0x8760, "HP EliteBook 8{4,5}5 G7", ALC285_FIXUP_HP_BEEP_MICMUTE_LED),
10527 	SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10528 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
10529 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10530 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
10531 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10532 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
10533 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10534 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10535 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10536 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10537 	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10538 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
10539 	SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10540 	SND_PCI_QUIRK(0x103c, 0x87df, "HP ProBook 430 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10541 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10542 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10543 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10544 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10545 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
10546 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
10547 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10548 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10549 	SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10550 	SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10551 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10552 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10553 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10554 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10555 	SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10556 	SND_PCI_QUIRK(0x103c, 0x881e, "HP Laptop 15s-du3xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10557 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10558 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10559 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10560 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10561 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10562 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10563 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10564 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10565 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10566 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10567 	SND_PCI_QUIRK(0x103c, 0x887c, "HP Laptop 14s-fq1xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10568 	SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10569 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
10570 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
10571 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
10572 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10573 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
10574 	SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
10575 	SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
10576 	SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10577 	SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
10578 	SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10579 	SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10580 	SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10581 	SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10582 	SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10583 	SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10584 	SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10585 	SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
10586 	SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
10587 	SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10588 	SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10589 	SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10590 	SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
10591 	SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10592 	SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
10593 	SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
10594 	SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
10595 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
10596 	SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
10597 	SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
10598 	SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10599 	SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10600 	SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10601 	SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10602 	SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10603 	SND_PCI_QUIRK(0x103c, 0x89e7, "HP Elite x2 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10604 	SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
10605 	SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10606 	SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10607 	SND_PCI_QUIRK(0x103c, 0x8a28, "HP Envy 13", ALC287_FIXUP_CS35L41_I2C_2),
10608 	SND_PCI_QUIRK(0x103c, 0x8a29, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10609 	SND_PCI_QUIRK(0x103c, 0x8a2a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10610 	SND_PCI_QUIRK(0x103c, 0x8a2b, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10611 	SND_PCI_QUIRK(0x103c, 0x8a2c, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10612 	SND_PCI_QUIRK(0x103c, 0x8a2d, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10613 	SND_PCI_QUIRK(0x103c, 0x8a2e, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10614 	SND_PCI_QUIRK(0x103c, 0x8a30, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10615 	SND_PCI_QUIRK(0x103c, 0x8a31, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10616 	SND_PCI_QUIRK(0x103c, 0x8a6e, "HP EDNA 360", ALC287_FIXUP_CS35L41_I2C_4),
10617 	SND_PCI_QUIRK(0x103c, 0x8a74, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10618 	SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10619 	SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
10620 	SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
10621 	SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
10622 	SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
10623 	SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
10624 	SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10625 	SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10626 	SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10627 	SND_PCI_QUIRK(0x103c, 0x8ad8, "HP 800 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10628 	SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10629 	SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10630 	SND_PCI_QUIRK(0x103c, 0x8b3a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10631 	SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
10632 	SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10633 	SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10634 	SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10635 	SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10636 	SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10637 	SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10638 	SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10639 	SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10640 	SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10641 	SND_PCI_QUIRK(0x103c, 0x8b5f, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10642 	SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10643 	SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10644 	SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10645 	SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10646 	SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10647 	SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10648 	SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
10649 	SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10650 	SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10651 	SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
10652 	SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10653 	SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
10654 	SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10655 	SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10656 	SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10657 	SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10658 	SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10659 	SND_PCI_QUIRK(0x103c, 0x8bb3, "HP Slim OMEN", ALC287_FIXUP_CS35L41_I2C_2),
10660 	SND_PCI_QUIRK(0x103c, 0x8bb4, "HP Slim OMEN", ALC287_FIXUP_CS35L41_I2C_2),
10661 	SND_PCI_QUIRK(0x103c, 0x8bdd, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10662 	SND_PCI_QUIRK(0x103c, 0x8bde, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10663 	SND_PCI_QUIRK(0x103c, 0x8bdf, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10664 	SND_PCI_QUIRK(0x103c, 0x8be0, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10665 	SND_PCI_QUIRK(0x103c, 0x8be1, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10666 	SND_PCI_QUIRK(0x103c, 0x8be2, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10667 	SND_PCI_QUIRK(0x103c, 0x8be3, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10668 	SND_PCI_QUIRK(0x103c, 0x8be5, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10669 	SND_PCI_QUIRK(0x103c, 0x8be6, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10670 	SND_PCI_QUIRK(0x103c, 0x8be7, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10671 	SND_PCI_QUIRK(0x103c, 0x8be8, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10672 	SND_PCI_QUIRK(0x103c, 0x8be9, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10673 	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10674 	SND_PCI_QUIRK(0x103c, 0x8c15, "HP Spectre x360 2-in-1 Laptop 14-eu0xxx", ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX),
10675 	SND_PCI_QUIRK(0x103c, 0x8c16, "HP Spectre x360 2-in-1 Laptop 16-aa0xxx", ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX),
10676 	SND_PCI_QUIRK(0x103c, 0x8c17, "HP Spectre 16", ALC287_FIXUP_CS35L41_I2C_2),
10677 	SND_PCI_QUIRK(0x103c, 0x8c21, "HP Pavilion Plus Laptop 14-ey0XXX", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10678 	SND_PCI_QUIRK(0x103c, 0x8c30, "HP Victus 15-fb1xxx", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10679 	SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10680 	SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10681 	SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10682 	SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10683 	SND_PCI_QUIRK(0x103c, 0x8c4d, "HP Omen", ALC287_FIXUP_CS35L41_I2C_2),
10684 	SND_PCI_QUIRK(0x103c, 0x8c4e, "HP Omen", ALC287_FIXUP_CS35L41_I2C_2),
10685 	SND_PCI_QUIRK(0x103c, 0x8c4f, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10686 	SND_PCI_QUIRK(0x103c, 0x8c50, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10687 	SND_PCI_QUIRK(0x103c, 0x8c51, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10688 	SND_PCI_QUIRK(0x103c, 0x8c52, "HP EliteBook 1040 G11", ALC285_FIXUP_HP_GPIO_LED),
10689 	SND_PCI_QUIRK(0x103c, 0x8c53, "HP Elite x360 1040 2-in-1 G11", ALC285_FIXUP_HP_GPIO_LED),
10690 	SND_PCI_QUIRK(0x103c, 0x8c66, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10691 	SND_PCI_QUIRK(0x103c, 0x8c67, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10692 	SND_PCI_QUIRK(0x103c, 0x8c68, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10693 	SND_PCI_QUIRK(0x103c, 0x8c6a, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10694 	SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10695 	SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10696 	SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10697 	SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10698 	SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10699 	SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10700 	SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10701 	SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10702 	SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10703 	SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10704 	SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10705 	SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10706 	SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10707 	SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10708 	SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10709 	SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10710 	SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10711 	SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10712 	SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10713 	SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10714 	SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10715 	SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10716 	SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10717 	SND_PCI_QUIRK(0x103c, 0x8caf, "HP Elite mt645 G8 Mobile Thin Client", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10718 	SND_PCI_QUIRK(0x103c, 0x8cbd, "HP Pavilion Aero Laptop 13-bg0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10719 	SND_PCI_QUIRK(0x103c, 0x8cdd, "HP Spectre", ALC287_FIXUP_CS35L41_I2C_2),
10720 	SND_PCI_QUIRK(0x103c, 0x8cde, "HP Spectre", ALC287_FIXUP_CS35L41_I2C_2),
10721 	SND_PCI_QUIRK(0x103c, 0x8cdf, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10722 	SND_PCI_QUIRK(0x103c, 0x8ce0, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10723 	SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10724 	SND_PCI_QUIRK(0x103c, 0x8d01, "HP ZBook Power 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10725 	SND_PCI_QUIRK(0x103c, 0x8d84, "HP EliteBook X G1i", ALC285_FIXUP_HP_GPIO_LED),
10726 	SND_PCI_QUIRK(0x103c, 0x8d85, "HP EliteBook 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10727 	SND_PCI_QUIRK(0x103c, 0x8d86, "HP Elite X360 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10728 	SND_PCI_QUIRK(0x103c, 0x8d8c, "HP EliteBook 13 G12", ALC285_FIXUP_HP_GPIO_LED),
10729 	SND_PCI_QUIRK(0x103c, 0x8d8d, "HP Elite X360 13 G12", ALC285_FIXUP_HP_GPIO_LED),
10730 	SND_PCI_QUIRK(0x103c, 0x8d8e, "HP EliteBook 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10731 	SND_PCI_QUIRK(0x103c, 0x8d8f, "HP EliteBook 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10732 	SND_PCI_QUIRK(0x103c, 0x8d90, "HP EliteBook 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10733 	SND_PCI_QUIRK(0x103c, 0x8d91, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10734 	SND_PCI_QUIRK(0x103c, 0x8d92, "HP ZBook Firefly 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10735 	SND_PCI_QUIRK(0x103c, 0x8d9b, "HP 17 Turbine OmniBook 7 UMA", ALC287_FIXUP_CS35L41_I2C_2),
10736 	SND_PCI_QUIRK(0x103c, 0x8d9c, "HP 17 Turbine OmniBook 7 DIS", ALC287_FIXUP_CS35L41_I2C_2),
10737 	SND_PCI_QUIRK(0x103c, 0x8d9d, "HP 17 Turbine OmniBook X UMA", ALC287_FIXUP_CS35L41_I2C_2),
10738 	SND_PCI_QUIRK(0x103c, 0x8d9e, "HP 17 Turbine OmniBook X DIS", ALC287_FIXUP_CS35L41_I2C_2),
10739 	SND_PCI_QUIRK(0x103c, 0x8d9f, "HP 14 Cadet (x360)", ALC287_FIXUP_CS35L41_I2C_2),
10740 	SND_PCI_QUIRK(0x103c, 0x8da0, "HP 16 Clipper OmniBook 7(X360)", ALC287_FIXUP_CS35L41_I2C_2),
10741 	SND_PCI_QUIRK(0x103c, 0x8da1, "HP 16 Clipper OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10742 	SND_PCI_QUIRK(0x103c, 0x8da7, "HP 14 Enstrom OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10743 	SND_PCI_QUIRK(0x103c, 0x8da8, "HP 16 Piston OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10744 	SND_PCI_QUIRK(0x103c, 0x8de8, "HP Gemtree", ALC245_FIXUP_TAS2781_SPI_2),
10745 	SND_PCI_QUIRK(0x103c, 0x8de9, "HP Gemtree", ALC245_FIXUP_TAS2781_SPI_2),
10746 	SND_PCI_QUIRK(0x103c, 0x8dec, "HP EliteBook 640 G12", ALC236_FIXUP_HP_GPIO_LED),
10747 	SND_PCI_QUIRK(0x103c, 0x8dee, "HP EliteBook 660 G12", ALC236_FIXUP_HP_GPIO_LED),
10748 	SND_PCI_QUIRK(0x103c, 0x8df0, "HP EliteBook 630 G12", ALC236_FIXUP_HP_GPIO_LED),
10749 	SND_PCI_QUIRK(0x103c, 0x8dfc, "HP EliteBook 645 G12", ALC236_FIXUP_HP_GPIO_LED),
10750 	SND_PCI_QUIRK(0x103c, 0x8dfe, "HP EliteBook 665 G12", ALC236_FIXUP_HP_GPIO_LED),
10751 	SND_PCI_QUIRK(0x103c, 0x8e11, "HP Trekker", ALC287_FIXUP_CS35L41_I2C_2),
10752 	SND_PCI_QUIRK(0x103c, 0x8e12, "HP Trekker", ALC287_FIXUP_CS35L41_I2C_2),
10753 	SND_PCI_QUIRK(0x103c, 0x8e13, "HP Trekker", ALC287_FIXUP_CS35L41_I2C_2),
10754 	SND_PCI_QUIRK(0x103c, 0x8e14, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10755 	SND_PCI_QUIRK(0x103c, 0x8e15, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10756 	SND_PCI_QUIRK(0x103c, 0x8e16, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10757 	SND_PCI_QUIRK(0x103c, 0x8e17, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10758 	SND_PCI_QUIRK(0x103c, 0x8e18, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10759 	SND_PCI_QUIRK(0x103c, 0x8e19, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10760 	SND_PCI_QUIRK(0x103c, 0x8e1a, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10761 	SND_PCI_QUIRK(0x103c, 0x8e1b, "HP EliteBook G12", ALC285_FIXUP_HP_GPIO_LED),
10762 	SND_PCI_QUIRK(0x103c, 0x8e1c, "HP EliteBook G12", ALC285_FIXUP_HP_GPIO_LED),
10763 	SND_PCI_QUIRK(0x103c, 0x8e2c, "HP EliteBook 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10764 	SND_PCI_QUIRK(0x103c, 0x8e36, "HP 14 Enstrom OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10765 	SND_PCI_QUIRK(0x103c, 0x8e37, "HP 16 Piston OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10766 	SND_PCI_QUIRK(0x103c, 0x8e60, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2),
10767 	SND_PCI_QUIRK(0x103c, 0x8e61, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2),
10768 	SND_PCI_QUIRK(0x103c, 0x8e62, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2),
10769 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10770 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10771 	SND_PCI_QUIRK(0x1043, 0x1054, "ASUS G614FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2),
10772 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10773 	SND_PCI_QUIRK(0x1043, 0x106f, "ASUS VivoBook X515UA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10774 	SND_PCI_QUIRK(0x1043, 0x1074, "ASUS G614PH/PM/PP", ALC287_FIXUP_CS35L41_I2C_2),
10775 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10776 	SND_PCI_QUIRK(0x1043, 0x10a4, "ASUS TP3407SA", ALC287_FIXUP_TAS2781_I2C),
10777 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10778 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10779 	SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10780 	SND_PCI_QUIRK(0x1043, 0x1154, "ASUS TP3607SH", ALC287_FIXUP_TAS2781_I2C),
10781 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10782 	SND_PCI_QUIRK(0x1043, 0x1194, "ASUS UM3406KA", ALC287_FIXUP_CS35L41_I2C_2),
10783 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10784 	SND_PCI_QUIRK(0x1043, 0x1204, "ASUS Strix G615JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C),
10785 	SND_PCI_QUIRK(0x1043, 0x1214, "ASUS Strix G615LH_LM_LP", ALC287_FIXUP_TAS2781_I2C),
10786 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10787 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10788 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10789 	SND_PCI_QUIRK(0x1043, 0x1294, "ASUS B3405CVA", ALC245_FIXUP_CS35L41_SPI_2),
10790 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10791 	SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10792 	SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10793 	SND_PCI_QUIRK(0x1043, 0x12b4, "ASUS B3405CCA / P3405CCA", ALC245_FIXUP_CS35L41_SPI_2),
10794 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10795 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10796 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10797 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10798 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10799 	SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVV", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10800 	SND_PCI_QUIRK(0x1043, 0x1460, "Asus VivoBook 15", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10801 	SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X/GA402N", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10802 	SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604VI/VC/VE/VG/VJ/VQ/VU/VV/VY/VZ", ALC285_FIXUP_ASUS_HEADSET_MIC),
10803 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603VQ/VU/VV/VJ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10804 	SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601VV/VU/VJ/VQ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10805 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G614JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10806 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS G513PI/PU/PV", ALC287_FIXUP_CS35L41_I2C_2),
10807 	SND_PCI_QUIRK(0x1043, 0x1503, "ASUS G733PY/PZ/PZV/PYV", ALC287_FIXUP_CS35L41_I2C_2),
10808 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10809 	SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA/XJ/XQ/XU/XV/XI", ALC287_FIXUP_CS35L41_I2C_2),
10810 	SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301VV/VQ/VU/VJ/VA/VC/VE/VVC/VQC/VUC/VJC/VEC/VCC", ALC285_FIXUP_ASUS_HEADSET_MIC),
10811 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10812 	SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZI/ZJ/ZQ/ZU/ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10813 	SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10814 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10815 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10816 	SND_PCI_QUIRK(0x1043, 0x16d3, "ASUS UX5304VA", ALC245_FIXUP_CS35L41_SPI_2),
10817 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10818 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS UX7602VI/BZ", ALC245_FIXUP_CS35L41_SPI_2),
10819 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10820 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10821 	SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally NR2301L/X", ALC294_FIXUP_ASUS_ALLY),
10822 	SND_PCI_QUIRK(0x1043, 0x1863, "ASUS UX6404VI/VV", ALC245_FIXUP_CS35L41_SPI_2),
10823 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10824 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10825 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10826 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10827 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10828 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10829 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10830 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10831 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10832 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10833 	SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10834 	SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10835 	SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10836 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10837 	SND_PCI_QUIRK(0x1043, 0x1b13, "ASUS U41SV/GA403U", ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC),
10838 	SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10839 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10840 	SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10841 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10842 	SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10843 	SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10844 	SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10845 	SND_PCI_QUIRK(0x1043, 0x1c63, "ASUS GU605M", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10846 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10847 	SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JU/JV/JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10848 	SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JY/JZ/JI/JG", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10849 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10850 	SND_PCI_QUIRK(0x1043, 0x1ccf, "ASUS G814JU/JV/JI", ALC245_FIXUP_CS35L41_SPI_2),
10851 	SND_PCI_QUIRK(0x1043, 0x1cdf, "ASUS G814JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10852 	SND_PCI_QUIRK(0x1043, 0x1cef, "ASUS G834JY/JZ/JI/JG", ALC285_FIXUP_ASUS_HEADSET_MIC),
10853 	SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS G713PI/PU/PV/PVN", ALC287_FIXUP_CS35L41_I2C_2),
10854 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10855 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10856 	SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10857 	SND_PCI_QUIRK(0x1043, 0x1df3, "ASUS UM5606WA", ALC294_FIXUP_BASS_SPEAKER_15),
10858 	SND_PCI_QUIRK(0x1043, 0x1264, "ASUS UM5606KA", ALC294_FIXUP_BASS_SPEAKER_15),
10859 	SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10860 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10861 	SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10862 	SND_PCI_QUIRK(0x1043, 0x1e1f, "ASUS Vivobook 15 X1504VAP", ALC2XX_FIXUP_HEADSET_MIC),
10863 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10864 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10865 	SND_PCI_QUIRK(0x1043, 0x1e63, "ASUS H7606W", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10866 	SND_PCI_QUIRK(0x1043, 0x1e83, "ASUS GA605W", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10867 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10868 	SND_PCI_QUIRK(0x1043, 0x1eb3, "ASUS Ally RCLA72", ALC287_FIXUP_TAS2781_I2C),
10869 	SND_PCI_QUIRK(0x1043, 0x1ed3, "ASUS HN7306W", ALC287_FIXUP_CS35L41_I2C_2),
10870 	SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10871 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10872 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10873 	SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10874 	SND_PCI_QUIRK(0x1043, 0x1f1f, "ASUS H7604JI/JV/J3D", ALC245_FIXUP_CS35L41_SPI_2),
10875 	SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10876 	SND_PCI_QUIRK(0x1043, 0x1f63, "ASUS P5405CSA", ALC245_FIXUP_CS35L41_SPI_2),
10877 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10878 	SND_PCI_QUIRK(0x1043, 0x1fb3, "ASUS ROG Flow Z13 GZ302EA", ALC287_FIXUP_CS35L41_I2C_2),
10879 	SND_PCI_QUIRK(0x1043, 0x3011, "ASUS B5605CVA", ALC245_FIXUP_CS35L41_SPI_2),
10880 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10881 	SND_PCI_QUIRK(0x1043, 0x3061, "ASUS B3405CCA", ALC245_FIXUP_CS35L41_SPI_2),
10882 	SND_PCI_QUIRK(0x1043, 0x3071, "ASUS B5405CCA", ALC245_FIXUP_CS35L41_SPI_2),
10883 	SND_PCI_QUIRK(0x1043, 0x30c1, "ASUS B3605CCA / P3605CCA", ALC245_FIXUP_CS35L41_SPI_2),
10884 	SND_PCI_QUIRK(0x1043, 0x30d1, "ASUS B5405CCA", ALC245_FIXUP_CS35L41_SPI_2),
10885 	SND_PCI_QUIRK(0x1043, 0x30e1, "ASUS B5605CCA", ALC245_FIXUP_CS35L41_SPI_2),
10886 	SND_PCI_QUIRK(0x1043, 0x31d0, "ASUS Zen AIO 27 Z272SD_A272SD", ALC274_FIXUP_ASUS_ZEN_AIO_27),
10887 	SND_PCI_QUIRK(0x1043, 0x31e1, "ASUS B5605CCA", ALC245_FIXUP_CS35L41_SPI_2),
10888 	SND_PCI_QUIRK(0x1043, 0x31f1, "ASUS B3605CCA", ALC245_FIXUP_CS35L41_SPI_2),
10889 	SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10890 	SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10891 	SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10892 	SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10893 	SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10894 	SND_PCI_QUIRK(0x1043, 0x3d78, "ASUS GA603KH", ALC287_FIXUP_CS35L41_I2C_2),
10895 	SND_PCI_QUIRK(0x1043, 0x3d88, "ASUS GA603KM", ALC287_FIXUP_CS35L41_I2C_2),
10896 	SND_PCI_QUIRK(0x1043, 0x3e00, "ASUS G814FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2),
10897 	SND_PCI_QUIRK(0x1043, 0x3e20, "ASUS G814PH/PM/PP", ALC287_FIXUP_CS35L41_I2C_2),
10898 	SND_PCI_QUIRK(0x1043, 0x3e30, "ASUS TP3607SA", ALC287_FIXUP_TAS2781_I2C),
10899 	SND_PCI_QUIRK(0x1043, 0x3ee0, "ASUS Strix G815_JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C),
10900 	SND_PCI_QUIRK(0x1043, 0x3ef0, "ASUS Strix G635LR_LW_LX", ALC287_FIXUP_TAS2781_I2C),
10901 	SND_PCI_QUIRK(0x1043, 0x3f00, "ASUS Strix G815LH_LM_LP", ALC287_FIXUP_TAS2781_I2C),
10902 	SND_PCI_QUIRK(0x1043, 0x3f10, "ASUS Strix G835LR_LW_LX", ALC287_FIXUP_TAS2781_I2C),
10903 	SND_PCI_QUIRK(0x1043, 0x3f20, "ASUS Strix G615LR_LW", ALC287_FIXUP_TAS2781_I2C),
10904 	SND_PCI_QUIRK(0x1043, 0x3f30, "ASUS Strix G815LR_LW", ALC287_FIXUP_TAS2781_I2C),
10905 	SND_PCI_QUIRK(0x1043, 0x3fd0, "ASUS B3605CVA", ALC245_FIXUP_CS35L41_SPI_2),
10906 	SND_PCI_QUIRK(0x1043, 0x3ff0, "ASUS B5405CVA", ALC245_FIXUP_CS35L41_SPI_2),
10907 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10908 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10909 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10910 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10911 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10912 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10913 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10914 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10915 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10916 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10917 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10918 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10919 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10920 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10921 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10922 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10923 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10924 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10925 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10926 	SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10927 	SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10928 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10929 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10930 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10931 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10932 	SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10933 	SND_PCI_QUIRK(0x10ec, 0x12f6, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10934 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10935 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10936 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10937 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10938 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10939 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10940 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10941 	SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10942 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10943 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10944 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10945 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10946 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10947 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10948 	SND_PCI_QUIRK(0x144d, 0xca06, "Samsung Galaxy Book3 360 (NP730QFG)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10949 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10950 	SND_PCI_QUIRK(0x144d, 0xc870, "Samsung Galaxy Book2 Pro (NP950XED)", ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS),
10951 	SND_PCI_QUIRK(0x144d, 0xc872, "Samsung Galaxy Book2 Pro (NP950XEE)", ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS),
10952 	SND_PCI_QUIRK(0x144d, 0xc886, "Samsung Galaxy Book3 Pro (NP964XFG)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10953 	SND_PCI_QUIRK(0x144d, 0xc1ca, "Samsung Galaxy Book3 Pro 360 (NP960QFG)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10954 	SND_PCI_QUIRK(0x144d, 0xc1cc, "Samsung Galaxy Book3 Ultra (NT960XFH)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10955 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10956 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10957 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10958 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10959 	SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10960 	SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10961 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10962 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10963 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10964 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10965 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10966 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10967 	SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10968 	SND_PCI_QUIRK(0x1558, 0x28c1, "Clevo V370VND", ALC2XX_FIXUP_HEADSET_MIC),
10969 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10970 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10971 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10972 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10973 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10974 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10975 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10976 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10977 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10978 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10979 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10980 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10981 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10982 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10983 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10984 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10985 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10986 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10987 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10988 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10989 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10990 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10991 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10992 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10993 	SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10994 	SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10995 	SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10996 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10997 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10998 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10999 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11000 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11001 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11002 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11003 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11004 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11005 	SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11006 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11007 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11008 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11009 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11010 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11011 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11012 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11013 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
11014 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
11015 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
11016 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11017 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11018 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11019 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11020 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11021 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
11022 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11023 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11024 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11025 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11026 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11027 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11028 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11029 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11030 	SND_PCI_QUIRK(0x1558, 0xa554, "VAIO VJFH52", ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE),
11031 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11032 	SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11033 	SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11034 	SND_PCI_QUIRK(0x1558, 0xa741, "Clevo V54x_6x_TNE", ALC245_FIXUP_CLEVO_NOISY_MIC),
11035 	SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC245_FIXUP_CLEVO_NOISY_MIC),
11036 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11037 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11038 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11039 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11040 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11041 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11042 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
11043 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
11044 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
11045 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
11046 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
11047 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
11048 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
11049 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
11050 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
11051 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
11052 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
11053 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
11054 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
11055 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
11056 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
11057 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
11058 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
11059 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
11060 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
11061 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11062 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
11063 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
11064 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
11065 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11066 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11067 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
11068 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
11069 	SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
11070 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
11071 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11072 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11073 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
11074 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11075 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11076 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11077 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11078 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
11079 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
11080 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
11081 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
11082 	SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11083 	SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11084 	SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11085 	SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11086 	SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11087 	SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11088 	SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11089 	SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11090 	SND_PCI_QUIRK(0x17aa, 0x231e, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
11091 	SND_PCI_QUIRK(0x17aa, 0x231f, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
11092 	SND_PCI_QUIRK(0x17aa, 0x2326, "Hera2", ALC287_FIXUP_TAS2781_I2C),
11093 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
11094 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
11095 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11096 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11097 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11098 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11099 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11100 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11101 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11102 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11103 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
11104 	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
11105 	SND_PCI_QUIRK(0x17aa, 0x3384, "ThinkCentre M90a PRO", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11106 	SND_PCI_QUIRK(0x17aa, 0x3386, "ThinkCentre M90a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11107 	SND_PCI_QUIRK(0x17aa, 0x3387, "ThinkCentre M70a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11108 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11109 	HDA_CODEC_QUIRK(0x17aa, 0x3802, "DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11110 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8", ALC287_FIXUP_TAS2781_I2C),
11111 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
11112 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
11113 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
11114 	HDA_CODEC_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
11115 	SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11116 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
11117 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
11118 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11119 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
11120 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
11121 	SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
11122 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11123 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11124 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11125 	SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
11126 	SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
11127 	SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
11128 	SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11129 	HDA_CODEC_QUIRK(0x17aa, 0x386e, "Legion Y9000X 2022 IAH7", ALC287_FIXUP_CS35L41_I2C_2),
11130 	SND_PCI_QUIRK(0x17aa, 0x386e, "Yoga Pro 7 14ARP8", ALC285_FIXUP_SPEAKER2_TO_DAC1),
11131 	HDA_CODEC_QUIRK(0x17aa, 0x38a8, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C), /* this must match before PCI SSID 17aa:386f below */
11132 	SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7i 16IAX7", ALC287_FIXUP_CS35L41_I2C_2),
11133 	SND_PCI_QUIRK(0x17aa, 0x3870, "Lenovo Yoga 7 14ARB7", ALC287_FIXUP_YOGA7_14ARB7_I2C),
11134 	SND_PCI_QUIRK(0x17aa, 0x3877, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
11135 	SND_PCI_QUIRK(0x17aa, 0x3878, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
11136 	SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
11137 	SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
11138 	SND_PCI_QUIRK(0x17aa, 0x387f, "Yoga S780-16 pro dual LX", ALC287_FIXUP_TAS2781_I2C),
11139 	SND_PCI_QUIRK(0x17aa, 0x3880, "Yoga S780-16 pro dual YC", ALC287_FIXUP_TAS2781_I2C),
11140 	SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
11141 	SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11142 	SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11143 	SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
11144 	SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11145 	SND_PCI_QUIRK(0x17aa, 0x38a5, "Y580P AMD dual", ALC287_FIXUP_TAS2781_I2C),
11146 	SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
11147 	SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
11148 	SND_PCI_QUIRK(0x17aa, 0x38a9, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11149 	SND_PCI_QUIRK(0x17aa, 0x38ab, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11150 	SND_PCI_QUIRK(0x17aa, 0x38b4, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
11151 	SND_PCI_QUIRK(0x17aa, 0x38b5, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
11152 	SND_PCI_QUIRK(0x17aa, 0x38b6, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
11153 	SND_PCI_QUIRK(0x17aa, 0x38b7, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
11154 	SND_PCI_QUIRK(0x17aa, 0x38b8, "Yoga S780-14.5 proX AMD YC Dual", ALC287_FIXUP_TAS2781_I2C),
11155 	SND_PCI_QUIRK(0x17aa, 0x38b9, "Yoga S780-14.5 proX AMD LX Dual", ALC287_FIXUP_TAS2781_I2C),
11156 	SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
11157 	SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
11158 	SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
11159 	SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
11160 	SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
11161 	SND_PCI_QUIRK(0x17aa, 0x38c7, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
11162 	SND_PCI_QUIRK(0x17aa, 0x38c8, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
11163 	SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11164 	SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
11165 	SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
11166 	SND_PCI_QUIRK(0x17aa, 0x38d3, "Yoga S990-16 Pro IMH YC Dual", ALC287_FIXUP_TAS2781_I2C),
11167 	SND_PCI_QUIRK(0x17aa, 0x38d4, "Yoga S990-16 Pro IMH VECO Dual", ALC287_FIXUP_TAS2781_I2C),
11168 	SND_PCI_QUIRK(0x17aa, 0x38d5, "Yoga S990-16 Pro IMH YC Quad", ALC287_FIXUP_TAS2781_I2C),
11169 	SND_PCI_QUIRK(0x17aa, 0x38d6, "Yoga S990-16 Pro IMH VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11170 	SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
11171 	SND_PCI_QUIRK(0x17aa, 0x38df, "Yoga Y990 Intel YC Dual", ALC287_FIXUP_TAS2781_I2C),
11172 	SND_PCI_QUIRK(0x17aa, 0x38e0, "Yoga Y990 Intel VECO Dual", ALC287_FIXUP_TAS2781_I2C),
11173 	SND_PCI_QUIRK(0x17aa, 0x38f8, "Yoga Book 9i", ALC287_FIXUP_TAS2781_I2C),
11174 	SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11175 	SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11176 	SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11177 	SND_PCI_QUIRK(0x17aa, 0x38fd, "ThinkBook plus Gen5 Hybrid", ALC287_FIXUP_TAS2781_I2C),
11178 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11179 	SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
11180 	SND_PCI_QUIRK(0x17aa, 0x391f, "Yoga S990-16 pro Quad YC Quad", ALC287_FIXUP_TAS2781_I2C),
11181 	SND_PCI_QUIRK(0x17aa, 0x3920, "Yoga S990-16 pro Quad VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11182 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
11183 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11184 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
11185 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11186 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
11187 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
11188 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11189 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
11190 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
11191 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
11192 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
11193 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
11194 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
11195 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
11196 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
11197 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11198 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11199 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11200 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
11201 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11202 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11203 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11204 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
11205 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
11206 	SND_PCI_QUIRK(0x1849, 0x0269, "Positivo Master C6400", ALC269VB_FIXUP_ASUS_ZENBOOK),
11207 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
11208 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
11209 	SND_PCI_QUIRK(0x1854, 0x0440, "LG CQ6", ALC256_FIXUP_HEADPHONE_AMP_VOL),
11210 	SND_PCI_QUIRK(0x1854, 0x0441, "LG CQ6 AIO", ALC256_FIXUP_HEADPHONE_AMP_VOL),
11211 	SND_PCI_QUIRK(0x1854, 0x0488, "LG gram 16 (16Z90R)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11212 	SND_PCI_QUIRK(0x1854, 0x048a, "LG gram 17 (17ZD90R)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11213 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
11214 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
11215 	SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
11216 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
11217 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
11218 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
11219 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
11220 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
11221 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
11222 	SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11223 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
11224 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
11225 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
11226 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
11227 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11228 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11229 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11230 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
11231 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
11232 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
11233 	SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
11234 	SND_PCI_QUIRK(0x1d05, 0x1409, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
11235 	SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
11236 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
11237 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
11238 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
11239 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
11240 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
11241 	SND_PCI_QUIRK(0x1f66, 0x0105, "Ayaneo Portable Game Player", ALC287_FIXUP_CS35L41_I2C_2),
11242 	SND_PCI_QUIRK(0x2014, 0x800a, "Positivo ARN50", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11243 	SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11244 	SND_PCI_QUIRK(0x2782, 0x0228, "Infinix ZERO BOOK 13", ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13),
11245 	SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
11246 	SND_PCI_QUIRK(0x2782, 0x1701, "Infinix Y4 Max", ALC269VC_FIXUP_INFINIX_Y4_MAX),
11247 	SND_PCI_QUIRK(0x2782, 0x1705, "MEDION E15433", ALC269VC_FIXUP_INFINIX_Y4_MAX),
11248 	SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
11249 	SND_PCI_QUIRK(0x2782, 0x4900, "MEDION E15443", ALC233_FIXUP_MEDION_MTL_SPK),
11250 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
11251 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
11252 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
11253 	SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
11254 	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11255 	SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11256 	SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11257 	SND_PCI_QUIRK(0xf111, 0x000c, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11258 
11259 #if 0
11260 	/* Below is a quirk table taken from the old code.
11261 	 * Basically the device should work as is without the fixup table.
11262 	 * If BIOS doesn't give a proper info, enable the corresponding
11263 	 * fixup entry.
11264 	 */
11265 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
11266 		      ALC269_FIXUP_AMIC),
11267 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
11268 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
11269 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
11270 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
11271 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
11272 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
11273 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
11274 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
11275 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
11276 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
11277 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
11278 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
11279 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
11280 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
11281 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
11282 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
11283 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
11284 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
11285 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
11286 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
11287 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
11288 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
11289 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
11290 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
11291 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
11292 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
11293 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
11294 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
11295 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
11296 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
11297 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
11298 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
11299 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
11300 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
11301 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
11302 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
11303 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
11304 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
11305 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
11306 #endif
11307 	{}
11308 };
11309 
11310 static const struct hda_quirk alc269_fixup_vendor_tbl[] = {
11311 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
11312 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
11313 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
11314 	SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo XPAD", ALC269_FIXUP_LENOVO_XPAD_ACPI),
11315 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
11316 	{}
11317 };
11318 
11319 static const struct hda_model_fixup alc269_fixup_models[] = {
11320 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
11321 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
11322 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
11323 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
11324 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
11325 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
11326 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
11327 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
11328 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
11329 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
11330 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11331 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
11332 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
11333 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
11334 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
11335 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
11336 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
11337 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
11338 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
11339 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
11340 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
11341 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
11342 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
11343 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
11344 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
11345 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
11346 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
11347 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
11348 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
11349 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
11350 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
11351 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
11352 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
11353 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
11354 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
11355 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
11356 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
11357 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
11358 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
11359 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
11360 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
11361 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
11362 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
11363 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
11364 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
11365 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
11366 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
11367 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
11368 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
11369 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
11370 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
11371 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
11372 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
11373 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
11374 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
11375 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
11376 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
11377 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
11378 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
11379 	{.id = ALC269_FIXUP_LENOVO_XPAD_ACPI, .name = "lenovo-xpad-led"},
11380 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
11381 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
11382 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
11383 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
11384 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
11385 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
11386 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
11387 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
11388 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
11389 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
11390 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
11391 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11392 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
11393 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
11394 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
11395 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
11396 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
11397 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
11398 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
11399 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
11400 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
11401 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
11402 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
11403 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
11404 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
11405 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
11406 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
11407 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
11408 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
11409 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
11410 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
11411 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
11412 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
11413 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
11414 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
11415 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
11416 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
11417 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
11418 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
11419 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
11420 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
11421 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
11422 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
11423 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
11424 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
11425 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
11426 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
11427 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
11428 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
11429 	{.id = ALC256_FIXUP_CHROME_BOOK, .name = "alc-2024y-chromebook"},
11430 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
11431 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
11432 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
11433 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
11434 	{.id = ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS, .name = "alc298-samsung-amp-v2-2-amps"},
11435 	{.id = ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS, .name = "alc298-samsung-amp-v2-4-amps"},
11436 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
11437 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
11438 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
11439 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
11440 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
11441 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
11442 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
11443 	{.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
11444 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
11445 	{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
11446 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
11447 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
11448 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
11449 	{.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
11450 	{.id = ALC2XX_FIXUP_HEADSET_MIC, .name = "alc2xx-fixup-headset-mic"},
11451 	{}
11452 };
11453 #define ALC225_STANDARD_PINS \
11454 	{0x21, 0x04211020}
11455 
11456 #define ALC256_STANDARD_PINS \
11457 	{0x12, 0x90a60140}, \
11458 	{0x14, 0x90170110}, \
11459 	{0x21, 0x02211020}
11460 
11461 #define ALC282_STANDARD_PINS \
11462 	{0x14, 0x90170110}
11463 
11464 #define ALC290_STANDARD_PINS \
11465 	{0x12, 0x99a30130}
11466 
11467 #define ALC292_STANDARD_PINS \
11468 	{0x14, 0x90170110}, \
11469 	{0x15, 0x0221401f}
11470 
11471 #define ALC295_STANDARD_PINS \
11472 	{0x12, 0xb7a60130}, \
11473 	{0x14, 0x90170110}, \
11474 	{0x21, 0x04211020}
11475 
11476 #define ALC298_STANDARD_PINS \
11477 	{0x12, 0x90a60130}, \
11478 	{0x21, 0x03211020}
11479 
11480 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
11481 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
11482 		{0x14, 0x01014020},
11483 		{0x17, 0x90170110},
11484 		{0x18, 0x02a11030},
11485 		{0x19, 0x0181303F},
11486 		{0x21, 0x0221102f}),
11487 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
11488 		{0x12, 0x90a601c0},
11489 		{0x14, 0x90171120},
11490 		{0x21, 0x02211030}),
11491 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
11492 		{0x14, 0x90170110},
11493 		{0x1b, 0x90a70130},
11494 		{0x21, 0x03211020}),
11495 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
11496 		{0x1a, 0x90a70130},
11497 		{0x1b, 0x90170110},
11498 		{0x21, 0x03211020}),
11499 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11500 		ALC225_STANDARD_PINS,
11501 		{0x12, 0xb7a60130},
11502 		{0x14, 0x901701a0}),
11503 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11504 		ALC225_STANDARD_PINS,
11505 		{0x12, 0xb7a60130},
11506 		{0x14, 0x901701b0}),
11507 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11508 		ALC225_STANDARD_PINS,
11509 		{0x12, 0xb7a60150},
11510 		{0x14, 0x901701a0}),
11511 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11512 		ALC225_STANDARD_PINS,
11513 		{0x12, 0xb7a60150},
11514 		{0x14, 0x901701b0}),
11515 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11516 		ALC225_STANDARD_PINS,
11517 		{0x12, 0xb7a60130},
11518 		{0x1b, 0x90170110}),
11519 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11520 		{0x1b, 0x01111010},
11521 		{0x1e, 0x01451130},
11522 		{0x21, 0x02211020}),
11523 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
11524 		{0x12, 0x90a60140},
11525 		{0x14, 0x90170110},
11526 		{0x19, 0x02a11030},
11527 		{0x21, 0x02211020}),
11528 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11529 		{0x14, 0x90170110},
11530 		{0x19, 0x02a11030},
11531 		{0x1a, 0x02a11040},
11532 		{0x1b, 0x01014020},
11533 		{0x21, 0x0221101f}),
11534 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11535 		{0x14, 0x90170110},
11536 		{0x19, 0x02a11030},
11537 		{0x1a, 0x02a11040},
11538 		{0x1b, 0x01011020},
11539 		{0x21, 0x0221101f}),
11540 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11541 		{0x14, 0x90170110},
11542 		{0x19, 0x02a11020},
11543 		{0x1a, 0x02a11030},
11544 		{0x21, 0x0221101f}),
11545 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
11546 		{0x21, 0x02211010}),
11547 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
11548 		{0x14, 0x90170110},
11549 		{0x19, 0x02a11020},
11550 		{0x21, 0x02211030}),
11551 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
11552 		{0x14, 0x90170110},
11553 		{0x21, 0x02211020}),
11554 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11555 		{0x14, 0x90170130},
11556 		{0x21, 0x02211040}),
11557 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11558 		{0x12, 0x90a60140},
11559 		{0x14, 0x90170110},
11560 		{0x21, 0x02211020}),
11561 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11562 		{0x12, 0x90a60160},
11563 		{0x14, 0x90170120},
11564 		{0x21, 0x02211030}),
11565 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11566 		{0x14, 0x90170110},
11567 		{0x1b, 0x02011020},
11568 		{0x21, 0x0221101f}),
11569 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11570 		{0x14, 0x90170110},
11571 		{0x1b, 0x01011020},
11572 		{0x21, 0x0221101f}),
11573 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11574 		{0x14, 0x90170130},
11575 		{0x1b, 0x01014020},
11576 		{0x21, 0x0221103f}),
11577 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11578 		{0x14, 0x90170130},
11579 		{0x1b, 0x01011020},
11580 		{0x21, 0x0221103f}),
11581 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11582 		{0x14, 0x90170130},
11583 		{0x1b, 0x02011020},
11584 		{0x21, 0x0221103f}),
11585 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11586 		{0x14, 0x90170150},
11587 		{0x1b, 0x02011020},
11588 		{0x21, 0x0221105f}),
11589 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11590 		{0x14, 0x90170110},
11591 		{0x1b, 0x01014020},
11592 		{0x21, 0x0221101f}),
11593 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11594 		{0x12, 0x90a60160},
11595 		{0x14, 0x90170120},
11596 		{0x17, 0x90170140},
11597 		{0x21, 0x0321102f}),
11598 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11599 		{0x12, 0x90a60160},
11600 		{0x14, 0x90170130},
11601 		{0x21, 0x02211040}),
11602 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11603 		{0x12, 0x90a60160},
11604 		{0x14, 0x90170140},
11605 		{0x21, 0x02211050}),
11606 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11607 		{0x12, 0x90a60170},
11608 		{0x14, 0x90170120},
11609 		{0x21, 0x02211030}),
11610 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11611 		{0x12, 0x90a60170},
11612 		{0x14, 0x90170130},
11613 		{0x21, 0x02211040}),
11614 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11615 		{0x12, 0x90a60170},
11616 		{0x14, 0x90171130},
11617 		{0x21, 0x02211040}),
11618 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11619 		{0x12, 0x90a60170},
11620 		{0x14, 0x90170140},
11621 		{0x21, 0x02211050}),
11622 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11623 		{0x12, 0x90a60180},
11624 		{0x14, 0x90170130},
11625 		{0x21, 0x02211040}),
11626 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11627 		{0x12, 0x90a60180},
11628 		{0x14, 0x90170120},
11629 		{0x21, 0x02211030}),
11630 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11631 		{0x1b, 0x01011020},
11632 		{0x21, 0x02211010}),
11633 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
11634 		{0x14, 0x90170110},
11635 		{0x1b, 0x90a70130},
11636 		{0x21, 0x04211020}),
11637 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
11638 		{0x14, 0x90170110},
11639 		{0x1b, 0x90a70130},
11640 		{0x21, 0x03211020}),
11641 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11642 		{0x12, 0x90a60130},
11643 		{0x14, 0x90170110},
11644 		{0x21, 0x03211020}),
11645 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11646 		{0x12, 0x90a60130},
11647 		{0x14, 0x90170110},
11648 		{0x21, 0x04211020}),
11649 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11650 		{0x1a, 0x90a70130},
11651 		{0x1b, 0x90170110},
11652 		{0x21, 0x03211020}),
11653        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
11654 		{0x14, 0x90170110},
11655 		{0x19, 0x02a11020},
11656 		{0x21, 0x0221101f}),
11657        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
11658 		{0x17, 0x90170110},
11659 		{0x19, 0x03a11030},
11660 		{0x21, 0x03211020}),
11661 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
11662 		{0x12, 0x90a60130},
11663 		{0x14, 0x90170110},
11664 		{0x15, 0x0421101f},
11665 		{0x1a, 0x04a11020}),
11666 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
11667 		{0x12, 0x90a60140},
11668 		{0x14, 0x90170110},
11669 		{0x15, 0x0421101f},
11670 		{0x18, 0x02811030},
11671 		{0x1a, 0x04a1103f},
11672 		{0x1b, 0x02011020}),
11673 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11674 		ALC282_STANDARD_PINS,
11675 		{0x12, 0x99a30130},
11676 		{0x19, 0x03a11020},
11677 		{0x21, 0x0321101f}),
11678 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11679 		ALC282_STANDARD_PINS,
11680 		{0x12, 0x99a30130},
11681 		{0x19, 0x03a11020},
11682 		{0x21, 0x03211040}),
11683 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11684 		ALC282_STANDARD_PINS,
11685 		{0x12, 0x99a30130},
11686 		{0x19, 0x03a11030},
11687 		{0x21, 0x03211020}),
11688 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11689 		ALC282_STANDARD_PINS,
11690 		{0x12, 0x99a30130},
11691 		{0x19, 0x04a11020},
11692 		{0x21, 0x0421101f}),
11693 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
11694 		ALC282_STANDARD_PINS,
11695 		{0x12, 0x90a60140},
11696 		{0x19, 0x04a11030},
11697 		{0x21, 0x04211020}),
11698 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11699 		ALC282_STANDARD_PINS,
11700 		{0x12, 0x90a609c0},
11701 		{0x18, 0x03a11830},
11702 		{0x19, 0x04a19831},
11703 		{0x1a, 0x0481303f},
11704 		{0x1b, 0x04211020},
11705 		{0x21, 0x0321101f}),
11706 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11707 		ALC282_STANDARD_PINS,
11708 		{0x12, 0x90a60940},
11709 		{0x18, 0x03a11830},
11710 		{0x19, 0x04a19831},
11711 		{0x1a, 0x0481303f},
11712 		{0x1b, 0x04211020},
11713 		{0x21, 0x0321101f}),
11714 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11715 		ALC282_STANDARD_PINS,
11716 		{0x12, 0x90a60130},
11717 		{0x21, 0x0321101f}),
11718 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11719 		{0x12, 0x90a60160},
11720 		{0x14, 0x90170120},
11721 		{0x21, 0x02211030}),
11722 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11723 		ALC282_STANDARD_PINS,
11724 		{0x12, 0x90a60130},
11725 		{0x19, 0x03a11020},
11726 		{0x21, 0x0321101f}),
11727 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11728 		{0x12, 0x90a60130},
11729 		{0x14, 0x90170110},
11730 		{0x19, 0x04a11040},
11731 		{0x21, 0x04211020}),
11732 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11733 		{0x14, 0x90170110},
11734 		{0x19, 0x04a11040},
11735 		{0x1d, 0x40600001},
11736 		{0x21, 0x04211020}),
11737 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
11738 		{0x14, 0x90170110},
11739 		{0x19, 0x04a11040},
11740 		{0x21, 0x04211020}),
11741 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
11742 		{0x14, 0x90170110},
11743 		{0x17, 0x90170111},
11744 		{0x19, 0x03a11030},
11745 		{0x21, 0x03211020}),
11746 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11747 		{0x17, 0x90170110},
11748 		{0x19, 0x03a11030},
11749 		{0x21, 0x03211020}),
11750 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11751 		{0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
11752 		{0x19, 0x04a11040},
11753 		{0x21, 0x04211020}),
11754 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
11755 		{0x12, 0x90a60130},
11756 		{0x17, 0x90170110},
11757 		{0x21, 0x02211020}),
11758 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
11759 		{0x12, 0x90a60120},
11760 		{0x14, 0x90170110},
11761 		{0x21, 0x0321101f}),
11762 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11763 		ALC290_STANDARD_PINS,
11764 		{0x15, 0x04211040},
11765 		{0x18, 0x90170112},
11766 		{0x1a, 0x04a11020}),
11767 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11768 		ALC290_STANDARD_PINS,
11769 		{0x15, 0x04211040},
11770 		{0x18, 0x90170110},
11771 		{0x1a, 0x04a11020}),
11772 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11773 		ALC290_STANDARD_PINS,
11774 		{0x15, 0x0421101f},
11775 		{0x1a, 0x04a11020}),
11776 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11777 		ALC290_STANDARD_PINS,
11778 		{0x15, 0x04211020},
11779 		{0x1a, 0x04a11040}),
11780 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11781 		ALC290_STANDARD_PINS,
11782 		{0x14, 0x90170110},
11783 		{0x15, 0x04211020},
11784 		{0x1a, 0x04a11040}),
11785 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11786 		ALC290_STANDARD_PINS,
11787 		{0x14, 0x90170110},
11788 		{0x15, 0x04211020},
11789 		{0x1a, 0x04a11020}),
11790 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11791 		ALC290_STANDARD_PINS,
11792 		{0x14, 0x90170110},
11793 		{0x15, 0x0421101f},
11794 		{0x1a, 0x04a11020}),
11795 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11796 		ALC292_STANDARD_PINS,
11797 		{0x12, 0x90a60140},
11798 		{0x16, 0x01014020},
11799 		{0x19, 0x01a19030}),
11800 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11801 		ALC292_STANDARD_PINS,
11802 		{0x12, 0x90a60140},
11803 		{0x16, 0x01014020},
11804 		{0x18, 0x02a19031},
11805 		{0x19, 0x01a1903e}),
11806 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
11807 		ALC292_STANDARD_PINS,
11808 		{0x12, 0x90a60140}),
11809 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11810 		ALC292_STANDARD_PINS,
11811 		{0x13, 0x90a60140},
11812 		{0x16, 0x21014020},
11813 		{0x19, 0x21a19030}),
11814 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11815 		ALC292_STANDARD_PINS,
11816 		{0x13, 0x90a60140}),
11817 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
11818 		{0x17, 0x90170110},
11819 		{0x21, 0x04211020}),
11820 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
11821 		{0x14, 0x90170110},
11822 		{0x1b, 0x90a70130},
11823 		{0x21, 0x04211020}),
11824 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11825 		{0x12, 0x90a60130},
11826 		{0x17, 0x90170110},
11827 		{0x21, 0x03211020}),
11828 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11829 		{0x12, 0x90a60130},
11830 		{0x17, 0x90170110},
11831 		{0x21, 0x04211020}),
11832 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11833 		{0x12, 0x90a60130},
11834 		{0x17, 0x90170110},
11835 		{0x21, 0x03211020}),
11836 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11837 		{0x12, 0x90a60120},
11838 		{0x17, 0x90170110},
11839 		{0x21, 0x04211030}),
11840 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11841 		{0x12, 0x90a60130},
11842 		{0x17, 0x90170110},
11843 		{0x21, 0x03211020}),
11844 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11845 		{0x12, 0x90a60130},
11846 		{0x17, 0x90170110},
11847 		{0x21, 0x03211020}),
11848 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11849 		ALC298_STANDARD_PINS,
11850 		{0x17, 0x90170110}),
11851 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11852 		ALC298_STANDARD_PINS,
11853 		{0x17, 0x90170140}),
11854 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11855 		ALC298_STANDARD_PINS,
11856 		{0x17, 0x90170150}),
11857 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11858 		{0x12, 0xb7a60140},
11859 		{0x13, 0xb7a60150},
11860 		{0x17, 0x90170110},
11861 		{0x1a, 0x03011020},
11862 		{0x21, 0x03211030}),
11863 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11864 		{0x12, 0xb7a60140},
11865 		{0x17, 0x90170110},
11866 		{0x1a, 0x03a11030},
11867 		{0x21, 0x03211020}),
11868 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11869 		ALC225_STANDARD_PINS,
11870 		{0x12, 0xb7a60130},
11871 		{0x17, 0x90170110}),
11872 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11873 		{0x14, 0x01014010},
11874 		{0x17, 0x90170120},
11875 		{0x18, 0x02a11030},
11876 		{0x19, 0x02a1103f},
11877 		{0x21, 0x0221101f}),
11878 	{}
11879 };
11880 
11881 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11882  * more machines, don't need to match all valid pins, just need to match
11883  * all the pins defined in the tbl. Just because of this reason, it is possible
11884  * that a single machine matches multiple tbls, so there is one limitation:
11885  *   at most one tbl is allowed to define for the same vendor and same codec
11886  */
11887 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11888 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11889 		{0x19, 0x40000000}),
11890 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11891 		{0x19, 0x40000000},
11892 		{0x1b, 0x40000000}),
11893 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
11894 		{0x19, 0x40000000},
11895 		{0x1b, 0x40000000}),
11896 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11897 		{0x19, 0x40000000},
11898 		{0x1a, 0x40000000}),
11899 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11900 		{0x19, 0x40000000},
11901 		{0x1a, 0x40000000}),
11902 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11903 		{0x19, 0x40000000},
11904 		{0x1a, 0x40000000}),
11905 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11906 		{0x19, 0x40000000}),
11907 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1558, "Clevo", ALC2XX_FIXUP_HEADSET_MIC,
11908 		{0x19, 0x40000000}),
11909 	{}
11910 };
11911 
alc269_fill_coef(struct hda_codec * codec)11912 static void alc269_fill_coef(struct hda_codec *codec)
11913 {
11914 	struct alc_spec *spec = codec->spec;
11915 	int val;
11916 
11917 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11918 		return;
11919 
11920 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11921 		alc_write_coef_idx(codec, 0xf, 0x960b);
11922 		alc_write_coef_idx(codec, 0xe, 0x8817);
11923 	}
11924 
11925 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11926 		alc_write_coef_idx(codec, 0xf, 0x960b);
11927 		alc_write_coef_idx(codec, 0xe, 0x8814);
11928 	}
11929 
11930 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11931 		/* Power up output pin */
11932 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11933 	}
11934 
11935 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11936 		val = alc_read_coef_idx(codec, 0xd);
11937 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11938 			/* Capless ramp up clock control */
11939 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
11940 		}
11941 		val = alc_read_coef_idx(codec, 0x17);
11942 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11943 			/* Class D power on reset */
11944 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
11945 		}
11946 	}
11947 
11948 	/* HP */
11949 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11950 }
11951 
11952 /*
11953  */
patch_alc269(struct hda_codec * codec)11954 static int patch_alc269(struct hda_codec *codec)
11955 {
11956 	struct alc_spec *spec;
11957 	int err;
11958 
11959 	err = alc_alloc_spec(codec, 0x0b);
11960 	if (err < 0)
11961 		return err;
11962 
11963 	spec = codec->spec;
11964 	spec->gen.shared_mic_vref_pin = 0x18;
11965 	codec->power_save_node = 0;
11966 	spec->en_3kpull_low = true;
11967 
11968 	codec->patch_ops.suspend = alc269_suspend;
11969 	codec->patch_ops.resume = alc269_resume;
11970 	spec->shutup = alc_default_shutup;
11971 	spec->init_hook = alc_default_init;
11972 
11973 	switch (codec->core.vendor_id) {
11974 	case 0x10ec0269:
11975 		spec->codec_variant = ALC269_TYPE_ALC269VA;
11976 		switch (alc_get_coef0(codec) & 0x00f0) {
11977 		case 0x0010:
11978 			if (codec->bus->pci &&
11979 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
11980 			    spec->cdefine.platform_type == 1)
11981 				err = alc_codec_rename(codec, "ALC271X");
11982 			spec->codec_variant = ALC269_TYPE_ALC269VB;
11983 			break;
11984 		case 0x0020:
11985 			if (codec->bus->pci &&
11986 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
11987 			    codec->bus->pci->subsystem_device == 0x21f3)
11988 				err = alc_codec_rename(codec, "ALC3202");
11989 			spec->codec_variant = ALC269_TYPE_ALC269VC;
11990 			break;
11991 		case 0x0030:
11992 			spec->codec_variant = ALC269_TYPE_ALC269VD;
11993 			break;
11994 		default:
11995 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
11996 		}
11997 		if (err < 0)
11998 			goto error;
11999 		spec->shutup = alc269_shutup;
12000 		spec->init_hook = alc269_fill_coef;
12001 		alc269_fill_coef(codec);
12002 		break;
12003 
12004 	case 0x10ec0280:
12005 	case 0x10ec0290:
12006 		spec->codec_variant = ALC269_TYPE_ALC280;
12007 		break;
12008 	case 0x10ec0282:
12009 		spec->codec_variant = ALC269_TYPE_ALC282;
12010 		spec->shutup = alc282_shutup;
12011 		spec->init_hook = alc282_init;
12012 		break;
12013 	case 0x10ec0233:
12014 	case 0x10ec0283:
12015 		spec->codec_variant = ALC269_TYPE_ALC283;
12016 		spec->shutup = alc283_shutup;
12017 		spec->init_hook = alc283_init;
12018 		break;
12019 	case 0x10ec0284:
12020 	case 0x10ec0292:
12021 		spec->codec_variant = ALC269_TYPE_ALC284;
12022 		break;
12023 	case 0x10ec0293:
12024 		spec->codec_variant = ALC269_TYPE_ALC293;
12025 		break;
12026 	case 0x10ec0286:
12027 	case 0x10ec0288:
12028 		spec->codec_variant = ALC269_TYPE_ALC286;
12029 		break;
12030 	case 0x10ec0298:
12031 		spec->codec_variant = ALC269_TYPE_ALC298;
12032 		break;
12033 	case 0x10ec0235:
12034 	case 0x10ec0255:
12035 		spec->codec_variant = ALC269_TYPE_ALC255;
12036 		spec->shutup = alc256_shutup;
12037 		spec->init_hook = alc256_init;
12038 		break;
12039 	case 0x10ec0230:
12040 	case 0x10ec0236:
12041 	case 0x10ec0256:
12042 	case 0x19e58326:
12043 		spec->codec_variant = ALC269_TYPE_ALC256;
12044 		spec->shutup = alc256_shutup;
12045 		spec->init_hook = alc256_init;
12046 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
12047 		if (codec->core.vendor_id == 0x10ec0236 &&
12048 		    codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
12049 			spec->en_3kpull_low = false;
12050 		break;
12051 	case 0x10ec0257:
12052 		spec->codec_variant = ALC269_TYPE_ALC257;
12053 		spec->shutup = alc256_shutup;
12054 		spec->init_hook = alc256_init;
12055 		spec->gen.mixer_nid = 0;
12056 		spec->en_3kpull_low = false;
12057 		break;
12058 	case 0x10ec0215:
12059 	case 0x10ec0245:
12060 	case 0x10ec0285:
12061 	case 0x10ec0289:
12062 		if (alc_get_coef0(codec) & 0x0010)
12063 			spec->codec_variant = ALC269_TYPE_ALC245;
12064 		else
12065 			spec->codec_variant = ALC269_TYPE_ALC215;
12066 		spec->shutup = alc225_shutup;
12067 		spec->init_hook = alc225_init;
12068 		spec->gen.mixer_nid = 0;
12069 		break;
12070 	case 0x10ec0225:
12071 	case 0x10ec0295:
12072 	case 0x10ec0299:
12073 		spec->codec_variant = ALC269_TYPE_ALC225;
12074 		spec->shutup = alc225_shutup;
12075 		spec->init_hook = alc225_init;
12076 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
12077 		break;
12078 	case 0x10ec0287:
12079 		spec->codec_variant = ALC269_TYPE_ALC287;
12080 		spec->shutup = alc225_shutup;
12081 		spec->init_hook = alc225_init;
12082 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
12083 		break;
12084 	case 0x10ec0234:
12085 	case 0x10ec0274:
12086 	case 0x10ec0294:
12087 		spec->codec_variant = ALC269_TYPE_ALC294;
12088 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
12089 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
12090 		spec->init_hook = alc294_init;
12091 		break;
12092 	case 0x10ec0300:
12093 		spec->codec_variant = ALC269_TYPE_ALC300;
12094 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
12095 		break;
12096 	case 0x10ec0222:
12097 	case 0x10ec0623:
12098 		spec->codec_variant = ALC269_TYPE_ALC623;
12099 		spec->shutup = alc222_shutup;
12100 		spec->init_hook = alc222_init;
12101 		break;
12102 	case 0x10ec0700:
12103 	case 0x10ec0701:
12104 	case 0x10ec0703:
12105 	case 0x10ec0711:
12106 		spec->codec_variant = ALC269_TYPE_ALC700;
12107 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
12108 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
12109 		spec->init_hook = alc294_init;
12110 		break;
12111 
12112 	}
12113 
12114 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
12115 		spec->has_alc5505_dsp = 1;
12116 		spec->init_hook = alc5505_dsp_init;
12117 	}
12118 
12119 	alc_pre_init(codec);
12120 
12121 	snd_hda_pick_fixup(codec, alc269_fixup_models,
12122 		       alc269_fixup_tbl, alc269_fixups);
12123 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
12124 	 * the quirk breaks the latter (bko#214101).
12125 	 * Clear the wrong entry.
12126 	 */
12127 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
12128 	    codec->core.vendor_id == 0x10ec0294) {
12129 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
12130 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
12131 	}
12132 
12133 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
12134 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
12135 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
12136 			   alc269_fixups);
12137 
12138 	/*
12139 	 * Check whether ACPI describes companion amplifiers that require
12140 	 * component binding
12141 	 */
12142 	find_cirrus_companion_amps(codec);
12143 
12144 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12145 
12146 	alc_auto_parse_customize_define(codec);
12147 
12148 	if (has_cdefine_beep(codec))
12149 		spec->gen.beep_nid = 0x01;
12150 
12151 	/* automatic parse from the BIOS config */
12152 	err = alc269_parse_auto_config(codec);
12153 	if (err < 0)
12154 		goto error;
12155 
12156 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
12157 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
12158 		if (err < 0)
12159 			goto error;
12160 	}
12161 
12162 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12163 
12164 	return 0;
12165 
12166  error:
12167 	alc_free(codec);
12168 	return err;
12169 }
12170 
12171 /*
12172  * ALC861
12173  */
12174 
alc861_parse_auto_config(struct hda_codec * codec)12175 static int alc861_parse_auto_config(struct hda_codec *codec)
12176 {
12177 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
12178 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
12179 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
12180 }
12181 
12182 /* Pin config fixes */
12183 enum {
12184 	ALC861_FIXUP_FSC_AMILO_PI1505,
12185 	ALC861_FIXUP_AMP_VREF_0F,
12186 	ALC861_FIXUP_NO_JACK_DETECT,
12187 	ALC861_FIXUP_ASUS_A6RP,
12188 	ALC660_FIXUP_ASUS_W7J,
12189 };
12190 
12191 /* 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)12192 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
12193 			const struct hda_fixup *fix, int action)
12194 {
12195 	struct alc_spec *spec = codec->spec;
12196 	unsigned int val;
12197 
12198 	if (action != HDA_FIXUP_ACT_INIT)
12199 		return;
12200 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
12201 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
12202 		val |= AC_PINCTL_IN_EN;
12203 	val |= AC_PINCTL_VREF_50;
12204 	snd_hda_set_pin_ctl(codec, 0x0f, val);
12205 	spec->gen.keep_vref_in_automute = 1;
12206 }
12207 
12208 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)12209 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
12210 				     const struct hda_fixup *fix, int action)
12211 {
12212 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
12213 		codec->no_jack_detect = 1;
12214 }
12215 
12216 static const struct hda_fixup alc861_fixups[] = {
12217 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
12218 		.type = HDA_FIXUP_PINS,
12219 		.v.pins = (const struct hda_pintbl[]) {
12220 			{ 0x0b, 0x0221101f }, /* HP */
12221 			{ 0x0f, 0x90170310 }, /* speaker */
12222 			{ }
12223 		}
12224 	},
12225 	[ALC861_FIXUP_AMP_VREF_0F] = {
12226 		.type = HDA_FIXUP_FUNC,
12227 		.v.func = alc861_fixup_asus_amp_vref_0f,
12228 	},
12229 	[ALC861_FIXUP_NO_JACK_DETECT] = {
12230 		.type = HDA_FIXUP_FUNC,
12231 		.v.func = alc_fixup_no_jack_detect,
12232 	},
12233 	[ALC861_FIXUP_ASUS_A6RP] = {
12234 		.type = HDA_FIXUP_FUNC,
12235 		.v.func = alc861_fixup_asus_amp_vref_0f,
12236 		.chained = true,
12237 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
12238 	},
12239 	[ALC660_FIXUP_ASUS_W7J] = {
12240 		.type = HDA_FIXUP_VERBS,
12241 		.v.verbs = (const struct hda_verb[]) {
12242 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
12243 			 * for enabling outputs
12244 			 */
12245 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12246 			{ }
12247 		},
12248 	}
12249 };
12250 
12251 static const struct hda_quirk alc861_fixup_tbl[] = {
12252 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
12253 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
12254 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
12255 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
12256 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
12257 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
12258 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
12259 	{}
12260 };
12261 
12262 /*
12263  */
patch_alc861(struct hda_codec * codec)12264 static int patch_alc861(struct hda_codec *codec)
12265 {
12266 	struct alc_spec *spec;
12267 	int err;
12268 
12269 	err = alc_alloc_spec(codec, 0x15);
12270 	if (err < 0)
12271 		return err;
12272 
12273 	spec = codec->spec;
12274 	if (has_cdefine_beep(codec))
12275 		spec->gen.beep_nid = 0x23;
12276 
12277 	spec->power_hook = alc_power_eapd;
12278 
12279 	alc_pre_init(codec);
12280 
12281 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
12282 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12283 
12284 	/* automatic parse from the BIOS config */
12285 	err = alc861_parse_auto_config(codec);
12286 	if (err < 0)
12287 		goto error;
12288 
12289 	if (!spec->gen.no_analog) {
12290 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
12291 		if (err < 0)
12292 			goto error;
12293 	}
12294 
12295 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12296 
12297 	return 0;
12298 
12299  error:
12300 	alc_free(codec);
12301 	return err;
12302 }
12303 
12304 /*
12305  * ALC861-VD support
12306  *
12307  * Based on ALC882
12308  *
12309  * In addition, an independent DAC
12310  */
alc861vd_parse_auto_config(struct hda_codec * codec)12311 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12312 {
12313 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12314 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
12315 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
12316 }
12317 
12318 enum {
12319 	ALC660VD_FIX_ASUS_GPIO1,
12320 	ALC861VD_FIX_DALLAS,
12321 };
12322 
12323 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)12324 static void alc861vd_fixup_dallas(struct hda_codec *codec,
12325 				  const struct hda_fixup *fix, int action)
12326 {
12327 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12328 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
12329 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
12330 	}
12331 }
12332 
12333 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)12334 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
12335 				      const struct hda_fixup *fix, int action)
12336 {
12337 	struct alc_spec *spec = codec->spec;
12338 
12339 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
12340 		spec->gpio_mask |= 0x02;
12341 	alc_fixup_gpio(codec, action, 0x01);
12342 }
12343 
12344 static const struct hda_fixup alc861vd_fixups[] = {
12345 	[ALC660VD_FIX_ASUS_GPIO1] = {
12346 		.type = HDA_FIXUP_FUNC,
12347 		.v.func = alc660vd_fixup_asus_gpio1,
12348 	},
12349 	[ALC861VD_FIX_DALLAS] = {
12350 		.type = HDA_FIXUP_FUNC,
12351 		.v.func = alc861vd_fixup_dallas,
12352 	},
12353 };
12354 
12355 static const struct hda_quirk alc861vd_fixup_tbl[] = {
12356 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
12357 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
12358 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
12359 	{}
12360 };
12361 
12362 /*
12363  */
patch_alc861vd(struct hda_codec * codec)12364 static int patch_alc861vd(struct hda_codec *codec)
12365 {
12366 	struct alc_spec *spec;
12367 	int err;
12368 
12369 	err = alc_alloc_spec(codec, 0x0b);
12370 	if (err < 0)
12371 		return err;
12372 
12373 	spec = codec->spec;
12374 	if (has_cdefine_beep(codec))
12375 		spec->gen.beep_nid = 0x23;
12376 
12377 	spec->shutup = alc_eapd_shutup;
12378 
12379 	alc_pre_init(codec);
12380 
12381 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
12382 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12383 
12384 	/* automatic parse from the BIOS config */
12385 	err = alc861vd_parse_auto_config(codec);
12386 	if (err < 0)
12387 		goto error;
12388 
12389 	if (!spec->gen.no_analog) {
12390 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12391 		if (err < 0)
12392 			goto error;
12393 	}
12394 
12395 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12396 
12397 	return 0;
12398 
12399  error:
12400 	alc_free(codec);
12401 	return err;
12402 }
12403 
12404 /*
12405  * ALC662 support
12406  *
12407  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12408  * configuration.  Each pin widget can choose any input DACs and a mixer.
12409  * Each ADC is connected from a mixer of all inputs.  This makes possible
12410  * 6-channel independent captures.
12411  *
12412  * In addition, an independent DAC for the multi-playback (not used in this
12413  * driver yet).
12414  */
12415 
12416 /*
12417  * BIOS auto configuration
12418  */
12419 
alc662_parse_auto_config(struct hda_codec * codec)12420 static int alc662_parse_auto_config(struct hda_codec *codec)
12421 {
12422 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
12423 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
12424 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
12425 	const hda_nid_t *ssids;
12426 
12427 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
12428 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
12429 	    codec->core.vendor_id == 0x10ec0671)
12430 		ssids = alc663_ssids;
12431 	else
12432 		ssids = alc662_ssids;
12433 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
12434 }
12435 
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)12436 static void alc272_fixup_mario(struct hda_codec *codec,
12437 			       const struct hda_fixup *fix, int action)
12438 {
12439 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
12440 		return;
12441 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
12442 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
12443 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
12444 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12445 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
12446 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
12447 }
12448 
12449 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
12450 	{ .channels = 2,
12451 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
12452 	{ .channels = 4,
12453 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
12454 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
12455 	{ }
12456 };
12457 
12458 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)12459 static void alc_fixup_bass_chmap(struct hda_codec *codec,
12460 				    const struct hda_fixup *fix, int action)
12461 {
12462 	if (action == HDA_FIXUP_ACT_BUILD) {
12463 		struct alc_spec *spec = codec->spec;
12464 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
12465 	}
12466 }
12467 
12468 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)12469 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
12470 					  hda_nid_t nid,
12471 					  unsigned int power_state)
12472 {
12473 	struct alc_spec *spec = codec->spec;
12474 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
12475 		return AC_PWRST_D0;
12476 	return power_state;
12477 }
12478 
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)12479 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
12480 				   const struct hda_fixup *fix, int action)
12481 {
12482 	struct alc_spec *spec = codec->spec;
12483 
12484 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
12485 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12486 		spec->mute_led_polarity = 1;
12487 		codec->power_filter = gpio_led_power_filter;
12488 	}
12489 }
12490 
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)12491 static void alc662_usi_automute_hook(struct hda_codec *codec,
12492 					 struct hda_jack_callback *jack)
12493 {
12494 	struct alc_spec *spec = codec->spec;
12495 	int vref;
12496 	msleep(200);
12497 	snd_hda_gen_hp_automute(codec, jack);
12498 
12499 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
12500 	msleep(100);
12501 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
12502 			    vref);
12503 }
12504 
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)12505 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
12506 				     const struct hda_fixup *fix, int action)
12507 {
12508 	struct alc_spec *spec = codec->spec;
12509 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12510 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12511 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
12512 	}
12513 }
12514 
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)12515 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
12516 					struct hda_jack_callback *cb)
12517 {
12518 	/* surround speakers at 0x1b already get muted automatically when
12519 	 * headphones are plugged in, but we have to mute/unmute the remaining
12520 	 * channels manually:
12521 	 * 0x15 - front left/front right
12522 	 * 0x18 - front center/ LFE
12523 	 */
12524 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
12525 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
12526 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
12527 	} else {
12528 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
12529 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
12530 	}
12531 }
12532 
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)12533 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
12534 					const struct hda_fixup *fix, int action)
12535 {
12536     /* Pin 0x1b: shared headphones jack and surround speakers */
12537 	if (!is_jack_detectable(codec, 0x1b))
12538 		return;
12539 
12540 	switch (action) {
12541 	case HDA_FIXUP_ACT_PRE_PROBE:
12542 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
12543 				alc662_aspire_ethos_mute_speakers);
12544 		/* subwoofer needs an extra GPIO setting to become audible */
12545 		alc_setup_gpio(codec, 0x02);
12546 		break;
12547 	case HDA_FIXUP_ACT_INIT:
12548 		/* Make sure to start in a correct state, i.e. if
12549 		 * headphones have been plugged in before powering up the system
12550 		 */
12551 		alc662_aspire_ethos_mute_speakers(codec, NULL);
12552 		break;
12553 	}
12554 }
12555 
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)12556 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
12557 					     const struct hda_fixup *fix, int action)
12558 {
12559 	struct alc_spec *spec = codec->spec;
12560 
12561 	static const struct hda_pintbl pincfgs[] = {
12562 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
12563 		{ 0x1b, 0x0181304f },
12564 		{ }
12565 	};
12566 
12567 	switch (action) {
12568 	case HDA_FIXUP_ACT_PRE_PROBE:
12569 		spec->gen.mixer_nid = 0;
12570 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12571 		snd_hda_apply_pincfgs(codec, pincfgs);
12572 		break;
12573 	case HDA_FIXUP_ACT_INIT:
12574 		alc_write_coef_idx(codec, 0x19, 0xa054);
12575 		break;
12576 	}
12577 }
12578 
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)12579 static void alc897_hp_automute_hook(struct hda_codec *codec,
12580 					 struct hda_jack_callback *jack)
12581 {
12582 	struct alc_spec *spec = codec->spec;
12583 	int vref;
12584 
12585 	snd_hda_gen_hp_automute(codec, jack);
12586 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
12587 	snd_hda_set_pin_ctl(codec, 0x1b, vref);
12588 }
12589 
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)12590 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
12591 				     const struct hda_fixup *fix, int action)
12592 {
12593 	struct alc_spec *spec = codec->spec;
12594 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12595 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
12596 		spec->no_shutup_pins = 1;
12597 	}
12598 	if (action == HDA_FIXUP_ACT_PROBE) {
12599 		snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
12600 	}
12601 }
12602 
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)12603 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
12604 				     const struct hda_fixup *fix, int action)
12605 {
12606 	struct alc_spec *spec = codec->spec;
12607 
12608 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12609 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12610 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
12611 	}
12612 }
12613 
12614 static const struct coef_fw alc668_coefs[] = {
12615 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
12616 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
12617 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
12618 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
12619 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
12620 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
12621 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
12622 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
12623 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
12624 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
12625 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
12626 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
12627 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
12628 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
12629 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
12630 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
12631 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
12632 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
12633 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
12634 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
12635 	{}
12636 };
12637 
alc668_restore_default_value(struct hda_codec * codec)12638 static void alc668_restore_default_value(struct hda_codec *codec)
12639 {
12640 	alc_process_coef_fw(codec, alc668_coefs);
12641 }
12642 
12643 enum {
12644 	ALC662_FIXUP_ASPIRE,
12645 	ALC662_FIXUP_LED_GPIO1,
12646 	ALC662_FIXUP_IDEAPAD,
12647 	ALC272_FIXUP_MARIO,
12648 	ALC662_FIXUP_CZC_ET26,
12649 	ALC662_FIXUP_CZC_P10T,
12650 	ALC662_FIXUP_SKU_IGNORE,
12651 	ALC662_FIXUP_HP_RP5800,
12652 	ALC662_FIXUP_ASUS_MODE1,
12653 	ALC662_FIXUP_ASUS_MODE2,
12654 	ALC662_FIXUP_ASUS_MODE3,
12655 	ALC662_FIXUP_ASUS_MODE4,
12656 	ALC662_FIXUP_ASUS_MODE5,
12657 	ALC662_FIXUP_ASUS_MODE6,
12658 	ALC662_FIXUP_ASUS_MODE7,
12659 	ALC662_FIXUP_ASUS_MODE8,
12660 	ALC662_FIXUP_NO_JACK_DETECT,
12661 	ALC662_FIXUP_ZOTAC_Z68,
12662 	ALC662_FIXUP_INV_DMIC,
12663 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12664 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
12665 	ALC662_FIXUP_HEADSET_MODE,
12666 	ALC668_FIXUP_HEADSET_MODE,
12667 	ALC662_FIXUP_BASS_MODE4_CHMAP,
12668 	ALC662_FIXUP_BASS_16,
12669 	ALC662_FIXUP_BASS_1A,
12670 	ALC662_FIXUP_BASS_CHMAP,
12671 	ALC668_FIXUP_AUTO_MUTE,
12672 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
12673 	ALC668_FIXUP_DELL_XPS13,
12674 	ALC662_FIXUP_ASUS_Nx50,
12675 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12676 	ALC668_FIXUP_ASUS_Nx51,
12677 	ALC668_FIXUP_MIC_COEF,
12678 	ALC668_FIXUP_ASUS_G751,
12679 	ALC891_FIXUP_HEADSET_MODE,
12680 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12681 	ALC662_FIXUP_ACER_VERITON,
12682 	ALC892_FIXUP_ASROCK_MOBO,
12683 	ALC662_FIXUP_USI_FUNC,
12684 	ALC662_FIXUP_USI_HEADSET_MODE,
12685 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
12686 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
12687 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
12688 	ALC671_FIXUP_HP_HEADSET_MIC2,
12689 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
12690 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
12691 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
12692 	ALC668_FIXUP_HEADSET_MIC,
12693 	ALC668_FIXUP_MIC_DET_COEF,
12694 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
12695 	ALC897_FIXUP_HEADSET_MIC_PIN,
12696 	ALC897_FIXUP_HP_HSMIC_VERB,
12697 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
12698 	ALC897_FIXUP_HEADSET_MIC_PIN2,
12699 	ALC897_FIXUP_UNIS_H3C_X500S,
12700 	ALC897_FIXUP_HEADSET_MIC_PIN3,
12701 };
12702 
12703 static const struct hda_fixup alc662_fixups[] = {
12704 	[ALC662_FIXUP_ASPIRE] = {
12705 		.type = HDA_FIXUP_PINS,
12706 		.v.pins = (const struct hda_pintbl[]) {
12707 			{ 0x15, 0x99130112 }, /* subwoofer */
12708 			{ }
12709 		}
12710 	},
12711 	[ALC662_FIXUP_LED_GPIO1] = {
12712 		.type = HDA_FIXUP_FUNC,
12713 		.v.func = alc662_fixup_led_gpio1,
12714 	},
12715 	[ALC662_FIXUP_IDEAPAD] = {
12716 		.type = HDA_FIXUP_PINS,
12717 		.v.pins = (const struct hda_pintbl[]) {
12718 			{ 0x17, 0x99130112 }, /* subwoofer */
12719 			{ }
12720 		},
12721 		.chained = true,
12722 		.chain_id = ALC662_FIXUP_LED_GPIO1,
12723 	},
12724 	[ALC272_FIXUP_MARIO] = {
12725 		.type = HDA_FIXUP_FUNC,
12726 		.v.func = alc272_fixup_mario,
12727 	},
12728 	[ALC662_FIXUP_CZC_ET26] = {
12729 		.type = HDA_FIXUP_PINS,
12730 		.v.pins = (const struct hda_pintbl[]) {
12731 			{0x12, 0x403cc000},
12732 			{0x14, 0x90170110}, /* speaker */
12733 			{0x15, 0x411111f0},
12734 			{0x16, 0x411111f0},
12735 			{0x18, 0x01a19030}, /* mic */
12736 			{0x19, 0x90a7013f}, /* int-mic */
12737 			{0x1a, 0x01014020},
12738 			{0x1b, 0x0121401f},
12739 			{0x1c, 0x411111f0},
12740 			{0x1d, 0x411111f0},
12741 			{0x1e, 0x40478e35},
12742 			{}
12743 		},
12744 		.chained = true,
12745 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12746 	},
12747 	[ALC662_FIXUP_CZC_P10T] = {
12748 		.type = HDA_FIXUP_VERBS,
12749 		.v.verbs = (const struct hda_verb[]) {
12750 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
12751 			{}
12752 		}
12753 	},
12754 	[ALC662_FIXUP_SKU_IGNORE] = {
12755 		.type = HDA_FIXUP_FUNC,
12756 		.v.func = alc_fixup_sku_ignore,
12757 	},
12758 	[ALC662_FIXUP_HP_RP5800] = {
12759 		.type = HDA_FIXUP_PINS,
12760 		.v.pins = (const struct hda_pintbl[]) {
12761 			{ 0x14, 0x0221201f }, /* HP out */
12762 			{ }
12763 		},
12764 		.chained = true,
12765 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12766 	},
12767 	[ALC662_FIXUP_ASUS_MODE1] = {
12768 		.type = HDA_FIXUP_PINS,
12769 		.v.pins = (const struct hda_pintbl[]) {
12770 			{ 0x14, 0x99130110 }, /* speaker */
12771 			{ 0x18, 0x01a19c20 }, /* mic */
12772 			{ 0x19, 0x99a3092f }, /* int-mic */
12773 			{ 0x21, 0x0121401f }, /* HP out */
12774 			{ }
12775 		},
12776 		.chained = true,
12777 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12778 	},
12779 	[ALC662_FIXUP_ASUS_MODE2] = {
12780 		.type = HDA_FIXUP_PINS,
12781 		.v.pins = (const struct hda_pintbl[]) {
12782 			{ 0x14, 0x99130110 }, /* speaker */
12783 			{ 0x18, 0x01a19820 }, /* mic */
12784 			{ 0x19, 0x99a3092f }, /* int-mic */
12785 			{ 0x1b, 0x0121401f }, /* HP out */
12786 			{ }
12787 		},
12788 		.chained = true,
12789 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12790 	},
12791 	[ALC662_FIXUP_ASUS_MODE3] = {
12792 		.type = HDA_FIXUP_PINS,
12793 		.v.pins = (const struct hda_pintbl[]) {
12794 			{ 0x14, 0x99130110 }, /* speaker */
12795 			{ 0x15, 0x0121441f }, /* HP */
12796 			{ 0x18, 0x01a19840 }, /* mic */
12797 			{ 0x19, 0x99a3094f }, /* int-mic */
12798 			{ 0x21, 0x01211420 }, /* HP2 */
12799 			{ }
12800 		},
12801 		.chained = true,
12802 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12803 	},
12804 	[ALC662_FIXUP_ASUS_MODE4] = {
12805 		.type = HDA_FIXUP_PINS,
12806 		.v.pins = (const struct hda_pintbl[]) {
12807 			{ 0x14, 0x99130110 }, /* speaker */
12808 			{ 0x16, 0x99130111 }, /* speaker */
12809 			{ 0x18, 0x01a19840 }, /* mic */
12810 			{ 0x19, 0x99a3094f }, /* int-mic */
12811 			{ 0x21, 0x0121441f }, /* HP */
12812 			{ }
12813 		},
12814 		.chained = true,
12815 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12816 	},
12817 	[ALC662_FIXUP_ASUS_MODE5] = {
12818 		.type = HDA_FIXUP_PINS,
12819 		.v.pins = (const struct hda_pintbl[]) {
12820 			{ 0x14, 0x99130110 }, /* speaker */
12821 			{ 0x15, 0x0121441f }, /* HP */
12822 			{ 0x16, 0x99130111 }, /* speaker */
12823 			{ 0x18, 0x01a19840 }, /* mic */
12824 			{ 0x19, 0x99a3094f }, /* int-mic */
12825 			{ }
12826 		},
12827 		.chained = true,
12828 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12829 	},
12830 	[ALC662_FIXUP_ASUS_MODE6] = {
12831 		.type = HDA_FIXUP_PINS,
12832 		.v.pins = (const struct hda_pintbl[]) {
12833 			{ 0x14, 0x99130110 }, /* speaker */
12834 			{ 0x15, 0x01211420 }, /* HP2 */
12835 			{ 0x18, 0x01a19840 }, /* mic */
12836 			{ 0x19, 0x99a3094f }, /* int-mic */
12837 			{ 0x1b, 0x0121441f }, /* HP */
12838 			{ }
12839 		},
12840 		.chained = true,
12841 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12842 	},
12843 	[ALC662_FIXUP_ASUS_MODE7] = {
12844 		.type = HDA_FIXUP_PINS,
12845 		.v.pins = (const struct hda_pintbl[]) {
12846 			{ 0x14, 0x99130110 }, /* speaker */
12847 			{ 0x17, 0x99130111 }, /* speaker */
12848 			{ 0x18, 0x01a19840 }, /* mic */
12849 			{ 0x19, 0x99a3094f }, /* int-mic */
12850 			{ 0x1b, 0x01214020 }, /* HP */
12851 			{ 0x21, 0x0121401f }, /* HP */
12852 			{ }
12853 		},
12854 		.chained = true,
12855 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12856 	},
12857 	[ALC662_FIXUP_ASUS_MODE8] = {
12858 		.type = HDA_FIXUP_PINS,
12859 		.v.pins = (const struct hda_pintbl[]) {
12860 			{ 0x14, 0x99130110 }, /* speaker */
12861 			{ 0x12, 0x99a30970 }, /* int-mic */
12862 			{ 0x15, 0x01214020 }, /* HP */
12863 			{ 0x17, 0x99130111 }, /* speaker */
12864 			{ 0x18, 0x01a19840 }, /* mic */
12865 			{ 0x21, 0x0121401f }, /* HP */
12866 			{ }
12867 		},
12868 		.chained = true,
12869 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12870 	},
12871 	[ALC662_FIXUP_NO_JACK_DETECT] = {
12872 		.type = HDA_FIXUP_FUNC,
12873 		.v.func = alc_fixup_no_jack_detect,
12874 	},
12875 	[ALC662_FIXUP_ZOTAC_Z68] = {
12876 		.type = HDA_FIXUP_PINS,
12877 		.v.pins = (const struct hda_pintbl[]) {
12878 			{ 0x1b, 0x02214020 }, /* Front HP */
12879 			{ }
12880 		}
12881 	},
12882 	[ALC662_FIXUP_INV_DMIC] = {
12883 		.type = HDA_FIXUP_FUNC,
12884 		.v.func = alc_fixup_inv_dmic,
12885 	},
12886 	[ALC668_FIXUP_DELL_XPS13] = {
12887 		.type = HDA_FIXUP_FUNC,
12888 		.v.func = alc_fixup_dell_xps13,
12889 		.chained = true,
12890 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12891 	},
12892 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12893 		.type = HDA_FIXUP_FUNC,
12894 		.v.func = alc_fixup_disable_aamix,
12895 		.chained = true,
12896 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12897 	},
12898 	[ALC668_FIXUP_AUTO_MUTE] = {
12899 		.type = HDA_FIXUP_FUNC,
12900 		.v.func = alc_fixup_auto_mute_via_amp,
12901 		.chained = true,
12902 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12903 	},
12904 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12905 		.type = HDA_FIXUP_PINS,
12906 		.v.pins = (const struct hda_pintbl[]) {
12907 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12908 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12909 			{ }
12910 		},
12911 		.chained = true,
12912 		.chain_id = ALC662_FIXUP_HEADSET_MODE
12913 	},
12914 	[ALC662_FIXUP_HEADSET_MODE] = {
12915 		.type = HDA_FIXUP_FUNC,
12916 		.v.func = alc_fixup_headset_mode_alc662,
12917 	},
12918 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12919 		.type = HDA_FIXUP_PINS,
12920 		.v.pins = (const struct hda_pintbl[]) {
12921 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12922 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12923 			{ }
12924 		},
12925 		.chained = true,
12926 		.chain_id = ALC668_FIXUP_HEADSET_MODE
12927 	},
12928 	[ALC668_FIXUP_HEADSET_MODE] = {
12929 		.type = HDA_FIXUP_FUNC,
12930 		.v.func = alc_fixup_headset_mode_alc668,
12931 	},
12932 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12933 		.type = HDA_FIXUP_FUNC,
12934 		.v.func = alc_fixup_bass_chmap,
12935 		.chained = true,
12936 		.chain_id = ALC662_FIXUP_ASUS_MODE4
12937 	},
12938 	[ALC662_FIXUP_BASS_16] = {
12939 		.type = HDA_FIXUP_PINS,
12940 		.v.pins = (const struct hda_pintbl[]) {
12941 			{0x16, 0x80106111}, /* bass speaker */
12942 			{}
12943 		},
12944 		.chained = true,
12945 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12946 	},
12947 	[ALC662_FIXUP_BASS_1A] = {
12948 		.type = HDA_FIXUP_PINS,
12949 		.v.pins = (const struct hda_pintbl[]) {
12950 			{0x1a, 0x80106111}, /* bass speaker */
12951 			{}
12952 		},
12953 		.chained = true,
12954 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12955 	},
12956 	[ALC662_FIXUP_BASS_CHMAP] = {
12957 		.type = HDA_FIXUP_FUNC,
12958 		.v.func = alc_fixup_bass_chmap,
12959 	},
12960 	[ALC662_FIXUP_ASUS_Nx50] = {
12961 		.type = HDA_FIXUP_FUNC,
12962 		.v.func = alc_fixup_auto_mute_via_amp,
12963 		.chained = true,
12964 		.chain_id = ALC662_FIXUP_BASS_1A
12965 	},
12966 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12967 		.type = HDA_FIXUP_FUNC,
12968 		.v.func = alc_fixup_headset_mode_alc668,
12969 		.chain_id = ALC662_FIXUP_BASS_CHMAP
12970 	},
12971 	[ALC668_FIXUP_ASUS_Nx51] = {
12972 		.type = HDA_FIXUP_PINS,
12973 		.v.pins = (const struct hda_pintbl[]) {
12974 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12975 			{ 0x1a, 0x90170151 }, /* bass speaker */
12976 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12977 			{}
12978 		},
12979 		.chained = true,
12980 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12981 	},
12982 	[ALC668_FIXUP_MIC_COEF] = {
12983 		.type = HDA_FIXUP_VERBS,
12984 		.v.verbs = (const struct hda_verb[]) {
12985 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12986 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12987 			{}
12988 		},
12989 	},
12990 	[ALC668_FIXUP_ASUS_G751] = {
12991 		.type = HDA_FIXUP_PINS,
12992 		.v.pins = (const struct hda_pintbl[]) {
12993 			{ 0x16, 0x0421101f }, /* HP */
12994 			{}
12995 		},
12996 		.chained = true,
12997 		.chain_id = ALC668_FIXUP_MIC_COEF
12998 	},
12999 	[ALC891_FIXUP_HEADSET_MODE] = {
13000 		.type = HDA_FIXUP_FUNC,
13001 		.v.func = alc_fixup_headset_mode,
13002 	},
13003 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
13004 		.type = HDA_FIXUP_PINS,
13005 		.v.pins = (const struct hda_pintbl[]) {
13006 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
13007 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
13008 			{ }
13009 		},
13010 		.chained = true,
13011 		.chain_id = ALC891_FIXUP_HEADSET_MODE
13012 	},
13013 	[ALC662_FIXUP_ACER_VERITON] = {
13014 		.type = HDA_FIXUP_PINS,
13015 		.v.pins = (const struct hda_pintbl[]) {
13016 			{ 0x15, 0x50170120 }, /* no internal speaker */
13017 			{ }
13018 		}
13019 	},
13020 	[ALC892_FIXUP_ASROCK_MOBO] = {
13021 		.type = HDA_FIXUP_PINS,
13022 		.v.pins = (const struct hda_pintbl[]) {
13023 			{ 0x15, 0x40f000f0 }, /* disabled */
13024 			{ 0x16, 0x40f000f0 }, /* disabled */
13025 			{ }
13026 		}
13027 	},
13028 	[ALC662_FIXUP_USI_FUNC] = {
13029 		.type = HDA_FIXUP_FUNC,
13030 		.v.func = alc662_fixup_usi_headset_mic,
13031 	},
13032 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
13033 		.type = HDA_FIXUP_PINS,
13034 		.v.pins = (const struct hda_pintbl[]) {
13035 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
13036 			{ 0x18, 0x01a1903d },
13037 			{ }
13038 		},
13039 		.chained = true,
13040 		.chain_id = ALC662_FIXUP_USI_FUNC
13041 	},
13042 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
13043 		.type = HDA_FIXUP_FUNC,
13044 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
13045 	},
13046 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
13047 		.type = HDA_FIXUP_FUNC,
13048 		.v.func = alc662_fixup_aspire_ethos_hp,
13049 	},
13050 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
13051 		.type = HDA_FIXUP_PINS,
13052 		.v.pins = (const struct hda_pintbl[]) {
13053 			{ 0x15, 0x92130110 }, /* front speakers */
13054 			{ 0x18, 0x99130111 }, /* center/subwoofer */
13055 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
13056 			{ }
13057 		},
13058 		.chained = true,
13059 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
13060 	},
13061 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
13062 		.type = HDA_FIXUP_FUNC,
13063 		.v.func = alc671_fixup_hp_headset_mic2,
13064 	},
13065 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
13066 		.type = HDA_FIXUP_PINS,
13067 		.v.pins = (const struct hda_pintbl[]) {
13068 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
13069 			{ }
13070 		},
13071 		.chained = true,
13072 		.chain_id = ALC662_FIXUP_USI_FUNC
13073 	},
13074 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
13075 		.type = HDA_FIXUP_PINS,
13076 		.v.pins = (const struct hda_pintbl[]) {
13077 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
13078 			{ 0x1b, 0x0221144f },
13079 			{ }
13080 		},
13081 		.chained = true,
13082 		.chain_id = ALC662_FIXUP_USI_FUNC
13083 	},
13084 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
13085 		.type = HDA_FIXUP_PINS,
13086 		.v.pins = (const struct hda_pintbl[]) {
13087 			{ 0x1b, 0x04a1112c },
13088 			{ }
13089 		},
13090 		.chained = true,
13091 		.chain_id = ALC668_FIXUP_HEADSET_MIC
13092 	},
13093 	[ALC668_FIXUP_HEADSET_MIC] = {
13094 		.type = HDA_FIXUP_FUNC,
13095 		.v.func = alc269_fixup_headset_mic,
13096 		.chained = true,
13097 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
13098 	},
13099 	[ALC668_FIXUP_MIC_DET_COEF] = {
13100 		.type = HDA_FIXUP_VERBS,
13101 		.v.verbs = (const struct hda_verb[]) {
13102 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
13103 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
13104 			{}
13105 		},
13106 	},
13107 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
13108 		.type = HDA_FIXUP_FUNC,
13109 		.v.func = alc897_fixup_lenovo_headset_mic,
13110 	},
13111 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
13112 		.type = HDA_FIXUP_PINS,
13113 		.v.pins = (const struct hda_pintbl[]) {
13114 			{ 0x1a, 0x03a11050 },
13115 			{ }
13116 		},
13117 		.chained = true,
13118 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
13119 	},
13120 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
13121 		.type = HDA_FIXUP_PINS,
13122 		.v.pins = (const struct hda_pintbl[]) {
13123 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
13124 			{ }
13125 		},
13126 	},
13127 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
13128 		.type = HDA_FIXUP_FUNC,
13129 		.v.func = alc897_fixup_lenovo_headset_mode,
13130 	},
13131 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
13132 		.type = HDA_FIXUP_PINS,
13133 		.v.pins = (const struct hda_pintbl[]) {
13134 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
13135 			{ }
13136 		},
13137 		.chained = true,
13138 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
13139 	},
13140 	[ALC897_FIXUP_UNIS_H3C_X500S] = {
13141 		.type = HDA_FIXUP_VERBS,
13142 		.v.verbs = (const struct hda_verb[]) {
13143 			{ 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
13144 			{}
13145 		},
13146 	},
13147 	[ALC897_FIXUP_HEADSET_MIC_PIN3] = {
13148 		.type = HDA_FIXUP_PINS,
13149 		.v.pins = (const struct hda_pintbl[]) {
13150 			{ 0x19, 0x03a11050 }, /* use as headset mic */
13151 			{ }
13152 		},
13153 	},
13154 };
13155 
13156 static const struct hda_quirk alc662_fixup_tbl[] = {
13157 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
13158 	SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
13159 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
13160 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
13161 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
13162 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
13163 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
13164 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
13165 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
13166 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
13167 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
13168 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
13169 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13170 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13171 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
13172 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
13173 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
13174 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13175 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13176 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13177 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13178 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13179 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
13180 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13181 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13182 	SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13183 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
13184 	SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
13185 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
13186 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
13187 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
13188 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
13189 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
13190 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
13191 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
13192 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
13193 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
13194 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
13195 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
13196 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
13197 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
13198 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
13199 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
13200 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
13201 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
13202 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
13203 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
13204 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
13205 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
13206 	SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
13207 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
13208 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
13209 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
13210 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
13211 	SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
13212 	SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
13213 	SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
13214 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
13215 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
13216 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
13217 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
13218 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
13219 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
13220 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
13221 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
13222 	SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
13223 
13224 #if 0
13225 	/* Below is a quirk table taken from the old code.
13226 	 * Basically the device should work as is without the fixup table.
13227 	 * If BIOS doesn't give a proper info, enable the corresponding
13228 	 * fixup entry.
13229 	 */
13230 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
13231 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
13232 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
13233 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
13234 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13235 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13236 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13237 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
13238 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
13239 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13240 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
13241 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
13242 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
13243 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
13244 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
13245 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13246 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
13247 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
13248 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13249 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13250 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13251 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13252 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
13253 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
13254 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
13255 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13256 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
13257 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13258 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13259 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
13260 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13261 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13262 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
13263 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
13264 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
13265 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
13266 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
13267 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
13268 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
13269 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13270 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
13271 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
13272 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13273 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
13274 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
13275 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
13276 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
13277 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
13278 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13279 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
13280 #endif
13281 	{}
13282 };
13283 
13284 static const struct hda_model_fixup alc662_fixup_models[] = {
13285 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
13286 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
13287 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
13288 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
13289 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
13290 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
13291 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
13292 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
13293 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
13294 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
13295 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
13296 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
13297 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
13298 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
13299 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
13300 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
13301 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
13302 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
13303 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
13304 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
13305 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
13306 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
13307 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
13308 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
13309 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
13310 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
13311 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
13312 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
13313 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
13314 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
13315 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
13316 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
13317 	{.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
13318 	{}
13319 };
13320 
13321 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
13322 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
13323 		{0x17, 0x02211010},
13324 		{0x18, 0x01a19030},
13325 		{0x1a, 0x01813040},
13326 		{0x21, 0x01014020}),
13327 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
13328 		{0x16, 0x01813030},
13329 		{0x17, 0x02211010},
13330 		{0x18, 0x01a19040},
13331 		{0x21, 0x01014020}),
13332 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
13333 		{0x14, 0x01014010},
13334 		{0x18, 0x01a19020},
13335 		{0x1a, 0x0181302f},
13336 		{0x1b, 0x0221401f}),
13337 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13338 		{0x12, 0x99a30130},
13339 		{0x14, 0x90170110},
13340 		{0x15, 0x0321101f},
13341 		{0x16, 0x03011020}),
13342 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13343 		{0x12, 0x99a30140},
13344 		{0x14, 0x90170110},
13345 		{0x15, 0x0321101f},
13346 		{0x16, 0x03011020}),
13347 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13348 		{0x12, 0x99a30150},
13349 		{0x14, 0x90170110},
13350 		{0x15, 0x0321101f},
13351 		{0x16, 0x03011020}),
13352 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13353 		{0x14, 0x90170110},
13354 		{0x15, 0x0321101f},
13355 		{0x16, 0x03011020}),
13356 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
13357 		{0x12, 0x90a60130},
13358 		{0x14, 0x90170110},
13359 		{0x15, 0x0321101f}),
13360 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13361 		{0x14, 0x01014010},
13362 		{0x17, 0x90170150},
13363 		{0x19, 0x02a11060},
13364 		{0x1b, 0x01813030},
13365 		{0x21, 0x02211020}),
13366 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13367 		{0x14, 0x01014010},
13368 		{0x18, 0x01a19040},
13369 		{0x1b, 0x01813030},
13370 		{0x21, 0x02211020}),
13371 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13372 		{0x14, 0x01014020},
13373 		{0x17, 0x90170110},
13374 		{0x18, 0x01a19050},
13375 		{0x1b, 0x01813040},
13376 		{0x21, 0x02211030}),
13377 	{}
13378 };
13379 
13380 /*
13381  */
patch_alc662(struct hda_codec * codec)13382 static int patch_alc662(struct hda_codec *codec)
13383 {
13384 	struct alc_spec *spec;
13385 	int err;
13386 
13387 	err = alc_alloc_spec(codec, 0x0b);
13388 	if (err < 0)
13389 		return err;
13390 
13391 	spec = codec->spec;
13392 
13393 	spec->shutup = alc_eapd_shutup;
13394 
13395 	/* handle multiple HPs as is */
13396 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
13397 
13398 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
13399 
13400 	switch (codec->core.vendor_id) {
13401 	case 0x10ec0668:
13402 		spec->init_hook = alc668_restore_default_value;
13403 		break;
13404 	}
13405 
13406 	alc_pre_init(codec);
13407 
13408 	snd_hda_pick_fixup(codec, alc662_fixup_models,
13409 		       alc662_fixup_tbl, alc662_fixups);
13410 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
13411 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
13412 
13413 	alc_auto_parse_customize_define(codec);
13414 
13415 	if (has_cdefine_beep(codec))
13416 		spec->gen.beep_nid = 0x01;
13417 
13418 	if ((alc_get_coef0(codec) & (1 << 14)) &&
13419 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
13420 	    spec->cdefine.platform_type == 1) {
13421 		err = alc_codec_rename(codec, "ALC272X");
13422 		if (err < 0)
13423 			goto error;
13424 	}
13425 
13426 	/* automatic parse from the BIOS config */
13427 	err = alc662_parse_auto_config(codec);
13428 	if (err < 0)
13429 		goto error;
13430 
13431 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
13432 		switch (codec->core.vendor_id) {
13433 		case 0x10ec0662:
13434 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13435 			break;
13436 		case 0x10ec0272:
13437 		case 0x10ec0663:
13438 		case 0x10ec0665:
13439 		case 0x10ec0668:
13440 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13441 			break;
13442 		case 0x10ec0273:
13443 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
13444 			break;
13445 		}
13446 		if (err < 0)
13447 			goto error;
13448 	}
13449 
13450 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
13451 
13452 	return 0;
13453 
13454  error:
13455 	alc_free(codec);
13456 	return err;
13457 }
13458 
13459 /*
13460  * ALC680 support
13461  */
13462 
alc680_parse_auto_config(struct hda_codec * codec)13463 static int alc680_parse_auto_config(struct hda_codec *codec)
13464 {
13465 	return alc_parse_auto_config(codec, NULL, NULL);
13466 }
13467 
13468 /*
13469  */
patch_alc680(struct hda_codec * codec)13470 static int patch_alc680(struct hda_codec *codec)
13471 {
13472 	int err;
13473 
13474 	/* ALC680 has no aa-loopback mixer */
13475 	err = alc_alloc_spec(codec, 0);
13476 	if (err < 0)
13477 		return err;
13478 
13479 	/* automatic parse from the BIOS config */
13480 	err = alc680_parse_auto_config(codec);
13481 	if (err < 0) {
13482 		alc_free(codec);
13483 		return err;
13484 	}
13485 
13486 	return 0;
13487 }
13488 
13489 /*
13490  * patch entries
13491  */
13492 static const struct hda_device_id snd_hda_id_realtek[] = {
13493 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
13494 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
13495 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
13496 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
13497 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
13498 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
13499 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
13500 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
13501 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
13502 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
13503 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
13504 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
13505 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
13506 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
13507 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
13508 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
13509 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
13510 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
13511 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
13512 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
13513 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
13514 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
13515 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
13516 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
13517 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
13518 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
13519 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
13520 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
13521 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
13522 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
13523 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
13524 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
13525 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
13526 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
13527 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
13528 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
13529 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
13530 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
13531 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
13532 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
13533 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
13534 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
13535 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
13536 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
13537 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
13538 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
13539 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
13540 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
13541 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
13542 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
13543 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
13544 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
13545 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
13546 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
13547 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
13548 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
13549 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
13550 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
13551 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
13552 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
13553 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
13554 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
13555 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
13556 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
13557 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
13558 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
13559 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
13560 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
13561 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
13562 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
13563 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
13564 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
13565 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
13566 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
13567 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
13568 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
13569 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
13570 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
13571 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
13572 	{} /* terminator */
13573 };
13574 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
13575 
13576 MODULE_LICENSE("GPL");
13577 MODULE_DESCRIPTION("Realtek HD-audio codec");
13578 MODULE_IMPORT_NS("SND_HDA_SCODEC_COMPONENT");
13579 
13580 static struct hda_codec_driver realtek_driver = {
13581 	.id = snd_hda_id_realtek,
13582 };
13583 
13584 module_hda_codec_driver(realtek_driver);
13585