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 <[email protected]>
8  *                    PeiSen Hou <[email protected]>
9  *                    Takashi Iwai <[email protected]>
10  *                    Jonathan Woithe <[email protected]>
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_jack.h"
32 #include "hda_generic.h"
33 #include "hda_component.h"
34 
35 /* keep halting ALC5505 DSP, for power saving */
36 #define HALT_REALTEK_ALC5505
37 
38 /* extra amp-initialization sequence types */
39 enum {
40 	ALC_INIT_UNDEFINED,
41 	ALC_INIT_NONE,
42 	ALC_INIT_DEFAULT,
43 };
44 
45 enum {
46 	ALC_HEADSET_MODE_UNKNOWN,
47 	ALC_HEADSET_MODE_UNPLUGGED,
48 	ALC_HEADSET_MODE_HEADSET,
49 	ALC_HEADSET_MODE_MIC,
50 	ALC_HEADSET_MODE_HEADPHONE,
51 };
52 
53 enum {
54 	ALC_HEADSET_TYPE_UNKNOWN,
55 	ALC_HEADSET_TYPE_CTIA,
56 	ALC_HEADSET_TYPE_OMTP,
57 };
58 
59 enum {
60 	ALC_KEY_MICMUTE_INDEX,
61 };
62 
63 struct alc_customize_define {
64 	unsigned int  sku_cfg;
65 	unsigned char port_connectivity;
66 	unsigned char check_sum;
67 	unsigned char customization;
68 	unsigned char external_amp;
69 	unsigned int  enable_pcbeep:1;
70 	unsigned int  platform_type:1;
71 	unsigned int  swap:1;
72 	unsigned int  override:1;
73 	unsigned int  fixup:1; /* Means that this sku is set by driver, not read from hw */
74 };
75 
76 struct alc_coef_led {
77 	unsigned int idx;
78 	unsigned int mask;
79 	unsigned int on;
80 	unsigned int off;
81 };
82 
83 struct alc_spec {
84 	struct hda_gen_spec gen; /* must be at head */
85 
86 	/* codec parameterization */
87 	struct alc_customize_define cdefine;
88 	unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
89 
90 	/* GPIO bits */
91 	unsigned int gpio_mask;
92 	unsigned int gpio_dir;
93 	unsigned int gpio_data;
94 	bool gpio_write_delay;	/* add a delay before writing gpio_data */
95 
96 	/* mute LED for HP laptops, see vref_mute_led_set() */
97 	int mute_led_polarity;
98 	int micmute_led_polarity;
99 	hda_nid_t mute_led_nid;
100 	hda_nid_t cap_mute_led_nid;
101 
102 	unsigned int gpio_mute_led_mask;
103 	unsigned int gpio_mic_led_mask;
104 	struct alc_coef_led mute_led_coef;
105 	struct alc_coef_led mic_led_coef;
106 	struct mutex coef_mutex;
107 
108 	hda_nid_t headset_mic_pin;
109 	hda_nid_t headphone_mic_pin;
110 	int current_headset_mode;
111 	int current_headset_type;
112 
113 	/* hooks */
114 	void (*init_hook)(struct hda_codec *codec);
115 	void (*power_hook)(struct hda_codec *codec);
116 	void (*shutup)(struct hda_codec *codec);
117 
118 	int init_amp;
119 	int codec_variant;	/* flag for other variants */
120 	unsigned int has_alc5505_dsp:1;
121 	unsigned int no_depop_delay:1;
122 	unsigned int done_hp_init:1;
123 	unsigned int no_shutup_pins:1;
124 	unsigned int ultra_low_power:1;
125 	unsigned int has_hs_key:1;
126 	unsigned int no_internal_mic_pin:1;
127 	unsigned int en_3kpull_low:1;
128 	int num_speaker_amps;
129 
130 	/* for PLL fix */
131 	hda_nid_t pll_nid;
132 	unsigned int pll_coef_idx, pll_coef_bit;
133 	unsigned int coef0;
134 	struct input_dev *kb_dev;
135 	u8 alc_mute_keycode_map[1];
136 
137 	/* component binding */
138 	struct hda_component_parent comps;
139 };
140 
141 /*
142  * COEF access helper functions
143  */
144 
coef_mutex_lock(struct hda_codec * codec)145 static void coef_mutex_lock(struct hda_codec *codec)
146 {
147 	struct alc_spec *spec = codec->spec;
148 
149 	snd_hda_power_up_pm(codec);
150 	mutex_lock(&spec->coef_mutex);
151 }
152 
coef_mutex_unlock(struct hda_codec * codec)153 static void coef_mutex_unlock(struct hda_codec *codec)
154 {
155 	struct alc_spec *spec = codec->spec;
156 
157 	mutex_unlock(&spec->coef_mutex);
158 	snd_hda_power_down_pm(codec);
159 }
160 
__alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)161 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
162 				 unsigned int coef_idx)
163 {
164 	unsigned int val;
165 
166 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
167 	val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
168 	return val;
169 }
170 
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)171 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
172 			       unsigned int coef_idx)
173 {
174 	unsigned int val;
175 
176 	coef_mutex_lock(codec);
177 	val = __alc_read_coefex_idx(codec, nid, coef_idx);
178 	coef_mutex_unlock(codec);
179 	return val;
180 }
181 
182 #define alc_read_coef_idx(codec, coef_idx) \
183 	alc_read_coefex_idx(codec, 0x20, coef_idx)
184 
__alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)185 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
186 				   unsigned int coef_idx, unsigned int coef_val)
187 {
188 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
189 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
190 }
191 
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)192 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
193 				 unsigned int coef_idx, unsigned int coef_val)
194 {
195 	coef_mutex_lock(codec);
196 	__alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
197 	coef_mutex_unlock(codec);
198 }
199 
200 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
201 	alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
202 
__alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)203 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
204 				    unsigned int coef_idx, unsigned int mask,
205 				    unsigned int bits_set)
206 {
207 	unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
208 
209 	if (val != -1)
210 		__alc_write_coefex_idx(codec, nid, coef_idx,
211 				       (val & ~mask) | bits_set);
212 }
213 
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)214 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
215 				  unsigned int coef_idx, unsigned int mask,
216 				  unsigned int bits_set)
217 {
218 	coef_mutex_lock(codec);
219 	__alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
220 	coef_mutex_unlock(codec);
221 }
222 
223 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set)	\
224 	alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
225 
226 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)227 static unsigned int alc_get_coef0(struct hda_codec *codec)
228 {
229 	struct alc_spec *spec = codec->spec;
230 
231 	if (!spec->coef0)
232 		spec->coef0 = alc_read_coef_idx(codec, 0);
233 	return spec->coef0;
234 }
235 
236 /* coef writes/updates batch */
237 struct coef_fw {
238 	unsigned char nid;
239 	unsigned char idx;
240 	unsigned short mask;
241 	unsigned short val;
242 };
243 
244 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
245 	{ .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
246 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
247 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
248 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
249 
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)250 static void alc_process_coef_fw(struct hda_codec *codec,
251 				const struct coef_fw *fw)
252 {
253 	coef_mutex_lock(codec);
254 	for (; fw->nid; fw++) {
255 		if (fw->mask == (unsigned short)-1)
256 			__alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
257 		else
258 			__alc_update_coefex_idx(codec, fw->nid, fw->idx,
259 						fw->mask, fw->val);
260 	}
261 	coef_mutex_unlock(codec);
262 }
263 
264 /*
265  * GPIO setup tables, used in initialization
266  */
267 
268 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)269 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
270 {
271 	struct alc_spec *spec = codec->spec;
272 
273 	spec->gpio_mask |= mask;
274 	spec->gpio_dir |= mask;
275 	spec->gpio_data |= mask;
276 }
277 
alc_write_gpio_data(struct hda_codec * codec)278 static void alc_write_gpio_data(struct hda_codec *codec)
279 {
280 	struct alc_spec *spec = codec->spec;
281 
282 	snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
283 			    spec->gpio_data);
284 }
285 
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)286 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
287 				 bool on)
288 {
289 	struct alc_spec *spec = codec->spec;
290 	unsigned int oldval = spec->gpio_data;
291 
292 	if (on)
293 		spec->gpio_data |= mask;
294 	else
295 		spec->gpio_data &= ~mask;
296 	if (oldval != spec->gpio_data)
297 		alc_write_gpio_data(codec);
298 }
299 
alc_write_gpio(struct hda_codec * codec)300 static void alc_write_gpio(struct hda_codec *codec)
301 {
302 	struct alc_spec *spec = codec->spec;
303 
304 	if (!spec->gpio_mask)
305 		return;
306 
307 	snd_hda_codec_write(codec, codec->core.afg, 0,
308 			    AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
309 	snd_hda_codec_write(codec, codec->core.afg, 0,
310 			    AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
311 	if (spec->gpio_write_delay)
312 		msleep(1);
313 	alc_write_gpio_data(codec);
314 }
315 
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)316 static void alc_fixup_gpio(struct hda_codec *codec, int action,
317 			   unsigned int mask)
318 {
319 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
320 		alc_setup_gpio(codec, mask);
321 }
322 
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)323 static void alc_fixup_gpio1(struct hda_codec *codec,
324 			    const struct hda_fixup *fix, int action)
325 {
326 	alc_fixup_gpio(codec, action, 0x01);
327 }
328 
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)329 static void alc_fixup_gpio2(struct hda_codec *codec,
330 			    const struct hda_fixup *fix, int action)
331 {
332 	alc_fixup_gpio(codec, action, 0x02);
333 }
334 
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)335 static void alc_fixup_gpio3(struct hda_codec *codec,
336 			    const struct hda_fixup *fix, int action)
337 {
338 	alc_fixup_gpio(codec, action, 0x03);
339 }
340 
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)341 static void alc_fixup_gpio4(struct hda_codec *codec,
342 			    const struct hda_fixup *fix, int action)
343 {
344 	alc_fixup_gpio(codec, action, 0x04);
345 }
346 
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)347 static void alc_fixup_micmute_led(struct hda_codec *codec,
348 				  const struct hda_fixup *fix, int action)
349 {
350 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
351 		snd_hda_gen_add_micmute_led_cdev(codec, NULL);
352 }
353 
354 /*
355  * Fix hardware PLL issue
356  * On some codecs, the analog PLL gating control must be off while
357  * the default value is 1.
358  */
alc_fix_pll(struct hda_codec * codec)359 static void alc_fix_pll(struct hda_codec *codec)
360 {
361 	struct alc_spec *spec = codec->spec;
362 
363 	if (spec->pll_nid)
364 		alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
365 				      1 << spec->pll_coef_bit, 0);
366 }
367 
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)368 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
369 			     unsigned int coef_idx, unsigned int coef_bit)
370 {
371 	struct alc_spec *spec = codec->spec;
372 	spec->pll_nid = nid;
373 	spec->pll_coef_idx = coef_idx;
374 	spec->pll_coef_bit = coef_bit;
375 	alc_fix_pll(codec);
376 }
377 
378 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)379 static void alc_update_knob_master(struct hda_codec *codec,
380 				   struct hda_jack_callback *jack)
381 {
382 	unsigned int val;
383 	struct snd_kcontrol *kctl;
384 	struct snd_ctl_elem_value *uctl;
385 
386 	kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
387 	if (!kctl)
388 		return;
389 	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
390 	if (!uctl)
391 		return;
392 	val = snd_hda_codec_read(codec, jack->nid, 0,
393 				 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
394 	val &= HDA_AMP_VOLMASK;
395 	uctl->value.integer.value[0] = val;
396 	uctl->value.integer.value[1] = val;
397 	kctl->put(kctl, uctl);
398 	kfree(uctl);
399 }
400 
alc880_unsol_event(struct hda_codec * codec,unsigned int res)401 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
402 {
403 	/* For some reason, the res given from ALC880 is broken.
404 	   Here we adjust it properly. */
405 	snd_hda_jack_unsol_event(codec, res >> 2);
406 }
407 
408 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)409 static void alc_fill_eapd_coef(struct hda_codec *codec)
410 {
411 	int coef;
412 
413 	coef = alc_get_coef0(codec);
414 
415 	switch (codec->core.vendor_id) {
416 	case 0x10ec0262:
417 		alc_update_coef_idx(codec, 0x7, 0, 1<<5);
418 		break;
419 	case 0x10ec0267:
420 	case 0x10ec0268:
421 		alc_update_coef_idx(codec, 0x7, 0, 1<<13);
422 		break;
423 	case 0x10ec0269:
424 		if ((coef & 0x00f0) == 0x0010)
425 			alc_update_coef_idx(codec, 0xd, 0, 1<<14);
426 		if ((coef & 0x00f0) == 0x0020)
427 			alc_update_coef_idx(codec, 0x4, 1<<15, 0);
428 		if ((coef & 0x00f0) == 0x0030)
429 			alc_update_coef_idx(codec, 0x10, 1<<9, 0);
430 		break;
431 	case 0x10ec0280:
432 	case 0x10ec0284:
433 	case 0x10ec0290:
434 	case 0x10ec0292:
435 		alc_update_coef_idx(codec, 0x4, 1<<15, 0);
436 		break;
437 	case 0x10ec0225:
438 	case 0x10ec0295:
439 	case 0x10ec0299:
440 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
441 		fallthrough;
442 	case 0x10ec0215:
443 	case 0x10ec0285:
444 	case 0x10ec0289:
445 		alc_update_coef_idx(codec, 0x36, 1<<13, 0);
446 		fallthrough;
447 	case 0x10ec0230:
448 	case 0x10ec0233:
449 	case 0x10ec0235:
450 	case 0x10ec0236:
451 	case 0x10ec0245:
452 	case 0x10ec0255:
453 	case 0x10ec0256:
454 	case 0x19e58326:
455 	case 0x10ec0257:
456 	case 0x10ec0282:
457 	case 0x10ec0283:
458 	case 0x10ec0286:
459 	case 0x10ec0288:
460 	case 0x10ec0298:
461 	case 0x10ec0300:
462 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
463 		break;
464 	case 0x10ec0275:
465 		alc_update_coef_idx(codec, 0xe, 0, 1<<0);
466 		break;
467 	case 0x10ec0287:
468 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
469 		alc_write_coef_idx(codec, 0x8, 0x4ab7);
470 		break;
471 	case 0x10ec0293:
472 		alc_update_coef_idx(codec, 0xa, 1<<13, 0);
473 		break;
474 	case 0x10ec0234:
475 	case 0x10ec0274:
476 		alc_write_coef_idx(codec, 0x6e, 0x0c25);
477 		fallthrough;
478 	case 0x10ec0294:
479 	case 0x10ec0700:
480 	case 0x10ec0701:
481 	case 0x10ec0703:
482 	case 0x10ec0711:
483 		alc_update_coef_idx(codec, 0x10, 1<<15, 0);
484 		break;
485 	case 0x10ec0662:
486 		if ((coef & 0x00f0) == 0x0030)
487 			alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
488 		break;
489 	case 0x10ec0272:
490 	case 0x10ec0273:
491 	case 0x10ec0663:
492 	case 0x10ec0665:
493 	case 0x10ec0670:
494 	case 0x10ec0671:
495 	case 0x10ec0672:
496 		alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
497 		break;
498 	case 0x10ec0222:
499 	case 0x10ec0623:
500 		alc_update_coef_idx(codec, 0x19, 1<<13, 0);
501 		break;
502 	case 0x10ec0668:
503 		alc_update_coef_idx(codec, 0x7, 3<<13, 0);
504 		break;
505 	case 0x10ec0867:
506 		alc_update_coef_idx(codec, 0x4, 1<<10, 0);
507 		break;
508 	case 0x10ec0888:
509 		if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
510 			alc_update_coef_idx(codec, 0x7, 1<<5, 0);
511 		break;
512 	case 0x10ec0892:
513 	case 0x10ec0897:
514 		alc_update_coef_idx(codec, 0x7, 1<<5, 0);
515 		break;
516 	case 0x10ec0899:
517 	case 0x10ec0900:
518 	case 0x10ec0b00:
519 	case 0x10ec1168:
520 	case 0x10ec1220:
521 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
522 		break;
523 	}
524 }
525 
526 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)527 static void alc888_coef_init(struct hda_codec *codec)
528 {
529 	switch (alc_get_coef0(codec) & 0x00f0) {
530 	/* alc888-VA */
531 	case 0x00:
532 	/* alc888-VB */
533 	case 0x10:
534 		alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
535 		break;
536 	}
537 }
538 
539 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)540 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
541 {
542 	if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
543 		return;
544 	if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
545 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
546 				    on ? 2 : 0);
547 }
548 
549 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)550 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
551 {
552 	/* We currently only handle front, HP */
553 	static const hda_nid_t pins[] = {
554 		0x0f, 0x10, 0x14, 0x15, 0x17, 0
555 	};
556 	const hda_nid_t *p;
557 	for (p = pins; *p; p++)
558 		set_eapd(codec, *p, on);
559 }
560 
561 static int find_ext_mic_pin(struct hda_codec *codec);
562 
alc_headset_mic_no_shutup(struct hda_codec * codec)563 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
564 {
565 	const struct hda_pincfg *pin;
566 	int mic_pin = find_ext_mic_pin(codec);
567 	int i;
568 
569 	/* don't shut up pins when unloading the driver; otherwise it breaks
570 	 * the default pin setup at the next load of the driver
571 	 */
572 	if (codec->bus->shutdown)
573 		return;
574 
575 	snd_array_for_each(&codec->init_pins, i, pin) {
576 		/* use read here for syncing after issuing each verb */
577 		if (pin->nid != mic_pin)
578 			snd_hda_codec_read(codec, pin->nid, 0,
579 					AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
580 	}
581 
582 	codec->pins_shutup = 1;
583 }
584 
alc_shutup_pins(struct hda_codec * codec)585 static void alc_shutup_pins(struct hda_codec *codec)
586 {
587 	struct alc_spec *spec = codec->spec;
588 
589 	if (spec->no_shutup_pins)
590 		return;
591 
592 	switch (codec->core.vendor_id) {
593 	case 0x10ec0236:
594 	case 0x10ec0256:
595 	case 0x10ec0257:
596 	case 0x19e58326:
597 	case 0x10ec0283:
598 	case 0x10ec0285:
599 	case 0x10ec0286:
600 	case 0x10ec0287:
601 	case 0x10ec0288:
602 	case 0x10ec0295:
603 	case 0x10ec0298:
604 		alc_headset_mic_no_shutup(codec);
605 		break;
606 	default:
607 		snd_hda_shutup_pins(codec);
608 		break;
609 	}
610 }
611 
612 /* generic shutup callback;
613  * just turning off EAPD and a little pause for avoiding pop-noise
614  */
alc_eapd_shutup(struct hda_codec * codec)615 static void alc_eapd_shutup(struct hda_codec *codec)
616 {
617 	struct alc_spec *spec = codec->spec;
618 
619 	alc_auto_setup_eapd(codec, false);
620 	if (!spec->no_depop_delay)
621 		msleep(200);
622 	alc_shutup_pins(codec);
623 }
624 
625 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)626 static void alc_auto_init_amp(struct hda_codec *codec, int type)
627 {
628 	alc_auto_setup_eapd(codec, true);
629 	alc_write_gpio(codec);
630 	switch (type) {
631 	case ALC_INIT_DEFAULT:
632 		switch (codec->core.vendor_id) {
633 		case 0x10ec0260:
634 			alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
635 			break;
636 		case 0x10ec0880:
637 		case 0x10ec0882:
638 		case 0x10ec0883:
639 		case 0x10ec0885:
640 			alc_update_coef_idx(codec, 7, 0, 0x2030);
641 			break;
642 		case 0x10ec0888:
643 			alc888_coef_init(codec);
644 			break;
645 		}
646 		break;
647 	}
648 }
649 
650 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)651 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
652 {
653 	if (spec->gen.autocfg.hp_pins[0])
654 		return spec->gen.autocfg.hp_pins[0];
655 	if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
656 		return spec->gen.autocfg.line_out_pins[0];
657 	return 0;
658 }
659 
660 /*
661  * Realtek SSID verification
662  */
663 
664 /* Could be any non-zero and even value. When used as fixup, tells
665  * the driver to ignore any present sku defines.
666  */
667 #define ALC_FIXUP_SKU_IGNORE (2)
668 
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)669 static void alc_fixup_sku_ignore(struct hda_codec *codec,
670 				 const struct hda_fixup *fix, int action)
671 {
672 	struct alc_spec *spec = codec->spec;
673 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
674 		spec->cdefine.fixup = 1;
675 		spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
676 	}
677 }
678 
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)679 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
680 				    const struct hda_fixup *fix, int action)
681 {
682 	struct alc_spec *spec = codec->spec;
683 
684 	if (action == HDA_FIXUP_ACT_PROBE) {
685 		spec->no_depop_delay = 1;
686 		codec->depop_delay = 0;
687 	}
688 }
689 
alc_auto_parse_customize_define(struct hda_codec * codec)690 static int alc_auto_parse_customize_define(struct hda_codec *codec)
691 {
692 	unsigned int ass, tmp, i;
693 	unsigned nid = 0;
694 	struct alc_spec *spec = codec->spec;
695 
696 	spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
697 
698 	if (spec->cdefine.fixup) {
699 		ass = spec->cdefine.sku_cfg;
700 		if (ass == ALC_FIXUP_SKU_IGNORE)
701 			return -1;
702 		goto do_sku;
703 	}
704 
705 	if (!codec->bus->pci)
706 		return -1;
707 	ass = codec->core.subsystem_id & 0xffff;
708 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
709 		goto do_sku;
710 
711 	nid = 0x1d;
712 	if (codec->core.vendor_id == 0x10ec0260)
713 		nid = 0x17;
714 	ass = snd_hda_codec_get_pincfg(codec, nid);
715 
716 	if (!(ass & 1)) {
717 		codec_info(codec, "%s: SKU not ready 0x%08x\n",
718 			   codec->core.chip_name, ass);
719 		return -1;
720 	}
721 
722 	/* check sum */
723 	tmp = 0;
724 	for (i = 1; i < 16; i++) {
725 		if ((ass >> i) & 1)
726 			tmp++;
727 	}
728 	if (((ass >> 16) & 0xf) != tmp)
729 		return -1;
730 
731 	spec->cdefine.port_connectivity = ass >> 30;
732 	spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
733 	spec->cdefine.check_sum = (ass >> 16) & 0xf;
734 	spec->cdefine.customization = ass >> 8;
735 do_sku:
736 	spec->cdefine.sku_cfg = ass;
737 	spec->cdefine.external_amp = (ass & 0x38) >> 3;
738 	spec->cdefine.platform_type = (ass & 0x4) >> 2;
739 	spec->cdefine.swap = (ass & 0x2) >> 1;
740 	spec->cdefine.override = ass & 0x1;
741 
742 	codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
743 		   nid, spec->cdefine.sku_cfg);
744 	codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
745 		   spec->cdefine.port_connectivity);
746 	codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
747 	codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
748 	codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
749 	codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
750 	codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
751 	codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
752 	codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
753 
754 	return 0;
755 }
756 
757 /* 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)758 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
759 {
760 	int i;
761 	for (i = 0; i < nums; i++)
762 		if (list[i] == nid)
763 			return i;
764 	return -1;
765 }
766 /* 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)767 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
768 {
769 	return find_idx_in_nid_list(nid, list, nums) >= 0;
770 }
771 
772 /* check subsystem ID and set up device-specific initialization;
773  * return 1 if initialized, 0 if invalid SSID
774  */
775 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
776  *	31 ~ 16 :	Manufacture ID
777  *	15 ~ 8	:	SKU ID
778  *	7  ~ 0	:	Assembly ID
779  *	port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
780  */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)781 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
782 {
783 	unsigned int ass, tmp, i;
784 	unsigned nid;
785 	struct alc_spec *spec = codec->spec;
786 
787 	if (spec->cdefine.fixup) {
788 		ass = spec->cdefine.sku_cfg;
789 		if (ass == ALC_FIXUP_SKU_IGNORE)
790 			return 0;
791 		goto do_sku;
792 	}
793 
794 	ass = codec->core.subsystem_id & 0xffff;
795 	if (codec->bus->pci &&
796 	    ass != codec->bus->pci->subsystem_device && (ass & 1))
797 		goto do_sku;
798 
799 	/* invalid SSID, check the special NID pin defcfg instead */
800 	/*
801 	 * 31~30	: port connectivity
802 	 * 29~21	: reserve
803 	 * 20		: PCBEEP input
804 	 * 19~16	: Check sum (15:1)
805 	 * 15~1		: Custom
806 	 * 0		: override
807 	*/
808 	nid = 0x1d;
809 	if (codec->core.vendor_id == 0x10ec0260)
810 		nid = 0x17;
811 	ass = snd_hda_codec_get_pincfg(codec, nid);
812 	codec_dbg(codec,
813 		  "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
814 		   ass, nid);
815 	if (!(ass & 1))
816 		return 0;
817 	if ((ass >> 30) != 1)	/* no physical connection */
818 		return 0;
819 
820 	/* check sum */
821 	tmp = 0;
822 	for (i = 1; i < 16; i++) {
823 		if ((ass >> i) & 1)
824 			tmp++;
825 	}
826 	if (((ass >> 16) & 0xf) != tmp)
827 		return 0;
828 do_sku:
829 	codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
830 		   ass & 0xffff, codec->core.vendor_id);
831 	/*
832 	 * 0 : override
833 	 * 1 :	Swap Jack
834 	 * 2 : 0 --> Desktop, 1 --> Laptop
835 	 * 3~5 : External Amplifier control
836 	 * 7~6 : Reserved
837 	*/
838 	tmp = (ass & 0x38) >> 3;	/* external Amp control */
839 	if (spec->init_amp == ALC_INIT_UNDEFINED) {
840 		switch (tmp) {
841 		case 1:
842 			alc_setup_gpio(codec, 0x01);
843 			break;
844 		case 3:
845 			alc_setup_gpio(codec, 0x02);
846 			break;
847 		case 7:
848 			alc_setup_gpio(codec, 0x04);
849 			break;
850 		case 5:
851 		default:
852 			spec->init_amp = ALC_INIT_DEFAULT;
853 			break;
854 		}
855 	}
856 
857 	/* is laptop or Desktop and enable the function "Mute internal speaker
858 	 * when the external headphone out jack is plugged"
859 	 */
860 	if (!(ass & 0x8000))
861 		return 1;
862 	/*
863 	 * 10~8 : Jack location
864 	 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
865 	 * 14~13: Resvered
866 	 * 15   : 1 --> enable the function "Mute internal speaker
867 	 *	        when the external headphone out jack is plugged"
868 	 */
869 	if (!alc_get_hp_pin(spec)) {
870 		hda_nid_t nid;
871 		tmp = (ass >> 11) & 0x3;	/* HP to chassis */
872 		nid = ports[tmp];
873 		if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
874 				      spec->gen.autocfg.line_outs))
875 			return 1;
876 		spec->gen.autocfg.hp_pins[0] = nid;
877 	}
878 	return 1;
879 }
880 
881 /* Check the validity of ALC subsystem-id
882  * 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)883 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
884 {
885 	if (!alc_subsystem_id(codec, ports)) {
886 		struct alc_spec *spec = codec->spec;
887 		if (spec->init_amp == ALC_INIT_UNDEFINED) {
888 			codec_dbg(codec,
889 				  "realtek: Enable default setup for auto mode as fallback\n");
890 			spec->init_amp = ALC_INIT_DEFAULT;
891 		}
892 	}
893 }
894 
895 /* inverted digital-mic */
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)896 static void alc_fixup_inv_dmic(struct hda_codec *codec,
897 			       const struct hda_fixup *fix, int action)
898 {
899 	struct alc_spec *spec = codec->spec;
900 
901 	spec->gen.inv_dmic_split = 1;
902 }
903 
904 
alc_build_controls(struct hda_codec * codec)905 static int alc_build_controls(struct hda_codec *codec)
906 {
907 	int err;
908 
909 	err = snd_hda_gen_build_controls(codec);
910 	if (err < 0)
911 		return err;
912 
913 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
914 	return 0;
915 }
916 
917 
918 /*
919  * Common callbacks
920  */
921 
alc_pre_init(struct hda_codec * codec)922 static void alc_pre_init(struct hda_codec *codec)
923 {
924 	alc_fill_eapd_coef(codec);
925 }
926 
927 #define is_s3_resume(codec) \
928 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
929 #define is_s4_resume(codec) \
930 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
931 #define is_s4_suspend(codec) \
932 	((codec)->core.dev.power.power_state.event == PM_EVENT_FREEZE)
933 
alc_init(struct hda_codec * codec)934 static int alc_init(struct hda_codec *codec)
935 {
936 	struct alc_spec *spec = codec->spec;
937 
938 	/* hibernation resume needs the full chip initialization */
939 	if (is_s4_resume(codec))
940 		alc_pre_init(codec);
941 
942 	if (spec->init_hook)
943 		spec->init_hook(codec);
944 
945 	spec->gen.skip_verbs = 1; /* applied in below */
946 	snd_hda_gen_init(codec);
947 	alc_fix_pll(codec);
948 	alc_auto_init_amp(codec, spec->init_amp);
949 	snd_hda_apply_verbs(codec); /* apply verbs here after own init */
950 
951 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
952 
953 	return 0;
954 }
955 
956 /* forward declaration */
957 static const struct component_master_ops comp_master_ops;
958 
alc_free(struct hda_codec * codec)959 static void alc_free(struct hda_codec *codec)
960 {
961 	struct alc_spec *spec = codec->spec;
962 
963 	if (spec)
964 		hda_component_manager_free(&spec->comps, &comp_master_ops);
965 
966 	snd_hda_gen_free(codec);
967 }
968 
alc_shutup(struct hda_codec * codec)969 static inline void alc_shutup(struct hda_codec *codec)
970 {
971 	struct alc_spec *spec = codec->spec;
972 
973 	if (!snd_hda_get_bool_hint(codec, "shutup"))
974 		return; /* disabled explicitly by hints */
975 
976 	if (spec && spec->shutup)
977 		spec->shutup(codec);
978 	else
979 		alc_shutup_pins(codec);
980 }
981 
alc_power_eapd(struct hda_codec * codec)982 static void alc_power_eapd(struct hda_codec *codec)
983 {
984 	alc_auto_setup_eapd(codec, false);
985 }
986 
alc_suspend(struct hda_codec * codec)987 static int alc_suspend(struct hda_codec *codec)
988 {
989 	struct alc_spec *spec = codec->spec;
990 	alc_shutup(codec);
991 	if (spec && spec->power_hook)
992 		spec->power_hook(codec);
993 	return 0;
994 }
995 
alc_resume(struct hda_codec * codec)996 static int alc_resume(struct hda_codec *codec)
997 {
998 	struct alc_spec *spec = codec->spec;
999 
1000 	if (!spec->no_depop_delay)
1001 		msleep(150); /* to avoid pop noise */
1002 	codec->patch_ops.init(codec);
1003 	snd_hda_regmap_sync(codec);
1004 	hda_call_check_power_status(codec, 0x01);
1005 	return 0;
1006 }
1007 
1008 /*
1009  */
1010 static const struct hda_codec_ops alc_patch_ops = {
1011 	.build_controls = alc_build_controls,
1012 	.build_pcms = snd_hda_gen_build_pcms,
1013 	.init = alc_init,
1014 	.free = alc_free,
1015 	.unsol_event = snd_hda_jack_unsol_event,
1016 	.resume = alc_resume,
1017 	.suspend = alc_suspend,
1018 	.check_power_status = snd_hda_gen_check_power_status,
1019 };
1020 
1021 
1022 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1023 
1024 /*
1025  * Rename codecs appropriately from COEF value or subvendor id
1026  */
1027 struct alc_codec_rename_table {
1028 	unsigned int vendor_id;
1029 	unsigned short coef_mask;
1030 	unsigned short coef_bits;
1031 	const char *name;
1032 };
1033 
1034 struct alc_codec_rename_pci_table {
1035 	unsigned int codec_vendor_id;
1036 	unsigned short pci_subvendor;
1037 	unsigned short pci_subdevice;
1038 	const char *name;
1039 };
1040 
1041 static const struct alc_codec_rename_table rename_tbl[] = {
1042 	{ 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1043 	{ 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1044 	{ 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1045 	{ 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1046 	{ 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1047 	{ 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1048 	{ 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1049 	{ 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1050 	{ 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1051 	{ 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1052 	{ 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1053 	{ 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1054 	{ 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1055 	{ 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1056 	{ 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1057 	{ 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1058 	{ 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1059 	{ } /* terminator */
1060 };
1061 
1062 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1063 	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
1064 	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
1065 	{ 0x10ec0283, 0x1028, 0, "ALC3223" },
1066 	{ 0x10ec0288, 0x1028, 0, "ALC3263" },
1067 	{ 0x10ec0292, 0x1028, 0, "ALC3226" },
1068 	{ 0x10ec0293, 0x1028, 0, "ALC3235" },
1069 	{ 0x10ec0255, 0x1028, 0, "ALC3234" },
1070 	{ 0x10ec0668, 0x1028, 0, "ALC3661" },
1071 	{ 0x10ec0275, 0x1028, 0, "ALC3260" },
1072 	{ 0x10ec0899, 0x1028, 0, "ALC3861" },
1073 	{ 0x10ec0298, 0x1028, 0, "ALC3266" },
1074 	{ 0x10ec0236, 0x1028, 0, "ALC3204" },
1075 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
1076 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
1077 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
1078 	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
1079 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
1080 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
1081 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
1082 	{ 0x10ec0233, 0x1043, 0, "ALC3236" },
1083 	{ 0x10ec0280, 0x103c, 0, "ALC3228" },
1084 	{ 0x10ec0282, 0x103c, 0, "ALC3227" },
1085 	{ 0x10ec0286, 0x103c, 0, "ALC3242" },
1086 	{ 0x10ec0290, 0x103c, 0, "ALC3241" },
1087 	{ 0x10ec0668, 0x103c, 0, "ALC3662" },
1088 	{ 0x10ec0283, 0x17aa, 0, "ALC3239" },
1089 	{ 0x10ec0292, 0x17aa, 0, "ALC3232" },
1090 	{ } /* terminator */
1091 };
1092 
alc_codec_rename_from_preset(struct hda_codec * codec)1093 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1094 {
1095 	const struct alc_codec_rename_table *p;
1096 	const struct alc_codec_rename_pci_table *q;
1097 
1098 	for (p = rename_tbl; p->vendor_id; p++) {
1099 		if (p->vendor_id != codec->core.vendor_id)
1100 			continue;
1101 		if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1102 			return alc_codec_rename(codec, p->name);
1103 	}
1104 
1105 	if (!codec->bus->pci)
1106 		return 0;
1107 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1108 		if (q->codec_vendor_id != codec->core.vendor_id)
1109 			continue;
1110 		if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1111 			continue;
1112 		if (!q->pci_subdevice ||
1113 		    q->pci_subdevice == codec->bus->pci->subsystem_device)
1114 			return alc_codec_rename(codec, q->name);
1115 	}
1116 
1117 	return 0;
1118 }
1119 
1120 
1121 /*
1122  * Digital-beep handlers
1123  */
1124 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1125 
1126 /* additional beep mixers; private_value will be overwritten */
1127 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1128 	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1129 	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1130 };
1131 
1132 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1133 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1134 			int idx, int dir)
1135 {
1136 	struct snd_kcontrol_new *knew;
1137 	unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1138 	int i;
1139 
1140 	for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1141 		knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1142 					    &alc_beep_mixer[i]);
1143 		if (!knew)
1144 			return -ENOMEM;
1145 		knew->private_value = beep_amp;
1146 	}
1147 	return 0;
1148 }
1149 
1150 static const struct snd_pci_quirk beep_allow_list[] = {
1151 	SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1152 	SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1153 	SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1154 	SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1155 	SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1156 	SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1157 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1158 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1159 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1160 	/* denylist -- no beep available */
1161 	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1162 	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1163 	{}
1164 };
1165 
has_cdefine_beep(struct hda_codec * codec)1166 static inline int has_cdefine_beep(struct hda_codec *codec)
1167 {
1168 	struct alc_spec *spec = codec->spec;
1169 	const struct snd_pci_quirk *q;
1170 	q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1171 	if (q)
1172 		return q->value;
1173 	return spec->cdefine.enable_pcbeep;
1174 }
1175 #else
1176 #define set_beep_amp(spec, nid, idx, dir)	0
1177 #define has_cdefine_beep(codec)		0
1178 #endif
1179 
1180 /* parse the BIOS configuration and set up the alc_spec */
1181 /* return 1 if successful, 0 if the proper config is not found,
1182  * or a negative error code
1183  */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1184 static int alc_parse_auto_config(struct hda_codec *codec,
1185 				 const hda_nid_t *ignore_nids,
1186 				 const hda_nid_t *ssid_nids)
1187 {
1188 	struct alc_spec *spec = codec->spec;
1189 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1190 	int err;
1191 
1192 	err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1193 				       spec->parse_flags);
1194 	if (err < 0)
1195 		return err;
1196 
1197 	if (ssid_nids)
1198 		alc_ssid_check(codec, ssid_nids);
1199 
1200 	err = snd_hda_gen_parse_auto_config(codec, cfg);
1201 	if (err < 0)
1202 		return err;
1203 
1204 	return 1;
1205 }
1206 
1207 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1208 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1209 {
1210 	struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1211 	int err;
1212 
1213 	if (!spec)
1214 		return -ENOMEM;
1215 	codec->spec = spec;
1216 	snd_hda_gen_spec_init(&spec->gen);
1217 	spec->gen.mixer_nid = mixer_nid;
1218 	spec->gen.own_eapd_ctl = 1;
1219 	codec->single_adc_amp = 1;
1220 	/* FIXME: do we need this for all Realtek codec models? */
1221 	codec->spdif_status_reset = 1;
1222 	codec->forced_resume = 1;
1223 	codec->patch_ops = alc_patch_ops;
1224 	mutex_init(&spec->coef_mutex);
1225 
1226 	err = alc_codec_rename_from_preset(codec);
1227 	if (err < 0) {
1228 		kfree(spec);
1229 		return err;
1230 	}
1231 	return 0;
1232 }
1233 
alc880_parse_auto_config(struct hda_codec * codec)1234 static int alc880_parse_auto_config(struct hda_codec *codec)
1235 {
1236 	static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1237 	static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1238 	return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1239 }
1240 
1241 /*
1242  * ALC880 fix-ups
1243  */
1244 enum {
1245 	ALC880_FIXUP_GPIO1,
1246 	ALC880_FIXUP_GPIO2,
1247 	ALC880_FIXUP_MEDION_RIM,
1248 	ALC880_FIXUP_LG,
1249 	ALC880_FIXUP_LG_LW25,
1250 	ALC880_FIXUP_W810,
1251 	ALC880_FIXUP_EAPD_COEF,
1252 	ALC880_FIXUP_TCL_S700,
1253 	ALC880_FIXUP_VOL_KNOB,
1254 	ALC880_FIXUP_FUJITSU,
1255 	ALC880_FIXUP_F1734,
1256 	ALC880_FIXUP_UNIWILL,
1257 	ALC880_FIXUP_UNIWILL_DIG,
1258 	ALC880_FIXUP_Z71V,
1259 	ALC880_FIXUP_ASUS_W5A,
1260 	ALC880_FIXUP_3ST_BASE,
1261 	ALC880_FIXUP_3ST,
1262 	ALC880_FIXUP_3ST_DIG,
1263 	ALC880_FIXUP_5ST_BASE,
1264 	ALC880_FIXUP_5ST,
1265 	ALC880_FIXUP_5ST_DIG,
1266 	ALC880_FIXUP_6ST_BASE,
1267 	ALC880_FIXUP_6ST,
1268 	ALC880_FIXUP_6ST_DIG,
1269 	ALC880_FIXUP_6ST_AUTOMUTE,
1270 };
1271 
1272 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1273 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1274 				  const struct hda_fixup *fix, int action)
1275 {
1276 	if (action == HDA_FIXUP_ACT_PROBE)
1277 		snd_hda_jack_detect_enable_callback(codec, 0x21,
1278 						    alc_update_knob_master);
1279 }
1280 
1281 static const struct hda_fixup alc880_fixups[] = {
1282 	[ALC880_FIXUP_GPIO1] = {
1283 		.type = HDA_FIXUP_FUNC,
1284 		.v.func = alc_fixup_gpio1,
1285 	},
1286 	[ALC880_FIXUP_GPIO2] = {
1287 		.type = HDA_FIXUP_FUNC,
1288 		.v.func = alc_fixup_gpio2,
1289 	},
1290 	[ALC880_FIXUP_MEDION_RIM] = {
1291 		.type = HDA_FIXUP_VERBS,
1292 		.v.verbs = (const struct hda_verb[]) {
1293 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1294 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1295 			{ }
1296 		},
1297 		.chained = true,
1298 		.chain_id = ALC880_FIXUP_GPIO2,
1299 	},
1300 	[ALC880_FIXUP_LG] = {
1301 		.type = HDA_FIXUP_PINS,
1302 		.v.pins = (const struct hda_pintbl[]) {
1303 			/* disable bogus unused pins */
1304 			{ 0x16, 0x411111f0 },
1305 			{ 0x18, 0x411111f0 },
1306 			{ 0x1a, 0x411111f0 },
1307 			{ }
1308 		}
1309 	},
1310 	[ALC880_FIXUP_LG_LW25] = {
1311 		.type = HDA_FIXUP_PINS,
1312 		.v.pins = (const struct hda_pintbl[]) {
1313 			{ 0x1a, 0x0181344f }, /* line-in */
1314 			{ 0x1b, 0x0321403f }, /* headphone */
1315 			{ }
1316 		}
1317 	},
1318 	[ALC880_FIXUP_W810] = {
1319 		.type = HDA_FIXUP_PINS,
1320 		.v.pins = (const struct hda_pintbl[]) {
1321 			/* disable bogus unused pins */
1322 			{ 0x17, 0x411111f0 },
1323 			{ }
1324 		},
1325 		.chained = true,
1326 		.chain_id = ALC880_FIXUP_GPIO2,
1327 	},
1328 	[ALC880_FIXUP_EAPD_COEF] = {
1329 		.type = HDA_FIXUP_VERBS,
1330 		.v.verbs = (const struct hda_verb[]) {
1331 			/* change to EAPD mode */
1332 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1333 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1334 			{}
1335 		},
1336 	},
1337 	[ALC880_FIXUP_TCL_S700] = {
1338 		.type = HDA_FIXUP_VERBS,
1339 		.v.verbs = (const struct hda_verb[]) {
1340 			/* change to EAPD mode */
1341 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1342 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3070 },
1343 			{}
1344 		},
1345 		.chained = true,
1346 		.chain_id = ALC880_FIXUP_GPIO2,
1347 	},
1348 	[ALC880_FIXUP_VOL_KNOB] = {
1349 		.type = HDA_FIXUP_FUNC,
1350 		.v.func = alc880_fixup_vol_knob,
1351 	},
1352 	[ALC880_FIXUP_FUJITSU] = {
1353 		/* override all pins as BIOS on old Amilo is broken */
1354 		.type = HDA_FIXUP_PINS,
1355 		.v.pins = (const struct hda_pintbl[]) {
1356 			{ 0x14, 0x0121401f }, /* HP */
1357 			{ 0x15, 0x99030120 }, /* speaker */
1358 			{ 0x16, 0x99030130 }, /* bass speaker */
1359 			{ 0x17, 0x411111f0 }, /* N/A */
1360 			{ 0x18, 0x411111f0 }, /* N/A */
1361 			{ 0x19, 0x01a19950 }, /* mic-in */
1362 			{ 0x1a, 0x411111f0 }, /* N/A */
1363 			{ 0x1b, 0x411111f0 }, /* N/A */
1364 			{ 0x1c, 0x411111f0 }, /* N/A */
1365 			{ 0x1d, 0x411111f0 }, /* N/A */
1366 			{ 0x1e, 0x01454140 }, /* SPDIF out */
1367 			{ }
1368 		},
1369 		.chained = true,
1370 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1371 	},
1372 	[ALC880_FIXUP_F1734] = {
1373 		/* almost compatible with FUJITSU, but no bass and SPDIF */
1374 		.type = HDA_FIXUP_PINS,
1375 		.v.pins = (const struct hda_pintbl[]) {
1376 			{ 0x14, 0x0121401f }, /* HP */
1377 			{ 0x15, 0x99030120 }, /* speaker */
1378 			{ 0x16, 0x411111f0 }, /* N/A */
1379 			{ 0x17, 0x411111f0 }, /* N/A */
1380 			{ 0x18, 0x411111f0 }, /* N/A */
1381 			{ 0x19, 0x01a19950 }, /* mic-in */
1382 			{ 0x1a, 0x411111f0 }, /* N/A */
1383 			{ 0x1b, 0x411111f0 }, /* N/A */
1384 			{ 0x1c, 0x411111f0 }, /* N/A */
1385 			{ 0x1d, 0x411111f0 }, /* N/A */
1386 			{ 0x1e, 0x411111f0 }, /* N/A */
1387 			{ }
1388 		},
1389 		.chained = true,
1390 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1391 	},
1392 	[ALC880_FIXUP_UNIWILL] = {
1393 		/* need to fix HP and speaker pins to be parsed correctly */
1394 		.type = HDA_FIXUP_PINS,
1395 		.v.pins = (const struct hda_pintbl[]) {
1396 			{ 0x14, 0x0121411f }, /* HP */
1397 			{ 0x15, 0x99030120 }, /* speaker */
1398 			{ 0x16, 0x99030130 }, /* bass speaker */
1399 			{ }
1400 		},
1401 	},
1402 	[ALC880_FIXUP_UNIWILL_DIG] = {
1403 		.type = HDA_FIXUP_PINS,
1404 		.v.pins = (const struct hda_pintbl[]) {
1405 			/* disable bogus unused pins */
1406 			{ 0x17, 0x411111f0 },
1407 			{ 0x19, 0x411111f0 },
1408 			{ 0x1b, 0x411111f0 },
1409 			{ 0x1f, 0x411111f0 },
1410 			{ }
1411 		}
1412 	},
1413 	[ALC880_FIXUP_Z71V] = {
1414 		.type = HDA_FIXUP_PINS,
1415 		.v.pins = (const struct hda_pintbl[]) {
1416 			/* set up the whole pins as BIOS is utterly broken */
1417 			{ 0x14, 0x99030120 }, /* speaker */
1418 			{ 0x15, 0x0121411f }, /* HP */
1419 			{ 0x16, 0x411111f0 }, /* N/A */
1420 			{ 0x17, 0x411111f0 }, /* N/A */
1421 			{ 0x18, 0x01a19950 }, /* mic-in */
1422 			{ 0x19, 0x411111f0 }, /* N/A */
1423 			{ 0x1a, 0x01813031 }, /* line-in */
1424 			{ 0x1b, 0x411111f0 }, /* N/A */
1425 			{ 0x1c, 0x411111f0 }, /* N/A */
1426 			{ 0x1d, 0x411111f0 }, /* N/A */
1427 			{ 0x1e, 0x0144111e }, /* SPDIF */
1428 			{ }
1429 		}
1430 	},
1431 	[ALC880_FIXUP_ASUS_W5A] = {
1432 		.type = HDA_FIXUP_PINS,
1433 		.v.pins = (const struct hda_pintbl[]) {
1434 			/* set up the whole pins as BIOS is utterly broken */
1435 			{ 0x14, 0x0121411f }, /* HP */
1436 			{ 0x15, 0x411111f0 }, /* N/A */
1437 			{ 0x16, 0x411111f0 }, /* N/A */
1438 			{ 0x17, 0x411111f0 }, /* N/A */
1439 			{ 0x18, 0x90a60160 }, /* mic */
1440 			{ 0x19, 0x411111f0 }, /* N/A */
1441 			{ 0x1a, 0x411111f0 }, /* N/A */
1442 			{ 0x1b, 0x411111f0 }, /* N/A */
1443 			{ 0x1c, 0x411111f0 }, /* N/A */
1444 			{ 0x1d, 0x411111f0 }, /* N/A */
1445 			{ 0x1e, 0xb743111e }, /* SPDIF out */
1446 			{ }
1447 		},
1448 		.chained = true,
1449 		.chain_id = ALC880_FIXUP_GPIO1,
1450 	},
1451 	[ALC880_FIXUP_3ST_BASE] = {
1452 		.type = HDA_FIXUP_PINS,
1453 		.v.pins = (const struct hda_pintbl[]) {
1454 			{ 0x14, 0x01014010 }, /* line-out */
1455 			{ 0x15, 0x411111f0 }, /* N/A */
1456 			{ 0x16, 0x411111f0 }, /* N/A */
1457 			{ 0x17, 0x411111f0 }, /* N/A */
1458 			{ 0x18, 0x01a19c30 }, /* mic-in */
1459 			{ 0x19, 0x0121411f }, /* HP */
1460 			{ 0x1a, 0x01813031 }, /* line-in */
1461 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1462 			{ 0x1c, 0x411111f0 }, /* N/A */
1463 			{ 0x1d, 0x411111f0 }, /* N/A */
1464 			/* 0x1e is filled in below */
1465 			{ 0x1f, 0x411111f0 }, /* N/A */
1466 			{ }
1467 		}
1468 	},
1469 	[ALC880_FIXUP_3ST] = {
1470 		.type = HDA_FIXUP_PINS,
1471 		.v.pins = (const struct hda_pintbl[]) {
1472 			{ 0x1e, 0x411111f0 }, /* N/A */
1473 			{ }
1474 		},
1475 		.chained = true,
1476 		.chain_id = ALC880_FIXUP_3ST_BASE,
1477 	},
1478 	[ALC880_FIXUP_3ST_DIG] = {
1479 		.type = HDA_FIXUP_PINS,
1480 		.v.pins = (const struct hda_pintbl[]) {
1481 			{ 0x1e, 0x0144111e }, /* SPDIF */
1482 			{ }
1483 		},
1484 		.chained = true,
1485 		.chain_id = ALC880_FIXUP_3ST_BASE,
1486 	},
1487 	[ALC880_FIXUP_5ST_BASE] = {
1488 		.type = HDA_FIXUP_PINS,
1489 		.v.pins = (const struct hda_pintbl[]) {
1490 			{ 0x14, 0x01014010 }, /* front */
1491 			{ 0x15, 0x411111f0 }, /* N/A */
1492 			{ 0x16, 0x01011411 }, /* CLFE */
1493 			{ 0x17, 0x01016412 }, /* surr */
1494 			{ 0x18, 0x01a19c30 }, /* mic-in */
1495 			{ 0x19, 0x0121411f }, /* HP */
1496 			{ 0x1a, 0x01813031 }, /* line-in */
1497 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1498 			{ 0x1c, 0x411111f0 }, /* N/A */
1499 			{ 0x1d, 0x411111f0 }, /* N/A */
1500 			/* 0x1e is filled in below */
1501 			{ 0x1f, 0x411111f0 }, /* N/A */
1502 			{ }
1503 		}
1504 	},
1505 	[ALC880_FIXUP_5ST] = {
1506 		.type = HDA_FIXUP_PINS,
1507 		.v.pins = (const struct hda_pintbl[]) {
1508 			{ 0x1e, 0x411111f0 }, /* N/A */
1509 			{ }
1510 		},
1511 		.chained = true,
1512 		.chain_id = ALC880_FIXUP_5ST_BASE,
1513 	},
1514 	[ALC880_FIXUP_5ST_DIG] = {
1515 		.type = HDA_FIXUP_PINS,
1516 		.v.pins = (const struct hda_pintbl[]) {
1517 			{ 0x1e, 0x0144111e }, /* SPDIF */
1518 			{ }
1519 		},
1520 		.chained = true,
1521 		.chain_id = ALC880_FIXUP_5ST_BASE,
1522 	},
1523 	[ALC880_FIXUP_6ST_BASE] = {
1524 		.type = HDA_FIXUP_PINS,
1525 		.v.pins = (const struct hda_pintbl[]) {
1526 			{ 0x14, 0x01014010 }, /* front */
1527 			{ 0x15, 0x01016412 }, /* surr */
1528 			{ 0x16, 0x01011411 }, /* CLFE */
1529 			{ 0x17, 0x01012414 }, /* side */
1530 			{ 0x18, 0x01a19c30 }, /* mic-in */
1531 			{ 0x19, 0x02a19c40 }, /* front-mic */
1532 			{ 0x1a, 0x01813031 }, /* line-in */
1533 			{ 0x1b, 0x0121411f }, /* HP */
1534 			{ 0x1c, 0x411111f0 }, /* N/A */
1535 			{ 0x1d, 0x411111f0 }, /* N/A */
1536 			/* 0x1e is filled in below */
1537 			{ 0x1f, 0x411111f0 }, /* N/A */
1538 			{ }
1539 		}
1540 	},
1541 	[ALC880_FIXUP_6ST] = {
1542 		.type = HDA_FIXUP_PINS,
1543 		.v.pins = (const struct hda_pintbl[]) {
1544 			{ 0x1e, 0x411111f0 }, /* N/A */
1545 			{ }
1546 		},
1547 		.chained = true,
1548 		.chain_id = ALC880_FIXUP_6ST_BASE,
1549 	},
1550 	[ALC880_FIXUP_6ST_DIG] = {
1551 		.type = HDA_FIXUP_PINS,
1552 		.v.pins = (const struct hda_pintbl[]) {
1553 			{ 0x1e, 0x0144111e }, /* SPDIF */
1554 			{ }
1555 		},
1556 		.chained = true,
1557 		.chain_id = ALC880_FIXUP_6ST_BASE,
1558 	},
1559 	[ALC880_FIXUP_6ST_AUTOMUTE] = {
1560 		.type = HDA_FIXUP_PINS,
1561 		.v.pins = (const struct hda_pintbl[]) {
1562 			{ 0x1b, 0x0121401f }, /* HP with jack detect */
1563 			{ }
1564 		},
1565 		.chained_before = true,
1566 		.chain_id = ALC880_FIXUP_6ST_BASE,
1567 	},
1568 };
1569 
1570 static const struct hda_quirk alc880_fixup_tbl[] = {
1571 	SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1572 	SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1573 	SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1574 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1575 	SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1576 	SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1577 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1578 	SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1579 	SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1580 	SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1581 	SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1582 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1583 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1584 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1585 	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1586 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1587 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1588 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1589 	SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1590 	SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1591 	SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1592 	SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1593 	SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1594 
1595 	/* Below is the copied entries from alc880_quirks.c.
1596 	 * It's not quite sure whether BIOS sets the correct pin-config table
1597 	 * on these machines, thus they are kept to be compatible with
1598 	 * the old static quirks.  Once when it's confirmed to work without
1599 	 * these overrides, it'd be better to remove.
1600 	 */
1601 	SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1602 	SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1603 	SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1604 	SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1605 	SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1606 	SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1607 	SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1608 	SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1609 	SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1610 	SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1611 	SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1612 	SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1613 	SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1614 	SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1615 	SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1616 	SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1617 	SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1618 	SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1619 	SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1620 	SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1621 	SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1622 	SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1623 	SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1624 	SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1625 	SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1626 	SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1627 	SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1628 	SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1629 	SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1630 	SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1631 	SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1632 	SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1633 	SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1634 	/* default Intel */
1635 	SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1636 	SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1637 	SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1638 	{}
1639 };
1640 
1641 static const struct hda_model_fixup alc880_fixup_models[] = {
1642 	{.id = ALC880_FIXUP_3ST, .name = "3stack"},
1643 	{.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1644 	{.id = ALC880_FIXUP_5ST, .name = "5stack"},
1645 	{.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1646 	{.id = ALC880_FIXUP_6ST, .name = "6stack"},
1647 	{.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1648 	{.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1649 	{}
1650 };
1651 
1652 
1653 /*
1654  * OK, here we have finally the patch for ALC880
1655  */
patch_alc880(struct hda_codec * codec)1656 static int patch_alc880(struct hda_codec *codec)
1657 {
1658 	struct alc_spec *spec;
1659 	int err;
1660 
1661 	err = alc_alloc_spec(codec, 0x0b);
1662 	if (err < 0)
1663 		return err;
1664 
1665 	spec = codec->spec;
1666 	spec->gen.need_dac_fix = 1;
1667 	spec->gen.beep_nid = 0x01;
1668 
1669 	codec->patch_ops.unsol_event = alc880_unsol_event;
1670 
1671 	alc_pre_init(codec);
1672 
1673 	snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1674 		       alc880_fixups);
1675 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1676 
1677 	/* automatic parse from the BIOS config */
1678 	err = alc880_parse_auto_config(codec);
1679 	if (err < 0)
1680 		goto error;
1681 
1682 	if (!spec->gen.no_analog) {
1683 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1684 		if (err < 0)
1685 			goto error;
1686 	}
1687 
1688 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1689 
1690 	return 0;
1691 
1692  error:
1693 	alc_free(codec);
1694 	return err;
1695 }
1696 
1697 
1698 /*
1699  * ALC260 support
1700  */
alc260_parse_auto_config(struct hda_codec * codec)1701 static int alc260_parse_auto_config(struct hda_codec *codec)
1702 {
1703 	static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1704 	static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1705 	return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1706 }
1707 
1708 /*
1709  * Pin config fixes
1710  */
1711 enum {
1712 	ALC260_FIXUP_HP_DC5750,
1713 	ALC260_FIXUP_HP_PIN_0F,
1714 	ALC260_FIXUP_COEF,
1715 	ALC260_FIXUP_GPIO1,
1716 	ALC260_FIXUP_GPIO1_TOGGLE,
1717 	ALC260_FIXUP_REPLACER,
1718 	ALC260_FIXUP_HP_B1900,
1719 	ALC260_FIXUP_KN1,
1720 	ALC260_FIXUP_FSC_S7020,
1721 	ALC260_FIXUP_FSC_S7020_JWSE,
1722 	ALC260_FIXUP_VAIO_PINS,
1723 };
1724 
alc260_gpio1_automute(struct hda_codec * codec)1725 static void alc260_gpio1_automute(struct hda_codec *codec)
1726 {
1727 	struct alc_spec *spec = codec->spec;
1728 
1729 	alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1730 }
1731 
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1732 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1733 				      const struct hda_fixup *fix, int action)
1734 {
1735 	struct alc_spec *spec = codec->spec;
1736 	if (action == HDA_FIXUP_ACT_PROBE) {
1737 		/* although the machine has only one output pin, we need to
1738 		 * toggle GPIO1 according to the jack state
1739 		 */
1740 		spec->gen.automute_hook = alc260_gpio1_automute;
1741 		spec->gen.detect_hp = 1;
1742 		spec->gen.automute_speaker = 1;
1743 		spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1744 		snd_hda_jack_detect_enable_callback(codec, 0x0f,
1745 						    snd_hda_gen_hp_automute);
1746 		alc_setup_gpio(codec, 0x01);
1747 	}
1748 }
1749 
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1750 static void alc260_fixup_kn1(struct hda_codec *codec,
1751 			     const struct hda_fixup *fix, int action)
1752 {
1753 	struct alc_spec *spec = codec->spec;
1754 	static const struct hda_pintbl pincfgs[] = {
1755 		{ 0x0f, 0x02214000 }, /* HP/speaker */
1756 		{ 0x12, 0x90a60160 }, /* int mic */
1757 		{ 0x13, 0x02a19000 }, /* ext mic */
1758 		{ 0x18, 0x01446000 }, /* SPDIF out */
1759 		/* disable bogus I/O pins */
1760 		{ 0x10, 0x411111f0 },
1761 		{ 0x11, 0x411111f0 },
1762 		{ 0x14, 0x411111f0 },
1763 		{ 0x15, 0x411111f0 },
1764 		{ 0x16, 0x411111f0 },
1765 		{ 0x17, 0x411111f0 },
1766 		{ 0x19, 0x411111f0 },
1767 		{ }
1768 	};
1769 
1770 	switch (action) {
1771 	case HDA_FIXUP_ACT_PRE_PROBE:
1772 		snd_hda_apply_pincfgs(codec, pincfgs);
1773 		spec->init_amp = ALC_INIT_NONE;
1774 		break;
1775 	}
1776 }
1777 
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1778 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1779 				   const struct hda_fixup *fix, int action)
1780 {
1781 	struct alc_spec *spec = codec->spec;
1782 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
1783 		spec->init_amp = ALC_INIT_NONE;
1784 }
1785 
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1786 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1787 				   const struct hda_fixup *fix, int action)
1788 {
1789 	struct alc_spec *spec = codec->spec;
1790 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1791 		spec->gen.add_jack_modes = 1;
1792 		spec->gen.hp_mic = 1;
1793 	}
1794 }
1795 
1796 static const struct hda_fixup alc260_fixups[] = {
1797 	[ALC260_FIXUP_HP_DC5750] = {
1798 		.type = HDA_FIXUP_PINS,
1799 		.v.pins = (const struct hda_pintbl[]) {
1800 			{ 0x11, 0x90130110 }, /* speaker */
1801 			{ }
1802 		}
1803 	},
1804 	[ALC260_FIXUP_HP_PIN_0F] = {
1805 		.type = HDA_FIXUP_PINS,
1806 		.v.pins = (const struct hda_pintbl[]) {
1807 			{ 0x0f, 0x01214000 }, /* HP */
1808 			{ }
1809 		}
1810 	},
1811 	[ALC260_FIXUP_COEF] = {
1812 		.type = HDA_FIXUP_VERBS,
1813 		.v.verbs = (const struct hda_verb[]) {
1814 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1815 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3040 },
1816 			{ }
1817 		},
1818 	},
1819 	[ALC260_FIXUP_GPIO1] = {
1820 		.type = HDA_FIXUP_FUNC,
1821 		.v.func = alc_fixup_gpio1,
1822 	},
1823 	[ALC260_FIXUP_GPIO1_TOGGLE] = {
1824 		.type = HDA_FIXUP_FUNC,
1825 		.v.func = alc260_fixup_gpio1_toggle,
1826 		.chained = true,
1827 		.chain_id = ALC260_FIXUP_HP_PIN_0F,
1828 	},
1829 	[ALC260_FIXUP_REPLACER] = {
1830 		.type = HDA_FIXUP_VERBS,
1831 		.v.verbs = (const struct hda_verb[]) {
1832 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1833 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3050 },
1834 			{ }
1835 		},
1836 		.chained = true,
1837 		.chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1838 	},
1839 	[ALC260_FIXUP_HP_B1900] = {
1840 		.type = HDA_FIXUP_FUNC,
1841 		.v.func = alc260_fixup_gpio1_toggle,
1842 		.chained = true,
1843 		.chain_id = ALC260_FIXUP_COEF,
1844 	},
1845 	[ALC260_FIXUP_KN1] = {
1846 		.type = HDA_FIXUP_FUNC,
1847 		.v.func = alc260_fixup_kn1,
1848 	},
1849 	[ALC260_FIXUP_FSC_S7020] = {
1850 		.type = HDA_FIXUP_FUNC,
1851 		.v.func = alc260_fixup_fsc_s7020,
1852 	},
1853 	[ALC260_FIXUP_FSC_S7020_JWSE] = {
1854 		.type = HDA_FIXUP_FUNC,
1855 		.v.func = alc260_fixup_fsc_s7020_jwse,
1856 		.chained = true,
1857 		.chain_id = ALC260_FIXUP_FSC_S7020,
1858 	},
1859 	[ALC260_FIXUP_VAIO_PINS] = {
1860 		.type = HDA_FIXUP_PINS,
1861 		.v.pins = (const struct hda_pintbl[]) {
1862 			/* Pin configs are missing completely on some VAIOs */
1863 			{ 0x0f, 0x01211020 },
1864 			{ 0x10, 0x0001003f },
1865 			{ 0x11, 0x411111f0 },
1866 			{ 0x12, 0x01a15930 },
1867 			{ 0x13, 0x411111f0 },
1868 			{ 0x14, 0x411111f0 },
1869 			{ 0x15, 0x411111f0 },
1870 			{ 0x16, 0x411111f0 },
1871 			{ 0x17, 0x411111f0 },
1872 			{ 0x18, 0x411111f0 },
1873 			{ 0x19, 0x411111f0 },
1874 			{ }
1875 		}
1876 	},
1877 };
1878 
1879 static const struct hda_quirk alc260_fixup_tbl[] = {
1880 	SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1881 	SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1882 	SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1883 	SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1884 	SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1885 	SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1886 	SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1887 	SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1888 	SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1889 	SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1890 	SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1891 	SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1892 	{}
1893 };
1894 
1895 static const struct hda_model_fixup alc260_fixup_models[] = {
1896 	{.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1897 	{.id = ALC260_FIXUP_COEF, .name = "coef"},
1898 	{.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1899 	{.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1900 	{}
1901 };
1902 
1903 /*
1904  */
patch_alc260(struct hda_codec * codec)1905 static int patch_alc260(struct hda_codec *codec)
1906 {
1907 	struct alc_spec *spec;
1908 	int err;
1909 
1910 	err = alc_alloc_spec(codec, 0x07);
1911 	if (err < 0)
1912 		return err;
1913 
1914 	spec = codec->spec;
1915 	/* as quite a few machines require HP amp for speaker outputs,
1916 	 * it's easier to enable it unconditionally; even if it's unneeded,
1917 	 * it's almost harmless.
1918 	 */
1919 	spec->gen.prefer_hp_amp = 1;
1920 	spec->gen.beep_nid = 0x01;
1921 
1922 	spec->shutup = alc_eapd_shutup;
1923 
1924 	alc_pre_init(codec);
1925 
1926 	snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1927 			   alc260_fixups);
1928 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1929 
1930 	/* automatic parse from the BIOS config */
1931 	err = alc260_parse_auto_config(codec);
1932 	if (err < 0)
1933 		goto error;
1934 
1935 	if (!spec->gen.no_analog) {
1936 		err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1937 		if (err < 0)
1938 			goto error;
1939 	}
1940 
1941 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1942 
1943 	return 0;
1944 
1945  error:
1946 	alc_free(codec);
1947 	return err;
1948 }
1949 
1950 
1951 /*
1952  * ALC882/883/885/888/889 support
1953  *
1954  * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1955  * configuration.  Each pin widget can choose any input DACs and a mixer.
1956  * Each ADC is connected from a mixer of all inputs.  This makes possible
1957  * 6-channel independent captures.
1958  *
1959  * In addition, an independent DAC for the multi-playback (not used in this
1960  * driver yet).
1961  */
1962 
1963 /*
1964  * Pin config fixes
1965  */
1966 enum {
1967 	ALC882_FIXUP_ABIT_AW9D_MAX,
1968 	ALC882_FIXUP_LENOVO_Y530,
1969 	ALC882_FIXUP_PB_M5210,
1970 	ALC882_FIXUP_ACER_ASPIRE_7736,
1971 	ALC882_FIXUP_ASUS_W90V,
1972 	ALC889_FIXUP_CD,
1973 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1974 	ALC889_FIXUP_VAIO_TT,
1975 	ALC888_FIXUP_EEE1601,
1976 	ALC886_FIXUP_EAPD,
1977 	ALC882_FIXUP_EAPD,
1978 	ALC883_FIXUP_EAPD,
1979 	ALC883_FIXUP_ACER_EAPD,
1980 	ALC882_FIXUP_GPIO1,
1981 	ALC882_FIXUP_GPIO2,
1982 	ALC882_FIXUP_GPIO3,
1983 	ALC889_FIXUP_COEF,
1984 	ALC882_FIXUP_ASUS_W2JC,
1985 	ALC882_FIXUP_ACER_ASPIRE_4930G,
1986 	ALC882_FIXUP_ACER_ASPIRE_8930G,
1987 	ALC882_FIXUP_ASPIRE_8930G_VERBS,
1988 	ALC885_FIXUP_MACPRO_GPIO,
1989 	ALC889_FIXUP_DAC_ROUTE,
1990 	ALC889_FIXUP_MBP_VREF,
1991 	ALC889_FIXUP_IMAC91_VREF,
1992 	ALC889_FIXUP_MBA11_VREF,
1993 	ALC889_FIXUP_MBA21_VREF,
1994 	ALC889_FIXUP_MP11_VREF,
1995 	ALC889_FIXUP_MP41_VREF,
1996 	ALC882_FIXUP_INV_DMIC,
1997 	ALC882_FIXUP_NO_PRIMARY_HP,
1998 	ALC887_FIXUP_ASUS_BASS,
1999 	ALC887_FIXUP_BASS_CHMAP,
2000 	ALC1220_FIXUP_GB_DUAL_CODECS,
2001 	ALC1220_FIXUP_GB_X570,
2002 	ALC1220_FIXUP_CLEVO_P950,
2003 	ALC1220_FIXUP_CLEVO_PB51ED,
2004 	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
2005 	ALC887_FIXUP_ASUS_AUDIO,
2006 	ALC887_FIXUP_ASUS_HMIC,
2007 	ALCS1200A_FIXUP_MIC_VREF,
2008 	ALC888VD_FIXUP_MIC_100VREF,
2009 };
2010 
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)2011 static void alc889_fixup_coef(struct hda_codec *codec,
2012 			      const struct hda_fixup *fix, int action)
2013 {
2014 	if (action != HDA_FIXUP_ACT_INIT)
2015 		return;
2016 	alc_update_coef_idx(codec, 7, 0, 0x2030);
2017 }
2018 
2019 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2020 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2021 				     const struct hda_fixup *fix, int action)
2022 {
2023 	struct alc_spec *spec = codec->spec;
2024 
2025 	spec->gpio_write_delay = true;
2026 	alc_fixup_gpio3(codec, fix, action);
2027 }
2028 
2029 /* Fix the connection of some pins for ALC889:
2030  * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2031  * work correctly (bko#42740)
2032  */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2033 static void alc889_fixup_dac_route(struct hda_codec *codec,
2034 				   const struct hda_fixup *fix, int action)
2035 {
2036 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2037 		/* fake the connections during parsing the tree */
2038 		static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2039 		static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2040 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2041 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2042 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2043 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2044 	} else if (action == HDA_FIXUP_ACT_PROBE) {
2045 		/* restore the connections */
2046 		static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2047 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2048 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2049 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2050 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2051 	}
2052 }
2053 
2054 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2055 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2056 				  const struct hda_fixup *fix, int action)
2057 {
2058 	static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2059 	struct alc_spec *spec = codec->spec;
2060 	int i;
2061 
2062 	if (action != HDA_FIXUP_ACT_INIT)
2063 		return;
2064 	for (i = 0; i < ARRAY_SIZE(nids); i++) {
2065 		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2066 		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2067 			continue;
2068 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2069 		val |= AC_PINCTL_VREF_80;
2070 		snd_hda_set_pin_ctl(codec, nids[i], val);
2071 		spec->gen.keep_vref_in_automute = 1;
2072 		break;
2073 	}
2074 }
2075 
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2076 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2077 				  const hda_nid_t *nids, int num_nids)
2078 {
2079 	struct alc_spec *spec = codec->spec;
2080 	int i;
2081 
2082 	for (i = 0; i < num_nids; i++) {
2083 		unsigned int val;
2084 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2085 		val |= AC_PINCTL_VREF_50;
2086 		snd_hda_set_pin_ctl(codec, nids[i], val);
2087 	}
2088 	spec->gen.keep_vref_in_automute = 1;
2089 }
2090 
2091 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2092 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2093 				     const struct hda_fixup *fix, int action)
2094 {
2095 	static const hda_nid_t nids[] = { 0x18, 0x1a };
2096 
2097 	if (action == HDA_FIXUP_ACT_INIT)
2098 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2099 }
2100 
2101 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2102 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2103 				    const struct hda_fixup *fix, int action)
2104 {
2105 	static const hda_nid_t nids[] = { 0x18 };
2106 
2107 	if (action == HDA_FIXUP_ACT_INIT)
2108 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2109 }
2110 
2111 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2112 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2113 				    const struct hda_fixup *fix, int action)
2114 {
2115 	static const hda_nid_t nids[] = { 0x18, 0x19 };
2116 
2117 	if (action == HDA_FIXUP_ACT_INIT)
2118 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2119 }
2120 
2121 /* Don't take HP output as primary
2122  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2123  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2124  */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2125 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2126 				       const struct hda_fixup *fix, int action)
2127 {
2128 	struct alc_spec *spec = codec->spec;
2129 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2130 		spec->gen.no_primary_hp = 1;
2131 		spec->gen.no_multi_io = 1;
2132 	}
2133 }
2134 
2135 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2136 				 const struct hda_fixup *fix, int action);
2137 
2138 /* For dual-codec configuration, we need to disable some features to avoid
2139  * conflicts of kctls and PCM streams
2140  */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2141 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2142 				  const struct hda_fixup *fix, int action)
2143 {
2144 	struct alc_spec *spec = codec->spec;
2145 
2146 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2147 		return;
2148 	/* disable vmaster */
2149 	spec->gen.suppress_vmaster = 1;
2150 	/* auto-mute and auto-mic switch don't work with multiple codecs */
2151 	spec->gen.suppress_auto_mute = 1;
2152 	spec->gen.suppress_auto_mic = 1;
2153 	/* disable aamix as well */
2154 	spec->gen.mixer_nid = 0;
2155 	/* add location prefix to avoid conflicts */
2156 	codec->force_pin_prefix = 1;
2157 }
2158 
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2159 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2160 		       const char *newname)
2161 {
2162 	struct snd_kcontrol *kctl;
2163 
2164 	kctl = snd_hda_find_mixer_ctl(codec, oldname);
2165 	if (kctl)
2166 		snd_ctl_rename(codec->card, kctl, newname);
2167 }
2168 
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2169 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2170 					 const struct hda_fixup *fix,
2171 					 int action)
2172 {
2173 	alc_fixup_dual_codecs(codec, fix, action);
2174 	switch (action) {
2175 	case HDA_FIXUP_ACT_PRE_PROBE:
2176 		/* override card longname to provide a unique UCM profile */
2177 		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2178 		break;
2179 	case HDA_FIXUP_ACT_BUILD:
2180 		/* rename Capture controls depending on the codec */
2181 		rename_ctl(codec, "Capture Volume",
2182 			   codec->addr == 0 ?
2183 			   "Rear-Panel Capture Volume" :
2184 			   "Front-Panel Capture Volume");
2185 		rename_ctl(codec, "Capture Switch",
2186 			   codec->addr == 0 ?
2187 			   "Rear-Panel Capture Switch" :
2188 			   "Front-Panel Capture Switch");
2189 		break;
2190 	}
2191 }
2192 
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2193 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2194 				     const struct hda_fixup *fix,
2195 				     int action)
2196 {
2197 	static const hda_nid_t conn1[] = { 0x0c };
2198 	static const struct coef_fw gb_x570_coefs[] = {
2199 		WRITE_COEF(0x07, 0x03c0),
2200 		WRITE_COEF(0x1a, 0x01c1),
2201 		WRITE_COEF(0x1b, 0x0202),
2202 		WRITE_COEF(0x43, 0x3005),
2203 		{}
2204 	};
2205 
2206 	switch (action) {
2207 	case HDA_FIXUP_ACT_PRE_PROBE:
2208 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2209 		snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2210 		break;
2211 	case HDA_FIXUP_ACT_INIT:
2212 		alc_process_coef_fw(codec, gb_x570_coefs);
2213 		break;
2214 	}
2215 }
2216 
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2217 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2218 				     const struct hda_fixup *fix,
2219 				     int action)
2220 {
2221 	static const hda_nid_t conn1[] = { 0x0c };
2222 
2223 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2224 		return;
2225 
2226 	alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2227 	/* We therefore want to make sure 0x14 (front headphone) and
2228 	 * 0x1b (speakers) use the stereo DAC 0x02
2229 	 */
2230 	snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2231 	snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2232 }
2233 
2234 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2235 				const struct hda_fixup *fix, int action);
2236 
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2237 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2238 				     const struct hda_fixup *fix,
2239 				     int action)
2240 {
2241 	alc1220_fixup_clevo_p950(codec, fix, action);
2242 	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2243 }
2244 
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2245 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2246 					 struct hda_jack_callback *jack)
2247 {
2248 	struct alc_spec *spec = codec->spec;
2249 	unsigned int vref;
2250 
2251 	snd_hda_gen_hp_automute(codec, jack);
2252 
2253 	if (spec->gen.hp_jack_present)
2254 		vref = AC_PINCTL_VREF_80;
2255 	else
2256 		vref = AC_PINCTL_VREF_HIZ;
2257 	snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2258 }
2259 
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2260 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2261 				     const struct hda_fixup *fix, int action)
2262 {
2263 	struct alc_spec *spec = codec->spec;
2264 	if (action != HDA_FIXUP_ACT_PROBE)
2265 		return;
2266 	snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2267 	spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2268 }
2269 
2270 static const struct hda_fixup alc882_fixups[] = {
2271 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
2272 		.type = HDA_FIXUP_PINS,
2273 		.v.pins = (const struct hda_pintbl[]) {
2274 			{ 0x15, 0x01080104 }, /* side */
2275 			{ 0x16, 0x01011012 }, /* rear */
2276 			{ 0x17, 0x01016011 }, /* clfe */
2277 			{ }
2278 		}
2279 	},
2280 	[ALC882_FIXUP_LENOVO_Y530] = {
2281 		.type = HDA_FIXUP_PINS,
2282 		.v.pins = (const struct hda_pintbl[]) {
2283 			{ 0x15, 0x99130112 }, /* rear int speakers */
2284 			{ 0x16, 0x99130111 }, /* subwoofer */
2285 			{ }
2286 		}
2287 	},
2288 	[ALC882_FIXUP_PB_M5210] = {
2289 		.type = HDA_FIXUP_PINCTLS,
2290 		.v.pins = (const struct hda_pintbl[]) {
2291 			{ 0x19, PIN_VREF50 },
2292 			{}
2293 		}
2294 	},
2295 	[ALC882_FIXUP_ACER_ASPIRE_7736] = {
2296 		.type = HDA_FIXUP_FUNC,
2297 		.v.func = alc_fixup_sku_ignore,
2298 	},
2299 	[ALC882_FIXUP_ASUS_W90V] = {
2300 		.type = HDA_FIXUP_PINS,
2301 		.v.pins = (const struct hda_pintbl[]) {
2302 			{ 0x16, 0x99130110 }, /* fix sequence for CLFE */
2303 			{ }
2304 		}
2305 	},
2306 	[ALC889_FIXUP_CD] = {
2307 		.type = HDA_FIXUP_PINS,
2308 		.v.pins = (const struct hda_pintbl[]) {
2309 			{ 0x1c, 0x993301f0 }, /* CD */
2310 			{ }
2311 		}
2312 	},
2313 	[ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2314 		.type = HDA_FIXUP_PINS,
2315 		.v.pins = (const struct hda_pintbl[]) {
2316 			{ 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2317 			{ }
2318 		},
2319 		.chained = true,
2320 		.chain_id = ALC889_FIXUP_CD,
2321 	},
2322 	[ALC889_FIXUP_VAIO_TT] = {
2323 		.type = HDA_FIXUP_PINS,
2324 		.v.pins = (const struct hda_pintbl[]) {
2325 			{ 0x17, 0x90170111 }, /* hidden surround speaker */
2326 			{ }
2327 		}
2328 	},
2329 	[ALC888_FIXUP_EEE1601] = {
2330 		.type = HDA_FIXUP_VERBS,
2331 		.v.verbs = (const struct hda_verb[]) {
2332 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2333 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x0838 },
2334 			{ }
2335 		}
2336 	},
2337 	[ALC886_FIXUP_EAPD] = {
2338 		.type = HDA_FIXUP_VERBS,
2339 		.v.verbs = (const struct hda_verb[]) {
2340 			/* change to EAPD mode */
2341 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2342 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2343 			{ }
2344 		}
2345 	},
2346 	[ALC882_FIXUP_EAPD] = {
2347 		.type = HDA_FIXUP_VERBS,
2348 		.v.verbs = (const struct hda_verb[]) {
2349 			/* change to EAPD mode */
2350 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2351 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2352 			{ }
2353 		}
2354 	},
2355 	[ALC883_FIXUP_EAPD] = {
2356 		.type = HDA_FIXUP_VERBS,
2357 		.v.verbs = (const struct hda_verb[]) {
2358 			/* change to EAPD mode */
2359 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2360 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2361 			{ }
2362 		}
2363 	},
2364 	[ALC883_FIXUP_ACER_EAPD] = {
2365 		.type = HDA_FIXUP_VERBS,
2366 		.v.verbs = (const struct hda_verb[]) {
2367 			/* eanable EAPD on Acer laptops */
2368 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2369 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2370 			{ }
2371 		}
2372 	},
2373 	[ALC882_FIXUP_GPIO1] = {
2374 		.type = HDA_FIXUP_FUNC,
2375 		.v.func = alc_fixup_gpio1,
2376 	},
2377 	[ALC882_FIXUP_GPIO2] = {
2378 		.type = HDA_FIXUP_FUNC,
2379 		.v.func = alc_fixup_gpio2,
2380 	},
2381 	[ALC882_FIXUP_GPIO3] = {
2382 		.type = HDA_FIXUP_FUNC,
2383 		.v.func = alc_fixup_gpio3,
2384 	},
2385 	[ALC882_FIXUP_ASUS_W2JC] = {
2386 		.type = HDA_FIXUP_FUNC,
2387 		.v.func = alc_fixup_gpio1,
2388 		.chained = true,
2389 		.chain_id = ALC882_FIXUP_EAPD,
2390 	},
2391 	[ALC889_FIXUP_COEF] = {
2392 		.type = HDA_FIXUP_FUNC,
2393 		.v.func = alc889_fixup_coef,
2394 	},
2395 	[ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2396 		.type = HDA_FIXUP_PINS,
2397 		.v.pins = (const struct hda_pintbl[]) {
2398 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2399 			{ 0x17, 0x99130112 }, /* surround speaker */
2400 			{ }
2401 		},
2402 		.chained = true,
2403 		.chain_id = ALC882_FIXUP_GPIO1,
2404 	},
2405 	[ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2406 		.type = HDA_FIXUP_PINS,
2407 		.v.pins = (const struct hda_pintbl[]) {
2408 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2409 			{ 0x1b, 0x99130112 }, /* surround speaker */
2410 			{ }
2411 		},
2412 		.chained = true,
2413 		.chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2414 	},
2415 	[ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2416 		/* additional init verbs for Acer Aspire 8930G */
2417 		.type = HDA_FIXUP_VERBS,
2418 		.v.verbs = (const struct hda_verb[]) {
2419 			/* Enable all DACs */
2420 			/* DAC DISABLE/MUTE 1? */
2421 			/*  setting bits 1-5 disables DAC nids 0x02-0x06
2422 			 *  apparently. Init=0x38 */
2423 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2424 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2425 			/* DAC DISABLE/MUTE 2? */
2426 			/*  some bit here disables the other DACs.
2427 			 *  Init=0x4900 */
2428 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2429 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2430 			/* DMIC fix
2431 			 * This laptop has a stereo digital microphone.
2432 			 * The mics are only 1cm apart which makes the stereo
2433 			 * useless. However, either the mic or the ALC889
2434 			 * makes the signal become a difference/sum signal
2435 			 * instead of standard stereo, which is annoying.
2436 			 * So instead we flip this bit which makes the
2437 			 * codec replicate the sum signal to both channels,
2438 			 * turning it into a normal mono mic.
2439 			 */
2440 			/* DMIC_CONTROL? Init value = 0x0001 */
2441 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2442 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2443 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2444 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2445 			{ }
2446 		},
2447 		.chained = true,
2448 		.chain_id = ALC882_FIXUP_GPIO1,
2449 	},
2450 	[ALC885_FIXUP_MACPRO_GPIO] = {
2451 		.type = HDA_FIXUP_FUNC,
2452 		.v.func = alc885_fixup_macpro_gpio,
2453 	},
2454 	[ALC889_FIXUP_DAC_ROUTE] = {
2455 		.type = HDA_FIXUP_FUNC,
2456 		.v.func = alc889_fixup_dac_route,
2457 	},
2458 	[ALC889_FIXUP_MBP_VREF] = {
2459 		.type = HDA_FIXUP_FUNC,
2460 		.v.func = alc889_fixup_mbp_vref,
2461 		.chained = true,
2462 		.chain_id = ALC882_FIXUP_GPIO1,
2463 	},
2464 	[ALC889_FIXUP_IMAC91_VREF] = {
2465 		.type = HDA_FIXUP_FUNC,
2466 		.v.func = alc889_fixup_imac91_vref,
2467 		.chained = true,
2468 		.chain_id = ALC882_FIXUP_GPIO1,
2469 	},
2470 	[ALC889_FIXUP_MBA11_VREF] = {
2471 		.type = HDA_FIXUP_FUNC,
2472 		.v.func = alc889_fixup_mba11_vref,
2473 		.chained = true,
2474 		.chain_id = ALC889_FIXUP_MBP_VREF,
2475 	},
2476 	[ALC889_FIXUP_MBA21_VREF] = {
2477 		.type = HDA_FIXUP_FUNC,
2478 		.v.func = alc889_fixup_mba21_vref,
2479 		.chained = true,
2480 		.chain_id = ALC889_FIXUP_MBP_VREF,
2481 	},
2482 	[ALC889_FIXUP_MP11_VREF] = {
2483 		.type = HDA_FIXUP_FUNC,
2484 		.v.func = alc889_fixup_mba11_vref,
2485 		.chained = true,
2486 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2487 	},
2488 	[ALC889_FIXUP_MP41_VREF] = {
2489 		.type = HDA_FIXUP_FUNC,
2490 		.v.func = alc889_fixup_mbp_vref,
2491 		.chained = true,
2492 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2493 	},
2494 	[ALC882_FIXUP_INV_DMIC] = {
2495 		.type = HDA_FIXUP_FUNC,
2496 		.v.func = alc_fixup_inv_dmic,
2497 	},
2498 	[ALC882_FIXUP_NO_PRIMARY_HP] = {
2499 		.type = HDA_FIXUP_FUNC,
2500 		.v.func = alc882_fixup_no_primary_hp,
2501 	},
2502 	[ALC887_FIXUP_ASUS_BASS] = {
2503 		.type = HDA_FIXUP_PINS,
2504 		.v.pins = (const struct hda_pintbl[]) {
2505 			{0x16, 0x99130130}, /* bass speaker */
2506 			{}
2507 		},
2508 		.chained = true,
2509 		.chain_id = ALC887_FIXUP_BASS_CHMAP,
2510 	},
2511 	[ALC887_FIXUP_BASS_CHMAP] = {
2512 		.type = HDA_FIXUP_FUNC,
2513 		.v.func = alc_fixup_bass_chmap,
2514 	},
2515 	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
2516 		.type = HDA_FIXUP_FUNC,
2517 		.v.func = alc1220_fixup_gb_dual_codecs,
2518 	},
2519 	[ALC1220_FIXUP_GB_X570] = {
2520 		.type = HDA_FIXUP_FUNC,
2521 		.v.func = alc1220_fixup_gb_x570,
2522 	},
2523 	[ALC1220_FIXUP_CLEVO_P950] = {
2524 		.type = HDA_FIXUP_FUNC,
2525 		.v.func = alc1220_fixup_clevo_p950,
2526 	},
2527 	[ALC1220_FIXUP_CLEVO_PB51ED] = {
2528 		.type = HDA_FIXUP_FUNC,
2529 		.v.func = alc1220_fixup_clevo_pb51ed,
2530 	},
2531 	[ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2532 		.type = HDA_FIXUP_PINS,
2533 		.v.pins = (const struct hda_pintbl[]) {
2534 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2535 			{}
2536 		},
2537 		.chained = true,
2538 		.chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2539 	},
2540 	[ALC887_FIXUP_ASUS_AUDIO] = {
2541 		.type = HDA_FIXUP_PINS,
2542 		.v.pins = (const struct hda_pintbl[]) {
2543 			{ 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2544 			{ 0x19, 0x22219420 },
2545 			{}
2546 		},
2547 	},
2548 	[ALC887_FIXUP_ASUS_HMIC] = {
2549 		.type = HDA_FIXUP_FUNC,
2550 		.v.func = alc887_fixup_asus_jack,
2551 		.chained = true,
2552 		.chain_id = ALC887_FIXUP_ASUS_AUDIO,
2553 	},
2554 	[ALCS1200A_FIXUP_MIC_VREF] = {
2555 		.type = HDA_FIXUP_PINCTLS,
2556 		.v.pins = (const struct hda_pintbl[]) {
2557 			{ 0x18, PIN_VREF50 }, /* rear mic */
2558 			{ 0x19, PIN_VREF50 }, /* front mic */
2559 			{}
2560 		}
2561 	},
2562 	[ALC888VD_FIXUP_MIC_100VREF] = {
2563 		.type = HDA_FIXUP_PINCTLS,
2564 		.v.pins = (const struct hda_pintbl[]) {
2565 			{ 0x18, PIN_VREF100 }, /* headset mic */
2566 			{}
2567 		}
2568 	},
2569 };
2570 
2571 static const struct hda_quirk alc882_fixup_tbl[] = {
2572 	SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2573 	SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2574 	SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2575 	SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2576 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2577 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2578 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2579 	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2580 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2581 	SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2582 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2583 	SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2584 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2585 	SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2586 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2587 	SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2588 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2589 	SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2590 	SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2591 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2592 	SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2593 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2594 	SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2595 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2596 	SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2597 	SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2598 	SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2599 	SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2600 	SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2601 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2602 	SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2603 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2604 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2605 	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2606 	SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2607 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2608 	SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2609 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2610 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2611 	SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2612 
2613 	/* All Apple entries are in codec SSIDs */
2614 	SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2615 	SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2616 	SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2617 	SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2618 	SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2619 	SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2620 	SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2621 	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2622 	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2623 	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2624 	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2625 	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2626 	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2627 	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2628 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2629 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2630 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2631 	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2632 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2633 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2634 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2635 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2636 
2637 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2638 	SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2639 	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2640 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2641 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2642 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2643 	SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2644 	SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2645 	SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2646 	SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2647 	SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2648 	SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2649 	SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2650 	SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2651 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2652 	SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2653 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2654 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2655 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2656 	SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 	SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 	SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 	SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 	SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2661 	SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2662 	SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2663 	SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2664 	SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2665 	SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2666 	SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2667 	SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2668 	SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2669 	SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2670 	SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2671 	SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2672 	SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2673 	SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2674 	SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2675 	SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2676 	SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2677 	SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2678 	SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2679 	SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2680 	SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2681 	SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2682 	SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2683 	SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2684 	SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2685 	SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2686 	SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2687 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2688 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2689 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2690 	SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2691 	{}
2692 };
2693 
2694 static const struct hda_model_fixup alc882_fixup_models[] = {
2695 	{.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2696 	{.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2697 	{.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2698 	{.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2699 	{.id = ALC889_FIXUP_CD, .name = "cd"},
2700 	{.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2701 	{.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2702 	{.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2703 	{.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2704 	{.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2705 	{.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2706 	{.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2707 	{.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2708 	{.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2709 	{.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2710 	{.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2711 	{.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2712 	{.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2713 	{.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2714 	{.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2715 	{.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2716 	{.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2717 	{.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2718 	{.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2719 	{.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2720 	{.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2721 	{.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2722 	{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2723 	{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2724 	{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2725 	{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2726 	{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2727 	{}
2728 };
2729 
2730 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2731 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2732 		{0x14, 0x01014010},
2733 		{0x15, 0x01011012},
2734 		{0x16, 0x01016011},
2735 		{0x18, 0x01a19040},
2736 		{0x19, 0x02a19050},
2737 		{0x1a, 0x0181304f},
2738 		{0x1b, 0x0221401f},
2739 		{0x1e, 0x01456130}),
2740 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2741 		{0x14, 0x01015010},
2742 		{0x15, 0x01011012},
2743 		{0x16, 0x01011011},
2744 		{0x18, 0x01a11040},
2745 		{0x19, 0x02a19050},
2746 		{0x1a, 0x0181104f},
2747 		{0x1b, 0x0221401f},
2748 		{0x1e, 0x01451130}),
2749 	{}
2750 };
2751 
2752 /*
2753  * BIOS auto configuration
2754  */
2755 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2756 static int alc882_parse_auto_config(struct hda_codec *codec)
2757 {
2758 	static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2759 	static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2760 	return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2761 }
2762 
2763 /*
2764  */
patch_alc882(struct hda_codec * codec)2765 static int patch_alc882(struct hda_codec *codec)
2766 {
2767 	struct alc_spec *spec;
2768 	int err;
2769 
2770 	err = alc_alloc_spec(codec, 0x0b);
2771 	if (err < 0)
2772 		return err;
2773 
2774 	spec = codec->spec;
2775 
2776 	switch (codec->core.vendor_id) {
2777 	case 0x10ec0882:
2778 	case 0x10ec0885:
2779 	case 0x10ec0900:
2780 	case 0x10ec0b00:
2781 	case 0x10ec1220:
2782 		break;
2783 	default:
2784 		/* ALC883 and variants */
2785 		alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2786 		break;
2787 	}
2788 
2789 	alc_pre_init(codec);
2790 
2791 	snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2792 		       alc882_fixups);
2793 	snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2794 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2795 
2796 	alc_auto_parse_customize_define(codec);
2797 
2798 	if (has_cdefine_beep(codec))
2799 		spec->gen.beep_nid = 0x01;
2800 
2801 	/* automatic parse from the BIOS config */
2802 	err = alc882_parse_auto_config(codec);
2803 	if (err < 0)
2804 		goto error;
2805 
2806 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2807 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2808 		if (err < 0)
2809 			goto error;
2810 	}
2811 
2812 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2813 
2814 	return 0;
2815 
2816  error:
2817 	alc_free(codec);
2818 	return err;
2819 }
2820 
2821 
2822 /*
2823  * ALC262 support
2824  */
alc262_parse_auto_config(struct hda_codec * codec)2825 static int alc262_parse_auto_config(struct hda_codec *codec)
2826 {
2827 	static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2828 	static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2829 	return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2830 }
2831 
2832 /*
2833  * Pin config fixes
2834  */
2835 enum {
2836 	ALC262_FIXUP_FSC_H270,
2837 	ALC262_FIXUP_FSC_S7110,
2838 	ALC262_FIXUP_HP_Z200,
2839 	ALC262_FIXUP_TYAN,
2840 	ALC262_FIXUP_LENOVO_3000,
2841 	ALC262_FIXUP_BENQ,
2842 	ALC262_FIXUP_BENQ_T31,
2843 	ALC262_FIXUP_INV_DMIC,
2844 	ALC262_FIXUP_INTEL_BAYLEYBAY,
2845 };
2846 
2847 static const struct hda_fixup alc262_fixups[] = {
2848 	[ALC262_FIXUP_FSC_H270] = {
2849 		.type = HDA_FIXUP_PINS,
2850 		.v.pins = (const struct hda_pintbl[]) {
2851 			{ 0x14, 0x99130110 }, /* speaker */
2852 			{ 0x15, 0x0221142f }, /* front HP */
2853 			{ 0x1b, 0x0121141f }, /* rear HP */
2854 			{ }
2855 		}
2856 	},
2857 	[ALC262_FIXUP_FSC_S7110] = {
2858 		.type = HDA_FIXUP_PINS,
2859 		.v.pins = (const struct hda_pintbl[]) {
2860 			{ 0x15, 0x90170110 }, /* speaker */
2861 			{ }
2862 		},
2863 		.chained = true,
2864 		.chain_id = ALC262_FIXUP_BENQ,
2865 	},
2866 	[ALC262_FIXUP_HP_Z200] = {
2867 		.type = HDA_FIXUP_PINS,
2868 		.v.pins = (const struct hda_pintbl[]) {
2869 			{ 0x16, 0x99130120 }, /* internal speaker */
2870 			{ }
2871 		}
2872 	},
2873 	[ALC262_FIXUP_TYAN] = {
2874 		.type = HDA_FIXUP_PINS,
2875 		.v.pins = (const struct hda_pintbl[]) {
2876 			{ 0x14, 0x1993e1f0 }, /* int AUX */
2877 			{ }
2878 		}
2879 	},
2880 	[ALC262_FIXUP_LENOVO_3000] = {
2881 		.type = HDA_FIXUP_PINCTLS,
2882 		.v.pins = (const struct hda_pintbl[]) {
2883 			{ 0x19, PIN_VREF50 },
2884 			{}
2885 		},
2886 		.chained = true,
2887 		.chain_id = ALC262_FIXUP_BENQ,
2888 	},
2889 	[ALC262_FIXUP_BENQ] = {
2890 		.type = HDA_FIXUP_VERBS,
2891 		.v.verbs = (const struct hda_verb[]) {
2892 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2893 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2894 			{}
2895 		}
2896 	},
2897 	[ALC262_FIXUP_BENQ_T31] = {
2898 		.type = HDA_FIXUP_VERBS,
2899 		.v.verbs = (const struct hda_verb[]) {
2900 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2901 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2902 			{}
2903 		}
2904 	},
2905 	[ALC262_FIXUP_INV_DMIC] = {
2906 		.type = HDA_FIXUP_FUNC,
2907 		.v.func = alc_fixup_inv_dmic,
2908 	},
2909 	[ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2910 		.type = HDA_FIXUP_FUNC,
2911 		.v.func = alc_fixup_no_depop_delay,
2912 	},
2913 };
2914 
2915 static const struct hda_quirk alc262_fixup_tbl[] = {
2916 	SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2917 	SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2918 	SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2919 	SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2920 	SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2921 	SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2922 	SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2923 	SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2924 	SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2925 	SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2926 	{}
2927 };
2928 
2929 static const struct hda_model_fixup alc262_fixup_models[] = {
2930 	{.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2931 	{.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2932 	{.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2933 	{.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2934 	{.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2935 	{.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2936 	{.id = ALC262_FIXUP_BENQ, .name = "benq"},
2937 	{.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2938 	{.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2939 	{}
2940 };
2941 
2942 /*
2943  */
patch_alc262(struct hda_codec * codec)2944 static int patch_alc262(struct hda_codec *codec)
2945 {
2946 	struct alc_spec *spec;
2947 	int err;
2948 
2949 	err = alc_alloc_spec(codec, 0x0b);
2950 	if (err < 0)
2951 		return err;
2952 
2953 	spec = codec->spec;
2954 	spec->gen.shared_mic_vref_pin = 0x18;
2955 
2956 	spec->shutup = alc_eapd_shutup;
2957 
2958 #if 0
2959 	/* pshou 07/11/05  set a zero PCM sample to DAC when FIFO is
2960 	 * under-run
2961 	 */
2962 	alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2963 #endif
2964 	alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2965 
2966 	alc_pre_init(codec);
2967 
2968 	snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2969 		       alc262_fixups);
2970 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2971 
2972 	alc_auto_parse_customize_define(codec);
2973 
2974 	if (has_cdefine_beep(codec))
2975 		spec->gen.beep_nid = 0x01;
2976 
2977 	/* automatic parse from the BIOS config */
2978 	err = alc262_parse_auto_config(codec);
2979 	if (err < 0)
2980 		goto error;
2981 
2982 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2983 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2984 		if (err < 0)
2985 			goto error;
2986 	}
2987 
2988 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2989 
2990 	return 0;
2991 
2992  error:
2993 	alc_free(codec);
2994 	return err;
2995 }
2996 
2997 /*
2998  *  ALC268
2999  */
3000 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)3001 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
3002 				  struct snd_ctl_elem_value *ucontrol)
3003 {
3004 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3005 	unsigned long pval;
3006 	int err;
3007 
3008 	mutex_lock(&codec->control_mutex);
3009 	pval = kcontrol->private_value;
3010 	kcontrol->private_value = (pval & ~0xff) | 0x0f;
3011 	err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3012 	if (err >= 0) {
3013 		kcontrol->private_value = (pval & ~0xff) | 0x10;
3014 		err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3015 	}
3016 	kcontrol->private_value = pval;
3017 	mutex_unlock(&codec->control_mutex);
3018 	return err;
3019 }
3020 
3021 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3022 	HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3023 	{
3024 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3025 		.name = "Beep Playback Switch",
3026 		.subdevice = HDA_SUBDEV_AMP_FLAG,
3027 		.info = snd_hda_mixer_amp_switch_info,
3028 		.get = snd_hda_mixer_amp_switch_get,
3029 		.put = alc268_beep_switch_put,
3030 		.private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3031 	},
3032 };
3033 
3034 /* set PCBEEP vol = 0, mute connections */
3035 static const struct hda_verb alc268_beep_init_verbs[] = {
3036 	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3037 	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3038 	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3039 	{ }
3040 };
3041 
3042 enum {
3043 	ALC268_FIXUP_INV_DMIC,
3044 	ALC268_FIXUP_HP_EAPD,
3045 	ALC268_FIXUP_SPDIF,
3046 };
3047 
3048 static const struct hda_fixup alc268_fixups[] = {
3049 	[ALC268_FIXUP_INV_DMIC] = {
3050 		.type = HDA_FIXUP_FUNC,
3051 		.v.func = alc_fixup_inv_dmic,
3052 	},
3053 	[ALC268_FIXUP_HP_EAPD] = {
3054 		.type = HDA_FIXUP_VERBS,
3055 		.v.verbs = (const struct hda_verb[]) {
3056 			{0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3057 			{}
3058 		}
3059 	},
3060 	[ALC268_FIXUP_SPDIF] = {
3061 		.type = HDA_FIXUP_PINS,
3062 		.v.pins = (const struct hda_pintbl[]) {
3063 			{ 0x1e, 0x014b1180 }, /* enable SPDIF out */
3064 			{}
3065 		}
3066 	},
3067 };
3068 
3069 static const struct hda_model_fixup alc268_fixup_models[] = {
3070 	{.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3071 	{.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3072 	{.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3073 	{}
3074 };
3075 
3076 static const struct hda_quirk alc268_fixup_tbl[] = {
3077 	SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3078 	SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3079 	/* below is codec SSID since multiple Toshiba laptops have the
3080 	 * same PCI SSID 1179:ff00
3081 	 */
3082 	SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3083 	{}
3084 };
3085 
3086 /*
3087  * BIOS auto configuration
3088  */
alc268_parse_auto_config(struct hda_codec * codec)3089 static int alc268_parse_auto_config(struct hda_codec *codec)
3090 {
3091 	static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3092 	return alc_parse_auto_config(codec, NULL, alc268_ssids);
3093 }
3094 
3095 /*
3096  */
patch_alc268(struct hda_codec * codec)3097 static int patch_alc268(struct hda_codec *codec)
3098 {
3099 	struct alc_spec *spec;
3100 	int i, err;
3101 
3102 	/* ALC268 has no aa-loopback mixer */
3103 	err = alc_alloc_spec(codec, 0);
3104 	if (err < 0)
3105 		return err;
3106 
3107 	spec = codec->spec;
3108 	if (has_cdefine_beep(codec))
3109 		spec->gen.beep_nid = 0x01;
3110 
3111 	spec->shutup = alc_eapd_shutup;
3112 
3113 	alc_pre_init(codec);
3114 
3115 	snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3116 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3117 
3118 	/* automatic parse from the BIOS config */
3119 	err = alc268_parse_auto_config(codec);
3120 	if (err < 0)
3121 		goto error;
3122 
3123 	if (err > 0 && !spec->gen.no_analog &&
3124 	    spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3125 		for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3126 			if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3127 						  &alc268_beep_mixer[i])) {
3128 				err = -ENOMEM;
3129 				goto error;
3130 			}
3131 		}
3132 		snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3133 		if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3134 			/* override the amp caps for beep generator */
3135 			snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3136 					  (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3137 					  (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3138 					  (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3139 					  (0 << AC_AMPCAP_MUTE_SHIFT));
3140 	}
3141 
3142 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3143 
3144 	return 0;
3145 
3146  error:
3147 	alc_free(codec);
3148 	return err;
3149 }
3150 
3151 /*
3152  * ALC269
3153  */
3154 
3155 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3156 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3157 };
3158 
3159 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3160 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3161 };
3162 
3163 /* different alc269-variants */
3164 enum {
3165 	ALC269_TYPE_ALC269VA,
3166 	ALC269_TYPE_ALC269VB,
3167 	ALC269_TYPE_ALC269VC,
3168 	ALC269_TYPE_ALC269VD,
3169 	ALC269_TYPE_ALC280,
3170 	ALC269_TYPE_ALC282,
3171 	ALC269_TYPE_ALC283,
3172 	ALC269_TYPE_ALC284,
3173 	ALC269_TYPE_ALC293,
3174 	ALC269_TYPE_ALC286,
3175 	ALC269_TYPE_ALC298,
3176 	ALC269_TYPE_ALC255,
3177 	ALC269_TYPE_ALC256,
3178 	ALC269_TYPE_ALC257,
3179 	ALC269_TYPE_ALC215,
3180 	ALC269_TYPE_ALC225,
3181 	ALC269_TYPE_ALC245,
3182 	ALC269_TYPE_ALC287,
3183 	ALC269_TYPE_ALC294,
3184 	ALC269_TYPE_ALC300,
3185 	ALC269_TYPE_ALC623,
3186 	ALC269_TYPE_ALC700,
3187 };
3188 
3189 /*
3190  * BIOS auto configuration
3191  */
alc269_parse_auto_config(struct hda_codec * codec)3192 static int alc269_parse_auto_config(struct hda_codec *codec)
3193 {
3194 	static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3195 	static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3196 	static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3197 	struct alc_spec *spec = codec->spec;
3198 	const hda_nid_t *ssids;
3199 
3200 	switch (spec->codec_variant) {
3201 	case ALC269_TYPE_ALC269VA:
3202 	case ALC269_TYPE_ALC269VC:
3203 	case ALC269_TYPE_ALC280:
3204 	case ALC269_TYPE_ALC284:
3205 	case ALC269_TYPE_ALC293:
3206 		ssids = alc269va_ssids;
3207 		break;
3208 	case ALC269_TYPE_ALC269VB:
3209 	case ALC269_TYPE_ALC269VD:
3210 	case ALC269_TYPE_ALC282:
3211 	case ALC269_TYPE_ALC283:
3212 	case ALC269_TYPE_ALC286:
3213 	case ALC269_TYPE_ALC298:
3214 	case ALC269_TYPE_ALC255:
3215 	case ALC269_TYPE_ALC256:
3216 	case ALC269_TYPE_ALC257:
3217 	case ALC269_TYPE_ALC215:
3218 	case ALC269_TYPE_ALC225:
3219 	case ALC269_TYPE_ALC245:
3220 	case ALC269_TYPE_ALC287:
3221 	case ALC269_TYPE_ALC294:
3222 	case ALC269_TYPE_ALC300:
3223 	case ALC269_TYPE_ALC623:
3224 	case ALC269_TYPE_ALC700:
3225 		ssids = alc269_ssids;
3226 		break;
3227 	default:
3228 		ssids = alc269_ssids;
3229 		break;
3230 	}
3231 
3232 	return alc_parse_auto_config(codec, alc269_ignore, ssids);
3233 }
3234 
3235 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3236 	{ SND_JACK_BTN_0, KEY_PLAYPAUSE },
3237 	{ SND_JACK_BTN_1, KEY_VOICECOMMAND },
3238 	{ SND_JACK_BTN_2, KEY_VOLUMEUP },
3239 	{ SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3240 	{}
3241 };
3242 
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3243 static void alc_headset_btn_callback(struct hda_codec *codec,
3244 				     struct hda_jack_callback *jack)
3245 {
3246 	int report = 0;
3247 
3248 	if (jack->unsol_res & (7 << 13))
3249 		report |= SND_JACK_BTN_0;
3250 
3251 	if (jack->unsol_res  & (1 << 16 | 3 << 8))
3252 		report |= SND_JACK_BTN_1;
3253 
3254 	/* Volume up key */
3255 	if (jack->unsol_res & (7 << 23))
3256 		report |= SND_JACK_BTN_2;
3257 
3258 	/* Volume down key */
3259 	if (jack->unsol_res & (7 << 10))
3260 		report |= SND_JACK_BTN_3;
3261 
3262 	snd_hda_jack_set_button_state(codec, jack->nid, report);
3263 }
3264 
alc_disable_headset_jack_key(struct hda_codec * codec)3265 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3266 {
3267 	struct alc_spec *spec = codec->spec;
3268 
3269 	if (!spec->has_hs_key)
3270 		return;
3271 
3272 	switch (codec->core.vendor_id) {
3273 	case 0x10ec0215:
3274 	case 0x10ec0225:
3275 	case 0x10ec0285:
3276 	case 0x10ec0287:
3277 	case 0x10ec0295:
3278 	case 0x10ec0289:
3279 	case 0x10ec0299:
3280 		alc_write_coef_idx(codec, 0x48, 0x0);
3281 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3282 		alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3283 		break;
3284 	case 0x10ec0230:
3285 	case 0x10ec0236:
3286 	case 0x10ec0256:
3287 	case 0x10ec0257:
3288 	case 0x19e58326:
3289 		alc_write_coef_idx(codec, 0x48, 0x0);
3290 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3291 		break;
3292 	}
3293 }
3294 
alc_enable_headset_jack_key(struct hda_codec * codec)3295 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3296 {
3297 	struct alc_spec *spec = codec->spec;
3298 
3299 	if (!spec->has_hs_key)
3300 		return;
3301 
3302 	switch (codec->core.vendor_id) {
3303 	case 0x10ec0215:
3304 	case 0x10ec0225:
3305 	case 0x10ec0285:
3306 	case 0x10ec0287:
3307 	case 0x10ec0295:
3308 	case 0x10ec0289:
3309 	case 0x10ec0299:
3310 		alc_write_coef_idx(codec, 0x48, 0xd011);
3311 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3312 		alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3313 		break;
3314 	case 0x10ec0230:
3315 	case 0x10ec0236:
3316 	case 0x10ec0256:
3317 	case 0x10ec0257:
3318 	case 0x19e58326:
3319 		alc_write_coef_idx(codec, 0x48, 0xd011);
3320 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3321 		break;
3322 	}
3323 }
3324 
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3325 static void alc_fixup_headset_jack(struct hda_codec *codec,
3326 				    const struct hda_fixup *fix, int action)
3327 {
3328 	struct alc_spec *spec = codec->spec;
3329 	hda_nid_t hp_pin;
3330 
3331 	switch (action) {
3332 	case HDA_FIXUP_ACT_PRE_PROBE:
3333 		spec->has_hs_key = 1;
3334 		snd_hda_jack_detect_enable_callback(codec, 0x55,
3335 						    alc_headset_btn_callback);
3336 		break;
3337 	case HDA_FIXUP_ACT_BUILD:
3338 		hp_pin = alc_get_hp_pin(spec);
3339 		if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3340 							alc_headset_btn_keymap,
3341 							hp_pin))
3342 			snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3343 					      false, SND_JACK_HEADSET,
3344 					      alc_headset_btn_keymap);
3345 
3346 		alc_enable_headset_jack_key(codec);
3347 		break;
3348 	}
3349 }
3350 
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3351 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3352 {
3353 	alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3354 }
3355 
alc269_shutup(struct hda_codec * codec)3356 static void alc269_shutup(struct hda_codec *codec)
3357 {
3358 	struct alc_spec *spec = codec->spec;
3359 
3360 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3361 		alc269vb_toggle_power_output(codec, 0);
3362 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3363 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3364 		msleep(150);
3365 	}
3366 	alc_shutup_pins(codec);
3367 }
3368 
3369 static const struct coef_fw alc282_coefs[] = {
3370 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3371 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3372 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3373 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3374 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3375 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3376 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3377 	WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3378 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3379 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3380 	WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3381 	UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3382 	WRITE_COEF(0x34, 0xa0c0), /* ANC */
3383 	UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3384 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3385 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3386 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3387 	WRITE_COEF(0x63, 0x2902), /* PLL */
3388 	WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3389 	WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3390 	WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3391 	WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3392 	UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3393 	WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3394 	UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3395 	WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3396 	WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3397 	UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3398 	WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3399 	{}
3400 };
3401 
alc282_restore_default_value(struct hda_codec * codec)3402 static void alc282_restore_default_value(struct hda_codec *codec)
3403 {
3404 	alc_process_coef_fw(codec, alc282_coefs);
3405 }
3406 
alc282_init(struct hda_codec * codec)3407 static void alc282_init(struct hda_codec *codec)
3408 {
3409 	struct alc_spec *spec = codec->spec;
3410 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3411 	bool hp_pin_sense;
3412 	int coef78;
3413 
3414 	alc282_restore_default_value(codec);
3415 
3416 	if (!hp_pin)
3417 		return;
3418 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3419 	coef78 = alc_read_coef_idx(codec, 0x78);
3420 
3421 	/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3422 	/* Headphone capless set to high power mode */
3423 	alc_write_coef_idx(codec, 0x78, 0x9004);
3424 
3425 	if (hp_pin_sense)
3426 		msleep(2);
3427 
3428 	snd_hda_codec_write(codec, hp_pin, 0,
3429 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3430 
3431 	if (hp_pin_sense)
3432 		msleep(85);
3433 
3434 	snd_hda_codec_write(codec, hp_pin, 0,
3435 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3436 
3437 	if (hp_pin_sense)
3438 		msleep(100);
3439 
3440 	/* Headphone capless set to normal mode */
3441 	alc_write_coef_idx(codec, 0x78, coef78);
3442 }
3443 
alc282_shutup(struct hda_codec * codec)3444 static void alc282_shutup(struct hda_codec *codec)
3445 {
3446 	struct alc_spec *spec = codec->spec;
3447 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3448 	bool hp_pin_sense;
3449 	int coef78;
3450 
3451 	if (!hp_pin) {
3452 		alc269_shutup(codec);
3453 		return;
3454 	}
3455 
3456 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3457 	coef78 = alc_read_coef_idx(codec, 0x78);
3458 	alc_write_coef_idx(codec, 0x78, 0x9004);
3459 
3460 	if (hp_pin_sense)
3461 		msleep(2);
3462 
3463 	snd_hda_codec_write(codec, hp_pin, 0,
3464 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3465 
3466 	if (hp_pin_sense)
3467 		msleep(85);
3468 
3469 	if (!spec->no_shutup_pins)
3470 		snd_hda_codec_write(codec, hp_pin, 0,
3471 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3472 
3473 	if (hp_pin_sense)
3474 		msleep(100);
3475 
3476 	alc_auto_setup_eapd(codec, false);
3477 	alc_shutup_pins(codec);
3478 	alc_write_coef_idx(codec, 0x78, coef78);
3479 }
3480 
3481 static const struct coef_fw alc283_coefs[] = {
3482 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3483 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3484 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3485 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3486 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3487 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3488 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3489 	WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3490 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3491 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3492 	WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3493 	UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3494 	WRITE_COEF(0x22, 0xa0c0), /* ANC */
3495 	UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3496 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3497 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3498 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3499 	WRITE_COEF(0x2e, 0x2902), /* PLL */
3500 	WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3501 	WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3502 	WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3503 	WRITE_COEF(0x36, 0x0), /* capless control 5 */
3504 	UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3505 	WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3506 	UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3507 	WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3508 	WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3509 	UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3510 	WRITE_COEF(0x49, 0x0), /* test mode */
3511 	UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3512 	UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3513 	WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3514 	UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3515 	{}
3516 };
3517 
alc283_restore_default_value(struct hda_codec * codec)3518 static void alc283_restore_default_value(struct hda_codec *codec)
3519 {
3520 	alc_process_coef_fw(codec, alc283_coefs);
3521 }
3522 
alc283_init(struct hda_codec * codec)3523 static void alc283_init(struct hda_codec *codec)
3524 {
3525 	struct alc_spec *spec = codec->spec;
3526 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3527 	bool hp_pin_sense;
3528 
3529 	alc283_restore_default_value(codec);
3530 
3531 	if (!hp_pin)
3532 		return;
3533 
3534 	msleep(30);
3535 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3536 
3537 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3538 	/* Headphone capless set to high power mode */
3539 	alc_write_coef_idx(codec, 0x43, 0x9004);
3540 
3541 	snd_hda_codec_write(codec, hp_pin, 0,
3542 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3543 
3544 	if (hp_pin_sense)
3545 		msleep(85);
3546 
3547 	snd_hda_codec_write(codec, hp_pin, 0,
3548 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3549 
3550 	if (hp_pin_sense)
3551 		msleep(85);
3552 	/* Index 0x46 Combo jack auto switch control 2 */
3553 	/* 3k pull low control for Headset jack. */
3554 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3555 	/* Headphone capless set to normal mode */
3556 	alc_write_coef_idx(codec, 0x43, 0x9614);
3557 }
3558 
alc283_shutup(struct hda_codec * codec)3559 static void alc283_shutup(struct hda_codec *codec)
3560 {
3561 	struct alc_spec *spec = codec->spec;
3562 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3563 	bool hp_pin_sense;
3564 
3565 	if (!hp_pin) {
3566 		alc269_shutup(codec);
3567 		return;
3568 	}
3569 
3570 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3571 
3572 	alc_write_coef_idx(codec, 0x43, 0x9004);
3573 
3574 	/*depop hp during suspend*/
3575 	alc_write_coef_idx(codec, 0x06, 0x2100);
3576 
3577 	snd_hda_codec_write(codec, hp_pin, 0,
3578 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3579 
3580 	if (hp_pin_sense)
3581 		msleep(100);
3582 
3583 	if (!spec->no_shutup_pins)
3584 		snd_hda_codec_write(codec, hp_pin, 0,
3585 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3586 
3587 	alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3588 
3589 	if (hp_pin_sense)
3590 		msleep(100);
3591 	alc_auto_setup_eapd(codec, false);
3592 	alc_shutup_pins(codec);
3593 	alc_write_coef_idx(codec, 0x43, 0x9614);
3594 }
3595 
alc256_init(struct hda_codec * codec)3596 static void alc256_init(struct hda_codec *codec)
3597 {
3598 	struct alc_spec *spec = codec->spec;
3599 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3600 	bool hp_pin_sense;
3601 
3602 	if (spec->ultra_low_power) {
3603 		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3604 		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3605 		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3606 		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3607 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3608 		msleep(30);
3609 	}
3610 
3611 	if (!hp_pin)
3612 		hp_pin = 0x21;
3613 
3614 	msleep(30);
3615 
3616 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3617 
3618 	if (hp_pin_sense) {
3619 		msleep(2);
3620 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3621 
3622 		snd_hda_codec_write(codec, hp_pin, 0,
3623 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3624 
3625 		msleep(75);
3626 
3627 		snd_hda_codec_write(codec, hp_pin, 0,
3628 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3629 
3630 		msleep(75);
3631 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3632 	}
3633 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3634 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3635 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3636 	/*
3637 	 * Expose headphone mic (or possibly Line In on some machines) instead
3638 	 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3639 	 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3640 	 * this register.
3641 	 */
3642 	alc_write_coef_idx(codec, 0x36, 0x5757);
3643 }
3644 
alc256_shutup(struct hda_codec * codec)3645 static void alc256_shutup(struct hda_codec *codec)
3646 {
3647 	struct alc_spec *spec = codec->spec;
3648 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3649 	bool hp_pin_sense;
3650 
3651 	if (!hp_pin)
3652 		hp_pin = 0x21;
3653 
3654 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3655 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3656 
3657 	if (hp_pin_sense) {
3658 		msleep(2);
3659 
3660 		snd_hda_codec_write(codec, hp_pin, 0,
3661 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3662 
3663 		msleep(75);
3664 
3665 	/* 3k pull low control for Headset jack. */
3666 	/* NOTE: call this before clearing the pin, otherwise codec stalls */
3667 	/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3668 	 * when booting with headset plugged. So skip setting it for the codec alc257
3669 	 */
3670 		if (spec->en_3kpull_low)
3671 			alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3672 
3673 		if (!spec->no_shutup_pins)
3674 			snd_hda_codec_write(codec, hp_pin, 0,
3675 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3676 
3677 		msleep(75);
3678 	}
3679 
3680 	alc_auto_setup_eapd(codec, false);
3681 	alc_shutup_pins(codec);
3682 	if (spec->ultra_low_power) {
3683 		msleep(50);
3684 		alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3685 		alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3686 		alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3687 		alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3688 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3689 		msleep(30);
3690 	}
3691 }
3692 
alc285_hp_init(struct hda_codec * codec)3693 static void alc285_hp_init(struct hda_codec *codec)
3694 {
3695 	struct alc_spec *spec = codec->spec;
3696 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3697 	int i, val;
3698 	int coef38, coef0d, coef36;
3699 
3700 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3701 	alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3702 	coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3703 	coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3704 	coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3705 	alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3706 	alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3707 
3708 	alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3709 
3710 	if (hp_pin)
3711 		snd_hda_codec_write(codec, hp_pin, 0,
3712 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3713 
3714 	msleep(130);
3715 	alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3716 	alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3717 
3718 	if (hp_pin)
3719 		snd_hda_codec_write(codec, hp_pin, 0,
3720 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3721 	msleep(10);
3722 	alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3723 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3724 	alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3725 	alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3726 
3727 	alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3728 	val = alc_read_coefex_idx(codec, 0x58, 0x00);
3729 	for (i = 0; i < 20 && val & 0x8000; i++) {
3730 		msleep(50);
3731 		val = alc_read_coefex_idx(codec, 0x58, 0x00);
3732 	} /* Wait for depop procedure finish  */
3733 
3734 	alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3735 	alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3736 	alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3737 	alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3738 
3739 	msleep(50);
3740 	alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3741 }
3742 
alc225_init(struct hda_codec * codec)3743 static void alc225_init(struct hda_codec *codec)
3744 {
3745 	struct alc_spec *spec = codec->spec;
3746 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3747 	bool hp1_pin_sense, hp2_pin_sense;
3748 
3749 	if (spec->ultra_low_power) {
3750 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3751 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3752 		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3753 		msleep(30);
3754 	}
3755 
3756 	if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3757 		spec->codec_variant != ALC269_TYPE_ALC245)
3758 		/* required only at boot or S3 and S4 resume time */
3759 		if (!spec->done_hp_init ||
3760 			is_s3_resume(codec) ||
3761 			is_s4_resume(codec)) {
3762 			alc285_hp_init(codec);
3763 			spec->done_hp_init = true;
3764 		}
3765 
3766 	if (!hp_pin)
3767 		hp_pin = 0x21;
3768 	msleep(30);
3769 
3770 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3771 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3772 
3773 	if (hp1_pin_sense || hp2_pin_sense) {
3774 		msleep(2);
3775 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3776 
3777 		if (hp1_pin_sense)
3778 			snd_hda_codec_write(codec, hp_pin, 0,
3779 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3780 		if (hp2_pin_sense)
3781 			snd_hda_codec_write(codec, 0x16, 0,
3782 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3783 		msleep(75);
3784 
3785 		if (hp1_pin_sense)
3786 			snd_hda_codec_write(codec, hp_pin, 0,
3787 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3788 		if (hp2_pin_sense)
3789 			snd_hda_codec_write(codec, 0x16, 0,
3790 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3791 
3792 		msleep(75);
3793 		alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3794 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3795 	}
3796 }
3797 
alc225_shutup(struct hda_codec * codec)3798 static void alc225_shutup(struct hda_codec *codec)
3799 {
3800 	struct alc_spec *spec = codec->spec;
3801 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3802 	bool hp1_pin_sense, hp2_pin_sense;
3803 
3804 	if (!hp_pin)
3805 		hp_pin = 0x21;
3806 
3807 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3808 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3809 
3810 	if (hp1_pin_sense || hp2_pin_sense) {
3811 		alc_disable_headset_jack_key(codec);
3812 		/* 3k pull low control for Headset jack. */
3813 		alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3814 		msleep(2);
3815 
3816 		if (hp1_pin_sense)
3817 			snd_hda_codec_write(codec, hp_pin, 0,
3818 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3819 		if (hp2_pin_sense)
3820 			snd_hda_codec_write(codec, 0x16, 0,
3821 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3822 
3823 		msleep(75);
3824 
3825 		if (hp1_pin_sense)
3826 			snd_hda_codec_write(codec, hp_pin, 0,
3827 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3828 		if (hp2_pin_sense)
3829 			snd_hda_codec_write(codec, 0x16, 0,
3830 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3831 
3832 		msleep(75);
3833 		alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3834 		alc_enable_headset_jack_key(codec);
3835 	}
3836 	alc_auto_setup_eapd(codec, false);
3837 	alc_shutup_pins(codec);
3838 	if (spec->ultra_low_power) {
3839 		msleep(50);
3840 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3841 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3842 		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3843 		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3844 		msleep(30);
3845 	}
3846 }
3847 
alc222_init(struct hda_codec * codec)3848 static void alc222_init(struct hda_codec *codec)
3849 {
3850 	struct alc_spec *spec = codec->spec;
3851 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3852 	bool hp1_pin_sense, hp2_pin_sense;
3853 
3854 	if (!hp_pin)
3855 		return;
3856 
3857 	msleep(30);
3858 
3859 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3860 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3861 
3862 	if (hp1_pin_sense || hp2_pin_sense) {
3863 		msleep(2);
3864 
3865 		if (hp1_pin_sense)
3866 			snd_hda_codec_write(codec, hp_pin, 0,
3867 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3868 		if (hp2_pin_sense)
3869 			snd_hda_codec_write(codec, 0x14, 0,
3870 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3871 		msleep(75);
3872 
3873 		if (hp1_pin_sense)
3874 			snd_hda_codec_write(codec, hp_pin, 0,
3875 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3876 		if (hp2_pin_sense)
3877 			snd_hda_codec_write(codec, 0x14, 0,
3878 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3879 
3880 		msleep(75);
3881 	}
3882 }
3883 
alc222_shutup(struct hda_codec * codec)3884 static void alc222_shutup(struct hda_codec *codec)
3885 {
3886 	struct alc_spec *spec = codec->spec;
3887 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3888 	bool hp1_pin_sense, hp2_pin_sense;
3889 
3890 	if (!hp_pin)
3891 		hp_pin = 0x21;
3892 
3893 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3894 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3895 
3896 	if (hp1_pin_sense || hp2_pin_sense) {
3897 		msleep(2);
3898 
3899 		if (hp1_pin_sense)
3900 			snd_hda_codec_write(codec, hp_pin, 0,
3901 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3902 		if (hp2_pin_sense)
3903 			snd_hda_codec_write(codec, 0x14, 0,
3904 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3905 
3906 		msleep(75);
3907 
3908 		if (hp1_pin_sense)
3909 			snd_hda_codec_write(codec, hp_pin, 0,
3910 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3911 		if (hp2_pin_sense)
3912 			snd_hda_codec_write(codec, 0x14, 0,
3913 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3914 
3915 		msleep(75);
3916 	}
3917 	alc_auto_setup_eapd(codec, false);
3918 	alc_shutup_pins(codec);
3919 }
3920 
alc_default_init(struct hda_codec * codec)3921 static void alc_default_init(struct hda_codec *codec)
3922 {
3923 	struct alc_spec *spec = codec->spec;
3924 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3925 	bool hp_pin_sense;
3926 
3927 	if (!hp_pin)
3928 		return;
3929 
3930 	msleep(30);
3931 
3932 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3933 
3934 	if (hp_pin_sense) {
3935 		msleep(2);
3936 
3937 		snd_hda_codec_write(codec, hp_pin, 0,
3938 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3939 
3940 		msleep(75);
3941 
3942 		snd_hda_codec_write(codec, hp_pin, 0,
3943 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3944 		msleep(75);
3945 	}
3946 }
3947 
alc_default_shutup(struct hda_codec * codec)3948 static void alc_default_shutup(struct hda_codec *codec)
3949 {
3950 	struct alc_spec *spec = codec->spec;
3951 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3952 	bool hp_pin_sense;
3953 
3954 	if (!hp_pin) {
3955 		alc269_shutup(codec);
3956 		return;
3957 	}
3958 
3959 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3960 
3961 	if (hp_pin_sense) {
3962 		msleep(2);
3963 
3964 		snd_hda_codec_write(codec, hp_pin, 0,
3965 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3966 
3967 		msleep(75);
3968 
3969 		if (!spec->no_shutup_pins)
3970 			snd_hda_codec_write(codec, hp_pin, 0,
3971 					    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3972 
3973 		msleep(75);
3974 	}
3975 	alc_auto_setup_eapd(codec, false);
3976 	alc_shutup_pins(codec);
3977 }
3978 
alc294_hp_init(struct hda_codec * codec)3979 static void alc294_hp_init(struct hda_codec *codec)
3980 {
3981 	struct alc_spec *spec = codec->spec;
3982 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3983 	int i, val;
3984 
3985 	if (!hp_pin)
3986 		return;
3987 
3988 	snd_hda_codec_write(codec, hp_pin, 0,
3989 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3990 
3991 	msleep(100);
3992 
3993 	if (!spec->no_shutup_pins)
3994 		snd_hda_codec_write(codec, hp_pin, 0,
3995 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3996 
3997 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3998 	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3999 
4000 	/* Wait for depop procedure finish  */
4001 	val = alc_read_coefex_idx(codec, 0x58, 0x01);
4002 	for (i = 0; i < 20 && val & 0x0080; i++) {
4003 		msleep(50);
4004 		val = alc_read_coefex_idx(codec, 0x58, 0x01);
4005 	}
4006 	/* Set HP depop to auto mode */
4007 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
4008 	msleep(50);
4009 }
4010 
alc294_init(struct hda_codec * codec)4011 static void alc294_init(struct hda_codec *codec)
4012 {
4013 	struct alc_spec *spec = codec->spec;
4014 
4015 	/* required only at boot or S4 resume time */
4016 	if (!spec->done_hp_init ||
4017 	    codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
4018 		alc294_hp_init(codec);
4019 		spec->done_hp_init = true;
4020 	}
4021 	alc_default_init(codec);
4022 }
4023 
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)4024 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
4025 			     unsigned int val)
4026 {
4027 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
4028 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
4029 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
4030 }
4031 
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)4032 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
4033 {
4034 	unsigned int val;
4035 
4036 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
4037 	val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
4038 		& 0xffff;
4039 	val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
4040 		<< 16;
4041 	return val;
4042 }
4043 
alc5505_dsp_halt(struct hda_codec * codec)4044 static void alc5505_dsp_halt(struct hda_codec *codec)
4045 {
4046 	unsigned int val;
4047 
4048 	alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
4049 	alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
4050 	alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
4051 	alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
4052 	alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
4053 	alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
4054 	alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
4055 	val = alc5505_coef_get(codec, 0x6220);
4056 	alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
4057 }
4058 
alc5505_dsp_back_from_halt(struct hda_codec * codec)4059 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
4060 {
4061 	alc5505_coef_set(codec, 0x61b8, 0x04133302);
4062 	alc5505_coef_set(codec, 0x61b0, 0x00005b16);
4063 	alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
4064 	alc5505_coef_set(codec, 0x6230, 0xf80d4011);
4065 	alc5505_coef_set(codec, 0x6220, 0x2002010f);
4066 	alc5505_coef_set(codec, 0x880c, 0x00000004);
4067 }
4068 
alc5505_dsp_init(struct hda_codec * codec)4069 static void alc5505_dsp_init(struct hda_codec *codec)
4070 {
4071 	unsigned int val;
4072 
4073 	alc5505_dsp_halt(codec);
4074 	alc5505_dsp_back_from_halt(codec);
4075 	alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
4076 	alc5505_coef_set(codec, 0x61b0, 0x5b16);
4077 	alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
4078 	alc5505_coef_set(codec, 0x61b4, 0x04132b02);
4079 	alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
4080 	alc5505_coef_set(codec, 0x61b8, 0x041f3302);
4081 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
4082 	alc5505_coef_set(codec, 0x61b8, 0x041b3302);
4083 	alc5505_coef_set(codec, 0x61b8, 0x04173302);
4084 	alc5505_coef_set(codec, 0x61b8, 0x04163302);
4085 	alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4086 	alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4087 	alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4088 
4089 	val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4090 	if (val <= 3)
4091 		alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4092 	else
4093 		alc5505_coef_set(codec, 0x6220, 0x6002018f);
4094 
4095 	alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4096 	alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4097 	alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4098 	alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4099 	alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4100 	alc5505_coef_set(codec, 0x880c, 0x00000003);
4101 	alc5505_coef_set(codec, 0x880c, 0x00000010);
4102 
4103 #ifdef HALT_REALTEK_ALC5505
4104 	alc5505_dsp_halt(codec);
4105 #endif
4106 }
4107 
4108 #ifdef HALT_REALTEK_ALC5505
4109 #define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
4110 #define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
4111 #else
4112 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
4113 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
4114 #endif
4115 
alc269_suspend(struct hda_codec * codec)4116 static int alc269_suspend(struct hda_codec *codec)
4117 {
4118 	struct alc_spec *spec = codec->spec;
4119 
4120 	if (spec->has_alc5505_dsp)
4121 		alc5505_dsp_suspend(codec);
4122 
4123 	return alc_suspend(codec);
4124 }
4125 
alc269_resume(struct hda_codec * codec)4126 static int alc269_resume(struct hda_codec *codec)
4127 {
4128 	struct alc_spec *spec = codec->spec;
4129 
4130 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4131 		alc269vb_toggle_power_output(codec, 0);
4132 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4133 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
4134 		msleep(150);
4135 	}
4136 
4137 	codec->patch_ops.init(codec);
4138 
4139 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4140 		alc269vb_toggle_power_output(codec, 1);
4141 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4142 			(alc_get_coef0(codec) & 0x00ff) == 0x017) {
4143 		msleep(200);
4144 	}
4145 
4146 	snd_hda_regmap_sync(codec);
4147 	hda_call_check_power_status(codec, 0x01);
4148 
4149 	/* on some machine, the BIOS will clear the codec gpio data when enter
4150 	 * suspend, and won't restore the data after resume, so we restore it
4151 	 * in the driver.
4152 	 */
4153 	if (spec->gpio_data)
4154 		alc_write_gpio_data(codec);
4155 
4156 	if (spec->has_alc5505_dsp)
4157 		alc5505_dsp_resume(codec);
4158 
4159 	return 0;
4160 }
4161 
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4162 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4163 						 const struct hda_fixup *fix, int action)
4164 {
4165 	struct alc_spec *spec = codec->spec;
4166 
4167 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4168 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4169 }
4170 
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4171 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4172 						 const struct hda_fixup *fix,
4173 						 int action)
4174 {
4175 	unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4176 	unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4177 
4178 	if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4179 		snd_hda_codec_set_pincfg(codec, 0x19,
4180 			(cfg_headphone & ~AC_DEFCFG_DEVICE) |
4181 			(AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4182 }
4183 
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4184 static void alc269_fixup_hweq(struct hda_codec *codec,
4185 			       const struct hda_fixup *fix, int action)
4186 {
4187 	if (action == HDA_FIXUP_ACT_INIT)
4188 		alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4189 }
4190 
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4191 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4192 				       const struct hda_fixup *fix, int action)
4193 {
4194 	struct alc_spec *spec = codec->spec;
4195 
4196 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4197 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4198 }
4199 
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4200 static void alc271_fixup_dmic(struct hda_codec *codec,
4201 			      const struct hda_fixup *fix, int action)
4202 {
4203 	static const struct hda_verb verbs[] = {
4204 		{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4205 		{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4206 		{}
4207 	};
4208 	unsigned int cfg;
4209 
4210 	if (strcmp(codec->core.chip_name, "ALC271X") &&
4211 	    strcmp(codec->core.chip_name, "ALC269VB"))
4212 		return;
4213 	cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4214 	if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4215 		snd_hda_sequence_write(codec, verbs);
4216 }
4217 
4218 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4219 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4220 					  const struct hda_fixup *fix,
4221 					  int action)
4222 {
4223 	if (action == HDA_FIXUP_ACT_INIT)
4224 		alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4225 }
4226 
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4227 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4228 				 const struct hda_fixup *fix, int action)
4229 {
4230 	struct alc_spec *spec = codec->spec;
4231 
4232 	if (action != HDA_FIXUP_ACT_PROBE)
4233 		return;
4234 
4235 	/* Due to a hardware problem on Lenovo Ideadpad, we need to
4236 	 * fix the sample rate of analog I/O to 44.1kHz
4237 	 */
4238 	spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4239 	spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4240 }
4241 
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4242 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4243 				     const struct hda_fixup *fix, int action)
4244 {
4245 	/* The digital-mic unit sends PDM (differential signal) instead of
4246 	 * the standard PCM, thus you can't record a valid mono stream as is.
4247 	 * Below is a workaround specific to ALC269 to control the dmic
4248 	 * signal source as mono.
4249 	 */
4250 	if (action == HDA_FIXUP_ACT_INIT)
4251 		alc_update_coef_idx(codec, 0x07, 0, 0x80);
4252 }
4253 
alc269_quanta_automute(struct hda_codec * codec)4254 static void alc269_quanta_automute(struct hda_codec *codec)
4255 {
4256 	snd_hda_gen_update_outputs(codec);
4257 
4258 	alc_write_coef_idx(codec, 0x0c, 0x680);
4259 	alc_write_coef_idx(codec, 0x0c, 0x480);
4260 }
4261 
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4262 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4263 				     const struct hda_fixup *fix, int action)
4264 {
4265 	struct alc_spec *spec = codec->spec;
4266 	if (action != HDA_FIXUP_ACT_PROBE)
4267 		return;
4268 	spec->gen.automute_hook = alc269_quanta_automute;
4269 }
4270 
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4271 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4272 					 struct hda_jack_callback *jack)
4273 {
4274 	struct alc_spec *spec = codec->spec;
4275 	int vref;
4276 	msleep(200);
4277 	snd_hda_gen_hp_automute(codec, jack);
4278 
4279 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4280 	msleep(100);
4281 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4282 			    vref);
4283 	msleep(500);
4284 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4285 			    vref);
4286 }
4287 
4288 /*
4289  * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4290  */
4291 struct hda_alc298_mbxinit {
4292 	unsigned char value_0x23;
4293 	unsigned char value_0x25;
4294 };
4295 
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4296 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4297 					 const struct hda_alc298_mbxinit *initval,
4298 					 bool first)
4299 {
4300 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4301 	alc_write_coef_idx(codec, 0x26, 0xb000);
4302 
4303 	if (first)
4304 		snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4305 
4306 	snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4307 	alc_write_coef_idx(codec, 0x26, 0xf000);
4308 	alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4309 
4310 	if (initval->value_0x23 != 0x1e)
4311 		alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4312 
4313 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4314 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4315 }
4316 
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4317 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4318 					   const struct hda_fixup *fix,
4319 					   int action)
4320 {
4321 	/* Initialization magic */
4322 	static const struct hda_alc298_mbxinit dac_init[] = {
4323 		{0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4324 		{0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4325 		{0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4326 		{0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4327 		{0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4328 		{0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4329 		{0x2f, 0x00},
4330 		{0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4331 		{0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4332 		{0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4333 		{}
4334 	};
4335 	const struct hda_alc298_mbxinit *seq;
4336 
4337 	if (action != HDA_FIXUP_ACT_INIT)
4338 		return;
4339 
4340 	/* Start */
4341 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4342 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4343 	alc_write_coef_idx(codec, 0x26, 0xf000);
4344 	alc_write_coef_idx(codec, 0x22, 0x31);
4345 	alc_write_coef_idx(codec, 0x23, 0x0b);
4346 	alc_write_coef_idx(codec, 0x25, 0x00);
4347 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4348 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4349 
4350 	for (seq = dac_init; seq->value_0x23; seq++)
4351 		alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4352 }
4353 
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4354 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4355 				     const struct hda_fixup *fix, int action)
4356 {
4357 	struct alc_spec *spec = codec->spec;
4358 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4359 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4360 		spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4361 	}
4362 }
4363 
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4364 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4365 				bool polarity, bool on)
4366 {
4367 	unsigned int pinval;
4368 
4369 	if (!pin)
4370 		return;
4371 	if (polarity)
4372 		on = !on;
4373 	pinval = snd_hda_codec_get_pin_target(codec, pin);
4374 	pinval &= ~AC_PINCTL_VREFEN;
4375 	pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4376 	/* temporarily power up/down for setting VREF */
4377 	snd_hda_power_up_pm(codec);
4378 	snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4379 	snd_hda_power_down_pm(codec);
4380 }
4381 
4382 /* 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)4383 static int vref_mute_led_set(struct led_classdev *led_cdev,
4384 			     enum led_brightness brightness)
4385 {
4386 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4387 	struct alc_spec *spec = codec->spec;
4388 
4389 	alc_update_vref_led(codec, spec->mute_led_nid,
4390 			    spec->mute_led_polarity, brightness);
4391 	return 0;
4392 }
4393 
4394 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4395 static unsigned int led_power_filter(struct hda_codec *codec,
4396 						  hda_nid_t nid,
4397 						  unsigned int power_state)
4398 {
4399 	struct alc_spec *spec = codec->spec;
4400 
4401 	if (power_state != AC_PWRST_D3 || nid == 0 ||
4402 	    (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4403 		return power_state;
4404 
4405 	/* Set pin ctl again, it might have just been set to 0 */
4406 	snd_hda_set_pin_ctl(codec, nid,
4407 			    snd_hda_codec_get_pin_target(codec, nid));
4408 
4409 	return snd_hda_gen_path_power_filter(codec, nid, power_state);
4410 }
4411 
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4412 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4413 				     const struct hda_fixup *fix, int action)
4414 {
4415 	struct alc_spec *spec = codec->spec;
4416 	const struct dmi_device *dev = NULL;
4417 
4418 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4419 		return;
4420 
4421 	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4422 		int pol, pin;
4423 		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4424 			continue;
4425 		if (pin < 0x0a || pin >= 0x10)
4426 			break;
4427 		spec->mute_led_polarity = pol;
4428 		spec->mute_led_nid = pin - 0x0a + 0x18;
4429 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4430 		codec->power_filter = led_power_filter;
4431 		codec_dbg(codec,
4432 			  "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4433 			   spec->mute_led_polarity);
4434 		break;
4435 	}
4436 }
4437 
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4438 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4439 					  const struct hda_fixup *fix,
4440 					  int action, hda_nid_t pin)
4441 {
4442 	struct alc_spec *spec = codec->spec;
4443 
4444 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4445 		spec->mute_led_polarity = 0;
4446 		spec->mute_led_nid = pin;
4447 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4448 		codec->power_filter = led_power_filter;
4449 	}
4450 }
4451 
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4452 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4453 				const struct hda_fixup *fix, int action)
4454 {
4455 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4456 }
4457 
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4458 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4459 				const struct hda_fixup *fix, int action)
4460 {
4461 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4462 }
4463 
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4464 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4465 				const struct hda_fixup *fix, int action)
4466 {
4467 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4468 }
4469 
4470 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4471 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4472 				int polarity, bool enabled)
4473 {
4474 	if (polarity)
4475 		enabled = !enabled;
4476 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4477 }
4478 
4479 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4480 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4481 			     enum led_brightness brightness)
4482 {
4483 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4484 	struct alc_spec *spec = codec->spec;
4485 
4486 	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4487 			    spec->mute_led_polarity, !brightness);
4488 	return 0;
4489 }
4490 
4491 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4492 static int micmute_led_set(struct led_classdev *led_cdev,
4493 			   enum led_brightness brightness)
4494 {
4495 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4496 	struct alc_spec *spec = codec->spec;
4497 
4498 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4499 			    spec->micmute_led_polarity, !brightness);
4500 	return 0;
4501 }
4502 
4503 /* 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)4504 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4505 				  int action,
4506 				  unsigned int mute_mask,
4507 				  unsigned int micmute_mask)
4508 {
4509 	struct alc_spec *spec = codec->spec;
4510 
4511 	alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4512 
4513 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4514 		return;
4515 	if (mute_mask) {
4516 		spec->gpio_mute_led_mask = mute_mask;
4517 		snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4518 	}
4519 	if (micmute_mask) {
4520 		spec->gpio_mic_led_mask = micmute_mask;
4521 		snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4522 	}
4523 }
4524 
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4525 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4526 				const struct hda_fixup *fix, int action)
4527 {
4528 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4529 }
4530 
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4531 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4532 				const struct hda_fixup *fix, int action)
4533 {
4534 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4535 }
4536 
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4537 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4538 				const struct hda_fixup *fix, int action)
4539 {
4540 	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4541 }
4542 
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4543 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4544 				const struct hda_fixup *fix, int action)
4545 {
4546 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4547 }
4548 
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4549 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4550 				const struct hda_fixup *fix, int action)
4551 {
4552 	alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4553 }
4554 
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4555 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4556 				const struct hda_fixup *fix, int action)
4557 {
4558 	struct alc_spec *spec = codec->spec;
4559 
4560 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4561 		spec->micmute_led_polarity = 1;
4562 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4563 }
4564 
4565 /* 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)4566 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4567 				enum led_brightness brightness)
4568 {
4569 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4570 	struct alc_spec *spec = codec->spec;
4571 
4572 	alc_update_vref_led(codec, spec->cap_mute_led_nid,
4573 			    spec->micmute_led_polarity, brightness);
4574 	return 0;
4575 }
4576 
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4577 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4578 				const struct hda_fixup *fix, int action)
4579 {
4580 	struct alc_spec *spec = codec->spec;
4581 
4582 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4583 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4584 		/* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4585 		 * enable headphone amp
4586 		 */
4587 		spec->gpio_mask |= 0x10;
4588 		spec->gpio_dir |= 0x10;
4589 		spec->cap_mute_led_nid = 0x18;
4590 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4591 		codec->power_filter = led_power_filter;
4592 	}
4593 }
4594 
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4595 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4596 				   const struct hda_fixup *fix, int action)
4597 {
4598 	struct alc_spec *spec = codec->spec;
4599 
4600 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4601 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4602 		spec->cap_mute_led_nid = 0x18;
4603 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4604 		codec->power_filter = led_power_filter;
4605 	}
4606 }
4607 
4608 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4609  * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4610  */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4611 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4612 				     const struct hda_fixup *fix, int action)
4613 {
4614 	struct alc_spec *spec = codec->spec;
4615 
4616 	switch (action) {
4617 	case HDA_FIXUP_ACT_PRE_PROBE:
4618 		spec->gpio_mask |= 0x01;
4619 		spec->gpio_dir |= 0x01;
4620 		break;
4621 	case HDA_FIXUP_ACT_INIT:
4622 		/* need to toggle GPIO to enable the amp */
4623 		alc_update_gpio_data(codec, 0x01, true);
4624 		msleep(100);
4625 		alc_update_gpio_data(codec, 0x01, false);
4626 		break;
4627 	}
4628 }
4629 
4630 /* 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)4631 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4632 				    struct hda_codec *codec,
4633 				    struct snd_pcm_substream *substream,
4634 				    int action)
4635 {
4636 	switch (action) {
4637 	case HDA_GEN_PCM_ACT_PREPARE:
4638 		alc_update_gpio_data(codec, 0x04, true);
4639 		break;
4640 	case HDA_GEN_PCM_ACT_CLEANUP:
4641 		alc_update_gpio_data(codec, 0x04, false);
4642 		break;
4643 	}
4644 }
4645 
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4646 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4647 				      const struct hda_fixup *fix,
4648 				      int action)
4649 {
4650 	struct alc_spec *spec = codec->spec;
4651 
4652 	if (action == HDA_FIXUP_ACT_PROBE) {
4653 		spec->gpio_mask |= 0x04;
4654 		spec->gpio_dir |= 0x04;
4655 		spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4656 	}
4657 }
4658 
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4659 static void alc_update_coef_led(struct hda_codec *codec,
4660 				struct alc_coef_led *led,
4661 				bool polarity, bool on)
4662 {
4663 	if (polarity)
4664 		on = !on;
4665 	/* temporarily power up/down for setting COEF bit */
4666 	alc_update_coef_idx(codec, led->idx, led->mask,
4667 			    on ? led->on : led->off);
4668 }
4669 
4670 /* 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)4671 static int coef_mute_led_set(struct led_classdev *led_cdev,
4672 			     enum led_brightness brightness)
4673 {
4674 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4675 	struct alc_spec *spec = codec->spec;
4676 
4677 	alc_update_coef_led(codec, &spec->mute_led_coef,
4678 			    spec->mute_led_polarity, brightness);
4679 	return 0;
4680 }
4681 
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4682 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4683 					  const struct hda_fixup *fix,
4684 					  int action)
4685 {
4686 	struct alc_spec *spec = codec->spec;
4687 
4688 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4689 		spec->mute_led_polarity = 0;
4690 		spec->mute_led_coef.idx = 0x0b;
4691 		spec->mute_led_coef.mask = 1 << 3;
4692 		spec->mute_led_coef.on = 1 << 3;
4693 		spec->mute_led_coef.off = 0;
4694 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4695 	}
4696 }
4697 
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4698 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4699 					  const struct hda_fixup *fix,
4700 					  int action)
4701 {
4702 	struct alc_spec *spec = codec->spec;
4703 
4704 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4705 		spec->mute_led_polarity = 0;
4706 		spec->mute_led_coef.idx = 0x34;
4707 		spec->mute_led_coef.mask = 1 << 5;
4708 		spec->mute_led_coef.on = 0;
4709 		spec->mute_led_coef.off = 1 << 5;
4710 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4711 	}
4712 }
4713 
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4714 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4715 					  const struct hda_fixup *fix, int action)
4716 {
4717 	struct alc_spec *spec = codec->spec;
4718 
4719 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4720 		spec->mute_led_polarity = 0;
4721 		spec->mute_led_coef.idx = 0x07;
4722 		spec->mute_led_coef.mask = 1;
4723 		spec->mute_led_coef.on = 1;
4724 		spec->mute_led_coef.off = 0;
4725 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4726 	}
4727 }
4728 
alc245_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4729 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4730 					  const struct hda_fixup *fix,
4731 					  int action)
4732 {
4733 	struct alc_spec *spec = codec->spec;
4734 
4735 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4736 		spec->mute_led_polarity = 0;
4737 		spec->mute_led_coef.idx = 0x0b;
4738 		spec->mute_led_coef.mask = 3 << 2;
4739 		spec->mute_led_coef.on = 2 << 2;
4740 		spec->mute_led_coef.off = 1 << 2;
4741 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4742 	}
4743 }
4744 
alc245_fixup_hp_mute_led_v1_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4745 static void alc245_fixup_hp_mute_led_v1_coefbit(struct hda_codec *codec,
4746 					  const struct hda_fixup *fix,
4747 					  int action)
4748 {
4749 	struct alc_spec *spec = codec->spec;
4750 
4751 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4752 		spec->mute_led_polarity = 0;
4753 		spec->mute_led_coef.idx = 0x0b;
4754 		spec->mute_led_coef.mask = 1 << 3;
4755 		spec->mute_led_coef.on = 1 << 3;
4756 		spec->mute_led_coef.off = 0;
4757 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4758 	}
4759 }
4760 
4761 /* 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)4762 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4763 				enum led_brightness brightness)
4764 {
4765 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4766 	struct alc_spec *spec = codec->spec;
4767 
4768 	alc_update_coef_led(codec, &spec->mic_led_coef,
4769 			    spec->micmute_led_polarity, brightness);
4770 	return 0;
4771 }
4772 
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4773 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4774 				const struct hda_fixup *fix, int action)
4775 {
4776 	struct alc_spec *spec = codec->spec;
4777 
4778 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4779 		spec->mic_led_coef.idx = 0x19;
4780 		spec->mic_led_coef.mask = 1 << 13;
4781 		spec->mic_led_coef.on = 1 << 13;
4782 		spec->mic_led_coef.off = 0;
4783 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4784 	}
4785 }
4786 
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4787 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4788 				const struct hda_fixup *fix, int action)
4789 {
4790 	struct alc_spec *spec = codec->spec;
4791 
4792 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4793 		spec->micmute_led_polarity = 1;
4794 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4795 }
4796 
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4797 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4798 				const struct hda_fixup *fix, int action)
4799 {
4800 	struct alc_spec *spec = codec->spec;
4801 
4802 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4803 		spec->mic_led_coef.idx = 0x35;
4804 		spec->mic_led_coef.mask = 3 << 2;
4805 		spec->mic_led_coef.on = 2 << 2;
4806 		spec->mic_led_coef.off = 1 << 2;
4807 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4808 	}
4809 }
4810 
alc295_fixup_hp_mute_led_coefbit11(struct hda_codec * codec,const struct hda_fixup * fix,int action)4811 static void alc295_fixup_hp_mute_led_coefbit11(struct hda_codec *codec,
4812 				const struct hda_fixup *fix, int action)
4813 {
4814 	struct alc_spec *spec = codec->spec;
4815 
4816 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4817 		spec->mute_led_polarity = 0;
4818 		spec->mute_led_coef.idx = 0xb;
4819 		spec->mute_led_coef.mask = 3 << 3;
4820 		spec->mute_led_coef.on = 1 << 3;
4821 		spec->mute_led_coef.off = 1 << 4;
4822 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4823 	}
4824 }
4825 
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4826 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4827 				const struct hda_fixup *fix, int action)
4828 {
4829 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4830 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4831 }
4832 
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4833 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4834 				const struct hda_fixup *fix, int action)
4835 {
4836 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4837 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4838 }
4839 
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4840 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4841 				const struct hda_fixup *fix, int action)
4842 {
4843 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4844 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4845 }
4846 
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4847 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4848 				const struct hda_fixup *fix, int action)
4849 {
4850 	struct alc_spec *spec = codec->spec;
4851 
4852 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4853 		spec->cap_mute_led_nid = 0x1a;
4854 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4855 		codec->power_filter = led_power_filter;
4856 	}
4857 }
4858 
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4859 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4860 				const struct hda_fixup *fix, int action)
4861 {
4862 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4863 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4864 }
4865 
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4866 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4867 						  const unsigned short coefs[2])
4868 {
4869 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4870 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4871 	alc_write_coef_idx(codec, 0x26, 0xb011);
4872 }
4873 
4874 struct alc298_samsung_amp_desc {
4875 	unsigned char nid;
4876 	unsigned short init_seq[2][2];
4877 };
4878 
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4879 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4880 				     const struct hda_fixup *fix, int action)
4881 {
4882 	int i, j;
4883 	static const unsigned short init_seq[][2] = {
4884 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4885 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4886 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4887 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4888 	};
4889 	static const struct alc298_samsung_amp_desc amps[] = {
4890 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4891 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4892 	};
4893 
4894 	if (action != HDA_FIXUP_ACT_INIT)
4895 		return;
4896 
4897 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4898 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4899 
4900 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4901 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4902 
4903 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4904 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4905 	}
4906 }
4907 
4908 struct alc298_samsung_v2_amp_desc {
4909 	unsigned short nid;
4910 	int init_seq_size;
4911 	unsigned short init_seq[18][2];
4912 };
4913 
4914 static const struct alc298_samsung_v2_amp_desc
4915 alc298_samsung_v2_amp_desc_tbl[] = {
4916 	{ 0x38, 18, {
4917 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4918 		{ 0x201b, 0x0001 }, { 0x201d, 0x0001 }, { 0x201f, 0x00fe },
4919 		{ 0x2021, 0x0000 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4920 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4921 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x2399, 0x0003 },
4922 		{ 0x23a4, 0x00b5 }, { 0x23a5, 0x0001 }, { 0x23ba, 0x0094 }
4923 	}},
4924 	{ 0x39, 18, {
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 }, { 0x2399, 0x0003 },
4930 		{ 0x23a4, 0x00b5 }, { 0x23a5, 0x0001 }, { 0x23ba, 0x0094 }
4931 	}},
4932 	{ 0x3c, 15, {
4933 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4934 		{ 0x201b, 0x0001 }, { 0x201d, 0x0001 }, { 0x201f, 0x00fe },
4935 		{ 0x2021, 0x0000 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4936 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4937 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x23ba, 0x008d }
4938 	}},
4939 	{ 0x3d, 15, {
4940 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4941 		{ 0x201b, 0x0002 }, { 0x201d, 0x0002 }, { 0x201f, 0x00fd },
4942 		{ 0x2021, 0x0001 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4943 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4944 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x23ba, 0x008d }
4945 	}}
4946 };
4947 
alc298_samsung_v2_enable_amps(struct hda_codec * codec)4948 static void alc298_samsung_v2_enable_amps(struct hda_codec *codec)
4949 {
4950 	struct alc_spec *spec = codec->spec;
4951 	static const unsigned short enable_seq[][2] = {
4952 		{ 0x203a, 0x0081 }, { 0x23ff, 0x0001 },
4953 	};
4954 	int i, j;
4955 
4956 	for (i = 0; i < spec->num_speaker_amps; i++) {
4957 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4958 		for (j = 0; j < ARRAY_SIZE(enable_seq); j++)
4959 			alc298_samsung_write_coef_pack(codec, enable_seq[j]);
4960 		codec_dbg(codec, "alc298_samsung_v2: Enabled speaker amp 0x%02x\n",
4961 				alc298_samsung_v2_amp_desc_tbl[i].nid);
4962 	}
4963 }
4964 
alc298_samsung_v2_disable_amps(struct hda_codec * codec)4965 static void alc298_samsung_v2_disable_amps(struct hda_codec *codec)
4966 {
4967 	struct alc_spec *spec = codec->spec;
4968 	static const unsigned short disable_seq[][2] = {
4969 		{ 0x23ff, 0x0000 }, { 0x203a, 0x0080 },
4970 	};
4971 	int i, j;
4972 
4973 	for (i = 0; i < spec->num_speaker_amps; i++) {
4974 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4975 		for (j = 0; j < ARRAY_SIZE(disable_seq); j++)
4976 			alc298_samsung_write_coef_pack(codec, disable_seq[j]);
4977 		codec_dbg(codec, "alc298_samsung_v2: Disabled speaker amp 0x%02x\n",
4978 				alc298_samsung_v2_amp_desc_tbl[i].nid);
4979 	}
4980 }
4981 
alc298_samsung_v2_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)4982 static void alc298_samsung_v2_playback_hook(struct hda_pcm_stream *hinfo,
4983 				struct hda_codec *codec,
4984 				struct snd_pcm_substream *substream,
4985 				int action)
4986 {
4987 	/* Dynamically enable/disable speaker amps before and after playback */
4988 	if (action == HDA_GEN_PCM_ACT_OPEN)
4989 		alc298_samsung_v2_enable_amps(codec);
4990 	if (action == HDA_GEN_PCM_ACT_CLOSE)
4991 		alc298_samsung_v2_disable_amps(codec);
4992 }
4993 
alc298_samsung_v2_init_amps(struct hda_codec * codec,int num_speaker_amps)4994 static void alc298_samsung_v2_init_amps(struct hda_codec *codec,
4995 				int num_speaker_amps)
4996 {
4997 	struct alc_spec *spec = codec->spec;
4998 	int i, j;
4999 
5000 	/* Set spec's num_speaker_amps before doing anything else */
5001 	spec->num_speaker_amps = num_speaker_amps;
5002 
5003 	/* Disable speaker amps before init to prevent any physical damage */
5004 	alc298_samsung_v2_disable_amps(codec);
5005 
5006 	/* Initialize the speaker amps */
5007 	for (i = 0; i < spec->num_speaker_amps; i++) {
5008 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
5009 		for (j = 0; j < alc298_samsung_v2_amp_desc_tbl[i].init_seq_size; j++) {
5010 			alc298_samsung_write_coef_pack(codec,
5011 					alc298_samsung_v2_amp_desc_tbl[i].init_seq[j]);
5012 		}
5013 		alc_write_coef_idx(codec, 0x89, 0x0);
5014 		codec_dbg(codec, "alc298_samsung_v2: Initialized speaker amp 0x%02x\n",
5015 				alc298_samsung_v2_amp_desc_tbl[i].nid);
5016 	}
5017 
5018 	/* register hook to enable speaker amps only when they are needed */
5019 	spec->gen.pcm_playback_hook = alc298_samsung_v2_playback_hook;
5020 }
5021 
alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec * codec,const struct hda_fixup * fix,int action)5022 static void alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec *codec,
5023 				const struct hda_fixup *fix, int action)
5024 {
5025 	if (action == HDA_FIXUP_ACT_PROBE)
5026 		alc298_samsung_v2_init_amps(codec, 2);
5027 }
5028 
alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec * codec,const struct hda_fixup * fix,int action)5029 static void alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec *codec,
5030 				const struct hda_fixup *fix, int action)
5031 {
5032 	if (action == HDA_FIXUP_ACT_PROBE)
5033 		alc298_samsung_v2_init_amps(codec, 4);
5034 }
5035 
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)5036 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
5037 				   struct hda_jack_callback *event)
5038 {
5039 	struct alc_spec *spec = codec->spec;
5040 
5041 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
5042 	   send both key on and key off event for every interrupt. */
5043 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
5044 	input_sync(spec->kb_dev);
5045 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
5046 	input_sync(spec->kb_dev);
5047 }
5048 
alc_register_micmute_input_device(struct hda_codec * codec)5049 static int alc_register_micmute_input_device(struct hda_codec *codec)
5050 {
5051 	struct alc_spec *spec = codec->spec;
5052 	int i;
5053 
5054 	spec->kb_dev = input_allocate_device();
5055 	if (!spec->kb_dev) {
5056 		codec_err(codec, "Out of memory (input_allocate_device)\n");
5057 		return -ENOMEM;
5058 	}
5059 
5060 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
5061 
5062 	spec->kb_dev->name = "Microphone Mute Button";
5063 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
5064 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
5065 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
5066 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
5067 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
5068 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
5069 
5070 	if (input_register_device(spec->kb_dev)) {
5071 		codec_err(codec, "input_register_device failed\n");
5072 		input_free_device(spec->kb_dev);
5073 		spec->kb_dev = NULL;
5074 		return -ENOMEM;
5075 	}
5076 
5077 	return 0;
5078 }
5079 
5080 /* GPIO1 = set according to SKU external amp
5081  * GPIO2 = mic mute hotkey
5082  * GPIO3 = mute LED
5083  * GPIO4 = mic mute LED
5084  */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)5085 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
5086 					     const struct hda_fixup *fix, int action)
5087 {
5088 	struct alc_spec *spec = codec->spec;
5089 
5090 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
5091 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5092 		spec->init_amp = ALC_INIT_DEFAULT;
5093 		if (alc_register_micmute_input_device(codec) != 0)
5094 			return;
5095 
5096 		spec->gpio_mask |= 0x06;
5097 		spec->gpio_dir |= 0x02;
5098 		spec->gpio_data |= 0x02;
5099 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
5100 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
5101 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
5102 						    gpio2_mic_hotkey_event);
5103 		return;
5104 	}
5105 
5106 	if (!spec->kb_dev)
5107 		return;
5108 
5109 	switch (action) {
5110 	case HDA_FIXUP_ACT_FREE:
5111 		input_unregister_device(spec->kb_dev);
5112 		spec->kb_dev = NULL;
5113 	}
5114 }
5115 
5116 /* Line2 = mic mute hotkey
5117  * GPIO2 = mic mute LED
5118  */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)5119 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
5120 					     const struct hda_fixup *fix, int action)
5121 {
5122 	struct alc_spec *spec = codec->spec;
5123 
5124 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
5125 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5126 		spec->init_amp = ALC_INIT_DEFAULT;
5127 		if (alc_register_micmute_input_device(codec) != 0)
5128 			return;
5129 
5130 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
5131 						    gpio2_mic_hotkey_event);
5132 		return;
5133 	}
5134 
5135 	if (!spec->kb_dev)
5136 		return;
5137 
5138 	switch (action) {
5139 	case HDA_FIXUP_ACT_FREE:
5140 		input_unregister_device(spec->kb_dev);
5141 		spec->kb_dev = NULL;
5142 	}
5143 }
5144 
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)5145 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
5146 				const struct hda_fixup *fix, int action)
5147 {
5148 	struct alc_spec *spec = codec->spec;
5149 
5150 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
5151 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5152 		spec->cap_mute_led_nid = 0x18;
5153 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
5154 	}
5155 }
5156 
alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)5157 static void alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec *codec,
5158 				const struct hda_fixup *fix, int action)
5159 {
5160 	struct alc_spec *spec = codec->spec;
5161 
5162 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
5163 		spec->micmute_led_polarity = 1;
5164 	alc233_fixup_lenovo_line2_mic_hotkey(codec, fix, action);
5165 }
5166 
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)5167 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
5168 {
5169 	if (delay <= 0)
5170 		delay = 75;
5171 	snd_hda_codec_write(codec, 0x21, 0,
5172 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5173 	msleep(delay);
5174 	snd_hda_codec_write(codec, 0x21, 0,
5175 		    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5176 	msleep(delay);
5177 }
5178 
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)5179 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
5180 {
5181 	if (delay <= 0)
5182 		delay = 75;
5183 	snd_hda_codec_write(codec, 0x21, 0,
5184 		    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5185 	msleep(delay);
5186 	snd_hda_codec_write(codec, 0x21, 0,
5187 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5188 	msleep(delay);
5189 }
5190 
5191 static const struct coef_fw alc225_pre_hsmode[] = {
5192 	UPDATE_COEF(0x4a, 1<<8, 0),
5193 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
5194 	UPDATE_COEF(0x63, 3<<14, 3<<14),
5195 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
5196 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
5197 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
5198 	UPDATE_COEF(0x4a, 3<<10, 0),
5199 	{}
5200 };
5201 
alc_headset_mode_unplugged(struct hda_codec * codec)5202 static void alc_headset_mode_unplugged(struct hda_codec *codec)
5203 {
5204 	struct alc_spec *spec = codec->spec;
5205 	static const struct coef_fw coef0255[] = {
5206 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
5207 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5208 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5209 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5210 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
5211 		{}
5212 	};
5213 	static const struct coef_fw coef0256[] = {
5214 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
5215 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5216 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5217 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
5218 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5219 		{}
5220 	};
5221 	static const struct coef_fw coef0233[] = {
5222 		WRITE_COEF(0x1b, 0x0c0b),
5223 		WRITE_COEF(0x45, 0xc429),
5224 		UPDATE_COEF(0x35, 0x4000, 0),
5225 		WRITE_COEF(0x06, 0x2104),
5226 		WRITE_COEF(0x1a, 0x0001),
5227 		WRITE_COEF(0x26, 0x0004),
5228 		WRITE_COEF(0x32, 0x42a3),
5229 		{}
5230 	};
5231 	static const struct coef_fw coef0288[] = {
5232 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5233 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5234 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5235 		UPDATE_COEF(0x66, 0x0008, 0),
5236 		UPDATE_COEF(0x67, 0x2000, 0),
5237 		{}
5238 	};
5239 	static const struct coef_fw coef0298[] = {
5240 		UPDATE_COEF(0x19, 0x1300, 0x0300),
5241 		{}
5242 	};
5243 	static const struct coef_fw coef0292[] = {
5244 		WRITE_COEF(0x76, 0x000e),
5245 		WRITE_COEF(0x6c, 0x2400),
5246 		WRITE_COEF(0x18, 0x7308),
5247 		WRITE_COEF(0x6b, 0xc429),
5248 		{}
5249 	};
5250 	static const struct coef_fw coef0293[] = {
5251 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5252 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5253 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5254 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5255 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5256 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5257 		{}
5258 	};
5259 	static const struct coef_fw coef0668[] = {
5260 		WRITE_COEF(0x15, 0x0d40),
5261 		WRITE_COEF(0xb7, 0x802b),
5262 		{}
5263 	};
5264 	static const struct coef_fw coef0225[] = {
5265 		UPDATE_COEF(0x63, 3<<14, 0),
5266 		{}
5267 	};
5268 	static const struct coef_fw coef0274[] = {
5269 		UPDATE_COEF(0x4a, 0x0100, 0),
5270 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5271 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
5272 		UPDATE_COEF(0x4a, 0x0010, 0),
5273 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5274 		WRITE_COEF(0x45, 0x5289),
5275 		UPDATE_COEF(0x4a, 0x0c00, 0),
5276 		{}
5277 	};
5278 
5279 	if (spec->no_internal_mic_pin) {
5280 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5281 		return;
5282 	}
5283 
5284 	switch (codec->core.vendor_id) {
5285 	case 0x10ec0255:
5286 		alc_process_coef_fw(codec, coef0255);
5287 		break;
5288 	case 0x10ec0230:
5289 	case 0x10ec0236:
5290 	case 0x10ec0256:
5291 	case 0x19e58326:
5292 		alc_hp_mute_disable(codec, 75);
5293 		alc_process_coef_fw(codec, coef0256);
5294 		break;
5295 	case 0x10ec0234:
5296 	case 0x10ec0274:
5297 	case 0x10ec0294:
5298 		alc_process_coef_fw(codec, coef0274);
5299 		break;
5300 	case 0x10ec0233:
5301 	case 0x10ec0283:
5302 		alc_process_coef_fw(codec, coef0233);
5303 		break;
5304 	case 0x10ec0286:
5305 	case 0x10ec0288:
5306 		alc_process_coef_fw(codec, coef0288);
5307 		break;
5308 	case 0x10ec0298:
5309 		alc_process_coef_fw(codec, coef0298);
5310 		alc_process_coef_fw(codec, coef0288);
5311 		break;
5312 	case 0x10ec0292:
5313 		alc_process_coef_fw(codec, coef0292);
5314 		break;
5315 	case 0x10ec0293:
5316 		alc_process_coef_fw(codec, coef0293);
5317 		break;
5318 	case 0x10ec0668:
5319 		alc_process_coef_fw(codec, coef0668);
5320 		break;
5321 	case 0x10ec0215:
5322 	case 0x10ec0225:
5323 	case 0x10ec0285:
5324 	case 0x10ec0295:
5325 	case 0x10ec0289:
5326 	case 0x10ec0299:
5327 		alc_hp_mute_disable(codec, 75);
5328 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5329 		alc_process_coef_fw(codec, coef0225);
5330 		break;
5331 	case 0x10ec0867:
5332 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5333 		break;
5334 	}
5335 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5336 }
5337 
5338 
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5339 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5340 				    hda_nid_t mic_pin)
5341 {
5342 	static const struct coef_fw coef0255[] = {
5343 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5344 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5345 		{}
5346 	};
5347 	static const struct coef_fw coef0256[] = {
5348 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5349 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5350 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5351 		{}
5352 	};
5353 	static const struct coef_fw coef0233[] = {
5354 		UPDATE_COEF(0x35, 0, 1<<14),
5355 		WRITE_COEF(0x06, 0x2100),
5356 		WRITE_COEF(0x1a, 0x0021),
5357 		WRITE_COEF(0x26, 0x008c),
5358 		{}
5359 	};
5360 	static const struct coef_fw coef0288[] = {
5361 		UPDATE_COEF(0x4f, 0x00c0, 0),
5362 		UPDATE_COEF(0x50, 0x2000, 0),
5363 		UPDATE_COEF(0x56, 0x0006, 0),
5364 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5365 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5366 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5367 		{}
5368 	};
5369 	static const struct coef_fw coef0292[] = {
5370 		WRITE_COEF(0x19, 0xa208),
5371 		WRITE_COEF(0x2e, 0xacf0),
5372 		{}
5373 	};
5374 	static const struct coef_fw coef0293[] = {
5375 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5376 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5377 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5378 		{}
5379 	};
5380 	static const struct coef_fw coef0688[] = {
5381 		WRITE_COEF(0xb7, 0x802b),
5382 		WRITE_COEF(0xb5, 0x1040),
5383 		UPDATE_COEF(0xc3, 0, 1<<12),
5384 		{}
5385 	};
5386 	static const struct coef_fw coef0225[] = {
5387 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5388 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5389 		UPDATE_COEF(0x63, 3<<14, 0),
5390 		{}
5391 	};
5392 	static const struct coef_fw coef0274[] = {
5393 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5394 		UPDATE_COEF(0x4a, 0x0010, 0),
5395 		UPDATE_COEF(0x6b, 0xf000, 0),
5396 		{}
5397 	};
5398 
5399 	switch (codec->core.vendor_id) {
5400 	case 0x10ec0255:
5401 		alc_write_coef_idx(codec, 0x45, 0xc489);
5402 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5403 		alc_process_coef_fw(codec, coef0255);
5404 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5405 		break;
5406 	case 0x10ec0230:
5407 	case 0x10ec0236:
5408 	case 0x10ec0256:
5409 	case 0x19e58326:
5410 		alc_write_coef_idx(codec, 0x45, 0xc489);
5411 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5412 		alc_process_coef_fw(codec, coef0256);
5413 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5414 		break;
5415 	case 0x10ec0234:
5416 	case 0x10ec0274:
5417 	case 0x10ec0294:
5418 		alc_write_coef_idx(codec, 0x45, 0x4689);
5419 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5420 		alc_process_coef_fw(codec, coef0274);
5421 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5422 		break;
5423 	case 0x10ec0233:
5424 	case 0x10ec0283:
5425 		alc_write_coef_idx(codec, 0x45, 0xc429);
5426 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5427 		alc_process_coef_fw(codec, coef0233);
5428 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5429 		break;
5430 	case 0x10ec0286:
5431 	case 0x10ec0288:
5432 	case 0x10ec0298:
5433 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5434 		alc_process_coef_fw(codec, coef0288);
5435 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5436 		break;
5437 	case 0x10ec0292:
5438 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5439 		alc_process_coef_fw(codec, coef0292);
5440 		break;
5441 	case 0x10ec0293:
5442 		/* Set to TRS mode */
5443 		alc_write_coef_idx(codec, 0x45, 0xc429);
5444 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5445 		alc_process_coef_fw(codec, coef0293);
5446 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5447 		break;
5448 	case 0x10ec0867:
5449 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5450 		fallthrough;
5451 	case 0x10ec0221:
5452 	case 0x10ec0662:
5453 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5454 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5455 		break;
5456 	case 0x10ec0668:
5457 		alc_write_coef_idx(codec, 0x11, 0x0001);
5458 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5459 		alc_process_coef_fw(codec, coef0688);
5460 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5461 		break;
5462 	case 0x10ec0215:
5463 	case 0x10ec0225:
5464 	case 0x10ec0285:
5465 	case 0x10ec0295:
5466 	case 0x10ec0289:
5467 	case 0x10ec0299:
5468 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5469 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5470 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5471 		alc_process_coef_fw(codec, coef0225);
5472 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5473 		break;
5474 	}
5475 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5476 }
5477 
alc_headset_mode_default(struct hda_codec * codec)5478 static void alc_headset_mode_default(struct hda_codec *codec)
5479 {
5480 	static const struct coef_fw coef0225[] = {
5481 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5482 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5483 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5484 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5485 		UPDATE_COEF(0x63, 3<<14, 0),
5486 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5487 		{}
5488 	};
5489 	static const struct coef_fw coef0255[] = {
5490 		WRITE_COEF(0x45, 0xc089),
5491 		WRITE_COEF(0x45, 0xc489),
5492 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5493 		WRITE_COEF(0x49, 0x0049),
5494 		{}
5495 	};
5496 	static const struct coef_fw coef0256[] = {
5497 		WRITE_COEF(0x45, 0xc489),
5498 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5499 		WRITE_COEF(0x49, 0x0049),
5500 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5501 		WRITE_COEF(0x06, 0x6100),
5502 		{}
5503 	};
5504 	static const struct coef_fw coef0233[] = {
5505 		WRITE_COEF(0x06, 0x2100),
5506 		WRITE_COEF(0x32, 0x4ea3),
5507 		{}
5508 	};
5509 	static const struct coef_fw coef0288[] = {
5510 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5511 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5512 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5513 		UPDATE_COEF(0x66, 0x0008, 0),
5514 		UPDATE_COEF(0x67, 0x2000, 0),
5515 		{}
5516 	};
5517 	static const struct coef_fw coef0292[] = {
5518 		WRITE_COEF(0x76, 0x000e),
5519 		WRITE_COEF(0x6c, 0x2400),
5520 		WRITE_COEF(0x6b, 0xc429),
5521 		WRITE_COEF(0x18, 0x7308),
5522 		{}
5523 	};
5524 	static const struct coef_fw coef0293[] = {
5525 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5526 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5527 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5528 		{}
5529 	};
5530 	static const struct coef_fw coef0688[] = {
5531 		WRITE_COEF(0x11, 0x0041),
5532 		WRITE_COEF(0x15, 0x0d40),
5533 		WRITE_COEF(0xb7, 0x802b),
5534 		{}
5535 	};
5536 	static const struct coef_fw coef0274[] = {
5537 		WRITE_COEF(0x45, 0x4289),
5538 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5539 		UPDATE_COEF(0x6b, 0x0f00, 0),
5540 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5541 		{}
5542 	};
5543 
5544 	switch (codec->core.vendor_id) {
5545 	case 0x10ec0215:
5546 	case 0x10ec0225:
5547 	case 0x10ec0285:
5548 	case 0x10ec0295:
5549 	case 0x10ec0289:
5550 	case 0x10ec0299:
5551 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5552 		alc_process_coef_fw(codec, coef0225);
5553 		alc_hp_enable_unmute(codec, 75);
5554 		break;
5555 	case 0x10ec0255:
5556 		alc_process_coef_fw(codec, coef0255);
5557 		break;
5558 	case 0x10ec0230:
5559 	case 0x10ec0236:
5560 	case 0x10ec0256:
5561 	case 0x19e58326:
5562 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5563 		alc_write_coef_idx(codec, 0x45, 0xc089);
5564 		msleep(50);
5565 		alc_process_coef_fw(codec, coef0256);
5566 		alc_hp_enable_unmute(codec, 75);
5567 		break;
5568 	case 0x10ec0234:
5569 	case 0x10ec0274:
5570 	case 0x10ec0294:
5571 		alc_process_coef_fw(codec, coef0274);
5572 		break;
5573 	case 0x10ec0233:
5574 	case 0x10ec0283:
5575 		alc_process_coef_fw(codec, coef0233);
5576 		break;
5577 	case 0x10ec0286:
5578 	case 0x10ec0288:
5579 	case 0x10ec0298:
5580 		alc_process_coef_fw(codec, coef0288);
5581 		break;
5582 	case 0x10ec0292:
5583 		alc_process_coef_fw(codec, coef0292);
5584 		break;
5585 	case 0x10ec0293:
5586 		alc_process_coef_fw(codec, coef0293);
5587 		break;
5588 	case 0x10ec0668:
5589 		alc_process_coef_fw(codec, coef0688);
5590 		break;
5591 	case 0x10ec0867:
5592 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5593 		break;
5594 	}
5595 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5596 }
5597 
5598 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5599 static void alc_headset_mode_ctia(struct hda_codec *codec)
5600 {
5601 	int val;
5602 
5603 	static const struct coef_fw coef0255[] = {
5604 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5605 		WRITE_COEF(0x1b, 0x0c2b),
5606 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5607 		{}
5608 	};
5609 	static const struct coef_fw coef0256[] = {
5610 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5611 		WRITE_COEF(0x1b, 0x0e6b),
5612 		{}
5613 	};
5614 	static const struct coef_fw coef0233[] = {
5615 		WRITE_COEF(0x45, 0xd429),
5616 		WRITE_COEF(0x1b, 0x0c2b),
5617 		WRITE_COEF(0x32, 0x4ea3),
5618 		{}
5619 	};
5620 	static const struct coef_fw coef0288[] = {
5621 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5622 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5623 		UPDATE_COEF(0x66, 0x0008, 0),
5624 		UPDATE_COEF(0x67, 0x2000, 0),
5625 		{}
5626 	};
5627 	static const struct coef_fw coef0292[] = {
5628 		WRITE_COEF(0x6b, 0xd429),
5629 		WRITE_COEF(0x76, 0x0008),
5630 		WRITE_COEF(0x18, 0x7388),
5631 		{}
5632 	};
5633 	static const struct coef_fw coef0293[] = {
5634 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5635 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5636 		{}
5637 	};
5638 	static const struct coef_fw coef0688[] = {
5639 		WRITE_COEF(0x11, 0x0001),
5640 		WRITE_COEF(0x15, 0x0d60),
5641 		WRITE_COEF(0xc3, 0x0000),
5642 		{}
5643 	};
5644 	static const struct coef_fw coef0225_1[] = {
5645 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5646 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5647 		{}
5648 	};
5649 	static const struct coef_fw coef0225_2[] = {
5650 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5651 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5652 		{}
5653 	};
5654 
5655 	switch (codec->core.vendor_id) {
5656 	case 0x10ec0255:
5657 		alc_process_coef_fw(codec, coef0255);
5658 		break;
5659 	case 0x10ec0230:
5660 	case 0x10ec0236:
5661 	case 0x10ec0256:
5662 	case 0x19e58326:
5663 		alc_process_coef_fw(codec, coef0256);
5664 		alc_hp_enable_unmute(codec, 75);
5665 		break;
5666 	case 0x10ec0234:
5667 	case 0x10ec0274:
5668 	case 0x10ec0294:
5669 		alc_write_coef_idx(codec, 0x45, 0xd689);
5670 		break;
5671 	case 0x10ec0233:
5672 	case 0x10ec0283:
5673 		alc_process_coef_fw(codec, coef0233);
5674 		break;
5675 	case 0x10ec0298:
5676 		val = alc_read_coef_idx(codec, 0x50);
5677 		if (val & (1 << 12)) {
5678 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5679 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5680 			msleep(300);
5681 		} else {
5682 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5683 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5684 			msleep(300);
5685 		}
5686 		break;
5687 	case 0x10ec0286:
5688 	case 0x10ec0288:
5689 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5690 		msleep(300);
5691 		alc_process_coef_fw(codec, coef0288);
5692 		break;
5693 	case 0x10ec0292:
5694 		alc_process_coef_fw(codec, coef0292);
5695 		break;
5696 	case 0x10ec0293:
5697 		alc_process_coef_fw(codec, coef0293);
5698 		break;
5699 	case 0x10ec0668:
5700 		alc_process_coef_fw(codec, coef0688);
5701 		break;
5702 	case 0x10ec0215:
5703 	case 0x10ec0225:
5704 	case 0x10ec0285:
5705 	case 0x10ec0295:
5706 	case 0x10ec0289:
5707 	case 0x10ec0299:
5708 		val = alc_read_coef_idx(codec, 0x45);
5709 		if (val & (1 << 9))
5710 			alc_process_coef_fw(codec, coef0225_2);
5711 		else
5712 			alc_process_coef_fw(codec, coef0225_1);
5713 		alc_hp_enable_unmute(codec, 75);
5714 		break;
5715 	case 0x10ec0867:
5716 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5717 		break;
5718 	}
5719 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5720 }
5721 
5722 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5723 static void alc_headset_mode_omtp(struct hda_codec *codec)
5724 {
5725 	static const struct coef_fw coef0255[] = {
5726 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5727 		WRITE_COEF(0x1b, 0x0c2b),
5728 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5729 		{}
5730 	};
5731 	static const struct coef_fw coef0256[] = {
5732 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5733 		WRITE_COEF(0x1b, 0x0e6b),
5734 		{}
5735 	};
5736 	static const struct coef_fw coef0233[] = {
5737 		WRITE_COEF(0x45, 0xe429),
5738 		WRITE_COEF(0x1b, 0x0c2b),
5739 		WRITE_COEF(0x32, 0x4ea3),
5740 		{}
5741 	};
5742 	static const struct coef_fw coef0288[] = {
5743 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5744 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5745 		UPDATE_COEF(0x66, 0x0008, 0),
5746 		UPDATE_COEF(0x67, 0x2000, 0),
5747 		{}
5748 	};
5749 	static const struct coef_fw coef0292[] = {
5750 		WRITE_COEF(0x6b, 0xe429),
5751 		WRITE_COEF(0x76, 0x0008),
5752 		WRITE_COEF(0x18, 0x7388),
5753 		{}
5754 	};
5755 	static const struct coef_fw coef0293[] = {
5756 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5757 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5758 		{}
5759 	};
5760 	static const struct coef_fw coef0688[] = {
5761 		WRITE_COEF(0x11, 0x0001),
5762 		WRITE_COEF(0x15, 0x0d50),
5763 		WRITE_COEF(0xc3, 0x0000),
5764 		{}
5765 	};
5766 	static const struct coef_fw coef0225[] = {
5767 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5768 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5769 		{}
5770 	};
5771 
5772 	switch (codec->core.vendor_id) {
5773 	case 0x10ec0255:
5774 		alc_process_coef_fw(codec, coef0255);
5775 		break;
5776 	case 0x10ec0230:
5777 	case 0x10ec0236:
5778 	case 0x10ec0256:
5779 	case 0x19e58326:
5780 		alc_process_coef_fw(codec, coef0256);
5781 		alc_hp_enable_unmute(codec, 75);
5782 		break;
5783 	case 0x10ec0234:
5784 	case 0x10ec0274:
5785 	case 0x10ec0294:
5786 		alc_write_coef_idx(codec, 0x45, 0xe689);
5787 		break;
5788 	case 0x10ec0233:
5789 	case 0x10ec0283:
5790 		alc_process_coef_fw(codec, coef0233);
5791 		break;
5792 	case 0x10ec0298:
5793 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5794 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5795 		msleep(300);
5796 		break;
5797 	case 0x10ec0286:
5798 	case 0x10ec0288:
5799 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5800 		msleep(300);
5801 		alc_process_coef_fw(codec, coef0288);
5802 		break;
5803 	case 0x10ec0292:
5804 		alc_process_coef_fw(codec, coef0292);
5805 		break;
5806 	case 0x10ec0293:
5807 		alc_process_coef_fw(codec, coef0293);
5808 		break;
5809 	case 0x10ec0668:
5810 		alc_process_coef_fw(codec, coef0688);
5811 		break;
5812 	case 0x10ec0215:
5813 	case 0x10ec0225:
5814 	case 0x10ec0285:
5815 	case 0x10ec0295:
5816 	case 0x10ec0289:
5817 	case 0x10ec0299:
5818 		alc_process_coef_fw(codec, coef0225);
5819 		alc_hp_enable_unmute(codec, 75);
5820 		break;
5821 	}
5822 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5823 }
5824 
alc_determine_headset_type(struct hda_codec * codec)5825 static void alc_determine_headset_type(struct hda_codec *codec)
5826 {
5827 	int val;
5828 	bool is_ctia = false;
5829 	struct alc_spec *spec = codec->spec;
5830 	static const struct coef_fw coef0255[] = {
5831 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5832 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5833  conteol) */
5834 		{}
5835 	};
5836 	static const struct coef_fw coef0288[] = {
5837 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5838 		{}
5839 	};
5840 	static const struct coef_fw coef0298[] = {
5841 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5842 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5843 		UPDATE_COEF(0x66, 0x0008, 0),
5844 		UPDATE_COEF(0x67, 0x2000, 0),
5845 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5846 		{}
5847 	};
5848 	static const struct coef_fw coef0293[] = {
5849 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5850 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5851 		{}
5852 	};
5853 	static const struct coef_fw coef0688[] = {
5854 		WRITE_COEF(0x11, 0x0001),
5855 		WRITE_COEF(0xb7, 0x802b),
5856 		WRITE_COEF(0x15, 0x0d60),
5857 		WRITE_COEF(0xc3, 0x0c00),
5858 		{}
5859 	};
5860 	static const struct coef_fw coef0274[] = {
5861 		UPDATE_COEF(0x4a, 0x0010, 0),
5862 		UPDATE_COEF(0x4a, 0x8000, 0),
5863 		WRITE_COEF(0x45, 0xd289),
5864 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5865 		{}
5866 	};
5867 
5868 	if (spec->no_internal_mic_pin) {
5869 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5870 		return;
5871 	}
5872 
5873 	switch (codec->core.vendor_id) {
5874 	case 0x10ec0255:
5875 		alc_process_coef_fw(codec, coef0255);
5876 		msleep(300);
5877 		val = alc_read_coef_idx(codec, 0x46);
5878 		is_ctia = (val & 0x0070) == 0x0070;
5879 		break;
5880 	case 0x10ec0230:
5881 	case 0x10ec0236:
5882 	case 0x10ec0256:
5883 	case 0x19e58326:
5884 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5885 		alc_write_coef_idx(codec, 0x06, 0x6104);
5886 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5887 
5888 		alc_process_coef_fw(codec, coef0255);
5889 		msleep(300);
5890 		val = alc_read_coef_idx(codec, 0x46);
5891 		is_ctia = (val & 0x0070) == 0x0070;
5892 		if (!is_ctia) {
5893 			alc_write_coef_idx(codec, 0x45, 0xe089);
5894 			msleep(100);
5895 			val = alc_read_coef_idx(codec, 0x46);
5896 			if ((val & 0x0070) == 0x0070)
5897 				is_ctia = false;
5898 			else
5899 				is_ctia = true;
5900 		}
5901 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5902 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5903 		break;
5904 	case 0x10ec0234:
5905 	case 0x10ec0274:
5906 	case 0x10ec0294:
5907 		alc_process_coef_fw(codec, coef0274);
5908 		msleep(850);
5909 		val = alc_read_coef_idx(codec, 0x46);
5910 		is_ctia = (val & 0x00f0) == 0x00f0;
5911 		break;
5912 	case 0x10ec0233:
5913 	case 0x10ec0283:
5914 		alc_write_coef_idx(codec, 0x45, 0xd029);
5915 		msleep(300);
5916 		val = alc_read_coef_idx(codec, 0x46);
5917 		is_ctia = (val & 0x0070) == 0x0070;
5918 		break;
5919 	case 0x10ec0298:
5920 		snd_hda_codec_write(codec, 0x21, 0,
5921 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5922 		msleep(100);
5923 		snd_hda_codec_write(codec, 0x21, 0,
5924 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5925 		msleep(200);
5926 
5927 		val = alc_read_coef_idx(codec, 0x50);
5928 		if (val & (1 << 12)) {
5929 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5930 			alc_process_coef_fw(codec, coef0288);
5931 			msleep(350);
5932 			val = alc_read_coef_idx(codec, 0x50);
5933 			is_ctia = (val & 0x0070) == 0x0070;
5934 		} else {
5935 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5936 			alc_process_coef_fw(codec, coef0288);
5937 			msleep(350);
5938 			val = alc_read_coef_idx(codec, 0x50);
5939 			is_ctia = (val & 0x0070) == 0x0070;
5940 		}
5941 		alc_process_coef_fw(codec, coef0298);
5942 		snd_hda_codec_write(codec, 0x21, 0,
5943 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5944 		msleep(75);
5945 		snd_hda_codec_write(codec, 0x21, 0,
5946 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5947 		break;
5948 	case 0x10ec0286:
5949 	case 0x10ec0288:
5950 		alc_process_coef_fw(codec, coef0288);
5951 		msleep(350);
5952 		val = alc_read_coef_idx(codec, 0x50);
5953 		is_ctia = (val & 0x0070) == 0x0070;
5954 		break;
5955 	case 0x10ec0292:
5956 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5957 		msleep(300);
5958 		val = alc_read_coef_idx(codec, 0x6c);
5959 		is_ctia = (val & 0x001c) == 0x001c;
5960 		break;
5961 	case 0x10ec0293:
5962 		alc_process_coef_fw(codec, coef0293);
5963 		msleep(300);
5964 		val = alc_read_coef_idx(codec, 0x46);
5965 		is_ctia = (val & 0x0070) == 0x0070;
5966 		break;
5967 	case 0x10ec0668:
5968 		alc_process_coef_fw(codec, coef0688);
5969 		msleep(300);
5970 		val = alc_read_coef_idx(codec, 0xbe);
5971 		is_ctia = (val & 0x1c02) == 0x1c02;
5972 		break;
5973 	case 0x10ec0215:
5974 	case 0x10ec0225:
5975 	case 0x10ec0285:
5976 	case 0x10ec0295:
5977 	case 0x10ec0289:
5978 	case 0x10ec0299:
5979 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5980 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5981 		val = alc_read_coef_idx(codec, 0x45);
5982 		if (val & (1 << 9)) {
5983 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5984 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5985 			msleep(800);
5986 			val = alc_read_coef_idx(codec, 0x46);
5987 			is_ctia = (val & 0x00f0) == 0x00f0;
5988 		} else {
5989 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5990 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5991 			msleep(800);
5992 			val = alc_read_coef_idx(codec, 0x46);
5993 			is_ctia = (val & 0x00f0) == 0x00f0;
5994 		}
5995 		if (!is_ctia) {
5996 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5997 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5998 			msleep(100);
5999 			val = alc_read_coef_idx(codec, 0x46);
6000 			if ((val & 0x00f0) == 0x00f0)
6001 				is_ctia = false;
6002 			else
6003 				is_ctia = true;
6004 		}
6005 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
6006 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
6007 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
6008 		break;
6009 	case 0x10ec0867:
6010 		is_ctia = true;
6011 		break;
6012 	}
6013 
6014 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
6015 		  str_yes_no(is_ctia));
6016 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
6017 }
6018 
alc_update_headset_mode(struct hda_codec * codec)6019 static void alc_update_headset_mode(struct hda_codec *codec)
6020 {
6021 	struct alc_spec *spec = codec->spec;
6022 
6023 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
6024 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
6025 
6026 	int new_headset_mode;
6027 
6028 	if (!snd_hda_jack_detect(codec, hp_pin))
6029 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
6030 	else if (mux_pin == spec->headset_mic_pin)
6031 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
6032 	else if (mux_pin == spec->headphone_mic_pin)
6033 		new_headset_mode = ALC_HEADSET_MODE_MIC;
6034 	else
6035 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
6036 
6037 	if (new_headset_mode == spec->current_headset_mode) {
6038 		snd_hda_gen_update_outputs(codec);
6039 		return;
6040 	}
6041 
6042 	switch (new_headset_mode) {
6043 	case ALC_HEADSET_MODE_UNPLUGGED:
6044 		alc_headset_mode_unplugged(codec);
6045 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
6046 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
6047 		spec->gen.hp_jack_present = false;
6048 		break;
6049 	case ALC_HEADSET_MODE_HEADSET:
6050 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
6051 			alc_determine_headset_type(codec);
6052 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
6053 			alc_headset_mode_ctia(codec);
6054 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
6055 			alc_headset_mode_omtp(codec);
6056 		spec->gen.hp_jack_present = true;
6057 		break;
6058 	case ALC_HEADSET_MODE_MIC:
6059 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
6060 		spec->gen.hp_jack_present = false;
6061 		break;
6062 	case ALC_HEADSET_MODE_HEADPHONE:
6063 		alc_headset_mode_default(codec);
6064 		spec->gen.hp_jack_present = true;
6065 		break;
6066 	}
6067 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
6068 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
6069 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
6070 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
6071 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
6072 						  PIN_VREFHIZ);
6073 	}
6074 	spec->current_headset_mode = new_headset_mode;
6075 
6076 	snd_hda_gen_update_outputs(codec);
6077 }
6078 
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)6079 static void alc_update_headset_mode_hook(struct hda_codec *codec,
6080 					 struct snd_kcontrol *kcontrol,
6081 					 struct snd_ctl_elem_value *ucontrol)
6082 {
6083 	alc_update_headset_mode(codec);
6084 }
6085 
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)6086 static void alc_update_headset_jack_cb(struct hda_codec *codec,
6087 				       struct hda_jack_callback *jack)
6088 {
6089 	snd_hda_gen_hp_automute(codec, jack);
6090 	alc_update_headset_mode(codec);
6091 }
6092 
alc_probe_headset_mode(struct hda_codec * codec)6093 static void alc_probe_headset_mode(struct hda_codec *codec)
6094 {
6095 	int i;
6096 	struct alc_spec *spec = codec->spec;
6097 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6098 
6099 	/* Find mic pins */
6100 	for (i = 0; i < cfg->num_inputs; i++) {
6101 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
6102 			spec->headset_mic_pin = cfg->inputs[i].pin;
6103 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
6104 			spec->headphone_mic_pin = cfg->inputs[i].pin;
6105 	}
6106 
6107 	WARN_ON(spec->gen.cap_sync_hook);
6108 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
6109 	spec->gen.automute_hook = alc_update_headset_mode;
6110 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
6111 }
6112 
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)6113 static void alc_fixup_headset_mode(struct hda_codec *codec,
6114 				const struct hda_fixup *fix, int action)
6115 {
6116 	struct alc_spec *spec = codec->spec;
6117 
6118 	switch (action) {
6119 	case HDA_FIXUP_ACT_PRE_PROBE:
6120 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
6121 		break;
6122 	case HDA_FIXUP_ACT_PROBE:
6123 		alc_probe_headset_mode(codec);
6124 		break;
6125 	case HDA_FIXUP_ACT_INIT:
6126 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
6127 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
6128 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
6129 		}
6130 		alc_update_headset_mode(codec);
6131 		break;
6132 	}
6133 }
6134 
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6135 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
6136 				const struct hda_fixup *fix, int action)
6137 {
6138 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6139 		struct alc_spec *spec = codec->spec;
6140 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6141 	}
6142 	else
6143 		alc_fixup_headset_mode(codec, fix, action);
6144 }
6145 
alc255_set_default_jack_type(struct hda_codec * codec)6146 static void alc255_set_default_jack_type(struct hda_codec *codec)
6147 {
6148 	/* Set to iphone type */
6149 	static const struct coef_fw alc255fw[] = {
6150 		WRITE_COEF(0x1b, 0x880b),
6151 		WRITE_COEF(0x45, 0xd089),
6152 		WRITE_COEF(0x1b, 0x080b),
6153 		WRITE_COEF(0x46, 0x0004),
6154 		WRITE_COEF(0x1b, 0x0c0b),
6155 		{}
6156 	};
6157 	static const struct coef_fw alc256fw[] = {
6158 		WRITE_COEF(0x1b, 0x884b),
6159 		WRITE_COEF(0x45, 0xd089),
6160 		WRITE_COEF(0x1b, 0x084b),
6161 		WRITE_COEF(0x46, 0x0004),
6162 		WRITE_COEF(0x1b, 0x0c4b),
6163 		{}
6164 	};
6165 	switch (codec->core.vendor_id) {
6166 	case 0x10ec0255:
6167 		alc_process_coef_fw(codec, alc255fw);
6168 		break;
6169 	case 0x10ec0230:
6170 	case 0x10ec0236:
6171 	case 0x10ec0256:
6172 	case 0x19e58326:
6173 		alc_process_coef_fw(codec, alc256fw);
6174 		break;
6175 	}
6176 	msleep(30);
6177 }
6178 
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)6179 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
6180 				const struct hda_fixup *fix, int action)
6181 {
6182 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6183 		alc255_set_default_jack_type(codec);
6184 	}
6185 	alc_fixup_headset_mode(codec, fix, action);
6186 }
6187 
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6188 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
6189 				const struct hda_fixup *fix, int action)
6190 {
6191 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6192 		struct alc_spec *spec = codec->spec;
6193 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6194 		alc255_set_default_jack_type(codec);
6195 	}
6196 	else
6197 		alc_fixup_headset_mode(codec, fix, action);
6198 }
6199 
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)6200 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
6201 				       struct hda_jack_callback *jack)
6202 {
6203 	struct alc_spec *spec = codec->spec;
6204 
6205 	alc_update_headset_jack_cb(codec, jack);
6206 	/* Headset Mic enable or disable, only for Dell Dino */
6207 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
6208 }
6209 
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)6210 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
6211 				const struct hda_fixup *fix, int action)
6212 {
6213 	alc_fixup_headset_mode(codec, fix, action);
6214 	if (action == HDA_FIXUP_ACT_PROBE) {
6215 		struct alc_spec *spec = codec->spec;
6216 		/* toggled via hp_automute_hook */
6217 		spec->gpio_mask |= 0x40;
6218 		spec->gpio_dir |= 0x40;
6219 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
6220 	}
6221 }
6222 
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6223 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
6224 					const struct hda_fixup *fix, int action)
6225 {
6226 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6227 		struct alc_spec *spec = codec->spec;
6228 		spec->gen.auto_mute_via_amp = 1;
6229 	}
6230 }
6231 
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)6232 static void alc_fixup_no_shutup(struct hda_codec *codec,
6233 				const struct hda_fixup *fix, int action)
6234 {
6235 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6236 		struct alc_spec *spec = codec->spec;
6237 		spec->no_shutup_pins = 1;
6238 	}
6239 }
6240 
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)6241 static void alc_fixup_disable_aamix(struct hda_codec *codec,
6242 				    const struct hda_fixup *fix, int action)
6243 {
6244 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6245 		struct alc_spec *spec = codec->spec;
6246 		/* Disable AA-loopback as it causes white noise */
6247 		spec->gen.mixer_nid = 0;
6248 	}
6249 }
6250 
6251 /* 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)6252 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6253 				  const struct hda_fixup *fix, int action)
6254 {
6255 	static const struct hda_pintbl pincfgs[] = {
6256 		{ 0x16, 0x21211010 }, /* dock headphone */
6257 		{ 0x19, 0x21a11010 }, /* dock mic */
6258 		{ }
6259 	};
6260 	struct alc_spec *spec = codec->spec;
6261 
6262 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6263 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6264 		codec->power_save_node = 0; /* avoid click noises */
6265 		snd_hda_apply_pincfgs(codec, pincfgs);
6266 	}
6267 }
6268 
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6269 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6270 				  const struct hda_fixup *fix, int action)
6271 {
6272 	static const struct hda_pintbl pincfgs[] = {
6273 		{ 0x17, 0x21211010 }, /* dock headphone */
6274 		{ 0x19, 0x21a11010 }, /* dock mic */
6275 		{ }
6276 	};
6277 	struct alc_spec *spec = codec->spec;
6278 
6279 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6280 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6281 		snd_hda_apply_pincfgs(codec, pincfgs);
6282 	} else if (action == HDA_FIXUP_ACT_INIT) {
6283 		/* Enable DOCK device */
6284 		snd_hda_codec_write(codec, 0x17, 0,
6285 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6286 		/* Enable DOCK device */
6287 		snd_hda_codec_write(codec, 0x19, 0,
6288 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6289 	}
6290 }
6291 
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6292 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6293 				  const struct hda_fixup *fix, int action)
6294 {
6295 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6296 	 * the speaker output becomes too low by some reason on Thinkpads with
6297 	 * ALC298 codec
6298 	 */
6299 	static const hda_nid_t preferred_pairs[] = {
6300 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6301 		0
6302 	};
6303 	struct alc_spec *spec = codec->spec;
6304 
6305 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6306 		spec->gen.preferred_dacs = preferred_pairs;
6307 }
6308 
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6309 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6310 				   const struct hda_fixup *fix, int action)
6311 {
6312 	static const hda_nid_t preferred_pairs[] = {
6313 		0x17, 0x02, 0x21, 0x03, 0
6314 	};
6315 	struct alc_spec *spec = codec->spec;
6316 
6317 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6318 		spec->gen.preferred_dacs = preferred_pairs;
6319 }
6320 
alc_shutup_dell_xps13(struct hda_codec * codec)6321 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6322 {
6323 	struct alc_spec *spec = codec->spec;
6324 	int hp_pin = alc_get_hp_pin(spec);
6325 
6326 	/* Prevent pop noises when headphones are plugged in */
6327 	snd_hda_codec_write(codec, hp_pin, 0,
6328 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6329 	msleep(20);
6330 }
6331 
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6332 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6333 				const struct hda_fixup *fix, int action)
6334 {
6335 	struct alc_spec *spec = codec->spec;
6336 	struct hda_input_mux *imux = &spec->gen.input_mux;
6337 	int i;
6338 
6339 	switch (action) {
6340 	case HDA_FIXUP_ACT_PRE_PROBE:
6341 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6342 		 * it causes a click noise at start up
6343 		 */
6344 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6345 		spec->shutup = alc_shutup_dell_xps13;
6346 		break;
6347 	case HDA_FIXUP_ACT_PROBE:
6348 		/* Make the internal mic the default input source. */
6349 		for (i = 0; i < imux->num_items; i++) {
6350 			if (spec->gen.imux_pins[i] == 0x12) {
6351 				spec->gen.cur_mux[0] = i;
6352 				break;
6353 			}
6354 		}
6355 		break;
6356 	}
6357 }
6358 
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6359 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6360 				const struct hda_fixup *fix, int action)
6361 {
6362 	struct alc_spec *spec = codec->spec;
6363 
6364 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6365 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6366 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6367 
6368 		/* Disable boost for mic-in permanently. (This code is only called
6369 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6370 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6371 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6372 	} else
6373 		alc_fixup_headset_mode(codec, fix, action);
6374 }
6375 
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6376 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6377 				const struct hda_fixup *fix, int action)
6378 {
6379 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6380 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6381 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6382 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6383 	}
6384 	alc_fixup_headset_mode(codec, fix, action);
6385 }
6386 
6387 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6388 static int find_ext_mic_pin(struct hda_codec *codec)
6389 {
6390 	struct alc_spec *spec = codec->spec;
6391 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6392 	hda_nid_t nid;
6393 	unsigned int defcfg;
6394 	int i;
6395 
6396 	for (i = 0; i < cfg->num_inputs; i++) {
6397 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6398 			continue;
6399 		nid = cfg->inputs[i].pin;
6400 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6401 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6402 			continue;
6403 		return nid;
6404 	}
6405 
6406 	return 0;
6407 }
6408 
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6409 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6410 				    const struct hda_fixup *fix,
6411 				    int action)
6412 {
6413 	struct alc_spec *spec = codec->spec;
6414 
6415 	if (action == HDA_FIXUP_ACT_PROBE) {
6416 		int mic_pin = find_ext_mic_pin(codec);
6417 		int hp_pin = alc_get_hp_pin(spec);
6418 
6419 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6420 			return;
6421 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6422 	}
6423 }
6424 
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6425 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6426 					     const struct hda_fixup *fix,
6427 					     int action)
6428 {
6429 	struct alc_spec *spec = codec->spec;
6430 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6431 	int i;
6432 
6433 	/* The mic boosts on level 2 and 3 are too noisy
6434 	   on the internal mic input.
6435 	   Therefore limit the boost to 0 or 1. */
6436 
6437 	if (action != HDA_FIXUP_ACT_PROBE)
6438 		return;
6439 
6440 	for (i = 0; i < cfg->num_inputs; i++) {
6441 		hda_nid_t nid = cfg->inputs[i].pin;
6442 		unsigned int defcfg;
6443 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6444 			continue;
6445 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6446 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6447 			continue;
6448 
6449 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6450 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6451 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6452 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6453 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6454 	}
6455 }
6456 
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6457 static void alc283_hp_automute_hook(struct hda_codec *codec,
6458 				    struct hda_jack_callback *jack)
6459 {
6460 	struct alc_spec *spec = codec->spec;
6461 	int vref;
6462 
6463 	msleep(200);
6464 	snd_hda_gen_hp_automute(codec, jack);
6465 
6466 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6467 
6468 	msleep(600);
6469 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6470 			    vref);
6471 }
6472 
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6473 static void alc283_fixup_chromebook(struct hda_codec *codec,
6474 				    const struct hda_fixup *fix, int action)
6475 {
6476 	struct alc_spec *spec = codec->spec;
6477 
6478 	switch (action) {
6479 	case HDA_FIXUP_ACT_PRE_PROBE:
6480 		snd_hda_override_wcaps(codec, 0x03, 0);
6481 		/* Disable AA-loopback as it causes white noise */
6482 		spec->gen.mixer_nid = 0;
6483 		break;
6484 	case HDA_FIXUP_ACT_INIT:
6485 		/* MIC2-VREF control */
6486 		/* Set to manual mode */
6487 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6488 		/* Enable Line1 input control by verb */
6489 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6490 		break;
6491 	}
6492 }
6493 
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6494 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6495 				    const struct hda_fixup *fix, int action)
6496 {
6497 	struct alc_spec *spec = codec->spec;
6498 
6499 	switch (action) {
6500 	case HDA_FIXUP_ACT_PRE_PROBE:
6501 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6502 		break;
6503 	case HDA_FIXUP_ACT_INIT:
6504 		/* MIC2-VREF control */
6505 		/* Set to manual mode */
6506 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6507 		break;
6508 	}
6509 }
6510 
6511 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6512 static void asus_tx300_automute(struct hda_codec *codec)
6513 {
6514 	struct alc_spec *spec = codec->spec;
6515 	snd_hda_gen_update_outputs(codec);
6516 	if (snd_hda_jack_detect(codec, 0x1b))
6517 		spec->gen.mute_bits |= (1ULL << 0x14);
6518 }
6519 
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6520 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6521 				    const struct hda_fixup *fix, int action)
6522 {
6523 	struct alc_spec *spec = codec->spec;
6524 	static const struct hda_pintbl dock_pins[] = {
6525 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6526 		{}
6527 	};
6528 
6529 	switch (action) {
6530 	case HDA_FIXUP_ACT_PRE_PROBE:
6531 		spec->init_amp = ALC_INIT_DEFAULT;
6532 		/* TX300 needs to set up GPIO2 for the speaker amp */
6533 		alc_setup_gpio(codec, 0x04);
6534 		snd_hda_apply_pincfgs(codec, dock_pins);
6535 		spec->gen.auto_mute_via_amp = 1;
6536 		spec->gen.automute_hook = asus_tx300_automute;
6537 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6538 						    snd_hda_gen_hp_automute);
6539 		break;
6540 	case HDA_FIXUP_ACT_PROBE:
6541 		spec->init_amp = ALC_INIT_DEFAULT;
6542 		break;
6543 	case HDA_FIXUP_ACT_BUILD:
6544 		/* this is a bit tricky; give more sane names for the main
6545 		 * (tablet) speaker and the dock speaker, respectively
6546 		 */
6547 		rename_ctl(codec, "Speaker Playback Switch",
6548 			   "Dock Speaker Playback Switch");
6549 		rename_ctl(codec, "Bass Speaker Playback Switch",
6550 			   "Speaker Playback Switch");
6551 		break;
6552 	}
6553 }
6554 
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6555 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6556 				       const struct hda_fixup *fix, int action)
6557 {
6558 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6559 		/* DAC node 0x03 is giving mono output. We therefore want to
6560 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6561 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6562 		static const hda_nid_t conn1[] = { 0x0c };
6563 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6564 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6565 	}
6566 }
6567 
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6568 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6569 					const struct hda_fixup *fix, int action)
6570 {
6571 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6572 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6573 		   we can't adjust the speaker's volume since this node does not has
6574 		   Amp-out capability. we change the speaker's route to:
6575 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6576 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6577 		   speaker's volume now. */
6578 
6579 		static const hda_nid_t conn1[] = { 0x0c };
6580 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6581 	}
6582 }
6583 
6584 /* 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)6585 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6586 				      const struct hda_fixup *fix, int action)
6587 {
6588 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6589 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6590 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6591 	}
6592 }
6593 
6594 /* 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)6595 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6596 					  const struct hda_fixup *fix, int action)
6597 {
6598 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6599 		static const hda_nid_t conn[] = { 0x02 };
6600 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6601 	}
6602 }
6603 
6604 /* 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)6605 static void alc294_fixup_bass_speaker_15(struct hda_codec *codec,
6606 					 const struct hda_fixup *fix, int action)
6607 {
6608 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6609 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6610 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
6611 	}
6612 }
6613 
6614 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6615 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6616 					  struct hda_jack_callback *jack)
6617 {
6618 	struct alc_spec *spec = codec->spec;
6619 
6620 	snd_hda_gen_hp_automute(codec, jack);
6621 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6622 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6623 			    !spec->gen.hp_jack_present);
6624 }
6625 
6626 /* Manage GPIOs for HP EliteBook Folio 9480m.
6627  *
6628  * GPIO4 is the headphone amplifier power control
6629  * GPIO3 is the audio output mute indicator LED
6630  */
6631 
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6632 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6633 				  const struct hda_fixup *fix,
6634 				  int action)
6635 {
6636 	struct alc_spec *spec = codec->spec;
6637 
6638 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6639 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6640 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6641 		spec->gpio_mask |= 0x10;
6642 		spec->gpio_dir |= 0x10;
6643 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6644 	}
6645 }
6646 
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6647 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6648 				   const struct hda_fixup *fix,
6649 				   int action)
6650 {
6651 	struct alc_spec *spec = codec->spec;
6652 
6653 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6654 		spec->gpio_mask |= 0x04;
6655 		spec->gpio_dir |= 0x04;
6656 		/* set data bit low */
6657 	}
6658 }
6659 
6660 /* Quirk for Thinkpad X1 7th and 8th Gen
6661  * The following fixed routing needed
6662  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6663  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6664  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6665  */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6666 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6667 					  const struct hda_fixup *fix, int action)
6668 {
6669 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6670 	static const hda_nid_t preferred_pairs[] = {
6671 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6672 	};
6673 	struct alc_spec *spec = codec->spec;
6674 
6675 	switch (action) {
6676 	case HDA_FIXUP_ACT_PRE_PROBE:
6677 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6678 		spec->gen.preferred_dacs = preferred_pairs;
6679 		break;
6680 	case HDA_FIXUP_ACT_BUILD:
6681 		/* The generic parser creates somewhat unintuitive volume ctls
6682 		 * with the fixed routing above, and the shared DAC2 may be
6683 		 * confusing for PA.
6684 		 * Rename those to unique names so that PA doesn't touch them
6685 		 * and use only Master volume.
6686 		 */
6687 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6688 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6689 		break;
6690 	}
6691 }
6692 
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6693 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6694 					 const struct hda_fixup *fix,
6695 					 int action)
6696 {
6697 	alc_fixup_dual_codecs(codec, fix, action);
6698 	switch (action) {
6699 	case HDA_FIXUP_ACT_PRE_PROBE:
6700 		/* override card longname to provide a unique UCM profile */
6701 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6702 		break;
6703 	case HDA_FIXUP_ACT_BUILD:
6704 		/* rename Capture controls depending on the codec */
6705 		rename_ctl(codec, "Capture Volume",
6706 			   codec->addr == 0 ?
6707 			   "Rear-Panel Capture Volume" :
6708 			   "Front-Panel Capture Volume");
6709 		rename_ctl(codec, "Capture Switch",
6710 			   codec->addr == 0 ?
6711 			   "Rear-Panel Capture Switch" :
6712 			   "Front-Panel Capture Switch");
6713 		break;
6714 	}
6715 }
6716 
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6717 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6718 				      const struct hda_fixup *fix, int action)
6719 {
6720 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6721 		return;
6722 
6723 	codec->power_save_node = 1;
6724 }
6725 
6726 /* 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)6727 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6728 				    const struct hda_fixup *fix, int action)
6729 {
6730 	struct alc_spec *spec = codec->spec;
6731 	static const hda_nid_t preferred_pairs[] = {
6732 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6733 		0
6734 	};
6735 
6736 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6737 		return;
6738 
6739 	spec->gen.preferred_dacs = preferred_pairs;
6740 	spec->gen.auto_mute_via_amp = 1;
6741 	codec->power_save_node = 0;
6742 }
6743 
6744 /* 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)6745 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6746 				    const struct hda_fixup *fix, int action)
6747 {
6748 	static const hda_nid_t preferred_pairs[] = {
6749 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6750 	};
6751 	struct alc_spec *spec = codec->spec;
6752 
6753 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6754 		spec->gen.preferred_dacs = preferred_pairs;
6755 }
6756 
6757 /* 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)6758 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6759 			      const struct hda_fixup *fix, int action)
6760 {
6761 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6762 		return;
6763 
6764 	snd_hda_override_wcaps(codec, 0x03, 0);
6765 }
6766 
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6767 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6768 {
6769 	switch (codec->core.vendor_id) {
6770 	case 0x10ec0274:
6771 	case 0x10ec0294:
6772 	case 0x10ec0225:
6773 	case 0x10ec0295:
6774 	case 0x10ec0299:
6775 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6776 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6777 		break;
6778 	case 0x10ec0230:
6779 	case 0x10ec0235:
6780 	case 0x10ec0236:
6781 	case 0x10ec0255:
6782 	case 0x10ec0256:
6783 	case 0x10ec0257:
6784 	case 0x19e58326:
6785 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6786 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6787 		break;
6788 	}
6789 }
6790 
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6791 static void alc295_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->ultra_low_power = true;
6799 		break;
6800 	case HDA_FIXUP_ACT_INIT:
6801 		alc_combo_jack_hp_jd_restart(codec);
6802 		break;
6803 	}
6804 }
6805 
alc256_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6806 static void alc256_fixup_chromebook(struct hda_codec *codec,
6807 				    const struct hda_fixup *fix, int action)
6808 {
6809 	struct alc_spec *spec = codec->spec;
6810 
6811 	switch (action) {
6812 	case HDA_FIXUP_ACT_PRE_PROBE:
6813 		spec->gen.suppress_auto_mute = 1;
6814 		spec->gen.suppress_auto_mic = 1;
6815 		spec->en_3kpull_low = false;
6816 		break;
6817 	}
6818 }
6819 
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6820 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6821 				  const struct hda_fixup *fix, int action)
6822 {
6823 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6824 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6825 }
6826 
6827 
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6828 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6829 					struct hda_jack_callback *cb)
6830 {
6831 	/* The Windows driver sets the codec up in a very different way where
6832 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6833 	 */
6834 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6835 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6836 	else
6837 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6838 }
6839 
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6840 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6841 					const struct hda_fixup *fix, int action)
6842 {
6843 	/* Pin 0x21: headphones/headset mic */
6844 	if (!is_jack_detectable(codec, 0x21))
6845 		return;
6846 
6847 	switch (action) {
6848 	case HDA_FIXUP_ACT_PRE_PROBE:
6849 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6850 				alc294_gx502_toggle_output);
6851 		break;
6852 	case HDA_FIXUP_ACT_INIT:
6853 		/* Make sure to start in a correct state, i.e. if
6854 		 * headphones have been plugged in before powering up the system
6855 		 */
6856 		alc294_gx502_toggle_output(codec, NULL);
6857 		break;
6858 	}
6859 }
6860 
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6861 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6862 				       struct hda_jack_callback *cb)
6863 {
6864 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6865 	 * responsible from changes between speakers and headphones
6866 	 */
6867 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6868 		alc_write_coef_idx(codec, 0x10, 0x8420);
6869 	else
6870 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6871 }
6872 
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6873 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6874 				  const struct hda_fixup *fix, int action)
6875 {
6876 	if (!is_jack_detectable(codec, 0x21))
6877 		return;
6878 
6879 	switch (action) {
6880 	case HDA_FIXUP_ACT_PRE_PROBE:
6881 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6882 				alc294_gu502_toggle_output);
6883 		break;
6884 	case HDA_FIXUP_ACT_INIT:
6885 		alc294_gu502_toggle_output(codec, NULL);
6886 		break;
6887 	}
6888 }
6889 
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6890 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6891 			      const struct hda_fixup *fix, int action)
6892 {
6893 	if (action != HDA_FIXUP_ACT_INIT)
6894 		return;
6895 
6896 	msleep(100);
6897 	alc_write_coef_idx(codec, 0x65, 0x0);
6898 }
6899 
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6900 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6901 				    const struct hda_fixup *fix, int action)
6902 {
6903 	switch (action) {
6904 	case HDA_FIXUP_ACT_INIT:
6905 		alc_combo_jack_hp_jd_restart(codec);
6906 		break;
6907 	}
6908 }
6909 
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6910 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6911 				    const struct hda_fixup *fix, int action)
6912 {
6913 	struct alc_spec *spec = codec->spec;
6914 
6915 	switch (action) {
6916 	case HDA_FIXUP_ACT_PRE_PROBE:
6917 		/* Mic RING SLEEVE swap for combo jack */
6918 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6919 		spec->no_internal_mic_pin = true;
6920 		break;
6921 	case HDA_FIXUP_ACT_INIT:
6922 		alc_combo_jack_hp_jd_restart(codec);
6923 		break;
6924 	}
6925 }
6926 
6927 /* GPIO1 = amplifier on/off
6928  * GPIO3 = mic mute LED
6929  */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6930 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6931 					  const struct hda_fixup *fix, int action)
6932 {
6933 	static const hda_nid_t conn[] = { 0x02 };
6934 
6935 	struct alc_spec *spec = codec->spec;
6936 	static const struct hda_pintbl pincfgs[] = {
6937 		{ 0x14, 0x90170110 },  /* front/high speakers */
6938 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6939 		{ }
6940 	};
6941 
6942 	//enable micmute led
6943 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6944 
6945 	switch (action) {
6946 	case HDA_FIXUP_ACT_PRE_PROBE:
6947 		spec->micmute_led_polarity = 1;
6948 		/* needed for amp of back speakers */
6949 		spec->gpio_mask |= 0x01;
6950 		spec->gpio_dir |= 0x01;
6951 		snd_hda_apply_pincfgs(codec, pincfgs);
6952 		/* share DAC to have unified volume control */
6953 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6954 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6955 		break;
6956 	case HDA_FIXUP_ACT_INIT:
6957 		/* need to toggle GPIO to enable the amp of back speakers */
6958 		alc_update_gpio_data(codec, 0x01, true);
6959 		msleep(100);
6960 		alc_update_gpio_data(codec, 0x01, false);
6961 		break;
6962 	}
6963 }
6964 
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6965 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6966 					  const struct hda_fixup *fix, int action)
6967 {
6968 	static const hda_nid_t conn[] = { 0x02 };
6969 	static const struct hda_pintbl pincfgs[] = {
6970 		{ 0x14, 0x90170110 },  /* rear speaker */
6971 		{ }
6972 	};
6973 
6974 	switch (action) {
6975 	case HDA_FIXUP_ACT_PRE_PROBE:
6976 		snd_hda_apply_pincfgs(codec, pincfgs);
6977 		/* force front speaker to DAC1 */
6978 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6979 		break;
6980 	}
6981 }
6982 
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6983 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6984 				      const struct hda_fixup *fix,
6985 				      int action)
6986 {
6987 	static const struct coef_fw coefs[] = {
6988 		WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6989 		WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6990 		WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6991 		WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6992 		WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6993 		WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6994 		WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6995 		WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6996 		WRITE_COEF(0x6e, 0x1005), { }
6997 	};
6998 
6999 	static const struct hda_pintbl pincfgs[] = {
7000 		{ 0x12, 0xb7a60130 },  /* Internal microphone*/
7001 		{ 0x14, 0x90170150 },  /* B&O soundbar speakers */
7002 		{ 0x17, 0x90170153 },  /* Side speakers */
7003 		{ 0x19, 0x03a11040 },  /* Headset microphone */
7004 		{ }
7005 	};
7006 
7007 	switch (action) {
7008 	case HDA_FIXUP_ACT_PRE_PROBE:
7009 		snd_hda_apply_pincfgs(codec, pincfgs);
7010 
7011 		/* Fixes volume control problem for side speakers */
7012 		alc295_fixup_disable_dac3(codec, fix, action);
7013 
7014 		/* Fixes no sound from headset speaker */
7015 		snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
7016 
7017 		/* Auto-enable headset mic when plugged */
7018 		snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
7019 
7020 		/* Headset mic volume enhancement */
7021 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
7022 		break;
7023 	case HDA_FIXUP_ACT_INIT:
7024 		alc_process_coef_fw(codec, coefs);
7025 		break;
7026 	case HDA_FIXUP_ACT_BUILD:
7027 		rename_ctl(codec, "Bass Speaker Playback Volume",
7028 			   "B&O-Tuned Playback Volume");
7029 		rename_ctl(codec, "Front Playback Switch",
7030 			   "B&O Soundbar Playback Switch");
7031 		rename_ctl(codec, "Bass Speaker Playback Switch",
7032 			   "Side Speaker Playback Switch");
7033 		break;
7034 	}
7035 }
7036 
7037 /* for hda_fixup_thinkpad_acpi() */
7038 #include "thinkpad_helper.c"
7039 
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)7040 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
7041 				    const struct hda_fixup *fix, int action)
7042 {
7043 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
7044 	hda_fixup_thinkpad_acpi(codec, fix, action);
7045 }
7046 
7047 /* for hda_fixup_ideapad_acpi() */
7048 #include "ideapad_hotkey_led_helper.c"
7049 
alc_fixup_ideapad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)7050 static void alc_fixup_ideapad_acpi(struct hda_codec *codec,
7051 				   const struct hda_fixup *fix, int action)
7052 {
7053 	hda_fixup_ideapad_acpi(codec, fix, action);
7054 }
7055 
7056 /* 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)7057 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
7058 						  const struct hda_fixup *fix,
7059 						  int action)
7060 {
7061 	struct alc_spec *spec = codec->spec;
7062 
7063 	switch (action) {
7064 	case HDA_FIXUP_ACT_PRE_PROBE:
7065 		spec->gen.suppress_auto_mute = 1;
7066 		break;
7067 	}
7068 }
7069 
comp_acpi_device_notify(acpi_handle handle,u32 event,void * data)7070 static void comp_acpi_device_notify(acpi_handle handle, u32 event, void *data)
7071 {
7072 	struct hda_codec *cdc = data;
7073 	struct alc_spec *spec = cdc->spec;
7074 
7075 	codec_info(cdc, "ACPI Notification %d\n", event);
7076 
7077 	hda_component_acpi_device_notify(&spec->comps, handle, event, data);
7078 }
7079 
comp_bind(struct device * dev)7080 static int comp_bind(struct device *dev)
7081 {
7082 	struct hda_codec *cdc = dev_to_hda_codec(dev);
7083 	struct alc_spec *spec = cdc->spec;
7084 	int ret;
7085 
7086 	ret = hda_component_manager_bind(cdc, &spec->comps);
7087 	if (ret)
7088 		return ret;
7089 
7090 	return hda_component_manager_bind_acpi_notifications(cdc,
7091 							     &spec->comps,
7092 							     comp_acpi_device_notify, cdc);
7093 }
7094 
comp_unbind(struct device * dev)7095 static void comp_unbind(struct device *dev)
7096 {
7097 	struct hda_codec *cdc = dev_to_hda_codec(dev);
7098 	struct alc_spec *spec = cdc->spec;
7099 
7100 	hda_component_manager_unbind_acpi_notifications(cdc, &spec->comps, comp_acpi_device_notify);
7101 	hda_component_manager_unbind(cdc, &spec->comps);
7102 }
7103 
7104 static const struct component_master_ops comp_master_ops = {
7105 	.bind = comp_bind,
7106 	.unbind = comp_unbind,
7107 };
7108 
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)7109 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
7110 				       struct snd_pcm_substream *sub, int action)
7111 {
7112 	struct alc_spec *spec = cdc->spec;
7113 
7114 	hda_component_manager_playback_hook(&spec->comps, action);
7115 }
7116 
comp_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,const char * match_str,int count)7117 static void comp_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
7118 			       const char *hid, const char *match_str, int count)
7119 {
7120 	struct alc_spec *spec = cdc->spec;
7121 	int ret;
7122 
7123 	switch (action) {
7124 	case HDA_FIXUP_ACT_PRE_PROBE:
7125 		ret = hda_component_manager_init(cdc, &spec->comps, count, bus, hid,
7126 						 match_str, &comp_master_ops);
7127 		if (ret)
7128 			return;
7129 
7130 		spec->gen.pcm_playback_hook = comp_generic_playback_hook;
7131 		break;
7132 	case HDA_FIXUP_ACT_FREE:
7133 		hda_component_manager_free(&spec->comps, &comp_master_ops);
7134 		break;
7135 	}
7136 }
7137 
find_cirrus_companion_amps(struct hda_codec * cdc)7138 static void find_cirrus_companion_amps(struct hda_codec *cdc)
7139 {
7140 	struct device *dev = hda_codec_dev(cdc);
7141 	struct acpi_device *adev;
7142 	struct fwnode_handle *fwnode __free(fwnode_handle) = NULL;
7143 	const char *bus = NULL;
7144 	static const struct {
7145 		const char *hid;
7146 		const char *name;
7147 	} acpi_ids[] = {{ "CSC3554", "cs35l54-hda" },
7148 			{ "CSC3556", "cs35l56-hda" },
7149 			{ "CSC3557", "cs35l57-hda" }};
7150 	char *match;
7151 	int i, count = 0, count_devindex = 0;
7152 
7153 	for (i = 0; i < ARRAY_SIZE(acpi_ids); ++i) {
7154 		adev = acpi_dev_get_first_match_dev(acpi_ids[i].hid, NULL, -1);
7155 		if (adev)
7156 			break;
7157 	}
7158 	if (!adev) {
7159 		codec_dbg(cdc, "Did not find ACPI entry for a Cirrus Amp\n");
7160 		return;
7161 	}
7162 
7163 	count = i2c_acpi_client_count(adev);
7164 	if (count > 0) {
7165 		bus = "i2c";
7166 	} else {
7167 		count = acpi_spi_count_resources(adev);
7168 		if (count > 0)
7169 			bus = "spi";
7170 	}
7171 
7172 	fwnode = fwnode_handle_get(acpi_fwnode_handle(adev));
7173 	acpi_dev_put(adev);
7174 
7175 	if (!bus) {
7176 		codec_err(cdc, "Did not find any buses for %s\n", acpi_ids[i].hid);
7177 		return;
7178 	}
7179 
7180 	if (!fwnode) {
7181 		codec_err(cdc, "Could not get fwnode for %s\n", acpi_ids[i].hid);
7182 		return;
7183 	}
7184 
7185 	/*
7186 	 * When available the cirrus,dev-index property is an accurate
7187 	 * count of the amps in a system and is used in preference to
7188 	 * the count of bus devices that can contain additional address
7189 	 * alias entries.
7190 	 */
7191 	count_devindex = fwnode_property_count_u32(fwnode, "cirrus,dev-index");
7192 	if (count_devindex > 0)
7193 		count = count_devindex;
7194 
7195 	match = devm_kasprintf(dev, GFP_KERNEL, "-%%s:00-%s.%%d", acpi_ids[i].name);
7196 	if (!match)
7197 		return;
7198 	codec_info(cdc, "Found %d %s on %s (%s)\n", count, acpi_ids[i].hid, bus, match);
7199 	comp_generic_fixup(cdc, HDA_FIXUP_ACT_PRE_PROBE, bus, acpi_ids[i].hid, match, count);
7200 }
7201 
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7202 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7203 {
7204 	comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
7205 }
7206 
cs35l41_fixup_i2c_four(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7207 static void cs35l41_fixup_i2c_four(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7208 {
7209 	comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
7210 }
7211 
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)7212 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7213 {
7214 	comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
7215 }
7216 
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)7217 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7218 {
7219 	comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
7220 }
7221 
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7222 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7223 						 int action)
7224 {
7225 	comp_generic_fixup(cdc, action, "i2c", "CLSA0100", "-%s:00-cs35l41-hda.%d", 2);
7226 }
7227 
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7228 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7229 						 int action)
7230 {
7231 	comp_generic_fixup(cdc, action, "i2c", "CLSA0101", "-%s:00-cs35l41-hda.%d", 2);
7232 }
7233 
alc285_fixup_asus_ga403u(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7234 static void alc285_fixup_asus_ga403u(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7235 {
7236 	/*
7237 	 * The same SSID has been re-used in different hardware, they have
7238 	 * different codecs and the newer GA403U has a ALC285.
7239 	 */
7240 	if (cdc->core.vendor_id != 0x10ec0285)
7241 		alc_fixup_inv_dmic(cdc, fix, action);
7242 }
7243 
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7244 static void tas2781_fixup_i2c(struct hda_codec *cdc,
7245 	const struct hda_fixup *fix, int action)
7246 {
7247 	comp_generic_fixup(cdc, action, "i2c", "TIAS2781", "-%s:00", 1);
7248 }
7249 
tas2781_fixup_spi(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7250 static void tas2781_fixup_spi(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7251 {
7252 	comp_generic_fixup(cdc, action, "spi", "TXNW2781", "-%s:00-tas2781-hda.%d", 2);
7253 }
7254 
yoga7_14arb7_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7255 static void yoga7_14arb7_fixup_i2c(struct hda_codec *cdc,
7256 	const struct hda_fixup *fix, int action)
7257 {
7258 	comp_generic_fixup(cdc, action, "i2c", "INT8866", "-%s:00", 1);
7259 }
7260 
alc256_fixup_acer_sfg16_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)7261 static void alc256_fixup_acer_sfg16_micmute_led(struct hda_codec *codec,
7262 	const struct hda_fixup *fix, int action)
7263 {
7264 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
7265 }
7266 
7267 
7268 /* for alc295_fixup_hp_top_speakers */
7269 #include "hp_x360_helper.c"
7270 
7271 /* for alc285_fixup_ideapad_s740_coef() */
7272 #include "ideapad_s740_helper.c"
7273 
7274 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
7275 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
7276 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
7277 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
7278 	{}
7279 };
7280 
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)7281 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
7282 					   const struct hda_fixup *fix,
7283 					   int action)
7284 {
7285 	/*
7286 	 * A certain other OS sets these coeffs to different values. On at least
7287 	 * one TongFang barebone these settings might survive even a cold
7288 	 * reboot. So to restore a clean slate the values are explicitly reset
7289 	 * to default here. Without this, the external microphone is always in a
7290 	 * plugged-in state, while the internal microphone is always in an
7291 	 * unplugged state, breaking the ability to use the internal microphone.
7292 	 */
7293 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7294 }
7295 
7296 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7297 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7298 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7299 	WRITE_COEF(0x49, 0x0149),
7300 	{}
7301 };
7302 
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7303 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7304 				       const struct hda_fixup *fix,
7305 				       int action)
7306 {
7307 	/*
7308 	 * The audio jack input and output is not detected on the ASRock NUC Box
7309 	 * 1100 series when cold booting without this fix. Warm rebooting from a
7310 	 * certain other OS makes the audio functional, as COEF settings are
7311 	 * preserved in this case. This fix sets these altered COEF values as
7312 	 * the default.
7313 	 */
7314 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7315 }
7316 
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7317 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7318 						    const struct hda_fixup *fix,
7319 						    int action)
7320 {
7321 	/*
7322 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7323 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7324 	 * needs an additional quirk for sound working after suspend and resume.
7325 	 */
7326 	if (codec->core.vendor_id == 0x10ec0256) {
7327 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7328 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7329 	} else {
7330 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7331 	}
7332 }
7333 
alc256_decrease_headphone_amp_val(struct hda_codec * codec,const struct hda_fixup * fix,int action)7334 static void alc256_decrease_headphone_amp_val(struct hda_codec *codec,
7335 					      const struct hda_fixup *fix, int action)
7336 {
7337 	u32 caps;
7338 	u8 nsteps, offs;
7339 
7340 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7341 		return;
7342 
7343 	caps = query_amp_caps(codec, 0x3, HDA_OUTPUT);
7344 	nsteps = ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) - 10;
7345 	offs = ((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT) - 10;
7346 	caps &= ~AC_AMPCAP_NUM_STEPS & ~AC_AMPCAP_OFFSET;
7347 	caps |= (nsteps << AC_AMPCAP_NUM_STEPS_SHIFT) | (offs << AC_AMPCAP_OFFSET_SHIFT);
7348 
7349 	if (snd_hda_override_amp_caps(codec, 0x3, HDA_OUTPUT, caps))
7350 		codec_warn(codec, "failed to override amp caps for NID 0x3\n");
7351 }
7352 
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7353 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7354 						  const struct hda_fixup *fix,
7355 						  int action)
7356 {
7357 	struct alc_spec *spec = codec->spec;
7358 	struct hda_input_mux *imux = &spec->gen.input_mux;
7359 	int i;
7360 
7361 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
7362 
7363 	switch (action) {
7364 	case HDA_FIXUP_ACT_PRE_PROBE:
7365 		/**
7366 		 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7367 		 * to Hi-Z to avoid pop noises at startup and when plugging and
7368 		 * unplugging headphones.
7369 		 */
7370 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7371 		snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7372 		break;
7373 	case HDA_FIXUP_ACT_PROBE:
7374 		/**
7375 		 * Make the internal mic (0x12) the default input source to
7376 		 * prevent pop noises on cold boot.
7377 		 */
7378 		for (i = 0; i < imux->num_items; i++) {
7379 			if (spec->gen.imux_pins[i] == 0x12) {
7380 				spec->gen.cur_mux[0] = i;
7381 				break;
7382 			}
7383 		}
7384 		break;
7385 	}
7386 }
7387 
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7388 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7389 					  const struct hda_fixup *fix, int action)
7390 {
7391 	/*
7392 	 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7393 	 * unconnected.
7394 	 */
7395 	static const struct hda_pintbl pincfgs[] = {
7396 		{ 0x17, 0x90170121 },
7397 		{ }
7398 	};
7399 	/*
7400 	 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7401 	 * DAC 0x02 and 0x03 would be fine.
7402 	 */
7403 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7404 	/*
7405 	 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7406 	 * Headphones (0x21) are connected to DAC 0x03.
7407 	 */
7408 	static const hda_nid_t preferred_pairs[] = {
7409 		0x14, 0x02,
7410 		0x17, 0x02,
7411 		0x21, 0x03,
7412 		0
7413 	};
7414 	struct alc_spec *spec = codec->spec;
7415 
7416 	switch (action) {
7417 	case HDA_FIXUP_ACT_PRE_PROBE:
7418 		snd_hda_apply_pincfgs(codec, pincfgs);
7419 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7420 		spec->gen.preferred_dacs = preferred_pairs;
7421 		break;
7422 	}
7423 }
7424 
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7425 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7426 					  const struct hda_fixup *fix, int action)
7427 {
7428 	static const struct hda_pintbl pincfgs[] = {
7429 		{ 0x14, 0x90170151 },
7430 		{ 0x17, 0x90170150 },
7431 		{ }
7432 	};
7433 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7434 	static const hda_nid_t preferred_pairs[] = {
7435 		0x14, 0x02,
7436 		0x17, 0x03,
7437 		0x21, 0x02,
7438 		0
7439 	};
7440 	struct alc_spec *spec = codec->spec;
7441 
7442 	alc_fixup_no_shutup(codec, fix, action);
7443 
7444 	switch (action) {
7445 	case HDA_FIXUP_ACT_PRE_PROBE:
7446 		snd_hda_apply_pincfgs(codec, pincfgs);
7447 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7448 		spec->gen.preferred_dacs = preferred_pairs;
7449 		break;
7450 	}
7451 }
7452 
7453 /* 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)7454 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7455 				    const struct hda_fixup *fix, int action)
7456 {
7457 	struct alc_spec *spec = codec->spec;
7458 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7459 	static const hda_nid_t preferred_pairs[] = {
7460 		0x17, 0x02, 0x21, 0x03, 0
7461 	};
7462 
7463 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7464 		return;
7465 
7466 	snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7467 	spec->gen.preferred_dacs = preferred_pairs;
7468 	spec->gen.auto_mute_via_amp = 1;
7469 	if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7470 		snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7471 					0x0); /* Make sure 0x14 was disable */
7472 	}
7473 }
7474 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7475 static void alc_fixup_headset_mic(struct hda_codec *codec,
7476 				   const struct hda_fixup *fix, int action)
7477 {
7478 	struct alc_spec *spec = codec->spec;
7479 	static const struct hda_pintbl pincfgs[] = {
7480 		{ 0x19, 0x03a1103c },
7481 		{ }
7482 	};
7483 
7484 	switch (action) {
7485 	case HDA_FIXUP_ACT_PRE_PROBE:
7486 		snd_hda_apply_pincfgs(codec, pincfgs);
7487 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7488 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7489 		break;
7490 	}
7491 }
7492 
alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec * codec,const struct hda_fixup * fix,int action)7493 static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec,
7494 					  const struct hda_fixup *fix, int action)
7495 {
7496 	/*
7497 	 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
7498 	 * unconnected.
7499 	 * The Pin Complex 0x17 for the bass speakers has the lowest association
7500 	 * and sequence values so shift it up a bit to squeeze 0x14 in.
7501 	 */
7502 	static const struct hda_pintbl pincfgs[] = {
7503 		{ 0x14, 0x90170110 }, // top/treble
7504 		{ 0x17, 0x90170111 }, // bottom/bass
7505 		{ }
7506 	};
7507 
7508 	/*
7509 	 * Force DAC 0x02 for the bass speakers 0x17.
7510 	 */
7511 	static const hda_nid_t conn[] = { 0x02 };
7512 
7513 	switch (action) {
7514 	case HDA_FIXUP_ACT_PRE_PROBE:
7515 		snd_hda_apply_pincfgs(codec, pincfgs);
7516 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7517 		break;
7518 	}
7519 
7520 	cs35l41_fixup_i2c_two(codec, fix, action);
7521 	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7522 	alc245_fixup_hp_gpio_led(codec, fix, action);
7523 }
7524 
7525 /* 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)7526 static void alc245_fixup_hp_spectre_x360_16_aa0xxx(struct hda_codec *codec,
7527 					  const struct hda_fixup *fix, int action)
7528 {
7529 	/*
7530 	 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
7531 	 * unconnected.
7532 	 * The Pin Complex 0x17 for the bass speakers has the lowest association
7533 	 * and sequence values so shift it up a bit to squeeze 0x14 in.
7534 	 */
7535 	struct alc_spec *spec = codec->spec;
7536 	static const struct hda_pintbl pincfgs[] = {
7537 		{ 0x14, 0x90170110 }, // top/treble
7538 		{ 0x17, 0x90170111 }, // bottom/bass
7539 		{ }
7540 	};
7541 
7542 	/*
7543 	 * Force DAC 0x02 for the bass speakers 0x17.
7544 	 */
7545 	static const hda_nid_t conn[] = { 0x02 };
7546 
7547 	switch (action) {
7548 	case HDA_FIXUP_ACT_PRE_PROBE:
7549 		/* needed for amp of back speakers */
7550 		spec->gpio_mask |= 0x01;
7551 		spec->gpio_dir |= 0x01;
7552 		snd_hda_apply_pincfgs(codec, pincfgs);
7553 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7554 		break;
7555 	case HDA_FIXUP_ACT_INIT:
7556 		/* need to toggle GPIO to enable the amp of back speakers */
7557 		alc_update_gpio_data(codec, 0x01, true);
7558 		msleep(100);
7559 		alc_update_gpio_data(codec, 0x01, false);
7560 		break;
7561 	}
7562 
7563 	cs35l41_fixup_i2c_two(codec, fix, action);
7564 	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7565 	alc245_fixup_hp_gpio_led(codec, fix, action);
7566 }
7567 
7568 /*
7569  * ALC287 PCM hooks
7570  */
alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)7571 static void alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream *hinfo,
7572 				   struct hda_codec *codec,
7573 				   struct snd_pcm_substream *substream,
7574 				   int action)
7575 {
7576 	switch (action) {
7577 	case HDA_GEN_PCM_ACT_OPEN:
7578 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x954f); /* write gpio3 to high */
7579 		break;
7580 	case HDA_GEN_PCM_ACT_CLOSE:
7581 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7582 		break;
7583 	}
7584 }
7585 
alc287_s4_power_gpio3_default(struct hda_codec * codec)7586 static void alc287_s4_power_gpio3_default(struct hda_codec *codec)
7587 {
7588 	if (is_s4_suspend(codec)) {
7589 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7590 	}
7591 }
7592 
alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec * codec,const struct hda_fixup * fix,int action)7593 static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec,
7594 			       const struct hda_fixup *fix, int action)
7595 {
7596 	struct alc_spec *spec = codec->spec;
7597 	static const struct coef_fw coefs[] = {
7598 		WRITE_COEF(0x24, 0x0013), WRITE_COEF(0x25, 0x0000), WRITE_COEF(0x26, 0xC300),
7599 		WRITE_COEF(0x28, 0x0001), WRITE_COEF(0x29, 0xb023),
7600 		WRITE_COEF(0x24, 0x0013), WRITE_COEF(0x25, 0x0000), WRITE_COEF(0x26, 0xC301),
7601 		WRITE_COEF(0x28, 0x0001), WRITE_COEF(0x29, 0xb023),
7602 	};
7603 
7604 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7605 		return;
7606 	alc_update_coef_idx(codec, 0x10, 1<<11, 1<<11);
7607 	alc_process_coef_fw(codec, coefs);
7608 	spec->power_hook = alc287_s4_power_gpio3_default;
7609 	spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook;
7610 }
7611 
7612 /*
7613  * Clear COEF 0x0d (PCBEEP passthrough) bit 0x40 where BIOS sets it wrongly
7614  * at PM resume
7615  */
alc283_fixup_dell_hp_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7616 static void alc283_fixup_dell_hp_resume(struct hda_codec *codec,
7617 					const struct hda_fixup *fix, int action)
7618 {
7619 	if (action == HDA_FIXUP_ACT_INIT)
7620 		alc_write_coef_idx(codec, 0xd, 0x2800);
7621 }
7622 
7623 enum {
7624 	ALC269_FIXUP_GPIO2,
7625 	ALC269_FIXUP_SONY_VAIO,
7626 	ALC275_FIXUP_SONY_VAIO_GPIO2,
7627 	ALC269_FIXUP_DELL_M101Z,
7628 	ALC269_FIXUP_SKU_IGNORE,
7629 	ALC269_FIXUP_ASUS_G73JW,
7630 	ALC269_FIXUP_ASUS_N7601ZM_PINS,
7631 	ALC269_FIXUP_ASUS_N7601ZM,
7632 	ALC269_FIXUP_LENOVO_EAPD,
7633 	ALC275_FIXUP_SONY_HWEQ,
7634 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
7635 	ALC271_FIXUP_DMIC,
7636 	ALC269_FIXUP_PCM_44K,
7637 	ALC269_FIXUP_STEREO_DMIC,
7638 	ALC269_FIXUP_HEADSET_MIC,
7639 	ALC269_FIXUP_QUANTA_MUTE,
7640 	ALC269_FIXUP_LIFEBOOK,
7641 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
7642 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
7643 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7644 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7645 	ALC269_FIXUP_AMIC,
7646 	ALC269_FIXUP_DMIC,
7647 	ALC269VB_FIXUP_AMIC,
7648 	ALC269VB_FIXUP_DMIC,
7649 	ALC269_FIXUP_HP_MUTE_LED,
7650 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
7651 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
7652 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
7653 	ALC269_FIXUP_HP_GPIO_LED,
7654 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
7655 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
7656 	ALC269_FIXUP_INV_DMIC,
7657 	ALC269_FIXUP_LENOVO_DOCK,
7658 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7659 	ALC269_FIXUP_NO_SHUTUP,
7660 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7661 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7662 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7663 	ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7664 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7665 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7666 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7667 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7668 	ALC269_FIXUP_HEADSET_MODE,
7669 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7670 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7671 	ALC269_FIXUP_ASUS_X101_FUNC,
7672 	ALC269_FIXUP_ASUS_X101_VERB,
7673 	ALC269_FIXUP_ASUS_X101,
7674 	ALC271_FIXUP_AMIC_MIC2,
7675 	ALC271_FIXUP_HP_GATE_MIC_JACK,
7676 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7677 	ALC269_FIXUP_ACER_AC700,
7678 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7679 	ALC269VB_FIXUP_ASUS_ZENBOOK,
7680 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7681 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7682 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7683 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
7684 	ALC283_FIXUP_CHROME_BOOK,
7685 	ALC283_FIXUP_SENSE_COMBO_JACK,
7686 	ALC282_FIXUP_ASUS_TX300,
7687 	ALC283_FIXUP_INT_MIC,
7688 	ALC290_FIXUP_MONO_SPEAKERS,
7689 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7690 	ALC290_FIXUP_SUBWOOFER,
7691 	ALC290_FIXUP_SUBWOOFER_HSJACK,
7692 	ALC295_FIXUP_HP_MUTE_LED_COEFBIT11,
7693 	ALC269_FIXUP_THINKPAD_ACPI,
7694 	ALC269_FIXUP_LENOVO_XPAD_ACPI,
7695 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7696 	ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
7697 	ALC269VC_FIXUP_INFINIX_Y4_MAX,
7698 	ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7699 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7700 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7701 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7702 	ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7703 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7704 	ALC255_FIXUP_HEADSET_MODE,
7705 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7706 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7707 	ALC292_FIXUP_TPT440_DOCK,
7708 	ALC292_FIXUP_TPT440,
7709 	ALC283_FIXUP_HEADSET_MIC,
7710 	ALC255_FIXUP_MIC_MUTE_LED,
7711 	ALC282_FIXUP_ASPIRE_V5_PINS,
7712 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
7713 	ALC280_FIXUP_HP_GPIO4,
7714 	ALC286_FIXUP_HP_GPIO_LED,
7715 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7716 	ALC280_FIXUP_HP_DOCK_PINS,
7717 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7718 	ALC280_FIXUP_HP_9480M,
7719 	ALC245_FIXUP_HP_X360_AMP,
7720 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7721 	ALC285_FIXUP_HP_ENVY_X360,
7722 	ALC288_FIXUP_DELL_HEADSET_MODE,
7723 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7724 	ALC288_FIXUP_DELL_XPS_13,
7725 	ALC288_FIXUP_DISABLE_AAMIX,
7726 	ALC292_FIXUP_DELL_E7X_AAMIX,
7727 	ALC292_FIXUP_DELL_E7X,
7728 	ALC292_FIXUP_DISABLE_AAMIX,
7729 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7730 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7731 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7732 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7733 	ALC275_FIXUP_DELL_XPS,
7734 	ALC293_FIXUP_LENOVO_SPK_NOISE,
7735 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7736 	ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED,
7737 	ALC255_FIXUP_DELL_SPK_NOISE,
7738 	ALC225_FIXUP_DISABLE_MIC_VREF,
7739 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7740 	ALC295_FIXUP_DISABLE_DAC3,
7741 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
7742 	ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7743 	ALC285_FIXUP_ASUS_HEADSET_MIC,
7744 	ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7745 	ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7746 	ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7747 	ALC280_FIXUP_HP_HEADSET_MIC,
7748 	ALC221_FIXUP_HP_FRONT_MIC,
7749 	ALC292_FIXUP_TPT460,
7750 	ALC298_FIXUP_SPK_VOLUME,
7751 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
7752 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7753 	ALC269_FIXUP_ATIV_BOOK_8,
7754 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7755 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7756 	ALC256_FIXUP_ASUS_HEADSET_MODE,
7757 	ALC256_FIXUP_ASUS_MIC,
7758 	ALC256_FIXUP_ASUS_AIO_GPIO2,
7759 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7760 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7761 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
7762 	ALC233_FIXUP_ACER_HEADSET_MIC,
7763 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
7764 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7765 	ALC225_FIXUP_S3_POP_NOISE,
7766 	ALC700_FIXUP_INTEL_REFERENCE,
7767 	ALC274_FIXUP_DELL_BIND_DACS,
7768 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7769 	ALC298_FIXUP_TPT470_DOCK_FIX,
7770 	ALC298_FIXUP_TPT470_DOCK,
7771 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7772 	ALC255_FIXUP_DELL_HEADSET_MIC,
7773 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7774 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
7775 	ALC295_FIXUP_HP_X360,
7776 	ALC221_FIXUP_HP_HEADSET_MIC,
7777 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7778 	ALC295_FIXUP_HP_AUTO_MUTE,
7779 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7780 	ALC294_FIXUP_ASUS_MIC,
7781 	ALC294_FIXUP_ASUS_HEADSET_MIC,
7782 	ALC294_FIXUP_ASUS_SPK,
7783 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7784 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7785 	ALC255_FIXUP_ACER_HEADSET_MIC,
7786 	ALC295_FIXUP_CHROME_BOOK,
7787 	ALC225_FIXUP_HEADSET_JACK,
7788 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7789 	ALC225_FIXUP_WYSE_AUTO_MUTE,
7790 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7791 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7792 	ALC256_FIXUP_ASUS_HEADSET_MIC,
7793 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7794 	ALC255_FIXUP_PREDATOR_SUBWOOFER,
7795 	ALC299_FIXUP_PREDATOR_SPK,
7796 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7797 	ALC289_FIXUP_DELL_SPK1,
7798 	ALC289_FIXUP_DELL_SPK2,
7799 	ALC289_FIXUP_DUAL_SPK,
7800 	ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7801 	ALC294_FIXUP_SPK2_TO_DAC1,
7802 	ALC294_FIXUP_ASUS_DUAL_SPK,
7803 	ALC285_FIXUP_THINKPAD_X1_GEN7,
7804 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7805 	ALC294_FIXUP_ASUS_ALLY,
7806 	ALC294_FIXUP_ASUS_ALLY_PINS,
7807 	ALC294_FIXUP_ASUS_ALLY_VERBS,
7808 	ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7809 	ALC294_FIXUP_ASUS_HPE,
7810 	ALC294_FIXUP_ASUS_COEF_1B,
7811 	ALC294_FIXUP_ASUS_GX502_HP,
7812 	ALC294_FIXUP_ASUS_GX502_PINS,
7813 	ALC294_FIXUP_ASUS_GX502_VERBS,
7814 	ALC294_FIXUP_ASUS_GU502_HP,
7815 	ALC294_FIXUP_ASUS_GU502_PINS,
7816 	ALC294_FIXUP_ASUS_GU502_VERBS,
7817 	ALC294_FIXUP_ASUS_G513_PINS,
7818 	ALC285_FIXUP_ASUS_G533Z_PINS,
7819 	ALC285_FIXUP_HP_GPIO_LED,
7820 	ALC285_FIXUP_HP_MUTE_LED,
7821 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7822 	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7823 	ALC236_FIXUP_HP_GPIO_LED,
7824 	ALC236_FIXUP_HP_MUTE_LED,
7825 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7826 	ALC236_FIXUP_LENOVO_INV_DMIC,
7827 	ALC298_FIXUP_SAMSUNG_AMP,
7828 	ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS,
7829 	ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS,
7830 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7831 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7832 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7833 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7834 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
7835 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7836 	ALC289_FIXUP_ASUS_GA401,
7837 	ALC289_FIXUP_ASUS_GA502,
7838 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7839 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
7840 	ALC269_FIXUP_CZC_B20,
7841 	ALC269_FIXUP_CZC_TMI,
7842 	ALC269_FIXUP_CZC_L101,
7843 	ALC269_FIXUP_LEMOTE_A1802,
7844 	ALC269_FIXUP_LEMOTE_A190X,
7845 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
7846 	ALC233_FIXUP_INTEL_NUC8_DMIC,
7847 	ALC233_FIXUP_INTEL_NUC8_BOOST,
7848 	ALC256_FIXUP_INTEL_NUC10,
7849 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7850 	ALC274_FIXUP_HP_MIC,
7851 	ALC274_FIXUP_HP_HEADSET_MIC,
7852 	ALC274_FIXUP_HP_ENVY_GPIO,
7853 	ALC274_FIXUP_ASUS_ZEN_AIO_27,
7854 	ALC256_FIXUP_ASUS_HPE,
7855 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7856 	ALC287_FIXUP_HP_GPIO_LED,
7857 	ALC256_FIXUP_HP_HEADSET_MIC,
7858 	ALC245_FIXUP_HP_GPIO_LED,
7859 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7860 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7861 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7862 	ALC256_FIXUP_ACER_HEADSET_MIC,
7863 	ALC285_FIXUP_IDEAPAD_S740_COEF,
7864 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7865 	ALC295_FIXUP_ASUS_DACS,
7866 	ALC295_FIXUP_HP_OMEN,
7867 	ALC285_FIXUP_HP_SPECTRE_X360,
7868 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7869 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7870 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7871 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7872 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7873 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7874 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7875 	ALC298_FIXUP_LENOVO_C940_DUET7,
7876 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
7877 	ALC256_FIXUP_SET_COEF_DEFAULTS,
7878 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7879 	ALC233_FIXUP_NO_AUDIO_JACK,
7880 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7881 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7882 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7883 	ALC287_FIXUP_LEGION_16ACHG6,
7884 	ALC287_FIXUP_CS35L41_I2C_2,
7885 	ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7886 	ALC287_FIXUP_CS35L41_I2C_4,
7887 	ALC245_FIXUP_CS35L41_SPI_2,
7888 	ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7889 	ALC245_FIXUP_CS35L41_SPI_4,
7890 	ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7891 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7892 	ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7893 	ALC287_FIXUP_LEGION_16ITHG6,
7894 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7895 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7896 	ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7897 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7898 	ALC236_FIXUP_DELL_DUAL_CODECS,
7899 	ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7900 	ALC287_FIXUP_TAS2781_I2C,
7901 	ALC245_FIXUP_TAS2781_SPI_2,
7902 	ALC287_FIXUP_YOGA7_14ARB7_I2C,
7903 	ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7904 	ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT,
7905 	ALC245_FIXUP_HP_X360_MUTE_LEDS,
7906 	ALC287_FIXUP_THINKPAD_I2S_SPK,
7907 	ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7908 	ALC2XX_FIXUP_HEADSET_MIC,
7909 	ALC289_FIXUP_DELL_CS35L41_SPI_2,
7910 	ALC294_FIXUP_CS35L41_I2C_2,
7911 	ALC256_FIXUP_ACER_SFG16_MICMUTE_LED,
7912 	ALC256_FIXUP_HEADPHONE_AMP_VOL,
7913 	ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX,
7914 	ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX,
7915 	ALC285_FIXUP_ASUS_GA403U,
7916 	ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC,
7917 	ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1,
7918 	ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
7919 	ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1,
7920 	ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318,
7921 	ALC256_FIXUP_CHROME_BOOK,
7922 	ALC245_FIXUP_CLEVO_NOISY_MIC,
7923 	ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE,
7924 	ALC233_FIXUP_MEDION_MTL_SPK,
7925 	ALC294_FIXUP_BASS_SPEAKER_15,
7926 	ALC283_FIXUP_DELL_HP_RESUME,
7927 	ALC294_FIXUP_ASUS_CS35L41_SPI_2,
7928 };
7929 
7930 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7931  * both have the very same PCI SSID, and we need to apply different fixups
7932  * depending on the codec ID
7933  */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)7934 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7935 					   const struct hda_fixup *fix,
7936 					   int action)
7937 {
7938 	int id;
7939 
7940 	if (codec->core.vendor_id == 0x10ec0298)
7941 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7942 	else
7943 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7944 	__snd_hda_apply_fixup(codec, id, action, 0);
7945 }
7946 
7947 static const struct hda_fixup alc269_fixups[] = {
7948 	[ALC269_FIXUP_GPIO2] = {
7949 		.type = HDA_FIXUP_FUNC,
7950 		.v.func = alc_fixup_gpio2,
7951 	},
7952 	[ALC269_FIXUP_SONY_VAIO] = {
7953 		.type = HDA_FIXUP_PINCTLS,
7954 		.v.pins = (const struct hda_pintbl[]) {
7955 			{0x19, PIN_VREFGRD},
7956 			{}
7957 		}
7958 	},
7959 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7960 		.type = HDA_FIXUP_FUNC,
7961 		.v.func = alc275_fixup_gpio4_off,
7962 		.chained = true,
7963 		.chain_id = ALC269_FIXUP_SONY_VAIO
7964 	},
7965 	[ALC269_FIXUP_DELL_M101Z] = {
7966 		.type = HDA_FIXUP_VERBS,
7967 		.v.verbs = (const struct hda_verb[]) {
7968 			/* Enables internal speaker */
7969 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
7970 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7971 			{}
7972 		}
7973 	},
7974 	[ALC269_FIXUP_SKU_IGNORE] = {
7975 		.type = HDA_FIXUP_FUNC,
7976 		.v.func = alc_fixup_sku_ignore,
7977 	},
7978 	[ALC269_FIXUP_ASUS_G73JW] = {
7979 		.type = HDA_FIXUP_PINS,
7980 		.v.pins = (const struct hda_pintbl[]) {
7981 			{ 0x17, 0x99130111 }, /* subwoofer */
7982 			{ }
7983 		}
7984 	},
7985 	[ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7986 		.type = HDA_FIXUP_PINS,
7987 		.v.pins = (const struct hda_pintbl[]) {
7988 			{ 0x19, 0x03A11050 },
7989 			{ 0x1a, 0x03A11C30 },
7990 			{ 0x21, 0x03211420 },
7991 			{ }
7992 		}
7993 	},
7994 	[ALC269_FIXUP_ASUS_N7601ZM] = {
7995 		.type = HDA_FIXUP_VERBS,
7996 		.v.verbs = (const struct hda_verb[]) {
7997 			{0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7998 			{0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7999 			{0x20, AC_VERB_SET_COEF_INDEX, 0x10},
8000 			{0x20, AC_VERB_SET_PROC_COEF, 0x8420},
8001 			{0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
8002 			{0x20, AC_VERB_SET_PROC_COEF, 0x7774},
8003 			{ }
8004 		},
8005 		.chained = true,
8006 		.chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
8007 	},
8008 	[ALC269_FIXUP_LENOVO_EAPD] = {
8009 		.type = HDA_FIXUP_VERBS,
8010 		.v.verbs = (const struct hda_verb[]) {
8011 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
8012 			{}
8013 		}
8014 	},
8015 	[ALC275_FIXUP_SONY_HWEQ] = {
8016 		.type = HDA_FIXUP_FUNC,
8017 		.v.func = alc269_fixup_hweq,
8018 		.chained = true,
8019 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
8020 	},
8021 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
8022 		.type = HDA_FIXUP_FUNC,
8023 		.v.func = alc_fixup_disable_aamix,
8024 		.chained = true,
8025 		.chain_id = ALC269_FIXUP_SONY_VAIO
8026 	},
8027 	[ALC271_FIXUP_DMIC] = {
8028 		.type = HDA_FIXUP_FUNC,
8029 		.v.func = alc271_fixup_dmic,
8030 	},
8031 	[ALC269_FIXUP_PCM_44K] = {
8032 		.type = HDA_FIXUP_FUNC,
8033 		.v.func = alc269_fixup_pcm_44k,
8034 		.chained = true,
8035 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
8036 	},
8037 	[ALC269_FIXUP_STEREO_DMIC] = {
8038 		.type = HDA_FIXUP_FUNC,
8039 		.v.func = alc269_fixup_stereo_dmic,
8040 	},
8041 	[ALC269_FIXUP_HEADSET_MIC] = {
8042 		.type = HDA_FIXUP_FUNC,
8043 		.v.func = alc269_fixup_headset_mic,
8044 	},
8045 	[ALC269_FIXUP_QUANTA_MUTE] = {
8046 		.type = HDA_FIXUP_FUNC,
8047 		.v.func = alc269_fixup_quanta_mute,
8048 	},
8049 	[ALC269_FIXUP_LIFEBOOK] = {
8050 		.type = HDA_FIXUP_PINS,
8051 		.v.pins = (const struct hda_pintbl[]) {
8052 			{ 0x1a, 0x2101103f }, /* dock line-out */
8053 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
8054 			{ }
8055 		},
8056 		.chained = true,
8057 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
8058 	},
8059 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
8060 		.type = HDA_FIXUP_PINS,
8061 		.v.pins = (const struct hda_pintbl[]) {
8062 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
8063 			{ }
8064 		},
8065 	},
8066 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
8067 		.type = HDA_FIXUP_PINS,
8068 		.v.pins = (const struct hda_pintbl[]) {
8069 			{ 0x21, 0x0221102f }, /* HP out */
8070 			{ }
8071 		},
8072 	},
8073 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
8074 		.type = HDA_FIXUP_FUNC,
8075 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
8076 	},
8077 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
8078 		.type = HDA_FIXUP_FUNC,
8079 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
8080 	},
8081 	[ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13] = {
8082 		.type = HDA_FIXUP_PINS,
8083 		.v.pins = (const struct hda_pintbl[]) {
8084 			{ 0x14, 0x90170151 }, /* use as internal speaker (LFE) */
8085 			{ 0x1b, 0x90170152 }, /* use as internal speaker (back) */
8086 			{ }
8087 		},
8088 		.chained = true,
8089 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8090 	},
8091 	[ALC269VC_FIXUP_INFINIX_Y4_MAX] = {
8092 		.type = HDA_FIXUP_PINS,
8093 		.v.pins = (const struct hda_pintbl[]) {
8094 			{ 0x1b, 0x90170150 }, /* use as internal speaker */
8095 			{ }
8096 		},
8097 		.chained = true,
8098 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8099 	},
8100 	[ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
8101 		.type = HDA_FIXUP_PINS,
8102 		.v.pins = (const struct hda_pintbl[]) {
8103 			{ 0x18, 0x03a19020 }, /* headset mic */
8104 			{ 0x1b, 0x90170150 }, /* speaker */
8105 			{ }
8106 		},
8107 	},
8108 	[ALC269_FIXUP_AMIC] = {
8109 		.type = HDA_FIXUP_PINS,
8110 		.v.pins = (const struct hda_pintbl[]) {
8111 			{ 0x14, 0x99130110 }, /* speaker */
8112 			{ 0x15, 0x0121401f }, /* HP out */
8113 			{ 0x18, 0x01a19c20 }, /* mic */
8114 			{ 0x19, 0x99a3092f }, /* int-mic */
8115 			{ }
8116 		},
8117 	},
8118 	[ALC269_FIXUP_DMIC] = {
8119 		.type = HDA_FIXUP_PINS,
8120 		.v.pins = (const struct hda_pintbl[]) {
8121 			{ 0x12, 0x99a3092f }, /* int-mic */
8122 			{ 0x14, 0x99130110 }, /* speaker */
8123 			{ 0x15, 0x0121401f }, /* HP out */
8124 			{ 0x18, 0x01a19c20 }, /* mic */
8125 			{ }
8126 		},
8127 	},
8128 	[ALC269VB_FIXUP_AMIC] = {
8129 		.type = HDA_FIXUP_PINS,
8130 		.v.pins = (const struct hda_pintbl[]) {
8131 			{ 0x14, 0x99130110 }, /* speaker */
8132 			{ 0x18, 0x01a19c20 }, /* mic */
8133 			{ 0x19, 0x99a3092f }, /* int-mic */
8134 			{ 0x21, 0x0121401f }, /* HP out */
8135 			{ }
8136 		},
8137 	},
8138 	[ALC269VB_FIXUP_DMIC] = {
8139 		.type = HDA_FIXUP_PINS,
8140 		.v.pins = (const struct hda_pintbl[]) {
8141 			{ 0x12, 0x99a3092f }, /* int-mic */
8142 			{ 0x14, 0x99130110 }, /* speaker */
8143 			{ 0x18, 0x01a19c20 }, /* mic */
8144 			{ 0x21, 0x0121401f }, /* HP out */
8145 			{ }
8146 		},
8147 	},
8148 	[ALC269_FIXUP_HP_MUTE_LED] = {
8149 		.type = HDA_FIXUP_FUNC,
8150 		.v.func = alc269_fixup_hp_mute_led,
8151 	},
8152 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
8153 		.type = HDA_FIXUP_FUNC,
8154 		.v.func = alc269_fixup_hp_mute_led_mic1,
8155 	},
8156 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
8157 		.type = HDA_FIXUP_FUNC,
8158 		.v.func = alc269_fixup_hp_mute_led_mic2,
8159 	},
8160 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
8161 		.type = HDA_FIXUP_FUNC,
8162 		.v.func = alc269_fixup_hp_mute_led_mic3,
8163 		.chained = true,
8164 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
8165 	},
8166 	[ALC269_FIXUP_HP_GPIO_LED] = {
8167 		.type = HDA_FIXUP_FUNC,
8168 		.v.func = alc269_fixup_hp_gpio_led,
8169 	},
8170 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
8171 		.type = HDA_FIXUP_FUNC,
8172 		.v.func = alc269_fixup_hp_gpio_mic1_led,
8173 	},
8174 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
8175 		.type = HDA_FIXUP_FUNC,
8176 		.v.func = alc269_fixup_hp_line1_mic1_led,
8177 	},
8178 	[ALC269_FIXUP_INV_DMIC] = {
8179 		.type = HDA_FIXUP_FUNC,
8180 		.v.func = alc_fixup_inv_dmic,
8181 	},
8182 	[ALC269_FIXUP_NO_SHUTUP] = {
8183 		.type = HDA_FIXUP_FUNC,
8184 		.v.func = alc_fixup_no_shutup,
8185 	},
8186 	[ALC269_FIXUP_LENOVO_DOCK] = {
8187 		.type = HDA_FIXUP_PINS,
8188 		.v.pins = (const struct hda_pintbl[]) {
8189 			{ 0x19, 0x23a11040 }, /* dock mic */
8190 			{ 0x1b, 0x2121103f }, /* dock headphone */
8191 			{ }
8192 		},
8193 		.chained = true,
8194 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
8195 	},
8196 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
8197 		.type = HDA_FIXUP_FUNC,
8198 		.v.func = alc269_fixup_limit_int_mic_boost,
8199 		.chained = true,
8200 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
8201 	},
8202 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
8203 		.type = HDA_FIXUP_FUNC,
8204 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
8205 		.chained = true,
8206 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8207 	},
8208 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8209 		.type = HDA_FIXUP_PINS,
8210 		.v.pins = (const struct hda_pintbl[]) {
8211 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8212 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8213 			{ }
8214 		},
8215 		.chained = true,
8216 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8217 	},
8218 	[ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8219 		.type = HDA_FIXUP_FUNC,
8220 		.v.func = alc269_fixup_limit_int_mic_boost,
8221 		.chained = true,
8222 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8223 	},
8224 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8225 		.type = HDA_FIXUP_PINS,
8226 		.v.pins = (const struct hda_pintbl[]) {
8227 			{ 0x16, 0x21014020 }, /* dock line out */
8228 			{ 0x19, 0x21a19030 }, /* dock mic */
8229 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8230 			{ }
8231 		},
8232 		.chained = true,
8233 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8234 	},
8235 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
8236 		.type = HDA_FIXUP_PINS,
8237 		.v.pins = (const struct hda_pintbl[]) {
8238 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8239 			{ }
8240 		},
8241 		.chained = true,
8242 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8243 	},
8244 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
8245 		.type = HDA_FIXUP_PINS,
8246 		.v.pins = (const struct hda_pintbl[]) {
8247 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8248 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8249 			{ }
8250 		},
8251 		.chained = true,
8252 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8253 	},
8254 	[ALC269_FIXUP_HEADSET_MODE] = {
8255 		.type = HDA_FIXUP_FUNC,
8256 		.v.func = alc_fixup_headset_mode,
8257 		.chained = true,
8258 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8259 	},
8260 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8261 		.type = HDA_FIXUP_FUNC,
8262 		.v.func = alc_fixup_headset_mode_no_hp_mic,
8263 	},
8264 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
8265 		.type = HDA_FIXUP_PINS,
8266 		.v.pins = (const struct hda_pintbl[]) {
8267 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
8268 			{ }
8269 		},
8270 		.chained = true,
8271 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8272 	},
8273 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
8274 		.type = HDA_FIXUP_PINS,
8275 		.v.pins = (const struct hda_pintbl[]) {
8276 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8277 			{ }
8278 		},
8279 		.chained = true,
8280 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8281 	},
8282 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8283 		.type = HDA_FIXUP_PINS,
8284 		.v.pins = (const struct hda_pintbl[]) {
8285 			{0x12, 0x90a60130},
8286 			{0x13, 0x40000000},
8287 			{0x14, 0x90170110},
8288 			{0x18, 0x411111f0},
8289 			{0x19, 0x04a11040},
8290 			{0x1a, 0x411111f0},
8291 			{0x1b, 0x90170112},
8292 			{0x1d, 0x40759a05},
8293 			{0x1e, 0x411111f0},
8294 			{0x21, 0x04211020},
8295 			{ }
8296 		},
8297 		.chained = true,
8298 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8299 	},
8300 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
8301 		.type = HDA_FIXUP_FUNC,
8302 		.v.func = alc298_fixup_huawei_mbx_stereo,
8303 		.chained = true,
8304 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8305 	},
8306 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
8307 		.type = HDA_FIXUP_FUNC,
8308 		.v.func = alc269_fixup_x101_headset_mic,
8309 	},
8310 	[ALC269_FIXUP_ASUS_X101_VERB] = {
8311 		.type = HDA_FIXUP_VERBS,
8312 		.v.verbs = (const struct hda_verb[]) {
8313 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
8314 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8315 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
8316 			{ }
8317 		},
8318 		.chained = true,
8319 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
8320 	},
8321 	[ALC269_FIXUP_ASUS_X101] = {
8322 		.type = HDA_FIXUP_PINS,
8323 		.v.pins = (const struct hda_pintbl[]) {
8324 			{ 0x18, 0x04a1182c }, /* Headset mic */
8325 			{ }
8326 		},
8327 		.chained = true,
8328 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
8329 	},
8330 	[ALC271_FIXUP_AMIC_MIC2] = {
8331 		.type = HDA_FIXUP_PINS,
8332 		.v.pins = (const struct hda_pintbl[]) {
8333 			{ 0x14, 0x99130110 }, /* speaker */
8334 			{ 0x19, 0x01a19c20 }, /* mic */
8335 			{ 0x1b, 0x99a7012f }, /* int-mic */
8336 			{ 0x21, 0x0121401f }, /* HP out */
8337 			{ }
8338 		},
8339 	},
8340 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
8341 		.type = HDA_FIXUP_FUNC,
8342 		.v.func = alc271_hp_gate_mic_jack,
8343 		.chained = true,
8344 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
8345 	},
8346 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
8347 		.type = HDA_FIXUP_FUNC,
8348 		.v.func = alc269_fixup_limit_int_mic_boost,
8349 		.chained = true,
8350 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
8351 	},
8352 	[ALC269_FIXUP_ACER_AC700] = {
8353 		.type = HDA_FIXUP_PINS,
8354 		.v.pins = (const struct hda_pintbl[]) {
8355 			{ 0x12, 0x99a3092f }, /* int-mic */
8356 			{ 0x14, 0x99130110 }, /* speaker */
8357 			{ 0x18, 0x03a11c20 }, /* mic */
8358 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
8359 			{ 0x21, 0x0321101f }, /* HP out */
8360 			{ }
8361 		},
8362 		.chained = true,
8363 		.chain_id = ALC271_FIXUP_DMIC,
8364 	},
8365 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
8366 		.type = HDA_FIXUP_FUNC,
8367 		.v.func = alc269_fixup_limit_int_mic_boost,
8368 		.chained = true,
8369 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8370 	},
8371 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
8372 		.type = HDA_FIXUP_FUNC,
8373 		.v.func = alc269_fixup_limit_int_mic_boost,
8374 		.chained = true,
8375 		.chain_id = ALC269VB_FIXUP_DMIC,
8376 	},
8377 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
8378 		.type = HDA_FIXUP_VERBS,
8379 		.v.verbs = (const struct hda_verb[]) {
8380 			/* class-D output amp +5dB */
8381 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
8382 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
8383 			{}
8384 		},
8385 		.chained = true,
8386 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
8387 	},
8388 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8389 		.type = HDA_FIXUP_PINS,
8390 		.v.pins = (const struct hda_pintbl[]) {
8391 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
8392 			{ }
8393 		},
8394 		.chained = true,
8395 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8396 	},
8397 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
8398 		.type = HDA_FIXUP_FUNC,
8399 		.v.func = alc269_fixup_limit_int_mic_boost,
8400 		.chained = true,
8401 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
8402 	},
8403 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
8404 		.type = HDA_FIXUP_PINS,
8405 		.v.pins = (const struct hda_pintbl[]) {
8406 			{ 0x12, 0x99a3092f }, /* int-mic */
8407 			{ 0x18, 0x03a11d20 }, /* mic */
8408 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
8409 			{ }
8410 		},
8411 	},
8412 	[ALC283_FIXUP_CHROME_BOOK] = {
8413 		.type = HDA_FIXUP_FUNC,
8414 		.v.func = alc283_fixup_chromebook,
8415 	},
8416 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
8417 		.type = HDA_FIXUP_FUNC,
8418 		.v.func = alc283_fixup_sense_combo_jack,
8419 		.chained = true,
8420 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
8421 	},
8422 	[ALC282_FIXUP_ASUS_TX300] = {
8423 		.type = HDA_FIXUP_FUNC,
8424 		.v.func = alc282_fixup_asus_tx300,
8425 	},
8426 	[ALC283_FIXUP_INT_MIC] = {
8427 		.type = HDA_FIXUP_VERBS,
8428 		.v.verbs = (const struct hda_verb[]) {
8429 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
8430 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
8431 			{ }
8432 		},
8433 		.chained = true,
8434 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8435 	},
8436 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
8437 		.type = HDA_FIXUP_PINS,
8438 		.v.pins = (const struct hda_pintbl[]) {
8439 			{ 0x17, 0x90170112 }, /* subwoofer */
8440 			{ }
8441 		},
8442 		.chained = true,
8443 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
8444 	},
8445 	[ALC290_FIXUP_SUBWOOFER] = {
8446 		.type = HDA_FIXUP_PINS,
8447 		.v.pins = (const struct hda_pintbl[]) {
8448 			{ 0x17, 0x90170112 }, /* subwoofer */
8449 			{ }
8450 		},
8451 		.chained = true,
8452 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
8453 	},
8454 	[ALC290_FIXUP_MONO_SPEAKERS] = {
8455 		.type = HDA_FIXUP_FUNC,
8456 		.v.func = alc290_fixup_mono_speakers,
8457 	},
8458 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8459 		.type = HDA_FIXUP_FUNC,
8460 		.v.func = alc290_fixup_mono_speakers,
8461 		.chained = true,
8462 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8463 	},
8464 	[ALC269_FIXUP_THINKPAD_ACPI] = {
8465 		.type = HDA_FIXUP_FUNC,
8466 		.v.func = alc_fixup_thinkpad_acpi,
8467 		.chained = true,
8468 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
8469 	},
8470 	[ALC269_FIXUP_LENOVO_XPAD_ACPI] = {
8471 		.type = HDA_FIXUP_FUNC,
8472 		.v.func = alc_fixup_ideapad_acpi,
8473 		.chained = true,
8474 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8475 	},
8476 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8477 		.type = HDA_FIXUP_FUNC,
8478 		.v.func = alc_fixup_inv_dmic,
8479 		.chained = true,
8480 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8481 	},
8482 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8483 		.type = HDA_FIXUP_PINS,
8484 		.v.pins = (const struct hda_pintbl[]) {
8485 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8486 			{ }
8487 		},
8488 		.chained = true,
8489 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8490 	},
8491 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8492 		.type = HDA_FIXUP_PINS,
8493 		.v.pins = (const struct hda_pintbl[]) {
8494 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8495 			{ }
8496 		},
8497 		.chained = true,
8498 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8499 	},
8500 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8501 		.type = HDA_FIXUP_PINS,
8502 		.v.pins = (const struct hda_pintbl[]) {
8503 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8504 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8505 			{ }
8506 		},
8507 		.chained = true,
8508 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8509 	},
8510 	[ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8511 		.type = HDA_FIXUP_FUNC,
8512 		.v.func = alc269_fixup_limit_int_mic_boost,
8513 		.chained = true,
8514 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8515 	},
8516 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8517 		.type = HDA_FIXUP_PINS,
8518 		.v.pins = (const struct hda_pintbl[]) {
8519 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8520 			{ }
8521 		},
8522 		.chained = true,
8523 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8524 	},
8525 	[ALC255_FIXUP_HEADSET_MODE] = {
8526 		.type = HDA_FIXUP_FUNC,
8527 		.v.func = alc_fixup_headset_mode_alc255,
8528 		.chained = true,
8529 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8530 	},
8531 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8532 		.type = HDA_FIXUP_FUNC,
8533 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8534 	},
8535 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8536 		.type = HDA_FIXUP_PINS,
8537 		.v.pins = (const struct hda_pintbl[]) {
8538 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8539 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8540 			{ }
8541 		},
8542 		.chained = true,
8543 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8544 	},
8545 	[ALC292_FIXUP_TPT440_DOCK] = {
8546 		.type = HDA_FIXUP_FUNC,
8547 		.v.func = alc_fixup_tpt440_dock,
8548 		.chained = true,
8549 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8550 	},
8551 	[ALC292_FIXUP_TPT440] = {
8552 		.type = HDA_FIXUP_FUNC,
8553 		.v.func = alc_fixup_disable_aamix,
8554 		.chained = true,
8555 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
8556 	},
8557 	[ALC283_FIXUP_HEADSET_MIC] = {
8558 		.type = HDA_FIXUP_PINS,
8559 		.v.pins = (const struct hda_pintbl[]) {
8560 			{ 0x19, 0x04a110f0 },
8561 			{ },
8562 		},
8563 	},
8564 	[ALC255_FIXUP_MIC_MUTE_LED] = {
8565 		.type = HDA_FIXUP_FUNC,
8566 		.v.func = alc_fixup_micmute_led,
8567 	},
8568 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
8569 		.type = HDA_FIXUP_PINS,
8570 		.v.pins = (const struct hda_pintbl[]) {
8571 			{ 0x12, 0x90a60130 },
8572 			{ 0x14, 0x90170110 },
8573 			{ 0x17, 0x40000008 },
8574 			{ 0x18, 0x411111f0 },
8575 			{ 0x19, 0x01a1913c },
8576 			{ 0x1a, 0x411111f0 },
8577 			{ 0x1b, 0x411111f0 },
8578 			{ 0x1d, 0x40f89b2d },
8579 			{ 0x1e, 0x411111f0 },
8580 			{ 0x21, 0x0321101f },
8581 			{ },
8582 		},
8583 	},
8584 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8585 		.type = HDA_FIXUP_FUNC,
8586 		.v.func = alc269vb_fixup_aspire_e1_coef,
8587 	},
8588 	[ALC280_FIXUP_HP_GPIO4] = {
8589 		.type = HDA_FIXUP_FUNC,
8590 		.v.func = alc280_fixup_hp_gpio4,
8591 	},
8592 	[ALC286_FIXUP_HP_GPIO_LED] = {
8593 		.type = HDA_FIXUP_FUNC,
8594 		.v.func = alc286_fixup_hp_gpio_led,
8595 	},
8596 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8597 		.type = HDA_FIXUP_FUNC,
8598 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8599 	},
8600 	[ALC280_FIXUP_HP_DOCK_PINS] = {
8601 		.type = HDA_FIXUP_PINS,
8602 		.v.pins = (const struct hda_pintbl[]) {
8603 			{ 0x1b, 0x21011020 }, /* line-out */
8604 			{ 0x1a, 0x01a1903c }, /* headset mic */
8605 			{ 0x18, 0x2181103f }, /* line-in */
8606 			{ },
8607 		},
8608 		.chained = true,
8609 		.chain_id = ALC280_FIXUP_HP_GPIO4
8610 	},
8611 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8612 		.type = HDA_FIXUP_PINS,
8613 		.v.pins = (const struct hda_pintbl[]) {
8614 			{ 0x1b, 0x21011020 }, /* line-out */
8615 			{ 0x18, 0x2181103f }, /* line-in */
8616 			{ },
8617 		},
8618 		.chained = true,
8619 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8620 	},
8621 	[ALC280_FIXUP_HP_9480M] = {
8622 		.type = HDA_FIXUP_FUNC,
8623 		.v.func = alc280_fixup_hp_9480m,
8624 	},
8625 	[ALC245_FIXUP_HP_X360_AMP] = {
8626 		.type = HDA_FIXUP_FUNC,
8627 		.v.func = alc245_fixup_hp_x360_amp,
8628 		.chained = true,
8629 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
8630 	},
8631 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
8632 		.type = HDA_FIXUP_FUNC,
8633 		.v.func = alc_fixup_headset_mode_dell_alc288,
8634 		.chained = true,
8635 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8636 	},
8637 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8638 		.type = HDA_FIXUP_PINS,
8639 		.v.pins = (const struct hda_pintbl[]) {
8640 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8641 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8642 			{ }
8643 		},
8644 		.chained = true,
8645 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8646 	},
8647 	[ALC288_FIXUP_DISABLE_AAMIX] = {
8648 		.type = HDA_FIXUP_FUNC,
8649 		.v.func = alc_fixup_disable_aamix,
8650 		.chained = true,
8651 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8652 	},
8653 	[ALC288_FIXUP_DELL_XPS_13] = {
8654 		.type = HDA_FIXUP_FUNC,
8655 		.v.func = alc_fixup_dell_xps13,
8656 		.chained = true,
8657 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
8658 	},
8659 	[ALC292_FIXUP_DISABLE_AAMIX] = {
8660 		.type = HDA_FIXUP_FUNC,
8661 		.v.func = alc_fixup_disable_aamix,
8662 		.chained = true,
8663 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8664 	},
8665 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8666 		.type = HDA_FIXUP_FUNC,
8667 		.v.func = alc_fixup_disable_aamix,
8668 		.chained = true,
8669 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8670 	},
8671 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
8672 		.type = HDA_FIXUP_FUNC,
8673 		.v.func = alc_fixup_dell_xps13,
8674 		.chained = true,
8675 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
8676 	},
8677 	[ALC292_FIXUP_DELL_E7X] = {
8678 		.type = HDA_FIXUP_FUNC,
8679 		.v.func = alc_fixup_micmute_led,
8680 		/* micmute fixup must be applied at last */
8681 		.chained_before = true,
8682 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8683 	},
8684 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8685 		.type = HDA_FIXUP_PINS,
8686 		.v.pins = (const struct hda_pintbl[]) {
8687 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8688 			{ }
8689 		},
8690 		.chained_before = true,
8691 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8692 	},
8693 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8694 		.type = HDA_FIXUP_PINS,
8695 		.v.pins = (const struct hda_pintbl[]) {
8696 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8697 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8698 			{ }
8699 		},
8700 		.chained = true,
8701 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8702 	},
8703 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8704 		.type = HDA_FIXUP_PINS,
8705 		.v.pins = (const struct hda_pintbl[]) {
8706 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8707 			{ }
8708 		},
8709 		.chained = true,
8710 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8711 	},
8712 	[ALC275_FIXUP_DELL_XPS] = {
8713 		.type = HDA_FIXUP_VERBS,
8714 		.v.verbs = (const struct hda_verb[]) {
8715 			/* Enables internal speaker */
8716 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8717 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8718 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8719 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8720 			{}
8721 		}
8722 	},
8723 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8724 		.type = HDA_FIXUP_FUNC,
8725 		.v.func = alc_fixup_disable_aamix,
8726 		.chained = true,
8727 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8728 	},
8729 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8730 		.type = HDA_FIXUP_FUNC,
8731 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8732 	},
8733 	[ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED] = {
8734 		.type = HDA_FIXUP_FUNC,
8735 		.v.func = alc233_fixup_lenovo_low_en_micmute_led,
8736 	},
8737 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8738 		.type = HDA_FIXUP_FUNC,
8739 		.v.func = alc_fixup_inv_dmic,
8740 		.chained = true,
8741 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8742 	},
8743 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8744 		.type = HDA_FIXUP_FUNC,
8745 		.v.func = alc269_fixup_limit_int_mic_boost
8746 	},
8747 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
8748 		.type = HDA_FIXUP_FUNC,
8749 		.v.func = alc_fixup_disable_aamix,
8750 		.chained = true,
8751 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8752 	},
8753 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
8754 		.type = HDA_FIXUP_FUNC,
8755 		.v.func = alc_fixup_disable_mic_vref,
8756 		.chained = true,
8757 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8758 	},
8759 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8760 		.type = HDA_FIXUP_VERBS,
8761 		.v.verbs = (const struct hda_verb[]) {
8762 			/* Disable pass-through path for FRONT 14h */
8763 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8764 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8765 			{}
8766 		},
8767 		.chained = true,
8768 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8769 	},
8770 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
8771 		.type = HDA_FIXUP_FUNC,
8772 		.v.func = alc_fixup_disable_aamix,
8773 		.chained = true,
8774 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
8775 	},
8776 	[ALC221_FIXUP_HP_FRONT_MIC] = {
8777 		.type = HDA_FIXUP_PINS,
8778 		.v.pins = (const struct hda_pintbl[]) {
8779 			{ 0x19, 0x02a19020 }, /* Front Mic */
8780 			{ }
8781 		},
8782 	},
8783 	[ALC292_FIXUP_TPT460] = {
8784 		.type = HDA_FIXUP_FUNC,
8785 		.v.func = alc_fixup_tpt440_dock,
8786 		.chained = true,
8787 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8788 	},
8789 	[ALC298_FIXUP_SPK_VOLUME] = {
8790 		.type = HDA_FIXUP_FUNC,
8791 		.v.func = alc298_fixup_speaker_volume,
8792 		.chained = true,
8793 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8794 	},
8795 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8796 		.type = HDA_FIXUP_FUNC,
8797 		.v.func = alc298_fixup_speaker_volume,
8798 	},
8799 	[ALC295_FIXUP_DISABLE_DAC3] = {
8800 		.type = HDA_FIXUP_FUNC,
8801 		.v.func = alc295_fixup_disable_dac3,
8802 	},
8803 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8804 		.type = HDA_FIXUP_FUNC,
8805 		.v.func = alc285_fixup_speaker2_to_dac1,
8806 		.chained = true,
8807 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8808 	},
8809 	[ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8810 		.type = HDA_FIXUP_FUNC,
8811 		.v.func = alc285_fixup_speaker2_to_dac1,
8812 		.chained = true,
8813 		.chain_id = ALC245_FIXUP_CS35L41_SPI_2
8814 	},
8815 	[ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8816 		.type = HDA_FIXUP_PINS,
8817 		.v.pins = (const struct hda_pintbl[]) {
8818 			{ 0x19, 0x03a11050 },
8819 			{ 0x1b, 0x03a11c30 },
8820 			{ }
8821 		},
8822 		.chained = true,
8823 		.chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8824 	},
8825 	[ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8826 		.type = HDA_FIXUP_PINS,
8827 		.v.pins = (const struct hda_pintbl[]) {
8828 			{ 0x14, 0x90170120 },
8829 			{ }
8830 		},
8831 		.chained = true,
8832 		.chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8833 	},
8834 	[ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8835 		.type = HDA_FIXUP_FUNC,
8836 		.v.func = alc285_fixup_speaker2_to_dac1,
8837 		.chained = true,
8838 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2
8839 	},
8840 	[ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8841 		.type = HDA_FIXUP_PINS,
8842 		.v.pins = (const struct hda_pintbl[]) {
8843 			{ 0x19, 0x03a11050 },
8844 			{ 0x1b, 0x03a11c30 },
8845 			{ }
8846 		},
8847 		.chained = true,
8848 		.chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8849 	},
8850 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8851 		.type = HDA_FIXUP_PINS,
8852 		.v.pins = (const struct hda_pintbl[]) {
8853 			{ 0x1b, 0x90170151 },
8854 			{ }
8855 		},
8856 		.chained = true,
8857 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8858 	},
8859 	[ALC269_FIXUP_ATIV_BOOK_8] = {
8860 		.type = HDA_FIXUP_FUNC,
8861 		.v.func = alc_fixup_auto_mute_via_amp,
8862 		.chained = true,
8863 		.chain_id = ALC269_FIXUP_NO_SHUTUP
8864 	},
8865 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8866 		.type = HDA_FIXUP_PINS,
8867 		.v.pins = (const struct hda_pintbl[]) {
8868 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8869 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8870 			{ }
8871 		},
8872 		.chained = true,
8873 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8874 	},
8875 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8876 		.type = HDA_FIXUP_PINS,
8877 		.v.pins = (const struct hda_pintbl[]) {
8878 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8879 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8880 			{ }
8881 		},
8882 		.chained = true,
8883 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8884 	},
8885 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8886 		.type = HDA_FIXUP_FUNC,
8887 		.v.func = alc_fixup_headset_mode,
8888 	},
8889 	[ALC256_FIXUP_ASUS_MIC] = {
8890 		.type = HDA_FIXUP_PINS,
8891 		.v.pins = (const struct hda_pintbl[]) {
8892 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8893 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8894 			{ }
8895 		},
8896 		.chained = true,
8897 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8898 	},
8899 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8900 		.type = HDA_FIXUP_FUNC,
8901 		/* Set up GPIO2 for the speaker amp */
8902 		.v.func = alc_fixup_gpio4,
8903 	},
8904 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8905 		.type = HDA_FIXUP_PINS,
8906 		.v.pins = (const struct hda_pintbl[]) {
8907 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8908 			{ }
8909 		},
8910 		.chained = true,
8911 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8912 	},
8913 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8914 		.type = HDA_FIXUP_VERBS,
8915 		.v.verbs = (const struct hda_verb[]) {
8916 			/* Enables internal speaker */
8917 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8918 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8919 			{}
8920 		},
8921 		.chained = true,
8922 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8923 	},
8924 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8925 		.type = HDA_FIXUP_FUNC,
8926 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8927 		.chained = true,
8928 		.chain_id = ALC269_FIXUP_GPIO2
8929 	},
8930 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
8931 		.type = HDA_FIXUP_VERBS,
8932 		.v.verbs = (const struct hda_verb[]) {
8933 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8934 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8935 			{ }
8936 		},
8937 		.chained = true,
8938 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8939 	},
8940 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8941 		.type = HDA_FIXUP_PINS,
8942 		.v.pins = (const struct hda_pintbl[]) {
8943 			/* Change the mic location from front to right, otherwise there are
8944 			   two front mics with the same name, pulseaudio can't handle them.
8945 			   This is just a temporary workaround, after applying this fixup,
8946 			   there will be one "Front Mic" and one "Mic" in this machine.
8947 			 */
8948 			{ 0x1a, 0x04a19040 },
8949 			{ }
8950 		},
8951 	},
8952 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8953 		.type = HDA_FIXUP_PINS,
8954 		.v.pins = (const struct hda_pintbl[]) {
8955 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
8956 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8957 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8958 			{ 0x1b, 0x02011020 },
8959 			{ }
8960 		},
8961 		.chained = true,
8962 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
8963 	},
8964 	[ALC225_FIXUP_S3_POP_NOISE] = {
8965 		.type = HDA_FIXUP_FUNC,
8966 		.v.func = alc225_fixup_s3_pop_noise,
8967 		.chained = true,
8968 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8969 	},
8970 	[ALC700_FIXUP_INTEL_REFERENCE] = {
8971 		.type = HDA_FIXUP_VERBS,
8972 		.v.verbs = (const struct hda_verb[]) {
8973 			/* Enables internal speaker */
8974 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8975 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8976 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8977 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8978 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8979 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8980 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8981 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8982 			{}
8983 		}
8984 	},
8985 	[ALC274_FIXUP_DELL_BIND_DACS] = {
8986 		.type = HDA_FIXUP_FUNC,
8987 		.v.func = alc274_fixup_bind_dacs,
8988 		.chained = true,
8989 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8990 	},
8991 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8992 		.type = HDA_FIXUP_PINS,
8993 		.v.pins = (const struct hda_pintbl[]) {
8994 			{ 0x1b, 0x0401102f },
8995 			{ }
8996 		},
8997 		.chained = true,
8998 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
8999 	},
9000 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
9001 		.type = HDA_FIXUP_FUNC,
9002 		.v.func = alc_fixup_tpt470_dock,
9003 		.chained = true,
9004 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
9005 	},
9006 	[ALC298_FIXUP_TPT470_DOCK] = {
9007 		.type = HDA_FIXUP_FUNC,
9008 		.v.func = alc_fixup_tpt470_dacs,
9009 		.chained = true,
9010 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
9011 	},
9012 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
9013 		.type = HDA_FIXUP_PINS,
9014 		.v.pins = (const struct hda_pintbl[]) {
9015 			{ 0x14, 0x0201101f },
9016 			{ }
9017 		},
9018 		.chained = true,
9019 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9020 	},
9021 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
9022 		.type = HDA_FIXUP_PINS,
9023 		.v.pins = (const struct hda_pintbl[]) {
9024 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9025 			{ }
9026 		},
9027 		.chained = true,
9028 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9029 	},
9030 	[ALC295_FIXUP_HP_X360] = {
9031 		.type = HDA_FIXUP_FUNC,
9032 		.v.func = alc295_fixup_hp_top_speakers,
9033 		.chained = true,
9034 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
9035 	},
9036 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
9037 		.type = HDA_FIXUP_PINS,
9038 		.v.pins = (const struct hda_pintbl[]) {
9039 			{ 0x19, 0x0181313f},
9040 			{ }
9041 		},
9042 		.chained = true,
9043 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9044 	},
9045 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
9046 		.type = HDA_FIXUP_FUNC,
9047 		.v.func = alc285_fixup_invalidate_dacs,
9048 		.chained = true,
9049 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9050 	},
9051 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
9052 		.type = HDA_FIXUP_FUNC,
9053 		.v.func = alc_fixup_auto_mute_via_amp,
9054 	},
9055 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
9056 		.type = HDA_FIXUP_PINS,
9057 		.v.pins = (const struct hda_pintbl[]) {
9058 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9059 			{ }
9060 		},
9061 		.chained = true,
9062 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9063 	},
9064 	[ALC294_FIXUP_ASUS_MIC] = {
9065 		.type = HDA_FIXUP_PINS,
9066 		.v.pins = (const struct hda_pintbl[]) {
9067 			{ 0x13, 0x90a60160 }, /* use as internal mic */
9068 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
9069 			{ }
9070 		},
9071 		.chained = true,
9072 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9073 	},
9074 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
9075 		.type = HDA_FIXUP_PINS,
9076 		.v.pins = (const struct hda_pintbl[]) {
9077 			{ 0x19, 0x01a1103c }, /* use as headset mic */
9078 			{ }
9079 		},
9080 		.chained = true,
9081 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9082 	},
9083 	[ALC294_FIXUP_ASUS_SPK] = {
9084 		.type = HDA_FIXUP_VERBS,
9085 		.v.verbs = (const struct hda_verb[]) {
9086 			/* Set EAPD high */
9087 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
9088 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
9089 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9090 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
9091 			{ }
9092 		},
9093 		.chained = true,
9094 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9095 	},
9096 	[ALC295_FIXUP_CHROME_BOOK] = {
9097 		.type = HDA_FIXUP_FUNC,
9098 		.v.func = alc295_fixup_chromebook,
9099 		.chained = true,
9100 		.chain_id = ALC225_FIXUP_HEADSET_JACK
9101 	},
9102 	[ALC225_FIXUP_HEADSET_JACK] = {
9103 		.type = HDA_FIXUP_FUNC,
9104 		.v.func = alc_fixup_headset_jack,
9105 	},
9106 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9107 		.type = HDA_FIXUP_PINS,
9108 		.v.pins = (const struct hda_pintbl[]) {
9109 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9110 			{ }
9111 		},
9112 		.chained = true,
9113 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9114 	},
9115 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
9116 		.type = HDA_FIXUP_VERBS,
9117 		.v.verbs = (const struct hda_verb[]) {
9118 			/* Disable PCBEEP-IN passthrough */
9119 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
9120 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
9121 			{ }
9122 		},
9123 		.chained = true,
9124 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
9125 	},
9126 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
9127 		.type = HDA_FIXUP_PINS,
9128 		.v.pins = (const struct hda_pintbl[]) {
9129 			{ 0x19, 0x03a11130 },
9130 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
9131 			{ }
9132 		},
9133 		.chained = true,
9134 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
9135 	},
9136 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
9137 		.type = HDA_FIXUP_PINS,
9138 		.v.pins = (const struct hda_pintbl[]) {
9139 			{ 0x16, 0x01011020 }, /* Rear Line out */
9140 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
9141 			{ }
9142 		},
9143 		.chained = true,
9144 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
9145 	},
9146 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
9147 		.type = HDA_FIXUP_FUNC,
9148 		.v.func = alc_fixup_auto_mute_via_amp,
9149 		.chained = true,
9150 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
9151 	},
9152 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
9153 		.type = HDA_FIXUP_FUNC,
9154 		.v.func = alc_fixup_disable_mic_vref,
9155 		.chained = true,
9156 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9157 	},
9158 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
9159 		.type = HDA_FIXUP_VERBS,
9160 		.v.verbs = (const struct hda_verb[]) {
9161 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
9162 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
9163 			{ }
9164 		},
9165 		.chained = true,
9166 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
9167 	},
9168 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
9169 		.type = HDA_FIXUP_PINS,
9170 		.v.pins = (const struct hda_pintbl[]) {
9171 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9172 			{ }
9173 		},
9174 		.chained = true,
9175 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9176 	},
9177 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9178 		.type = HDA_FIXUP_PINS,
9179 		.v.pins = (const struct hda_pintbl[]) {
9180 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
9181 			{ }
9182 		},
9183 		.chained = true,
9184 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9185 	},
9186 	[ALC255_FIXUP_PREDATOR_SUBWOOFER] = {
9187 		.type = HDA_FIXUP_PINS,
9188 		.v.pins = (const struct hda_pintbl[]) {
9189 			{ 0x17, 0x90170151 }, /* use as internal speaker (LFE) */
9190 			{ 0x1b, 0x90170152 } /* use as internal speaker (back) */
9191 		}
9192 	},
9193 	[ALC299_FIXUP_PREDATOR_SPK] = {
9194 		.type = HDA_FIXUP_PINS,
9195 		.v.pins = (const struct hda_pintbl[]) {
9196 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
9197 			{ }
9198 		}
9199 	},
9200 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
9201 		.type = HDA_FIXUP_PINS,
9202 		.v.pins = (const struct hda_pintbl[]) {
9203 			{ 0x19, 0x04a11040 },
9204 			{ 0x21, 0x04211020 },
9205 			{ }
9206 		},
9207 		.chained = true,
9208 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9209 	},
9210 	[ALC289_FIXUP_DELL_SPK1] = {
9211 		.type = HDA_FIXUP_PINS,
9212 		.v.pins = (const struct hda_pintbl[]) {
9213 			{ 0x14, 0x90170140 },
9214 			{ }
9215 		},
9216 		.chained = true,
9217 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
9218 	},
9219 	[ALC289_FIXUP_DELL_SPK2] = {
9220 		.type = HDA_FIXUP_PINS,
9221 		.v.pins = (const struct hda_pintbl[]) {
9222 			{ 0x17, 0x90170130 }, /* bass spk */
9223 			{ }
9224 		},
9225 		.chained = true,
9226 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
9227 	},
9228 	[ALC289_FIXUP_DUAL_SPK] = {
9229 		.type = HDA_FIXUP_FUNC,
9230 		.v.func = alc285_fixup_speaker2_to_dac1,
9231 		.chained = true,
9232 		.chain_id = ALC289_FIXUP_DELL_SPK2
9233 	},
9234 	[ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
9235 		.type = HDA_FIXUP_FUNC,
9236 		.v.func = alc285_fixup_speaker2_to_dac1,
9237 		.chained = true,
9238 		.chain_id = ALC289_FIXUP_DELL_SPK1
9239 	},
9240 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
9241 		.type = HDA_FIXUP_FUNC,
9242 		.v.func = alc285_fixup_speaker2_to_dac1,
9243 		.chained = true,
9244 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9245 	},
9246 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
9247 		.type = HDA_FIXUP_FUNC,
9248 		/* The GPIO must be pulled to initialize the AMP */
9249 		.v.func = alc_fixup_gpio4,
9250 		.chained = true,
9251 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
9252 	},
9253 	[ALC294_FIXUP_ASUS_ALLY] = {
9254 		.type = HDA_FIXUP_FUNC,
9255 		.v.func = cs35l41_fixup_i2c_two,
9256 		.chained = true,
9257 		.chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
9258 	},
9259 	[ALC294_FIXUP_ASUS_ALLY_PINS] = {
9260 		.type = HDA_FIXUP_PINS,
9261 		.v.pins = (const struct hda_pintbl[]) {
9262 			{ 0x19, 0x03a11050 },
9263 			{ 0x1a, 0x03a11c30 },
9264 			{ 0x21, 0x03211420 },
9265 			{ }
9266 		},
9267 		.chained = true,
9268 		.chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
9269 	},
9270 	[ALC294_FIXUP_ASUS_ALLY_VERBS] = {
9271 		.type = HDA_FIXUP_VERBS,
9272 		.v.verbs = (const struct hda_verb[]) {
9273 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9274 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9275 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
9276 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
9277 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
9278 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
9279 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
9280 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
9281 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
9282 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
9283 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
9284 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
9285 			{ }
9286 		},
9287 		.chained = true,
9288 		.chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
9289 	},
9290 	[ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
9291 		.type = HDA_FIXUP_FUNC,
9292 		.v.func = alc285_fixup_speaker2_to_dac1,
9293 	},
9294 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
9295 		.type = HDA_FIXUP_FUNC,
9296 		.v.func = alc285_fixup_thinkpad_x1_gen7,
9297 		.chained = true,
9298 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9299 	},
9300 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
9301 		.type = HDA_FIXUP_FUNC,
9302 		.v.func = alc_fixup_headset_jack,
9303 		.chained = true,
9304 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
9305 	},
9306 	[ALC294_FIXUP_ASUS_HPE] = {
9307 		.type = HDA_FIXUP_VERBS,
9308 		.v.verbs = (const struct hda_verb[]) {
9309 			/* Set EAPD high */
9310 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9311 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
9312 			{ }
9313 		},
9314 		.chained = true,
9315 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9316 	},
9317 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
9318 		.type = HDA_FIXUP_PINS,
9319 		.v.pins = (const struct hda_pintbl[]) {
9320 			{ 0x19, 0x03a11050 }, /* front HP mic */
9321 			{ 0x1a, 0x01a11830 }, /* rear external mic */
9322 			{ 0x21, 0x03211020 }, /* front HP out */
9323 			{ }
9324 		},
9325 		.chained = true,
9326 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
9327 	},
9328 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
9329 		.type = HDA_FIXUP_VERBS,
9330 		.v.verbs = (const struct hda_verb[]) {
9331 			/* set 0x15 to HP-OUT ctrl */
9332 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9333 			/* unmute the 0x15 amp */
9334 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
9335 			{ }
9336 		},
9337 		.chained = true,
9338 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
9339 	},
9340 	[ALC294_FIXUP_ASUS_GX502_HP] = {
9341 		.type = HDA_FIXUP_FUNC,
9342 		.v.func = alc294_fixup_gx502_hp,
9343 	},
9344 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
9345 		.type = HDA_FIXUP_PINS,
9346 		.v.pins = (const struct hda_pintbl[]) {
9347 			{ 0x19, 0x01a11050 }, /* rear HP mic */
9348 			{ 0x1a, 0x01a11830 }, /* rear external mic */
9349 			{ 0x21, 0x012110f0 }, /* rear HP out */
9350 			{ }
9351 		},
9352 		.chained = true,
9353 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
9354 	},
9355 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
9356 		.type = HDA_FIXUP_VERBS,
9357 		.v.verbs = (const struct hda_verb[]) {
9358 			/* set 0x15 to HP-OUT ctrl */
9359 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9360 			/* unmute the 0x15 amp */
9361 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
9362 			/* set 0x1b to HP-OUT */
9363 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9364 			{ }
9365 		},
9366 		.chained = true,
9367 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
9368 	},
9369 	[ALC294_FIXUP_ASUS_GU502_HP] = {
9370 		.type = HDA_FIXUP_FUNC,
9371 		.v.func = alc294_fixup_gu502_hp,
9372 	},
9373 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
9374 		.type = HDA_FIXUP_PINS,
9375 		.v.pins = (const struct hda_pintbl[]) {
9376 				{ 0x19, 0x03a11050 }, /* front HP mic */
9377 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
9378 				{ 0x21, 0x03211420 }, /* front HP out */
9379 				{ }
9380 		},
9381 	},
9382 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
9383 		.type = HDA_FIXUP_PINS,
9384 		.v.pins = (const struct hda_pintbl[]) {
9385 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
9386 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
9387 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
9388 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
9389 			{ 0x21, 0x03211420 },
9390 			{ }
9391 		},
9392 	},
9393 	[ALC294_FIXUP_ASUS_COEF_1B] = {
9394 		.type = HDA_FIXUP_VERBS,
9395 		.v.verbs = (const struct hda_verb[]) {
9396 			/* Set bit 10 to correct noisy output after reboot from
9397 			 * Windows 10 (due to pop noise reduction?)
9398 			 */
9399 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
9400 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
9401 			{ }
9402 		},
9403 		.chained = true,
9404 		.chain_id = ALC289_FIXUP_ASUS_GA401,
9405 	},
9406 	[ALC285_FIXUP_HP_GPIO_LED] = {
9407 		.type = HDA_FIXUP_FUNC,
9408 		.v.func = alc285_fixup_hp_gpio_led,
9409 	},
9410 	[ALC285_FIXUP_HP_MUTE_LED] = {
9411 		.type = HDA_FIXUP_FUNC,
9412 		.v.func = alc285_fixup_hp_mute_led,
9413 	},
9414 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
9415 		.type = HDA_FIXUP_FUNC,
9416 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
9417 	},
9418 	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
9419 	    .type = HDA_FIXUP_FUNC,
9420 	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
9421 	},
9422 	[ALC236_FIXUP_HP_GPIO_LED] = {
9423 		.type = HDA_FIXUP_FUNC,
9424 		.v.func = alc236_fixup_hp_gpio_led,
9425 	},
9426 	[ALC236_FIXUP_HP_MUTE_LED] = {
9427 		.type = HDA_FIXUP_FUNC,
9428 		.v.func = alc236_fixup_hp_mute_led,
9429 	},
9430 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
9431 		.type = HDA_FIXUP_FUNC,
9432 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
9433 	},
9434 	[ALC236_FIXUP_LENOVO_INV_DMIC] = {
9435 		.type = HDA_FIXUP_FUNC,
9436 		.v.func = alc_fixup_inv_dmic,
9437 		.chained = true,
9438 		.chain_id = ALC283_FIXUP_INT_MIC,
9439 	},
9440 	[ALC295_FIXUP_HP_MUTE_LED_COEFBIT11] = {
9441 		.type = HDA_FIXUP_FUNC,
9442 		.v.func = alc295_fixup_hp_mute_led_coefbit11,
9443 	},
9444 	[ALC298_FIXUP_SAMSUNG_AMP] = {
9445 		.type = HDA_FIXUP_FUNC,
9446 		.v.func = alc298_fixup_samsung_amp,
9447 		.chained = true,
9448 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
9449 	},
9450 	[ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS] = {
9451 		.type = HDA_FIXUP_FUNC,
9452 		.v.func = alc298_fixup_samsung_amp_v2_2_amps
9453 	},
9454 	[ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS] = {
9455 		.type = HDA_FIXUP_FUNC,
9456 		.v.func = alc298_fixup_samsung_amp_v2_4_amps
9457 	},
9458 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9459 		.type = HDA_FIXUP_VERBS,
9460 		.v.verbs = (const struct hda_verb[]) {
9461 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
9462 			{ }
9463 		},
9464 	},
9465 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9466 		.type = HDA_FIXUP_VERBS,
9467 		.v.verbs = (const struct hda_verb[]) {
9468 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
9469 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
9470 			{ }
9471 		},
9472 	},
9473 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9474 		.type = HDA_FIXUP_PINS,
9475 		.v.pins = (const struct hda_pintbl[]) {
9476 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9477 			{ }
9478 		},
9479 		.chained = true,
9480 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9481 	},
9482 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
9483 		.type = HDA_FIXUP_PINS,
9484 		.v.pins = (const struct hda_pintbl[]) {
9485 			{ 0x14, 0x90100120 }, /* use as internal speaker */
9486 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
9487 			{ 0x1a, 0x01011020 }, /* use as line out */
9488 			{ },
9489 		},
9490 		.chained = true,
9491 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9492 	},
9493 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9494 		.type = HDA_FIXUP_PINS,
9495 		.v.pins = (const struct hda_pintbl[]) {
9496 			{ 0x18, 0x02a11030 }, /* use as headset mic */
9497 			{ }
9498 		},
9499 		.chained = true,
9500 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9501 	},
9502 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9503 		.type = HDA_FIXUP_PINS,
9504 		.v.pins = (const struct hda_pintbl[]) {
9505 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9506 			{ }
9507 		},
9508 		.chained = true,
9509 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9510 	},
9511 	[ALC289_FIXUP_ASUS_GA401] = {
9512 		.type = HDA_FIXUP_FUNC,
9513 		.v.func = alc289_fixup_asus_ga401,
9514 		.chained = true,
9515 		.chain_id = ALC289_FIXUP_ASUS_GA502,
9516 	},
9517 	[ALC289_FIXUP_ASUS_GA502] = {
9518 		.type = HDA_FIXUP_PINS,
9519 		.v.pins = (const struct hda_pintbl[]) {
9520 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9521 			{ }
9522 		},
9523 	},
9524 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9525 		.type = HDA_FIXUP_PINS,
9526 		.v.pins = (const struct hda_pintbl[]) {
9527 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9528 			{ }
9529 		},
9530 		.chained = true,
9531 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9532 	},
9533 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9534 		.type = HDA_FIXUP_FUNC,
9535 		.v.func = alc285_fixup_hp_gpio_amp_init,
9536 		.chained = true,
9537 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
9538 	},
9539 	[ALC269_FIXUP_CZC_B20] = {
9540 		.type = HDA_FIXUP_PINS,
9541 		.v.pins = (const struct hda_pintbl[]) {
9542 			{ 0x12, 0x411111f0 },
9543 			{ 0x14, 0x90170110 }, /* speaker */
9544 			{ 0x15, 0x032f1020 }, /* HP out */
9545 			{ 0x17, 0x411111f0 },
9546 			{ 0x18, 0x03ab1040 }, /* mic */
9547 			{ 0x19, 0xb7a7013f },
9548 			{ 0x1a, 0x0181305f },
9549 			{ 0x1b, 0x411111f0 },
9550 			{ 0x1d, 0x411111f0 },
9551 			{ 0x1e, 0x411111f0 },
9552 			{ }
9553 		},
9554 		.chain_id = ALC269_FIXUP_DMIC,
9555 	},
9556 	[ALC269_FIXUP_CZC_TMI] = {
9557 		.type = HDA_FIXUP_PINS,
9558 		.v.pins = (const struct hda_pintbl[]) {
9559 			{ 0x12, 0x4000c000 },
9560 			{ 0x14, 0x90170110 }, /* speaker */
9561 			{ 0x15, 0x0421401f }, /* HP out */
9562 			{ 0x17, 0x411111f0 },
9563 			{ 0x18, 0x04a19020 }, /* mic */
9564 			{ 0x19, 0x411111f0 },
9565 			{ 0x1a, 0x411111f0 },
9566 			{ 0x1b, 0x411111f0 },
9567 			{ 0x1d, 0x40448505 },
9568 			{ 0x1e, 0x411111f0 },
9569 			{ 0x20, 0x8000ffff },
9570 			{ }
9571 		},
9572 		.chain_id = ALC269_FIXUP_DMIC,
9573 	},
9574 	[ALC269_FIXUP_CZC_L101] = {
9575 		.type = HDA_FIXUP_PINS,
9576 		.v.pins = (const struct hda_pintbl[]) {
9577 			{ 0x12, 0x40000000 },
9578 			{ 0x14, 0x01014010 }, /* speaker */
9579 			{ 0x15, 0x411111f0 }, /* HP out */
9580 			{ 0x16, 0x411111f0 },
9581 			{ 0x18, 0x01a19020 }, /* mic */
9582 			{ 0x19, 0x02a19021 },
9583 			{ 0x1a, 0x0181302f },
9584 			{ 0x1b, 0x0221401f },
9585 			{ 0x1c, 0x411111f0 },
9586 			{ 0x1d, 0x4044c601 },
9587 			{ 0x1e, 0x411111f0 },
9588 			{ }
9589 		},
9590 		.chain_id = ALC269_FIXUP_DMIC,
9591 	},
9592 	[ALC269_FIXUP_LEMOTE_A1802] = {
9593 		.type = HDA_FIXUP_PINS,
9594 		.v.pins = (const struct hda_pintbl[]) {
9595 			{ 0x12, 0x40000000 },
9596 			{ 0x14, 0x90170110 }, /* speaker */
9597 			{ 0x17, 0x411111f0 },
9598 			{ 0x18, 0x03a19040 }, /* mic1 */
9599 			{ 0x19, 0x90a70130 }, /* mic2 */
9600 			{ 0x1a, 0x411111f0 },
9601 			{ 0x1b, 0x411111f0 },
9602 			{ 0x1d, 0x40489d2d },
9603 			{ 0x1e, 0x411111f0 },
9604 			{ 0x20, 0x0003ffff },
9605 			{ 0x21, 0x03214020 },
9606 			{ }
9607 		},
9608 		.chain_id = ALC269_FIXUP_DMIC,
9609 	},
9610 	[ALC269_FIXUP_LEMOTE_A190X] = {
9611 		.type = HDA_FIXUP_PINS,
9612 		.v.pins = (const struct hda_pintbl[]) {
9613 			{ 0x14, 0x99130110 }, /* speaker */
9614 			{ 0x15, 0x0121401f }, /* HP out */
9615 			{ 0x18, 0x01a19c20 }, /* rear  mic */
9616 			{ 0x19, 0x99a3092f }, /* front mic */
9617 			{ 0x1b, 0x0201401f }, /* front lineout */
9618 			{ }
9619 		},
9620 		.chain_id = ALC269_FIXUP_DMIC,
9621 	},
9622 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9623 		.type = HDA_FIXUP_PINS,
9624 		.v.pins = (const struct hda_pintbl[]) {
9625 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9626 			{ }
9627 		},
9628 		.chained = true,
9629 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9630 	},
9631 	[ALC256_FIXUP_INTEL_NUC10] = {
9632 		.type = HDA_FIXUP_PINS,
9633 		.v.pins = (const struct hda_pintbl[]) {
9634 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9635 			{ }
9636 		},
9637 		.chained = true,
9638 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9639 	},
9640 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9641 		.type = HDA_FIXUP_VERBS,
9642 		.v.verbs = (const struct hda_verb[]) {
9643 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9644 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9645 			{ }
9646 		},
9647 		.chained = true,
9648 		.chain_id = ALC289_FIXUP_ASUS_GA502
9649 	},
9650 	[ALC274_FIXUP_HP_MIC] = {
9651 		.type = HDA_FIXUP_VERBS,
9652 		.v.verbs = (const struct hda_verb[]) {
9653 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9654 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9655 			{ }
9656 		},
9657 	},
9658 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
9659 		.type = HDA_FIXUP_FUNC,
9660 		.v.func = alc274_fixup_hp_headset_mic,
9661 		.chained = true,
9662 		.chain_id = ALC274_FIXUP_HP_MIC
9663 	},
9664 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
9665 		.type = HDA_FIXUP_FUNC,
9666 		.v.func = alc274_fixup_hp_envy_gpio,
9667 	},
9668 	[ALC274_FIXUP_ASUS_ZEN_AIO_27] = {
9669 		.type = HDA_FIXUP_VERBS,
9670 		.v.verbs = (const struct hda_verb[]) {
9671 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x10 },
9672 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc420 },
9673 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
9674 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
9675 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
9676 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0249 },
9677 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
9678 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x202b },
9679 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x62 },
9680 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa007 },
9681 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
9682 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5060 },
9683 			{}
9684 		},
9685 		.chained = true,
9686 		.chain_id = ALC2XX_FIXUP_HEADSET_MIC,
9687 	},
9688 	[ALC256_FIXUP_ASUS_HPE] = {
9689 		.type = HDA_FIXUP_VERBS,
9690 		.v.verbs = (const struct hda_verb[]) {
9691 			/* Set EAPD high */
9692 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9693 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9694 			{ }
9695 		},
9696 		.chained = true,
9697 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9698 	},
9699 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9700 		.type = HDA_FIXUP_FUNC,
9701 		.v.func = alc_fixup_headset_jack,
9702 		.chained = true,
9703 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9704 	},
9705 	[ALC287_FIXUP_HP_GPIO_LED] = {
9706 		.type = HDA_FIXUP_FUNC,
9707 		.v.func = alc287_fixup_hp_gpio_led,
9708 	},
9709 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
9710 		.type = HDA_FIXUP_FUNC,
9711 		.v.func = alc274_fixup_hp_headset_mic,
9712 	},
9713 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9714 		.type = HDA_FIXUP_FUNC,
9715 		.v.func = alc_fixup_no_int_mic,
9716 		.chained = true,
9717 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9718 	},
9719 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9720 		.type = HDA_FIXUP_PINS,
9721 		.v.pins = (const struct hda_pintbl[]) {
9722 			{ 0x1b, 0x411111f0 },
9723 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9724 			{ },
9725 		},
9726 		.chained = true,
9727 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9728 	},
9729 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9730 		.type = HDA_FIXUP_FUNC,
9731 		.v.func = alc269_fixup_limit_int_mic_boost,
9732 		.chained = true,
9733 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9734 	},
9735 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
9736 		.type = HDA_FIXUP_PINS,
9737 		.v.pins = (const struct hda_pintbl[]) {
9738 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9739 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
9740 			{ }
9741 		},
9742 		.chained = true,
9743 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9744 	},
9745 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9746 		.type = HDA_FIXUP_FUNC,
9747 		.v.func = alc285_fixup_ideapad_s740_coef,
9748 		.chained = true,
9749 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9750 	},
9751 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9752 		.type = HDA_FIXUP_FUNC,
9753 		.v.func = alc269_fixup_limit_int_mic_boost,
9754 		.chained = true,
9755 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9756 	},
9757 	[ALC295_FIXUP_ASUS_DACS] = {
9758 		.type = HDA_FIXUP_FUNC,
9759 		.v.func = alc295_fixup_asus_dacs,
9760 	},
9761 	[ALC295_FIXUP_HP_OMEN] = {
9762 		.type = HDA_FIXUP_PINS,
9763 		.v.pins = (const struct hda_pintbl[]) {
9764 			{ 0x12, 0xb7a60130 },
9765 			{ 0x13, 0x40000000 },
9766 			{ 0x14, 0x411111f0 },
9767 			{ 0x16, 0x411111f0 },
9768 			{ 0x17, 0x90170110 },
9769 			{ 0x18, 0x411111f0 },
9770 			{ 0x19, 0x02a11030 },
9771 			{ 0x1a, 0x411111f0 },
9772 			{ 0x1b, 0x04a19030 },
9773 			{ 0x1d, 0x40600001 },
9774 			{ 0x1e, 0x411111f0 },
9775 			{ 0x21, 0x03211020 },
9776 			{}
9777 		},
9778 		.chained = true,
9779 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9780 	},
9781 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
9782 		.type = HDA_FIXUP_FUNC,
9783 		.v.func = alc285_fixup_hp_spectre_x360,
9784 	},
9785 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9786 		.type = HDA_FIXUP_FUNC,
9787 		.v.func = alc285_fixup_hp_spectre_x360_eb1
9788 	},
9789 	[ALC285_FIXUP_HP_ENVY_X360] = {
9790 		.type = HDA_FIXUP_FUNC,
9791 		.v.func = alc285_fixup_hp_envy_x360,
9792 		.chained = true,
9793 		.chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9794 	},
9795 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9796 		.type = HDA_FIXUP_FUNC,
9797 		.v.func = alc285_fixup_ideapad_s740_coef,
9798 		.chained = true,
9799 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9800 	},
9801 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9802 		.type = HDA_FIXUP_FUNC,
9803 		.v.func = alc_fixup_no_shutup,
9804 		.chained = true,
9805 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
9806 	},
9807 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9808 		.type = HDA_FIXUP_PINS,
9809 		.v.pins = (const struct hda_pintbl[]) {
9810 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9811 			{ }
9812 		},
9813 		.chained = true,
9814 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9815 	},
9816 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9817 		.type = HDA_FIXUP_FUNC,
9818 		.v.func = alc269_fixup_limit_int_mic_boost,
9819 		.chained = true,
9820 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9821 	},
9822 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9823 		.type = HDA_FIXUP_FUNC,
9824 		.v.func = alc285_fixup_ideapad_s740_coef,
9825 		.chained = true,
9826 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9827 	},
9828 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9829 		.type = HDA_FIXUP_FUNC,
9830 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9831 		.chained = true,
9832 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9833 	},
9834 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9835 		.type = HDA_FIXUP_VERBS,
9836 		//.v.verbs = legion_15imhg05_coefs,
9837 		.v.verbs = (const struct hda_verb[]) {
9838 			 // set left speaker Legion 7i.
9839 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9840 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9841 
9842 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9843 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9844 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9845 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9846 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9847 
9848 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9849 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9850 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9851 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9852 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9853 
9854 			 // set right speaker Legion 7i.
9855 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9856 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9857 
9858 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9859 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9860 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9861 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9862 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9863 
9864 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9865 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9866 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9867 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9868 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9869 			 {}
9870 		},
9871 		.chained = true,
9872 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9873 	},
9874 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9875 		.type = HDA_FIXUP_FUNC,
9876 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9877 		.chained = true,
9878 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9879 	},
9880 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9881 		.type = HDA_FIXUP_VERBS,
9882 		.v.verbs = (const struct hda_verb[]) {
9883 			 // set left speaker Yoga 7i.
9884 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9885 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9886 
9887 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9888 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9889 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9890 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9891 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9892 
9893 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9894 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9895 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9896 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9897 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9898 
9899 			 // set right speaker Yoga 7i.
9900 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9901 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9902 
9903 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9904 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9905 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9906 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9907 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9908 
9909 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9910 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9911 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9912 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9913 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9914 			 {}
9915 		},
9916 		.chained = true,
9917 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9918 	},
9919 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
9920 		.type = HDA_FIXUP_FUNC,
9921 		.v.func = alc298_fixup_lenovo_c940_duet7,
9922 	},
9923 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9924 		.type = HDA_FIXUP_VERBS,
9925 		.v.verbs = (const struct hda_verb[]) {
9926 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9927 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9928 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9929 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9930 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9931 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9932 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9933 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9934 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9935 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9936 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9937 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9938 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9939 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9940 			{}
9941 		},
9942 		.chained = true,
9943 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9944 	},
9945 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9946 		.type = HDA_FIXUP_FUNC,
9947 		.v.func = alc256_fixup_set_coef_defaults,
9948 	},
9949 	[ALC245_FIXUP_HP_GPIO_LED] = {
9950 		.type = HDA_FIXUP_FUNC,
9951 		.v.func = alc245_fixup_hp_gpio_led,
9952 	},
9953 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9954 		.type = HDA_FIXUP_PINS,
9955 		.v.pins = (const struct hda_pintbl[]) {
9956 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9957 			{ }
9958 		},
9959 		.chained = true,
9960 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9961 	},
9962 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
9963 		.type = HDA_FIXUP_FUNC,
9964 		.v.func = alc233_fixup_no_audio_jack,
9965 	},
9966 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9967 		.type = HDA_FIXUP_FUNC,
9968 		.v.func = alc256_fixup_mic_no_presence_and_resume,
9969 		.chained = true,
9970 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9971 	},
9972 	[ALC287_FIXUP_LEGION_16ACHG6] = {
9973 		.type = HDA_FIXUP_FUNC,
9974 		.v.func = alc287_fixup_legion_16achg6_speakers,
9975 	},
9976 	[ALC287_FIXUP_CS35L41_I2C_2] = {
9977 		.type = HDA_FIXUP_FUNC,
9978 		.v.func = cs35l41_fixup_i2c_two,
9979 	},
9980 	[ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9981 		.type = HDA_FIXUP_FUNC,
9982 		.v.func = cs35l41_fixup_i2c_two,
9983 		.chained = true,
9984 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9985 	},
9986 	[ALC287_FIXUP_CS35L41_I2C_4] = {
9987 		.type = HDA_FIXUP_FUNC,
9988 		.v.func = cs35l41_fixup_i2c_four,
9989 	},
9990 	[ALC245_FIXUP_CS35L41_SPI_2] = {
9991 		.type = HDA_FIXUP_FUNC,
9992 		.v.func = cs35l41_fixup_spi_two,
9993 	},
9994 	[ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9995 		.type = HDA_FIXUP_FUNC,
9996 		.v.func = cs35l41_fixup_spi_two,
9997 		.chained = true,
9998 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9999 	},
10000 	[ALC245_FIXUP_CS35L41_SPI_4] = {
10001 		.type = HDA_FIXUP_FUNC,
10002 		.v.func = cs35l41_fixup_spi_four,
10003 	},
10004 	[ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
10005 		.type = HDA_FIXUP_FUNC,
10006 		.v.func = cs35l41_fixup_spi_four,
10007 		.chained = true,
10008 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
10009 	},
10010 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
10011 		.type = HDA_FIXUP_VERBS,
10012 		.v.verbs = (const struct hda_verb[]) {
10013 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
10014 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
10015 			 { }
10016 		},
10017 		.chained = true,
10018 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
10019 	},
10020 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
10021 		.type = HDA_FIXUP_FUNC,
10022 		.v.func = alc_fixup_dell4_mic_no_presence_quiet,
10023 		.chained = true,
10024 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10025 	},
10026 	[ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
10027 		.type = HDA_FIXUP_PINS,
10028 		.v.pins = (const struct hda_pintbl[]) {
10029 			{ 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
10030 			{ }
10031 		},
10032 		.chained = true,
10033 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
10034 	},
10035 	[ALC287_FIXUP_LEGION_16ITHG6] = {
10036 		.type = HDA_FIXUP_FUNC,
10037 		.v.func = alc287_fixup_legion_16ithg6_speakers,
10038 	},
10039 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
10040 		.type = HDA_FIXUP_VERBS,
10041 		.v.verbs = (const struct hda_verb[]) {
10042 			// enable left speaker
10043 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10044 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
10045 
10046 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10047 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
10048 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10049 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
10050 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10051 
10052 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10053 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
10054 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10055 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
10056 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10057 
10058 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10059 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
10060 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10061 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
10062 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10063 
10064 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10065 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10066 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10067 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10068 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10069 
10070 			// enable right speaker
10071 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10072 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
10073 
10074 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10075 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
10076 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10077 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
10078 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10079 
10080 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10081 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
10082 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10083 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
10084 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10085 
10086 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10087 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
10088 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10089 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
10090 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10091 
10092 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10093 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10094 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10095 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10096 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10097 
10098 			{ },
10099 		},
10100 	},
10101 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
10102 		.type = HDA_FIXUP_FUNC,
10103 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
10104 		.chained = true,
10105 		.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
10106 	},
10107 	[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
10108 		.type = HDA_FIXUP_FUNC,
10109 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
10110 		.chained = true,
10111 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2,
10112 	},
10113 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
10114 		.type = HDA_FIXUP_FUNC,
10115 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
10116 		.chained = true,
10117 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10118 	},
10119 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
10120 		.type = HDA_FIXUP_PINS,
10121 		.v.func = alc1220_fixup_gb_dual_codecs,
10122 		.chained = true,
10123 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10124 	},
10125 	[ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
10126 		.type = HDA_FIXUP_FUNC,
10127 		.v.func = cs35l41_fixup_i2c_two,
10128 		.chained = true,
10129 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10130 	},
10131 	[ALC287_FIXUP_TAS2781_I2C] = {
10132 		.type = HDA_FIXUP_FUNC,
10133 		.v.func = tas2781_fixup_i2c,
10134 		.chained = true,
10135 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10136 	},
10137 	[ALC245_FIXUP_TAS2781_SPI_2] = {
10138 		.type = HDA_FIXUP_FUNC,
10139 		.v.func = tas2781_fixup_spi,
10140 		.chained = true,
10141 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
10142 	},
10143 	[ALC287_FIXUP_YOGA7_14ARB7_I2C] = {
10144 		.type = HDA_FIXUP_FUNC,
10145 		.v.func = yoga7_14arb7_fixup_i2c,
10146 		.chained = true,
10147 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10148 	},
10149 	[ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
10150 		.type = HDA_FIXUP_FUNC,
10151 		.v.func = alc245_fixup_hp_mute_led_coefbit,
10152 	},
10153 	[ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT] = {
10154 		.type = HDA_FIXUP_FUNC,
10155 		.v.func = alc245_fixup_hp_mute_led_v1_coefbit,
10156 	},
10157 	[ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
10158 		.type = HDA_FIXUP_FUNC,
10159 		.v.func = alc245_fixup_hp_mute_led_coefbit,
10160 		.chained = true,
10161 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
10162 	},
10163 	[ALC287_FIXUP_THINKPAD_I2S_SPK] = {
10164 		.type = HDA_FIXUP_FUNC,
10165 		.v.func = alc287_fixup_bind_dacs,
10166 		.chained = true,
10167 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10168 	},
10169 	[ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
10170 		.type = HDA_FIXUP_FUNC,
10171 		.v.func = alc287_fixup_bind_dacs,
10172 		.chained = true,
10173 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
10174 	},
10175 	[ALC2XX_FIXUP_HEADSET_MIC] = {
10176 		.type = HDA_FIXUP_FUNC,
10177 		.v.func = alc_fixup_headset_mic,
10178 	},
10179 	[ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
10180 		.type = HDA_FIXUP_FUNC,
10181 		.v.func = cs35l41_fixup_spi_two,
10182 		.chained = true,
10183 		.chain_id = ALC289_FIXUP_DUAL_SPK
10184 	},
10185 	[ALC294_FIXUP_CS35L41_I2C_2] = {
10186 		.type = HDA_FIXUP_FUNC,
10187 		.v.func = cs35l41_fixup_i2c_two,
10188 	},
10189 	[ALC256_FIXUP_ACER_SFG16_MICMUTE_LED] = {
10190 		.type = HDA_FIXUP_FUNC,
10191 		.v.func = alc256_fixup_acer_sfg16_micmute_led,
10192 	},
10193 	[ALC256_FIXUP_HEADPHONE_AMP_VOL] = {
10194 		.type = HDA_FIXUP_FUNC,
10195 		.v.func = alc256_decrease_headphone_amp_val,
10196 	},
10197 	[ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX] = {
10198 		.type = HDA_FIXUP_FUNC,
10199 		.v.func = alc245_fixup_hp_spectre_x360_eu0xxx,
10200 	},
10201 	[ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX] = {
10202 		.type = HDA_FIXUP_FUNC,
10203 		.v.func = alc245_fixup_hp_spectre_x360_16_aa0xxx,
10204 	},
10205 	[ALC285_FIXUP_ASUS_GA403U] = {
10206 		.type = HDA_FIXUP_FUNC,
10207 		.v.func = alc285_fixup_asus_ga403u,
10208 	},
10209 	[ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC] = {
10210 		.type = HDA_FIXUP_PINS,
10211 		.v.pins = (const struct hda_pintbl[]) {
10212 			{ 0x19, 0x03a11050 },
10213 			{ 0x1b, 0x03a11c30 },
10214 			{ }
10215 		},
10216 		.chained = true,
10217 		.chain_id = ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1
10218 	},
10219 	[ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1] = {
10220 		.type = HDA_FIXUP_FUNC,
10221 		.v.func = alc285_fixup_speaker2_to_dac1,
10222 		.chained = true,
10223 		.chain_id = ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
10224 	},
10225 	[ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC] = {
10226 		.type = HDA_FIXUP_PINS,
10227 		.v.pins = (const struct hda_pintbl[]) {
10228 			{ 0x19, 0x03a11050 },
10229 			{ 0x1b, 0x03a11c30 },
10230 			{ }
10231 		},
10232 	},
10233 	[ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1] = {
10234 		.type = HDA_FIXUP_FUNC,
10235 		.v.func = alc285_fixup_speaker2_to_dac1,
10236 		.chained = true,
10237 		.chain_id = ALC285_FIXUP_ASUS_GA403U,
10238 	},
10239 	[ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318] = {
10240 		.type = HDA_FIXUP_FUNC,
10241 		.v.func = alc287_fixup_lenovo_thinkpad_with_alc1318,
10242 		.chained = true,
10243 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
10244 	},
10245 	[ALC256_FIXUP_CHROME_BOOK] = {
10246 		.type = HDA_FIXUP_FUNC,
10247 		.v.func = alc256_fixup_chromebook,
10248 		.chained = true,
10249 		.chain_id = ALC225_FIXUP_HEADSET_JACK
10250 	},
10251 	[ALC245_FIXUP_CLEVO_NOISY_MIC] = {
10252 		.type = HDA_FIXUP_FUNC,
10253 		.v.func = alc269_fixup_limit_int_mic_boost,
10254 		.chained = true,
10255 		.chain_id = ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
10256 	},
10257 	[ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE] = {
10258 		.type = HDA_FIXUP_PINS,
10259 		.v.pins = (const struct hda_pintbl[]) {
10260 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10261 			{ 0x1b, 0x20a11040 }, /* dock mic */
10262 			{ }
10263 		},
10264 		.chained = true,
10265 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
10266 	},
10267 	[ALC233_FIXUP_MEDION_MTL_SPK] = {
10268 		.type = HDA_FIXUP_PINS,
10269 		.v.pins = (const struct hda_pintbl[]) {
10270 			{ 0x1b, 0x90170110 },
10271 			{ }
10272 		},
10273 	},
10274 	[ALC294_FIXUP_BASS_SPEAKER_15] = {
10275 		.type = HDA_FIXUP_FUNC,
10276 		.v.func = alc294_fixup_bass_speaker_15,
10277 	},
10278 	[ALC283_FIXUP_DELL_HP_RESUME] = {
10279 		.type = HDA_FIXUP_FUNC,
10280 		.v.func = alc283_fixup_dell_hp_resume,
10281 	},
10282 	[ALC294_FIXUP_ASUS_CS35L41_SPI_2] = {
10283 		.type = HDA_FIXUP_FUNC,
10284 		.v.func = cs35l41_fixup_spi_two,
10285 		.chained = true,
10286 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC,
10287 	},
10288 };
10289 
10290 static const struct hda_quirk alc269_fixup_tbl[] = {
10291 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
10292 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
10293 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
10294 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
10295 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10296 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
10297 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
10298 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10299 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10300 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
10301 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10302 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
10303 	SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10304 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
10305 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
10306 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
10307 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
10308 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10309 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10310 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10311 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
10312 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
10313 	SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10314 	SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10315 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
10316 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10317 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
10318 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
10319 	SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10320 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10321 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10322 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10323 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
10324 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10325 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10326 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10327 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
10328 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
10329 	SND_PCI_QUIRK(0x1025, 0x1360, "Acer Aspire A115", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10330 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10331 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10332 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10333 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
10334 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10335 	SND_PCI_QUIRK(0x1025, 0x159c, "Acer Nitro 5 AN515-58", ALC2XX_FIXUP_HEADSET_MIC),
10336 	SND_PCI_QUIRK(0x1025, 0x169a, "Acer Swift SFG16", ALC256_FIXUP_ACER_SFG16_MICMUTE_LED),
10337 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
10338 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
10339 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
10340 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
10341 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
10342 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
10343 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
10344 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
10345 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10346 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10347 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10348 	SND_PCI_QUIRK(0x1028, 0x0604, "Dell Venue 11 Pro 7130", ALC283_FIXUP_DELL_HP_RESUME),
10349 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
10350 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
10351 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
10352 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
10353 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
10354 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10355 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10356 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
10357 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
10358 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
10359 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
10360 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10361 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10362 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10363 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10364 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10365 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10366 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10367 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
10368 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
10369 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
10370 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
10371 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
10372 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
10373 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
10374 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
10375 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10376 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10377 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
10378 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
10379 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
10380 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
10381 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
10382 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10383 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
10384 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
10385 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
10386 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
10387 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
10388 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
10389 	SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
10390 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
10391 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
10392 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
10393 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10394 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10395 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
10396 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
10397 	SND_PCI_QUIRK(0x1028, 0x0b27, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
10398 	SND_PCI_QUIRK(0x1028, 0x0b28, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
10399 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10400 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10401 	SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10402 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10403 	SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10404 	SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10405 	SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10406 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
10407 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
10408 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
10409 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
10410 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
10411 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
10412 	SND_PCI_QUIRK(0x1028, 0x0c28, "Dell Inspiron 16 Plus 7630", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10413 	SND_PCI_QUIRK(0x1028, 0x0c4d, "Dell", ALC287_FIXUP_CS35L41_I2C_4),
10414 	SND_PCI_QUIRK(0x1028, 0x0c94, "Dell Polaris 3 metal", ALC287_FIXUP_TAS2781_I2C),
10415 	SND_PCI_QUIRK(0x1028, 0x0c96, "Dell Polaris 2in1", ALC287_FIXUP_TAS2781_I2C),
10416 	SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10417 	SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10418 	SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10419 	SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10420 	SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10421 	SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10422 	SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10423 	SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10424 	SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10425 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10426 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10427 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
10428 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
10429 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
10430 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10431 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10432 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10433 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10434 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
10435 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10436 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10437 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10438 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10439 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10440 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10441 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10442 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10443 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10444 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10445 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10446 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10447 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10448 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
10449 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
10450 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10451 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10452 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10453 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10454 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10455 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10456 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10457 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10458 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
10459 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10460 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
10461 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10462 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
10463 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10464 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10465 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10466 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10467 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10468 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10469 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10470 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10471 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10472 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10473 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10474 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10475 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10476 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10477 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
10478 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10479 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10480 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10481 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10482 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10483 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10484 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
10485 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10486 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10487 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
10488 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
10489 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
10490 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
10491 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
10492 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10493 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10494 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10495 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10496 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10497 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10498 	SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10499 	SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10500 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
10501 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10502 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
10503 	SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10504 	SND_PCI_QUIRK(0x103c, 0x85c6, "HP Pavilion x360 Convertible 14-dy1xxx", ALC295_FIXUP_HP_MUTE_LED_COEFBIT11),
10505 	SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
10506 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10507 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10508 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10509 	SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10510 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
10511 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10512 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10513 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
10514 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10515 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10516 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
10517 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
10518 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
10519 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10520 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10521 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10522 	SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
10523 	SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10524 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
10525 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10526 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
10527 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10528 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
10529 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10530 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10531 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10532 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10533 	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10534 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
10535 	SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10536 	SND_PCI_QUIRK(0x103c, 0x87df, "HP ProBook 430 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10537 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10538 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10539 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10540 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10541 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
10542 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
10543 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10544 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10545 	SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10546 	SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10547 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10548 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10549 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10550 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10551 	SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10552 	SND_PCI_QUIRK(0x103c, 0x881e, "HP Laptop 15s-du3xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10553 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10554 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10555 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10556 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10557 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10558 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10559 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10560 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10561 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10562 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10563 	SND_PCI_QUIRK(0x103c, 0x887c, "HP Laptop 14s-fq1xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10564 	SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10565 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
10566 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
10567 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
10568 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10569 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
10570 	SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
10571 	SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
10572 	SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10573 	SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
10574 	SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10575 	SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10576 	SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10577 	SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10578 	SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10579 	SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10580 	SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10581 	SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
10582 	SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
10583 	SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10584 	SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10585 	SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10586 	SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
10587 	SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10588 	SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
10589 	SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
10590 	SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
10591 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
10592 	SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
10593 	SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
10594 	SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10595 	SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10596 	SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10597 	SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10598 	SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10599 	SND_PCI_QUIRK(0x103c, 0x89e7, "HP Elite x2 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10600 	SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
10601 	SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10602 	SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10603 	SND_PCI_QUIRK(0x103c, 0x8a28, "HP Envy 13", ALC287_FIXUP_CS35L41_I2C_2),
10604 	SND_PCI_QUIRK(0x103c, 0x8a29, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10605 	SND_PCI_QUIRK(0x103c, 0x8a2a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10606 	SND_PCI_QUIRK(0x103c, 0x8a2b, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10607 	SND_PCI_QUIRK(0x103c, 0x8a2c, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10608 	SND_PCI_QUIRK(0x103c, 0x8a2d, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10609 	SND_PCI_QUIRK(0x103c, 0x8a2e, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10610 	SND_PCI_QUIRK(0x103c, 0x8a30, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10611 	SND_PCI_QUIRK(0x103c, 0x8a31, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10612 	SND_PCI_QUIRK(0x103c, 0x8a6e, "HP EDNA 360", ALC287_FIXUP_CS35L41_I2C_4),
10613 	SND_PCI_QUIRK(0x103c, 0x8a74, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10614 	SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10615 	SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
10616 	SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
10617 	SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
10618 	SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
10619 	SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
10620 	SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10621 	SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10622 	SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10623 	SND_PCI_QUIRK(0x103c, 0x8ad8, "HP 800 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10624 	SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10625 	SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10626 	SND_PCI_QUIRK(0x103c, 0x8b3a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10627 	SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
10628 	SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10629 	SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10630 	SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10631 	SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10632 	SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10633 	SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10634 	SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10635 	SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10636 	SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10637 	SND_PCI_QUIRK(0x103c, 0x8b5f, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10638 	SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10639 	SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10640 	SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10641 	SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10642 	SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10643 	SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10644 	SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
10645 	SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10646 	SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10647 	SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
10648 	SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10649 	SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
10650 	SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10651 	SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10652 	SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10653 	SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10654 	SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10655 	SND_PCI_QUIRK(0x103c, 0x8bb3, "HP Slim OMEN", ALC287_FIXUP_CS35L41_I2C_2),
10656 	SND_PCI_QUIRK(0x103c, 0x8bb4, "HP Slim OMEN", ALC287_FIXUP_CS35L41_I2C_2),
10657 	SND_PCI_QUIRK(0x103c, 0x8bcd, "HP Omen 16-xd0xxx", ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT),
10658 	SND_PCI_QUIRK(0x103c, 0x8bdd, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10659 	SND_PCI_QUIRK(0x103c, 0x8bde, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10660 	SND_PCI_QUIRK(0x103c, 0x8bdf, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10661 	SND_PCI_QUIRK(0x103c, 0x8be0, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10662 	SND_PCI_QUIRK(0x103c, 0x8be1, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10663 	SND_PCI_QUIRK(0x103c, 0x8be2, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10664 	SND_PCI_QUIRK(0x103c, 0x8be3, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10665 	SND_PCI_QUIRK(0x103c, 0x8be5, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10666 	SND_PCI_QUIRK(0x103c, 0x8be6, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10667 	SND_PCI_QUIRK(0x103c, 0x8be7, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10668 	SND_PCI_QUIRK(0x103c, 0x8be8, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10669 	SND_PCI_QUIRK(0x103c, 0x8be9, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10670 	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10671 	SND_PCI_QUIRK(0x103c, 0x8c15, "HP Spectre x360 2-in-1 Laptop 14-eu0xxx", ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX),
10672 	SND_PCI_QUIRK(0x103c, 0x8c16, "HP Spectre x360 2-in-1 Laptop 16-aa0xxx", ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX),
10673 	SND_PCI_QUIRK(0x103c, 0x8c17, "HP Spectre 16", ALC287_FIXUP_CS35L41_I2C_2),
10674 	SND_PCI_QUIRK(0x103c, 0x8c21, "HP Pavilion Plus Laptop 14-ey0XXX", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10675 	SND_PCI_QUIRK(0x103c, 0x8c30, "HP Victus 15-fb1xxx", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10676 	SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10677 	SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10678 	SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10679 	SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10680 	SND_PCI_QUIRK(0x103c, 0x8c4d, "HP Omen", ALC287_FIXUP_CS35L41_I2C_2),
10681 	SND_PCI_QUIRK(0x103c, 0x8c4e, "HP Omen", ALC287_FIXUP_CS35L41_I2C_2),
10682 	SND_PCI_QUIRK(0x103c, 0x8c4f, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10683 	SND_PCI_QUIRK(0x103c, 0x8c50, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10684 	SND_PCI_QUIRK(0x103c, 0x8c51, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10685 	SND_PCI_QUIRK(0x103c, 0x8c52, "HP EliteBook 1040 G11", ALC285_FIXUP_HP_GPIO_LED),
10686 	SND_PCI_QUIRK(0x103c, 0x8c53, "HP Elite x360 1040 2-in-1 G11", ALC285_FIXUP_HP_GPIO_LED),
10687 	SND_PCI_QUIRK(0x103c, 0x8c66, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10688 	SND_PCI_QUIRK(0x103c, 0x8c67, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10689 	SND_PCI_QUIRK(0x103c, 0x8c68, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10690 	SND_PCI_QUIRK(0x103c, 0x8c6a, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10691 	SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10692 	SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10693 	SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10694 	SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10695 	SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10696 	SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10697 	SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10698 	SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10699 	SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10700 	SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10701 	SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10702 	SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10703 	SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10704 	SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10705 	SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10706 	SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10707 	SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10708 	SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10709 	SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10710 	SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10711 	SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10712 	SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10713 	SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10714 	SND_PCI_QUIRK(0x103c, 0x8caf, "HP Elite mt645 G8 Mobile Thin Client", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10715 	SND_PCI_QUIRK(0x103c, 0x8cbd, "HP Pavilion Aero Laptop 13-bg0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10716 	SND_PCI_QUIRK(0x103c, 0x8cdd, "HP Spectre", ALC287_FIXUP_CS35L41_I2C_2),
10717 	SND_PCI_QUIRK(0x103c, 0x8cde, "HP Spectre", ALC287_FIXUP_CS35L41_I2C_2),
10718 	SND_PCI_QUIRK(0x103c, 0x8cdf, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10719 	SND_PCI_QUIRK(0x103c, 0x8ce0, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10720 	SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10721 	SND_PCI_QUIRK(0x103c, 0x8d01, "HP ZBook Power 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10722 	SND_PCI_QUIRK(0x103c, 0x8d84, "HP EliteBook X G1i", ALC285_FIXUP_HP_GPIO_LED),
10723 	SND_PCI_QUIRK(0x103c, 0x8d85, "HP EliteBook 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10724 	SND_PCI_QUIRK(0x103c, 0x8d86, "HP Elite X360 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10725 	SND_PCI_QUIRK(0x103c, 0x8d8c, "HP EliteBook 13 G12", ALC285_FIXUP_HP_GPIO_LED),
10726 	SND_PCI_QUIRK(0x103c, 0x8d8d, "HP Elite X360 13 G12", ALC285_FIXUP_HP_GPIO_LED),
10727 	SND_PCI_QUIRK(0x103c, 0x8d8e, "HP EliteBook 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10728 	SND_PCI_QUIRK(0x103c, 0x8d8f, "HP EliteBook 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10729 	SND_PCI_QUIRK(0x103c, 0x8d90, "HP EliteBook 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10730 	SND_PCI_QUIRK(0x103c, 0x8d91, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10731 	SND_PCI_QUIRK(0x103c, 0x8d92, "HP ZBook Firefly 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10732 	SND_PCI_QUIRK(0x103c, 0x8de8, "HP Gemtree", ALC245_FIXUP_TAS2781_SPI_2),
10733 	SND_PCI_QUIRK(0x103c, 0x8de9, "HP Gemtree", ALC245_FIXUP_TAS2781_SPI_2),
10734 	SND_PCI_QUIRK(0x103c, 0x8dec, "HP EliteBook 640 G12", ALC236_FIXUP_HP_GPIO_LED),
10735 	SND_PCI_QUIRK(0x103c, 0x8dee, "HP EliteBook 660 G12", ALC236_FIXUP_HP_GPIO_LED),
10736 	SND_PCI_QUIRK(0x103c, 0x8df0, "HP EliteBook 630 G12", ALC236_FIXUP_HP_GPIO_LED),
10737 	SND_PCI_QUIRK(0x103c, 0x8dfc, "HP EliteBook 645 G12", ALC236_FIXUP_HP_GPIO_LED),
10738 	SND_PCI_QUIRK(0x103c, 0x8dfe, "HP EliteBook 665 G12", ALC236_FIXUP_HP_GPIO_LED),
10739 	SND_PCI_QUIRK(0x103c, 0x8e14, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10740 	SND_PCI_QUIRK(0x103c, 0x8e15, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10741 	SND_PCI_QUIRK(0x103c, 0x8e16, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10742 	SND_PCI_QUIRK(0x103c, 0x8e17, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10743 	SND_PCI_QUIRK(0x103c, 0x8e18, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10744 	SND_PCI_QUIRK(0x103c, 0x8e19, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10745 	SND_PCI_QUIRK(0x103c, 0x8e1a, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10746 	SND_PCI_QUIRK(0x103c, 0x8e1b, "HP EliteBook G12", ALC285_FIXUP_HP_GPIO_LED),
10747 	SND_PCI_QUIRK(0x103c, 0x8e1c, "HP EliteBook G12", ALC285_FIXUP_HP_GPIO_LED),
10748 	SND_PCI_QUIRK(0x103c, 0x8e2c, "HP EliteBook 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10749 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10750 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10751 	SND_PCI_QUIRK(0x1043, 0x1054, "ASUS G614FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2),
10752 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10753 	SND_PCI_QUIRK(0x1043, 0x106f, "ASUS VivoBook X515UA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10754 	SND_PCI_QUIRK(0x1043, 0x1074, "ASUS G614PH/PM/PP", ALC287_FIXUP_CS35L41_I2C_2),
10755 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10756 	SND_PCI_QUIRK(0x1043, 0x10a4, "ASUS TP3407SA", ALC287_FIXUP_TAS2781_I2C),
10757 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10758 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10759 	SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10760 	SND_PCI_QUIRK(0x1043, 0x1154, "ASUS TP3607SH", ALC287_FIXUP_TAS2781_I2C),
10761 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10762 	SND_PCI_QUIRK(0x1043, 0x1194, "ASUS UM3406KA", ALC287_FIXUP_CS35L41_I2C_2),
10763 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10764 	SND_PCI_QUIRK(0x1043, 0x1204, "ASUS Strix G615JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C),
10765 	SND_PCI_QUIRK(0x1043, 0x1214, "ASUS Strix G615LH_LM_LP", ALC287_FIXUP_TAS2781_I2C),
10766 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10767 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10768 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10769 	SND_PCI_QUIRK(0x1043, 0x1294, "ASUS B3405CVA", ALC245_FIXUP_CS35L41_SPI_2),
10770 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10771 	SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10772 	SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10773 	SND_PCI_QUIRK(0x1043, 0x12b4, "ASUS B3405CCA / P3405CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10774 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10775 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10776 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10777 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10778 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10779 	SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVV", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10780 	SND_PCI_QUIRK(0x1043, 0x1460, "Asus VivoBook 15", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10781 	SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X/GA402N", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10782 	SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604VI/VC/VE/VG/VJ/VQ/VU/VV/VY/VZ", ALC285_FIXUP_ASUS_HEADSET_MIC),
10783 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603VQ/VU/VV/VJ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10784 	SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601VV/VU/VJ/VQ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10785 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G614JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10786 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS G513PI/PU/PV", ALC287_FIXUP_CS35L41_I2C_2),
10787 	SND_PCI_QUIRK(0x1043, 0x14f2, "ASUS VivoBook X515JA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10788 	SND_PCI_QUIRK(0x1043, 0x1503, "ASUS G733PY/PZ/PZV/PYV", ALC287_FIXUP_CS35L41_I2C_2),
10789 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10790 	SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA/XJ/XQ/XU/XV/XI", ALC287_FIXUP_CS35L41_I2C_2),
10791 	SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301VV/VQ/VU/VJ/VA/VC/VE/VVC/VQC/VUC/VJC/VEC/VCC", ALC285_FIXUP_ASUS_HEADSET_MIC),
10792 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10793 	SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZI/ZJ/ZQ/ZU/ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10794 	SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10795 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10796 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10797 	SND_PCI_QUIRK(0x1043, 0x16d3, "ASUS UX5304VA", ALC245_FIXUP_CS35L41_SPI_2),
10798 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10799 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS UX7602VI/BZ", ALC245_FIXUP_CS35L41_SPI_2),
10800 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10801 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10802 	SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally NR2301L/X", ALC294_FIXUP_ASUS_ALLY),
10803 	SND_PCI_QUIRK(0x1043, 0x1863, "ASUS UX6404VI/VV", ALC245_FIXUP_CS35L41_SPI_2),
10804 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10805 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10806 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10807 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10808 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10809 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10810 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10811 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10812 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10813 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10814 	SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10815 	SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10816 	SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10817 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10818 	SND_PCI_QUIRK(0x1043, 0x1b13, "ASUS U41SV/GA403U", ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC),
10819 	SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10820 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10821 	SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10822 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10823 	SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10824 	SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10825 	SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10826 	SND_PCI_QUIRK(0x1043, 0x1c63, "ASUS GU605M", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10827 	SND_PCI_QUIRK(0x1043, 0x1c80, "ASUS VivoBook TP401", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10828 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10829 	SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JU/JV/JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10830 	SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JY/JZ/JI/JG", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10831 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10832 	SND_PCI_QUIRK(0x1043, 0x1ccf, "ASUS G814JU/JV/JI", ALC245_FIXUP_CS35L41_SPI_2),
10833 	SND_PCI_QUIRK(0x1043, 0x1cdf, "ASUS G814JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10834 	SND_PCI_QUIRK(0x1043, 0x1cef, "ASUS G834JY/JZ/JI/JG", ALC285_FIXUP_ASUS_HEADSET_MIC),
10835 	SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS G713PI/PU/PV/PVN", ALC287_FIXUP_CS35L41_I2C_2),
10836 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10837 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10838 	SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10839 	SND_PCI_QUIRK(0x1043, 0x1df3, "ASUS UM5606WA", ALC294_FIXUP_BASS_SPEAKER_15),
10840 	SND_PCI_QUIRK(0x1043, 0x1264, "ASUS UM5606KA", ALC294_FIXUP_BASS_SPEAKER_15),
10841 	SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10842 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10843 	SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10844 	SND_PCI_QUIRK(0x1043, 0x1e1f, "ASUS Vivobook 15 X1504VAP", ALC2XX_FIXUP_HEADSET_MIC),
10845 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10846 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10847 	SND_PCI_QUIRK(0x1043, 0x1e63, "ASUS H7606W", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10848 	SND_PCI_QUIRK(0x1043, 0x1e83, "ASUS GA605W", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10849 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10850 	SND_PCI_QUIRK(0x1043, 0x1eb3, "ASUS Ally RCLA72", ALC287_FIXUP_TAS2781_I2C),
10851 	SND_PCI_QUIRK(0x1043, 0x1ed3, "ASUS HN7306W", ALC287_FIXUP_CS35L41_I2C_2),
10852 	SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10853 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10854 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10855 	SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10856 	SND_PCI_QUIRK(0x1043, 0x1f1f, "ASUS H7604JI/JV/J3D", ALC245_FIXUP_CS35L41_SPI_2),
10857 	SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10858 	SND_PCI_QUIRK(0x1043, 0x1f63, "ASUS P5405CSA", ALC245_FIXUP_CS35L41_SPI_2),
10859 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10860 	SND_PCI_QUIRK(0x1043, 0x1fb3, "ASUS ROG Flow Z13 GZ302EA", ALC287_FIXUP_CS35L41_I2C_2),
10861 	SND_PCI_QUIRK(0x1043, 0x3011, "ASUS B5605CVA", ALC245_FIXUP_CS35L41_SPI_2),
10862 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10863 	SND_PCI_QUIRK(0x1043, 0x3061, "ASUS B3405CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10864 	SND_PCI_QUIRK(0x1043, 0x3071, "ASUS B5405CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10865 	SND_PCI_QUIRK(0x1043, 0x30c1, "ASUS B3605CCA / P3605CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10866 	SND_PCI_QUIRK(0x1043, 0x30d1, "ASUS B5405CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10867 	SND_PCI_QUIRK(0x1043, 0x30e1, "ASUS B5605CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10868 	SND_PCI_QUIRK(0x1043, 0x31d0, "ASUS Zen AIO 27 Z272SD_A272SD", ALC274_FIXUP_ASUS_ZEN_AIO_27),
10869 	SND_PCI_QUIRK(0x1043, 0x31e1, "ASUS B5605CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10870 	SND_PCI_QUIRK(0x1043, 0x31f1, "ASUS B3605CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10871 	SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10872 	SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10873 	SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10874 	SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10875 	SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10876 	SND_PCI_QUIRK(0x1043, 0x3d78, "ASUS GA603KH", ALC287_FIXUP_CS35L41_I2C_2),
10877 	SND_PCI_QUIRK(0x1043, 0x3d88, "ASUS GA603KM", ALC287_FIXUP_CS35L41_I2C_2),
10878 	SND_PCI_QUIRK(0x1043, 0x3e00, "ASUS G814FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2),
10879 	SND_PCI_QUIRK(0x1043, 0x3e20, "ASUS G814PH/PM/PP", ALC287_FIXUP_CS35L41_I2C_2),
10880 	SND_PCI_QUIRK(0x1043, 0x3e30, "ASUS TP3607SA", ALC287_FIXUP_TAS2781_I2C),
10881 	SND_PCI_QUIRK(0x1043, 0x3ee0, "ASUS Strix G815_JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C),
10882 	SND_PCI_QUIRK(0x1043, 0x3ef0, "ASUS Strix G635LR_LW_LX", ALC287_FIXUP_TAS2781_I2C),
10883 	SND_PCI_QUIRK(0x1043, 0x3f00, "ASUS Strix G815LH_LM_LP", ALC287_FIXUP_TAS2781_I2C),
10884 	SND_PCI_QUIRK(0x1043, 0x3f10, "ASUS Strix G835LR_LW_LX", ALC287_FIXUP_TAS2781_I2C),
10885 	SND_PCI_QUIRK(0x1043, 0x3f20, "ASUS Strix G615LR_LW", ALC287_FIXUP_TAS2781_I2C),
10886 	SND_PCI_QUIRK(0x1043, 0x3f30, "ASUS Strix G815LR_LW", ALC287_FIXUP_TAS2781_I2C),
10887 	SND_PCI_QUIRK(0x1043, 0x3fd0, "ASUS B3605CVA", ALC245_FIXUP_CS35L41_SPI_2),
10888 	SND_PCI_QUIRK(0x1043, 0x3ff0, "ASUS B5405CVA", ALC245_FIXUP_CS35L41_SPI_2),
10889 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10890 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10891 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10892 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10893 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10894 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10895 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10896 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10897 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10898 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10899 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10900 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10901 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10902 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10903 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10904 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10905 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10906 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10907 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10908 	SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10909 	SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10910 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10911 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10912 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10913 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10914 	SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10915 	SND_PCI_QUIRK(0x10ec, 0x12f6, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10916 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10917 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10918 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10919 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10920 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10921 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10922 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10923 	SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10924 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10925 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10926 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10927 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10928 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10929 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10930 	SND_PCI_QUIRK(0x144d, 0xca06, "Samsung Galaxy Book3 360 (NP730QFG)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10931 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10932 	SND_PCI_QUIRK(0x144d, 0xc870, "Samsung Galaxy Book2 Pro (NP950XED)", ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS),
10933 	SND_PCI_QUIRK(0x144d, 0xc872, "Samsung Galaxy Book2 Pro (NP950XEE)", ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS),
10934 	SND_PCI_QUIRK(0x144d, 0xc886, "Samsung Galaxy Book3 Pro (NP964XFG)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10935 	SND_PCI_QUIRK(0x144d, 0xc1ca, "Samsung Galaxy Book3 Pro 360 (NP960QFG)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10936 	SND_PCI_QUIRK(0x144d, 0xc1cc, "Samsung Galaxy Book3 Ultra (NT960XFH)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10937 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10938 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10939 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10940 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10941 	SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10942 	SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10943 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10944 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10945 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10946 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10947 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10948 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10949 	SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10950 	SND_PCI_QUIRK(0x1558, 0x28c1, "Clevo V370VND", ALC2XX_FIXUP_HEADSET_MIC),
10951 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10952 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10953 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10954 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10955 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10956 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10957 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10958 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10959 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10960 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10961 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10962 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10963 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10964 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10965 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10966 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10967 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10968 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10969 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10970 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10971 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10972 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10973 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10974 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10975 	SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10976 	SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10977 	SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10978 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10979 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10980 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10981 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10982 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10983 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10984 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10985 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10986 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10987 	SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10988 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10989 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10990 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10991 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10992 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10993 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10994 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10995 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10996 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10997 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10998 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10999 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11000 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11001 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11002 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11003 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
11004 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11005 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11006 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11007 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11008 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11009 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11010 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11011 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11012 	SND_PCI_QUIRK(0x1558, 0xa554, "VAIO VJFH52", ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE),
11013 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11014 	SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11015 	SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11016 	SND_PCI_QUIRK(0x1558, 0xa741, "Clevo V54x_6x_TNE", ALC245_FIXUP_CLEVO_NOISY_MIC),
11017 	SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC245_FIXUP_CLEVO_NOISY_MIC),
11018 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11019 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11020 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11021 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11022 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11023 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11024 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
11025 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
11026 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
11027 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
11028 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
11029 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
11030 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
11031 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
11032 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
11033 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
11034 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
11035 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
11036 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
11037 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
11038 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
11039 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
11040 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
11041 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
11042 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
11043 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11044 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
11045 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
11046 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
11047 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11048 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11049 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
11050 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
11051 	SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
11052 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
11053 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11054 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11055 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
11056 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11057 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11058 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11059 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11060 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
11061 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
11062 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
11063 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
11064 	SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11065 	SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11066 	SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11067 	SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11068 	SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11069 	SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11070 	SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11071 	SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11072 	SND_PCI_QUIRK(0x17aa, 0x231e, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
11073 	SND_PCI_QUIRK(0x17aa, 0x231f, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
11074 	SND_PCI_QUIRK(0x17aa, 0x2326, "Hera2", ALC287_FIXUP_TAS2781_I2C),
11075 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
11076 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
11077 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11078 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11079 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11080 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11081 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11082 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11083 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11084 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11085 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
11086 	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
11087 	SND_PCI_QUIRK(0x17aa, 0x3384, "ThinkCentre M90a PRO", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11088 	SND_PCI_QUIRK(0x17aa, 0x3386, "ThinkCentre M90a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11089 	SND_PCI_QUIRK(0x17aa, 0x3387, "ThinkCentre M70a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11090 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11091 	HDA_CODEC_QUIRK(0x17aa, 0x3802, "DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11092 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8", ALC287_FIXUP_TAS2781_I2C),
11093 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
11094 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
11095 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
11096 	HDA_CODEC_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
11097 	SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11098 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
11099 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
11100 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11101 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
11102 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
11103 	SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
11104 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11105 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11106 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11107 	SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
11108 	SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
11109 	SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
11110 	SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11111 	HDA_CODEC_QUIRK(0x17aa, 0x386e, "Legion Y9000X 2022 IAH7", ALC287_FIXUP_CS35L41_I2C_2),
11112 	SND_PCI_QUIRK(0x17aa, 0x386e, "Yoga Pro 7 14ARP8", ALC285_FIXUP_SPEAKER2_TO_DAC1),
11113 	HDA_CODEC_QUIRK(0x17aa, 0x38a8, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C), /* this must match before PCI SSID 17aa:386f below */
11114 	SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7i 16IAX7", ALC287_FIXUP_CS35L41_I2C_2),
11115 	SND_PCI_QUIRK(0x17aa, 0x3870, "Lenovo Yoga 7 14ARB7", ALC287_FIXUP_YOGA7_14ARB7_I2C),
11116 	SND_PCI_QUIRK(0x17aa, 0x3877, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
11117 	SND_PCI_QUIRK(0x17aa, 0x3878, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
11118 	SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
11119 	SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
11120 	SND_PCI_QUIRK(0x17aa, 0x387f, "Yoga S780-16 pro dual LX", ALC287_FIXUP_TAS2781_I2C),
11121 	SND_PCI_QUIRK(0x17aa, 0x3880, "Yoga S780-16 pro dual YC", ALC287_FIXUP_TAS2781_I2C),
11122 	SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
11123 	SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11124 	SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11125 	SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
11126 	SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11127 	SND_PCI_QUIRK(0x17aa, 0x38a5, "Y580P AMD dual", ALC287_FIXUP_TAS2781_I2C),
11128 	SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
11129 	SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
11130 	SND_PCI_QUIRK(0x17aa, 0x38a9, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11131 	SND_PCI_QUIRK(0x17aa, 0x38ab, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11132 	SND_PCI_QUIRK(0x17aa, 0x38b4, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
11133 	SND_PCI_QUIRK(0x17aa, 0x38b5, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
11134 	SND_PCI_QUIRK(0x17aa, 0x38b6, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
11135 	SND_PCI_QUIRK(0x17aa, 0x38b7, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
11136 	SND_PCI_QUIRK(0x17aa, 0x38b8, "Yoga S780-14.5 proX AMD YC Dual", ALC287_FIXUP_TAS2781_I2C),
11137 	SND_PCI_QUIRK(0x17aa, 0x38b9, "Yoga S780-14.5 proX AMD LX Dual", ALC287_FIXUP_TAS2781_I2C),
11138 	SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
11139 	SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
11140 	SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
11141 	SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
11142 	SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
11143 	SND_PCI_QUIRK(0x17aa, 0x38c7, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
11144 	SND_PCI_QUIRK(0x17aa, 0x38c8, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
11145 	SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11146 	SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
11147 	SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
11148 	SND_PCI_QUIRK(0x17aa, 0x38d3, "Yoga S990-16 Pro IMH YC Dual", ALC287_FIXUP_TAS2781_I2C),
11149 	SND_PCI_QUIRK(0x17aa, 0x38d4, "Yoga S990-16 Pro IMH VECO Dual", ALC287_FIXUP_TAS2781_I2C),
11150 	SND_PCI_QUIRK(0x17aa, 0x38d5, "Yoga S990-16 Pro IMH YC Quad", ALC287_FIXUP_TAS2781_I2C),
11151 	SND_PCI_QUIRK(0x17aa, 0x38d6, "Yoga S990-16 Pro IMH VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11152 	SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
11153 	SND_PCI_QUIRK(0x17aa, 0x38df, "Yoga Y990 Intel YC Dual", ALC287_FIXUP_TAS2781_I2C),
11154 	SND_PCI_QUIRK(0x17aa, 0x38e0, "Yoga Y990 Intel VECO Dual", ALC287_FIXUP_TAS2781_I2C),
11155 	SND_PCI_QUIRK(0x17aa, 0x38f8, "Yoga Book 9i", ALC287_FIXUP_TAS2781_I2C),
11156 	SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11157 	SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11158 	SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11159 	SND_PCI_QUIRK(0x17aa, 0x38fd, "ThinkBook plus Gen5 Hybrid", ALC287_FIXUP_TAS2781_I2C),
11160 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11161 	SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
11162 	SND_PCI_QUIRK(0x17aa, 0x391f, "Yoga S990-16 pro Quad YC Quad", ALC287_FIXUP_TAS2781_I2C),
11163 	SND_PCI_QUIRK(0x17aa, 0x3920, "Yoga S990-16 pro Quad VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11164 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
11165 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11166 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
11167 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11168 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
11169 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
11170 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11171 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
11172 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
11173 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
11174 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
11175 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
11176 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
11177 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
11178 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
11179 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11180 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11181 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11182 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
11183 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11184 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11185 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11186 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
11187 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
11188 	SND_PCI_QUIRK(0x1849, 0x0269, "Positivo Master C6400", ALC269VB_FIXUP_ASUS_ZENBOOK),
11189 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
11190 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
11191 	SND_PCI_QUIRK(0x1854, 0x0440, "LG CQ6", ALC256_FIXUP_HEADPHONE_AMP_VOL),
11192 	SND_PCI_QUIRK(0x1854, 0x0441, "LG CQ6 AIO", ALC256_FIXUP_HEADPHONE_AMP_VOL),
11193 	SND_PCI_QUIRK(0x1854, 0x0488, "LG gram 16 (16Z90R)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11194 	SND_PCI_QUIRK(0x1854, 0x048a, "LG gram 17 (17ZD90R)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11195 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
11196 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
11197 	SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
11198 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
11199 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
11200 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
11201 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
11202 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
11203 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
11204 	SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11205 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
11206 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
11207 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
11208 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
11209 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11210 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11211 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11212 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
11213 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
11214 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
11215 	SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
11216 	SND_PCI_QUIRK(0x1d05, 0x1409, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
11217 	SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
11218 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
11219 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
11220 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
11221 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
11222 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
11223 	SND_PCI_QUIRK(0x1f66, 0x0105, "Ayaneo Portable Game Player", ALC287_FIXUP_CS35L41_I2C_2),
11224 	SND_PCI_QUIRK(0x2014, 0x800a, "Positivo ARN50", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11225 	SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11226 	SND_PCI_QUIRK(0x2782, 0x0228, "Infinix ZERO BOOK 13", ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13),
11227 	SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
11228 	SND_PCI_QUIRK(0x2782, 0x1701, "Infinix Y4 Max", ALC269VC_FIXUP_INFINIX_Y4_MAX),
11229 	SND_PCI_QUIRK(0x2782, 0x1705, "MEDION E15433", ALC269VC_FIXUP_INFINIX_Y4_MAX),
11230 	SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
11231 	SND_PCI_QUIRK(0x2782, 0x4900, "MEDION E15443", ALC233_FIXUP_MEDION_MTL_SPK),
11232 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
11233 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
11234 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
11235 	SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
11236 	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11237 	SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11238 	SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11239 	SND_PCI_QUIRK(0xf111, 0x000c, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11240 
11241 #if 0
11242 	/* Below is a quirk table taken from the old code.
11243 	 * Basically the device should work as is without the fixup table.
11244 	 * If BIOS doesn't give a proper info, enable the corresponding
11245 	 * fixup entry.
11246 	 */
11247 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
11248 		      ALC269_FIXUP_AMIC),
11249 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
11250 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
11251 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
11252 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
11253 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
11254 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
11255 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
11256 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
11257 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
11258 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
11259 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
11260 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
11261 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
11262 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
11263 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
11264 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
11265 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
11266 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
11267 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
11268 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
11269 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
11270 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
11271 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
11272 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
11273 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
11274 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
11275 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
11276 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
11277 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
11278 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
11279 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
11280 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
11281 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
11282 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
11283 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
11284 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
11285 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
11286 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
11287 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
11288 #endif
11289 	{}
11290 };
11291 
11292 static const struct hda_quirk alc269_fixup_vendor_tbl[] = {
11293 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
11294 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
11295 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
11296 	SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo XPAD", ALC269_FIXUP_LENOVO_XPAD_ACPI),
11297 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
11298 	{}
11299 };
11300 
11301 static const struct hda_model_fixup alc269_fixup_models[] = {
11302 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
11303 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
11304 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
11305 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
11306 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
11307 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
11308 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
11309 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
11310 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
11311 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
11312 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11313 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
11314 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
11315 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
11316 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
11317 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
11318 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
11319 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
11320 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
11321 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
11322 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
11323 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
11324 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
11325 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
11326 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
11327 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
11328 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
11329 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
11330 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
11331 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
11332 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
11333 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
11334 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
11335 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
11336 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
11337 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
11338 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
11339 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
11340 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
11341 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
11342 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
11343 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
11344 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
11345 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
11346 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
11347 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
11348 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
11349 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
11350 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
11351 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
11352 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
11353 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
11354 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
11355 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
11356 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
11357 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
11358 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
11359 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
11360 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
11361 	{.id = ALC269_FIXUP_LENOVO_XPAD_ACPI, .name = "lenovo-xpad-led"},
11362 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
11363 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
11364 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
11365 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
11366 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
11367 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
11368 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
11369 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
11370 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
11371 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
11372 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
11373 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11374 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
11375 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
11376 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
11377 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
11378 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
11379 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
11380 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
11381 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
11382 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
11383 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
11384 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
11385 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
11386 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
11387 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
11388 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
11389 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
11390 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
11391 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
11392 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
11393 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
11394 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
11395 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
11396 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
11397 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
11398 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
11399 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
11400 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
11401 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
11402 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
11403 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
11404 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
11405 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
11406 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
11407 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
11408 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
11409 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
11410 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
11411 	{.id = ALC256_FIXUP_CHROME_BOOK, .name = "alc-2024y-chromebook"},
11412 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
11413 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
11414 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
11415 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
11416 	{.id = ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS, .name = "alc298-samsung-amp-v2-2-amps"},
11417 	{.id = ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS, .name = "alc298-samsung-amp-v2-4-amps"},
11418 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
11419 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
11420 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
11421 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
11422 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
11423 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
11424 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
11425 	{.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
11426 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
11427 	{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
11428 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
11429 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
11430 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
11431 	{.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
11432 	{.id = ALC2XX_FIXUP_HEADSET_MIC, .name = "alc2xx-fixup-headset-mic"},
11433 	{}
11434 };
11435 #define ALC225_STANDARD_PINS \
11436 	{0x21, 0x04211020}
11437 
11438 #define ALC256_STANDARD_PINS \
11439 	{0x12, 0x90a60140}, \
11440 	{0x14, 0x90170110}, \
11441 	{0x21, 0x02211020}
11442 
11443 #define ALC282_STANDARD_PINS \
11444 	{0x14, 0x90170110}
11445 
11446 #define ALC290_STANDARD_PINS \
11447 	{0x12, 0x99a30130}
11448 
11449 #define ALC292_STANDARD_PINS \
11450 	{0x14, 0x90170110}, \
11451 	{0x15, 0x0221401f}
11452 
11453 #define ALC295_STANDARD_PINS \
11454 	{0x12, 0xb7a60130}, \
11455 	{0x14, 0x90170110}, \
11456 	{0x21, 0x04211020}
11457 
11458 #define ALC298_STANDARD_PINS \
11459 	{0x12, 0x90a60130}, \
11460 	{0x21, 0x03211020}
11461 
11462 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
11463 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
11464 		{0x14, 0x01014020},
11465 		{0x17, 0x90170110},
11466 		{0x18, 0x02a11030},
11467 		{0x19, 0x0181303F},
11468 		{0x21, 0x0221102f}),
11469 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
11470 		{0x12, 0x90a601c0},
11471 		{0x14, 0x90171120},
11472 		{0x21, 0x02211030}),
11473 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
11474 		{0x14, 0x90170110},
11475 		{0x1b, 0x90a70130},
11476 		{0x21, 0x03211020}),
11477 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
11478 		{0x1a, 0x90a70130},
11479 		{0x1b, 0x90170110},
11480 		{0x21, 0x03211020}),
11481 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11482 		ALC225_STANDARD_PINS,
11483 		{0x12, 0xb7a60130},
11484 		{0x14, 0x901701a0}),
11485 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11486 		ALC225_STANDARD_PINS,
11487 		{0x12, 0xb7a60130},
11488 		{0x14, 0x901701b0}),
11489 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11490 		ALC225_STANDARD_PINS,
11491 		{0x12, 0xb7a60150},
11492 		{0x14, 0x901701a0}),
11493 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11494 		ALC225_STANDARD_PINS,
11495 		{0x12, 0xb7a60150},
11496 		{0x14, 0x901701b0}),
11497 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11498 		ALC225_STANDARD_PINS,
11499 		{0x12, 0xb7a60130},
11500 		{0x1b, 0x90170110}),
11501 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11502 		{0x1b, 0x01111010},
11503 		{0x1e, 0x01451130},
11504 		{0x21, 0x02211020}),
11505 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
11506 		{0x12, 0x90a60140},
11507 		{0x14, 0x90170110},
11508 		{0x19, 0x02a11030},
11509 		{0x21, 0x02211020}),
11510 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11511 		{0x14, 0x90170110},
11512 		{0x19, 0x02a11030},
11513 		{0x1a, 0x02a11040},
11514 		{0x1b, 0x01014020},
11515 		{0x21, 0x0221101f}),
11516 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11517 		{0x14, 0x90170110},
11518 		{0x19, 0x02a11030},
11519 		{0x1a, 0x02a11040},
11520 		{0x1b, 0x01011020},
11521 		{0x21, 0x0221101f}),
11522 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11523 		{0x14, 0x90170110},
11524 		{0x19, 0x02a11020},
11525 		{0x1a, 0x02a11030},
11526 		{0x21, 0x0221101f}),
11527 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
11528 		{0x21, 0x02211010}),
11529 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
11530 		{0x14, 0x90170110},
11531 		{0x19, 0x02a11020},
11532 		{0x21, 0x02211030}),
11533 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
11534 		{0x14, 0x90170110},
11535 		{0x21, 0x02211020}),
11536 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11537 		{0x14, 0x90170130},
11538 		{0x21, 0x02211040}),
11539 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11540 		{0x12, 0x90a60140},
11541 		{0x14, 0x90170110},
11542 		{0x21, 0x02211020}),
11543 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11544 		{0x12, 0x90a60160},
11545 		{0x14, 0x90170120},
11546 		{0x21, 0x02211030}),
11547 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11548 		{0x14, 0x90170110},
11549 		{0x1b, 0x02011020},
11550 		{0x21, 0x0221101f}),
11551 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11552 		{0x14, 0x90170110},
11553 		{0x1b, 0x01011020},
11554 		{0x21, 0x0221101f}),
11555 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11556 		{0x14, 0x90170130},
11557 		{0x1b, 0x01014020},
11558 		{0x21, 0x0221103f}),
11559 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11560 		{0x14, 0x90170130},
11561 		{0x1b, 0x01011020},
11562 		{0x21, 0x0221103f}),
11563 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11564 		{0x14, 0x90170130},
11565 		{0x1b, 0x02011020},
11566 		{0x21, 0x0221103f}),
11567 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11568 		{0x14, 0x90170150},
11569 		{0x1b, 0x02011020},
11570 		{0x21, 0x0221105f}),
11571 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11572 		{0x14, 0x90170110},
11573 		{0x1b, 0x01014020},
11574 		{0x21, 0x0221101f}),
11575 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11576 		{0x12, 0x90a60160},
11577 		{0x14, 0x90170120},
11578 		{0x17, 0x90170140},
11579 		{0x21, 0x0321102f}),
11580 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11581 		{0x12, 0x90a60160},
11582 		{0x14, 0x90170130},
11583 		{0x21, 0x02211040}),
11584 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11585 		{0x12, 0x90a60160},
11586 		{0x14, 0x90170140},
11587 		{0x21, 0x02211050}),
11588 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11589 		{0x12, 0x90a60170},
11590 		{0x14, 0x90170120},
11591 		{0x21, 0x02211030}),
11592 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11593 		{0x12, 0x90a60170},
11594 		{0x14, 0x90170130},
11595 		{0x21, 0x02211040}),
11596 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11597 		{0x12, 0x90a60170},
11598 		{0x14, 0x90171130},
11599 		{0x21, 0x02211040}),
11600 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11601 		{0x12, 0x90a60170},
11602 		{0x14, 0x90170140},
11603 		{0x21, 0x02211050}),
11604 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11605 		{0x12, 0x90a60180},
11606 		{0x14, 0x90170130},
11607 		{0x21, 0x02211040}),
11608 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11609 		{0x12, 0x90a60180},
11610 		{0x14, 0x90170120},
11611 		{0x21, 0x02211030}),
11612 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11613 		{0x1b, 0x01011020},
11614 		{0x21, 0x02211010}),
11615 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
11616 		{0x14, 0x90170110},
11617 		{0x1b, 0x90a70130},
11618 		{0x21, 0x04211020}),
11619 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
11620 		{0x14, 0x90170110},
11621 		{0x1b, 0x90a70130},
11622 		{0x21, 0x03211020}),
11623 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11624 		{0x12, 0x90a60130},
11625 		{0x14, 0x90170110},
11626 		{0x21, 0x03211020}),
11627 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11628 		{0x12, 0x90a60130},
11629 		{0x14, 0x90170110},
11630 		{0x21, 0x04211020}),
11631 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11632 		{0x1a, 0x90a70130},
11633 		{0x1b, 0x90170110},
11634 		{0x21, 0x03211020}),
11635        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
11636 		{0x14, 0x90170110},
11637 		{0x19, 0x02a11020},
11638 		{0x21, 0x0221101f}),
11639        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
11640 		{0x17, 0x90170110},
11641 		{0x19, 0x03a11030},
11642 		{0x21, 0x03211020}),
11643 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
11644 		{0x12, 0x90a60130},
11645 		{0x14, 0x90170110},
11646 		{0x15, 0x0421101f},
11647 		{0x1a, 0x04a11020}),
11648 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
11649 		{0x12, 0x90a60140},
11650 		{0x14, 0x90170110},
11651 		{0x15, 0x0421101f},
11652 		{0x18, 0x02811030},
11653 		{0x1a, 0x04a1103f},
11654 		{0x1b, 0x02011020}),
11655 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11656 		ALC282_STANDARD_PINS,
11657 		{0x12, 0x99a30130},
11658 		{0x19, 0x03a11020},
11659 		{0x21, 0x0321101f}),
11660 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11661 		ALC282_STANDARD_PINS,
11662 		{0x12, 0x99a30130},
11663 		{0x19, 0x03a11020},
11664 		{0x21, 0x03211040}),
11665 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11666 		ALC282_STANDARD_PINS,
11667 		{0x12, 0x99a30130},
11668 		{0x19, 0x03a11030},
11669 		{0x21, 0x03211020}),
11670 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11671 		ALC282_STANDARD_PINS,
11672 		{0x12, 0x99a30130},
11673 		{0x19, 0x04a11020},
11674 		{0x21, 0x0421101f}),
11675 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
11676 		ALC282_STANDARD_PINS,
11677 		{0x12, 0x90a60140},
11678 		{0x19, 0x04a11030},
11679 		{0x21, 0x04211020}),
11680 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11681 		ALC282_STANDARD_PINS,
11682 		{0x12, 0x90a609c0},
11683 		{0x18, 0x03a11830},
11684 		{0x19, 0x04a19831},
11685 		{0x1a, 0x0481303f},
11686 		{0x1b, 0x04211020},
11687 		{0x21, 0x0321101f}),
11688 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11689 		ALC282_STANDARD_PINS,
11690 		{0x12, 0x90a60940},
11691 		{0x18, 0x03a11830},
11692 		{0x19, 0x04a19831},
11693 		{0x1a, 0x0481303f},
11694 		{0x1b, 0x04211020},
11695 		{0x21, 0x0321101f}),
11696 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11697 		ALC282_STANDARD_PINS,
11698 		{0x12, 0x90a60130},
11699 		{0x21, 0x0321101f}),
11700 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11701 		{0x12, 0x90a60160},
11702 		{0x14, 0x90170120},
11703 		{0x21, 0x02211030}),
11704 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11705 		ALC282_STANDARD_PINS,
11706 		{0x12, 0x90a60130},
11707 		{0x19, 0x03a11020},
11708 		{0x21, 0x0321101f}),
11709 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11710 		{0x12, 0x90a60130},
11711 		{0x14, 0x90170110},
11712 		{0x19, 0x04a11040},
11713 		{0x21, 0x04211020}),
11714 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11715 		{0x14, 0x90170110},
11716 		{0x19, 0x04a11040},
11717 		{0x1d, 0x40600001},
11718 		{0x21, 0x04211020}),
11719 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
11720 		{0x14, 0x90170110},
11721 		{0x19, 0x04a11040},
11722 		{0x21, 0x04211020}),
11723 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
11724 		{0x14, 0x90170110},
11725 		{0x17, 0x90170111},
11726 		{0x19, 0x03a11030},
11727 		{0x21, 0x03211020}),
11728 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11729 		{0x17, 0x90170110},
11730 		{0x19, 0x03a11030},
11731 		{0x21, 0x03211020}),
11732 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11733 		{0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
11734 		{0x19, 0x04a11040},
11735 		{0x21, 0x04211020}),
11736 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
11737 		{0x12, 0x90a60130},
11738 		{0x17, 0x90170110},
11739 		{0x21, 0x02211020}),
11740 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
11741 		{0x12, 0x90a60120},
11742 		{0x14, 0x90170110},
11743 		{0x21, 0x0321101f}),
11744 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11745 		ALC290_STANDARD_PINS,
11746 		{0x15, 0x04211040},
11747 		{0x18, 0x90170112},
11748 		{0x1a, 0x04a11020}),
11749 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11750 		ALC290_STANDARD_PINS,
11751 		{0x15, 0x04211040},
11752 		{0x18, 0x90170110},
11753 		{0x1a, 0x04a11020}),
11754 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11755 		ALC290_STANDARD_PINS,
11756 		{0x15, 0x0421101f},
11757 		{0x1a, 0x04a11020}),
11758 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11759 		ALC290_STANDARD_PINS,
11760 		{0x15, 0x04211020},
11761 		{0x1a, 0x04a11040}),
11762 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11763 		ALC290_STANDARD_PINS,
11764 		{0x14, 0x90170110},
11765 		{0x15, 0x04211020},
11766 		{0x1a, 0x04a11040}),
11767 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11768 		ALC290_STANDARD_PINS,
11769 		{0x14, 0x90170110},
11770 		{0x15, 0x04211020},
11771 		{0x1a, 0x04a11020}),
11772 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11773 		ALC290_STANDARD_PINS,
11774 		{0x14, 0x90170110},
11775 		{0x15, 0x0421101f},
11776 		{0x1a, 0x04a11020}),
11777 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11778 		ALC292_STANDARD_PINS,
11779 		{0x12, 0x90a60140},
11780 		{0x16, 0x01014020},
11781 		{0x19, 0x01a19030}),
11782 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11783 		ALC292_STANDARD_PINS,
11784 		{0x12, 0x90a60140},
11785 		{0x16, 0x01014020},
11786 		{0x18, 0x02a19031},
11787 		{0x19, 0x01a1903e}),
11788 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
11789 		ALC292_STANDARD_PINS,
11790 		{0x12, 0x90a60140}),
11791 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11792 		ALC292_STANDARD_PINS,
11793 		{0x13, 0x90a60140},
11794 		{0x16, 0x21014020},
11795 		{0x19, 0x21a19030}),
11796 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11797 		ALC292_STANDARD_PINS,
11798 		{0x13, 0x90a60140}),
11799 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
11800 		{0x17, 0x90170110},
11801 		{0x21, 0x04211020}),
11802 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
11803 		{0x14, 0x90170110},
11804 		{0x1b, 0x90a70130},
11805 		{0x21, 0x04211020}),
11806 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11807 		{0x12, 0x90a60130},
11808 		{0x17, 0x90170110},
11809 		{0x21, 0x03211020}),
11810 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11811 		{0x12, 0x90a60130},
11812 		{0x17, 0x90170110},
11813 		{0x21, 0x04211020}),
11814 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11815 		{0x12, 0x90a60130},
11816 		{0x17, 0x90170110},
11817 		{0x21, 0x03211020}),
11818 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11819 		{0x12, 0x90a60120},
11820 		{0x17, 0x90170110},
11821 		{0x21, 0x04211030}),
11822 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11823 		{0x12, 0x90a60130},
11824 		{0x17, 0x90170110},
11825 		{0x21, 0x03211020}),
11826 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11827 		{0x12, 0x90a60130},
11828 		{0x17, 0x90170110},
11829 		{0x21, 0x03211020}),
11830 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11831 		ALC298_STANDARD_PINS,
11832 		{0x17, 0x90170110}),
11833 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11834 		ALC298_STANDARD_PINS,
11835 		{0x17, 0x90170140}),
11836 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11837 		ALC298_STANDARD_PINS,
11838 		{0x17, 0x90170150}),
11839 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11840 		{0x12, 0xb7a60140},
11841 		{0x13, 0xb7a60150},
11842 		{0x17, 0x90170110},
11843 		{0x1a, 0x03011020},
11844 		{0x21, 0x03211030}),
11845 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11846 		{0x12, 0xb7a60140},
11847 		{0x17, 0x90170110},
11848 		{0x1a, 0x03a11030},
11849 		{0x21, 0x03211020}),
11850 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11851 		ALC225_STANDARD_PINS,
11852 		{0x12, 0xb7a60130},
11853 		{0x17, 0x90170110}),
11854 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11855 		{0x14, 0x01014010},
11856 		{0x17, 0x90170120},
11857 		{0x18, 0x02a11030},
11858 		{0x19, 0x02a1103f},
11859 		{0x21, 0x0221101f}),
11860 	{}
11861 };
11862 
11863 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11864  * more machines, don't need to match all valid pins, just need to match
11865  * all the pins defined in the tbl. Just because of this reason, it is possible
11866  * that a single machine matches multiple tbls, so there is one limitation:
11867  *   at most one tbl is allowed to define for the same vendor and same codec
11868  */
11869 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11870 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11871 		{0x19, 0x40000000}),
11872 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11873 		{0x19, 0x40000000},
11874 		{0x1b, 0x40000000}),
11875 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
11876 		{0x19, 0x40000000},
11877 		{0x1b, 0x40000000}),
11878 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11879 		{0x19, 0x40000000},
11880 		{0x1a, 0x40000000}),
11881 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11882 		{0x19, 0x40000000},
11883 		{0x1a, 0x40000000}),
11884 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11885 		{0x19, 0x40000000},
11886 		{0x1a, 0x40000000}),
11887 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11888 		{0x19, 0x40000000}),
11889 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1558, "Clevo", ALC2XX_FIXUP_HEADSET_MIC,
11890 		{0x19, 0x40000000}),
11891 	{}
11892 };
11893 
alc269_fill_coef(struct hda_codec * codec)11894 static void alc269_fill_coef(struct hda_codec *codec)
11895 {
11896 	struct alc_spec *spec = codec->spec;
11897 	int val;
11898 
11899 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11900 		return;
11901 
11902 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11903 		alc_write_coef_idx(codec, 0xf, 0x960b);
11904 		alc_write_coef_idx(codec, 0xe, 0x8817);
11905 	}
11906 
11907 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11908 		alc_write_coef_idx(codec, 0xf, 0x960b);
11909 		alc_write_coef_idx(codec, 0xe, 0x8814);
11910 	}
11911 
11912 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11913 		/* Power up output pin */
11914 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11915 	}
11916 
11917 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11918 		val = alc_read_coef_idx(codec, 0xd);
11919 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11920 			/* Capless ramp up clock control */
11921 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
11922 		}
11923 		val = alc_read_coef_idx(codec, 0x17);
11924 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11925 			/* Class D power on reset */
11926 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
11927 		}
11928 	}
11929 
11930 	/* HP */
11931 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11932 }
11933 
11934 /*
11935  */
patch_alc269(struct hda_codec * codec)11936 static int patch_alc269(struct hda_codec *codec)
11937 {
11938 	struct alc_spec *spec;
11939 	int err;
11940 
11941 	err = alc_alloc_spec(codec, 0x0b);
11942 	if (err < 0)
11943 		return err;
11944 
11945 	spec = codec->spec;
11946 	spec->gen.shared_mic_vref_pin = 0x18;
11947 	codec->power_save_node = 0;
11948 	spec->en_3kpull_low = true;
11949 
11950 	codec->patch_ops.suspend = alc269_suspend;
11951 	codec->patch_ops.resume = alc269_resume;
11952 	spec->shutup = alc_default_shutup;
11953 	spec->init_hook = alc_default_init;
11954 
11955 	switch (codec->core.vendor_id) {
11956 	case 0x10ec0269:
11957 		spec->codec_variant = ALC269_TYPE_ALC269VA;
11958 		switch (alc_get_coef0(codec) & 0x00f0) {
11959 		case 0x0010:
11960 			if (codec->bus->pci &&
11961 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
11962 			    spec->cdefine.platform_type == 1)
11963 				err = alc_codec_rename(codec, "ALC271X");
11964 			spec->codec_variant = ALC269_TYPE_ALC269VB;
11965 			break;
11966 		case 0x0020:
11967 			if (codec->bus->pci &&
11968 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
11969 			    codec->bus->pci->subsystem_device == 0x21f3)
11970 				err = alc_codec_rename(codec, "ALC3202");
11971 			spec->codec_variant = ALC269_TYPE_ALC269VC;
11972 			break;
11973 		case 0x0030:
11974 			spec->codec_variant = ALC269_TYPE_ALC269VD;
11975 			break;
11976 		default:
11977 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
11978 		}
11979 		if (err < 0)
11980 			goto error;
11981 		spec->shutup = alc269_shutup;
11982 		spec->init_hook = alc269_fill_coef;
11983 		alc269_fill_coef(codec);
11984 		break;
11985 
11986 	case 0x10ec0280:
11987 	case 0x10ec0290:
11988 		spec->codec_variant = ALC269_TYPE_ALC280;
11989 		break;
11990 	case 0x10ec0282:
11991 		spec->codec_variant = ALC269_TYPE_ALC282;
11992 		spec->shutup = alc282_shutup;
11993 		spec->init_hook = alc282_init;
11994 		break;
11995 	case 0x10ec0233:
11996 	case 0x10ec0283:
11997 		spec->codec_variant = ALC269_TYPE_ALC283;
11998 		spec->shutup = alc283_shutup;
11999 		spec->init_hook = alc283_init;
12000 		break;
12001 	case 0x10ec0284:
12002 	case 0x10ec0292:
12003 		spec->codec_variant = ALC269_TYPE_ALC284;
12004 		break;
12005 	case 0x10ec0293:
12006 		spec->codec_variant = ALC269_TYPE_ALC293;
12007 		break;
12008 	case 0x10ec0286:
12009 	case 0x10ec0288:
12010 		spec->codec_variant = ALC269_TYPE_ALC286;
12011 		break;
12012 	case 0x10ec0298:
12013 		spec->codec_variant = ALC269_TYPE_ALC298;
12014 		break;
12015 	case 0x10ec0235:
12016 	case 0x10ec0255:
12017 		spec->codec_variant = ALC269_TYPE_ALC255;
12018 		spec->shutup = alc256_shutup;
12019 		spec->init_hook = alc256_init;
12020 		break;
12021 	case 0x10ec0230:
12022 	case 0x10ec0236:
12023 	case 0x10ec0256:
12024 	case 0x19e58326:
12025 		spec->codec_variant = ALC269_TYPE_ALC256;
12026 		spec->shutup = alc256_shutup;
12027 		spec->init_hook = alc256_init;
12028 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
12029 		if (codec->core.vendor_id == 0x10ec0236 &&
12030 		    codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
12031 			spec->en_3kpull_low = false;
12032 		break;
12033 	case 0x10ec0257:
12034 		spec->codec_variant = ALC269_TYPE_ALC257;
12035 		spec->shutup = alc256_shutup;
12036 		spec->init_hook = alc256_init;
12037 		spec->gen.mixer_nid = 0;
12038 		spec->en_3kpull_low = false;
12039 		break;
12040 	case 0x10ec0215:
12041 	case 0x10ec0245:
12042 	case 0x10ec0285:
12043 	case 0x10ec0289:
12044 		if (alc_get_coef0(codec) & 0x0010)
12045 			spec->codec_variant = ALC269_TYPE_ALC245;
12046 		else
12047 			spec->codec_variant = ALC269_TYPE_ALC215;
12048 		spec->shutup = alc225_shutup;
12049 		spec->init_hook = alc225_init;
12050 		spec->gen.mixer_nid = 0;
12051 		break;
12052 	case 0x10ec0225:
12053 	case 0x10ec0295:
12054 	case 0x10ec0299:
12055 		spec->codec_variant = ALC269_TYPE_ALC225;
12056 		spec->shutup = alc225_shutup;
12057 		spec->init_hook = alc225_init;
12058 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
12059 		break;
12060 	case 0x10ec0287:
12061 		spec->codec_variant = ALC269_TYPE_ALC287;
12062 		spec->shutup = alc225_shutup;
12063 		spec->init_hook = alc225_init;
12064 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
12065 		break;
12066 	case 0x10ec0234:
12067 	case 0x10ec0274:
12068 	case 0x10ec0294:
12069 		spec->codec_variant = ALC269_TYPE_ALC294;
12070 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
12071 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
12072 		spec->init_hook = alc294_init;
12073 		break;
12074 	case 0x10ec0300:
12075 		spec->codec_variant = ALC269_TYPE_ALC300;
12076 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
12077 		break;
12078 	case 0x10ec0222:
12079 	case 0x10ec0623:
12080 		spec->codec_variant = ALC269_TYPE_ALC623;
12081 		spec->shutup = alc222_shutup;
12082 		spec->init_hook = alc222_init;
12083 		break;
12084 	case 0x10ec0700:
12085 	case 0x10ec0701:
12086 	case 0x10ec0703:
12087 	case 0x10ec0711:
12088 		spec->codec_variant = ALC269_TYPE_ALC700;
12089 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
12090 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
12091 		spec->init_hook = alc294_init;
12092 		break;
12093 
12094 	}
12095 
12096 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
12097 		spec->has_alc5505_dsp = 1;
12098 		spec->init_hook = alc5505_dsp_init;
12099 	}
12100 
12101 	alc_pre_init(codec);
12102 
12103 	snd_hda_pick_fixup(codec, alc269_fixup_models,
12104 		       alc269_fixup_tbl, alc269_fixups);
12105 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
12106 	 * the quirk breaks the latter (bko#214101).
12107 	 * Clear the wrong entry.
12108 	 */
12109 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
12110 	    codec->core.vendor_id == 0x10ec0294) {
12111 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
12112 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
12113 	}
12114 
12115 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
12116 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
12117 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
12118 			   alc269_fixups);
12119 
12120 	/*
12121 	 * Check whether ACPI describes companion amplifiers that require
12122 	 * component binding
12123 	 */
12124 	find_cirrus_companion_amps(codec);
12125 
12126 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12127 
12128 	alc_auto_parse_customize_define(codec);
12129 
12130 	if (has_cdefine_beep(codec))
12131 		spec->gen.beep_nid = 0x01;
12132 
12133 	/* automatic parse from the BIOS config */
12134 	err = alc269_parse_auto_config(codec);
12135 	if (err < 0)
12136 		goto error;
12137 
12138 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
12139 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
12140 		if (err < 0)
12141 			goto error;
12142 	}
12143 
12144 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12145 
12146 	return 0;
12147 
12148  error:
12149 	alc_free(codec);
12150 	return err;
12151 }
12152 
12153 /*
12154  * ALC861
12155  */
12156 
alc861_parse_auto_config(struct hda_codec * codec)12157 static int alc861_parse_auto_config(struct hda_codec *codec)
12158 {
12159 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
12160 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
12161 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
12162 }
12163 
12164 /* Pin config fixes */
12165 enum {
12166 	ALC861_FIXUP_FSC_AMILO_PI1505,
12167 	ALC861_FIXUP_AMP_VREF_0F,
12168 	ALC861_FIXUP_NO_JACK_DETECT,
12169 	ALC861_FIXUP_ASUS_A6RP,
12170 	ALC660_FIXUP_ASUS_W7J,
12171 };
12172 
12173 /* 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)12174 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
12175 			const struct hda_fixup *fix, int action)
12176 {
12177 	struct alc_spec *spec = codec->spec;
12178 	unsigned int val;
12179 
12180 	if (action != HDA_FIXUP_ACT_INIT)
12181 		return;
12182 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
12183 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
12184 		val |= AC_PINCTL_IN_EN;
12185 	val |= AC_PINCTL_VREF_50;
12186 	snd_hda_set_pin_ctl(codec, 0x0f, val);
12187 	spec->gen.keep_vref_in_automute = 1;
12188 }
12189 
12190 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)12191 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
12192 				     const struct hda_fixup *fix, int action)
12193 {
12194 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
12195 		codec->no_jack_detect = 1;
12196 }
12197 
12198 static const struct hda_fixup alc861_fixups[] = {
12199 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
12200 		.type = HDA_FIXUP_PINS,
12201 		.v.pins = (const struct hda_pintbl[]) {
12202 			{ 0x0b, 0x0221101f }, /* HP */
12203 			{ 0x0f, 0x90170310 }, /* speaker */
12204 			{ }
12205 		}
12206 	},
12207 	[ALC861_FIXUP_AMP_VREF_0F] = {
12208 		.type = HDA_FIXUP_FUNC,
12209 		.v.func = alc861_fixup_asus_amp_vref_0f,
12210 	},
12211 	[ALC861_FIXUP_NO_JACK_DETECT] = {
12212 		.type = HDA_FIXUP_FUNC,
12213 		.v.func = alc_fixup_no_jack_detect,
12214 	},
12215 	[ALC861_FIXUP_ASUS_A6RP] = {
12216 		.type = HDA_FIXUP_FUNC,
12217 		.v.func = alc861_fixup_asus_amp_vref_0f,
12218 		.chained = true,
12219 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
12220 	},
12221 	[ALC660_FIXUP_ASUS_W7J] = {
12222 		.type = HDA_FIXUP_VERBS,
12223 		.v.verbs = (const struct hda_verb[]) {
12224 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
12225 			 * for enabling outputs
12226 			 */
12227 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12228 			{ }
12229 		},
12230 	}
12231 };
12232 
12233 static const struct hda_quirk alc861_fixup_tbl[] = {
12234 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
12235 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
12236 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
12237 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
12238 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
12239 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
12240 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
12241 	{}
12242 };
12243 
12244 /*
12245  */
patch_alc861(struct hda_codec * codec)12246 static int patch_alc861(struct hda_codec *codec)
12247 {
12248 	struct alc_spec *spec;
12249 	int err;
12250 
12251 	err = alc_alloc_spec(codec, 0x15);
12252 	if (err < 0)
12253 		return err;
12254 
12255 	spec = codec->spec;
12256 	if (has_cdefine_beep(codec))
12257 		spec->gen.beep_nid = 0x23;
12258 
12259 	spec->power_hook = alc_power_eapd;
12260 
12261 	alc_pre_init(codec);
12262 
12263 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
12264 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12265 
12266 	/* automatic parse from the BIOS config */
12267 	err = alc861_parse_auto_config(codec);
12268 	if (err < 0)
12269 		goto error;
12270 
12271 	if (!spec->gen.no_analog) {
12272 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
12273 		if (err < 0)
12274 			goto error;
12275 	}
12276 
12277 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12278 
12279 	return 0;
12280 
12281  error:
12282 	alc_free(codec);
12283 	return err;
12284 }
12285 
12286 /*
12287  * ALC861-VD support
12288  *
12289  * Based on ALC882
12290  *
12291  * In addition, an independent DAC
12292  */
alc861vd_parse_auto_config(struct hda_codec * codec)12293 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12294 {
12295 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12296 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
12297 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
12298 }
12299 
12300 enum {
12301 	ALC660VD_FIX_ASUS_GPIO1,
12302 	ALC861VD_FIX_DALLAS,
12303 };
12304 
12305 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)12306 static void alc861vd_fixup_dallas(struct hda_codec *codec,
12307 				  const struct hda_fixup *fix, int action)
12308 {
12309 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12310 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
12311 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
12312 	}
12313 }
12314 
12315 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)12316 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
12317 				      const struct hda_fixup *fix, int action)
12318 {
12319 	struct alc_spec *spec = codec->spec;
12320 
12321 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
12322 		spec->gpio_mask |= 0x02;
12323 	alc_fixup_gpio(codec, action, 0x01);
12324 }
12325 
12326 static const struct hda_fixup alc861vd_fixups[] = {
12327 	[ALC660VD_FIX_ASUS_GPIO1] = {
12328 		.type = HDA_FIXUP_FUNC,
12329 		.v.func = alc660vd_fixup_asus_gpio1,
12330 	},
12331 	[ALC861VD_FIX_DALLAS] = {
12332 		.type = HDA_FIXUP_FUNC,
12333 		.v.func = alc861vd_fixup_dallas,
12334 	},
12335 };
12336 
12337 static const struct hda_quirk alc861vd_fixup_tbl[] = {
12338 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
12339 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
12340 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
12341 	{}
12342 };
12343 
12344 /*
12345  */
patch_alc861vd(struct hda_codec * codec)12346 static int patch_alc861vd(struct hda_codec *codec)
12347 {
12348 	struct alc_spec *spec;
12349 	int err;
12350 
12351 	err = alc_alloc_spec(codec, 0x0b);
12352 	if (err < 0)
12353 		return err;
12354 
12355 	spec = codec->spec;
12356 	if (has_cdefine_beep(codec))
12357 		spec->gen.beep_nid = 0x23;
12358 
12359 	spec->shutup = alc_eapd_shutup;
12360 
12361 	alc_pre_init(codec);
12362 
12363 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
12364 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12365 
12366 	/* automatic parse from the BIOS config */
12367 	err = alc861vd_parse_auto_config(codec);
12368 	if (err < 0)
12369 		goto error;
12370 
12371 	if (!spec->gen.no_analog) {
12372 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12373 		if (err < 0)
12374 			goto error;
12375 	}
12376 
12377 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12378 
12379 	return 0;
12380 
12381  error:
12382 	alc_free(codec);
12383 	return err;
12384 }
12385 
12386 /*
12387  * ALC662 support
12388  *
12389  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12390  * configuration.  Each pin widget can choose any input DACs and a mixer.
12391  * Each ADC is connected from a mixer of all inputs.  This makes possible
12392  * 6-channel independent captures.
12393  *
12394  * In addition, an independent DAC for the multi-playback (not used in this
12395  * driver yet).
12396  */
12397 
12398 /*
12399  * BIOS auto configuration
12400  */
12401 
alc662_parse_auto_config(struct hda_codec * codec)12402 static int alc662_parse_auto_config(struct hda_codec *codec)
12403 {
12404 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
12405 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
12406 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
12407 	const hda_nid_t *ssids;
12408 
12409 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
12410 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
12411 	    codec->core.vendor_id == 0x10ec0671)
12412 		ssids = alc663_ssids;
12413 	else
12414 		ssids = alc662_ssids;
12415 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
12416 }
12417 
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)12418 static void alc272_fixup_mario(struct hda_codec *codec,
12419 			       const struct hda_fixup *fix, int action)
12420 {
12421 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
12422 		return;
12423 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
12424 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
12425 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
12426 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12427 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
12428 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
12429 }
12430 
12431 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
12432 	{ .channels = 2,
12433 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
12434 	{ .channels = 4,
12435 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
12436 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
12437 	{ }
12438 };
12439 
12440 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)12441 static void alc_fixup_bass_chmap(struct hda_codec *codec,
12442 				    const struct hda_fixup *fix, int action)
12443 {
12444 	if (action == HDA_FIXUP_ACT_BUILD) {
12445 		struct alc_spec *spec = codec->spec;
12446 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
12447 	}
12448 }
12449 
12450 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)12451 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
12452 					  hda_nid_t nid,
12453 					  unsigned int power_state)
12454 {
12455 	struct alc_spec *spec = codec->spec;
12456 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
12457 		return AC_PWRST_D0;
12458 	return power_state;
12459 }
12460 
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)12461 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
12462 				   const struct hda_fixup *fix, int action)
12463 {
12464 	struct alc_spec *spec = codec->spec;
12465 
12466 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
12467 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12468 		spec->mute_led_polarity = 1;
12469 		codec->power_filter = gpio_led_power_filter;
12470 	}
12471 }
12472 
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)12473 static void alc662_usi_automute_hook(struct hda_codec *codec,
12474 					 struct hda_jack_callback *jack)
12475 {
12476 	struct alc_spec *spec = codec->spec;
12477 	int vref;
12478 	msleep(200);
12479 	snd_hda_gen_hp_automute(codec, jack);
12480 
12481 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
12482 	msleep(100);
12483 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
12484 			    vref);
12485 }
12486 
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)12487 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
12488 				     const struct hda_fixup *fix, int action)
12489 {
12490 	struct alc_spec *spec = codec->spec;
12491 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12492 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12493 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
12494 	}
12495 }
12496 
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)12497 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
12498 					struct hda_jack_callback *cb)
12499 {
12500 	/* surround speakers at 0x1b already get muted automatically when
12501 	 * headphones are plugged in, but we have to mute/unmute the remaining
12502 	 * channels manually:
12503 	 * 0x15 - front left/front right
12504 	 * 0x18 - front center/ LFE
12505 	 */
12506 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
12507 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
12508 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
12509 	} else {
12510 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
12511 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
12512 	}
12513 }
12514 
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)12515 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
12516 					const struct hda_fixup *fix, int action)
12517 {
12518     /* Pin 0x1b: shared headphones jack and surround speakers */
12519 	if (!is_jack_detectable(codec, 0x1b))
12520 		return;
12521 
12522 	switch (action) {
12523 	case HDA_FIXUP_ACT_PRE_PROBE:
12524 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
12525 				alc662_aspire_ethos_mute_speakers);
12526 		/* subwoofer needs an extra GPIO setting to become audible */
12527 		alc_setup_gpio(codec, 0x02);
12528 		break;
12529 	case HDA_FIXUP_ACT_INIT:
12530 		/* Make sure to start in a correct state, i.e. if
12531 		 * headphones have been plugged in before powering up the system
12532 		 */
12533 		alc662_aspire_ethos_mute_speakers(codec, NULL);
12534 		break;
12535 	}
12536 }
12537 
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)12538 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
12539 					     const struct hda_fixup *fix, int action)
12540 {
12541 	struct alc_spec *spec = codec->spec;
12542 
12543 	static const struct hda_pintbl pincfgs[] = {
12544 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
12545 		{ 0x1b, 0x0181304f },
12546 		{ }
12547 	};
12548 
12549 	switch (action) {
12550 	case HDA_FIXUP_ACT_PRE_PROBE:
12551 		spec->gen.mixer_nid = 0;
12552 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12553 		snd_hda_apply_pincfgs(codec, pincfgs);
12554 		break;
12555 	case HDA_FIXUP_ACT_INIT:
12556 		alc_write_coef_idx(codec, 0x19, 0xa054);
12557 		break;
12558 	}
12559 }
12560 
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)12561 static void alc897_hp_automute_hook(struct hda_codec *codec,
12562 					 struct hda_jack_callback *jack)
12563 {
12564 	struct alc_spec *spec = codec->spec;
12565 	int vref;
12566 
12567 	snd_hda_gen_hp_automute(codec, jack);
12568 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
12569 	snd_hda_set_pin_ctl(codec, 0x1b, vref);
12570 }
12571 
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)12572 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
12573 				     const struct hda_fixup *fix, int action)
12574 {
12575 	struct alc_spec *spec = codec->spec;
12576 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12577 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
12578 		spec->no_shutup_pins = 1;
12579 	}
12580 	if (action == HDA_FIXUP_ACT_PROBE) {
12581 		snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
12582 	}
12583 }
12584 
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)12585 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
12586 				     const struct hda_fixup *fix, int action)
12587 {
12588 	struct alc_spec *spec = codec->spec;
12589 
12590 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12591 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12592 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
12593 	}
12594 }
12595 
12596 static const struct coef_fw alc668_coefs[] = {
12597 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
12598 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
12599 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
12600 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
12601 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
12602 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
12603 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
12604 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
12605 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
12606 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
12607 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
12608 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
12609 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
12610 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
12611 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
12612 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
12613 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
12614 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
12615 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
12616 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
12617 	{}
12618 };
12619 
alc668_restore_default_value(struct hda_codec * codec)12620 static void alc668_restore_default_value(struct hda_codec *codec)
12621 {
12622 	alc_process_coef_fw(codec, alc668_coefs);
12623 }
12624 
12625 enum {
12626 	ALC662_FIXUP_ASPIRE,
12627 	ALC662_FIXUP_LED_GPIO1,
12628 	ALC662_FIXUP_IDEAPAD,
12629 	ALC272_FIXUP_MARIO,
12630 	ALC662_FIXUP_CZC_ET26,
12631 	ALC662_FIXUP_CZC_P10T,
12632 	ALC662_FIXUP_SKU_IGNORE,
12633 	ALC662_FIXUP_HP_RP5800,
12634 	ALC662_FIXUP_ASUS_MODE1,
12635 	ALC662_FIXUP_ASUS_MODE2,
12636 	ALC662_FIXUP_ASUS_MODE3,
12637 	ALC662_FIXUP_ASUS_MODE4,
12638 	ALC662_FIXUP_ASUS_MODE5,
12639 	ALC662_FIXUP_ASUS_MODE6,
12640 	ALC662_FIXUP_ASUS_MODE7,
12641 	ALC662_FIXUP_ASUS_MODE8,
12642 	ALC662_FIXUP_NO_JACK_DETECT,
12643 	ALC662_FIXUP_ZOTAC_Z68,
12644 	ALC662_FIXUP_INV_DMIC,
12645 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12646 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
12647 	ALC662_FIXUP_HEADSET_MODE,
12648 	ALC668_FIXUP_HEADSET_MODE,
12649 	ALC662_FIXUP_BASS_MODE4_CHMAP,
12650 	ALC662_FIXUP_BASS_16,
12651 	ALC662_FIXUP_BASS_1A,
12652 	ALC662_FIXUP_BASS_CHMAP,
12653 	ALC668_FIXUP_AUTO_MUTE,
12654 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
12655 	ALC668_FIXUP_DELL_XPS13,
12656 	ALC662_FIXUP_ASUS_Nx50,
12657 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12658 	ALC668_FIXUP_ASUS_Nx51,
12659 	ALC668_FIXUP_MIC_COEF,
12660 	ALC668_FIXUP_ASUS_G751,
12661 	ALC891_FIXUP_HEADSET_MODE,
12662 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12663 	ALC662_FIXUP_ACER_VERITON,
12664 	ALC892_FIXUP_ASROCK_MOBO,
12665 	ALC662_FIXUP_USI_FUNC,
12666 	ALC662_FIXUP_USI_HEADSET_MODE,
12667 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
12668 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
12669 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
12670 	ALC671_FIXUP_HP_HEADSET_MIC2,
12671 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
12672 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
12673 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
12674 	ALC668_FIXUP_HEADSET_MIC,
12675 	ALC668_FIXUP_MIC_DET_COEF,
12676 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
12677 	ALC897_FIXUP_HEADSET_MIC_PIN,
12678 	ALC897_FIXUP_HP_HSMIC_VERB,
12679 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
12680 	ALC897_FIXUP_HEADSET_MIC_PIN2,
12681 	ALC897_FIXUP_UNIS_H3C_X500S,
12682 	ALC897_FIXUP_HEADSET_MIC_PIN3,
12683 };
12684 
12685 static const struct hda_fixup alc662_fixups[] = {
12686 	[ALC662_FIXUP_ASPIRE] = {
12687 		.type = HDA_FIXUP_PINS,
12688 		.v.pins = (const struct hda_pintbl[]) {
12689 			{ 0x15, 0x99130112 }, /* subwoofer */
12690 			{ }
12691 		}
12692 	},
12693 	[ALC662_FIXUP_LED_GPIO1] = {
12694 		.type = HDA_FIXUP_FUNC,
12695 		.v.func = alc662_fixup_led_gpio1,
12696 	},
12697 	[ALC662_FIXUP_IDEAPAD] = {
12698 		.type = HDA_FIXUP_PINS,
12699 		.v.pins = (const struct hda_pintbl[]) {
12700 			{ 0x17, 0x99130112 }, /* subwoofer */
12701 			{ }
12702 		},
12703 		.chained = true,
12704 		.chain_id = ALC662_FIXUP_LED_GPIO1,
12705 	},
12706 	[ALC272_FIXUP_MARIO] = {
12707 		.type = HDA_FIXUP_FUNC,
12708 		.v.func = alc272_fixup_mario,
12709 	},
12710 	[ALC662_FIXUP_CZC_ET26] = {
12711 		.type = HDA_FIXUP_PINS,
12712 		.v.pins = (const struct hda_pintbl[]) {
12713 			{0x12, 0x403cc000},
12714 			{0x14, 0x90170110}, /* speaker */
12715 			{0x15, 0x411111f0},
12716 			{0x16, 0x411111f0},
12717 			{0x18, 0x01a19030}, /* mic */
12718 			{0x19, 0x90a7013f}, /* int-mic */
12719 			{0x1a, 0x01014020},
12720 			{0x1b, 0x0121401f},
12721 			{0x1c, 0x411111f0},
12722 			{0x1d, 0x411111f0},
12723 			{0x1e, 0x40478e35},
12724 			{}
12725 		},
12726 		.chained = true,
12727 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12728 	},
12729 	[ALC662_FIXUP_CZC_P10T] = {
12730 		.type = HDA_FIXUP_VERBS,
12731 		.v.verbs = (const struct hda_verb[]) {
12732 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
12733 			{}
12734 		}
12735 	},
12736 	[ALC662_FIXUP_SKU_IGNORE] = {
12737 		.type = HDA_FIXUP_FUNC,
12738 		.v.func = alc_fixup_sku_ignore,
12739 	},
12740 	[ALC662_FIXUP_HP_RP5800] = {
12741 		.type = HDA_FIXUP_PINS,
12742 		.v.pins = (const struct hda_pintbl[]) {
12743 			{ 0x14, 0x0221201f }, /* HP out */
12744 			{ }
12745 		},
12746 		.chained = true,
12747 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12748 	},
12749 	[ALC662_FIXUP_ASUS_MODE1] = {
12750 		.type = HDA_FIXUP_PINS,
12751 		.v.pins = (const struct hda_pintbl[]) {
12752 			{ 0x14, 0x99130110 }, /* speaker */
12753 			{ 0x18, 0x01a19c20 }, /* mic */
12754 			{ 0x19, 0x99a3092f }, /* int-mic */
12755 			{ 0x21, 0x0121401f }, /* HP out */
12756 			{ }
12757 		},
12758 		.chained = true,
12759 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12760 	},
12761 	[ALC662_FIXUP_ASUS_MODE2] = {
12762 		.type = HDA_FIXUP_PINS,
12763 		.v.pins = (const struct hda_pintbl[]) {
12764 			{ 0x14, 0x99130110 }, /* speaker */
12765 			{ 0x18, 0x01a19820 }, /* mic */
12766 			{ 0x19, 0x99a3092f }, /* int-mic */
12767 			{ 0x1b, 0x0121401f }, /* HP out */
12768 			{ }
12769 		},
12770 		.chained = true,
12771 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12772 	},
12773 	[ALC662_FIXUP_ASUS_MODE3] = {
12774 		.type = HDA_FIXUP_PINS,
12775 		.v.pins = (const struct hda_pintbl[]) {
12776 			{ 0x14, 0x99130110 }, /* speaker */
12777 			{ 0x15, 0x0121441f }, /* HP */
12778 			{ 0x18, 0x01a19840 }, /* mic */
12779 			{ 0x19, 0x99a3094f }, /* int-mic */
12780 			{ 0x21, 0x01211420 }, /* HP2 */
12781 			{ }
12782 		},
12783 		.chained = true,
12784 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12785 	},
12786 	[ALC662_FIXUP_ASUS_MODE4] = {
12787 		.type = HDA_FIXUP_PINS,
12788 		.v.pins = (const struct hda_pintbl[]) {
12789 			{ 0x14, 0x99130110 }, /* speaker */
12790 			{ 0x16, 0x99130111 }, /* speaker */
12791 			{ 0x18, 0x01a19840 }, /* mic */
12792 			{ 0x19, 0x99a3094f }, /* int-mic */
12793 			{ 0x21, 0x0121441f }, /* HP */
12794 			{ }
12795 		},
12796 		.chained = true,
12797 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12798 	},
12799 	[ALC662_FIXUP_ASUS_MODE5] = {
12800 		.type = HDA_FIXUP_PINS,
12801 		.v.pins = (const struct hda_pintbl[]) {
12802 			{ 0x14, 0x99130110 }, /* speaker */
12803 			{ 0x15, 0x0121441f }, /* HP */
12804 			{ 0x16, 0x99130111 }, /* speaker */
12805 			{ 0x18, 0x01a19840 }, /* mic */
12806 			{ 0x19, 0x99a3094f }, /* int-mic */
12807 			{ }
12808 		},
12809 		.chained = true,
12810 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12811 	},
12812 	[ALC662_FIXUP_ASUS_MODE6] = {
12813 		.type = HDA_FIXUP_PINS,
12814 		.v.pins = (const struct hda_pintbl[]) {
12815 			{ 0x14, 0x99130110 }, /* speaker */
12816 			{ 0x15, 0x01211420 }, /* HP2 */
12817 			{ 0x18, 0x01a19840 }, /* mic */
12818 			{ 0x19, 0x99a3094f }, /* int-mic */
12819 			{ 0x1b, 0x0121441f }, /* HP */
12820 			{ }
12821 		},
12822 		.chained = true,
12823 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12824 	},
12825 	[ALC662_FIXUP_ASUS_MODE7] = {
12826 		.type = HDA_FIXUP_PINS,
12827 		.v.pins = (const struct hda_pintbl[]) {
12828 			{ 0x14, 0x99130110 }, /* speaker */
12829 			{ 0x17, 0x99130111 }, /* speaker */
12830 			{ 0x18, 0x01a19840 }, /* mic */
12831 			{ 0x19, 0x99a3094f }, /* int-mic */
12832 			{ 0x1b, 0x01214020 }, /* HP */
12833 			{ 0x21, 0x0121401f }, /* HP */
12834 			{ }
12835 		},
12836 		.chained = true,
12837 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12838 	},
12839 	[ALC662_FIXUP_ASUS_MODE8] = {
12840 		.type = HDA_FIXUP_PINS,
12841 		.v.pins = (const struct hda_pintbl[]) {
12842 			{ 0x14, 0x99130110 }, /* speaker */
12843 			{ 0x12, 0x99a30970 }, /* int-mic */
12844 			{ 0x15, 0x01214020 }, /* HP */
12845 			{ 0x17, 0x99130111 }, /* speaker */
12846 			{ 0x18, 0x01a19840 }, /* mic */
12847 			{ 0x21, 0x0121401f }, /* HP */
12848 			{ }
12849 		},
12850 		.chained = true,
12851 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12852 	},
12853 	[ALC662_FIXUP_NO_JACK_DETECT] = {
12854 		.type = HDA_FIXUP_FUNC,
12855 		.v.func = alc_fixup_no_jack_detect,
12856 	},
12857 	[ALC662_FIXUP_ZOTAC_Z68] = {
12858 		.type = HDA_FIXUP_PINS,
12859 		.v.pins = (const struct hda_pintbl[]) {
12860 			{ 0x1b, 0x02214020 }, /* Front HP */
12861 			{ }
12862 		}
12863 	},
12864 	[ALC662_FIXUP_INV_DMIC] = {
12865 		.type = HDA_FIXUP_FUNC,
12866 		.v.func = alc_fixup_inv_dmic,
12867 	},
12868 	[ALC668_FIXUP_DELL_XPS13] = {
12869 		.type = HDA_FIXUP_FUNC,
12870 		.v.func = alc_fixup_dell_xps13,
12871 		.chained = true,
12872 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12873 	},
12874 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12875 		.type = HDA_FIXUP_FUNC,
12876 		.v.func = alc_fixup_disable_aamix,
12877 		.chained = true,
12878 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12879 	},
12880 	[ALC668_FIXUP_AUTO_MUTE] = {
12881 		.type = HDA_FIXUP_FUNC,
12882 		.v.func = alc_fixup_auto_mute_via_amp,
12883 		.chained = true,
12884 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12885 	},
12886 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12887 		.type = HDA_FIXUP_PINS,
12888 		.v.pins = (const struct hda_pintbl[]) {
12889 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12890 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12891 			{ }
12892 		},
12893 		.chained = true,
12894 		.chain_id = ALC662_FIXUP_HEADSET_MODE
12895 	},
12896 	[ALC662_FIXUP_HEADSET_MODE] = {
12897 		.type = HDA_FIXUP_FUNC,
12898 		.v.func = alc_fixup_headset_mode_alc662,
12899 	},
12900 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12901 		.type = HDA_FIXUP_PINS,
12902 		.v.pins = (const struct hda_pintbl[]) {
12903 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12904 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12905 			{ }
12906 		},
12907 		.chained = true,
12908 		.chain_id = ALC668_FIXUP_HEADSET_MODE
12909 	},
12910 	[ALC668_FIXUP_HEADSET_MODE] = {
12911 		.type = HDA_FIXUP_FUNC,
12912 		.v.func = alc_fixup_headset_mode_alc668,
12913 	},
12914 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12915 		.type = HDA_FIXUP_FUNC,
12916 		.v.func = alc_fixup_bass_chmap,
12917 		.chained = true,
12918 		.chain_id = ALC662_FIXUP_ASUS_MODE4
12919 	},
12920 	[ALC662_FIXUP_BASS_16] = {
12921 		.type = HDA_FIXUP_PINS,
12922 		.v.pins = (const struct hda_pintbl[]) {
12923 			{0x16, 0x80106111}, /* bass speaker */
12924 			{}
12925 		},
12926 		.chained = true,
12927 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12928 	},
12929 	[ALC662_FIXUP_BASS_1A] = {
12930 		.type = HDA_FIXUP_PINS,
12931 		.v.pins = (const struct hda_pintbl[]) {
12932 			{0x1a, 0x80106111}, /* bass speaker */
12933 			{}
12934 		},
12935 		.chained = true,
12936 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
12937 	},
12938 	[ALC662_FIXUP_BASS_CHMAP] = {
12939 		.type = HDA_FIXUP_FUNC,
12940 		.v.func = alc_fixup_bass_chmap,
12941 	},
12942 	[ALC662_FIXUP_ASUS_Nx50] = {
12943 		.type = HDA_FIXUP_FUNC,
12944 		.v.func = alc_fixup_auto_mute_via_amp,
12945 		.chained = true,
12946 		.chain_id = ALC662_FIXUP_BASS_1A
12947 	},
12948 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12949 		.type = HDA_FIXUP_FUNC,
12950 		.v.func = alc_fixup_headset_mode_alc668,
12951 		.chain_id = ALC662_FIXUP_BASS_CHMAP
12952 	},
12953 	[ALC668_FIXUP_ASUS_Nx51] = {
12954 		.type = HDA_FIXUP_PINS,
12955 		.v.pins = (const struct hda_pintbl[]) {
12956 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12957 			{ 0x1a, 0x90170151 }, /* bass speaker */
12958 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12959 			{}
12960 		},
12961 		.chained = true,
12962 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12963 	},
12964 	[ALC668_FIXUP_MIC_COEF] = {
12965 		.type = HDA_FIXUP_VERBS,
12966 		.v.verbs = (const struct hda_verb[]) {
12967 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12968 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12969 			{}
12970 		},
12971 	},
12972 	[ALC668_FIXUP_ASUS_G751] = {
12973 		.type = HDA_FIXUP_PINS,
12974 		.v.pins = (const struct hda_pintbl[]) {
12975 			{ 0x16, 0x0421101f }, /* HP */
12976 			{}
12977 		},
12978 		.chained = true,
12979 		.chain_id = ALC668_FIXUP_MIC_COEF
12980 	},
12981 	[ALC891_FIXUP_HEADSET_MODE] = {
12982 		.type = HDA_FIXUP_FUNC,
12983 		.v.func = alc_fixup_headset_mode,
12984 	},
12985 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
12986 		.type = HDA_FIXUP_PINS,
12987 		.v.pins = (const struct hda_pintbl[]) {
12988 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12989 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12990 			{ }
12991 		},
12992 		.chained = true,
12993 		.chain_id = ALC891_FIXUP_HEADSET_MODE
12994 	},
12995 	[ALC662_FIXUP_ACER_VERITON] = {
12996 		.type = HDA_FIXUP_PINS,
12997 		.v.pins = (const struct hda_pintbl[]) {
12998 			{ 0x15, 0x50170120 }, /* no internal speaker */
12999 			{ }
13000 		}
13001 	},
13002 	[ALC892_FIXUP_ASROCK_MOBO] = {
13003 		.type = HDA_FIXUP_PINS,
13004 		.v.pins = (const struct hda_pintbl[]) {
13005 			{ 0x15, 0x40f000f0 }, /* disabled */
13006 			{ 0x16, 0x40f000f0 }, /* disabled */
13007 			{ }
13008 		}
13009 	},
13010 	[ALC662_FIXUP_USI_FUNC] = {
13011 		.type = HDA_FIXUP_FUNC,
13012 		.v.func = alc662_fixup_usi_headset_mic,
13013 	},
13014 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
13015 		.type = HDA_FIXUP_PINS,
13016 		.v.pins = (const struct hda_pintbl[]) {
13017 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
13018 			{ 0x18, 0x01a1903d },
13019 			{ }
13020 		},
13021 		.chained = true,
13022 		.chain_id = ALC662_FIXUP_USI_FUNC
13023 	},
13024 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
13025 		.type = HDA_FIXUP_FUNC,
13026 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
13027 	},
13028 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
13029 		.type = HDA_FIXUP_FUNC,
13030 		.v.func = alc662_fixup_aspire_ethos_hp,
13031 	},
13032 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
13033 		.type = HDA_FIXUP_PINS,
13034 		.v.pins = (const struct hda_pintbl[]) {
13035 			{ 0x15, 0x92130110 }, /* front speakers */
13036 			{ 0x18, 0x99130111 }, /* center/subwoofer */
13037 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
13038 			{ }
13039 		},
13040 		.chained = true,
13041 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
13042 	},
13043 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
13044 		.type = HDA_FIXUP_FUNC,
13045 		.v.func = alc671_fixup_hp_headset_mic2,
13046 	},
13047 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
13048 		.type = HDA_FIXUP_PINS,
13049 		.v.pins = (const struct hda_pintbl[]) {
13050 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
13051 			{ }
13052 		},
13053 		.chained = true,
13054 		.chain_id = ALC662_FIXUP_USI_FUNC
13055 	},
13056 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
13057 		.type = HDA_FIXUP_PINS,
13058 		.v.pins = (const struct hda_pintbl[]) {
13059 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
13060 			{ 0x1b, 0x0221144f },
13061 			{ }
13062 		},
13063 		.chained = true,
13064 		.chain_id = ALC662_FIXUP_USI_FUNC
13065 	},
13066 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
13067 		.type = HDA_FIXUP_PINS,
13068 		.v.pins = (const struct hda_pintbl[]) {
13069 			{ 0x1b, 0x04a1112c },
13070 			{ }
13071 		},
13072 		.chained = true,
13073 		.chain_id = ALC668_FIXUP_HEADSET_MIC
13074 	},
13075 	[ALC668_FIXUP_HEADSET_MIC] = {
13076 		.type = HDA_FIXUP_FUNC,
13077 		.v.func = alc269_fixup_headset_mic,
13078 		.chained = true,
13079 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
13080 	},
13081 	[ALC668_FIXUP_MIC_DET_COEF] = {
13082 		.type = HDA_FIXUP_VERBS,
13083 		.v.verbs = (const struct hda_verb[]) {
13084 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
13085 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
13086 			{}
13087 		},
13088 	},
13089 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
13090 		.type = HDA_FIXUP_FUNC,
13091 		.v.func = alc897_fixup_lenovo_headset_mic,
13092 	},
13093 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
13094 		.type = HDA_FIXUP_PINS,
13095 		.v.pins = (const struct hda_pintbl[]) {
13096 			{ 0x1a, 0x03a11050 },
13097 			{ }
13098 		},
13099 		.chained = true,
13100 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
13101 	},
13102 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
13103 		.type = HDA_FIXUP_PINS,
13104 		.v.pins = (const struct hda_pintbl[]) {
13105 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
13106 			{ }
13107 		},
13108 	},
13109 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
13110 		.type = HDA_FIXUP_FUNC,
13111 		.v.func = alc897_fixup_lenovo_headset_mode,
13112 	},
13113 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
13114 		.type = HDA_FIXUP_PINS,
13115 		.v.pins = (const struct hda_pintbl[]) {
13116 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
13117 			{ }
13118 		},
13119 		.chained = true,
13120 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
13121 	},
13122 	[ALC897_FIXUP_UNIS_H3C_X500S] = {
13123 		.type = HDA_FIXUP_VERBS,
13124 		.v.verbs = (const struct hda_verb[]) {
13125 			{ 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
13126 			{}
13127 		},
13128 	},
13129 	[ALC897_FIXUP_HEADSET_MIC_PIN3] = {
13130 		.type = HDA_FIXUP_PINS,
13131 		.v.pins = (const struct hda_pintbl[]) {
13132 			{ 0x19, 0x03a11050 }, /* use as headset mic */
13133 			{ }
13134 		},
13135 	},
13136 };
13137 
13138 static const struct hda_quirk alc662_fixup_tbl[] = {
13139 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
13140 	SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
13141 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
13142 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
13143 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
13144 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
13145 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
13146 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
13147 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
13148 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
13149 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
13150 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
13151 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13152 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13153 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
13154 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
13155 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
13156 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13157 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13158 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13159 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13160 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13161 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
13162 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13163 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13164 	SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13165 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
13166 	SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
13167 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
13168 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
13169 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
13170 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
13171 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
13172 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
13173 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
13174 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
13175 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
13176 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
13177 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
13178 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
13179 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
13180 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
13181 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
13182 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
13183 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
13184 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
13185 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
13186 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
13187 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
13188 	SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
13189 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
13190 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
13191 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
13192 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
13193 	SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
13194 	SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
13195 	SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
13196 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
13197 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
13198 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
13199 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
13200 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
13201 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
13202 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
13203 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
13204 	SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
13205 
13206 #if 0
13207 	/* Below is a quirk table taken from the old code.
13208 	 * Basically the device should work as is without the fixup table.
13209 	 * If BIOS doesn't give a proper info, enable the corresponding
13210 	 * fixup entry.
13211 	 */
13212 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
13213 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
13214 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
13215 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
13216 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13217 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13218 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13219 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
13220 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
13221 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13222 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
13223 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
13224 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
13225 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
13226 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
13227 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13228 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
13229 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
13230 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13231 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13232 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13233 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13234 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
13235 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
13236 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
13237 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13238 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
13239 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13240 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13241 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
13242 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13243 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13244 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
13245 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
13246 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
13247 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
13248 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
13249 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
13250 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
13251 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13252 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
13253 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
13254 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13255 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
13256 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
13257 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
13258 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
13259 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
13260 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13261 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
13262 #endif
13263 	{}
13264 };
13265 
13266 static const struct hda_model_fixup alc662_fixup_models[] = {
13267 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
13268 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
13269 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
13270 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
13271 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
13272 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
13273 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
13274 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
13275 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
13276 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
13277 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
13278 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
13279 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
13280 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
13281 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
13282 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
13283 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
13284 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
13285 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
13286 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
13287 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
13288 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
13289 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
13290 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
13291 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
13292 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
13293 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
13294 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
13295 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
13296 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
13297 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
13298 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
13299 	{.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
13300 	{}
13301 };
13302 
13303 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
13304 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
13305 		{0x17, 0x02211010},
13306 		{0x18, 0x01a19030},
13307 		{0x1a, 0x01813040},
13308 		{0x21, 0x01014020}),
13309 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
13310 		{0x16, 0x01813030},
13311 		{0x17, 0x02211010},
13312 		{0x18, 0x01a19040},
13313 		{0x21, 0x01014020}),
13314 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
13315 		{0x14, 0x01014010},
13316 		{0x18, 0x01a19020},
13317 		{0x1a, 0x0181302f},
13318 		{0x1b, 0x0221401f}),
13319 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13320 		{0x12, 0x99a30130},
13321 		{0x14, 0x90170110},
13322 		{0x15, 0x0321101f},
13323 		{0x16, 0x03011020}),
13324 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13325 		{0x12, 0x99a30140},
13326 		{0x14, 0x90170110},
13327 		{0x15, 0x0321101f},
13328 		{0x16, 0x03011020}),
13329 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13330 		{0x12, 0x99a30150},
13331 		{0x14, 0x90170110},
13332 		{0x15, 0x0321101f},
13333 		{0x16, 0x03011020}),
13334 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13335 		{0x14, 0x90170110},
13336 		{0x15, 0x0321101f},
13337 		{0x16, 0x03011020}),
13338 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
13339 		{0x12, 0x90a60130},
13340 		{0x14, 0x90170110},
13341 		{0x15, 0x0321101f}),
13342 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13343 		{0x14, 0x01014010},
13344 		{0x17, 0x90170150},
13345 		{0x19, 0x02a11060},
13346 		{0x1b, 0x01813030},
13347 		{0x21, 0x02211020}),
13348 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13349 		{0x14, 0x01014010},
13350 		{0x18, 0x01a19040},
13351 		{0x1b, 0x01813030},
13352 		{0x21, 0x02211020}),
13353 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13354 		{0x14, 0x01014020},
13355 		{0x17, 0x90170110},
13356 		{0x18, 0x01a19050},
13357 		{0x1b, 0x01813040},
13358 		{0x21, 0x02211030}),
13359 	{}
13360 };
13361 
13362 /*
13363  */
patch_alc662(struct hda_codec * codec)13364 static int patch_alc662(struct hda_codec *codec)
13365 {
13366 	struct alc_spec *spec;
13367 	int err;
13368 
13369 	err = alc_alloc_spec(codec, 0x0b);
13370 	if (err < 0)
13371 		return err;
13372 
13373 	spec = codec->spec;
13374 
13375 	spec->shutup = alc_eapd_shutup;
13376 
13377 	/* handle multiple HPs as is */
13378 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
13379 
13380 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
13381 
13382 	switch (codec->core.vendor_id) {
13383 	case 0x10ec0668:
13384 		spec->init_hook = alc668_restore_default_value;
13385 		break;
13386 	}
13387 
13388 	alc_pre_init(codec);
13389 
13390 	snd_hda_pick_fixup(codec, alc662_fixup_models,
13391 		       alc662_fixup_tbl, alc662_fixups);
13392 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
13393 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
13394 
13395 	alc_auto_parse_customize_define(codec);
13396 
13397 	if (has_cdefine_beep(codec))
13398 		spec->gen.beep_nid = 0x01;
13399 
13400 	if ((alc_get_coef0(codec) & (1 << 14)) &&
13401 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
13402 	    spec->cdefine.platform_type == 1) {
13403 		err = alc_codec_rename(codec, "ALC272X");
13404 		if (err < 0)
13405 			goto error;
13406 	}
13407 
13408 	/* automatic parse from the BIOS config */
13409 	err = alc662_parse_auto_config(codec);
13410 	if (err < 0)
13411 		goto error;
13412 
13413 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
13414 		switch (codec->core.vendor_id) {
13415 		case 0x10ec0662:
13416 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13417 			break;
13418 		case 0x10ec0272:
13419 		case 0x10ec0663:
13420 		case 0x10ec0665:
13421 		case 0x10ec0668:
13422 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13423 			break;
13424 		case 0x10ec0273:
13425 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
13426 			break;
13427 		}
13428 		if (err < 0)
13429 			goto error;
13430 	}
13431 
13432 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
13433 
13434 	return 0;
13435 
13436  error:
13437 	alc_free(codec);
13438 	return err;
13439 }
13440 
13441 /*
13442  * ALC680 support
13443  */
13444 
alc680_parse_auto_config(struct hda_codec * codec)13445 static int alc680_parse_auto_config(struct hda_codec *codec)
13446 {
13447 	return alc_parse_auto_config(codec, NULL, NULL);
13448 }
13449 
13450 /*
13451  */
patch_alc680(struct hda_codec * codec)13452 static int patch_alc680(struct hda_codec *codec)
13453 {
13454 	int err;
13455 
13456 	/* ALC680 has no aa-loopback mixer */
13457 	err = alc_alloc_spec(codec, 0);
13458 	if (err < 0)
13459 		return err;
13460 
13461 	/* automatic parse from the BIOS config */
13462 	err = alc680_parse_auto_config(codec);
13463 	if (err < 0) {
13464 		alc_free(codec);
13465 		return err;
13466 	}
13467 
13468 	return 0;
13469 }
13470 
13471 /*
13472  * patch entries
13473  */
13474 static const struct hda_device_id snd_hda_id_realtek[] = {
13475 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
13476 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
13477 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
13478 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
13479 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
13480 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
13481 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
13482 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
13483 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
13484 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
13485 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
13486 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
13487 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
13488 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
13489 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
13490 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
13491 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
13492 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
13493 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
13494 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
13495 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
13496 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
13497 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
13498 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
13499 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
13500 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
13501 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
13502 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
13503 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
13504 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
13505 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
13506 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
13507 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
13508 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
13509 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
13510 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
13511 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
13512 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
13513 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
13514 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
13515 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
13516 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
13517 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
13518 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
13519 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
13520 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
13521 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
13522 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
13523 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
13524 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
13525 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
13526 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
13527 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
13528 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
13529 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
13530 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
13531 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
13532 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
13533 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
13534 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
13535 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
13536 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
13537 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
13538 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
13539 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
13540 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
13541 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
13542 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
13543 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
13544 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
13545 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
13546 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
13547 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
13548 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
13549 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
13550 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
13551 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
13552 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
13553 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
13554 	{} /* terminator */
13555 };
13556 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
13557 
13558 MODULE_LICENSE("GPL");
13559 MODULE_DESCRIPTION("Realtek HD-audio codec");
13560 MODULE_IMPORT_NS("SND_HDA_SCODEC_COMPONENT");
13561 
13562 static struct hda_codec_driver realtek_driver = {
13563 	.id = snd_hda_id_realtek,
13564 };
13565 
13566 module_hda_codec_driver(realtek_driver);
13567