• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Universal Interface for Intel High Definition Audio Codec
4  *
5  * HD audio interface patch for Realtek ALC codecs
6  *
7  * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8  *                    PeiSen Hou <pshou@realtek.com.tw>
9  *                    Takashi Iwai <tiwai@suse.de>
10  *                    Jonathan Woithe <jwoithe@just42.net>
11  */
12 
13 #include <linux/acpi.h>
14 #include <linux/cleanup.h>
15 #include <linux/init.h>
16 #include <linux/delay.h>
17 #include <linux/slab.h>
18 #include <linux/pci.h>
19 #include <linux/dmi.h>
20 #include <linux/module.h>
21 #include <linux/i2c.h>
22 #include <linux/input.h>
23 #include <linux/leds.h>
24 #include <linux/ctype.h>
25 #include <linux/spi/spi.h>
26 #include <sound/core.h>
27 #include <sound/jack.h>
28 #include <sound/hda_codec.h>
29 #include "hda_local.h"
30 #include "hda_auto_parser.h"
31 #include "hda_beep.h"
32 #include "hda_jack.h"
33 #include "hda_generic.h"
34 #include "hda_component.h"
35 
36 /* keep halting ALC5505 DSP, for power saving */
37 #define HALT_REALTEK_ALC5505
38 
39 /* extra amp-initialization sequence types */
40 enum {
41 	ALC_INIT_UNDEFINED,
42 	ALC_INIT_NONE,
43 	ALC_INIT_DEFAULT,
44 };
45 
46 enum {
47 	ALC_HEADSET_MODE_UNKNOWN,
48 	ALC_HEADSET_MODE_UNPLUGGED,
49 	ALC_HEADSET_MODE_HEADSET,
50 	ALC_HEADSET_MODE_MIC,
51 	ALC_HEADSET_MODE_HEADPHONE,
52 };
53 
54 enum {
55 	ALC_HEADSET_TYPE_UNKNOWN,
56 	ALC_HEADSET_TYPE_CTIA,
57 	ALC_HEADSET_TYPE_OMTP,
58 };
59 
60 enum {
61 	ALC_KEY_MICMUTE_INDEX,
62 };
63 
64 struct alc_customize_define {
65 	unsigned int  sku_cfg;
66 	unsigned char port_connectivity;
67 	unsigned char check_sum;
68 	unsigned char customization;
69 	unsigned char external_amp;
70 	unsigned int  enable_pcbeep:1;
71 	unsigned int  platform_type:1;
72 	unsigned int  swap:1;
73 	unsigned int  override:1;
74 	unsigned int  fixup:1; /* Means that this sku is set by driver, not read from hw */
75 };
76 
77 struct alc_coef_led {
78 	unsigned int idx;
79 	unsigned int mask;
80 	unsigned int on;
81 	unsigned int off;
82 };
83 
84 struct alc_spec {
85 	struct hda_gen_spec gen; /* must be at head */
86 
87 	/* codec parameterization */
88 	struct alc_customize_define cdefine;
89 	unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
90 
91 	/* GPIO bits */
92 	unsigned int gpio_mask;
93 	unsigned int gpio_dir;
94 	unsigned int gpio_data;
95 	bool gpio_write_delay;	/* add a delay before writing gpio_data */
96 
97 	/* mute LED for HP laptops, see vref_mute_led_set() */
98 	int mute_led_polarity;
99 	int micmute_led_polarity;
100 	hda_nid_t mute_led_nid;
101 	hda_nid_t cap_mute_led_nid;
102 
103 	unsigned int gpio_mute_led_mask;
104 	unsigned int gpio_mic_led_mask;
105 	struct alc_coef_led mute_led_coef;
106 	struct alc_coef_led mic_led_coef;
107 	struct mutex coef_mutex;
108 
109 	hda_nid_t headset_mic_pin;
110 	hda_nid_t headphone_mic_pin;
111 	int current_headset_mode;
112 	int current_headset_type;
113 
114 	/* hooks */
115 	void (*init_hook)(struct hda_codec *codec);
116 	void (*power_hook)(struct hda_codec *codec);
117 	void (*shutup)(struct hda_codec *codec);
118 
119 	int init_amp;
120 	int codec_variant;	/* flag for other variants */
121 	unsigned int has_alc5505_dsp:1;
122 	unsigned int no_depop_delay:1;
123 	unsigned int done_hp_init:1;
124 	unsigned int no_shutup_pins:1;
125 	unsigned int ultra_low_power:1;
126 	unsigned int has_hs_key:1;
127 	unsigned int no_internal_mic_pin:1;
128 	unsigned int en_3kpull_low:1;
129 	int num_speaker_amps;
130 
131 	/* for PLL fix */
132 	hda_nid_t pll_nid;
133 	unsigned int pll_coef_idx, pll_coef_bit;
134 	unsigned int coef0;
135 	struct input_dev *kb_dev;
136 	u8 alc_mute_keycode_map[1];
137 
138 	/* component binding */
139 	struct hda_component_parent comps;
140 };
141 
142 /*
143  * COEF access helper functions
144  */
145 
coef_mutex_lock(struct hda_codec * codec)146 static void coef_mutex_lock(struct hda_codec *codec)
147 {
148 	struct alc_spec *spec = codec->spec;
149 
150 	snd_hda_power_up_pm(codec);
151 	mutex_lock(&spec->coef_mutex);
152 }
153 
coef_mutex_unlock(struct hda_codec * codec)154 static void coef_mutex_unlock(struct hda_codec *codec)
155 {
156 	struct alc_spec *spec = codec->spec;
157 
158 	mutex_unlock(&spec->coef_mutex);
159 	snd_hda_power_down_pm(codec);
160 }
161 
__alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)162 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
163 				 unsigned int coef_idx)
164 {
165 	unsigned int val;
166 
167 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
168 	val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
169 	return val;
170 }
171 
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)172 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
173 			       unsigned int coef_idx)
174 {
175 	unsigned int val;
176 
177 	coef_mutex_lock(codec);
178 	val = __alc_read_coefex_idx(codec, nid, coef_idx);
179 	coef_mutex_unlock(codec);
180 	return val;
181 }
182 
183 #define alc_read_coef_idx(codec, coef_idx) \
184 	alc_read_coefex_idx(codec, 0x20, coef_idx)
185 
__alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)186 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
187 				   unsigned int coef_idx, unsigned int coef_val)
188 {
189 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
190 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
191 }
192 
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)193 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
194 				 unsigned int coef_idx, unsigned int coef_val)
195 {
196 	coef_mutex_lock(codec);
197 	__alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
198 	coef_mutex_unlock(codec);
199 }
200 
201 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
202 	alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
203 
__alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)204 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
205 				    unsigned int coef_idx, unsigned int mask,
206 				    unsigned int bits_set)
207 {
208 	unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
209 
210 	if (val != -1)
211 		__alc_write_coefex_idx(codec, nid, coef_idx,
212 				       (val & ~mask) | bits_set);
213 }
214 
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)215 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
216 				  unsigned int coef_idx, unsigned int mask,
217 				  unsigned int bits_set)
218 {
219 	coef_mutex_lock(codec);
220 	__alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
221 	coef_mutex_unlock(codec);
222 }
223 
224 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set)	\
225 	alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
226 
227 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)228 static unsigned int alc_get_coef0(struct hda_codec *codec)
229 {
230 	struct alc_spec *spec = codec->spec;
231 
232 	if (!spec->coef0)
233 		spec->coef0 = alc_read_coef_idx(codec, 0);
234 	return spec->coef0;
235 }
236 
237 /* coef writes/updates batch */
238 struct coef_fw {
239 	unsigned char nid;
240 	unsigned char idx;
241 	unsigned short mask;
242 	unsigned short val;
243 };
244 
245 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
246 	{ .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
247 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
248 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
249 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
250 
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)251 static void alc_process_coef_fw(struct hda_codec *codec,
252 				const struct coef_fw *fw)
253 {
254 	coef_mutex_lock(codec);
255 	for (; fw->nid; fw++) {
256 		if (fw->mask == (unsigned short)-1)
257 			__alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
258 		else
259 			__alc_update_coefex_idx(codec, fw->nid, fw->idx,
260 						fw->mask, fw->val);
261 	}
262 	coef_mutex_unlock(codec);
263 }
264 
265 /*
266  * GPIO setup tables, used in initialization
267  */
268 
269 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)270 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
271 {
272 	struct alc_spec *spec = codec->spec;
273 
274 	spec->gpio_mask |= mask;
275 	spec->gpio_dir |= mask;
276 	spec->gpio_data |= mask;
277 }
278 
alc_write_gpio_data(struct hda_codec * codec)279 static void alc_write_gpio_data(struct hda_codec *codec)
280 {
281 	struct alc_spec *spec = codec->spec;
282 
283 	snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
284 			    spec->gpio_data);
285 }
286 
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)287 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
288 				 bool on)
289 {
290 	struct alc_spec *spec = codec->spec;
291 	unsigned int oldval = spec->gpio_data;
292 
293 	if (on)
294 		spec->gpio_data |= mask;
295 	else
296 		spec->gpio_data &= ~mask;
297 	if (oldval != spec->gpio_data)
298 		alc_write_gpio_data(codec);
299 }
300 
alc_write_gpio(struct hda_codec * codec)301 static void alc_write_gpio(struct hda_codec *codec)
302 {
303 	struct alc_spec *spec = codec->spec;
304 
305 	if (!spec->gpio_mask)
306 		return;
307 
308 	snd_hda_codec_write(codec, codec->core.afg, 0,
309 			    AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
310 	snd_hda_codec_write(codec, codec->core.afg, 0,
311 			    AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
312 	if (spec->gpio_write_delay)
313 		msleep(1);
314 	alc_write_gpio_data(codec);
315 }
316 
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)317 static void alc_fixup_gpio(struct hda_codec *codec, int action,
318 			   unsigned int mask)
319 {
320 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
321 		alc_setup_gpio(codec, mask);
322 }
323 
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)324 static void alc_fixup_gpio1(struct hda_codec *codec,
325 			    const struct hda_fixup *fix, int action)
326 {
327 	alc_fixup_gpio(codec, action, 0x01);
328 }
329 
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)330 static void alc_fixup_gpio2(struct hda_codec *codec,
331 			    const struct hda_fixup *fix, int action)
332 {
333 	alc_fixup_gpio(codec, action, 0x02);
334 }
335 
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)336 static void alc_fixup_gpio3(struct hda_codec *codec,
337 			    const struct hda_fixup *fix, int action)
338 {
339 	alc_fixup_gpio(codec, action, 0x03);
340 }
341 
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)342 static void alc_fixup_gpio4(struct hda_codec *codec,
343 			    const struct hda_fixup *fix, int action)
344 {
345 	alc_fixup_gpio(codec, action, 0x04);
346 }
347 
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)348 static void alc_fixup_micmute_led(struct hda_codec *codec,
349 				  const struct hda_fixup *fix, int action)
350 {
351 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
352 		snd_hda_gen_add_micmute_led_cdev(codec, NULL);
353 }
354 
355 /*
356  * Fix hardware PLL issue
357  * On some codecs, the analog PLL gating control must be off while
358  * the default value is 1.
359  */
alc_fix_pll(struct hda_codec * codec)360 static void alc_fix_pll(struct hda_codec *codec)
361 {
362 	struct alc_spec *spec = codec->spec;
363 
364 	if (spec->pll_nid)
365 		alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
366 				      1 << spec->pll_coef_bit, 0);
367 }
368 
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)369 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
370 			     unsigned int coef_idx, unsigned int coef_bit)
371 {
372 	struct alc_spec *spec = codec->spec;
373 	spec->pll_nid = nid;
374 	spec->pll_coef_idx = coef_idx;
375 	spec->pll_coef_bit = coef_bit;
376 	alc_fix_pll(codec);
377 }
378 
379 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)380 static void alc_update_knob_master(struct hda_codec *codec,
381 				   struct hda_jack_callback *jack)
382 {
383 	unsigned int val;
384 	struct snd_kcontrol *kctl;
385 	struct snd_ctl_elem_value *uctl;
386 
387 	kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
388 	if (!kctl)
389 		return;
390 	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
391 	if (!uctl)
392 		return;
393 	val = snd_hda_codec_read(codec, jack->nid, 0,
394 				 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
395 	val &= HDA_AMP_VOLMASK;
396 	uctl->value.integer.value[0] = val;
397 	uctl->value.integer.value[1] = val;
398 	kctl->put(kctl, uctl);
399 	kfree(uctl);
400 }
401 
alc880_unsol_event(struct hda_codec * codec,unsigned int res)402 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
403 {
404 	/* For some reason, the res given from ALC880 is broken.
405 	   Here we adjust it properly. */
406 	snd_hda_jack_unsol_event(codec, res >> 2);
407 }
408 
409 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)410 static void alc_fill_eapd_coef(struct hda_codec *codec)
411 {
412 	int coef;
413 
414 	coef = alc_get_coef0(codec);
415 
416 	switch (codec->core.vendor_id) {
417 	case 0x10ec0262:
418 		alc_update_coef_idx(codec, 0x7, 0, 1<<5);
419 		break;
420 	case 0x10ec0267:
421 	case 0x10ec0268:
422 		alc_update_coef_idx(codec, 0x7, 0, 1<<13);
423 		break;
424 	case 0x10ec0269:
425 		if ((coef & 0x00f0) == 0x0010)
426 			alc_update_coef_idx(codec, 0xd, 0, 1<<14);
427 		if ((coef & 0x00f0) == 0x0020)
428 			alc_update_coef_idx(codec, 0x4, 1<<15, 0);
429 		if ((coef & 0x00f0) == 0x0030)
430 			alc_update_coef_idx(codec, 0x10, 1<<9, 0);
431 		break;
432 	case 0x10ec0280:
433 	case 0x10ec0284:
434 	case 0x10ec0290:
435 	case 0x10ec0292:
436 		alc_update_coef_idx(codec, 0x4, 1<<15, 0);
437 		break;
438 	case 0x10ec0225:
439 	case 0x10ec0295:
440 	case 0x10ec0299:
441 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
442 		fallthrough;
443 	case 0x10ec0215:
444 	case 0x10ec0236:
445 	case 0x10ec0245:
446 	case 0x10ec0256:
447 	case 0x10ec0257:
448 	case 0x10ec0285:
449 	case 0x10ec0289:
450 		alc_update_coef_idx(codec, 0x36, 1<<13, 0);
451 		fallthrough;
452 	case 0x10ec0230:
453 	case 0x10ec0233:
454 	case 0x10ec0235:
455 	case 0x10ec0255:
456 	case 0x19e58326:
457 	case 0x10ec0282:
458 	case 0x10ec0283:
459 	case 0x10ec0286:
460 	case 0x10ec0288:
461 	case 0x10ec0298:
462 	case 0x10ec0300:
463 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
464 		break;
465 	case 0x10ec0275:
466 		alc_update_coef_idx(codec, 0xe, 0, 1<<0);
467 		break;
468 	case 0x10ec0287:
469 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
470 		alc_write_coef_idx(codec, 0x8, 0x4ab7);
471 		break;
472 	case 0x10ec0293:
473 		alc_update_coef_idx(codec, 0xa, 1<<13, 0);
474 		break;
475 	case 0x10ec0234:
476 	case 0x10ec0274:
477 		alc_write_coef_idx(codec, 0x6e, 0x0c25);
478 		fallthrough;
479 	case 0x10ec0294:
480 	case 0x10ec0700:
481 	case 0x10ec0701:
482 	case 0x10ec0703:
483 	case 0x10ec0711:
484 		alc_update_coef_idx(codec, 0x10, 1<<15, 0);
485 		break;
486 	case 0x10ec0662:
487 		if ((coef & 0x00f0) == 0x0030)
488 			alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
489 		break;
490 	case 0x10ec0272:
491 	case 0x10ec0273:
492 	case 0x10ec0663:
493 	case 0x10ec0665:
494 	case 0x10ec0670:
495 	case 0x10ec0671:
496 	case 0x10ec0672:
497 		alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
498 		break;
499 	case 0x10ec0222:
500 	case 0x10ec0623:
501 		alc_update_coef_idx(codec, 0x19, 1<<13, 0);
502 		break;
503 	case 0x10ec0668:
504 		alc_update_coef_idx(codec, 0x7, 3<<13, 0);
505 		break;
506 	case 0x10ec0867:
507 		alc_update_coef_idx(codec, 0x4, 1<<10, 0);
508 		break;
509 	case 0x10ec0888:
510 		if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
511 			alc_update_coef_idx(codec, 0x7, 1<<5, 0);
512 		break;
513 	case 0x10ec0892:
514 	case 0x10ec0897:
515 		alc_update_coef_idx(codec, 0x7, 1<<5, 0);
516 		break;
517 	case 0x10ec0899:
518 	case 0x10ec0900:
519 	case 0x10ec0b00:
520 	case 0x10ec1168:
521 	case 0x10ec1220:
522 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
523 		break;
524 	}
525 }
526 
527 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)528 static void alc888_coef_init(struct hda_codec *codec)
529 {
530 	switch (alc_get_coef0(codec) & 0x00f0) {
531 	/* alc888-VA */
532 	case 0x00:
533 	/* alc888-VB */
534 	case 0x10:
535 		alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
536 		break;
537 	}
538 }
539 
540 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)541 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
542 {
543 	if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
544 		return;
545 	if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
546 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
547 				    on ? 2 : 0);
548 }
549 
550 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)551 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
552 {
553 	/* We currently only handle front, HP */
554 	static const hda_nid_t pins[] = {
555 		0x0f, 0x10, 0x14, 0x15, 0x17, 0
556 	};
557 	const hda_nid_t *p;
558 	for (p = pins; *p; p++)
559 		set_eapd(codec, *p, on);
560 }
561 
562 static int find_ext_mic_pin(struct hda_codec *codec);
563 
alc_headset_mic_no_shutup(struct hda_codec * codec)564 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
565 {
566 	const struct hda_pincfg *pin;
567 	int mic_pin = find_ext_mic_pin(codec);
568 	int i;
569 
570 	/* don't shut up pins when unloading the driver; otherwise it breaks
571 	 * the default pin setup at the next load of the driver
572 	 */
573 	if (codec->bus->shutdown)
574 		return;
575 
576 	snd_array_for_each(&codec->init_pins, i, pin) {
577 		/* use read here for syncing after issuing each verb */
578 		if (pin->nid != mic_pin)
579 			snd_hda_codec_read(codec, pin->nid, 0,
580 					AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
581 	}
582 
583 	codec->pins_shutup = 1;
584 }
585 
alc_shutup_pins(struct hda_codec * codec)586 static void alc_shutup_pins(struct hda_codec *codec)
587 {
588 	struct alc_spec *spec = codec->spec;
589 
590 	if (spec->no_shutup_pins)
591 		return;
592 
593 	switch (codec->core.vendor_id) {
594 	case 0x10ec0236:
595 	case 0x10ec0256:
596 	case 0x10ec0257:
597 	case 0x19e58326:
598 	case 0x10ec0283:
599 	case 0x10ec0285:
600 	case 0x10ec0286:
601 	case 0x10ec0287:
602 	case 0x10ec0288:
603 	case 0x10ec0295:
604 	case 0x10ec0298:
605 		alc_headset_mic_no_shutup(codec);
606 		break;
607 	default:
608 		snd_hda_shutup_pins(codec);
609 		break;
610 	}
611 }
612 
613 /* generic shutup callback;
614  * just turning off EAPD and a little pause for avoiding pop-noise
615  */
alc_eapd_shutup(struct hda_codec * codec)616 static void alc_eapd_shutup(struct hda_codec *codec)
617 {
618 	struct alc_spec *spec = codec->spec;
619 
620 	alc_auto_setup_eapd(codec, false);
621 	if (!spec->no_depop_delay)
622 		msleep(200);
623 	alc_shutup_pins(codec);
624 }
625 
626 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)627 static void alc_auto_init_amp(struct hda_codec *codec, int type)
628 {
629 	alc_auto_setup_eapd(codec, true);
630 	alc_write_gpio(codec);
631 	switch (type) {
632 	case ALC_INIT_DEFAULT:
633 		switch (codec->core.vendor_id) {
634 		case 0x10ec0260:
635 			alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
636 			break;
637 		case 0x10ec0880:
638 		case 0x10ec0882:
639 		case 0x10ec0883:
640 		case 0x10ec0885:
641 			alc_update_coef_idx(codec, 7, 0, 0x2030);
642 			break;
643 		case 0x10ec0888:
644 			alc888_coef_init(codec);
645 			break;
646 		}
647 		break;
648 	}
649 }
650 
651 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)652 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
653 {
654 	if (spec->gen.autocfg.hp_pins[0])
655 		return spec->gen.autocfg.hp_pins[0];
656 	if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
657 		return spec->gen.autocfg.line_out_pins[0];
658 	return 0;
659 }
660 
661 /*
662  * Realtek SSID verification
663  */
664 
665 /* Could be any non-zero and even value. When used as fixup, tells
666  * the driver to ignore any present sku defines.
667  */
668 #define ALC_FIXUP_SKU_IGNORE (2)
669 
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)670 static void alc_fixup_sku_ignore(struct hda_codec *codec,
671 				 const struct hda_fixup *fix, int action)
672 {
673 	struct alc_spec *spec = codec->spec;
674 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
675 		spec->cdefine.fixup = 1;
676 		spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
677 	}
678 }
679 
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)680 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
681 				    const struct hda_fixup *fix, int action)
682 {
683 	struct alc_spec *spec = codec->spec;
684 
685 	if (action == HDA_FIXUP_ACT_PROBE) {
686 		spec->no_depop_delay = 1;
687 		codec->depop_delay = 0;
688 	}
689 }
690 
alc_auto_parse_customize_define(struct hda_codec * codec)691 static int alc_auto_parse_customize_define(struct hda_codec *codec)
692 {
693 	unsigned int ass, tmp, i;
694 	unsigned nid = 0;
695 	struct alc_spec *spec = codec->spec;
696 
697 	spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
698 
699 	if (spec->cdefine.fixup) {
700 		ass = spec->cdefine.sku_cfg;
701 		if (ass == ALC_FIXUP_SKU_IGNORE)
702 			return -1;
703 		goto do_sku;
704 	}
705 
706 	if (!codec->bus->pci)
707 		return -1;
708 	ass = codec->core.subsystem_id & 0xffff;
709 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
710 		goto do_sku;
711 
712 	nid = 0x1d;
713 	if (codec->core.vendor_id == 0x10ec0260)
714 		nid = 0x17;
715 	ass = snd_hda_codec_get_pincfg(codec, nid);
716 
717 	if (!(ass & 1)) {
718 		codec_info(codec, "%s: SKU not ready 0x%08x\n",
719 			   codec->core.chip_name, ass);
720 		return -1;
721 	}
722 
723 	/* check sum */
724 	tmp = 0;
725 	for (i = 1; i < 16; i++) {
726 		if ((ass >> i) & 1)
727 			tmp++;
728 	}
729 	if (((ass >> 16) & 0xf) != tmp)
730 		return -1;
731 
732 	spec->cdefine.port_connectivity = ass >> 30;
733 	spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
734 	spec->cdefine.check_sum = (ass >> 16) & 0xf;
735 	spec->cdefine.customization = ass >> 8;
736 do_sku:
737 	spec->cdefine.sku_cfg = ass;
738 	spec->cdefine.external_amp = (ass & 0x38) >> 3;
739 	spec->cdefine.platform_type = (ass & 0x4) >> 2;
740 	spec->cdefine.swap = (ass & 0x2) >> 1;
741 	spec->cdefine.override = ass & 0x1;
742 
743 	codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
744 		   nid, spec->cdefine.sku_cfg);
745 	codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
746 		   spec->cdefine.port_connectivity);
747 	codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
748 	codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
749 	codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
750 	codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
751 	codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
752 	codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
753 	codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
754 
755 	return 0;
756 }
757 
758 /* return the position of NID in the list, or -1 if not found */
find_idx_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)759 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
760 {
761 	int i;
762 	for (i = 0; i < nums; i++)
763 		if (list[i] == nid)
764 			return i;
765 	return -1;
766 }
767 /* return true if the given NID is found in the list */
found_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)768 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
769 {
770 	return find_idx_in_nid_list(nid, list, nums) >= 0;
771 }
772 
773 /* check subsystem ID and set up device-specific initialization;
774  * return 1 if initialized, 0 if invalid SSID
775  */
776 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
777  *	31 ~ 16 :	Manufacture ID
778  *	15 ~ 8	:	SKU ID
779  *	7  ~ 0	:	Assembly ID
780  *	port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
781  */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)782 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
783 {
784 	unsigned int ass, tmp, i;
785 	unsigned nid;
786 	struct alc_spec *spec = codec->spec;
787 
788 	if (spec->cdefine.fixup) {
789 		ass = spec->cdefine.sku_cfg;
790 		if (ass == ALC_FIXUP_SKU_IGNORE)
791 			return 0;
792 		goto do_sku;
793 	}
794 
795 	ass = codec->core.subsystem_id & 0xffff;
796 	if (codec->bus->pci &&
797 	    ass != codec->bus->pci->subsystem_device && (ass & 1))
798 		goto do_sku;
799 
800 	/* invalid SSID, check the special NID pin defcfg instead */
801 	/*
802 	 * 31~30	: port connectivity
803 	 * 29~21	: reserve
804 	 * 20		: PCBEEP input
805 	 * 19~16	: Check sum (15:1)
806 	 * 15~1		: Custom
807 	 * 0		: override
808 	*/
809 	nid = 0x1d;
810 	if (codec->core.vendor_id == 0x10ec0260)
811 		nid = 0x17;
812 	ass = snd_hda_codec_get_pincfg(codec, nid);
813 	codec_dbg(codec,
814 		  "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
815 		   ass, nid);
816 	if (!(ass & 1))
817 		return 0;
818 	if ((ass >> 30) != 1)	/* no physical connection */
819 		return 0;
820 
821 	/* check sum */
822 	tmp = 0;
823 	for (i = 1; i < 16; i++) {
824 		if ((ass >> i) & 1)
825 			tmp++;
826 	}
827 	if (((ass >> 16) & 0xf) != tmp)
828 		return 0;
829 do_sku:
830 	codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
831 		   ass & 0xffff, codec->core.vendor_id);
832 	/*
833 	 * 0 : override
834 	 * 1 :	Swap Jack
835 	 * 2 : 0 --> Desktop, 1 --> Laptop
836 	 * 3~5 : External Amplifier control
837 	 * 7~6 : Reserved
838 	*/
839 	tmp = (ass & 0x38) >> 3;	/* external Amp control */
840 	if (spec->init_amp == ALC_INIT_UNDEFINED) {
841 		switch (tmp) {
842 		case 1:
843 			alc_setup_gpio(codec, 0x01);
844 			break;
845 		case 3:
846 			alc_setup_gpio(codec, 0x02);
847 			break;
848 		case 7:
849 			alc_setup_gpio(codec, 0x04);
850 			break;
851 		case 5:
852 		default:
853 			spec->init_amp = ALC_INIT_DEFAULT;
854 			break;
855 		}
856 	}
857 
858 	/* is laptop or Desktop and enable the function "Mute internal speaker
859 	 * when the external headphone out jack is plugged"
860 	 */
861 	if (!(ass & 0x8000))
862 		return 1;
863 	/*
864 	 * 10~8 : Jack location
865 	 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
866 	 * 14~13: Resvered
867 	 * 15   : 1 --> enable the function "Mute internal speaker
868 	 *	        when the external headphone out jack is plugged"
869 	 */
870 	if (!alc_get_hp_pin(spec)) {
871 		hda_nid_t nid;
872 		tmp = (ass >> 11) & 0x3;	/* HP to chassis */
873 		nid = ports[tmp];
874 		if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
875 				      spec->gen.autocfg.line_outs))
876 			return 1;
877 		spec->gen.autocfg.hp_pins[0] = nid;
878 	}
879 	return 1;
880 }
881 
882 /* Check the validity of ALC subsystem-id
883  * ports contains an array of 4 pin NIDs for port-A, E, D and I */
alc_ssid_check(struct hda_codec * codec,const hda_nid_t * ports)884 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
885 {
886 	if (!alc_subsystem_id(codec, ports)) {
887 		struct alc_spec *spec = codec->spec;
888 		if (spec->init_amp == ALC_INIT_UNDEFINED) {
889 			codec_dbg(codec,
890 				  "realtek: Enable default setup for auto mode as fallback\n");
891 			spec->init_amp = ALC_INIT_DEFAULT;
892 		}
893 	}
894 }
895 
896 /*
897  */
898 
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)899 static void alc_fixup_inv_dmic(struct hda_codec *codec,
900 			       const struct hda_fixup *fix, int action)
901 {
902 	struct alc_spec *spec = codec->spec;
903 
904 	spec->gen.inv_dmic_split = 1;
905 }
906 
907 
alc_build_controls(struct hda_codec * codec)908 static int alc_build_controls(struct hda_codec *codec)
909 {
910 	int err;
911 
912 	err = snd_hda_gen_build_controls(codec);
913 	if (err < 0)
914 		return err;
915 
916 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
917 	return 0;
918 }
919 
920 
921 /*
922  * Common callbacks
923  */
924 
alc_pre_init(struct hda_codec * codec)925 static void alc_pre_init(struct hda_codec *codec)
926 {
927 	alc_fill_eapd_coef(codec);
928 }
929 
930 #define is_s3_resume(codec) \
931 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
932 #define is_s4_resume(codec) \
933 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
934 #define is_s4_suspend(codec) \
935 	((codec)->core.dev.power.power_state.event == PM_EVENT_FREEZE)
936 
alc_init(struct hda_codec * codec)937 static int alc_init(struct hda_codec *codec)
938 {
939 	struct alc_spec *spec = codec->spec;
940 
941 	/* hibernation resume needs the full chip initialization */
942 	if (is_s4_resume(codec))
943 		alc_pre_init(codec);
944 
945 	if (spec->init_hook)
946 		spec->init_hook(codec);
947 
948 	spec->gen.skip_verbs = 1; /* applied in below */
949 	snd_hda_gen_init(codec);
950 	alc_fix_pll(codec);
951 	alc_auto_init_amp(codec, spec->init_amp);
952 	snd_hda_apply_verbs(codec); /* apply verbs here after own init */
953 
954 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
955 
956 	return 0;
957 }
958 
959 /* forward declaration */
960 static const struct component_master_ops comp_master_ops;
961 
alc_free(struct hda_codec * codec)962 static void alc_free(struct hda_codec *codec)
963 {
964 	struct alc_spec *spec = codec->spec;
965 
966 	if (spec)
967 		hda_component_manager_free(&spec->comps, &comp_master_ops);
968 
969 	snd_hda_gen_free(codec);
970 }
971 
alc_shutup(struct hda_codec * codec)972 static inline void alc_shutup(struct hda_codec *codec)
973 {
974 	struct alc_spec *spec = codec->spec;
975 
976 	if (!snd_hda_get_bool_hint(codec, "shutup"))
977 		return; /* disabled explicitly by hints */
978 
979 	if (spec && spec->shutup)
980 		spec->shutup(codec);
981 	else
982 		alc_shutup_pins(codec);
983 }
984 
alc_power_eapd(struct hda_codec * codec)985 static void alc_power_eapd(struct hda_codec *codec)
986 {
987 	alc_auto_setup_eapd(codec, false);
988 }
989 
alc_suspend(struct hda_codec * codec)990 static int alc_suspend(struct hda_codec *codec)
991 {
992 	struct alc_spec *spec = codec->spec;
993 	alc_shutup(codec);
994 	if (spec && spec->power_hook)
995 		spec->power_hook(codec);
996 	return 0;
997 }
998 
alc_resume(struct hda_codec * codec)999 static int alc_resume(struct hda_codec *codec)
1000 {
1001 	struct alc_spec *spec = codec->spec;
1002 
1003 	if (!spec->no_depop_delay)
1004 		msleep(150); /* to avoid pop noise */
1005 	codec->patch_ops.init(codec);
1006 	snd_hda_regmap_sync(codec);
1007 	hda_call_check_power_status(codec, 0x01);
1008 	return 0;
1009 }
1010 
1011 /*
1012  */
1013 static const struct hda_codec_ops alc_patch_ops = {
1014 	.build_controls = alc_build_controls,
1015 	.build_pcms = snd_hda_gen_build_pcms,
1016 	.init = alc_init,
1017 	.free = alc_free,
1018 	.unsol_event = snd_hda_jack_unsol_event,
1019 	.resume = alc_resume,
1020 	.suspend = alc_suspend,
1021 	.check_power_status = snd_hda_gen_check_power_status,
1022 };
1023 
1024 
1025 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1026 
1027 /*
1028  * Rename codecs appropriately from COEF value or subvendor id
1029  */
1030 struct alc_codec_rename_table {
1031 	unsigned int vendor_id;
1032 	unsigned short coef_mask;
1033 	unsigned short coef_bits;
1034 	const char *name;
1035 };
1036 
1037 struct alc_codec_rename_pci_table {
1038 	unsigned int codec_vendor_id;
1039 	unsigned short pci_subvendor;
1040 	unsigned short pci_subdevice;
1041 	const char *name;
1042 };
1043 
1044 static const struct alc_codec_rename_table rename_tbl[] = {
1045 	{ 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1046 	{ 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1047 	{ 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1048 	{ 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1049 	{ 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1050 	{ 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1051 	{ 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1052 	{ 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1053 	{ 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1054 	{ 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1055 	{ 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1056 	{ 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1057 	{ 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1058 	{ 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1059 	{ 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1060 	{ 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1061 	{ 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1062 	{ } /* terminator */
1063 };
1064 
1065 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1066 	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
1067 	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
1068 	{ 0x10ec0283, 0x1028, 0, "ALC3223" },
1069 	{ 0x10ec0288, 0x1028, 0, "ALC3263" },
1070 	{ 0x10ec0292, 0x1028, 0, "ALC3226" },
1071 	{ 0x10ec0293, 0x1028, 0, "ALC3235" },
1072 	{ 0x10ec0255, 0x1028, 0, "ALC3234" },
1073 	{ 0x10ec0668, 0x1028, 0, "ALC3661" },
1074 	{ 0x10ec0275, 0x1028, 0, "ALC3260" },
1075 	{ 0x10ec0899, 0x1028, 0, "ALC3861" },
1076 	{ 0x10ec0298, 0x1028, 0, "ALC3266" },
1077 	{ 0x10ec0236, 0x1028, 0, "ALC3204" },
1078 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
1079 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
1080 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
1081 	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
1082 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
1083 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
1084 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
1085 	{ 0x10ec0233, 0x1043, 0, "ALC3236" },
1086 	{ 0x10ec0280, 0x103c, 0, "ALC3228" },
1087 	{ 0x10ec0282, 0x103c, 0, "ALC3227" },
1088 	{ 0x10ec0286, 0x103c, 0, "ALC3242" },
1089 	{ 0x10ec0290, 0x103c, 0, "ALC3241" },
1090 	{ 0x10ec0668, 0x103c, 0, "ALC3662" },
1091 	{ 0x10ec0283, 0x17aa, 0, "ALC3239" },
1092 	{ 0x10ec0292, 0x17aa, 0, "ALC3232" },
1093 	{ } /* terminator */
1094 };
1095 
alc_codec_rename_from_preset(struct hda_codec * codec)1096 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1097 {
1098 	const struct alc_codec_rename_table *p;
1099 	const struct alc_codec_rename_pci_table *q;
1100 
1101 	for (p = rename_tbl; p->vendor_id; p++) {
1102 		if (p->vendor_id != codec->core.vendor_id)
1103 			continue;
1104 		if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1105 			return alc_codec_rename(codec, p->name);
1106 	}
1107 
1108 	if (!codec->bus->pci)
1109 		return 0;
1110 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1111 		if (q->codec_vendor_id != codec->core.vendor_id)
1112 			continue;
1113 		if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1114 			continue;
1115 		if (!q->pci_subdevice ||
1116 		    q->pci_subdevice == codec->bus->pci->subsystem_device)
1117 			return alc_codec_rename(codec, q->name);
1118 	}
1119 
1120 	return 0;
1121 }
1122 
1123 
1124 /*
1125  * Digital-beep handlers
1126  */
1127 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1128 
1129 /* additional beep mixers; private_value will be overwritten */
1130 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1131 	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1132 	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1133 };
1134 
1135 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1136 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1137 			int idx, int dir)
1138 {
1139 	struct snd_kcontrol_new *knew;
1140 	unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1141 	int i;
1142 
1143 	for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1144 		knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1145 					    &alc_beep_mixer[i]);
1146 		if (!knew)
1147 			return -ENOMEM;
1148 		knew->private_value = beep_amp;
1149 	}
1150 	return 0;
1151 }
1152 
1153 static const struct snd_pci_quirk beep_allow_list[] = {
1154 	SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1155 	SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1156 	SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1157 	SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1158 	SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1159 	SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1160 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1161 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1162 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1163 	/* denylist -- no beep available */
1164 	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1165 	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1166 	{}
1167 };
1168 
has_cdefine_beep(struct hda_codec * codec)1169 static inline int has_cdefine_beep(struct hda_codec *codec)
1170 {
1171 	struct alc_spec *spec = codec->spec;
1172 	const struct snd_pci_quirk *q;
1173 	q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1174 	if (q)
1175 		return q->value;
1176 	return spec->cdefine.enable_pcbeep;
1177 }
1178 #else
1179 #define set_beep_amp(spec, nid, idx, dir)	0
1180 #define has_cdefine_beep(codec)		0
1181 #endif
1182 
1183 /* parse the BIOS configuration and set up the alc_spec */
1184 /* return 1 if successful, 0 if the proper config is not found,
1185  * or a negative error code
1186  */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1187 static int alc_parse_auto_config(struct hda_codec *codec,
1188 				 const hda_nid_t *ignore_nids,
1189 				 const hda_nid_t *ssid_nids)
1190 {
1191 	struct alc_spec *spec = codec->spec;
1192 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1193 	int err;
1194 
1195 	err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1196 				       spec->parse_flags);
1197 	if (err < 0)
1198 		return err;
1199 
1200 	if (ssid_nids)
1201 		alc_ssid_check(codec, ssid_nids);
1202 
1203 	err = snd_hda_gen_parse_auto_config(codec, cfg);
1204 	if (err < 0)
1205 		return err;
1206 
1207 	return 1;
1208 }
1209 
1210 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1211 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1212 {
1213 	struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1214 	int err;
1215 
1216 	if (!spec)
1217 		return -ENOMEM;
1218 	codec->spec = spec;
1219 	snd_hda_gen_spec_init(&spec->gen);
1220 	spec->gen.mixer_nid = mixer_nid;
1221 	spec->gen.own_eapd_ctl = 1;
1222 	codec->single_adc_amp = 1;
1223 	/* FIXME: do we need this for all Realtek codec models? */
1224 	codec->spdif_status_reset = 1;
1225 	codec->forced_resume = 1;
1226 	codec->patch_ops = alc_patch_ops;
1227 	mutex_init(&spec->coef_mutex);
1228 
1229 	err = alc_codec_rename_from_preset(codec);
1230 	if (err < 0) {
1231 		kfree(spec);
1232 		return err;
1233 	}
1234 	return 0;
1235 }
1236 
alc880_parse_auto_config(struct hda_codec * codec)1237 static int alc880_parse_auto_config(struct hda_codec *codec)
1238 {
1239 	static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1240 	static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1241 	return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1242 }
1243 
1244 /*
1245  * ALC880 fix-ups
1246  */
1247 enum {
1248 	ALC880_FIXUP_GPIO1,
1249 	ALC880_FIXUP_GPIO2,
1250 	ALC880_FIXUP_MEDION_RIM,
1251 	ALC880_FIXUP_LG,
1252 	ALC880_FIXUP_LG_LW25,
1253 	ALC880_FIXUP_W810,
1254 	ALC880_FIXUP_EAPD_COEF,
1255 	ALC880_FIXUP_TCL_S700,
1256 	ALC880_FIXUP_VOL_KNOB,
1257 	ALC880_FIXUP_FUJITSU,
1258 	ALC880_FIXUP_F1734,
1259 	ALC880_FIXUP_UNIWILL,
1260 	ALC880_FIXUP_UNIWILL_DIG,
1261 	ALC880_FIXUP_Z71V,
1262 	ALC880_FIXUP_ASUS_W5A,
1263 	ALC880_FIXUP_3ST_BASE,
1264 	ALC880_FIXUP_3ST,
1265 	ALC880_FIXUP_3ST_DIG,
1266 	ALC880_FIXUP_5ST_BASE,
1267 	ALC880_FIXUP_5ST,
1268 	ALC880_FIXUP_5ST_DIG,
1269 	ALC880_FIXUP_6ST_BASE,
1270 	ALC880_FIXUP_6ST,
1271 	ALC880_FIXUP_6ST_DIG,
1272 	ALC880_FIXUP_6ST_AUTOMUTE,
1273 };
1274 
1275 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1276 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1277 				  const struct hda_fixup *fix, int action)
1278 {
1279 	if (action == HDA_FIXUP_ACT_PROBE)
1280 		snd_hda_jack_detect_enable_callback(codec, 0x21,
1281 						    alc_update_knob_master);
1282 }
1283 
1284 static const struct hda_fixup alc880_fixups[] = {
1285 	[ALC880_FIXUP_GPIO1] = {
1286 		.type = HDA_FIXUP_FUNC,
1287 		.v.func = alc_fixup_gpio1,
1288 	},
1289 	[ALC880_FIXUP_GPIO2] = {
1290 		.type = HDA_FIXUP_FUNC,
1291 		.v.func = alc_fixup_gpio2,
1292 	},
1293 	[ALC880_FIXUP_MEDION_RIM] = {
1294 		.type = HDA_FIXUP_VERBS,
1295 		.v.verbs = (const struct hda_verb[]) {
1296 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1297 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1298 			{ }
1299 		},
1300 		.chained = true,
1301 		.chain_id = ALC880_FIXUP_GPIO2,
1302 	},
1303 	[ALC880_FIXUP_LG] = {
1304 		.type = HDA_FIXUP_PINS,
1305 		.v.pins = (const struct hda_pintbl[]) {
1306 			/* disable bogus unused pins */
1307 			{ 0x16, 0x411111f0 },
1308 			{ 0x18, 0x411111f0 },
1309 			{ 0x1a, 0x411111f0 },
1310 			{ }
1311 		}
1312 	},
1313 	[ALC880_FIXUP_LG_LW25] = {
1314 		.type = HDA_FIXUP_PINS,
1315 		.v.pins = (const struct hda_pintbl[]) {
1316 			{ 0x1a, 0x0181344f }, /* line-in */
1317 			{ 0x1b, 0x0321403f }, /* headphone */
1318 			{ }
1319 		}
1320 	},
1321 	[ALC880_FIXUP_W810] = {
1322 		.type = HDA_FIXUP_PINS,
1323 		.v.pins = (const struct hda_pintbl[]) {
1324 			/* disable bogus unused pins */
1325 			{ 0x17, 0x411111f0 },
1326 			{ }
1327 		},
1328 		.chained = true,
1329 		.chain_id = ALC880_FIXUP_GPIO2,
1330 	},
1331 	[ALC880_FIXUP_EAPD_COEF] = {
1332 		.type = HDA_FIXUP_VERBS,
1333 		.v.verbs = (const struct hda_verb[]) {
1334 			/* change to EAPD mode */
1335 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1336 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1337 			{}
1338 		},
1339 	},
1340 	[ALC880_FIXUP_TCL_S700] = {
1341 		.type = HDA_FIXUP_VERBS,
1342 		.v.verbs = (const struct hda_verb[]) {
1343 			/* change to EAPD mode */
1344 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1345 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3070 },
1346 			{}
1347 		},
1348 		.chained = true,
1349 		.chain_id = ALC880_FIXUP_GPIO2,
1350 	},
1351 	[ALC880_FIXUP_VOL_KNOB] = {
1352 		.type = HDA_FIXUP_FUNC,
1353 		.v.func = alc880_fixup_vol_knob,
1354 	},
1355 	[ALC880_FIXUP_FUJITSU] = {
1356 		/* override all pins as BIOS on old Amilo is broken */
1357 		.type = HDA_FIXUP_PINS,
1358 		.v.pins = (const struct hda_pintbl[]) {
1359 			{ 0x14, 0x0121401f }, /* HP */
1360 			{ 0x15, 0x99030120 }, /* speaker */
1361 			{ 0x16, 0x99030130 }, /* bass speaker */
1362 			{ 0x17, 0x411111f0 }, /* N/A */
1363 			{ 0x18, 0x411111f0 }, /* N/A */
1364 			{ 0x19, 0x01a19950 }, /* mic-in */
1365 			{ 0x1a, 0x411111f0 }, /* N/A */
1366 			{ 0x1b, 0x411111f0 }, /* N/A */
1367 			{ 0x1c, 0x411111f0 }, /* N/A */
1368 			{ 0x1d, 0x411111f0 }, /* N/A */
1369 			{ 0x1e, 0x01454140 }, /* SPDIF out */
1370 			{ }
1371 		},
1372 		.chained = true,
1373 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1374 	},
1375 	[ALC880_FIXUP_F1734] = {
1376 		/* almost compatible with FUJITSU, but no bass and SPDIF */
1377 		.type = HDA_FIXUP_PINS,
1378 		.v.pins = (const struct hda_pintbl[]) {
1379 			{ 0x14, 0x0121401f }, /* HP */
1380 			{ 0x15, 0x99030120 }, /* speaker */
1381 			{ 0x16, 0x411111f0 }, /* N/A */
1382 			{ 0x17, 0x411111f0 }, /* N/A */
1383 			{ 0x18, 0x411111f0 }, /* N/A */
1384 			{ 0x19, 0x01a19950 }, /* mic-in */
1385 			{ 0x1a, 0x411111f0 }, /* N/A */
1386 			{ 0x1b, 0x411111f0 }, /* N/A */
1387 			{ 0x1c, 0x411111f0 }, /* N/A */
1388 			{ 0x1d, 0x411111f0 }, /* N/A */
1389 			{ 0x1e, 0x411111f0 }, /* N/A */
1390 			{ }
1391 		},
1392 		.chained = true,
1393 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1394 	},
1395 	[ALC880_FIXUP_UNIWILL] = {
1396 		/* need to fix HP and speaker pins to be parsed correctly */
1397 		.type = HDA_FIXUP_PINS,
1398 		.v.pins = (const struct hda_pintbl[]) {
1399 			{ 0x14, 0x0121411f }, /* HP */
1400 			{ 0x15, 0x99030120 }, /* speaker */
1401 			{ 0x16, 0x99030130 }, /* bass speaker */
1402 			{ }
1403 		},
1404 	},
1405 	[ALC880_FIXUP_UNIWILL_DIG] = {
1406 		.type = HDA_FIXUP_PINS,
1407 		.v.pins = (const struct hda_pintbl[]) {
1408 			/* disable bogus unused pins */
1409 			{ 0x17, 0x411111f0 },
1410 			{ 0x19, 0x411111f0 },
1411 			{ 0x1b, 0x411111f0 },
1412 			{ 0x1f, 0x411111f0 },
1413 			{ }
1414 		}
1415 	},
1416 	[ALC880_FIXUP_Z71V] = {
1417 		.type = HDA_FIXUP_PINS,
1418 		.v.pins = (const struct hda_pintbl[]) {
1419 			/* set up the whole pins as BIOS is utterly broken */
1420 			{ 0x14, 0x99030120 }, /* speaker */
1421 			{ 0x15, 0x0121411f }, /* HP */
1422 			{ 0x16, 0x411111f0 }, /* N/A */
1423 			{ 0x17, 0x411111f0 }, /* N/A */
1424 			{ 0x18, 0x01a19950 }, /* mic-in */
1425 			{ 0x19, 0x411111f0 }, /* N/A */
1426 			{ 0x1a, 0x01813031 }, /* line-in */
1427 			{ 0x1b, 0x411111f0 }, /* N/A */
1428 			{ 0x1c, 0x411111f0 }, /* N/A */
1429 			{ 0x1d, 0x411111f0 }, /* N/A */
1430 			{ 0x1e, 0x0144111e }, /* SPDIF */
1431 			{ }
1432 		}
1433 	},
1434 	[ALC880_FIXUP_ASUS_W5A] = {
1435 		.type = HDA_FIXUP_PINS,
1436 		.v.pins = (const struct hda_pintbl[]) {
1437 			/* set up the whole pins as BIOS is utterly broken */
1438 			{ 0x14, 0x0121411f }, /* HP */
1439 			{ 0x15, 0x411111f0 }, /* N/A */
1440 			{ 0x16, 0x411111f0 }, /* N/A */
1441 			{ 0x17, 0x411111f0 }, /* N/A */
1442 			{ 0x18, 0x90a60160 }, /* mic */
1443 			{ 0x19, 0x411111f0 }, /* N/A */
1444 			{ 0x1a, 0x411111f0 }, /* N/A */
1445 			{ 0x1b, 0x411111f0 }, /* N/A */
1446 			{ 0x1c, 0x411111f0 }, /* N/A */
1447 			{ 0x1d, 0x411111f0 }, /* N/A */
1448 			{ 0x1e, 0xb743111e }, /* SPDIF out */
1449 			{ }
1450 		},
1451 		.chained = true,
1452 		.chain_id = ALC880_FIXUP_GPIO1,
1453 	},
1454 	[ALC880_FIXUP_3ST_BASE] = {
1455 		.type = HDA_FIXUP_PINS,
1456 		.v.pins = (const struct hda_pintbl[]) {
1457 			{ 0x14, 0x01014010 }, /* line-out */
1458 			{ 0x15, 0x411111f0 }, /* N/A */
1459 			{ 0x16, 0x411111f0 }, /* N/A */
1460 			{ 0x17, 0x411111f0 }, /* N/A */
1461 			{ 0x18, 0x01a19c30 }, /* mic-in */
1462 			{ 0x19, 0x0121411f }, /* HP */
1463 			{ 0x1a, 0x01813031 }, /* line-in */
1464 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1465 			{ 0x1c, 0x411111f0 }, /* N/A */
1466 			{ 0x1d, 0x411111f0 }, /* N/A */
1467 			/* 0x1e is filled in below */
1468 			{ 0x1f, 0x411111f0 }, /* N/A */
1469 			{ }
1470 		}
1471 	},
1472 	[ALC880_FIXUP_3ST] = {
1473 		.type = HDA_FIXUP_PINS,
1474 		.v.pins = (const struct hda_pintbl[]) {
1475 			{ 0x1e, 0x411111f0 }, /* N/A */
1476 			{ }
1477 		},
1478 		.chained = true,
1479 		.chain_id = ALC880_FIXUP_3ST_BASE,
1480 	},
1481 	[ALC880_FIXUP_3ST_DIG] = {
1482 		.type = HDA_FIXUP_PINS,
1483 		.v.pins = (const struct hda_pintbl[]) {
1484 			{ 0x1e, 0x0144111e }, /* SPDIF */
1485 			{ }
1486 		},
1487 		.chained = true,
1488 		.chain_id = ALC880_FIXUP_3ST_BASE,
1489 	},
1490 	[ALC880_FIXUP_5ST_BASE] = {
1491 		.type = HDA_FIXUP_PINS,
1492 		.v.pins = (const struct hda_pintbl[]) {
1493 			{ 0x14, 0x01014010 }, /* front */
1494 			{ 0x15, 0x411111f0 }, /* N/A */
1495 			{ 0x16, 0x01011411 }, /* CLFE */
1496 			{ 0x17, 0x01016412 }, /* surr */
1497 			{ 0x18, 0x01a19c30 }, /* mic-in */
1498 			{ 0x19, 0x0121411f }, /* HP */
1499 			{ 0x1a, 0x01813031 }, /* line-in */
1500 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1501 			{ 0x1c, 0x411111f0 }, /* N/A */
1502 			{ 0x1d, 0x411111f0 }, /* N/A */
1503 			/* 0x1e is filled in below */
1504 			{ 0x1f, 0x411111f0 }, /* N/A */
1505 			{ }
1506 		}
1507 	},
1508 	[ALC880_FIXUP_5ST] = {
1509 		.type = HDA_FIXUP_PINS,
1510 		.v.pins = (const struct hda_pintbl[]) {
1511 			{ 0x1e, 0x411111f0 }, /* N/A */
1512 			{ }
1513 		},
1514 		.chained = true,
1515 		.chain_id = ALC880_FIXUP_5ST_BASE,
1516 	},
1517 	[ALC880_FIXUP_5ST_DIG] = {
1518 		.type = HDA_FIXUP_PINS,
1519 		.v.pins = (const struct hda_pintbl[]) {
1520 			{ 0x1e, 0x0144111e }, /* SPDIF */
1521 			{ }
1522 		},
1523 		.chained = true,
1524 		.chain_id = ALC880_FIXUP_5ST_BASE,
1525 	},
1526 	[ALC880_FIXUP_6ST_BASE] = {
1527 		.type = HDA_FIXUP_PINS,
1528 		.v.pins = (const struct hda_pintbl[]) {
1529 			{ 0x14, 0x01014010 }, /* front */
1530 			{ 0x15, 0x01016412 }, /* surr */
1531 			{ 0x16, 0x01011411 }, /* CLFE */
1532 			{ 0x17, 0x01012414 }, /* side */
1533 			{ 0x18, 0x01a19c30 }, /* mic-in */
1534 			{ 0x19, 0x02a19c40 }, /* front-mic */
1535 			{ 0x1a, 0x01813031 }, /* line-in */
1536 			{ 0x1b, 0x0121411f }, /* HP */
1537 			{ 0x1c, 0x411111f0 }, /* N/A */
1538 			{ 0x1d, 0x411111f0 }, /* N/A */
1539 			/* 0x1e is filled in below */
1540 			{ 0x1f, 0x411111f0 }, /* N/A */
1541 			{ }
1542 		}
1543 	},
1544 	[ALC880_FIXUP_6ST] = {
1545 		.type = HDA_FIXUP_PINS,
1546 		.v.pins = (const struct hda_pintbl[]) {
1547 			{ 0x1e, 0x411111f0 }, /* N/A */
1548 			{ }
1549 		},
1550 		.chained = true,
1551 		.chain_id = ALC880_FIXUP_6ST_BASE,
1552 	},
1553 	[ALC880_FIXUP_6ST_DIG] = {
1554 		.type = HDA_FIXUP_PINS,
1555 		.v.pins = (const struct hda_pintbl[]) {
1556 			{ 0x1e, 0x0144111e }, /* SPDIF */
1557 			{ }
1558 		},
1559 		.chained = true,
1560 		.chain_id = ALC880_FIXUP_6ST_BASE,
1561 	},
1562 	[ALC880_FIXUP_6ST_AUTOMUTE] = {
1563 		.type = HDA_FIXUP_PINS,
1564 		.v.pins = (const struct hda_pintbl[]) {
1565 			{ 0x1b, 0x0121401f }, /* HP with jack detect */
1566 			{ }
1567 		},
1568 		.chained_before = true,
1569 		.chain_id = ALC880_FIXUP_6ST_BASE,
1570 	},
1571 };
1572 
1573 static const struct hda_quirk alc880_fixup_tbl[] = {
1574 	SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1575 	SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1576 	SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1577 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1578 	SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1579 	SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1580 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1581 	SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1582 	SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1583 	SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1584 	SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1585 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1586 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1587 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1588 	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1589 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1590 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1591 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1592 	SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1593 	SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1594 	SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1595 	SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1596 	SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1597 
1598 	/* Below is the copied entries from alc880_quirks.c.
1599 	 * It's not quite sure whether BIOS sets the correct pin-config table
1600 	 * on these machines, thus they are kept to be compatible with
1601 	 * the old static quirks.  Once when it's confirmed to work without
1602 	 * these overrides, it'd be better to remove.
1603 	 */
1604 	SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1605 	SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1606 	SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1607 	SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1608 	SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1609 	SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1610 	SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1611 	SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1612 	SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1613 	SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1614 	SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1615 	SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1616 	SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1617 	SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1618 	SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1619 	SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1620 	SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1621 	SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1622 	SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1623 	SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1624 	SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1625 	SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1626 	SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1627 	SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1628 	SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1629 	SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1630 	SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1631 	SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1632 	SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1633 	SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1634 	SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1635 	SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1636 	SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1637 	/* default Intel */
1638 	SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1639 	SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1640 	SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1641 	{}
1642 };
1643 
1644 static const struct hda_model_fixup alc880_fixup_models[] = {
1645 	{.id = ALC880_FIXUP_3ST, .name = "3stack"},
1646 	{.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1647 	{.id = ALC880_FIXUP_5ST, .name = "5stack"},
1648 	{.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1649 	{.id = ALC880_FIXUP_6ST, .name = "6stack"},
1650 	{.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1651 	{.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1652 	{}
1653 };
1654 
1655 
1656 /*
1657  * OK, here we have finally the patch for ALC880
1658  */
patch_alc880(struct hda_codec * codec)1659 static int patch_alc880(struct hda_codec *codec)
1660 {
1661 	struct alc_spec *spec;
1662 	int err;
1663 
1664 	err = alc_alloc_spec(codec, 0x0b);
1665 	if (err < 0)
1666 		return err;
1667 
1668 	spec = codec->spec;
1669 	spec->gen.need_dac_fix = 1;
1670 	spec->gen.beep_nid = 0x01;
1671 
1672 	codec->patch_ops.unsol_event = alc880_unsol_event;
1673 
1674 	alc_pre_init(codec);
1675 
1676 	snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1677 		       alc880_fixups);
1678 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1679 
1680 	/* automatic parse from the BIOS config */
1681 	err = alc880_parse_auto_config(codec);
1682 	if (err < 0)
1683 		goto error;
1684 
1685 	if (!spec->gen.no_analog) {
1686 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1687 		if (err < 0)
1688 			goto error;
1689 	}
1690 
1691 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1692 
1693 	return 0;
1694 
1695  error:
1696 	alc_free(codec);
1697 	return err;
1698 }
1699 
1700 
1701 /*
1702  * ALC260 support
1703  */
alc260_parse_auto_config(struct hda_codec * codec)1704 static int alc260_parse_auto_config(struct hda_codec *codec)
1705 {
1706 	static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1707 	static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1708 	return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1709 }
1710 
1711 /*
1712  * Pin config fixes
1713  */
1714 enum {
1715 	ALC260_FIXUP_HP_DC5750,
1716 	ALC260_FIXUP_HP_PIN_0F,
1717 	ALC260_FIXUP_COEF,
1718 	ALC260_FIXUP_GPIO1,
1719 	ALC260_FIXUP_GPIO1_TOGGLE,
1720 	ALC260_FIXUP_REPLACER,
1721 	ALC260_FIXUP_HP_B1900,
1722 	ALC260_FIXUP_KN1,
1723 	ALC260_FIXUP_FSC_S7020,
1724 	ALC260_FIXUP_FSC_S7020_JWSE,
1725 	ALC260_FIXUP_VAIO_PINS,
1726 };
1727 
alc260_gpio1_automute(struct hda_codec * codec)1728 static void alc260_gpio1_automute(struct hda_codec *codec)
1729 {
1730 	struct alc_spec *spec = codec->spec;
1731 
1732 	alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1733 }
1734 
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1735 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1736 				      const struct hda_fixup *fix, int action)
1737 {
1738 	struct alc_spec *spec = codec->spec;
1739 	if (action == HDA_FIXUP_ACT_PROBE) {
1740 		/* although the machine has only one output pin, we need to
1741 		 * toggle GPIO1 according to the jack state
1742 		 */
1743 		spec->gen.automute_hook = alc260_gpio1_automute;
1744 		spec->gen.detect_hp = 1;
1745 		spec->gen.automute_speaker = 1;
1746 		spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1747 		snd_hda_jack_detect_enable_callback(codec, 0x0f,
1748 						    snd_hda_gen_hp_automute);
1749 		alc_setup_gpio(codec, 0x01);
1750 	}
1751 }
1752 
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1753 static void alc260_fixup_kn1(struct hda_codec *codec,
1754 			     const struct hda_fixup *fix, int action)
1755 {
1756 	struct alc_spec *spec = codec->spec;
1757 	static const struct hda_pintbl pincfgs[] = {
1758 		{ 0x0f, 0x02214000 }, /* HP/speaker */
1759 		{ 0x12, 0x90a60160 }, /* int mic */
1760 		{ 0x13, 0x02a19000 }, /* ext mic */
1761 		{ 0x18, 0x01446000 }, /* SPDIF out */
1762 		/* disable bogus I/O pins */
1763 		{ 0x10, 0x411111f0 },
1764 		{ 0x11, 0x411111f0 },
1765 		{ 0x14, 0x411111f0 },
1766 		{ 0x15, 0x411111f0 },
1767 		{ 0x16, 0x411111f0 },
1768 		{ 0x17, 0x411111f0 },
1769 		{ 0x19, 0x411111f0 },
1770 		{ }
1771 	};
1772 
1773 	switch (action) {
1774 	case HDA_FIXUP_ACT_PRE_PROBE:
1775 		snd_hda_apply_pincfgs(codec, pincfgs);
1776 		spec->init_amp = ALC_INIT_NONE;
1777 		break;
1778 	}
1779 }
1780 
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1781 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1782 				   const struct hda_fixup *fix, int action)
1783 {
1784 	struct alc_spec *spec = codec->spec;
1785 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
1786 		spec->init_amp = ALC_INIT_NONE;
1787 }
1788 
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1789 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1790 				   const struct hda_fixup *fix, int action)
1791 {
1792 	struct alc_spec *spec = codec->spec;
1793 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1794 		spec->gen.add_jack_modes = 1;
1795 		spec->gen.hp_mic = 1;
1796 	}
1797 }
1798 
1799 static const struct hda_fixup alc260_fixups[] = {
1800 	[ALC260_FIXUP_HP_DC5750] = {
1801 		.type = HDA_FIXUP_PINS,
1802 		.v.pins = (const struct hda_pintbl[]) {
1803 			{ 0x11, 0x90130110 }, /* speaker */
1804 			{ }
1805 		}
1806 	},
1807 	[ALC260_FIXUP_HP_PIN_0F] = {
1808 		.type = HDA_FIXUP_PINS,
1809 		.v.pins = (const struct hda_pintbl[]) {
1810 			{ 0x0f, 0x01214000 }, /* HP */
1811 			{ }
1812 		}
1813 	},
1814 	[ALC260_FIXUP_COEF] = {
1815 		.type = HDA_FIXUP_VERBS,
1816 		.v.verbs = (const struct hda_verb[]) {
1817 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1818 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3040 },
1819 			{ }
1820 		},
1821 	},
1822 	[ALC260_FIXUP_GPIO1] = {
1823 		.type = HDA_FIXUP_FUNC,
1824 		.v.func = alc_fixup_gpio1,
1825 	},
1826 	[ALC260_FIXUP_GPIO1_TOGGLE] = {
1827 		.type = HDA_FIXUP_FUNC,
1828 		.v.func = alc260_fixup_gpio1_toggle,
1829 		.chained = true,
1830 		.chain_id = ALC260_FIXUP_HP_PIN_0F,
1831 	},
1832 	[ALC260_FIXUP_REPLACER] = {
1833 		.type = HDA_FIXUP_VERBS,
1834 		.v.verbs = (const struct hda_verb[]) {
1835 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1836 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3050 },
1837 			{ }
1838 		},
1839 		.chained = true,
1840 		.chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1841 	},
1842 	[ALC260_FIXUP_HP_B1900] = {
1843 		.type = HDA_FIXUP_FUNC,
1844 		.v.func = alc260_fixup_gpio1_toggle,
1845 		.chained = true,
1846 		.chain_id = ALC260_FIXUP_COEF,
1847 	},
1848 	[ALC260_FIXUP_KN1] = {
1849 		.type = HDA_FIXUP_FUNC,
1850 		.v.func = alc260_fixup_kn1,
1851 	},
1852 	[ALC260_FIXUP_FSC_S7020] = {
1853 		.type = HDA_FIXUP_FUNC,
1854 		.v.func = alc260_fixup_fsc_s7020,
1855 	},
1856 	[ALC260_FIXUP_FSC_S7020_JWSE] = {
1857 		.type = HDA_FIXUP_FUNC,
1858 		.v.func = alc260_fixup_fsc_s7020_jwse,
1859 		.chained = true,
1860 		.chain_id = ALC260_FIXUP_FSC_S7020,
1861 	},
1862 	[ALC260_FIXUP_VAIO_PINS] = {
1863 		.type = HDA_FIXUP_PINS,
1864 		.v.pins = (const struct hda_pintbl[]) {
1865 			/* Pin configs are missing completely on some VAIOs */
1866 			{ 0x0f, 0x01211020 },
1867 			{ 0x10, 0x0001003f },
1868 			{ 0x11, 0x411111f0 },
1869 			{ 0x12, 0x01a15930 },
1870 			{ 0x13, 0x411111f0 },
1871 			{ 0x14, 0x411111f0 },
1872 			{ 0x15, 0x411111f0 },
1873 			{ 0x16, 0x411111f0 },
1874 			{ 0x17, 0x411111f0 },
1875 			{ 0x18, 0x411111f0 },
1876 			{ 0x19, 0x411111f0 },
1877 			{ }
1878 		}
1879 	},
1880 };
1881 
1882 static const struct hda_quirk alc260_fixup_tbl[] = {
1883 	SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1884 	SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1885 	SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1886 	SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1887 	SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1888 	SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1889 	SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1890 	SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1891 	SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1892 	SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1893 	SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1894 	SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1895 	{}
1896 };
1897 
1898 static const struct hda_model_fixup alc260_fixup_models[] = {
1899 	{.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1900 	{.id = ALC260_FIXUP_COEF, .name = "coef"},
1901 	{.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1902 	{.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1903 	{}
1904 };
1905 
1906 /*
1907  */
patch_alc260(struct hda_codec * codec)1908 static int patch_alc260(struct hda_codec *codec)
1909 {
1910 	struct alc_spec *spec;
1911 	int err;
1912 
1913 	err = alc_alloc_spec(codec, 0x07);
1914 	if (err < 0)
1915 		return err;
1916 
1917 	spec = codec->spec;
1918 	/* as quite a few machines require HP amp for speaker outputs,
1919 	 * it's easier to enable it unconditionally; even if it's unneeded,
1920 	 * it's almost harmless.
1921 	 */
1922 	spec->gen.prefer_hp_amp = 1;
1923 	spec->gen.beep_nid = 0x01;
1924 
1925 	spec->shutup = alc_eapd_shutup;
1926 
1927 	alc_pre_init(codec);
1928 
1929 	snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1930 			   alc260_fixups);
1931 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1932 
1933 	/* automatic parse from the BIOS config */
1934 	err = alc260_parse_auto_config(codec);
1935 	if (err < 0)
1936 		goto error;
1937 
1938 	if (!spec->gen.no_analog) {
1939 		err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1940 		if (err < 0)
1941 			goto error;
1942 	}
1943 
1944 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1945 
1946 	return 0;
1947 
1948  error:
1949 	alc_free(codec);
1950 	return err;
1951 }
1952 
1953 
1954 /*
1955  * ALC882/883/885/888/889 support
1956  *
1957  * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1958  * configuration.  Each pin widget can choose any input DACs and a mixer.
1959  * Each ADC is connected from a mixer of all inputs.  This makes possible
1960  * 6-channel independent captures.
1961  *
1962  * In addition, an independent DAC for the multi-playback (not used in this
1963  * driver yet).
1964  */
1965 
1966 /*
1967  * Pin config fixes
1968  */
1969 enum {
1970 	ALC882_FIXUP_ABIT_AW9D_MAX,
1971 	ALC882_FIXUP_LENOVO_Y530,
1972 	ALC882_FIXUP_PB_M5210,
1973 	ALC882_FIXUP_ACER_ASPIRE_7736,
1974 	ALC882_FIXUP_ASUS_W90V,
1975 	ALC889_FIXUP_CD,
1976 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1977 	ALC889_FIXUP_VAIO_TT,
1978 	ALC888_FIXUP_EEE1601,
1979 	ALC886_FIXUP_EAPD,
1980 	ALC882_FIXUP_EAPD,
1981 	ALC883_FIXUP_EAPD,
1982 	ALC883_FIXUP_ACER_EAPD,
1983 	ALC882_FIXUP_GPIO1,
1984 	ALC882_FIXUP_GPIO2,
1985 	ALC882_FIXUP_GPIO3,
1986 	ALC889_FIXUP_COEF,
1987 	ALC882_FIXUP_ASUS_W2JC,
1988 	ALC882_FIXUP_ACER_ASPIRE_4930G,
1989 	ALC882_FIXUP_ACER_ASPIRE_8930G,
1990 	ALC882_FIXUP_ASPIRE_8930G_VERBS,
1991 	ALC885_FIXUP_MACPRO_GPIO,
1992 	ALC889_FIXUP_DAC_ROUTE,
1993 	ALC889_FIXUP_MBP_VREF,
1994 	ALC889_FIXUP_IMAC91_VREF,
1995 	ALC889_FIXUP_MBA11_VREF,
1996 	ALC889_FIXUP_MBA21_VREF,
1997 	ALC889_FIXUP_MP11_VREF,
1998 	ALC889_FIXUP_MP41_VREF,
1999 	ALC882_FIXUP_INV_DMIC,
2000 	ALC882_FIXUP_NO_PRIMARY_HP,
2001 	ALC887_FIXUP_ASUS_BASS,
2002 	ALC887_FIXUP_BASS_CHMAP,
2003 	ALC1220_FIXUP_GB_DUAL_CODECS,
2004 	ALC1220_FIXUP_GB_X570,
2005 	ALC1220_FIXUP_CLEVO_P950,
2006 	ALC1220_FIXUP_CLEVO_PB51ED,
2007 	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
2008 	ALC887_FIXUP_ASUS_AUDIO,
2009 	ALC887_FIXUP_ASUS_HMIC,
2010 	ALCS1200A_FIXUP_MIC_VREF,
2011 	ALC888VD_FIXUP_MIC_100VREF,
2012 };
2013 
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)2014 static void alc889_fixup_coef(struct hda_codec *codec,
2015 			      const struct hda_fixup *fix, int action)
2016 {
2017 	if (action != HDA_FIXUP_ACT_INIT)
2018 		return;
2019 	alc_update_coef_idx(codec, 7, 0, 0x2030);
2020 }
2021 
2022 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2023 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2024 				     const struct hda_fixup *fix, int action)
2025 {
2026 	struct alc_spec *spec = codec->spec;
2027 
2028 	spec->gpio_write_delay = true;
2029 	alc_fixup_gpio3(codec, fix, action);
2030 }
2031 
2032 /* Fix the connection of some pins for ALC889:
2033  * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2034  * work correctly (bko#42740)
2035  */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2036 static void alc889_fixup_dac_route(struct hda_codec *codec,
2037 				   const struct hda_fixup *fix, int action)
2038 {
2039 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2040 		/* fake the connections during parsing the tree */
2041 		static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2042 		static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2043 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2044 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2045 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2046 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2047 	} else if (action == HDA_FIXUP_ACT_PROBE) {
2048 		/* restore the connections */
2049 		static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2050 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2051 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2052 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2053 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2054 	}
2055 }
2056 
2057 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2058 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2059 				  const struct hda_fixup *fix, int action)
2060 {
2061 	static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2062 	struct alc_spec *spec = codec->spec;
2063 	int i;
2064 
2065 	if (action != HDA_FIXUP_ACT_INIT)
2066 		return;
2067 	for (i = 0; i < ARRAY_SIZE(nids); i++) {
2068 		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2069 		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2070 			continue;
2071 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2072 		val |= AC_PINCTL_VREF_80;
2073 		snd_hda_set_pin_ctl(codec, nids[i], val);
2074 		spec->gen.keep_vref_in_automute = 1;
2075 		break;
2076 	}
2077 }
2078 
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2079 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2080 				  const hda_nid_t *nids, int num_nids)
2081 {
2082 	struct alc_spec *spec = codec->spec;
2083 	int i;
2084 
2085 	for (i = 0; i < num_nids; i++) {
2086 		unsigned int val;
2087 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2088 		val |= AC_PINCTL_VREF_50;
2089 		snd_hda_set_pin_ctl(codec, nids[i], val);
2090 	}
2091 	spec->gen.keep_vref_in_automute = 1;
2092 }
2093 
2094 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2095 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2096 				     const struct hda_fixup *fix, int action)
2097 {
2098 	static const hda_nid_t nids[] = { 0x18, 0x1a };
2099 
2100 	if (action == HDA_FIXUP_ACT_INIT)
2101 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2102 }
2103 
2104 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2105 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2106 				    const struct hda_fixup *fix, int action)
2107 {
2108 	static const hda_nid_t nids[] = { 0x18 };
2109 
2110 	if (action == HDA_FIXUP_ACT_INIT)
2111 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2112 }
2113 
2114 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2115 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2116 				    const struct hda_fixup *fix, int action)
2117 {
2118 	static const hda_nid_t nids[] = { 0x18, 0x19 };
2119 
2120 	if (action == HDA_FIXUP_ACT_INIT)
2121 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2122 }
2123 
2124 /* Don't take HP output as primary
2125  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2126  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2127  */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2128 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2129 				       const struct hda_fixup *fix, int action)
2130 {
2131 	struct alc_spec *spec = codec->spec;
2132 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2133 		spec->gen.no_primary_hp = 1;
2134 		spec->gen.no_multi_io = 1;
2135 	}
2136 }
2137 
2138 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2139 				 const struct hda_fixup *fix, int action);
2140 
2141 /* For dual-codec configuration, we need to disable some features to avoid
2142  * conflicts of kctls and PCM streams
2143  */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2144 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2145 				  const struct hda_fixup *fix, int action)
2146 {
2147 	struct alc_spec *spec = codec->spec;
2148 
2149 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2150 		return;
2151 	/* disable vmaster */
2152 	spec->gen.suppress_vmaster = 1;
2153 	/* auto-mute and auto-mic switch don't work with multiple codecs */
2154 	spec->gen.suppress_auto_mute = 1;
2155 	spec->gen.suppress_auto_mic = 1;
2156 	/* disable aamix as well */
2157 	spec->gen.mixer_nid = 0;
2158 	/* add location prefix to avoid conflicts */
2159 	codec->force_pin_prefix = 1;
2160 }
2161 
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2162 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2163 		       const char *newname)
2164 {
2165 	struct snd_kcontrol *kctl;
2166 
2167 	kctl = snd_hda_find_mixer_ctl(codec, oldname);
2168 	if (kctl)
2169 		snd_ctl_rename(codec->card, kctl, newname);
2170 }
2171 
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2172 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2173 					 const struct hda_fixup *fix,
2174 					 int action)
2175 {
2176 	alc_fixup_dual_codecs(codec, fix, action);
2177 	switch (action) {
2178 	case HDA_FIXUP_ACT_PRE_PROBE:
2179 		/* override card longname to provide a unique UCM profile */
2180 		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2181 		break;
2182 	case HDA_FIXUP_ACT_BUILD:
2183 		/* rename Capture controls depending on the codec */
2184 		rename_ctl(codec, "Capture Volume",
2185 			   codec->addr == 0 ?
2186 			   "Rear-Panel Capture Volume" :
2187 			   "Front-Panel Capture Volume");
2188 		rename_ctl(codec, "Capture Switch",
2189 			   codec->addr == 0 ?
2190 			   "Rear-Panel Capture Switch" :
2191 			   "Front-Panel Capture Switch");
2192 		break;
2193 	}
2194 }
2195 
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2196 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2197 				     const struct hda_fixup *fix,
2198 				     int action)
2199 {
2200 	static const hda_nid_t conn1[] = { 0x0c };
2201 	static const struct coef_fw gb_x570_coefs[] = {
2202 		WRITE_COEF(0x07, 0x03c0),
2203 		WRITE_COEF(0x1a, 0x01c1),
2204 		WRITE_COEF(0x1b, 0x0202),
2205 		WRITE_COEF(0x43, 0x3005),
2206 		{}
2207 	};
2208 
2209 	switch (action) {
2210 	case HDA_FIXUP_ACT_PRE_PROBE:
2211 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2212 		snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2213 		break;
2214 	case HDA_FIXUP_ACT_INIT:
2215 		alc_process_coef_fw(codec, gb_x570_coefs);
2216 		break;
2217 	}
2218 }
2219 
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2220 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2221 				     const struct hda_fixup *fix,
2222 				     int action)
2223 {
2224 	static const hda_nid_t conn1[] = { 0x0c };
2225 
2226 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2227 		return;
2228 
2229 	alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2230 	/* We therefore want to make sure 0x14 (front headphone) and
2231 	 * 0x1b (speakers) use the stereo DAC 0x02
2232 	 */
2233 	snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2234 	snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2235 }
2236 
2237 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2238 				const struct hda_fixup *fix, int action);
2239 
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2240 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2241 				     const struct hda_fixup *fix,
2242 				     int action)
2243 {
2244 	alc1220_fixup_clevo_p950(codec, fix, action);
2245 	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2246 }
2247 
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2248 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2249 					 struct hda_jack_callback *jack)
2250 {
2251 	struct alc_spec *spec = codec->spec;
2252 	unsigned int vref;
2253 
2254 	snd_hda_gen_hp_automute(codec, jack);
2255 
2256 	if (spec->gen.hp_jack_present)
2257 		vref = AC_PINCTL_VREF_80;
2258 	else
2259 		vref = AC_PINCTL_VREF_HIZ;
2260 	snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2261 }
2262 
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2263 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2264 				     const struct hda_fixup *fix, int action)
2265 {
2266 	struct alc_spec *spec = codec->spec;
2267 	if (action != HDA_FIXUP_ACT_PROBE)
2268 		return;
2269 	snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2270 	spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2271 }
2272 
2273 static const struct hda_fixup alc882_fixups[] = {
2274 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
2275 		.type = HDA_FIXUP_PINS,
2276 		.v.pins = (const struct hda_pintbl[]) {
2277 			{ 0x15, 0x01080104 }, /* side */
2278 			{ 0x16, 0x01011012 }, /* rear */
2279 			{ 0x17, 0x01016011 }, /* clfe */
2280 			{ }
2281 		}
2282 	},
2283 	[ALC882_FIXUP_LENOVO_Y530] = {
2284 		.type = HDA_FIXUP_PINS,
2285 		.v.pins = (const struct hda_pintbl[]) {
2286 			{ 0x15, 0x99130112 }, /* rear int speakers */
2287 			{ 0x16, 0x99130111 }, /* subwoofer */
2288 			{ }
2289 		}
2290 	},
2291 	[ALC882_FIXUP_PB_M5210] = {
2292 		.type = HDA_FIXUP_PINCTLS,
2293 		.v.pins = (const struct hda_pintbl[]) {
2294 			{ 0x19, PIN_VREF50 },
2295 			{}
2296 		}
2297 	},
2298 	[ALC882_FIXUP_ACER_ASPIRE_7736] = {
2299 		.type = HDA_FIXUP_FUNC,
2300 		.v.func = alc_fixup_sku_ignore,
2301 	},
2302 	[ALC882_FIXUP_ASUS_W90V] = {
2303 		.type = HDA_FIXUP_PINS,
2304 		.v.pins = (const struct hda_pintbl[]) {
2305 			{ 0x16, 0x99130110 }, /* fix sequence for CLFE */
2306 			{ }
2307 		}
2308 	},
2309 	[ALC889_FIXUP_CD] = {
2310 		.type = HDA_FIXUP_PINS,
2311 		.v.pins = (const struct hda_pintbl[]) {
2312 			{ 0x1c, 0x993301f0 }, /* CD */
2313 			{ }
2314 		}
2315 	},
2316 	[ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2317 		.type = HDA_FIXUP_PINS,
2318 		.v.pins = (const struct hda_pintbl[]) {
2319 			{ 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2320 			{ }
2321 		},
2322 		.chained = true,
2323 		.chain_id = ALC889_FIXUP_CD,
2324 	},
2325 	[ALC889_FIXUP_VAIO_TT] = {
2326 		.type = HDA_FIXUP_PINS,
2327 		.v.pins = (const struct hda_pintbl[]) {
2328 			{ 0x17, 0x90170111 }, /* hidden surround speaker */
2329 			{ }
2330 		}
2331 	},
2332 	[ALC888_FIXUP_EEE1601] = {
2333 		.type = HDA_FIXUP_VERBS,
2334 		.v.verbs = (const struct hda_verb[]) {
2335 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2336 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x0838 },
2337 			{ }
2338 		}
2339 	},
2340 	[ALC886_FIXUP_EAPD] = {
2341 		.type = HDA_FIXUP_VERBS,
2342 		.v.verbs = (const struct hda_verb[]) {
2343 			/* change to EAPD mode */
2344 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2345 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2346 			{ }
2347 		}
2348 	},
2349 	[ALC882_FIXUP_EAPD] = {
2350 		.type = HDA_FIXUP_VERBS,
2351 		.v.verbs = (const struct hda_verb[]) {
2352 			/* change to EAPD mode */
2353 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2354 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2355 			{ }
2356 		}
2357 	},
2358 	[ALC883_FIXUP_EAPD] = {
2359 		.type = HDA_FIXUP_VERBS,
2360 		.v.verbs = (const struct hda_verb[]) {
2361 			/* change to EAPD mode */
2362 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2363 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2364 			{ }
2365 		}
2366 	},
2367 	[ALC883_FIXUP_ACER_EAPD] = {
2368 		.type = HDA_FIXUP_VERBS,
2369 		.v.verbs = (const struct hda_verb[]) {
2370 			/* eanable EAPD on Acer laptops */
2371 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2372 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2373 			{ }
2374 		}
2375 	},
2376 	[ALC882_FIXUP_GPIO1] = {
2377 		.type = HDA_FIXUP_FUNC,
2378 		.v.func = alc_fixup_gpio1,
2379 	},
2380 	[ALC882_FIXUP_GPIO2] = {
2381 		.type = HDA_FIXUP_FUNC,
2382 		.v.func = alc_fixup_gpio2,
2383 	},
2384 	[ALC882_FIXUP_GPIO3] = {
2385 		.type = HDA_FIXUP_FUNC,
2386 		.v.func = alc_fixup_gpio3,
2387 	},
2388 	[ALC882_FIXUP_ASUS_W2JC] = {
2389 		.type = HDA_FIXUP_FUNC,
2390 		.v.func = alc_fixup_gpio1,
2391 		.chained = true,
2392 		.chain_id = ALC882_FIXUP_EAPD,
2393 	},
2394 	[ALC889_FIXUP_COEF] = {
2395 		.type = HDA_FIXUP_FUNC,
2396 		.v.func = alc889_fixup_coef,
2397 	},
2398 	[ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2399 		.type = HDA_FIXUP_PINS,
2400 		.v.pins = (const struct hda_pintbl[]) {
2401 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2402 			{ 0x17, 0x99130112 }, /* surround speaker */
2403 			{ }
2404 		},
2405 		.chained = true,
2406 		.chain_id = ALC882_FIXUP_GPIO1,
2407 	},
2408 	[ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2409 		.type = HDA_FIXUP_PINS,
2410 		.v.pins = (const struct hda_pintbl[]) {
2411 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2412 			{ 0x1b, 0x99130112 }, /* surround speaker */
2413 			{ }
2414 		},
2415 		.chained = true,
2416 		.chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2417 	},
2418 	[ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2419 		/* additional init verbs for Acer Aspire 8930G */
2420 		.type = HDA_FIXUP_VERBS,
2421 		.v.verbs = (const struct hda_verb[]) {
2422 			/* Enable all DACs */
2423 			/* DAC DISABLE/MUTE 1? */
2424 			/*  setting bits 1-5 disables DAC nids 0x02-0x06
2425 			 *  apparently. Init=0x38 */
2426 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2427 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2428 			/* DAC DISABLE/MUTE 2? */
2429 			/*  some bit here disables the other DACs.
2430 			 *  Init=0x4900 */
2431 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2432 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2433 			/* DMIC fix
2434 			 * This laptop has a stereo digital microphone.
2435 			 * The mics are only 1cm apart which makes the stereo
2436 			 * useless. However, either the mic or the ALC889
2437 			 * makes the signal become a difference/sum signal
2438 			 * instead of standard stereo, which is annoying.
2439 			 * So instead we flip this bit which makes the
2440 			 * codec replicate the sum signal to both channels,
2441 			 * turning it into a normal mono mic.
2442 			 */
2443 			/* DMIC_CONTROL? Init value = 0x0001 */
2444 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2445 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2446 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2447 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2448 			{ }
2449 		},
2450 		.chained = true,
2451 		.chain_id = ALC882_FIXUP_GPIO1,
2452 	},
2453 	[ALC885_FIXUP_MACPRO_GPIO] = {
2454 		.type = HDA_FIXUP_FUNC,
2455 		.v.func = alc885_fixup_macpro_gpio,
2456 	},
2457 	[ALC889_FIXUP_DAC_ROUTE] = {
2458 		.type = HDA_FIXUP_FUNC,
2459 		.v.func = alc889_fixup_dac_route,
2460 	},
2461 	[ALC889_FIXUP_MBP_VREF] = {
2462 		.type = HDA_FIXUP_FUNC,
2463 		.v.func = alc889_fixup_mbp_vref,
2464 		.chained = true,
2465 		.chain_id = ALC882_FIXUP_GPIO1,
2466 	},
2467 	[ALC889_FIXUP_IMAC91_VREF] = {
2468 		.type = HDA_FIXUP_FUNC,
2469 		.v.func = alc889_fixup_imac91_vref,
2470 		.chained = true,
2471 		.chain_id = ALC882_FIXUP_GPIO1,
2472 	},
2473 	[ALC889_FIXUP_MBA11_VREF] = {
2474 		.type = HDA_FIXUP_FUNC,
2475 		.v.func = alc889_fixup_mba11_vref,
2476 		.chained = true,
2477 		.chain_id = ALC889_FIXUP_MBP_VREF,
2478 	},
2479 	[ALC889_FIXUP_MBA21_VREF] = {
2480 		.type = HDA_FIXUP_FUNC,
2481 		.v.func = alc889_fixup_mba21_vref,
2482 		.chained = true,
2483 		.chain_id = ALC889_FIXUP_MBP_VREF,
2484 	},
2485 	[ALC889_FIXUP_MP11_VREF] = {
2486 		.type = HDA_FIXUP_FUNC,
2487 		.v.func = alc889_fixup_mba11_vref,
2488 		.chained = true,
2489 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2490 	},
2491 	[ALC889_FIXUP_MP41_VREF] = {
2492 		.type = HDA_FIXUP_FUNC,
2493 		.v.func = alc889_fixup_mbp_vref,
2494 		.chained = true,
2495 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2496 	},
2497 	[ALC882_FIXUP_INV_DMIC] = {
2498 		.type = HDA_FIXUP_FUNC,
2499 		.v.func = alc_fixup_inv_dmic,
2500 	},
2501 	[ALC882_FIXUP_NO_PRIMARY_HP] = {
2502 		.type = HDA_FIXUP_FUNC,
2503 		.v.func = alc882_fixup_no_primary_hp,
2504 	},
2505 	[ALC887_FIXUP_ASUS_BASS] = {
2506 		.type = HDA_FIXUP_PINS,
2507 		.v.pins = (const struct hda_pintbl[]) {
2508 			{0x16, 0x99130130}, /* bass speaker */
2509 			{}
2510 		},
2511 		.chained = true,
2512 		.chain_id = ALC887_FIXUP_BASS_CHMAP,
2513 	},
2514 	[ALC887_FIXUP_BASS_CHMAP] = {
2515 		.type = HDA_FIXUP_FUNC,
2516 		.v.func = alc_fixup_bass_chmap,
2517 	},
2518 	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
2519 		.type = HDA_FIXUP_FUNC,
2520 		.v.func = alc1220_fixup_gb_dual_codecs,
2521 	},
2522 	[ALC1220_FIXUP_GB_X570] = {
2523 		.type = HDA_FIXUP_FUNC,
2524 		.v.func = alc1220_fixup_gb_x570,
2525 	},
2526 	[ALC1220_FIXUP_CLEVO_P950] = {
2527 		.type = HDA_FIXUP_FUNC,
2528 		.v.func = alc1220_fixup_clevo_p950,
2529 	},
2530 	[ALC1220_FIXUP_CLEVO_PB51ED] = {
2531 		.type = HDA_FIXUP_FUNC,
2532 		.v.func = alc1220_fixup_clevo_pb51ed,
2533 	},
2534 	[ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2535 		.type = HDA_FIXUP_PINS,
2536 		.v.pins = (const struct hda_pintbl[]) {
2537 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2538 			{}
2539 		},
2540 		.chained = true,
2541 		.chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2542 	},
2543 	[ALC887_FIXUP_ASUS_AUDIO] = {
2544 		.type = HDA_FIXUP_PINS,
2545 		.v.pins = (const struct hda_pintbl[]) {
2546 			{ 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2547 			{ 0x19, 0x22219420 },
2548 			{}
2549 		},
2550 	},
2551 	[ALC887_FIXUP_ASUS_HMIC] = {
2552 		.type = HDA_FIXUP_FUNC,
2553 		.v.func = alc887_fixup_asus_jack,
2554 		.chained = true,
2555 		.chain_id = ALC887_FIXUP_ASUS_AUDIO,
2556 	},
2557 	[ALCS1200A_FIXUP_MIC_VREF] = {
2558 		.type = HDA_FIXUP_PINCTLS,
2559 		.v.pins = (const struct hda_pintbl[]) {
2560 			{ 0x18, PIN_VREF50 }, /* rear mic */
2561 			{ 0x19, PIN_VREF50 }, /* front mic */
2562 			{}
2563 		}
2564 	},
2565 	[ALC888VD_FIXUP_MIC_100VREF] = {
2566 		.type = HDA_FIXUP_PINCTLS,
2567 		.v.pins = (const struct hda_pintbl[]) {
2568 			{ 0x18, PIN_VREF100 }, /* headset mic */
2569 			{}
2570 		}
2571 	},
2572 };
2573 
2574 static const struct hda_quirk alc882_fixup_tbl[] = {
2575 	SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2576 	SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2577 	SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2578 	SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2579 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2580 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2581 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2582 	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2583 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2584 	SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2585 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2586 	SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2587 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2588 	SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2589 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2590 	SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2591 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2592 	SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2593 	SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2594 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2595 	SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2596 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2597 	SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2598 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2599 	SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2600 	SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2601 	SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2602 	SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2603 	SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2604 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2605 	SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2606 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2607 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2608 	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2609 	SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2610 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2611 	SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2612 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2613 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2614 	SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2615 
2616 	/* All Apple entries are in codec SSIDs */
2617 	SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2618 	SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2619 	SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2620 	SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2621 	SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2622 	SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2623 	SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2624 	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2625 	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2626 	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2627 	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2628 	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2629 	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2630 	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2631 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2632 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2633 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2634 	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2635 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2636 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2637 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2638 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2639 
2640 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2641 	SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2642 	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2643 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2644 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2645 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2646 	SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2647 	SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2648 	SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2649 	SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2650 	SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2651 	SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2652 	SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2653 	SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2654 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2655 	SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2656 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2657 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2658 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2659 	SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 	SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2661 	SND_PCI_QUIRK(0x1558, 0x5802, "Clevo X58[05]WN[RST]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2662 	SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2663 	SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2664 	SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2665 	SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2666 	SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2667 	SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2668 	SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2669 	SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2670 	SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2671 	SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2672 	SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2673 	SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2674 	SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2675 	SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2676 	SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2677 	SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2678 	SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2679 	SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2680 	SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2681 	SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2682 	SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2683 	SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2684 	SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2685 	SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2686 	SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2687 	SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2688 	SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2689 	SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2690 	SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2691 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2692 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2693 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2694 	SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2695 	{}
2696 };
2697 
2698 static const struct hda_model_fixup alc882_fixup_models[] = {
2699 	{.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2700 	{.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2701 	{.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2702 	{.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2703 	{.id = ALC889_FIXUP_CD, .name = "cd"},
2704 	{.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2705 	{.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2706 	{.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2707 	{.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2708 	{.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2709 	{.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2710 	{.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2711 	{.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2712 	{.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2713 	{.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2714 	{.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2715 	{.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2716 	{.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2717 	{.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2718 	{.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2719 	{.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2720 	{.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2721 	{.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2722 	{.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2723 	{.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2724 	{.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2725 	{.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2726 	{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2727 	{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2728 	{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2729 	{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2730 	{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2731 	{}
2732 };
2733 
2734 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2735 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2736 		{0x14, 0x01014010},
2737 		{0x15, 0x01011012},
2738 		{0x16, 0x01016011},
2739 		{0x18, 0x01a19040},
2740 		{0x19, 0x02a19050},
2741 		{0x1a, 0x0181304f},
2742 		{0x1b, 0x0221401f},
2743 		{0x1e, 0x01456130}),
2744 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2745 		{0x14, 0x01015010},
2746 		{0x15, 0x01011012},
2747 		{0x16, 0x01011011},
2748 		{0x18, 0x01a11040},
2749 		{0x19, 0x02a19050},
2750 		{0x1a, 0x0181104f},
2751 		{0x1b, 0x0221401f},
2752 		{0x1e, 0x01451130}),
2753 	{}
2754 };
2755 
2756 /*
2757  * BIOS auto configuration
2758  */
2759 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2760 static int alc882_parse_auto_config(struct hda_codec *codec)
2761 {
2762 	static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2763 	static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2764 	return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2765 }
2766 
2767 /*
2768  */
patch_alc882(struct hda_codec * codec)2769 static int patch_alc882(struct hda_codec *codec)
2770 {
2771 	struct alc_spec *spec;
2772 	int err;
2773 
2774 	err = alc_alloc_spec(codec, 0x0b);
2775 	if (err < 0)
2776 		return err;
2777 
2778 	spec = codec->spec;
2779 
2780 	switch (codec->core.vendor_id) {
2781 	case 0x10ec0882:
2782 	case 0x10ec0885:
2783 	case 0x10ec0900:
2784 	case 0x10ec0b00:
2785 	case 0x10ec1220:
2786 		break;
2787 	default:
2788 		/* ALC883 and variants */
2789 		alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2790 		break;
2791 	}
2792 
2793 	alc_pre_init(codec);
2794 
2795 	snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2796 		       alc882_fixups);
2797 	snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2798 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2799 
2800 	alc_auto_parse_customize_define(codec);
2801 
2802 	if (has_cdefine_beep(codec))
2803 		spec->gen.beep_nid = 0x01;
2804 
2805 	/* automatic parse from the BIOS config */
2806 	err = alc882_parse_auto_config(codec);
2807 	if (err < 0)
2808 		goto error;
2809 
2810 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2811 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2812 		if (err < 0)
2813 			goto error;
2814 	}
2815 
2816 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2817 
2818 	return 0;
2819 
2820  error:
2821 	alc_free(codec);
2822 	return err;
2823 }
2824 
2825 
2826 /*
2827  * ALC262 support
2828  */
alc262_parse_auto_config(struct hda_codec * codec)2829 static int alc262_parse_auto_config(struct hda_codec *codec)
2830 {
2831 	static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2832 	static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2833 	return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2834 }
2835 
2836 /*
2837  * Pin config fixes
2838  */
2839 enum {
2840 	ALC262_FIXUP_FSC_H270,
2841 	ALC262_FIXUP_FSC_S7110,
2842 	ALC262_FIXUP_HP_Z200,
2843 	ALC262_FIXUP_TYAN,
2844 	ALC262_FIXUP_LENOVO_3000,
2845 	ALC262_FIXUP_BENQ,
2846 	ALC262_FIXUP_BENQ_T31,
2847 	ALC262_FIXUP_INV_DMIC,
2848 	ALC262_FIXUP_INTEL_BAYLEYBAY,
2849 };
2850 
2851 static const struct hda_fixup alc262_fixups[] = {
2852 	[ALC262_FIXUP_FSC_H270] = {
2853 		.type = HDA_FIXUP_PINS,
2854 		.v.pins = (const struct hda_pintbl[]) {
2855 			{ 0x14, 0x99130110 }, /* speaker */
2856 			{ 0x15, 0x0221142f }, /* front HP */
2857 			{ 0x1b, 0x0121141f }, /* rear HP */
2858 			{ }
2859 		}
2860 	},
2861 	[ALC262_FIXUP_FSC_S7110] = {
2862 		.type = HDA_FIXUP_PINS,
2863 		.v.pins = (const struct hda_pintbl[]) {
2864 			{ 0x15, 0x90170110 }, /* speaker */
2865 			{ }
2866 		},
2867 		.chained = true,
2868 		.chain_id = ALC262_FIXUP_BENQ,
2869 	},
2870 	[ALC262_FIXUP_HP_Z200] = {
2871 		.type = HDA_FIXUP_PINS,
2872 		.v.pins = (const struct hda_pintbl[]) {
2873 			{ 0x16, 0x99130120 }, /* internal speaker */
2874 			{ }
2875 		}
2876 	},
2877 	[ALC262_FIXUP_TYAN] = {
2878 		.type = HDA_FIXUP_PINS,
2879 		.v.pins = (const struct hda_pintbl[]) {
2880 			{ 0x14, 0x1993e1f0 }, /* int AUX */
2881 			{ }
2882 		}
2883 	},
2884 	[ALC262_FIXUP_LENOVO_3000] = {
2885 		.type = HDA_FIXUP_PINCTLS,
2886 		.v.pins = (const struct hda_pintbl[]) {
2887 			{ 0x19, PIN_VREF50 },
2888 			{}
2889 		},
2890 		.chained = true,
2891 		.chain_id = ALC262_FIXUP_BENQ,
2892 	},
2893 	[ALC262_FIXUP_BENQ] = {
2894 		.type = HDA_FIXUP_VERBS,
2895 		.v.verbs = (const struct hda_verb[]) {
2896 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2897 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2898 			{}
2899 		}
2900 	},
2901 	[ALC262_FIXUP_BENQ_T31] = {
2902 		.type = HDA_FIXUP_VERBS,
2903 		.v.verbs = (const struct hda_verb[]) {
2904 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2905 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2906 			{}
2907 		}
2908 	},
2909 	[ALC262_FIXUP_INV_DMIC] = {
2910 		.type = HDA_FIXUP_FUNC,
2911 		.v.func = alc_fixup_inv_dmic,
2912 	},
2913 	[ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2914 		.type = HDA_FIXUP_FUNC,
2915 		.v.func = alc_fixup_no_depop_delay,
2916 	},
2917 };
2918 
2919 static const struct hda_quirk alc262_fixup_tbl[] = {
2920 	SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2921 	SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2922 	SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2923 	SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2924 	SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2925 	SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2926 	SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2927 	SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2928 	SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2929 	SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2930 	{}
2931 };
2932 
2933 static const struct hda_model_fixup alc262_fixup_models[] = {
2934 	{.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2935 	{.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2936 	{.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2937 	{.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2938 	{.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2939 	{.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2940 	{.id = ALC262_FIXUP_BENQ, .name = "benq"},
2941 	{.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2942 	{.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2943 	{}
2944 };
2945 
2946 /*
2947  */
patch_alc262(struct hda_codec * codec)2948 static int patch_alc262(struct hda_codec *codec)
2949 {
2950 	struct alc_spec *spec;
2951 	int err;
2952 
2953 	err = alc_alloc_spec(codec, 0x0b);
2954 	if (err < 0)
2955 		return err;
2956 
2957 	spec = codec->spec;
2958 	spec->gen.shared_mic_vref_pin = 0x18;
2959 
2960 	spec->shutup = alc_eapd_shutup;
2961 
2962 #if 0
2963 	/* pshou 07/11/05  set a zero PCM sample to DAC when FIFO is
2964 	 * under-run
2965 	 */
2966 	alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2967 #endif
2968 	alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2969 
2970 	alc_pre_init(codec);
2971 
2972 	snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2973 		       alc262_fixups);
2974 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2975 
2976 	alc_auto_parse_customize_define(codec);
2977 
2978 	if (has_cdefine_beep(codec))
2979 		spec->gen.beep_nid = 0x01;
2980 
2981 	/* automatic parse from the BIOS config */
2982 	err = alc262_parse_auto_config(codec);
2983 	if (err < 0)
2984 		goto error;
2985 
2986 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2987 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2988 		if (err < 0)
2989 			goto error;
2990 	}
2991 
2992 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2993 
2994 	return 0;
2995 
2996  error:
2997 	alc_free(codec);
2998 	return err;
2999 }
3000 
3001 /*
3002  *  ALC268
3003  */
3004 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)3005 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
3006 				  struct snd_ctl_elem_value *ucontrol)
3007 {
3008 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3009 	unsigned long pval;
3010 	int err;
3011 
3012 	mutex_lock(&codec->control_mutex);
3013 	pval = kcontrol->private_value;
3014 	kcontrol->private_value = (pval & ~0xff) | 0x0f;
3015 	err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3016 	if (err >= 0) {
3017 		kcontrol->private_value = (pval & ~0xff) | 0x10;
3018 		err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3019 	}
3020 	kcontrol->private_value = pval;
3021 	mutex_unlock(&codec->control_mutex);
3022 	return err;
3023 }
3024 
3025 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3026 	HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3027 	{
3028 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3029 		.name = "Beep Playback Switch",
3030 		.subdevice = HDA_SUBDEV_AMP_FLAG,
3031 		.info = snd_hda_mixer_amp_switch_info,
3032 		.get = snd_hda_mixer_amp_switch_get,
3033 		.put = alc268_beep_switch_put,
3034 		.private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3035 	},
3036 };
3037 
3038 /* set PCBEEP vol = 0, mute connections */
3039 static const struct hda_verb alc268_beep_init_verbs[] = {
3040 	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3041 	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3042 	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3043 	{ }
3044 };
3045 
3046 enum {
3047 	ALC268_FIXUP_INV_DMIC,
3048 	ALC268_FIXUP_HP_EAPD,
3049 	ALC268_FIXUP_SPDIF,
3050 };
3051 
3052 static const struct hda_fixup alc268_fixups[] = {
3053 	[ALC268_FIXUP_INV_DMIC] = {
3054 		.type = HDA_FIXUP_FUNC,
3055 		.v.func = alc_fixup_inv_dmic,
3056 	},
3057 	[ALC268_FIXUP_HP_EAPD] = {
3058 		.type = HDA_FIXUP_VERBS,
3059 		.v.verbs = (const struct hda_verb[]) {
3060 			{0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3061 			{}
3062 		}
3063 	},
3064 	[ALC268_FIXUP_SPDIF] = {
3065 		.type = HDA_FIXUP_PINS,
3066 		.v.pins = (const struct hda_pintbl[]) {
3067 			{ 0x1e, 0x014b1180 }, /* enable SPDIF out */
3068 			{}
3069 		}
3070 	},
3071 };
3072 
3073 static const struct hda_model_fixup alc268_fixup_models[] = {
3074 	{.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3075 	{.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3076 	{.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3077 	{}
3078 };
3079 
3080 static const struct hda_quirk alc268_fixup_tbl[] = {
3081 	SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3082 	SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3083 	/* below is codec SSID since multiple Toshiba laptops have the
3084 	 * same PCI SSID 1179:ff00
3085 	 */
3086 	SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3087 	{}
3088 };
3089 
3090 /*
3091  * BIOS auto configuration
3092  */
alc268_parse_auto_config(struct hda_codec * codec)3093 static int alc268_parse_auto_config(struct hda_codec *codec)
3094 {
3095 	static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3096 	return alc_parse_auto_config(codec, NULL, alc268_ssids);
3097 }
3098 
3099 /*
3100  */
patch_alc268(struct hda_codec * codec)3101 static int patch_alc268(struct hda_codec *codec)
3102 {
3103 	struct alc_spec *spec;
3104 	int i, err;
3105 
3106 	/* ALC268 has no aa-loopback mixer */
3107 	err = alc_alloc_spec(codec, 0);
3108 	if (err < 0)
3109 		return err;
3110 
3111 	spec = codec->spec;
3112 	if (has_cdefine_beep(codec))
3113 		spec->gen.beep_nid = 0x01;
3114 
3115 	spec->shutup = alc_eapd_shutup;
3116 
3117 	alc_pre_init(codec);
3118 
3119 	snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3120 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3121 
3122 	/* automatic parse from the BIOS config */
3123 	err = alc268_parse_auto_config(codec);
3124 	if (err < 0)
3125 		goto error;
3126 
3127 	if (err > 0 && !spec->gen.no_analog &&
3128 	    spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3129 		for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3130 			if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3131 						  &alc268_beep_mixer[i])) {
3132 				err = -ENOMEM;
3133 				goto error;
3134 			}
3135 		}
3136 		snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3137 		if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3138 			/* override the amp caps for beep generator */
3139 			snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3140 					  (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3141 					  (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3142 					  (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3143 					  (0 << AC_AMPCAP_MUTE_SHIFT));
3144 	}
3145 
3146 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3147 
3148 	return 0;
3149 
3150  error:
3151 	alc_free(codec);
3152 	return err;
3153 }
3154 
3155 /*
3156  * ALC269
3157  */
3158 
3159 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3160 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3161 };
3162 
3163 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3164 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3165 };
3166 
3167 /* different alc269-variants */
3168 enum {
3169 	ALC269_TYPE_ALC269VA,
3170 	ALC269_TYPE_ALC269VB,
3171 	ALC269_TYPE_ALC269VC,
3172 	ALC269_TYPE_ALC269VD,
3173 	ALC269_TYPE_ALC280,
3174 	ALC269_TYPE_ALC282,
3175 	ALC269_TYPE_ALC283,
3176 	ALC269_TYPE_ALC284,
3177 	ALC269_TYPE_ALC293,
3178 	ALC269_TYPE_ALC286,
3179 	ALC269_TYPE_ALC298,
3180 	ALC269_TYPE_ALC255,
3181 	ALC269_TYPE_ALC256,
3182 	ALC269_TYPE_ALC257,
3183 	ALC269_TYPE_ALC215,
3184 	ALC269_TYPE_ALC225,
3185 	ALC269_TYPE_ALC245,
3186 	ALC269_TYPE_ALC287,
3187 	ALC269_TYPE_ALC294,
3188 	ALC269_TYPE_ALC300,
3189 	ALC269_TYPE_ALC623,
3190 	ALC269_TYPE_ALC700,
3191 };
3192 
3193 /*
3194  * BIOS auto configuration
3195  */
alc269_parse_auto_config(struct hda_codec * codec)3196 static int alc269_parse_auto_config(struct hda_codec *codec)
3197 {
3198 	static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3199 	static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3200 	static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3201 	struct alc_spec *spec = codec->spec;
3202 	const hda_nid_t *ssids;
3203 
3204 	switch (spec->codec_variant) {
3205 	case ALC269_TYPE_ALC269VA:
3206 	case ALC269_TYPE_ALC269VC:
3207 	case ALC269_TYPE_ALC280:
3208 	case ALC269_TYPE_ALC284:
3209 	case ALC269_TYPE_ALC293:
3210 		ssids = alc269va_ssids;
3211 		break;
3212 	case ALC269_TYPE_ALC269VB:
3213 	case ALC269_TYPE_ALC269VD:
3214 	case ALC269_TYPE_ALC282:
3215 	case ALC269_TYPE_ALC283:
3216 	case ALC269_TYPE_ALC286:
3217 	case ALC269_TYPE_ALC298:
3218 	case ALC269_TYPE_ALC255:
3219 	case ALC269_TYPE_ALC256:
3220 	case ALC269_TYPE_ALC257:
3221 	case ALC269_TYPE_ALC215:
3222 	case ALC269_TYPE_ALC225:
3223 	case ALC269_TYPE_ALC245:
3224 	case ALC269_TYPE_ALC287:
3225 	case ALC269_TYPE_ALC294:
3226 	case ALC269_TYPE_ALC300:
3227 	case ALC269_TYPE_ALC623:
3228 	case ALC269_TYPE_ALC700:
3229 		ssids = alc269_ssids;
3230 		break;
3231 	default:
3232 		ssids = alc269_ssids;
3233 		break;
3234 	}
3235 
3236 	return alc_parse_auto_config(codec, alc269_ignore, ssids);
3237 }
3238 
3239 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3240 	{ SND_JACK_BTN_0, KEY_PLAYPAUSE },
3241 	{ SND_JACK_BTN_1, KEY_VOICECOMMAND },
3242 	{ SND_JACK_BTN_2, KEY_VOLUMEUP },
3243 	{ SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3244 	{}
3245 };
3246 
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3247 static void alc_headset_btn_callback(struct hda_codec *codec,
3248 				     struct hda_jack_callback *jack)
3249 {
3250 	int report = 0;
3251 
3252 	if (jack->unsol_res & (7 << 13))
3253 		report |= SND_JACK_BTN_0;
3254 
3255 	if (jack->unsol_res  & (1 << 16 | 3 << 8))
3256 		report |= SND_JACK_BTN_1;
3257 
3258 	/* Volume up key */
3259 	if (jack->unsol_res & (7 << 23))
3260 		report |= SND_JACK_BTN_2;
3261 
3262 	/* Volume down key */
3263 	if (jack->unsol_res & (7 << 10))
3264 		report |= SND_JACK_BTN_3;
3265 
3266 	snd_hda_jack_set_button_state(codec, jack->nid, report);
3267 }
3268 
alc_disable_headset_jack_key(struct hda_codec * codec)3269 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3270 {
3271 	struct alc_spec *spec = codec->spec;
3272 
3273 	if (!spec->has_hs_key)
3274 		return;
3275 
3276 	switch (codec->core.vendor_id) {
3277 	case 0x10ec0215:
3278 	case 0x10ec0225:
3279 	case 0x10ec0285:
3280 	case 0x10ec0287:
3281 	case 0x10ec0295:
3282 	case 0x10ec0289:
3283 	case 0x10ec0299:
3284 		alc_write_coef_idx(codec, 0x48, 0x0);
3285 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3286 		alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3287 		break;
3288 	case 0x10ec0230:
3289 	case 0x10ec0236:
3290 	case 0x10ec0256:
3291 	case 0x10ec0257:
3292 	case 0x19e58326:
3293 		alc_write_coef_idx(codec, 0x48, 0x0);
3294 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3295 		break;
3296 	}
3297 }
3298 
alc_enable_headset_jack_key(struct hda_codec * codec)3299 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3300 {
3301 	struct alc_spec *spec = codec->spec;
3302 
3303 	if (!spec->has_hs_key)
3304 		return;
3305 
3306 	switch (codec->core.vendor_id) {
3307 	case 0x10ec0215:
3308 	case 0x10ec0225:
3309 	case 0x10ec0285:
3310 	case 0x10ec0287:
3311 	case 0x10ec0295:
3312 	case 0x10ec0289:
3313 	case 0x10ec0299:
3314 		alc_write_coef_idx(codec, 0x48, 0xd011);
3315 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3316 		alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3317 		break;
3318 	case 0x10ec0230:
3319 	case 0x10ec0236:
3320 	case 0x10ec0256:
3321 	case 0x10ec0257:
3322 	case 0x19e58326:
3323 		alc_write_coef_idx(codec, 0x48, 0xd011);
3324 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3325 		break;
3326 	}
3327 }
3328 
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3329 static void alc_fixup_headset_jack(struct hda_codec *codec,
3330 				    const struct hda_fixup *fix, int action)
3331 {
3332 	struct alc_spec *spec = codec->spec;
3333 	hda_nid_t hp_pin;
3334 
3335 	switch (action) {
3336 	case HDA_FIXUP_ACT_PRE_PROBE:
3337 		spec->has_hs_key = 1;
3338 		snd_hda_jack_detect_enable_callback(codec, 0x55,
3339 						    alc_headset_btn_callback);
3340 		break;
3341 	case HDA_FIXUP_ACT_BUILD:
3342 		hp_pin = alc_get_hp_pin(spec);
3343 		if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3344 							alc_headset_btn_keymap,
3345 							hp_pin))
3346 			snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3347 					      false, SND_JACK_HEADSET,
3348 					      alc_headset_btn_keymap);
3349 
3350 		alc_enable_headset_jack_key(codec);
3351 		break;
3352 	}
3353 }
3354 
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3355 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3356 {
3357 	alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3358 }
3359 
alc269_shutup(struct hda_codec * codec)3360 static void alc269_shutup(struct hda_codec *codec)
3361 {
3362 	struct alc_spec *spec = codec->spec;
3363 
3364 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3365 		alc269vb_toggle_power_output(codec, 0);
3366 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3367 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3368 		msleep(150);
3369 	}
3370 	alc_shutup_pins(codec);
3371 }
3372 
3373 static const struct coef_fw alc282_coefs[] = {
3374 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3375 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3376 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3377 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3378 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3379 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3380 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3381 	WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3382 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3383 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3384 	WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3385 	UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3386 	WRITE_COEF(0x34, 0xa0c0), /* ANC */
3387 	UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3388 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3389 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3390 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3391 	WRITE_COEF(0x63, 0x2902), /* PLL */
3392 	WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3393 	WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3394 	WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3395 	WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3396 	UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3397 	WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3398 	UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3399 	WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3400 	WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3401 	UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3402 	WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3403 	{}
3404 };
3405 
alc282_restore_default_value(struct hda_codec * codec)3406 static void alc282_restore_default_value(struct hda_codec *codec)
3407 {
3408 	alc_process_coef_fw(codec, alc282_coefs);
3409 }
3410 
alc282_init(struct hda_codec * codec)3411 static void alc282_init(struct hda_codec *codec)
3412 {
3413 	struct alc_spec *spec = codec->spec;
3414 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3415 	bool hp_pin_sense;
3416 	int coef78;
3417 
3418 	alc282_restore_default_value(codec);
3419 
3420 	if (!hp_pin)
3421 		return;
3422 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3423 	coef78 = alc_read_coef_idx(codec, 0x78);
3424 
3425 	/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3426 	/* Headphone capless set to high power mode */
3427 	alc_write_coef_idx(codec, 0x78, 0x9004);
3428 
3429 	if (hp_pin_sense)
3430 		msleep(2);
3431 
3432 	snd_hda_codec_write(codec, hp_pin, 0,
3433 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3434 
3435 	if (hp_pin_sense)
3436 		msleep(85);
3437 
3438 	snd_hda_codec_write(codec, hp_pin, 0,
3439 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3440 
3441 	if (hp_pin_sense)
3442 		msleep(100);
3443 
3444 	/* Headphone capless set to normal mode */
3445 	alc_write_coef_idx(codec, 0x78, coef78);
3446 }
3447 
alc282_shutup(struct hda_codec * codec)3448 static void alc282_shutup(struct hda_codec *codec)
3449 {
3450 	struct alc_spec *spec = codec->spec;
3451 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3452 	bool hp_pin_sense;
3453 	int coef78;
3454 
3455 	if (!hp_pin) {
3456 		alc269_shutup(codec);
3457 		return;
3458 	}
3459 
3460 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3461 	coef78 = alc_read_coef_idx(codec, 0x78);
3462 	alc_write_coef_idx(codec, 0x78, 0x9004);
3463 
3464 	if (hp_pin_sense)
3465 		msleep(2);
3466 
3467 	snd_hda_codec_write(codec, hp_pin, 0,
3468 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3469 
3470 	if (hp_pin_sense)
3471 		msleep(85);
3472 
3473 	if (!spec->no_shutup_pins)
3474 		snd_hda_codec_write(codec, hp_pin, 0,
3475 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3476 
3477 	if (hp_pin_sense)
3478 		msleep(100);
3479 
3480 	alc_auto_setup_eapd(codec, false);
3481 	alc_shutup_pins(codec);
3482 	alc_write_coef_idx(codec, 0x78, coef78);
3483 }
3484 
3485 static const struct coef_fw alc283_coefs[] = {
3486 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3487 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3488 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3489 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3490 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3491 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3492 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3493 	WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3494 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3495 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3496 	WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3497 	UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3498 	WRITE_COEF(0x22, 0xa0c0), /* ANC */
3499 	UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3500 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3501 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3502 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3503 	WRITE_COEF(0x2e, 0x2902), /* PLL */
3504 	WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3505 	WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3506 	WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3507 	WRITE_COEF(0x36, 0x0), /* capless control 5 */
3508 	UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3509 	WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3510 	UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3511 	WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3512 	WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3513 	UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3514 	WRITE_COEF(0x49, 0x0), /* test mode */
3515 	UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3516 	UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3517 	WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3518 	UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3519 	{}
3520 };
3521 
alc283_restore_default_value(struct hda_codec * codec)3522 static void alc283_restore_default_value(struct hda_codec *codec)
3523 {
3524 	alc_process_coef_fw(codec, alc283_coefs);
3525 }
3526 
alc283_init(struct hda_codec * codec)3527 static void alc283_init(struct hda_codec *codec)
3528 {
3529 	struct alc_spec *spec = codec->spec;
3530 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3531 	bool hp_pin_sense;
3532 
3533 	alc283_restore_default_value(codec);
3534 
3535 	if (!hp_pin)
3536 		return;
3537 
3538 	msleep(30);
3539 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3540 
3541 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3542 	/* Headphone capless set to high power mode */
3543 	alc_write_coef_idx(codec, 0x43, 0x9004);
3544 
3545 	snd_hda_codec_write(codec, hp_pin, 0,
3546 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3547 
3548 	if (hp_pin_sense)
3549 		msleep(85);
3550 
3551 	snd_hda_codec_write(codec, hp_pin, 0,
3552 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3553 
3554 	if (hp_pin_sense)
3555 		msleep(85);
3556 	/* Index 0x46 Combo jack auto switch control 2 */
3557 	/* 3k pull low control for Headset jack. */
3558 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3559 	/* Headphone capless set to normal mode */
3560 	alc_write_coef_idx(codec, 0x43, 0x9614);
3561 }
3562 
alc283_shutup(struct hda_codec * codec)3563 static void alc283_shutup(struct hda_codec *codec)
3564 {
3565 	struct alc_spec *spec = codec->spec;
3566 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3567 	bool hp_pin_sense;
3568 
3569 	if (!hp_pin) {
3570 		alc269_shutup(codec);
3571 		return;
3572 	}
3573 
3574 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3575 
3576 	alc_write_coef_idx(codec, 0x43, 0x9004);
3577 
3578 	/*depop hp during suspend*/
3579 	alc_write_coef_idx(codec, 0x06, 0x2100);
3580 
3581 	snd_hda_codec_write(codec, hp_pin, 0,
3582 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3583 
3584 	if (hp_pin_sense)
3585 		msleep(100);
3586 
3587 	if (!spec->no_shutup_pins)
3588 		snd_hda_codec_write(codec, hp_pin, 0,
3589 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3590 
3591 	alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3592 
3593 	if (hp_pin_sense)
3594 		msleep(100);
3595 	alc_auto_setup_eapd(codec, false);
3596 	alc_shutup_pins(codec);
3597 	alc_write_coef_idx(codec, 0x43, 0x9614);
3598 }
3599 
alc256_init(struct hda_codec * codec)3600 static void alc256_init(struct hda_codec *codec)
3601 {
3602 	struct alc_spec *spec = codec->spec;
3603 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3604 	bool hp_pin_sense;
3605 
3606 	if (spec->ultra_low_power) {
3607 		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3608 		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3609 		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3610 		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3611 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3612 		msleep(30);
3613 	}
3614 
3615 	if (!hp_pin)
3616 		hp_pin = 0x21;
3617 
3618 	msleep(30);
3619 
3620 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3621 
3622 	if (hp_pin_sense) {
3623 		msleep(2);
3624 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3625 
3626 		snd_hda_codec_write(codec, hp_pin, 0,
3627 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3628 
3629 		msleep(75);
3630 
3631 		snd_hda_codec_write(codec, hp_pin, 0,
3632 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3633 
3634 		msleep(75);
3635 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3636 	}
3637 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3638 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3639 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3640 	/*
3641 	 * Expose headphone mic (or possibly Line In on some machines) instead
3642 	 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3643 	 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3644 	 * this register.
3645 	 */
3646 	alc_write_coef_idx(codec, 0x36, 0x5757);
3647 }
3648 
alc256_shutup(struct hda_codec * codec)3649 static void alc256_shutup(struct hda_codec *codec)
3650 {
3651 	struct alc_spec *spec = codec->spec;
3652 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3653 	bool hp_pin_sense;
3654 
3655 	if (!hp_pin)
3656 		hp_pin = 0x21;
3657 
3658 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3659 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3660 
3661 	if (hp_pin_sense) {
3662 		msleep(2);
3663 
3664 		snd_hda_codec_write(codec, hp_pin, 0,
3665 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3666 
3667 		msleep(75);
3668 
3669 	/* 3k pull low control for Headset jack. */
3670 	/* NOTE: call this before clearing the pin, otherwise codec stalls */
3671 	/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3672 	 * when booting with headset plugged. So skip setting it for the codec alc257
3673 	 */
3674 		if (spec->en_3kpull_low)
3675 			alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3676 
3677 		if (!spec->no_shutup_pins)
3678 			snd_hda_codec_write(codec, hp_pin, 0,
3679 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3680 
3681 		msleep(75);
3682 	}
3683 
3684 	alc_auto_setup_eapd(codec, false);
3685 	alc_shutup_pins(codec);
3686 	if (spec->ultra_low_power) {
3687 		msleep(50);
3688 		alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3689 		alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3690 		alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3691 		alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3692 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3693 		msleep(30);
3694 	}
3695 }
3696 
alc285_hp_init(struct hda_codec * codec)3697 static void alc285_hp_init(struct hda_codec *codec)
3698 {
3699 	struct alc_spec *spec = codec->spec;
3700 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3701 	int i, val;
3702 	int coef38, coef0d, coef36;
3703 
3704 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3705 	alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3706 	coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3707 	coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3708 	coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3709 	alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3710 	alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3711 
3712 	alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3713 
3714 	if (hp_pin)
3715 		snd_hda_codec_write(codec, hp_pin, 0,
3716 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3717 
3718 	msleep(130);
3719 	alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3720 	alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3721 
3722 	if (hp_pin)
3723 		snd_hda_codec_write(codec, hp_pin, 0,
3724 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3725 	msleep(10);
3726 	alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3727 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3728 	alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3729 	alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3730 
3731 	alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3732 	val = alc_read_coefex_idx(codec, 0x58, 0x00);
3733 	for (i = 0; i < 20 && val & 0x8000; i++) {
3734 		msleep(50);
3735 		val = alc_read_coefex_idx(codec, 0x58, 0x00);
3736 	} /* Wait for depop procedure finish  */
3737 
3738 	alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3739 	alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3740 	alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3741 	alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3742 
3743 	msleep(50);
3744 	alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3745 }
3746 
alc225_init(struct hda_codec * codec)3747 static void alc225_init(struct hda_codec *codec)
3748 {
3749 	struct alc_spec *spec = codec->spec;
3750 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3751 	bool hp1_pin_sense, hp2_pin_sense;
3752 
3753 	if (spec->ultra_low_power) {
3754 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3755 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3756 		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3757 		msleep(30);
3758 	}
3759 
3760 	if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3761 		spec->codec_variant != ALC269_TYPE_ALC245)
3762 		/* required only at boot or S3 and S4 resume time */
3763 		if (!spec->done_hp_init ||
3764 			is_s3_resume(codec) ||
3765 			is_s4_resume(codec)) {
3766 			alc285_hp_init(codec);
3767 			spec->done_hp_init = true;
3768 		}
3769 
3770 	if (!hp_pin)
3771 		hp_pin = 0x21;
3772 	msleep(30);
3773 
3774 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3775 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3776 
3777 	if (hp1_pin_sense || hp2_pin_sense) {
3778 		msleep(2);
3779 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3780 
3781 		if (hp1_pin_sense)
3782 			snd_hda_codec_write(codec, hp_pin, 0,
3783 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3784 		if (hp2_pin_sense)
3785 			snd_hda_codec_write(codec, 0x16, 0,
3786 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3787 		msleep(75);
3788 
3789 		if (hp1_pin_sense)
3790 			snd_hda_codec_write(codec, hp_pin, 0,
3791 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3792 		if (hp2_pin_sense)
3793 			snd_hda_codec_write(codec, 0x16, 0,
3794 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3795 
3796 		msleep(75);
3797 		alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3798 		alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3799 	}
3800 }
3801 
alc225_shutup(struct hda_codec * codec)3802 static void alc225_shutup(struct hda_codec *codec)
3803 {
3804 	struct alc_spec *spec = codec->spec;
3805 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3806 	bool hp1_pin_sense, hp2_pin_sense;
3807 
3808 	if (!hp_pin)
3809 		hp_pin = 0x21;
3810 
3811 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3812 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3813 
3814 	if (hp1_pin_sense || hp2_pin_sense) {
3815 		alc_disable_headset_jack_key(codec);
3816 		/* 3k pull low control for Headset jack. */
3817 		alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3818 		msleep(2);
3819 
3820 		if (hp1_pin_sense)
3821 			snd_hda_codec_write(codec, hp_pin, 0,
3822 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3823 		if (hp2_pin_sense)
3824 			snd_hda_codec_write(codec, 0x16, 0,
3825 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3826 
3827 		msleep(75);
3828 
3829 		if (hp1_pin_sense)
3830 			snd_hda_codec_write(codec, hp_pin, 0,
3831 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3832 		if (hp2_pin_sense)
3833 			snd_hda_codec_write(codec, 0x16, 0,
3834 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3835 
3836 		msleep(75);
3837 		alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3838 		alc_enable_headset_jack_key(codec);
3839 	}
3840 	alc_auto_setup_eapd(codec, false);
3841 	alc_shutup_pins(codec);
3842 	if (spec->ultra_low_power) {
3843 		msleep(50);
3844 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3845 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3846 		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3847 		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3848 		msleep(30);
3849 	}
3850 }
3851 
alc222_init(struct hda_codec * codec)3852 static void alc222_init(struct hda_codec *codec)
3853 {
3854 	struct alc_spec *spec = codec->spec;
3855 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3856 	bool hp1_pin_sense, hp2_pin_sense;
3857 
3858 	if (!hp_pin)
3859 		return;
3860 
3861 	msleep(30);
3862 
3863 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3864 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3865 
3866 	if (hp1_pin_sense || hp2_pin_sense) {
3867 		msleep(2);
3868 
3869 		if (hp1_pin_sense)
3870 			snd_hda_codec_write(codec, hp_pin, 0,
3871 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3872 		if (hp2_pin_sense)
3873 			snd_hda_codec_write(codec, 0x14, 0,
3874 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3875 		msleep(75);
3876 
3877 		if (hp1_pin_sense)
3878 			snd_hda_codec_write(codec, hp_pin, 0,
3879 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3880 		if (hp2_pin_sense)
3881 			snd_hda_codec_write(codec, 0x14, 0,
3882 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3883 
3884 		msleep(75);
3885 	}
3886 }
3887 
alc222_shutup(struct hda_codec * codec)3888 static void alc222_shutup(struct hda_codec *codec)
3889 {
3890 	struct alc_spec *spec = codec->spec;
3891 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3892 	bool hp1_pin_sense, hp2_pin_sense;
3893 
3894 	if (!hp_pin)
3895 		hp_pin = 0x21;
3896 
3897 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3898 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3899 
3900 	if (hp1_pin_sense || hp2_pin_sense) {
3901 		msleep(2);
3902 
3903 		if (hp1_pin_sense)
3904 			snd_hda_codec_write(codec, hp_pin, 0,
3905 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3906 		if (hp2_pin_sense)
3907 			snd_hda_codec_write(codec, 0x14, 0,
3908 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3909 
3910 		msleep(75);
3911 
3912 		if (hp1_pin_sense)
3913 			snd_hda_codec_write(codec, hp_pin, 0,
3914 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3915 		if (hp2_pin_sense)
3916 			snd_hda_codec_write(codec, 0x14, 0,
3917 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3918 
3919 		msleep(75);
3920 	}
3921 	alc_auto_setup_eapd(codec, false);
3922 	alc_shutup_pins(codec);
3923 }
3924 
alc_default_init(struct hda_codec * codec)3925 static void alc_default_init(struct hda_codec *codec)
3926 {
3927 	struct alc_spec *spec = codec->spec;
3928 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3929 	bool hp_pin_sense;
3930 
3931 	if (!hp_pin)
3932 		return;
3933 
3934 	msleep(30);
3935 
3936 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3937 
3938 	if (hp_pin_sense) {
3939 		msleep(2);
3940 
3941 		snd_hda_codec_write(codec, hp_pin, 0,
3942 				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3943 
3944 		msleep(75);
3945 
3946 		snd_hda_codec_write(codec, hp_pin, 0,
3947 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3948 		msleep(75);
3949 	}
3950 }
3951 
alc_default_shutup(struct hda_codec * codec)3952 static void alc_default_shutup(struct hda_codec *codec)
3953 {
3954 	struct alc_spec *spec = codec->spec;
3955 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3956 	bool hp_pin_sense;
3957 
3958 	if (!hp_pin) {
3959 		alc269_shutup(codec);
3960 		return;
3961 	}
3962 
3963 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3964 
3965 	if (hp_pin_sense) {
3966 		msleep(2);
3967 
3968 		snd_hda_codec_write(codec, hp_pin, 0,
3969 				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3970 
3971 		msleep(75);
3972 
3973 		if (!spec->no_shutup_pins)
3974 			snd_hda_codec_write(codec, hp_pin, 0,
3975 					    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3976 
3977 		msleep(75);
3978 	}
3979 	alc_auto_setup_eapd(codec, false);
3980 	alc_shutup_pins(codec);
3981 }
3982 
alc294_hp_init(struct hda_codec * codec)3983 static void alc294_hp_init(struct hda_codec *codec)
3984 {
3985 	struct alc_spec *spec = codec->spec;
3986 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3987 	int i, val;
3988 
3989 	if (!hp_pin)
3990 		return;
3991 
3992 	snd_hda_codec_write(codec, hp_pin, 0,
3993 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3994 
3995 	msleep(100);
3996 
3997 	if (!spec->no_shutup_pins)
3998 		snd_hda_codec_write(codec, hp_pin, 0,
3999 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4000 
4001 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
4002 	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
4003 
4004 	/* Wait for depop procedure finish  */
4005 	val = alc_read_coefex_idx(codec, 0x58, 0x01);
4006 	for (i = 0; i < 20 && val & 0x0080; i++) {
4007 		msleep(50);
4008 		val = alc_read_coefex_idx(codec, 0x58, 0x01);
4009 	}
4010 	/* Set HP depop to auto mode */
4011 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
4012 	msleep(50);
4013 }
4014 
alc294_init(struct hda_codec * codec)4015 static void alc294_init(struct hda_codec *codec)
4016 {
4017 	struct alc_spec *spec = codec->spec;
4018 
4019 	/* required only at boot or S4 resume time */
4020 	if (!spec->done_hp_init ||
4021 	    codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
4022 		alc294_hp_init(codec);
4023 		spec->done_hp_init = true;
4024 	}
4025 	alc_default_init(codec);
4026 }
4027 
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)4028 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
4029 			     unsigned int val)
4030 {
4031 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
4032 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
4033 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
4034 }
4035 
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)4036 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
4037 {
4038 	unsigned int val;
4039 
4040 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
4041 	val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
4042 		& 0xffff;
4043 	val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
4044 		<< 16;
4045 	return val;
4046 }
4047 
alc5505_dsp_halt(struct hda_codec * codec)4048 static void alc5505_dsp_halt(struct hda_codec *codec)
4049 {
4050 	unsigned int val;
4051 
4052 	alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
4053 	alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
4054 	alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
4055 	alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
4056 	alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
4057 	alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
4058 	alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
4059 	val = alc5505_coef_get(codec, 0x6220);
4060 	alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
4061 }
4062 
alc5505_dsp_back_from_halt(struct hda_codec * codec)4063 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
4064 {
4065 	alc5505_coef_set(codec, 0x61b8, 0x04133302);
4066 	alc5505_coef_set(codec, 0x61b0, 0x00005b16);
4067 	alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
4068 	alc5505_coef_set(codec, 0x6230, 0xf80d4011);
4069 	alc5505_coef_set(codec, 0x6220, 0x2002010f);
4070 	alc5505_coef_set(codec, 0x880c, 0x00000004);
4071 }
4072 
alc5505_dsp_init(struct hda_codec * codec)4073 static void alc5505_dsp_init(struct hda_codec *codec)
4074 {
4075 	unsigned int val;
4076 
4077 	alc5505_dsp_halt(codec);
4078 	alc5505_dsp_back_from_halt(codec);
4079 	alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
4080 	alc5505_coef_set(codec, 0x61b0, 0x5b16);
4081 	alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
4082 	alc5505_coef_set(codec, 0x61b4, 0x04132b02);
4083 	alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
4084 	alc5505_coef_set(codec, 0x61b8, 0x041f3302);
4085 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
4086 	alc5505_coef_set(codec, 0x61b8, 0x041b3302);
4087 	alc5505_coef_set(codec, 0x61b8, 0x04173302);
4088 	alc5505_coef_set(codec, 0x61b8, 0x04163302);
4089 	alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4090 	alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4091 	alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4092 
4093 	val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4094 	if (val <= 3)
4095 		alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4096 	else
4097 		alc5505_coef_set(codec, 0x6220, 0x6002018f);
4098 
4099 	alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4100 	alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4101 	alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4102 	alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4103 	alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4104 	alc5505_coef_set(codec, 0x880c, 0x00000003);
4105 	alc5505_coef_set(codec, 0x880c, 0x00000010);
4106 
4107 #ifdef HALT_REALTEK_ALC5505
4108 	alc5505_dsp_halt(codec);
4109 #endif
4110 }
4111 
4112 #ifdef HALT_REALTEK_ALC5505
4113 #define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
4114 #define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
4115 #else
4116 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
4117 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
4118 #endif
4119 
alc269_suspend(struct hda_codec * codec)4120 static int alc269_suspend(struct hda_codec *codec)
4121 {
4122 	struct alc_spec *spec = codec->spec;
4123 
4124 	if (spec->has_alc5505_dsp)
4125 		alc5505_dsp_suspend(codec);
4126 
4127 	return alc_suspend(codec);
4128 }
4129 
alc269_resume(struct hda_codec * codec)4130 static int alc269_resume(struct hda_codec *codec)
4131 {
4132 	struct alc_spec *spec = codec->spec;
4133 
4134 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4135 		alc269vb_toggle_power_output(codec, 0);
4136 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4137 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
4138 		msleep(150);
4139 	}
4140 
4141 	codec->patch_ops.init(codec);
4142 
4143 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4144 		alc269vb_toggle_power_output(codec, 1);
4145 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4146 			(alc_get_coef0(codec) & 0x00ff) == 0x017) {
4147 		msleep(200);
4148 	}
4149 
4150 	snd_hda_regmap_sync(codec);
4151 	hda_call_check_power_status(codec, 0x01);
4152 
4153 	/* on some machine, the BIOS will clear the codec gpio data when enter
4154 	 * suspend, and won't restore the data after resume, so we restore it
4155 	 * in the driver.
4156 	 */
4157 	if (spec->gpio_data)
4158 		alc_write_gpio_data(codec);
4159 
4160 	if (spec->has_alc5505_dsp)
4161 		alc5505_dsp_resume(codec);
4162 
4163 	return 0;
4164 }
4165 
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4166 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4167 						 const struct hda_fixup *fix, int action)
4168 {
4169 	struct alc_spec *spec = codec->spec;
4170 
4171 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4172 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4173 }
4174 
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4175 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4176 						 const struct hda_fixup *fix,
4177 						 int action)
4178 {
4179 	unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4180 	unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4181 
4182 	if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4183 		snd_hda_codec_set_pincfg(codec, 0x19,
4184 			(cfg_headphone & ~AC_DEFCFG_DEVICE) |
4185 			(AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4186 }
4187 
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4188 static void alc269_fixup_hweq(struct hda_codec *codec,
4189 			       const struct hda_fixup *fix, int action)
4190 {
4191 	if (action == HDA_FIXUP_ACT_INIT)
4192 		alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4193 }
4194 
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4195 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4196 				       const struct hda_fixup *fix, int action)
4197 {
4198 	struct alc_spec *spec = codec->spec;
4199 
4200 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4201 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4202 }
4203 
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4204 static void alc271_fixup_dmic(struct hda_codec *codec,
4205 			      const struct hda_fixup *fix, int action)
4206 {
4207 	static const struct hda_verb verbs[] = {
4208 		{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4209 		{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4210 		{}
4211 	};
4212 	unsigned int cfg;
4213 
4214 	if (strcmp(codec->core.chip_name, "ALC271X") &&
4215 	    strcmp(codec->core.chip_name, "ALC269VB"))
4216 		return;
4217 	cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4218 	if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4219 		snd_hda_sequence_write(codec, verbs);
4220 }
4221 
4222 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4223 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4224 					  const struct hda_fixup *fix,
4225 					  int action)
4226 {
4227 	if (action == HDA_FIXUP_ACT_INIT)
4228 		alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4229 }
4230 
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4231 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4232 				 const struct hda_fixup *fix, int action)
4233 {
4234 	struct alc_spec *spec = codec->spec;
4235 
4236 	if (action != HDA_FIXUP_ACT_PROBE)
4237 		return;
4238 
4239 	/* Due to a hardware problem on Lenovo Ideadpad, we need to
4240 	 * fix the sample rate of analog I/O to 44.1kHz
4241 	 */
4242 	spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4243 	spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4244 }
4245 
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4246 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4247 				     const struct hda_fixup *fix, int action)
4248 {
4249 	/* The digital-mic unit sends PDM (differential signal) instead of
4250 	 * the standard PCM, thus you can't record a valid mono stream as is.
4251 	 * Below is a workaround specific to ALC269 to control the dmic
4252 	 * signal source as mono.
4253 	 */
4254 	if (action == HDA_FIXUP_ACT_INIT)
4255 		alc_update_coef_idx(codec, 0x07, 0, 0x80);
4256 }
4257 
alc269_quanta_automute(struct hda_codec * codec)4258 static void alc269_quanta_automute(struct hda_codec *codec)
4259 {
4260 	snd_hda_gen_update_outputs(codec);
4261 
4262 	alc_write_coef_idx(codec, 0x0c, 0x680);
4263 	alc_write_coef_idx(codec, 0x0c, 0x480);
4264 }
4265 
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4266 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4267 				     const struct hda_fixup *fix, int action)
4268 {
4269 	struct alc_spec *spec = codec->spec;
4270 	if (action != HDA_FIXUP_ACT_PROBE)
4271 		return;
4272 	spec->gen.automute_hook = alc269_quanta_automute;
4273 }
4274 
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4275 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4276 					 struct hda_jack_callback *jack)
4277 {
4278 	struct alc_spec *spec = codec->spec;
4279 	int vref;
4280 	msleep(200);
4281 	snd_hda_gen_hp_automute(codec, jack);
4282 
4283 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4284 	msleep(100);
4285 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4286 			    vref);
4287 	msleep(500);
4288 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4289 			    vref);
4290 }
4291 
4292 /*
4293  * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4294  */
4295 struct hda_alc298_mbxinit {
4296 	unsigned char value_0x23;
4297 	unsigned char value_0x25;
4298 };
4299 
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4300 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4301 					 const struct hda_alc298_mbxinit *initval,
4302 					 bool first)
4303 {
4304 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4305 	alc_write_coef_idx(codec, 0x26, 0xb000);
4306 
4307 	if (first)
4308 		snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4309 
4310 	snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4311 	alc_write_coef_idx(codec, 0x26, 0xf000);
4312 	alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4313 
4314 	if (initval->value_0x23 != 0x1e)
4315 		alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4316 
4317 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4318 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4319 }
4320 
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4321 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4322 					   const struct hda_fixup *fix,
4323 					   int action)
4324 {
4325 	/* Initialization magic */
4326 	static const struct hda_alc298_mbxinit dac_init[] = {
4327 		{0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4328 		{0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4329 		{0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4330 		{0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4331 		{0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4332 		{0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4333 		{0x2f, 0x00},
4334 		{0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4335 		{0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4336 		{0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4337 		{}
4338 	};
4339 	const struct hda_alc298_mbxinit *seq;
4340 
4341 	if (action != HDA_FIXUP_ACT_INIT)
4342 		return;
4343 
4344 	/* Start */
4345 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4346 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4347 	alc_write_coef_idx(codec, 0x26, 0xf000);
4348 	alc_write_coef_idx(codec, 0x22, 0x31);
4349 	alc_write_coef_idx(codec, 0x23, 0x0b);
4350 	alc_write_coef_idx(codec, 0x25, 0x00);
4351 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4352 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4353 
4354 	for (seq = dac_init; seq->value_0x23; seq++)
4355 		alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4356 }
4357 
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4358 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4359 				     const struct hda_fixup *fix, int action)
4360 {
4361 	struct alc_spec *spec = codec->spec;
4362 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4363 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4364 		spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4365 	}
4366 }
4367 
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4368 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4369 				bool polarity, bool on)
4370 {
4371 	unsigned int pinval;
4372 
4373 	if (!pin)
4374 		return;
4375 	if (polarity)
4376 		on = !on;
4377 	pinval = snd_hda_codec_get_pin_target(codec, pin);
4378 	pinval &= ~AC_PINCTL_VREFEN;
4379 	pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4380 	/* temporarily power up/down for setting VREF */
4381 	snd_hda_power_up_pm(codec);
4382 	snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4383 	snd_hda_power_down_pm(codec);
4384 }
4385 
4386 /* 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)4387 static int vref_mute_led_set(struct led_classdev *led_cdev,
4388 			     enum led_brightness brightness)
4389 {
4390 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4391 	struct alc_spec *spec = codec->spec;
4392 
4393 	alc_update_vref_led(codec, spec->mute_led_nid,
4394 			    spec->mute_led_polarity, brightness);
4395 	return 0;
4396 }
4397 
4398 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4399 static unsigned int led_power_filter(struct hda_codec *codec,
4400 						  hda_nid_t nid,
4401 						  unsigned int power_state)
4402 {
4403 	struct alc_spec *spec = codec->spec;
4404 
4405 	if (power_state != AC_PWRST_D3 || nid == 0 ||
4406 	    (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4407 		return power_state;
4408 
4409 	/* Set pin ctl again, it might have just been set to 0 */
4410 	snd_hda_set_pin_ctl(codec, nid,
4411 			    snd_hda_codec_get_pin_target(codec, nid));
4412 
4413 	return snd_hda_gen_path_power_filter(codec, nid, power_state);
4414 }
4415 
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4416 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4417 				     const struct hda_fixup *fix, int action)
4418 {
4419 	struct alc_spec *spec = codec->spec;
4420 	const struct dmi_device *dev = NULL;
4421 
4422 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4423 		return;
4424 
4425 	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4426 		int pol, pin;
4427 		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4428 			continue;
4429 		if (pin < 0x0a || pin >= 0x10)
4430 			break;
4431 		spec->mute_led_polarity = pol;
4432 		spec->mute_led_nid = pin - 0x0a + 0x18;
4433 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4434 		codec->power_filter = led_power_filter;
4435 		codec_dbg(codec,
4436 			  "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4437 			   spec->mute_led_polarity);
4438 		break;
4439 	}
4440 }
4441 
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4442 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4443 					  const struct hda_fixup *fix,
4444 					  int action, hda_nid_t pin)
4445 {
4446 	struct alc_spec *spec = codec->spec;
4447 
4448 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4449 		spec->mute_led_polarity = 0;
4450 		spec->mute_led_nid = pin;
4451 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4452 		codec->power_filter = led_power_filter;
4453 	}
4454 }
4455 
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4456 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4457 				const struct hda_fixup *fix, int action)
4458 {
4459 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4460 }
4461 
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4462 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4463 				const struct hda_fixup *fix, int action)
4464 {
4465 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4466 }
4467 
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4468 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4469 				const struct hda_fixup *fix, int action)
4470 {
4471 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4472 }
4473 
4474 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4475 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4476 				int polarity, bool enabled)
4477 {
4478 	if (polarity)
4479 		enabled = !enabled;
4480 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4481 }
4482 
4483 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4484 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4485 			     enum led_brightness brightness)
4486 {
4487 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4488 	struct alc_spec *spec = codec->spec;
4489 
4490 	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4491 			    spec->mute_led_polarity, !brightness);
4492 	return 0;
4493 }
4494 
4495 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4496 static int micmute_led_set(struct led_classdev *led_cdev,
4497 			   enum led_brightness brightness)
4498 {
4499 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4500 	struct alc_spec *spec = codec->spec;
4501 
4502 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4503 			    spec->micmute_led_polarity, !brightness);
4504 	return 0;
4505 }
4506 
4507 /* 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)4508 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4509 				  int action,
4510 				  unsigned int mute_mask,
4511 				  unsigned int micmute_mask)
4512 {
4513 	struct alc_spec *spec = codec->spec;
4514 
4515 	alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4516 
4517 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4518 		return;
4519 	if (mute_mask) {
4520 		spec->gpio_mute_led_mask = mute_mask;
4521 		snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4522 	}
4523 	if (micmute_mask) {
4524 		spec->gpio_mic_led_mask = micmute_mask;
4525 		snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4526 	}
4527 }
4528 
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4529 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4530 				const struct hda_fixup *fix, int action)
4531 {
4532 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4533 }
4534 
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4535 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4536 				const struct hda_fixup *fix, int action)
4537 {
4538 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4539 }
4540 
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4541 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4542 				const struct hda_fixup *fix, int action)
4543 {
4544 	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4545 }
4546 
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4547 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4548 				const struct hda_fixup *fix, int action)
4549 {
4550 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4551 }
4552 
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4553 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4554 				const struct hda_fixup *fix, int action)
4555 {
4556 	alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4557 }
4558 
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4559 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4560 				const struct hda_fixup *fix, int action)
4561 {
4562 	struct alc_spec *spec = codec->spec;
4563 
4564 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4565 		spec->micmute_led_polarity = 1;
4566 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4567 }
4568 
4569 /* 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)4570 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4571 				enum led_brightness brightness)
4572 {
4573 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4574 	struct alc_spec *spec = codec->spec;
4575 
4576 	alc_update_vref_led(codec, spec->cap_mute_led_nid,
4577 			    spec->micmute_led_polarity, brightness);
4578 	return 0;
4579 }
4580 
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4581 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4582 				const struct hda_fixup *fix, int action)
4583 {
4584 	struct alc_spec *spec = codec->spec;
4585 
4586 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4587 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4588 		/* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4589 		 * enable headphone amp
4590 		 */
4591 		spec->gpio_mask |= 0x10;
4592 		spec->gpio_dir |= 0x10;
4593 		spec->cap_mute_led_nid = 0x18;
4594 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4595 		codec->power_filter = led_power_filter;
4596 	}
4597 }
4598 
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4599 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4600 				   const struct hda_fixup *fix, int action)
4601 {
4602 	struct alc_spec *spec = codec->spec;
4603 
4604 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4605 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4606 		spec->cap_mute_led_nid = 0x18;
4607 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4608 		codec->power_filter = led_power_filter;
4609 	}
4610 }
4611 
4612 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4613  * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4614  */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4615 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4616 				     const struct hda_fixup *fix, int action)
4617 {
4618 	struct alc_spec *spec = codec->spec;
4619 
4620 	switch (action) {
4621 	case HDA_FIXUP_ACT_PRE_PROBE:
4622 		spec->gpio_mask |= 0x01;
4623 		spec->gpio_dir |= 0x01;
4624 		break;
4625 	case HDA_FIXUP_ACT_INIT:
4626 		/* need to toggle GPIO to enable the amp */
4627 		alc_update_gpio_data(codec, 0x01, true);
4628 		msleep(100);
4629 		alc_update_gpio_data(codec, 0x01, false);
4630 		break;
4631 	}
4632 }
4633 
4634 /* 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)4635 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4636 				    struct hda_codec *codec,
4637 				    struct snd_pcm_substream *substream,
4638 				    int action)
4639 {
4640 	switch (action) {
4641 	case HDA_GEN_PCM_ACT_PREPARE:
4642 		alc_update_gpio_data(codec, 0x04, true);
4643 		break;
4644 	case HDA_GEN_PCM_ACT_CLEANUP:
4645 		alc_update_gpio_data(codec, 0x04, false);
4646 		break;
4647 	}
4648 }
4649 
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4650 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4651 				      const struct hda_fixup *fix,
4652 				      int action)
4653 {
4654 	struct alc_spec *spec = codec->spec;
4655 
4656 	if (action == HDA_FIXUP_ACT_PROBE) {
4657 		spec->gpio_mask |= 0x04;
4658 		spec->gpio_dir |= 0x04;
4659 		spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4660 	}
4661 }
4662 
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4663 static void alc_update_coef_led(struct hda_codec *codec,
4664 				struct alc_coef_led *led,
4665 				bool polarity, bool on)
4666 {
4667 	if (polarity)
4668 		on = !on;
4669 	/* temporarily power up/down for setting COEF bit */
4670 	alc_update_coef_idx(codec, led->idx, led->mask,
4671 			    on ? led->on : led->off);
4672 }
4673 
4674 /* 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)4675 static int coef_mute_led_set(struct led_classdev *led_cdev,
4676 			     enum led_brightness brightness)
4677 {
4678 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4679 	struct alc_spec *spec = codec->spec;
4680 
4681 	alc_update_coef_led(codec, &spec->mute_led_coef,
4682 			    spec->mute_led_polarity, brightness);
4683 	return 0;
4684 }
4685 
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4686 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4687 					  const struct hda_fixup *fix,
4688 					  int action)
4689 {
4690 	struct alc_spec *spec = codec->spec;
4691 
4692 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4693 		spec->mute_led_polarity = 0;
4694 		spec->mute_led_coef.idx = 0x0b;
4695 		spec->mute_led_coef.mask = 1 << 3;
4696 		spec->mute_led_coef.on = 1 << 3;
4697 		spec->mute_led_coef.off = 0;
4698 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4699 	}
4700 }
4701 
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4702 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4703 					  const struct hda_fixup *fix,
4704 					  int action)
4705 {
4706 	struct alc_spec *spec = codec->spec;
4707 
4708 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4709 		spec->mute_led_polarity = 0;
4710 		spec->mute_led_coef.idx = 0x34;
4711 		spec->mute_led_coef.mask = 1 << 5;
4712 		spec->mute_led_coef.on = 0;
4713 		spec->mute_led_coef.off = 1 << 5;
4714 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4715 	}
4716 }
4717 
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4718 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4719 					  const struct hda_fixup *fix, int action)
4720 {
4721 	struct alc_spec *spec = codec->spec;
4722 
4723 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4724 		spec->mute_led_polarity = 0;
4725 		spec->mute_led_coef.idx = 0x07;
4726 		spec->mute_led_coef.mask = 1;
4727 		spec->mute_led_coef.on = 1;
4728 		spec->mute_led_coef.off = 0;
4729 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4730 	}
4731 }
4732 
alc245_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4733 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4734 					  const struct hda_fixup *fix,
4735 					  int action)
4736 {
4737 	struct alc_spec *spec = codec->spec;
4738 
4739 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4740 		spec->mute_led_polarity = 0;
4741 		spec->mute_led_coef.idx = 0x0b;
4742 		spec->mute_led_coef.mask = 3 << 2;
4743 		spec->mute_led_coef.on = 2 << 2;
4744 		spec->mute_led_coef.off = 1 << 2;
4745 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4746 	}
4747 }
4748 
alc245_fixup_hp_mute_led_v1_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4749 static void alc245_fixup_hp_mute_led_v1_coefbit(struct hda_codec *codec,
4750 					  const struct hda_fixup *fix,
4751 					  int action)
4752 {
4753 	struct alc_spec *spec = codec->spec;
4754 
4755 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4756 		spec->mute_led_polarity = 0;
4757 		spec->mute_led_coef.idx = 0x0b;
4758 		spec->mute_led_coef.mask = 3 << 2;
4759 		spec->mute_led_coef.on = 1 << 3;
4760 		spec->mute_led_coef.off = 0;
4761 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4762 	}
4763 }
4764 
4765 /* 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)4766 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4767 				enum led_brightness brightness)
4768 {
4769 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4770 	struct alc_spec *spec = codec->spec;
4771 
4772 	alc_update_coef_led(codec, &spec->mic_led_coef,
4773 			    spec->micmute_led_polarity, brightness);
4774 	return 0;
4775 }
4776 
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4777 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4778 				const struct hda_fixup *fix, int action)
4779 {
4780 	struct alc_spec *spec = codec->spec;
4781 
4782 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4783 		spec->mic_led_coef.idx = 0x19;
4784 		spec->mic_led_coef.mask = 1 << 13;
4785 		spec->mic_led_coef.on = 1 << 13;
4786 		spec->mic_led_coef.off = 0;
4787 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4788 	}
4789 }
4790 
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4791 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4792 				const struct hda_fixup *fix, int action)
4793 {
4794 	struct alc_spec *spec = codec->spec;
4795 
4796 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4797 		spec->micmute_led_polarity = 1;
4798 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4799 }
4800 
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4801 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4802 				const struct hda_fixup *fix, int action)
4803 {
4804 	struct alc_spec *spec = codec->spec;
4805 
4806 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4807 		spec->mic_led_coef.idx = 0x35;
4808 		spec->mic_led_coef.mask = 3 << 2;
4809 		spec->mic_led_coef.on = 2 << 2;
4810 		spec->mic_led_coef.off = 1 << 2;
4811 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4812 	}
4813 }
4814 
alc295_fixup_hp_mute_led_coefbit11(struct hda_codec * codec,const struct hda_fixup * fix,int action)4815 static void alc295_fixup_hp_mute_led_coefbit11(struct hda_codec *codec,
4816 				const struct hda_fixup *fix, int action)
4817 {
4818 	struct alc_spec *spec = codec->spec;
4819 
4820 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4821 		spec->mute_led_polarity = 0;
4822 		spec->mute_led_coef.idx = 0xb;
4823 		spec->mute_led_coef.mask = 3 << 3;
4824 		spec->mute_led_coef.on = 1 << 3;
4825 		spec->mute_led_coef.off = 1 << 4;
4826 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4827 	}
4828 }
4829 
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4830 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4831 				const struct hda_fixup *fix, int action)
4832 {
4833 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4834 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4835 }
4836 
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4837 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4838 				const struct hda_fixup *fix, int action)
4839 {
4840 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4841 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4842 }
4843 
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4844 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4845 				const struct hda_fixup *fix, int action)
4846 {
4847 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4848 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4849 }
4850 
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4851 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4852 				const struct hda_fixup *fix, int action)
4853 {
4854 	struct alc_spec *spec = codec->spec;
4855 
4856 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4857 		spec->cap_mute_led_nid = 0x1a;
4858 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4859 		codec->power_filter = led_power_filter;
4860 	}
4861 }
4862 
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4863 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4864 				const struct hda_fixup *fix, int action)
4865 {
4866 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4867 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4868 }
4869 
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4870 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4871 						  const unsigned short coefs[2])
4872 {
4873 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4874 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4875 	alc_write_coef_idx(codec, 0x26, 0xb011);
4876 }
4877 
4878 struct alc298_samsung_amp_desc {
4879 	unsigned char nid;
4880 	unsigned short init_seq[2][2];
4881 };
4882 
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4883 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4884 				     const struct hda_fixup *fix, int action)
4885 {
4886 	int i, j;
4887 	static const unsigned short init_seq[][2] = {
4888 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4889 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4890 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4891 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4892 	};
4893 	static const struct alc298_samsung_amp_desc amps[] = {
4894 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4895 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4896 	};
4897 
4898 	if (action != HDA_FIXUP_ACT_INIT)
4899 		return;
4900 
4901 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4902 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4903 
4904 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4905 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4906 
4907 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4908 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4909 	}
4910 }
4911 
4912 struct alc298_samsung_v2_amp_desc {
4913 	unsigned short nid;
4914 	int init_seq_size;
4915 	unsigned short init_seq[18][2];
4916 };
4917 
4918 static const struct alc298_samsung_v2_amp_desc
4919 alc298_samsung_v2_amp_desc_tbl[] = {
4920 	{ 0x38, 18, {
4921 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4922 		{ 0x201b, 0x0001 }, { 0x201d, 0x0001 }, { 0x201f, 0x00fe },
4923 		{ 0x2021, 0x0000 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4924 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4925 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x2399, 0x0003 },
4926 		{ 0x23a4, 0x00b5 }, { 0x23a5, 0x0001 }, { 0x23ba, 0x0094 }
4927 	}},
4928 	{ 0x39, 18, {
4929 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4930 		{ 0x201b, 0x0002 }, { 0x201d, 0x0002 }, { 0x201f, 0x00fd },
4931 		{ 0x2021, 0x0001 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4932 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4933 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x2399, 0x0003 },
4934 		{ 0x23a4, 0x00b5 }, { 0x23a5, 0x0001 }, { 0x23ba, 0x0094 }
4935 	}},
4936 	{ 0x3c, 15, {
4937 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4938 		{ 0x201b, 0x0001 }, { 0x201d, 0x0001 }, { 0x201f, 0x00fe },
4939 		{ 0x2021, 0x0000 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4940 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4941 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x23ba, 0x008d }
4942 	}},
4943 	{ 0x3d, 15, {
4944 		{ 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4945 		{ 0x201b, 0x0002 }, { 0x201d, 0x0002 }, { 0x201f, 0x00fd },
4946 		{ 0x2021, 0x0001 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4947 		{ 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4948 		{ 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x23ba, 0x008d }
4949 	}}
4950 };
4951 
alc298_samsung_v2_enable_amps(struct hda_codec * codec)4952 static void alc298_samsung_v2_enable_amps(struct hda_codec *codec)
4953 {
4954 	struct alc_spec *spec = codec->spec;
4955 	static const unsigned short enable_seq[][2] = {
4956 		{ 0x203a, 0x0081 }, { 0x23ff, 0x0001 },
4957 	};
4958 	int i, j;
4959 
4960 	for (i = 0; i < spec->num_speaker_amps; i++) {
4961 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4962 		for (j = 0; j < ARRAY_SIZE(enable_seq); j++)
4963 			alc298_samsung_write_coef_pack(codec, enable_seq[j]);
4964 		codec_dbg(codec, "alc298_samsung_v2: Enabled speaker amp 0x%02x\n",
4965 				alc298_samsung_v2_amp_desc_tbl[i].nid);
4966 	}
4967 }
4968 
alc298_samsung_v2_disable_amps(struct hda_codec * codec)4969 static void alc298_samsung_v2_disable_amps(struct hda_codec *codec)
4970 {
4971 	struct alc_spec *spec = codec->spec;
4972 	static const unsigned short disable_seq[][2] = {
4973 		{ 0x23ff, 0x0000 }, { 0x203a, 0x0080 },
4974 	};
4975 	int i, j;
4976 
4977 	for (i = 0; i < spec->num_speaker_amps; i++) {
4978 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4979 		for (j = 0; j < ARRAY_SIZE(disable_seq); j++)
4980 			alc298_samsung_write_coef_pack(codec, disable_seq[j]);
4981 		codec_dbg(codec, "alc298_samsung_v2: Disabled speaker amp 0x%02x\n",
4982 				alc298_samsung_v2_amp_desc_tbl[i].nid);
4983 	}
4984 }
4985 
alc298_samsung_v2_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)4986 static void alc298_samsung_v2_playback_hook(struct hda_pcm_stream *hinfo,
4987 				struct hda_codec *codec,
4988 				struct snd_pcm_substream *substream,
4989 				int action)
4990 {
4991 	/* Dynamically enable/disable speaker amps before and after playback */
4992 	if (action == HDA_GEN_PCM_ACT_OPEN)
4993 		alc298_samsung_v2_enable_amps(codec);
4994 	if (action == HDA_GEN_PCM_ACT_CLOSE)
4995 		alc298_samsung_v2_disable_amps(codec);
4996 }
4997 
alc298_samsung_v2_init_amps(struct hda_codec * codec,int num_speaker_amps)4998 static void alc298_samsung_v2_init_amps(struct hda_codec *codec,
4999 				int num_speaker_amps)
5000 {
5001 	struct alc_spec *spec = codec->spec;
5002 	int i, j;
5003 
5004 	/* Set spec's num_speaker_amps before doing anything else */
5005 	spec->num_speaker_amps = num_speaker_amps;
5006 
5007 	/* Disable speaker amps before init to prevent any physical damage */
5008 	alc298_samsung_v2_disable_amps(codec);
5009 
5010 	/* Initialize the speaker amps */
5011 	for (i = 0; i < spec->num_speaker_amps; i++) {
5012 		alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
5013 		for (j = 0; j < alc298_samsung_v2_amp_desc_tbl[i].init_seq_size; j++) {
5014 			alc298_samsung_write_coef_pack(codec,
5015 					alc298_samsung_v2_amp_desc_tbl[i].init_seq[j]);
5016 		}
5017 		alc_write_coef_idx(codec, 0x89, 0x0);
5018 		codec_dbg(codec, "alc298_samsung_v2: Initialized speaker amp 0x%02x\n",
5019 				alc298_samsung_v2_amp_desc_tbl[i].nid);
5020 	}
5021 
5022 	/* register hook to enable speaker amps only when they are needed */
5023 	spec->gen.pcm_playback_hook = alc298_samsung_v2_playback_hook;
5024 }
5025 
alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec * codec,const struct hda_fixup * fix,int action)5026 static void alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec *codec,
5027 				const struct hda_fixup *fix, int action)
5028 {
5029 	if (action == HDA_FIXUP_ACT_PROBE)
5030 		alc298_samsung_v2_init_amps(codec, 2);
5031 }
5032 
alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec * codec,const struct hda_fixup * fix,int action)5033 static void alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec *codec,
5034 				const struct hda_fixup *fix, int action)
5035 {
5036 	if (action == HDA_FIXUP_ACT_PROBE)
5037 		alc298_samsung_v2_init_amps(codec, 4);
5038 }
5039 
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)5040 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
5041 				   struct hda_jack_callback *event)
5042 {
5043 	struct alc_spec *spec = codec->spec;
5044 
5045 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
5046 	   send both key on and key off event for every interrupt. */
5047 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
5048 	input_sync(spec->kb_dev);
5049 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
5050 	input_sync(spec->kb_dev);
5051 }
5052 
alc_register_micmute_input_device(struct hda_codec * codec)5053 static int alc_register_micmute_input_device(struct hda_codec *codec)
5054 {
5055 	struct alc_spec *spec = codec->spec;
5056 	int i;
5057 
5058 	spec->kb_dev = input_allocate_device();
5059 	if (!spec->kb_dev) {
5060 		codec_err(codec, "Out of memory (input_allocate_device)\n");
5061 		return -ENOMEM;
5062 	}
5063 
5064 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
5065 
5066 	spec->kb_dev->name = "Microphone Mute Button";
5067 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
5068 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
5069 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
5070 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
5071 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
5072 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
5073 
5074 	if (input_register_device(spec->kb_dev)) {
5075 		codec_err(codec, "input_register_device failed\n");
5076 		input_free_device(spec->kb_dev);
5077 		spec->kb_dev = NULL;
5078 		return -ENOMEM;
5079 	}
5080 
5081 	return 0;
5082 }
5083 
5084 /* GPIO1 = set according to SKU external amp
5085  * GPIO2 = mic mute hotkey
5086  * GPIO3 = mute LED
5087  * GPIO4 = mic mute LED
5088  */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)5089 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
5090 					     const struct hda_fixup *fix, int action)
5091 {
5092 	struct alc_spec *spec = codec->spec;
5093 
5094 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
5095 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5096 		spec->init_amp = ALC_INIT_DEFAULT;
5097 		if (alc_register_micmute_input_device(codec) != 0)
5098 			return;
5099 
5100 		spec->gpio_mask |= 0x06;
5101 		spec->gpio_dir |= 0x02;
5102 		spec->gpio_data |= 0x02;
5103 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
5104 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
5105 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
5106 						    gpio2_mic_hotkey_event);
5107 		return;
5108 	}
5109 
5110 	if (!spec->kb_dev)
5111 		return;
5112 
5113 	switch (action) {
5114 	case HDA_FIXUP_ACT_FREE:
5115 		input_unregister_device(spec->kb_dev);
5116 		spec->kb_dev = NULL;
5117 	}
5118 }
5119 
5120 /* Line2 = mic mute hotkey
5121  * GPIO2 = mic mute LED
5122  */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)5123 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
5124 					     const struct hda_fixup *fix, int action)
5125 {
5126 	struct alc_spec *spec = codec->spec;
5127 
5128 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
5129 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5130 		spec->init_amp = ALC_INIT_DEFAULT;
5131 		if (alc_register_micmute_input_device(codec) != 0)
5132 			return;
5133 
5134 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
5135 						    gpio2_mic_hotkey_event);
5136 		return;
5137 	}
5138 
5139 	if (!spec->kb_dev)
5140 		return;
5141 
5142 	switch (action) {
5143 	case HDA_FIXUP_ACT_FREE:
5144 		input_unregister_device(spec->kb_dev);
5145 		spec->kb_dev = NULL;
5146 	}
5147 }
5148 
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)5149 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
5150 				const struct hda_fixup *fix, int action)
5151 {
5152 	struct alc_spec *spec = codec->spec;
5153 
5154 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
5155 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5156 		spec->cap_mute_led_nid = 0x18;
5157 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
5158 	}
5159 }
5160 
alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)5161 static void alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec *codec,
5162 				const struct hda_fixup *fix, int action)
5163 {
5164 	struct alc_spec *spec = codec->spec;
5165 
5166 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
5167 		spec->micmute_led_polarity = 1;
5168 	alc233_fixup_lenovo_line2_mic_hotkey(codec, fix, action);
5169 }
5170 
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)5171 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
5172 {
5173 	if (delay <= 0)
5174 		delay = 75;
5175 	snd_hda_codec_write(codec, 0x21, 0,
5176 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5177 	msleep(delay);
5178 	snd_hda_codec_write(codec, 0x21, 0,
5179 		    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5180 	msleep(delay);
5181 }
5182 
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)5183 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
5184 {
5185 	if (delay <= 0)
5186 		delay = 75;
5187 	snd_hda_codec_write(codec, 0x21, 0,
5188 		    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5189 	msleep(delay);
5190 	snd_hda_codec_write(codec, 0x21, 0,
5191 		    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5192 	msleep(delay);
5193 }
5194 
5195 static const struct coef_fw alc225_pre_hsmode[] = {
5196 	UPDATE_COEF(0x4a, 1<<8, 0),
5197 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
5198 	UPDATE_COEF(0x63, 3<<14, 3<<14),
5199 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
5200 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
5201 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
5202 	UPDATE_COEF(0x4a, 3<<10, 0),
5203 	{}
5204 };
5205 
alc_headset_mode_unplugged(struct hda_codec * codec)5206 static void alc_headset_mode_unplugged(struct hda_codec *codec)
5207 {
5208 	struct alc_spec *spec = codec->spec;
5209 	static const struct coef_fw coef0255[] = {
5210 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
5211 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5212 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5213 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5214 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
5215 		{}
5216 	};
5217 	static const struct coef_fw coef0256[] = {
5218 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
5219 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5220 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5221 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
5222 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5223 		{}
5224 	};
5225 	static const struct coef_fw coef0233[] = {
5226 		WRITE_COEF(0x1b, 0x0c0b),
5227 		WRITE_COEF(0x45, 0xc429),
5228 		UPDATE_COEF(0x35, 0x4000, 0),
5229 		WRITE_COEF(0x06, 0x2104),
5230 		WRITE_COEF(0x1a, 0x0001),
5231 		WRITE_COEF(0x26, 0x0004),
5232 		WRITE_COEF(0x32, 0x42a3),
5233 		{}
5234 	};
5235 	static const struct coef_fw coef0288[] = {
5236 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5237 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5238 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5239 		UPDATE_COEF(0x66, 0x0008, 0),
5240 		UPDATE_COEF(0x67, 0x2000, 0),
5241 		{}
5242 	};
5243 	static const struct coef_fw coef0298[] = {
5244 		UPDATE_COEF(0x19, 0x1300, 0x0300),
5245 		{}
5246 	};
5247 	static const struct coef_fw coef0292[] = {
5248 		WRITE_COEF(0x76, 0x000e),
5249 		WRITE_COEF(0x6c, 0x2400),
5250 		WRITE_COEF(0x18, 0x7308),
5251 		WRITE_COEF(0x6b, 0xc429),
5252 		{}
5253 	};
5254 	static const struct coef_fw coef0293[] = {
5255 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5256 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5257 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5258 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5259 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5260 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5261 		{}
5262 	};
5263 	static const struct coef_fw coef0668[] = {
5264 		WRITE_COEF(0x15, 0x0d40),
5265 		WRITE_COEF(0xb7, 0x802b),
5266 		{}
5267 	};
5268 	static const struct coef_fw coef0225[] = {
5269 		UPDATE_COEF(0x63, 3<<14, 0),
5270 		{}
5271 	};
5272 	static const struct coef_fw coef0274[] = {
5273 		UPDATE_COEF(0x4a, 0x0100, 0),
5274 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5275 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
5276 		UPDATE_COEF(0x4a, 0x0010, 0),
5277 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5278 		WRITE_COEF(0x45, 0x5289),
5279 		UPDATE_COEF(0x4a, 0x0c00, 0),
5280 		{}
5281 	};
5282 
5283 	if (spec->no_internal_mic_pin) {
5284 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5285 		return;
5286 	}
5287 
5288 	switch (codec->core.vendor_id) {
5289 	case 0x10ec0255:
5290 		alc_process_coef_fw(codec, coef0255);
5291 		break;
5292 	case 0x10ec0230:
5293 	case 0x10ec0236:
5294 	case 0x10ec0256:
5295 	case 0x19e58326:
5296 		alc_hp_mute_disable(codec, 75);
5297 		alc_process_coef_fw(codec, coef0256);
5298 		break;
5299 	case 0x10ec0234:
5300 	case 0x10ec0274:
5301 	case 0x10ec0294:
5302 		alc_process_coef_fw(codec, coef0274);
5303 		break;
5304 	case 0x10ec0233:
5305 	case 0x10ec0283:
5306 		alc_process_coef_fw(codec, coef0233);
5307 		break;
5308 	case 0x10ec0286:
5309 	case 0x10ec0288:
5310 		alc_process_coef_fw(codec, coef0288);
5311 		break;
5312 	case 0x10ec0298:
5313 		alc_process_coef_fw(codec, coef0298);
5314 		alc_process_coef_fw(codec, coef0288);
5315 		break;
5316 	case 0x10ec0292:
5317 		alc_process_coef_fw(codec, coef0292);
5318 		break;
5319 	case 0x10ec0293:
5320 		alc_process_coef_fw(codec, coef0293);
5321 		break;
5322 	case 0x10ec0668:
5323 		alc_process_coef_fw(codec, coef0668);
5324 		break;
5325 	case 0x10ec0215:
5326 	case 0x10ec0225:
5327 	case 0x10ec0285:
5328 	case 0x10ec0295:
5329 	case 0x10ec0289:
5330 	case 0x10ec0299:
5331 		alc_hp_mute_disable(codec, 75);
5332 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5333 		alc_process_coef_fw(codec, coef0225);
5334 		break;
5335 	case 0x10ec0867:
5336 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5337 		break;
5338 	}
5339 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5340 }
5341 
5342 
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5343 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5344 				    hda_nid_t mic_pin)
5345 {
5346 	static const struct coef_fw coef0255[] = {
5347 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5348 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5349 		{}
5350 	};
5351 	static const struct coef_fw coef0256[] = {
5352 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5353 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5354 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5355 		{}
5356 	};
5357 	static const struct coef_fw coef0233[] = {
5358 		UPDATE_COEF(0x35, 0, 1<<14),
5359 		WRITE_COEF(0x06, 0x2100),
5360 		WRITE_COEF(0x1a, 0x0021),
5361 		WRITE_COEF(0x26, 0x008c),
5362 		{}
5363 	};
5364 	static const struct coef_fw coef0288[] = {
5365 		UPDATE_COEF(0x4f, 0x00c0, 0),
5366 		UPDATE_COEF(0x50, 0x2000, 0),
5367 		UPDATE_COEF(0x56, 0x0006, 0),
5368 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5369 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5370 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5371 		{}
5372 	};
5373 	static const struct coef_fw coef0292[] = {
5374 		WRITE_COEF(0x19, 0xa208),
5375 		WRITE_COEF(0x2e, 0xacf0),
5376 		{}
5377 	};
5378 	static const struct coef_fw coef0293[] = {
5379 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5380 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5381 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5382 		{}
5383 	};
5384 	static const struct coef_fw coef0688[] = {
5385 		WRITE_COEF(0xb7, 0x802b),
5386 		WRITE_COEF(0xb5, 0x1040),
5387 		UPDATE_COEF(0xc3, 0, 1<<12),
5388 		{}
5389 	};
5390 	static const struct coef_fw coef0225[] = {
5391 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5392 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5393 		UPDATE_COEF(0x63, 3<<14, 0),
5394 		{}
5395 	};
5396 	static const struct coef_fw coef0274[] = {
5397 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5398 		UPDATE_COEF(0x4a, 0x0010, 0),
5399 		UPDATE_COEF(0x6b, 0xf000, 0),
5400 		{}
5401 	};
5402 
5403 	switch (codec->core.vendor_id) {
5404 	case 0x10ec0255:
5405 		alc_write_coef_idx(codec, 0x45, 0xc489);
5406 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5407 		alc_process_coef_fw(codec, coef0255);
5408 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5409 		break;
5410 	case 0x10ec0230:
5411 	case 0x10ec0236:
5412 	case 0x10ec0256:
5413 	case 0x19e58326:
5414 		alc_write_coef_idx(codec, 0x45, 0xc489);
5415 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5416 		alc_process_coef_fw(codec, coef0256);
5417 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5418 		break;
5419 	case 0x10ec0234:
5420 	case 0x10ec0274:
5421 	case 0x10ec0294:
5422 		alc_write_coef_idx(codec, 0x45, 0x4689);
5423 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5424 		alc_process_coef_fw(codec, coef0274);
5425 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5426 		break;
5427 	case 0x10ec0233:
5428 	case 0x10ec0283:
5429 		alc_write_coef_idx(codec, 0x45, 0xc429);
5430 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5431 		alc_process_coef_fw(codec, coef0233);
5432 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5433 		break;
5434 	case 0x10ec0286:
5435 	case 0x10ec0288:
5436 	case 0x10ec0298:
5437 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5438 		alc_process_coef_fw(codec, coef0288);
5439 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5440 		break;
5441 	case 0x10ec0292:
5442 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5443 		alc_process_coef_fw(codec, coef0292);
5444 		break;
5445 	case 0x10ec0293:
5446 		/* Set to TRS mode */
5447 		alc_write_coef_idx(codec, 0x45, 0xc429);
5448 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5449 		alc_process_coef_fw(codec, coef0293);
5450 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5451 		break;
5452 	case 0x10ec0867:
5453 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5454 		fallthrough;
5455 	case 0x10ec0221:
5456 	case 0x10ec0662:
5457 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5458 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5459 		break;
5460 	case 0x10ec0668:
5461 		alc_write_coef_idx(codec, 0x11, 0x0001);
5462 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5463 		alc_process_coef_fw(codec, coef0688);
5464 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5465 		break;
5466 	case 0x10ec0215:
5467 	case 0x10ec0225:
5468 	case 0x10ec0285:
5469 	case 0x10ec0295:
5470 	case 0x10ec0289:
5471 	case 0x10ec0299:
5472 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5473 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5474 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5475 		alc_process_coef_fw(codec, coef0225);
5476 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5477 		break;
5478 	}
5479 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5480 }
5481 
alc_headset_mode_default(struct hda_codec * codec)5482 static void alc_headset_mode_default(struct hda_codec *codec)
5483 {
5484 	static const struct coef_fw coef0225[] = {
5485 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5486 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5487 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5488 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5489 		UPDATE_COEF(0x63, 3<<14, 0),
5490 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5491 		{}
5492 	};
5493 	static const struct coef_fw coef0255[] = {
5494 		WRITE_COEF(0x45, 0xc089),
5495 		WRITE_COEF(0x45, 0xc489),
5496 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5497 		WRITE_COEF(0x49, 0x0049),
5498 		{}
5499 	};
5500 	static const struct coef_fw coef0256[] = {
5501 		WRITE_COEF(0x45, 0xc489),
5502 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5503 		WRITE_COEF(0x49, 0x0049),
5504 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5505 		WRITE_COEF(0x06, 0x6100),
5506 		{}
5507 	};
5508 	static const struct coef_fw coef0233[] = {
5509 		WRITE_COEF(0x06, 0x2100),
5510 		WRITE_COEF(0x32, 0x4ea3),
5511 		{}
5512 	};
5513 	static const struct coef_fw coef0288[] = {
5514 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5515 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5516 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5517 		UPDATE_COEF(0x66, 0x0008, 0),
5518 		UPDATE_COEF(0x67, 0x2000, 0),
5519 		{}
5520 	};
5521 	static const struct coef_fw coef0292[] = {
5522 		WRITE_COEF(0x76, 0x000e),
5523 		WRITE_COEF(0x6c, 0x2400),
5524 		WRITE_COEF(0x6b, 0xc429),
5525 		WRITE_COEF(0x18, 0x7308),
5526 		{}
5527 	};
5528 	static const struct coef_fw coef0293[] = {
5529 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5530 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5531 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5532 		{}
5533 	};
5534 	static const struct coef_fw coef0688[] = {
5535 		WRITE_COEF(0x11, 0x0041),
5536 		WRITE_COEF(0x15, 0x0d40),
5537 		WRITE_COEF(0xb7, 0x802b),
5538 		{}
5539 	};
5540 	static const struct coef_fw coef0274[] = {
5541 		WRITE_COEF(0x45, 0x4289),
5542 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5543 		UPDATE_COEF(0x6b, 0x0f00, 0),
5544 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5545 		{}
5546 	};
5547 
5548 	switch (codec->core.vendor_id) {
5549 	case 0x10ec0215:
5550 	case 0x10ec0225:
5551 	case 0x10ec0285:
5552 	case 0x10ec0295:
5553 	case 0x10ec0289:
5554 	case 0x10ec0299:
5555 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5556 		alc_process_coef_fw(codec, coef0225);
5557 		alc_hp_enable_unmute(codec, 75);
5558 		break;
5559 	case 0x10ec0255:
5560 		alc_process_coef_fw(codec, coef0255);
5561 		break;
5562 	case 0x10ec0230:
5563 	case 0x10ec0236:
5564 	case 0x10ec0256:
5565 	case 0x19e58326:
5566 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5567 		alc_write_coef_idx(codec, 0x45, 0xc089);
5568 		msleep(50);
5569 		alc_process_coef_fw(codec, coef0256);
5570 		alc_hp_enable_unmute(codec, 75);
5571 		break;
5572 	case 0x10ec0234:
5573 	case 0x10ec0274:
5574 	case 0x10ec0294:
5575 		alc_process_coef_fw(codec, coef0274);
5576 		break;
5577 	case 0x10ec0233:
5578 	case 0x10ec0283:
5579 		alc_process_coef_fw(codec, coef0233);
5580 		break;
5581 	case 0x10ec0286:
5582 	case 0x10ec0288:
5583 	case 0x10ec0298:
5584 		alc_process_coef_fw(codec, coef0288);
5585 		break;
5586 	case 0x10ec0292:
5587 		alc_process_coef_fw(codec, coef0292);
5588 		break;
5589 	case 0x10ec0293:
5590 		alc_process_coef_fw(codec, coef0293);
5591 		break;
5592 	case 0x10ec0668:
5593 		alc_process_coef_fw(codec, coef0688);
5594 		break;
5595 	case 0x10ec0867:
5596 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5597 		break;
5598 	}
5599 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5600 }
5601 
5602 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5603 static void alc_headset_mode_ctia(struct hda_codec *codec)
5604 {
5605 	int val;
5606 
5607 	static const struct coef_fw coef0255[] = {
5608 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5609 		WRITE_COEF(0x1b, 0x0c2b),
5610 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5611 		{}
5612 	};
5613 	static const struct coef_fw coef0256[] = {
5614 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5615 		WRITE_COEF(0x1b, 0x0e6b),
5616 		{}
5617 	};
5618 	static const struct coef_fw coef0233[] = {
5619 		WRITE_COEF(0x45, 0xd429),
5620 		WRITE_COEF(0x1b, 0x0c2b),
5621 		WRITE_COEF(0x32, 0x4ea3),
5622 		{}
5623 	};
5624 	static const struct coef_fw coef0288[] = {
5625 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5626 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5627 		UPDATE_COEF(0x66, 0x0008, 0),
5628 		UPDATE_COEF(0x67, 0x2000, 0),
5629 		{}
5630 	};
5631 	static const struct coef_fw coef0292[] = {
5632 		WRITE_COEF(0x6b, 0xd429),
5633 		WRITE_COEF(0x76, 0x0008),
5634 		WRITE_COEF(0x18, 0x7388),
5635 		{}
5636 	};
5637 	static const struct coef_fw coef0293[] = {
5638 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5639 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5640 		{}
5641 	};
5642 	static const struct coef_fw coef0688[] = {
5643 		WRITE_COEF(0x11, 0x0001),
5644 		WRITE_COEF(0x15, 0x0d60),
5645 		WRITE_COEF(0xc3, 0x0000),
5646 		{}
5647 	};
5648 	static const struct coef_fw coef0225_1[] = {
5649 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5650 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5651 		{}
5652 	};
5653 	static const struct coef_fw coef0225_2[] = {
5654 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5655 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5656 		{}
5657 	};
5658 
5659 	switch (codec->core.vendor_id) {
5660 	case 0x10ec0255:
5661 		alc_process_coef_fw(codec, coef0255);
5662 		break;
5663 	case 0x10ec0230:
5664 	case 0x10ec0236:
5665 	case 0x10ec0256:
5666 	case 0x19e58326:
5667 		alc_process_coef_fw(codec, coef0256);
5668 		alc_hp_enable_unmute(codec, 75);
5669 		break;
5670 	case 0x10ec0234:
5671 	case 0x10ec0274:
5672 	case 0x10ec0294:
5673 		alc_write_coef_idx(codec, 0x45, 0xd689);
5674 		break;
5675 	case 0x10ec0233:
5676 	case 0x10ec0283:
5677 		alc_process_coef_fw(codec, coef0233);
5678 		break;
5679 	case 0x10ec0298:
5680 		val = alc_read_coef_idx(codec, 0x50);
5681 		if (val & (1 << 12)) {
5682 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5683 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5684 			msleep(300);
5685 		} else {
5686 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5687 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5688 			msleep(300);
5689 		}
5690 		break;
5691 	case 0x10ec0286:
5692 	case 0x10ec0288:
5693 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5694 		msleep(300);
5695 		alc_process_coef_fw(codec, coef0288);
5696 		break;
5697 	case 0x10ec0292:
5698 		alc_process_coef_fw(codec, coef0292);
5699 		break;
5700 	case 0x10ec0293:
5701 		alc_process_coef_fw(codec, coef0293);
5702 		break;
5703 	case 0x10ec0668:
5704 		alc_process_coef_fw(codec, coef0688);
5705 		break;
5706 	case 0x10ec0215:
5707 	case 0x10ec0225:
5708 	case 0x10ec0285:
5709 	case 0x10ec0295:
5710 	case 0x10ec0289:
5711 	case 0x10ec0299:
5712 		val = alc_read_coef_idx(codec, 0x45);
5713 		if (val & (1 << 9))
5714 			alc_process_coef_fw(codec, coef0225_2);
5715 		else
5716 			alc_process_coef_fw(codec, coef0225_1);
5717 		alc_hp_enable_unmute(codec, 75);
5718 		break;
5719 	case 0x10ec0867:
5720 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5721 		break;
5722 	}
5723 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5724 }
5725 
5726 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5727 static void alc_headset_mode_omtp(struct hda_codec *codec)
5728 {
5729 	static const struct coef_fw coef0255[] = {
5730 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5731 		WRITE_COEF(0x1b, 0x0c2b),
5732 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5733 		{}
5734 	};
5735 	static const struct coef_fw coef0256[] = {
5736 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5737 		WRITE_COEF(0x1b, 0x0e6b),
5738 		{}
5739 	};
5740 	static const struct coef_fw coef0233[] = {
5741 		WRITE_COEF(0x45, 0xe429),
5742 		WRITE_COEF(0x1b, 0x0c2b),
5743 		WRITE_COEF(0x32, 0x4ea3),
5744 		{}
5745 	};
5746 	static const struct coef_fw coef0288[] = {
5747 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5748 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5749 		UPDATE_COEF(0x66, 0x0008, 0),
5750 		UPDATE_COEF(0x67, 0x2000, 0),
5751 		{}
5752 	};
5753 	static const struct coef_fw coef0292[] = {
5754 		WRITE_COEF(0x6b, 0xe429),
5755 		WRITE_COEF(0x76, 0x0008),
5756 		WRITE_COEF(0x18, 0x7388),
5757 		{}
5758 	};
5759 	static const struct coef_fw coef0293[] = {
5760 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5761 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5762 		{}
5763 	};
5764 	static const struct coef_fw coef0688[] = {
5765 		WRITE_COEF(0x11, 0x0001),
5766 		WRITE_COEF(0x15, 0x0d50),
5767 		WRITE_COEF(0xc3, 0x0000),
5768 		{}
5769 	};
5770 	static const struct coef_fw coef0225[] = {
5771 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5772 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5773 		{}
5774 	};
5775 
5776 	switch (codec->core.vendor_id) {
5777 	case 0x10ec0255:
5778 		alc_process_coef_fw(codec, coef0255);
5779 		break;
5780 	case 0x10ec0230:
5781 	case 0x10ec0236:
5782 	case 0x10ec0256:
5783 	case 0x19e58326:
5784 		alc_process_coef_fw(codec, coef0256);
5785 		alc_hp_enable_unmute(codec, 75);
5786 		break;
5787 	case 0x10ec0234:
5788 	case 0x10ec0274:
5789 	case 0x10ec0294:
5790 		alc_write_coef_idx(codec, 0x45, 0xe689);
5791 		break;
5792 	case 0x10ec0233:
5793 	case 0x10ec0283:
5794 		alc_process_coef_fw(codec, coef0233);
5795 		break;
5796 	case 0x10ec0298:
5797 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5798 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5799 		msleep(300);
5800 		break;
5801 	case 0x10ec0286:
5802 	case 0x10ec0288:
5803 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5804 		msleep(300);
5805 		alc_process_coef_fw(codec, coef0288);
5806 		break;
5807 	case 0x10ec0292:
5808 		alc_process_coef_fw(codec, coef0292);
5809 		break;
5810 	case 0x10ec0293:
5811 		alc_process_coef_fw(codec, coef0293);
5812 		break;
5813 	case 0x10ec0668:
5814 		alc_process_coef_fw(codec, coef0688);
5815 		break;
5816 	case 0x10ec0215:
5817 	case 0x10ec0225:
5818 	case 0x10ec0285:
5819 	case 0x10ec0295:
5820 	case 0x10ec0289:
5821 	case 0x10ec0299:
5822 		alc_process_coef_fw(codec, coef0225);
5823 		alc_hp_enable_unmute(codec, 75);
5824 		break;
5825 	}
5826 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5827 }
5828 
alc_determine_headset_type(struct hda_codec * codec)5829 static void alc_determine_headset_type(struct hda_codec *codec)
5830 {
5831 	int val;
5832 	bool is_ctia = false;
5833 	struct alc_spec *spec = codec->spec;
5834 	static const struct coef_fw coef0255[] = {
5835 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5836 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5837  conteol) */
5838 		{}
5839 	};
5840 	static const struct coef_fw coef0288[] = {
5841 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5842 		{}
5843 	};
5844 	static const struct coef_fw coef0298[] = {
5845 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5846 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5847 		UPDATE_COEF(0x66, 0x0008, 0),
5848 		UPDATE_COEF(0x67, 0x2000, 0),
5849 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5850 		{}
5851 	};
5852 	static const struct coef_fw coef0293[] = {
5853 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5854 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5855 		{}
5856 	};
5857 	static const struct coef_fw coef0688[] = {
5858 		WRITE_COEF(0x11, 0x0001),
5859 		WRITE_COEF(0xb7, 0x802b),
5860 		WRITE_COEF(0x15, 0x0d60),
5861 		WRITE_COEF(0xc3, 0x0c00),
5862 		{}
5863 	};
5864 	static const struct coef_fw coef0274[] = {
5865 		UPDATE_COEF(0x4a, 0x0010, 0),
5866 		UPDATE_COEF(0x4a, 0x8000, 0),
5867 		WRITE_COEF(0x45, 0xd289),
5868 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5869 		{}
5870 	};
5871 
5872 	if (spec->no_internal_mic_pin) {
5873 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5874 		return;
5875 	}
5876 
5877 	switch (codec->core.vendor_id) {
5878 	case 0x10ec0255:
5879 		alc_process_coef_fw(codec, coef0255);
5880 		msleep(300);
5881 		val = alc_read_coef_idx(codec, 0x46);
5882 		is_ctia = (val & 0x0070) == 0x0070;
5883 		break;
5884 	case 0x10ec0230:
5885 	case 0x10ec0236:
5886 	case 0x10ec0256:
5887 	case 0x19e58326:
5888 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5889 		alc_write_coef_idx(codec, 0x06, 0x6104);
5890 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5891 
5892 		alc_process_coef_fw(codec, coef0255);
5893 		msleep(300);
5894 		val = alc_read_coef_idx(codec, 0x46);
5895 		is_ctia = (val & 0x0070) == 0x0070;
5896 		if (!is_ctia) {
5897 			alc_write_coef_idx(codec, 0x45, 0xe089);
5898 			msleep(100);
5899 			val = alc_read_coef_idx(codec, 0x46);
5900 			if ((val & 0x0070) == 0x0070)
5901 				is_ctia = false;
5902 			else
5903 				is_ctia = true;
5904 		}
5905 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5906 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5907 		break;
5908 	case 0x10ec0234:
5909 	case 0x10ec0274:
5910 	case 0x10ec0294:
5911 		alc_process_coef_fw(codec, coef0274);
5912 		msleep(850);
5913 		val = alc_read_coef_idx(codec, 0x46);
5914 		is_ctia = (val & 0x00f0) == 0x00f0;
5915 		break;
5916 	case 0x10ec0233:
5917 	case 0x10ec0283:
5918 		alc_write_coef_idx(codec, 0x45, 0xd029);
5919 		msleep(300);
5920 		val = alc_read_coef_idx(codec, 0x46);
5921 		is_ctia = (val & 0x0070) == 0x0070;
5922 		break;
5923 	case 0x10ec0298:
5924 		snd_hda_codec_write(codec, 0x21, 0,
5925 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5926 		msleep(100);
5927 		snd_hda_codec_write(codec, 0x21, 0,
5928 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5929 		msleep(200);
5930 
5931 		val = alc_read_coef_idx(codec, 0x50);
5932 		if (val & (1 << 12)) {
5933 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5934 			alc_process_coef_fw(codec, coef0288);
5935 			msleep(350);
5936 			val = alc_read_coef_idx(codec, 0x50);
5937 			is_ctia = (val & 0x0070) == 0x0070;
5938 		} else {
5939 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5940 			alc_process_coef_fw(codec, coef0288);
5941 			msleep(350);
5942 			val = alc_read_coef_idx(codec, 0x50);
5943 			is_ctia = (val & 0x0070) == 0x0070;
5944 		}
5945 		alc_process_coef_fw(codec, coef0298);
5946 		snd_hda_codec_write(codec, 0x21, 0,
5947 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5948 		msleep(75);
5949 		snd_hda_codec_write(codec, 0x21, 0,
5950 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5951 		break;
5952 	case 0x10ec0286:
5953 	case 0x10ec0288:
5954 		alc_process_coef_fw(codec, coef0288);
5955 		msleep(350);
5956 		val = alc_read_coef_idx(codec, 0x50);
5957 		is_ctia = (val & 0x0070) == 0x0070;
5958 		break;
5959 	case 0x10ec0292:
5960 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5961 		msleep(300);
5962 		val = alc_read_coef_idx(codec, 0x6c);
5963 		is_ctia = (val & 0x001c) == 0x001c;
5964 		break;
5965 	case 0x10ec0293:
5966 		alc_process_coef_fw(codec, coef0293);
5967 		msleep(300);
5968 		val = alc_read_coef_idx(codec, 0x46);
5969 		is_ctia = (val & 0x0070) == 0x0070;
5970 		break;
5971 	case 0x10ec0668:
5972 		alc_process_coef_fw(codec, coef0688);
5973 		msleep(300);
5974 		val = alc_read_coef_idx(codec, 0xbe);
5975 		is_ctia = (val & 0x1c02) == 0x1c02;
5976 		break;
5977 	case 0x10ec0215:
5978 	case 0x10ec0225:
5979 	case 0x10ec0285:
5980 	case 0x10ec0295:
5981 	case 0x10ec0289:
5982 	case 0x10ec0299:
5983 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5984 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5985 		val = alc_read_coef_idx(codec, 0x45);
5986 		if (val & (1 << 9)) {
5987 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5988 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5989 			msleep(800);
5990 			val = alc_read_coef_idx(codec, 0x46);
5991 			is_ctia = (val & 0x00f0) == 0x00f0;
5992 		} else {
5993 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5994 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5995 			msleep(800);
5996 			val = alc_read_coef_idx(codec, 0x46);
5997 			is_ctia = (val & 0x00f0) == 0x00f0;
5998 		}
5999 		if (!is_ctia) {
6000 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
6001 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
6002 			msleep(100);
6003 			val = alc_read_coef_idx(codec, 0x46);
6004 			if ((val & 0x00f0) == 0x00f0)
6005 				is_ctia = false;
6006 			else
6007 				is_ctia = true;
6008 		}
6009 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
6010 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
6011 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
6012 		break;
6013 	case 0x10ec0867:
6014 		is_ctia = true;
6015 		break;
6016 	}
6017 
6018 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
6019 		    is_ctia ? "yes" : "no");
6020 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
6021 }
6022 
alc_update_headset_mode(struct hda_codec * codec)6023 static void alc_update_headset_mode(struct hda_codec *codec)
6024 {
6025 	struct alc_spec *spec = codec->spec;
6026 
6027 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
6028 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
6029 
6030 	int new_headset_mode;
6031 
6032 	if (!snd_hda_jack_detect(codec, hp_pin))
6033 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
6034 	else if (mux_pin == spec->headset_mic_pin)
6035 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
6036 	else if (mux_pin == spec->headphone_mic_pin)
6037 		new_headset_mode = ALC_HEADSET_MODE_MIC;
6038 	else
6039 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
6040 
6041 	if (new_headset_mode == spec->current_headset_mode) {
6042 		snd_hda_gen_update_outputs(codec);
6043 		return;
6044 	}
6045 
6046 	switch (new_headset_mode) {
6047 	case ALC_HEADSET_MODE_UNPLUGGED:
6048 		alc_headset_mode_unplugged(codec);
6049 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
6050 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
6051 		spec->gen.hp_jack_present = false;
6052 		break;
6053 	case ALC_HEADSET_MODE_HEADSET:
6054 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
6055 			alc_determine_headset_type(codec);
6056 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
6057 			alc_headset_mode_ctia(codec);
6058 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
6059 			alc_headset_mode_omtp(codec);
6060 		spec->gen.hp_jack_present = true;
6061 		break;
6062 	case ALC_HEADSET_MODE_MIC:
6063 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
6064 		spec->gen.hp_jack_present = false;
6065 		break;
6066 	case ALC_HEADSET_MODE_HEADPHONE:
6067 		alc_headset_mode_default(codec);
6068 		spec->gen.hp_jack_present = true;
6069 		break;
6070 	}
6071 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
6072 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
6073 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
6074 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
6075 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
6076 						  PIN_VREFHIZ);
6077 	}
6078 	spec->current_headset_mode = new_headset_mode;
6079 
6080 	snd_hda_gen_update_outputs(codec);
6081 }
6082 
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)6083 static void alc_update_headset_mode_hook(struct hda_codec *codec,
6084 					 struct snd_kcontrol *kcontrol,
6085 					 struct snd_ctl_elem_value *ucontrol)
6086 {
6087 	alc_update_headset_mode(codec);
6088 }
6089 
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)6090 static void alc_update_headset_jack_cb(struct hda_codec *codec,
6091 				       struct hda_jack_callback *jack)
6092 {
6093 	snd_hda_gen_hp_automute(codec, jack);
6094 	alc_update_headset_mode(codec);
6095 }
6096 
alc_probe_headset_mode(struct hda_codec * codec)6097 static void alc_probe_headset_mode(struct hda_codec *codec)
6098 {
6099 	int i;
6100 	struct alc_spec *spec = codec->spec;
6101 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6102 
6103 	/* Find mic pins */
6104 	for (i = 0; i < cfg->num_inputs; i++) {
6105 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
6106 			spec->headset_mic_pin = cfg->inputs[i].pin;
6107 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
6108 			spec->headphone_mic_pin = cfg->inputs[i].pin;
6109 	}
6110 
6111 	WARN_ON(spec->gen.cap_sync_hook);
6112 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
6113 	spec->gen.automute_hook = alc_update_headset_mode;
6114 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
6115 }
6116 
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)6117 static void alc_fixup_headset_mode(struct hda_codec *codec,
6118 				const struct hda_fixup *fix, int action)
6119 {
6120 	struct alc_spec *spec = codec->spec;
6121 
6122 	switch (action) {
6123 	case HDA_FIXUP_ACT_PRE_PROBE:
6124 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
6125 		break;
6126 	case HDA_FIXUP_ACT_PROBE:
6127 		alc_probe_headset_mode(codec);
6128 		break;
6129 	case HDA_FIXUP_ACT_INIT:
6130 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
6131 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
6132 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
6133 		}
6134 		alc_update_headset_mode(codec);
6135 		break;
6136 	}
6137 }
6138 
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6139 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
6140 				const struct hda_fixup *fix, int action)
6141 {
6142 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6143 		struct alc_spec *spec = codec->spec;
6144 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6145 	}
6146 	else
6147 		alc_fixup_headset_mode(codec, fix, action);
6148 }
6149 
alc255_set_default_jack_type(struct hda_codec * codec)6150 static void alc255_set_default_jack_type(struct hda_codec *codec)
6151 {
6152 	/* Set to iphone type */
6153 	static const struct coef_fw alc255fw[] = {
6154 		WRITE_COEF(0x1b, 0x880b),
6155 		WRITE_COEF(0x45, 0xd089),
6156 		WRITE_COEF(0x1b, 0x080b),
6157 		WRITE_COEF(0x46, 0x0004),
6158 		WRITE_COEF(0x1b, 0x0c0b),
6159 		{}
6160 	};
6161 	static const struct coef_fw alc256fw[] = {
6162 		WRITE_COEF(0x1b, 0x884b),
6163 		WRITE_COEF(0x45, 0xd089),
6164 		WRITE_COEF(0x1b, 0x084b),
6165 		WRITE_COEF(0x46, 0x0004),
6166 		WRITE_COEF(0x1b, 0x0c4b),
6167 		{}
6168 	};
6169 	switch (codec->core.vendor_id) {
6170 	case 0x10ec0255:
6171 		alc_process_coef_fw(codec, alc255fw);
6172 		break;
6173 	case 0x10ec0230:
6174 	case 0x10ec0236:
6175 	case 0x10ec0256:
6176 	case 0x19e58326:
6177 		alc_process_coef_fw(codec, alc256fw);
6178 		break;
6179 	}
6180 	msleep(30);
6181 }
6182 
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)6183 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
6184 				const struct hda_fixup *fix, int action)
6185 {
6186 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6187 		alc255_set_default_jack_type(codec);
6188 	}
6189 	alc_fixup_headset_mode(codec, fix, action);
6190 }
6191 
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6192 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
6193 				const struct hda_fixup *fix, int action)
6194 {
6195 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6196 		struct alc_spec *spec = codec->spec;
6197 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6198 		alc255_set_default_jack_type(codec);
6199 	}
6200 	else
6201 		alc_fixup_headset_mode(codec, fix, action);
6202 }
6203 
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)6204 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
6205 				       struct hda_jack_callback *jack)
6206 {
6207 	struct alc_spec *spec = codec->spec;
6208 
6209 	alc_update_headset_jack_cb(codec, jack);
6210 	/* Headset Mic enable or disable, only for Dell Dino */
6211 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
6212 }
6213 
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)6214 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
6215 				const struct hda_fixup *fix, int action)
6216 {
6217 	alc_fixup_headset_mode(codec, fix, action);
6218 	if (action == HDA_FIXUP_ACT_PROBE) {
6219 		struct alc_spec *spec = codec->spec;
6220 		/* toggled via hp_automute_hook */
6221 		spec->gpio_mask |= 0x40;
6222 		spec->gpio_dir |= 0x40;
6223 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
6224 	}
6225 }
6226 
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6227 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
6228 					const struct hda_fixup *fix, int action)
6229 {
6230 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6231 		struct alc_spec *spec = codec->spec;
6232 		spec->gen.auto_mute_via_amp = 1;
6233 	}
6234 }
6235 
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)6236 static void alc_fixup_no_shutup(struct hda_codec *codec,
6237 				const struct hda_fixup *fix, int action)
6238 {
6239 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6240 		struct alc_spec *spec = codec->spec;
6241 		spec->no_shutup_pins = 1;
6242 	}
6243 }
6244 
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)6245 static void alc_fixup_disable_aamix(struct hda_codec *codec,
6246 				    const struct hda_fixup *fix, int action)
6247 {
6248 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6249 		struct alc_spec *spec = codec->spec;
6250 		/* Disable AA-loopback as it causes white noise */
6251 		spec->gen.mixer_nid = 0;
6252 	}
6253 }
6254 
6255 /* 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)6256 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6257 				  const struct hda_fixup *fix, int action)
6258 {
6259 	static const struct hda_pintbl pincfgs[] = {
6260 		{ 0x16, 0x21211010 }, /* dock headphone */
6261 		{ 0x19, 0x21a11010 }, /* dock mic */
6262 		{ }
6263 	};
6264 	struct alc_spec *spec = codec->spec;
6265 
6266 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6267 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6268 		codec->power_save_node = 0; /* avoid click noises */
6269 		snd_hda_apply_pincfgs(codec, pincfgs);
6270 	}
6271 }
6272 
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6273 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6274 				  const struct hda_fixup *fix, int action)
6275 {
6276 	static const struct hda_pintbl pincfgs[] = {
6277 		{ 0x17, 0x21211010 }, /* dock headphone */
6278 		{ 0x19, 0x21a11010 }, /* dock mic */
6279 		{ }
6280 	};
6281 	struct alc_spec *spec = codec->spec;
6282 
6283 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6284 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6285 		snd_hda_apply_pincfgs(codec, pincfgs);
6286 	} else if (action == HDA_FIXUP_ACT_INIT) {
6287 		/* Enable DOCK device */
6288 		snd_hda_codec_write(codec, 0x17, 0,
6289 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6290 		/* Enable DOCK device */
6291 		snd_hda_codec_write(codec, 0x19, 0,
6292 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6293 	}
6294 }
6295 
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6296 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6297 				  const struct hda_fixup *fix, int action)
6298 {
6299 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6300 	 * the speaker output becomes too low by some reason on Thinkpads with
6301 	 * ALC298 codec
6302 	 */
6303 	static const hda_nid_t preferred_pairs[] = {
6304 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6305 		0
6306 	};
6307 	struct alc_spec *spec = codec->spec;
6308 
6309 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6310 		spec->gen.preferred_dacs = preferred_pairs;
6311 }
6312 
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6313 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6314 				   const struct hda_fixup *fix, int action)
6315 {
6316 	static const hda_nid_t preferred_pairs[] = {
6317 		0x17, 0x02, 0x21, 0x03, 0
6318 	};
6319 	struct alc_spec *spec = codec->spec;
6320 
6321 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6322 		spec->gen.preferred_dacs = preferred_pairs;
6323 }
6324 
alc_shutup_dell_xps13(struct hda_codec * codec)6325 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6326 {
6327 	struct alc_spec *spec = codec->spec;
6328 	int hp_pin = alc_get_hp_pin(spec);
6329 
6330 	/* Prevent pop noises when headphones are plugged in */
6331 	snd_hda_codec_write(codec, hp_pin, 0,
6332 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6333 	msleep(20);
6334 }
6335 
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6336 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6337 				const struct hda_fixup *fix, int action)
6338 {
6339 	struct alc_spec *spec = codec->spec;
6340 	struct hda_input_mux *imux = &spec->gen.input_mux;
6341 	int i;
6342 
6343 	switch (action) {
6344 	case HDA_FIXUP_ACT_PRE_PROBE:
6345 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6346 		 * it causes a click noise at start up
6347 		 */
6348 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6349 		spec->shutup = alc_shutup_dell_xps13;
6350 		break;
6351 	case HDA_FIXUP_ACT_PROBE:
6352 		/* Make the internal mic the default input source. */
6353 		for (i = 0; i < imux->num_items; i++) {
6354 			if (spec->gen.imux_pins[i] == 0x12) {
6355 				spec->gen.cur_mux[0] = i;
6356 				break;
6357 			}
6358 		}
6359 		break;
6360 	}
6361 }
6362 
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6363 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6364 				const struct hda_fixup *fix, int action)
6365 {
6366 	struct alc_spec *spec = codec->spec;
6367 
6368 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6369 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6370 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6371 
6372 		/* Disable boost for mic-in permanently. (This code is only called
6373 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6374 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6375 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6376 	} else
6377 		alc_fixup_headset_mode(codec, fix, action);
6378 }
6379 
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6380 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6381 				const struct hda_fixup *fix, int action)
6382 {
6383 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6384 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6385 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6386 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6387 	}
6388 	alc_fixup_headset_mode(codec, fix, action);
6389 }
6390 
6391 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6392 static int find_ext_mic_pin(struct hda_codec *codec)
6393 {
6394 	struct alc_spec *spec = codec->spec;
6395 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6396 	hda_nid_t nid;
6397 	unsigned int defcfg;
6398 	int i;
6399 
6400 	for (i = 0; i < cfg->num_inputs; i++) {
6401 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6402 			continue;
6403 		nid = cfg->inputs[i].pin;
6404 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6405 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6406 			continue;
6407 		return nid;
6408 	}
6409 
6410 	return 0;
6411 }
6412 
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6413 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6414 				    const struct hda_fixup *fix,
6415 				    int action)
6416 {
6417 	struct alc_spec *spec = codec->spec;
6418 
6419 	if (action == HDA_FIXUP_ACT_PROBE) {
6420 		int mic_pin = find_ext_mic_pin(codec);
6421 		int hp_pin = alc_get_hp_pin(spec);
6422 
6423 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6424 			return;
6425 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6426 	}
6427 }
6428 
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6429 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6430 					     const struct hda_fixup *fix,
6431 					     int action)
6432 {
6433 	struct alc_spec *spec = codec->spec;
6434 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6435 	int i;
6436 
6437 	/* The mic boosts on level 2 and 3 are too noisy
6438 	   on the internal mic input.
6439 	   Therefore limit the boost to 0 or 1. */
6440 
6441 	if (action != HDA_FIXUP_ACT_PROBE)
6442 		return;
6443 
6444 	for (i = 0; i < cfg->num_inputs; i++) {
6445 		hda_nid_t nid = cfg->inputs[i].pin;
6446 		unsigned int defcfg;
6447 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6448 			continue;
6449 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6450 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6451 			continue;
6452 
6453 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6454 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6455 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6456 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6457 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6458 	}
6459 }
6460 
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6461 static void alc283_hp_automute_hook(struct hda_codec *codec,
6462 				    struct hda_jack_callback *jack)
6463 {
6464 	struct alc_spec *spec = codec->spec;
6465 	int vref;
6466 
6467 	msleep(200);
6468 	snd_hda_gen_hp_automute(codec, jack);
6469 
6470 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6471 
6472 	msleep(600);
6473 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6474 			    vref);
6475 }
6476 
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6477 static void alc283_fixup_chromebook(struct hda_codec *codec,
6478 				    const struct hda_fixup *fix, int action)
6479 {
6480 	struct alc_spec *spec = codec->spec;
6481 
6482 	switch (action) {
6483 	case HDA_FIXUP_ACT_PRE_PROBE:
6484 		snd_hda_override_wcaps(codec, 0x03, 0);
6485 		/* Disable AA-loopback as it causes white noise */
6486 		spec->gen.mixer_nid = 0;
6487 		break;
6488 	case HDA_FIXUP_ACT_INIT:
6489 		/* MIC2-VREF control */
6490 		/* Set to manual mode */
6491 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6492 		/* Enable Line1 input control by verb */
6493 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6494 		break;
6495 	}
6496 }
6497 
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6498 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6499 				    const struct hda_fixup *fix, int action)
6500 {
6501 	struct alc_spec *spec = codec->spec;
6502 
6503 	switch (action) {
6504 	case HDA_FIXUP_ACT_PRE_PROBE:
6505 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6506 		break;
6507 	case HDA_FIXUP_ACT_INIT:
6508 		/* MIC2-VREF control */
6509 		/* Set to manual mode */
6510 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6511 		break;
6512 	}
6513 }
6514 
6515 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6516 static void asus_tx300_automute(struct hda_codec *codec)
6517 {
6518 	struct alc_spec *spec = codec->spec;
6519 	snd_hda_gen_update_outputs(codec);
6520 	if (snd_hda_jack_detect(codec, 0x1b))
6521 		spec->gen.mute_bits |= (1ULL << 0x14);
6522 }
6523 
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6524 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6525 				    const struct hda_fixup *fix, int action)
6526 {
6527 	struct alc_spec *spec = codec->spec;
6528 	static const struct hda_pintbl dock_pins[] = {
6529 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6530 		{}
6531 	};
6532 
6533 	switch (action) {
6534 	case HDA_FIXUP_ACT_PRE_PROBE:
6535 		spec->init_amp = ALC_INIT_DEFAULT;
6536 		/* TX300 needs to set up GPIO2 for the speaker amp */
6537 		alc_setup_gpio(codec, 0x04);
6538 		snd_hda_apply_pincfgs(codec, dock_pins);
6539 		spec->gen.auto_mute_via_amp = 1;
6540 		spec->gen.automute_hook = asus_tx300_automute;
6541 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6542 						    snd_hda_gen_hp_automute);
6543 		break;
6544 	case HDA_FIXUP_ACT_PROBE:
6545 		spec->init_amp = ALC_INIT_DEFAULT;
6546 		break;
6547 	case HDA_FIXUP_ACT_BUILD:
6548 		/* this is a bit tricky; give more sane names for the main
6549 		 * (tablet) speaker and the dock speaker, respectively
6550 		 */
6551 		rename_ctl(codec, "Speaker Playback Switch",
6552 			   "Dock Speaker Playback Switch");
6553 		rename_ctl(codec, "Bass Speaker Playback Switch",
6554 			   "Speaker Playback Switch");
6555 		break;
6556 	}
6557 }
6558 
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6559 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6560 				       const struct hda_fixup *fix, int action)
6561 {
6562 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6563 		/* DAC node 0x03 is giving mono output. We therefore want to
6564 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6565 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6566 		static const hda_nid_t conn1[] = { 0x0c };
6567 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6568 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6569 	}
6570 }
6571 
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6572 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6573 					const struct hda_fixup *fix, int action)
6574 {
6575 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6576 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6577 		   we can't adjust the speaker's volume since this node does not has
6578 		   Amp-out capability. we change the speaker's route to:
6579 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6580 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6581 		   speaker's volume now. */
6582 
6583 		static const hda_nid_t conn1[] = { 0x0c };
6584 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6585 	}
6586 }
6587 
6588 /* 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)6589 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6590 				      const struct hda_fixup *fix, int action)
6591 {
6592 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6593 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6594 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6595 	}
6596 }
6597 
6598 /* 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)6599 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6600 					  const struct hda_fixup *fix, int action)
6601 {
6602 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6603 		static const hda_nid_t conn[] = { 0x02 };
6604 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6605 	}
6606 }
6607 
6608 /* 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)6609 static void alc294_fixup_bass_speaker_15(struct hda_codec *codec,
6610 					 const struct hda_fixup *fix, int action)
6611 {
6612 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6613 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6614 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
6615 		snd_hda_gen_add_micmute_led_cdev(codec, NULL);
6616 	}
6617 }
6618 
6619 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6620 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6621 					  struct hda_jack_callback *jack)
6622 {
6623 	struct alc_spec *spec = codec->spec;
6624 
6625 	snd_hda_gen_hp_automute(codec, jack);
6626 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6627 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6628 			    !spec->gen.hp_jack_present);
6629 }
6630 
6631 /* Manage GPIOs for HP EliteBook Folio 9480m.
6632  *
6633  * GPIO4 is the headphone amplifier power control
6634  * GPIO3 is the audio output mute indicator LED
6635  */
6636 
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6637 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6638 				  const struct hda_fixup *fix,
6639 				  int action)
6640 {
6641 	struct alc_spec *spec = codec->spec;
6642 
6643 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6644 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6645 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6646 		spec->gpio_mask |= 0x10;
6647 		spec->gpio_dir |= 0x10;
6648 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6649 	}
6650 }
6651 
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6652 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6653 				   const struct hda_fixup *fix,
6654 				   int action)
6655 {
6656 	struct alc_spec *spec = codec->spec;
6657 
6658 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6659 		spec->gpio_mask |= 0x04;
6660 		spec->gpio_dir |= 0x04;
6661 		/* set data bit low */
6662 	}
6663 }
6664 
6665 /* Quirk for Thinkpad X1 7th and 8th Gen
6666  * The following fixed routing needed
6667  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6668  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6669  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6670  */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6671 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6672 					  const struct hda_fixup *fix, int action)
6673 {
6674 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6675 	static const hda_nid_t preferred_pairs[] = {
6676 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6677 	};
6678 	struct alc_spec *spec = codec->spec;
6679 
6680 	switch (action) {
6681 	case HDA_FIXUP_ACT_PRE_PROBE:
6682 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6683 		spec->gen.preferred_dacs = preferred_pairs;
6684 		break;
6685 	case HDA_FIXUP_ACT_BUILD:
6686 		/* The generic parser creates somewhat unintuitive volume ctls
6687 		 * with the fixed routing above, and the shared DAC2 may be
6688 		 * confusing for PA.
6689 		 * Rename those to unique names so that PA doesn't touch them
6690 		 * and use only Master volume.
6691 		 */
6692 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6693 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6694 		break;
6695 	}
6696 }
6697 
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6698 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6699 					 const struct hda_fixup *fix,
6700 					 int action)
6701 {
6702 	alc_fixup_dual_codecs(codec, fix, action);
6703 	switch (action) {
6704 	case HDA_FIXUP_ACT_PRE_PROBE:
6705 		/* override card longname to provide a unique UCM profile */
6706 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6707 		break;
6708 	case HDA_FIXUP_ACT_BUILD:
6709 		/* rename Capture controls depending on the codec */
6710 		rename_ctl(codec, "Capture Volume",
6711 			   codec->addr == 0 ?
6712 			   "Rear-Panel Capture Volume" :
6713 			   "Front-Panel Capture Volume");
6714 		rename_ctl(codec, "Capture Switch",
6715 			   codec->addr == 0 ?
6716 			   "Rear-Panel Capture Switch" :
6717 			   "Front-Panel Capture Switch");
6718 		break;
6719 	}
6720 }
6721 
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6722 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6723 				      const struct hda_fixup *fix, int action)
6724 {
6725 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6726 		return;
6727 
6728 	codec->power_save_node = 1;
6729 }
6730 
6731 /* 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)6732 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6733 				    const struct hda_fixup *fix, int action)
6734 {
6735 	struct alc_spec *spec = codec->spec;
6736 	static const hda_nid_t preferred_pairs[] = {
6737 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6738 		0
6739 	};
6740 
6741 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6742 		return;
6743 
6744 	spec->gen.preferred_dacs = preferred_pairs;
6745 	spec->gen.auto_mute_via_amp = 1;
6746 	codec->power_save_node = 0;
6747 }
6748 
6749 /* 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)6750 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6751 				    const struct hda_fixup *fix, int action)
6752 {
6753 	static const hda_nid_t preferred_pairs[] = {
6754 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6755 	};
6756 	struct alc_spec *spec = codec->spec;
6757 
6758 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6759 		spec->gen.preferred_dacs = preferred_pairs;
6760 }
6761 
6762 /* 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)6763 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6764 			      const struct hda_fixup *fix, int action)
6765 {
6766 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6767 		return;
6768 
6769 	snd_hda_override_wcaps(codec, 0x03, 0);
6770 }
6771 
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6772 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6773 {
6774 	switch (codec->core.vendor_id) {
6775 	case 0x10ec0274:
6776 	case 0x10ec0294:
6777 	case 0x10ec0225:
6778 	case 0x10ec0295:
6779 	case 0x10ec0299:
6780 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6781 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6782 		break;
6783 	case 0x10ec0230:
6784 	case 0x10ec0235:
6785 	case 0x10ec0236:
6786 	case 0x10ec0255:
6787 	case 0x10ec0256:
6788 	case 0x10ec0257:
6789 	case 0x19e58326:
6790 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6791 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6792 		break;
6793 	}
6794 }
6795 
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6796 static void alc295_fixup_chromebook(struct hda_codec *codec,
6797 				    const struct hda_fixup *fix, int action)
6798 {
6799 	struct alc_spec *spec = codec->spec;
6800 
6801 	switch (action) {
6802 	case HDA_FIXUP_ACT_PRE_PROBE:
6803 		spec->ultra_low_power = true;
6804 		break;
6805 	case HDA_FIXUP_ACT_INIT:
6806 		alc_combo_jack_hp_jd_restart(codec);
6807 		break;
6808 	}
6809 }
6810 
alc256_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6811 static void alc256_fixup_chromebook(struct hda_codec *codec,
6812 				    const struct hda_fixup *fix, int action)
6813 {
6814 	struct alc_spec *spec = codec->spec;
6815 
6816 	switch (action) {
6817 	case HDA_FIXUP_ACT_PRE_PROBE:
6818 		if (codec->core.subsystem_id == 0x10280d76)
6819 			spec->gen.suppress_auto_mute = 0;
6820 		else
6821 			spec->gen.suppress_auto_mute = 1;
6822 		spec->gen.suppress_auto_mic = 1;
6823 		spec->en_3kpull_low = false;
6824 		break;
6825 	}
6826 }
6827 
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6828 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6829 				  const struct hda_fixup *fix, int action)
6830 {
6831 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6832 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6833 }
6834 
6835 
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6836 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6837 					struct hda_jack_callback *cb)
6838 {
6839 	/* The Windows driver sets the codec up in a very different way where
6840 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6841 	 */
6842 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6843 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6844 	else
6845 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6846 }
6847 
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6848 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6849 					const struct hda_fixup *fix, int action)
6850 {
6851 	/* Pin 0x21: headphones/headset mic */
6852 	if (!is_jack_detectable(codec, 0x21))
6853 		return;
6854 
6855 	switch (action) {
6856 	case HDA_FIXUP_ACT_PRE_PROBE:
6857 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6858 				alc294_gx502_toggle_output);
6859 		break;
6860 	case HDA_FIXUP_ACT_INIT:
6861 		/* Make sure to start in a correct state, i.e. if
6862 		 * headphones have been plugged in before powering up the system
6863 		 */
6864 		alc294_gx502_toggle_output(codec, NULL);
6865 		break;
6866 	}
6867 }
6868 
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6869 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6870 				       struct hda_jack_callback *cb)
6871 {
6872 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6873 	 * responsible from changes between speakers and headphones
6874 	 */
6875 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6876 		alc_write_coef_idx(codec, 0x10, 0x8420);
6877 	else
6878 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6879 }
6880 
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6881 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6882 				  const struct hda_fixup *fix, int action)
6883 {
6884 	if (!is_jack_detectable(codec, 0x21))
6885 		return;
6886 
6887 	switch (action) {
6888 	case HDA_FIXUP_ACT_PRE_PROBE:
6889 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6890 				alc294_gu502_toggle_output);
6891 		break;
6892 	case HDA_FIXUP_ACT_INIT:
6893 		alc294_gu502_toggle_output(codec, NULL);
6894 		break;
6895 	}
6896 }
6897 
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6898 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6899 			      const struct hda_fixup *fix, int action)
6900 {
6901 	if (action != HDA_FIXUP_ACT_INIT)
6902 		return;
6903 
6904 	msleep(100);
6905 	alc_write_coef_idx(codec, 0x65, 0x0);
6906 }
6907 
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6908 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6909 				    const struct hda_fixup *fix, int action)
6910 {
6911 	switch (action) {
6912 	case HDA_FIXUP_ACT_INIT:
6913 		alc_combo_jack_hp_jd_restart(codec);
6914 		break;
6915 	}
6916 }
6917 
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6918 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6919 				    const struct hda_fixup *fix, int action)
6920 {
6921 	struct alc_spec *spec = codec->spec;
6922 
6923 	switch (action) {
6924 	case HDA_FIXUP_ACT_PRE_PROBE:
6925 		/* Mic RING SLEEVE swap for combo jack */
6926 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6927 		spec->no_internal_mic_pin = true;
6928 		break;
6929 	case HDA_FIXUP_ACT_INIT:
6930 		alc_combo_jack_hp_jd_restart(codec);
6931 		break;
6932 	}
6933 }
6934 
6935 /* GPIO1 = amplifier on/off
6936  * GPIO3 = mic mute LED
6937  */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6938 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6939 					  const struct hda_fixup *fix, int action)
6940 {
6941 	static const hda_nid_t conn[] = { 0x02 };
6942 
6943 	struct alc_spec *spec = codec->spec;
6944 	static const struct hda_pintbl pincfgs[] = {
6945 		{ 0x14, 0x90170110 },  /* front/high speakers */
6946 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6947 		{ }
6948 	};
6949 
6950 	//enable micmute led
6951 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6952 
6953 	switch (action) {
6954 	case HDA_FIXUP_ACT_PRE_PROBE:
6955 		spec->micmute_led_polarity = 1;
6956 		/* needed for amp of back speakers */
6957 		spec->gpio_mask |= 0x01;
6958 		spec->gpio_dir |= 0x01;
6959 		snd_hda_apply_pincfgs(codec, pincfgs);
6960 		/* share DAC to have unified volume control */
6961 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6962 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6963 		break;
6964 	case HDA_FIXUP_ACT_INIT:
6965 		/* need to toggle GPIO to enable the amp of back speakers */
6966 		alc_update_gpio_data(codec, 0x01, true);
6967 		msleep(100);
6968 		alc_update_gpio_data(codec, 0x01, false);
6969 		break;
6970 	}
6971 }
6972 
6973 /* GPIO1 = amplifier on/off */
alc285_fixup_hp_spectre_x360_df1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6974 static void alc285_fixup_hp_spectre_x360_df1(struct hda_codec *codec,
6975 					     const struct hda_fixup *fix,
6976 					     int action)
6977 {
6978 	struct alc_spec *spec = codec->spec;
6979 	static const hda_nid_t conn[] = { 0x02 };
6980 	static const struct hda_pintbl pincfgs[] = {
6981 		{ 0x14, 0x90170110 },  /* front/high speakers */
6982 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6983 		{ }
6984 	};
6985 
6986 	// enable mute led
6987 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
6988 
6989 	switch (action) {
6990 	case HDA_FIXUP_ACT_PRE_PROBE:
6991 		/* needed for amp of back speakers */
6992 		spec->gpio_mask |= 0x01;
6993 		spec->gpio_dir |= 0x01;
6994 		snd_hda_apply_pincfgs(codec, pincfgs);
6995 		/* share DAC to have unified volume control */
6996 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6997 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6998 		break;
6999 	case HDA_FIXUP_ACT_INIT:
7000 		/* need to toggle GPIO to enable the amp of back speakers */
7001 		alc_update_gpio_data(codec, 0x01, true);
7002 		msleep(100);
7003 		alc_update_gpio_data(codec, 0x01, false);
7004 		break;
7005 	}
7006 }
7007 
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)7008 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
7009 					  const struct hda_fixup *fix, int action)
7010 {
7011 	static const hda_nid_t conn[] = { 0x02 };
7012 	static const struct hda_pintbl pincfgs[] = {
7013 		{ 0x14, 0x90170110 },  /* rear speaker */
7014 		{ }
7015 	};
7016 
7017 	switch (action) {
7018 	case HDA_FIXUP_ACT_PRE_PROBE:
7019 		snd_hda_apply_pincfgs(codec, pincfgs);
7020 		/* force front speaker to DAC1 */
7021 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7022 		break;
7023 	}
7024 }
7025 
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)7026 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
7027 				      const struct hda_fixup *fix,
7028 				      int action)
7029 {
7030 	static const struct coef_fw coefs[] = {
7031 		WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
7032 		WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
7033 		WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
7034 		WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
7035 		WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
7036 		WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
7037 		WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
7038 		WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
7039 		WRITE_COEF(0x6e, 0x1005), { }
7040 	};
7041 
7042 	static const struct hda_pintbl pincfgs[] = {
7043 		{ 0x12, 0xb7a60130 },  /* Internal microphone*/
7044 		{ 0x14, 0x90170150 },  /* B&O soundbar speakers */
7045 		{ 0x17, 0x90170153 },  /* Side speakers */
7046 		{ 0x19, 0x03a11040 },  /* Headset microphone */
7047 		{ }
7048 	};
7049 
7050 	switch (action) {
7051 	case HDA_FIXUP_ACT_PRE_PROBE:
7052 		snd_hda_apply_pincfgs(codec, pincfgs);
7053 
7054 		/* Fixes volume control problem for side speakers */
7055 		alc295_fixup_disable_dac3(codec, fix, action);
7056 
7057 		/* Fixes no sound from headset speaker */
7058 		snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
7059 
7060 		/* Auto-enable headset mic when plugged */
7061 		snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
7062 
7063 		/* Headset mic volume enhancement */
7064 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
7065 		break;
7066 	case HDA_FIXUP_ACT_INIT:
7067 		alc_process_coef_fw(codec, coefs);
7068 		break;
7069 	case HDA_FIXUP_ACT_BUILD:
7070 		rename_ctl(codec, "Bass Speaker Playback Volume",
7071 			   "B&O-Tuned Playback Volume");
7072 		rename_ctl(codec, "Front Playback Switch",
7073 			   "B&O Soundbar Playback Switch");
7074 		rename_ctl(codec, "Bass Speaker Playback Switch",
7075 			   "Side Speaker Playback Switch");
7076 		break;
7077 	}
7078 }
7079 
alc285_fixup_hp_beep(struct hda_codec * codec,const struct hda_fixup * fix,int action)7080 static void alc285_fixup_hp_beep(struct hda_codec *codec,
7081 				 const struct hda_fixup *fix, int action)
7082 {
7083 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7084 		codec->beep_just_power_on = true;
7085 	} else  if (action == HDA_FIXUP_ACT_INIT) {
7086 #ifdef CONFIG_SND_HDA_INPUT_BEEP
7087 		/*
7088 		 * Just enable loopback to internal speaker and headphone jack.
7089 		 * Disable amplification to get about the same beep volume as
7090 		 * was on pure BIOS setup before loading the driver.
7091 		 */
7092 		alc_update_coef_idx(codec, 0x36, 0x7070, BIT(13));
7093 
7094 		snd_hda_enable_beep_device(codec, 1);
7095 
7096 #if !IS_ENABLED(CONFIG_INPUT_PCSPKR)
7097 		dev_warn_once(hda_codec_dev(codec),
7098 			      "enable CONFIG_INPUT_PCSPKR to get PC beeps\n");
7099 #endif
7100 #endif
7101 	}
7102 }
7103 
7104 /* for hda_fixup_thinkpad_acpi() */
7105 #include "thinkpad_helper.c"
7106 
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)7107 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
7108 				    const struct hda_fixup *fix, int action)
7109 {
7110 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
7111 	hda_fixup_thinkpad_acpi(codec, fix, action);
7112 }
7113 
7114 /* 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)7115 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
7116 						  const struct hda_fixup *fix,
7117 						  int action)
7118 {
7119 	struct alc_spec *spec = codec->spec;
7120 
7121 	switch (action) {
7122 	case HDA_FIXUP_ACT_PRE_PROBE:
7123 		spec->gen.suppress_auto_mute = 1;
7124 		break;
7125 	}
7126 }
7127 
comp_acpi_device_notify(acpi_handle handle,u32 event,void * data)7128 static void comp_acpi_device_notify(acpi_handle handle, u32 event, void *data)
7129 {
7130 	struct hda_codec *cdc = data;
7131 	struct alc_spec *spec = cdc->spec;
7132 
7133 	codec_info(cdc, "ACPI Notification %d\n", event);
7134 
7135 	hda_component_acpi_device_notify(&spec->comps, handle, event, data);
7136 }
7137 
comp_bind(struct device * dev)7138 static int comp_bind(struct device *dev)
7139 {
7140 	struct hda_codec *cdc = dev_to_hda_codec(dev);
7141 	struct alc_spec *spec = cdc->spec;
7142 	int ret;
7143 
7144 	ret = hda_component_manager_bind(cdc, &spec->comps);
7145 	if (ret)
7146 		return ret;
7147 
7148 	return hda_component_manager_bind_acpi_notifications(cdc,
7149 							     &spec->comps,
7150 							     comp_acpi_device_notify, cdc);
7151 }
7152 
comp_unbind(struct device * dev)7153 static void comp_unbind(struct device *dev)
7154 {
7155 	struct hda_codec *cdc = dev_to_hda_codec(dev);
7156 	struct alc_spec *spec = cdc->spec;
7157 
7158 	hda_component_manager_unbind_acpi_notifications(cdc, &spec->comps, comp_acpi_device_notify);
7159 	hda_component_manager_unbind(cdc, &spec->comps);
7160 }
7161 
7162 static const struct component_master_ops comp_master_ops = {
7163 	.bind = comp_bind,
7164 	.unbind = comp_unbind,
7165 };
7166 
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)7167 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
7168 				       struct snd_pcm_substream *sub, int action)
7169 {
7170 	struct alc_spec *spec = cdc->spec;
7171 
7172 	hda_component_manager_playback_hook(&spec->comps, action);
7173 }
7174 
comp_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,const char * match_str,int count)7175 static void comp_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
7176 			       const char *hid, const char *match_str, int count)
7177 {
7178 	struct alc_spec *spec = cdc->spec;
7179 	int ret;
7180 
7181 	switch (action) {
7182 	case HDA_FIXUP_ACT_PRE_PROBE:
7183 		ret = hda_component_manager_init(cdc, &spec->comps, count, bus, hid,
7184 						 match_str, &comp_master_ops);
7185 		if (ret)
7186 			return;
7187 
7188 		spec->gen.pcm_playback_hook = comp_generic_playback_hook;
7189 		break;
7190 	case HDA_FIXUP_ACT_FREE:
7191 		hda_component_manager_free(&spec->comps, &comp_master_ops);
7192 		break;
7193 	}
7194 }
7195 
find_cirrus_companion_amps(struct hda_codec * cdc)7196 static void find_cirrus_companion_amps(struct hda_codec *cdc)
7197 {
7198 	struct device *dev = hda_codec_dev(cdc);
7199 	struct acpi_device *adev;
7200 	struct fwnode_handle *fwnode __free(fwnode_handle) = NULL;
7201 	const char *bus = NULL;
7202 	static const struct {
7203 		const char *hid;
7204 		const char *name;
7205 	} acpi_ids[] = {{ "CSC3554", "cs35l54-hda" },
7206 			{ "CSC3556", "cs35l56-hda" },
7207 			{ "CSC3557", "cs35l57-hda" }};
7208 	char *match;
7209 	int i, count = 0, count_devindex = 0;
7210 
7211 	for (i = 0; i < ARRAY_SIZE(acpi_ids); ++i) {
7212 		adev = acpi_dev_get_first_match_dev(acpi_ids[i].hid, NULL, -1);
7213 		if (adev)
7214 			break;
7215 	}
7216 	if (!adev) {
7217 		codec_dbg(cdc, "Did not find ACPI entry for a Cirrus Amp\n");
7218 		return;
7219 	}
7220 
7221 	count = i2c_acpi_client_count(adev);
7222 	if (count > 0) {
7223 		bus = "i2c";
7224 	} else {
7225 		count = acpi_spi_count_resources(adev);
7226 		if (count > 0)
7227 			bus = "spi";
7228 	}
7229 
7230 	fwnode = fwnode_handle_get(acpi_fwnode_handle(adev));
7231 	acpi_dev_put(adev);
7232 
7233 	if (!bus) {
7234 		codec_err(cdc, "Did not find any buses for %s\n", acpi_ids[i].hid);
7235 		return;
7236 	}
7237 
7238 	if (!fwnode) {
7239 		codec_err(cdc, "Could not get fwnode for %s\n", acpi_ids[i].hid);
7240 		return;
7241 	}
7242 
7243 	/*
7244 	 * When available the cirrus,dev-index property is an accurate
7245 	 * count of the amps in a system and is used in preference to
7246 	 * the count of bus devices that can contain additional address
7247 	 * alias entries.
7248 	 */
7249 	count_devindex = fwnode_property_count_u32(fwnode, "cirrus,dev-index");
7250 	if (count_devindex > 0)
7251 		count = count_devindex;
7252 
7253 	match = devm_kasprintf(dev, GFP_KERNEL, "-%%s:00-%s.%%d", acpi_ids[i].name);
7254 	if (!match)
7255 		return;
7256 	codec_info(cdc, "Found %d %s on %s (%s)\n", count, acpi_ids[i].hid, bus, match);
7257 	comp_generic_fixup(cdc, HDA_FIXUP_ACT_PRE_PROBE, bus, acpi_ids[i].hid, match, count);
7258 }
7259 
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7260 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7261 {
7262 	comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
7263 }
7264 
cs35l41_fixup_i2c_four(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7265 static void cs35l41_fixup_i2c_four(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7266 {
7267 	comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
7268 }
7269 
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)7270 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7271 {
7272 	comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
7273 }
7274 
cs35l41_fixup_spi_one(struct hda_codec * codec,const struct hda_fixup * fix,int action)7275 static void cs35l41_fixup_spi_one(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7276 {
7277 	comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 1);
7278 }
7279 
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)7280 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7281 {
7282 	comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
7283 }
7284 
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7285 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7286 						 int action)
7287 {
7288 	comp_generic_fixup(cdc, action, "i2c", "CLSA0100", "-%s:00-cs35l41-hda.%d", 2);
7289 }
7290 
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7291 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7292 						 int action)
7293 {
7294 	comp_generic_fixup(cdc, action, "i2c", "CLSA0101", "-%s:00-cs35l41-hda.%d", 2);
7295 }
7296 
alc285_fixup_asus_ga403u(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7297 static void alc285_fixup_asus_ga403u(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7298 {
7299 	/*
7300 	 * The same SSID has been re-used in different hardware, they have
7301 	 * different codecs and the newer GA403U has a ALC285.
7302 	 */
7303 	if (cdc->core.vendor_id != 0x10ec0285)
7304 		alc_fixup_inv_dmic(cdc, fix, action);
7305 }
7306 
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7307 static void tas2781_fixup_i2c(struct hda_codec *cdc,
7308 	const struct hda_fixup *fix, int action)
7309 {
7310 	comp_generic_fixup(cdc, action, "i2c", "TIAS2781", "-%s:00", 1);
7311 }
7312 
yoga7_14arb7_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7313 static void yoga7_14arb7_fixup_i2c(struct hda_codec *cdc,
7314 	const struct hda_fixup *fix, int action)
7315 {
7316 	comp_generic_fixup(cdc, action, "i2c", "INT8866", "-%s:00", 1);
7317 }
7318 
alc256_fixup_acer_sfg16_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)7319 static void alc256_fixup_acer_sfg16_micmute_led(struct hda_codec *codec,
7320 	const struct hda_fixup *fix, int action)
7321 {
7322 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
7323 }
7324 
7325 
7326 /* for alc295_fixup_hp_top_speakers */
7327 #include "hp_x360_helper.c"
7328 
7329 /* for alc285_fixup_ideapad_s740_coef() */
7330 #include "ideapad_s740_helper.c"
7331 
7332 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
7333 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
7334 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
7335 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
7336 	{}
7337 };
7338 
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)7339 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
7340 					   const struct hda_fixup *fix,
7341 					   int action)
7342 {
7343 	/*
7344 	 * A certain other OS sets these coeffs to different values. On at least
7345 	 * one TongFang barebone these settings might survive even a cold
7346 	 * reboot. So to restore a clean slate the values are explicitly reset
7347 	 * to default here. Without this, the external microphone is always in a
7348 	 * plugged-in state, while the internal microphone is always in an
7349 	 * unplugged state, breaking the ability to use the internal microphone.
7350 	 */
7351 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7352 }
7353 
7354 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7355 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7356 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7357 	WRITE_COEF(0x49, 0x0149),
7358 	{}
7359 };
7360 
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7361 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7362 				       const struct hda_fixup *fix,
7363 				       int action)
7364 {
7365 	/*
7366 	 * The audio jack input and output is not detected on the ASRock NUC Box
7367 	 * 1100 series when cold booting without this fix. Warm rebooting from a
7368 	 * certain other OS makes the audio functional, as COEF settings are
7369 	 * preserved in this case. This fix sets these altered COEF values as
7370 	 * the default.
7371 	 */
7372 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7373 }
7374 
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7375 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7376 						    const struct hda_fixup *fix,
7377 						    int action)
7378 {
7379 	/*
7380 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7381 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7382 	 * needs an additional quirk for sound working after suspend and resume.
7383 	 */
7384 	if (codec->core.vendor_id == 0x10ec0256) {
7385 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7386 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7387 	} else {
7388 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7389 	}
7390 }
7391 
alc256_decrease_headphone_amp_val(struct hda_codec * codec,const struct hda_fixup * fix,int action)7392 static void alc256_decrease_headphone_amp_val(struct hda_codec *codec,
7393 					      const struct hda_fixup *fix, int action)
7394 {
7395 	u32 caps;
7396 	u8 nsteps, offs;
7397 
7398 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7399 		return;
7400 
7401 	caps = query_amp_caps(codec, 0x3, HDA_OUTPUT);
7402 	nsteps = ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) - 10;
7403 	offs = ((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT) - 10;
7404 	caps &= ~AC_AMPCAP_NUM_STEPS & ~AC_AMPCAP_OFFSET;
7405 	caps |= (nsteps << AC_AMPCAP_NUM_STEPS_SHIFT) | (offs << AC_AMPCAP_OFFSET_SHIFT);
7406 
7407 	if (snd_hda_override_amp_caps(codec, 0x3, HDA_OUTPUT, caps))
7408 		codec_warn(codec, "failed to override amp caps for NID 0x3\n");
7409 }
7410 
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7411 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7412 						  const struct hda_fixup *fix,
7413 						  int action)
7414 {
7415 	struct alc_spec *spec = codec->spec;
7416 	struct hda_input_mux *imux = &spec->gen.input_mux;
7417 	int i;
7418 
7419 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
7420 
7421 	switch (action) {
7422 	case HDA_FIXUP_ACT_PRE_PROBE:
7423 		/**
7424 		 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7425 		 * to Hi-Z to avoid pop noises at startup and when plugging and
7426 		 * unplugging headphones.
7427 		 */
7428 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7429 		snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7430 		break;
7431 	case HDA_FIXUP_ACT_PROBE:
7432 		/**
7433 		 * Make the internal mic (0x12) the default input source to
7434 		 * prevent pop noises on cold boot.
7435 		 */
7436 		for (i = 0; i < imux->num_items; i++) {
7437 			if (spec->gen.imux_pins[i] == 0x12) {
7438 				spec->gen.cur_mux[0] = i;
7439 				break;
7440 			}
7441 		}
7442 		break;
7443 	}
7444 }
7445 
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7446 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7447 					  const struct hda_fixup *fix, int action)
7448 {
7449 	/*
7450 	 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7451 	 * unconnected.
7452 	 */
7453 	static const struct hda_pintbl pincfgs[] = {
7454 		{ 0x17, 0x90170121 },
7455 		{ }
7456 	};
7457 	/*
7458 	 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7459 	 * DAC 0x02 and 0x03 would be fine.
7460 	 */
7461 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7462 	/*
7463 	 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7464 	 * Headphones (0x21) are connected to DAC 0x03.
7465 	 */
7466 	static const hda_nid_t preferred_pairs[] = {
7467 		0x14, 0x02,
7468 		0x17, 0x02,
7469 		0x21, 0x03,
7470 		0
7471 	};
7472 	struct alc_spec *spec = codec->spec;
7473 
7474 	switch (action) {
7475 	case HDA_FIXUP_ACT_PRE_PROBE:
7476 		snd_hda_apply_pincfgs(codec, pincfgs);
7477 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7478 		spec->gen.preferred_dacs = preferred_pairs;
7479 		break;
7480 	}
7481 }
7482 
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7483 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7484 					  const struct hda_fixup *fix, int action)
7485 {
7486 	static const struct hda_pintbl pincfgs[] = {
7487 		{ 0x14, 0x90170151 },
7488 		{ 0x17, 0x90170150 },
7489 		{ }
7490 	};
7491 	static const hda_nid_t conn[] = { 0x02, 0x03 };
7492 	static const hda_nid_t preferred_pairs[] = {
7493 		0x14, 0x02,
7494 		0x17, 0x03,
7495 		0x21, 0x02,
7496 		0
7497 	};
7498 	struct alc_spec *spec = codec->spec;
7499 
7500 	alc_fixup_no_shutup(codec, fix, action);
7501 
7502 	switch (action) {
7503 	case HDA_FIXUP_ACT_PRE_PROBE:
7504 		snd_hda_apply_pincfgs(codec, pincfgs);
7505 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7506 		spec->gen.preferred_dacs = preferred_pairs;
7507 		break;
7508 	}
7509 }
7510 
7511 /* 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)7512 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7513 				    const struct hda_fixup *fix, int action)
7514 {
7515 	struct alc_spec *spec = codec->spec;
7516 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7517 	static const hda_nid_t preferred_pairs[] = {
7518 		0x17, 0x02, 0x21, 0x03, 0
7519 	};
7520 
7521 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7522 		return;
7523 
7524 	snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7525 	spec->gen.preferred_dacs = preferred_pairs;
7526 	spec->gen.auto_mute_via_amp = 1;
7527 	if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7528 		snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7529 					0x0); /* Make sure 0x14 was disable */
7530 	}
7531 }
7532 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7533 static void alc_fixup_headset_mic(struct hda_codec *codec,
7534 				   const struct hda_fixup *fix, int action)
7535 {
7536 	struct alc_spec *spec = codec->spec;
7537 	static const struct hda_pintbl pincfgs[] = {
7538 		{ 0x19, 0x03a1103c },
7539 		{ }
7540 	};
7541 
7542 	switch (action) {
7543 	case HDA_FIXUP_ACT_PRE_PROBE:
7544 		snd_hda_apply_pincfgs(codec, pincfgs);
7545 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7546 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7547 		break;
7548 	}
7549 }
7550 
alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec * codec,const struct hda_fixup * fix,int action)7551 static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec,
7552 					  const struct hda_fixup *fix, int action)
7553 {
7554 	/*
7555 	 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
7556 	 * unconnected.
7557 	 * The Pin Complex 0x17 for the bass speakers has the lowest association
7558 	 * and sequence values so shift it up a bit to squeeze 0x14 in.
7559 	 */
7560 	static const struct hda_pintbl pincfgs[] = {
7561 		{ 0x14, 0x90170110 }, // top/treble
7562 		{ 0x17, 0x90170111 }, // bottom/bass
7563 		{ }
7564 	};
7565 
7566 	/*
7567 	 * Force DAC 0x02 for the bass speakers 0x17.
7568 	 */
7569 	static const hda_nid_t conn[] = { 0x02 };
7570 
7571 	switch (action) {
7572 	case HDA_FIXUP_ACT_PRE_PROBE:
7573 		snd_hda_apply_pincfgs(codec, pincfgs);
7574 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7575 		break;
7576 	}
7577 
7578 	cs35l41_fixup_i2c_two(codec, fix, action);
7579 	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7580 	alc245_fixup_hp_gpio_led(codec, fix, action);
7581 }
7582 
7583 /* 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)7584 static void alc245_fixup_hp_spectre_x360_16_aa0xxx(struct hda_codec *codec,
7585 					  const struct hda_fixup *fix, int action)
7586 {
7587 	/*
7588 	 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
7589 	 * unconnected.
7590 	 * The Pin Complex 0x17 for the bass speakers has the lowest association
7591 	 * and sequence values so shift it up a bit to squeeze 0x14 in.
7592 	 */
7593 	struct alc_spec *spec = codec->spec;
7594 	static const struct hda_pintbl pincfgs[] = {
7595 		{ 0x14, 0x90170110 }, // top/treble
7596 		{ 0x17, 0x90170111 }, // bottom/bass
7597 		{ }
7598 	};
7599 
7600 	/*
7601 	 * Force DAC 0x02 for the bass speakers 0x17.
7602 	 */
7603 	static const hda_nid_t conn[] = { 0x02 };
7604 
7605 	switch (action) {
7606 	case HDA_FIXUP_ACT_PRE_PROBE:
7607 		/* needed for amp of back speakers */
7608 		spec->gpio_mask |= 0x01;
7609 		spec->gpio_dir |= 0x01;
7610 		snd_hda_apply_pincfgs(codec, pincfgs);
7611 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7612 		break;
7613 	case HDA_FIXUP_ACT_INIT:
7614 		/* need to toggle GPIO to enable the amp of back speakers */
7615 		alc_update_gpio_data(codec, 0x01, true);
7616 		msleep(100);
7617 		alc_update_gpio_data(codec, 0x01, false);
7618 		break;
7619 	}
7620 
7621 	cs35l41_fixup_i2c_two(codec, fix, action);
7622 	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7623 	alc245_fixup_hp_gpio_led(codec, fix, action);
7624 }
7625 
alc245_fixup_hp_zbook_firefly_g12a(struct hda_codec * codec,const struct hda_fixup * fix,int action)7626 static void alc245_fixup_hp_zbook_firefly_g12a(struct hda_codec *codec,
7627 					  const struct hda_fixup *fix, int action)
7628 {
7629 	struct alc_spec *spec = codec->spec;
7630 	static const hda_nid_t conn[] = { 0x02 };
7631 
7632 	switch (action) {
7633 	case HDA_FIXUP_ACT_PRE_PROBE:
7634 		spec->gen.auto_mute_via_amp = 1;
7635 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7636 		break;
7637 	}
7638 
7639 	cs35l41_fixup_i2c_two(codec, fix, action);
7640 	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7641 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
7642 }
7643 
7644 /*
7645  * ALC287 PCM hooks
7646  */
alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)7647 static void alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream *hinfo,
7648 				   struct hda_codec *codec,
7649 				   struct snd_pcm_substream *substream,
7650 				   int action)
7651 {
7652 	switch (action) {
7653 	case HDA_GEN_PCM_ACT_OPEN:
7654 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x954f); /* write gpio3 to high */
7655 		break;
7656 	case HDA_GEN_PCM_ACT_CLOSE:
7657 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7658 		break;
7659 	}
7660 }
7661 
alc287_s4_power_gpio3_default(struct hda_codec * codec)7662 static void alc287_s4_power_gpio3_default(struct hda_codec *codec)
7663 {
7664 	if (is_s4_suspend(codec)) {
7665 		alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7666 	}
7667 }
7668 
alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec * codec,const struct hda_fixup * fix,int action)7669 static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec,
7670 			       const struct hda_fixup *fix, int action)
7671 {
7672 	struct alc_spec *spec = codec->spec;
7673 	static const struct coef_fw coefs[] = {
7674 		WRITE_COEF(0x24, 0x0013), WRITE_COEF(0x25, 0x0000), WRITE_COEF(0x26, 0xC300),
7675 		WRITE_COEF(0x28, 0x0001), WRITE_COEF(0x29, 0xb023),
7676 		WRITE_COEF(0x24, 0x0013), WRITE_COEF(0x25, 0x0000), WRITE_COEF(0x26, 0xC301),
7677 		WRITE_COEF(0x28, 0x0001), WRITE_COEF(0x29, 0xb023),
7678 	};
7679 
7680 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
7681 		return;
7682 	alc_update_coef_idx(codec, 0x10, 1<<11, 1<<11);
7683 	alc_process_coef_fw(codec, coefs);
7684 	spec->power_hook = alc287_s4_power_gpio3_default;
7685 	spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook;
7686 }
7687 
7688 /*
7689  * Clear COEF 0x0d (PCBEEP passthrough) bit 0x40 where BIOS sets it wrongly
7690  * at PM resume
7691  */
alc283_fixup_dell_hp_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7692 static void alc283_fixup_dell_hp_resume(struct hda_codec *codec,
7693 					const struct hda_fixup *fix, int action)
7694 {
7695 	if (action == HDA_FIXUP_ACT_INIT)
7696 		alc_write_coef_idx(codec, 0xd, 0x2800);
7697 }
7698 
7699 enum {
7700 	ALC269_FIXUP_GPIO2,
7701 	ALC269_FIXUP_SONY_VAIO,
7702 	ALC275_FIXUP_SONY_VAIO_GPIO2,
7703 	ALC269_FIXUP_DELL_M101Z,
7704 	ALC269_FIXUP_SKU_IGNORE,
7705 	ALC269_FIXUP_ASUS_G73JW,
7706 	ALC269_FIXUP_ASUS_N7601ZM_PINS,
7707 	ALC269_FIXUP_ASUS_N7601ZM,
7708 	ALC269_FIXUP_LENOVO_EAPD,
7709 	ALC275_FIXUP_SONY_HWEQ,
7710 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
7711 	ALC271_FIXUP_DMIC,
7712 	ALC269_FIXUP_PCM_44K,
7713 	ALC269_FIXUP_STEREO_DMIC,
7714 	ALC269_FIXUP_HEADSET_MIC,
7715 	ALC269_FIXUP_QUANTA_MUTE,
7716 	ALC269_FIXUP_LIFEBOOK,
7717 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
7718 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
7719 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7720 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7721 	ALC269_FIXUP_AMIC,
7722 	ALC269_FIXUP_DMIC,
7723 	ALC269VB_FIXUP_AMIC,
7724 	ALC269VB_FIXUP_DMIC,
7725 	ALC269_FIXUP_HP_MUTE_LED,
7726 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
7727 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
7728 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
7729 	ALC269_FIXUP_HP_GPIO_LED,
7730 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
7731 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
7732 	ALC269_FIXUP_INV_DMIC,
7733 	ALC269_FIXUP_LENOVO_DOCK,
7734 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7735 	ALC269_FIXUP_NO_SHUTUP,
7736 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7737 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7738 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7739 	ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7740 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7741 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7742 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7743 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7744 	ALC269_FIXUP_HEADSET_MODE,
7745 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7746 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7747 	ALC269_FIXUP_ASUS_X101_FUNC,
7748 	ALC269_FIXUP_ASUS_X101_VERB,
7749 	ALC269_FIXUP_ASUS_X101,
7750 	ALC271_FIXUP_AMIC_MIC2,
7751 	ALC271_FIXUP_HP_GATE_MIC_JACK,
7752 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7753 	ALC269_FIXUP_ACER_AC700,
7754 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7755 	ALC269VB_FIXUP_ASUS_ZENBOOK,
7756 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7757 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7758 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7759 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
7760 	ALC283_FIXUP_CHROME_BOOK,
7761 	ALC283_FIXUP_SENSE_COMBO_JACK,
7762 	ALC282_FIXUP_ASUS_TX300,
7763 	ALC283_FIXUP_INT_MIC,
7764 	ALC290_FIXUP_MONO_SPEAKERS,
7765 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7766 	ALC290_FIXUP_SUBWOOFER,
7767 	ALC290_FIXUP_SUBWOOFER_HSJACK,
7768 	ALC295_FIXUP_HP_MUTE_LED_COEFBIT11,
7769 	ALC269_FIXUP_THINKPAD_ACPI,
7770 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7771 	ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
7772 	ALC269VC_FIXUP_INFINIX_Y4_MAX,
7773 	ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7774 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7775 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7776 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7777 	ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7778 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7779 	ALC255_FIXUP_HEADSET_MODE,
7780 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7781 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7782 	ALC292_FIXUP_TPT440_DOCK,
7783 	ALC292_FIXUP_TPT440,
7784 	ALC283_FIXUP_HEADSET_MIC,
7785 	ALC255_FIXUP_MIC_MUTE_LED,
7786 	ALC282_FIXUP_ASPIRE_V5_PINS,
7787 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
7788 	ALC280_FIXUP_HP_GPIO4,
7789 	ALC286_FIXUP_HP_GPIO_LED,
7790 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7791 	ALC280_FIXUP_HP_DOCK_PINS,
7792 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7793 	ALC280_FIXUP_HP_9480M,
7794 	ALC245_FIXUP_HP_X360_AMP,
7795 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7796 	ALC285_FIXUP_HP_SPECTRE_X360_DF1,
7797 	ALC285_FIXUP_HP_ENVY_X360,
7798 	ALC288_FIXUP_DELL_HEADSET_MODE,
7799 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7800 	ALC288_FIXUP_DELL_XPS_13,
7801 	ALC288_FIXUP_DISABLE_AAMIX,
7802 	ALC292_FIXUP_DELL_E7X_AAMIX,
7803 	ALC292_FIXUP_DELL_E7X,
7804 	ALC292_FIXUP_DISABLE_AAMIX,
7805 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7806 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7807 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7808 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7809 	ALC275_FIXUP_DELL_XPS,
7810 	ALC293_FIXUP_LENOVO_SPK_NOISE,
7811 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7812 	ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED,
7813 	ALC255_FIXUP_DELL_SPK_NOISE,
7814 	ALC225_FIXUP_DISABLE_MIC_VREF,
7815 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7816 	ALC295_FIXUP_DISABLE_DAC3,
7817 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
7818 	ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7819 	ALC285_FIXUP_ASUS_HEADSET_MIC,
7820 	ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7821 	ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7822 	ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7823 	ALC280_FIXUP_HP_HEADSET_MIC,
7824 	ALC221_FIXUP_HP_FRONT_MIC,
7825 	ALC292_FIXUP_TPT460,
7826 	ALC298_FIXUP_SPK_VOLUME,
7827 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
7828 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7829 	ALC269_FIXUP_ATIV_BOOK_8,
7830 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7831 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7832 	ALC256_FIXUP_ASUS_HEADSET_MODE,
7833 	ALC256_FIXUP_ASUS_MIC,
7834 	ALC256_FIXUP_ASUS_AIO_GPIO2,
7835 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7836 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7837 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
7838 	ALC233_FIXUP_ACER_HEADSET_MIC,
7839 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
7840 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7841 	ALC225_FIXUP_S3_POP_NOISE,
7842 	ALC700_FIXUP_INTEL_REFERENCE,
7843 	ALC274_FIXUP_DELL_BIND_DACS,
7844 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7845 	ALC298_FIXUP_TPT470_DOCK_FIX,
7846 	ALC298_FIXUP_TPT470_DOCK,
7847 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7848 	ALC255_FIXUP_DELL_HEADSET_MIC,
7849 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7850 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
7851 	ALC295_FIXUP_HP_X360,
7852 	ALC221_FIXUP_HP_HEADSET_MIC,
7853 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7854 	ALC295_FIXUP_HP_AUTO_MUTE,
7855 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7856 	ALC294_FIXUP_ASUS_MIC,
7857 	ALC294_FIXUP_ASUS_HEADSET_MIC,
7858 	ALC294_FIXUP_ASUS_SPK,
7859 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7860 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7861 	ALC255_FIXUP_ACER_HEADSET_MIC,
7862 	ALC295_FIXUP_CHROME_BOOK,
7863 	ALC225_FIXUP_HEADSET_JACK,
7864 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7865 	ALC225_FIXUP_WYSE_AUTO_MUTE,
7866 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7867 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7868 	ALC256_FIXUP_ASUS_HEADSET_MIC,
7869 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7870 	ALC255_FIXUP_PREDATOR_SUBWOOFER,
7871 	ALC299_FIXUP_PREDATOR_SPK,
7872 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7873 	ALC289_FIXUP_DELL_SPK1,
7874 	ALC289_FIXUP_DELL_SPK2,
7875 	ALC289_FIXUP_DUAL_SPK,
7876 	ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7877 	ALC294_FIXUP_SPK2_TO_DAC1,
7878 	ALC294_FIXUP_ASUS_DUAL_SPK,
7879 	ALC285_FIXUP_THINKPAD_X1_GEN7,
7880 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7881 	ALC294_FIXUP_ASUS_ALLY,
7882 	ALC294_FIXUP_ASUS_ALLY_PINS,
7883 	ALC294_FIXUP_ASUS_ALLY_VERBS,
7884 	ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7885 	ALC294_FIXUP_ASUS_HPE,
7886 	ALC294_FIXUP_ASUS_COEF_1B,
7887 	ALC294_FIXUP_ASUS_GX502_HP,
7888 	ALC294_FIXUP_ASUS_GX502_PINS,
7889 	ALC294_FIXUP_ASUS_GX502_VERBS,
7890 	ALC294_FIXUP_ASUS_GU502_HP,
7891 	ALC294_FIXUP_ASUS_GU502_PINS,
7892 	ALC294_FIXUP_ASUS_GU502_VERBS,
7893 	ALC294_FIXUP_ASUS_G513_PINS,
7894 	ALC285_FIXUP_ASUS_G533Z_PINS,
7895 	ALC285_FIXUP_HP_GPIO_LED,
7896 	ALC285_FIXUP_HP_MUTE_LED,
7897 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7898 	ALC285_FIXUP_HP_BEEP_MICMUTE_LED,
7899 	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7900 	ALC236_FIXUP_HP_GPIO_LED,
7901 	ALC236_FIXUP_HP_MUTE_LED,
7902 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7903 	ALC236_FIXUP_LENOVO_INV_DMIC,
7904 	ALC298_FIXUP_SAMSUNG_AMP,
7905 	ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS,
7906 	ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS,
7907 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7908 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7909 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7910 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7911 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
7912 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7913 	ALC289_FIXUP_ASUS_GA401,
7914 	ALC289_FIXUP_ASUS_GA502,
7915 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7916 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
7917 	ALC269_FIXUP_CZC_B20,
7918 	ALC269_FIXUP_CZC_TMI,
7919 	ALC269_FIXUP_CZC_L101,
7920 	ALC269_FIXUP_LEMOTE_A1802,
7921 	ALC269_FIXUP_LEMOTE_A190X,
7922 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
7923 	ALC233_FIXUP_INTEL_NUC8_DMIC,
7924 	ALC233_FIXUP_INTEL_NUC8_BOOST,
7925 	ALC256_FIXUP_INTEL_NUC10,
7926 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7927 	ALC274_FIXUP_HP_MIC,
7928 	ALC274_FIXUP_HP_HEADSET_MIC,
7929 	ALC274_FIXUP_HP_ENVY_GPIO,
7930 	ALC274_FIXUP_ASUS_ZEN_AIO_27,
7931 	ALC256_FIXUP_ASUS_HPE,
7932 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7933 	ALC287_FIXUP_HP_GPIO_LED,
7934 	ALC256_FIXUP_HP_HEADSET_MIC,
7935 	ALC245_FIXUP_HP_GPIO_LED,
7936 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7937 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7938 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7939 	ALC256_FIXUP_ACER_HEADSET_MIC,
7940 	ALC285_FIXUP_IDEAPAD_S740_COEF,
7941 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7942 	ALC295_FIXUP_ASUS_DACS,
7943 	ALC295_FIXUP_HP_OMEN,
7944 	ALC285_FIXUP_HP_SPECTRE_X360,
7945 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7946 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7947 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7948 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7949 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7950 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7951 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7952 	ALC298_FIXUP_LENOVO_C940_DUET7,
7953 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
7954 	ALC256_FIXUP_SET_COEF_DEFAULTS,
7955 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7956 	ALC233_FIXUP_NO_AUDIO_JACK,
7957 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7958 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7959 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7960 	ALC287_FIXUP_LEGION_16ACHG6,
7961 	ALC287_FIXUP_CS35L41_I2C_2,
7962 	ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7963 	ALC287_FIXUP_CS35L41_I2C_4,
7964 	ALC245_FIXUP_CS35L41_SPI_1,
7965 	ALC245_FIXUP_CS35L41_SPI_2,
7966 	ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7967 	ALC245_FIXUP_CS35L41_SPI_4,
7968 	ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7969 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7970 	ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7971 	ALC287_FIXUP_LEGION_16ITHG6,
7972 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7973 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7974 	ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7975 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7976 	ALC236_FIXUP_DELL_DUAL_CODECS,
7977 	ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7978 	ALC287_FIXUP_TAS2781_I2C,
7979 	ALC287_FIXUP_YOGA7_14ARB7_I2C,
7980 	ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7981 	ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT,
7982 	ALC245_FIXUP_HP_X360_MUTE_LEDS,
7983 	ALC287_FIXUP_THINKPAD_I2S_SPK,
7984 	ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7985 	ALC2XX_FIXUP_HEADSET_MIC,
7986 	ALC289_FIXUP_DELL_CS35L41_SPI_2,
7987 	ALC294_FIXUP_CS35L41_I2C_2,
7988 	ALC256_FIXUP_ACER_SFG16_MICMUTE_LED,
7989 	ALC256_FIXUP_HEADPHONE_AMP_VOL,
7990 	ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX,
7991 	ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX,
7992 	ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A,
7993 	ALC285_FIXUP_ASUS_GA403U,
7994 	ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC,
7995 	ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1,
7996 	ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
7997 	ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1,
7998 	ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318,
7999 	ALC256_FIXUP_CHROME_BOOK,
8000 	ALC245_FIXUP_CLEVO_NOISY_MIC,
8001 	ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE,
8002 	ALC233_FIXUP_MEDION_MTL_SPK,
8003 	ALC294_FIXUP_BASS_SPEAKER_15,
8004 	ALC283_FIXUP_DELL_HP_RESUME,
8005 	ALC294_FIXUP_ASUS_CS35L41_SPI_2,
8006 };
8007 
8008 /* A special fixup for Lenovo C940 and Yoga Duet 7;
8009  * both have the very same PCI SSID, and we need to apply different fixups
8010  * depending on the codec ID
8011  */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)8012 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
8013 					   const struct hda_fixup *fix,
8014 					   int action)
8015 {
8016 	int id;
8017 
8018 	if (codec->core.vendor_id == 0x10ec0298)
8019 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
8020 	else
8021 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
8022 	__snd_hda_apply_fixup(codec, id, action, 0);
8023 }
8024 
8025 static const struct hda_fixup alc269_fixups[] = {
8026 	[ALC269_FIXUP_GPIO2] = {
8027 		.type = HDA_FIXUP_FUNC,
8028 		.v.func = alc_fixup_gpio2,
8029 	},
8030 	[ALC269_FIXUP_SONY_VAIO] = {
8031 		.type = HDA_FIXUP_PINCTLS,
8032 		.v.pins = (const struct hda_pintbl[]) {
8033 			{0x19, PIN_VREFGRD},
8034 			{}
8035 		}
8036 	},
8037 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
8038 		.type = HDA_FIXUP_FUNC,
8039 		.v.func = alc275_fixup_gpio4_off,
8040 		.chained = true,
8041 		.chain_id = ALC269_FIXUP_SONY_VAIO
8042 	},
8043 	[ALC269_FIXUP_DELL_M101Z] = {
8044 		.type = HDA_FIXUP_VERBS,
8045 		.v.verbs = (const struct hda_verb[]) {
8046 			/* Enables internal speaker */
8047 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
8048 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
8049 			{}
8050 		}
8051 	},
8052 	[ALC269_FIXUP_SKU_IGNORE] = {
8053 		.type = HDA_FIXUP_FUNC,
8054 		.v.func = alc_fixup_sku_ignore,
8055 	},
8056 	[ALC269_FIXUP_ASUS_G73JW] = {
8057 		.type = HDA_FIXUP_PINS,
8058 		.v.pins = (const struct hda_pintbl[]) {
8059 			{ 0x17, 0x99130111 }, /* subwoofer */
8060 			{ }
8061 		}
8062 	},
8063 	[ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
8064 		.type = HDA_FIXUP_PINS,
8065 		.v.pins = (const struct hda_pintbl[]) {
8066 			{ 0x19, 0x03A11050 },
8067 			{ 0x1a, 0x03A11C30 },
8068 			{ 0x21, 0x03211420 },
8069 			{ }
8070 		}
8071 	},
8072 	[ALC269_FIXUP_ASUS_N7601ZM] = {
8073 		.type = HDA_FIXUP_VERBS,
8074 		.v.verbs = (const struct hda_verb[]) {
8075 			{0x20, AC_VERB_SET_COEF_INDEX, 0x62},
8076 			{0x20, AC_VERB_SET_PROC_COEF, 0xa007},
8077 			{0x20, AC_VERB_SET_COEF_INDEX, 0x10},
8078 			{0x20, AC_VERB_SET_PROC_COEF, 0x8420},
8079 			{0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
8080 			{0x20, AC_VERB_SET_PROC_COEF, 0x7774},
8081 			{ }
8082 		},
8083 		.chained = true,
8084 		.chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
8085 	},
8086 	[ALC269_FIXUP_LENOVO_EAPD] = {
8087 		.type = HDA_FIXUP_VERBS,
8088 		.v.verbs = (const struct hda_verb[]) {
8089 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
8090 			{}
8091 		}
8092 	},
8093 	[ALC275_FIXUP_SONY_HWEQ] = {
8094 		.type = HDA_FIXUP_FUNC,
8095 		.v.func = alc269_fixup_hweq,
8096 		.chained = true,
8097 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
8098 	},
8099 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
8100 		.type = HDA_FIXUP_FUNC,
8101 		.v.func = alc_fixup_disable_aamix,
8102 		.chained = true,
8103 		.chain_id = ALC269_FIXUP_SONY_VAIO
8104 	},
8105 	[ALC271_FIXUP_DMIC] = {
8106 		.type = HDA_FIXUP_FUNC,
8107 		.v.func = alc271_fixup_dmic,
8108 	},
8109 	[ALC269_FIXUP_PCM_44K] = {
8110 		.type = HDA_FIXUP_FUNC,
8111 		.v.func = alc269_fixup_pcm_44k,
8112 		.chained = true,
8113 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
8114 	},
8115 	[ALC269_FIXUP_STEREO_DMIC] = {
8116 		.type = HDA_FIXUP_FUNC,
8117 		.v.func = alc269_fixup_stereo_dmic,
8118 	},
8119 	[ALC269_FIXUP_HEADSET_MIC] = {
8120 		.type = HDA_FIXUP_FUNC,
8121 		.v.func = alc269_fixup_headset_mic,
8122 	},
8123 	[ALC269_FIXUP_QUANTA_MUTE] = {
8124 		.type = HDA_FIXUP_FUNC,
8125 		.v.func = alc269_fixup_quanta_mute,
8126 	},
8127 	[ALC269_FIXUP_LIFEBOOK] = {
8128 		.type = HDA_FIXUP_PINS,
8129 		.v.pins = (const struct hda_pintbl[]) {
8130 			{ 0x1a, 0x2101103f }, /* dock line-out */
8131 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
8132 			{ }
8133 		},
8134 		.chained = true,
8135 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
8136 	},
8137 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
8138 		.type = HDA_FIXUP_PINS,
8139 		.v.pins = (const struct hda_pintbl[]) {
8140 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
8141 			{ }
8142 		},
8143 	},
8144 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
8145 		.type = HDA_FIXUP_PINS,
8146 		.v.pins = (const struct hda_pintbl[]) {
8147 			{ 0x21, 0x0221102f }, /* HP out */
8148 			{ }
8149 		},
8150 	},
8151 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
8152 		.type = HDA_FIXUP_FUNC,
8153 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
8154 	},
8155 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
8156 		.type = HDA_FIXUP_FUNC,
8157 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
8158 	},
8159 	[ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13] = {
8160 		.type = HDA_FIXUP_PINS,
8161 		.v.pins = (const struct hda_pintbl[]) {
8162 			{ 0x14, 0x90170151 }, /* use as internal speaker (LFE) */
8163 			{ 0x1b, 0x90170152 }, /* use as internal speaker (back) */
8164 			{ }
8165 		},
8166 		.chained = true,
8167 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8168 	},
8169 	[ALC269VC_FIXUP_INFINIX_Y4_MAX] = {
8170 		.type = HDA_FIXUP_PINS,
8171 		.v.pins = (const struct hda_pintbl[]) {
8172 			{ 0x1b, 0x90170150 }, /* use as internal speaker */
8173 			{ }
8174 		},
8175 		.chained = true,
8176 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8177 	},
8178 	[ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
8179 		.type = HDA_FIXUP_PINS,
8180 		.v.pins = (const struct hda_pintbl[]) {
8181 			{ 0x18, 0x03a19020 }, /* headset mic */
8182 			{ 0x1b, 0x90170150 }, /* speaker */
8183 			{ }
8184 		},
8185 	},
8186 	[ALC269_FIXUP_AMIC] = {
8187 		.type = HDA_FIXUP_PINS,
8188 		.v.pins = (const struct hda_pintbl[]) {
8189 			{ 0x14, 0x99130110 }, /* speaker */
8190 			{ 0x15, 0x0121401f }, /* HP out */
8191 			{ 0x18, 0x01a19c20 }, /* mic */
8192 			{ 0x19, 0x99a3092f }, /* int-mic */
8193 			{ }
8194 		},
8195 	},
8196 	[ALC269_FIXUP_DMIC] = {
8197 		.type = HDA_FIXUP_PINS,
8198 		.v.pins = (const struct hda_pintbl[]) {
8199 			{ 0x12, 0x99a3092f }, /* int-mic */
8200 			{ 0x14, 0x99130110 }, /* speaker */
8201 			{ 0x15, 0x0121401f }, /* HP out */
8202 			{ 0x18, 0x01a19c20 }, /* mic */
8203 			{ }
8204 		},
8205 	},
8206 	[ALC269VB_FIXUP_AMIC] = {
8207 		.type = HDA_FIXUP_PINS,
8208 		.v.pins = (const struct hda_pintbl[]) {
8209 			{ 0x14, 0x99130110 }, /* speaker */
8210 			{ 0x18, 0x01a19c20 }, /* mic */
8211 			{ 0x19, 0x99a3092f }, /* int-mic */
8212 			{ 0x21, 0x0121401f }, /* HP out */
8213 			{ }
8214 		},
8215 	},
8216 	[ALC269VB_FIXUP_DMIC] = {
8217 		.type = HDA_FIXUP_PINS,
8218 		.v.pins = (const struct hda_pintbl[]) {
8219 			{ 0x12, 0x99a3092f }, /* int-mic */
8220 			{ 0x14, 0x99130110 }, /* speaker */
8221 			{ 0x18, 0x01a19c20 }, /* mic */
8222 			{ 0x21, 0x0121401f }, /* HP out */
8223 			{ }
8224 		},
8225 	},
8226 	[ALC269_FIXUP_HP_MUTE_LED] = {
8227 		.type = HDA_FIXUP_FUNC,
8228 		.v.func = alc269_fixup_hp_mute_led,
8229 	},
8230 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
8231 		.type = HDA_FIXUP_FUNC,
8232 		.v.func = alc269_fixup_hp_mute_led_mic1,
8233 	},
8234 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
8235 		.type = HDA_FIXUP_FUNC,
8236 		.v.func = alc269_fixup_hp_mute_led_mic2,
8237 	},
8238 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
8239 		.type = HDA_FIXUP_FUNC,
8240 		.v.func = alc269_fixup_hp_mute_led_mic3,
8241 		.chained = true,
8242 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
8243 	},
8244 	[ALC269_FIXUP_HP_GPIO_LED] = {
8245 		.type = HDA_FIXUP_FUNC,
8246 		.v.func = alc269_fixup_hp_gpio_led,
8247 	},
8248 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
8249 		.type = HDA_FIXUP_FUNC,
8250 		.v.func = alc269_fixup_hp_gpio_mic1_led,
8251 	},
8252 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
8253 		.type = HDA_FIXUP_FUNC,
8254 		.v.func = alc269_fixup_hp_line1_mic1_led,
8255 	},
8256 	[ALC269_FIXUP_INV_DMIC] = {
8257 		.type = HDA_FIXUP_FUNC,
8258 		.v.func = alc_fixup_inv_dmic,
8259 	},
8260 	[ALC269_FIXUP_NO_SHUTUP] = {
8261 		.type = HDA_FIXUP_FUNC,
8262 		.v.func = alc_fixup_no_shutup,
8263 	},
8264 	[ALC269_FIXUP_LENOVO_DOCK] = {
8265 		.type = HDA_FIXUP_PINS,
8266 		.v.pins = (const struct hda_pintbl[]) {
8267 			{ 0x19, 0x23a11040 }, /* dock mic */
8268 			{ 0x1b, 0x2121103f }, /* dock headphone */
8269 			{ }
8270 		},
8271 		.chained = true,
8272 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
8273 	},
8274 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
8275 		.type = HDA_FIXUP_FUNC,
8276 		.v.func = alc269_fixup_limit_int_mic_boost,
8277 		.chained = true,
8278 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
8279 	},
8280 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
8281 		.type = HDA_FIXUP_FUNC,
8282 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
8283 		.chained = true,
8284 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8285 	},
8286 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8287 		.type = HDA_FIXUP_PINS,
8288 		.v.pins = (const struct hda_pintbl[]) {
8289 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8290 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8291 			{ }
8292 		},
8293 		.chained = true,
8294 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8295 	},
8296 	[ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8297 		.type = HDA_FIXUP_FUNC,
8298 		.v.func = alc269_fixup_limit_int_mic_boost,
8299 		.chained = true,
8300 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8301 	},
8302 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8303 		.type = HDA_FIXUP_PINS,
8304 		.v.pins = (const struct hda_pintbl[]) {
8305 			{ 0x16, 0x21014020 }, /* dock line out */
8306 			{ 0x19, 0x21a19030 }, /* dock mic */
8307 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8308 			{ }
8309 		},
8310 		.chained = true,
8311 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8312 	},
8313 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
8314 		.type = HDA_FIXUP_PINS,
8315 		.v.pins = (const struct hda_pintbl[]) {
8316 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8317 			{ }
8318 		},
8319 		.chained = true,
8320 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8321 	},
8322 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
8323 		.type = HDA_FIXUP_PINS,
8324 		.v.pins = (const struct hda_pintbl[]) {
8325 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8326 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8327 			{ }
8328 		},
8329 		.chained = true,
8330 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8331 	},
8332 	[ALC269_FIXUP_HEADSET_MODE] = {
8333 		.type = HDA_FIXUP_FUNC,
8334 		.v.func = alc_fixup_headset_mode,
8335 		.chained = true,
8336 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8337 	},
8338 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8339 		.type = HDA_FIXUP_FUNC,
8340 		.v.func = alc_fixup_headset_mode_no_hp_mic,
8341 	},
8342 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
8343 		.type = HDA_FIXUP_PINS,
8344 		.v.pins = (const struct hda_pintbl[]) {
8345 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
8346 			{ }
8347 		},
8348 		.chained = true,
8349 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8350 	},
8351 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
8352 		.type = HDA_FIXUP_PINS,
8353 		.v.pins = (const struct hda_pintbl[]) {
8354 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8355 			{ }
8356 		},
8357 		.chained = true,
8358 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8359 	},
8360 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8361 		.type = HDA_FIXUP_PINS,
8362 		.v.pins = (const struct hda_pintbl[]) {
8363 			{0x12, 0x90a60130},
8364 			{0x13, 0x40000000},
8365 			{0x14, 0x90170110},
8366 			{0x18, 0x411111f0},
8367 			{0x19, 0x04a11040},
8368 			{0x1a, 0x411111f0},
8369 			{0x1b, 0x90170112},
8370 			{0x1d, 0x40759a05},
8371 			{0x1e, 0x411111f0},
8372 			{0x21, 0x04211020},
8373 			{ }
8374 		},
8375 		.chained = true,
8376 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8377 	},
8378 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
8379 		.type = HDA_FIXUP_FUNC,
8380 		.v.func = alc298_fixup_huawei_mbx_stereo,
8381 		.chained = true,
8382 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8383 	},
8384 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
8385 		.type = HDA_FIXUP_FUNC,
8386 		.v.func = alc269_fixup_x101_headset_mic,
8387 	},
8388 	[ALC269_FIXUP_ASUS_X101_VERB] = {
8389 		.type = HDA_FIXUP_VERBS,
8390 		.v.verbs = (const struct hda_verb[]) {
8391 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
8392 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8393 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
8394 			{ }
8395 		},
8396 		.chained = true,
8397 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
8398 	},
8399 	[ALC269_FIXUP_ASUS_X101] = {
8400 		.type = HDA_FIXUP_PINS,
8401 		.v.pins = (const struct hda_pintbl[]) {
8402 			{ 0x18, 0x04a1182c }, /* Headset mic */
8403 			{ }
8404 		},
8405 		.chained = true,
8406 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
8407 	},
8408 	[ALC271_FIXUP_AMIC_MIC2] = {
8409 		.type = HDA_FIXUP_PINS,
8410 		.v.pins = (const struct hda_pintbl[]) {
8411 			{ 0x14, 0x99130110 }, /* speaker */
8412 			{ 0x19, 0x01a19c20 }, /* mic */
8413 			{ 0x1b, 0x99a7012f }, /* int-mic */
8414 			{ 0x21, 0x0121401f }, /* HP out */
8415 			{ }
8416 		},
8417 	},
8418 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
8419 		.type = HDA_FIXUP_FUNC,
8420 		.v.func = alc271_hp_gate_mic_jack,
8421 		.chained = true,
8422 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
8423 	},
8424 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
8425 		.type = HDA_FIXUP_FUNC,
8426 		.v.func = alc269_fixup_limit_int_mic_boost,
8427 		.chained = true,
8428 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
8429 	},
8430 	[ALC269_FIXUP_ACER_AC700] = {
8431 		.type = HDA_FIXUP_PINS,
8432 		.v.pins = (const struct hda_pintbl[]) {
8433 			{ 0x12, 0x99a3092f }, /* int-mic */
8434 			{ 0x14, 0x99130110 }, /* speaker */
8435 			{ 0x18, 0x03a11c20 }, /* mic */
8436 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
8437 			{ 0x21, 0x0321101f }, /* HP out */
8438 			{ }
8439 		},
8440 		.chained = true,
8441 		.chain_id = ALC271_FIXUP_DMIC,
8442 	},
8443 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
8444 		.type = HDA_FIXUP_FUNC,
8445 		.v.func = alc269_fixup_limit_int_mic_boost,
8446 		.chained = true,
8447 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8448 	},
8449 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
8450 		.type = HDA_FIXUP_FUNC,
8451 		.v.func = alc269_fixup_limit_int_mic_boost,
8452 		.chained = true,
8453 		.chain_id = ALC269VB_FIXUP_DMIC,
8454 	},
8455 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
8456 		.type = HDA_FIXUP_VERBS,
8457 		.v.verbs = (const struct hda_verb[]) {
8458 			/* class-D output amp +5dB */
8459 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
8460 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
8461 			{}
8462 		},
8463 		.chained = true,
8464 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
8465 	},
8466 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8467 		.type = HDA_FIXUP_PINS,
8468 		.v.pins = (const struct hda_pintbl[]) {
8469 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
8470 			{ }
8471 		},
8472 		.chained = true,
8473 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8474 	},
8475 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
8476 		.type = HDA_FIXUP_FUNC,
8477 		.v.func = alc269_fixup_limit_int_mic_boost,
8478 		.chained = true,
8479 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
8480 	},
8481 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
8482 		.type = HDA_FIXUP_PINS,
8483 		.v.pins = (const struct hda_pintbl[]) {
8484 			{ 0x12, 0x99a3092f }, /* int-mic */
8485 			{ 0x18, 0x03a11d20 }, /* mic */
8486 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
8487 			{ }
8488 		},
8489 	},
8490 	[ALC283_FIXUP_CHROME_BOOK] = {
8491 		.type = HDA_FIXUP_FUNC,
8492 		.v.func = alc283_fixup_chromebook,
8493 	},
8494 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
8495 		.type = HDA_FIXUP_FUNC,
8496 		.v.func = alc283_fixup_sense_combo_jack,
8497 		.chained = true,
8498 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
8499 	},
8500 	[ALC282_FIXUP_ASUS_TX300] = {
8501 		.type = HDA_FIXUP_FUNC,
8502 		.v.func = alc282_fixup_asus_tx300,
8503 	},
8504 	[ALC283_FIXUP_INT_MIC] = {
8505 		.type = HDA_FIXUP_VERBS,
8506 		.v.verbs = (const struct hda_verb[]) {
8507 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
8508 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
8509 			{ }
8510 		},
8511 		.chained = true,
8512 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8513 	},
8514 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
8515 		.type = HDA_FIXUP_PINS,
8516 		.v.pins = (const struct hda_pintbl[]) {
8517 			{ 0x17, 0x90170112 }, /* subwoofer */
8518 			{ }
8519 		},
8520 		.chained = true,
8521 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
8522 	},
8523 	[ALC290_FIXUP_SUBWOOFER] = {
8524 		.type = HDA_FIXUP_PINS,
8525 		.v.pins = (const struct hda_pintbl[]) {
8526 			{ 0x17, 0x90170112 }, /* subwoofer */
8527 			{ }
8528 		},
8529 		.chained = true,
8530 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
8531 	},
8532 	[ALC290_FIXUP_MONO_SPEAKERS] = {
8533 		.type = HDA_FIXUP_FUNC,
8534 		.v.func = alc290_fixup_mono_speakers,
8535 	},
8536 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8537 		.type = HDA_FIXUP_FUNC,
8538 		.v.func = alc290_fixup_mono_speakers,
8539 		.chained = true,
8540 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8541 	},
8542 	[ALC269_FIXUP_THINKPAD_ACPI] = {
8543 		.type = HDA_FIXUP_FUNC,
8544 		.v.func = alc_fixup_thinkpad_acpi,
8545 		.chained = true,
8546 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
8547 	},
8548 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8549 		.type = HDA_FIXUP_FUNC,
8550 		.v.func = alc_fixup_inv_dmic,
8551 		.chained = true,
8552 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8553 	},
8554 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8555 		.type = HDA_FIXUP_PINS,
8556 		.v.pins = (const struct hda_pintbl[]) {
8557 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8558 			{ }
8559 		},
8560 		.chained = true,
8561 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8562 	},
8563 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8564 		.type = HDA_FIXUP_PINS,
8565 		.v.pins = (const struct hda_pintbl[]) {
8566 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8567 			{ }
8568 		},
8569 		.chained = true,
8570 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8571 	},
8572 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8573 		.type = HDA_FIXUP_PINS,
8574 		.v.pins = (const struct hda_pintbl[]) {
8575 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8576 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8577 			{ }
8578 		},
8579 		.chained = true,
8580 		.chain_id = ALC255_FIXUP_HEADSET_MODE
8581 	},
8582 	[ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8583 		.type = HDA_FIXUP_FUNC,
8584 		.v.func = alc269_fixup_limit_int_mic_boost,
8585 		.chained = true,
8586 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8587 	},
8588 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8589 		.type = HDA_FIXUP_PINS,
8590 		.v.pins = (const struct hda_pintbl[]) {
8591 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8592 			{ }
8593 		},
8594 		.chained = true,
8595 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8596 	},
8597 	[ALC255_FIXUP_HEADSET_MODE] = {
8598 		.type = HDA_FIXUP_FUNC,
8599 		.v.func = alc_fixup_headset_mode_alc255,
8600 		.chained = true,
8601 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8602 	},
8603 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8604 		.type = HDA_FIXUP_FUNC,
8605 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8606 	},
8607 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8608 		.type = HDA_FIXUP_PINS,
8609 		.v.pins = (const struct hda_pintbl[]) {
8610 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8611 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8612 			{ }
8613 		},
8614 		.chained = true,
8615 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8616 	},
8617 	[ALC292_FIXUP_TPT440_DOCK] = {
8618 		.type = HDA_FIXUP_FUNC,
8619 		.v.func = alc_fixup_tpt440_dock,
8620 		.chained = true,
8621 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8622 	},
8623 	[ALC292_FIXUP_TPT440] = {
8624 		.type = HDA_FIXUP_FUNC,
8625 		.v.func = alc_fixup_disable_aamix,
8626 		.chained = true,
8627 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
8628 	},
8629 	[ALC283_FIXUP_HEADSET_MIC] = {
8630 		.type = HDA_FIXUP_PINS,
8631 		.v.pins = (const struct hda_pintbl[]) {
8632 			{ 0x19, 0x04a110f0 },
8633 			{ },
8634 		},
8635 	},
8636 	[ALC255_FIXUP_MIC_MUTE_LED] = {
8637 		.type = HDA_FIXUP_FUNC,
8638 		.v.func = alc_fixup_micmute_led,
8639 	},
8640 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
8641 		.type = HDA_FIXUP_PINS,
8642 		.v.pins = (const struct hda_pintbl[]) {
8643 			{ 0x12, 0x90a60130 },
8644 			{ 0x14, 0x90170110 },
8645 			{ 0x17, 0x40000008 },
8646 			{ 0x18, 0x411111f0 },
8647 			{ 0x19, 0x01a1913c },
8648 			{ 0x1a, 0x411111f0 },
8649 			{ 0x1b, 0x411111f0 },
8650 			{ 0x1d, 0x40f89b2d },
8651 			{ 0x1e, 0x411111f0 },
8652 			{ 0x21, 0x0321101f },
8653 			{ },
8654 		},
8655 	},
8656 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8657 		.type = HDA_FIXUP_FUNC,
8658 		.v.func = alc269vb_fixup_aspire_e1_coef,
8659 	},
8660 	[ALC280_FIXUP_HP_GPIO4] = {
8661 		.type = HDA_FIXUP_FUNC,
8662 		.v.func = alc280_fixup_hp_gpio4,
8663 	},
8664 	[ALC286_FIXUP_HP_GPIO_LED] = {
8665 		.type = HDA_FIXUP_FUNC,
8666 		.v.func = alc286_fixup_hp_gpio_led,
8667 	},
8668 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8669 		.type = HDA_FIXUP_FUNC,
8670 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8671 	},
8672 	[ALC280_FIXUP_HP_DOCK_PINS] = {
8673 		.type = HDA_FIXUP_PINS,
8674 		.v.pins = (const struct hda_pintbl[]) {
8675 			{ 0x1b, 0x21011020 }, /* line-out */
8676 			{ 0x1a, 0x01a1903c }, /* headset mic */
8677 			{ 0x18, 0x2181103f }, /* line-in */
8678 			{ },
8679 		},
8680 		.chained = true,
8681 		.chain_id = ALC280_FIXUP_HP_GPIO4
8682 	},
8683 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8684 		.type = HDA_FIXUP_PINS,
8685 		.v.pins = (const struct hda_pintbl[]) {
8686 			{ 0x1b, 0x21011020 }, /* line-out */
8687 			{ 0x18, 0x2181103f }, /* line-in */
8688 			{ },
8689 		},
8690 		.chained = true,
8691 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8692 	},
8693 	[ALC280_FIXUP_HP_9480M] = {
8694 		.type = HDA_FIXUP_FUNC,
8695 		.v.func = alc280_fixup_hp_9480m,
8696 	},
8697 	[ALC245_FIXUP_HP_X360_AMP] = {
8698 		.type = HDA_FIXUP_FUNC,
8699 		.v.func = alc245_fixup_hp_x360_amp,
8700 		.chained = true,
8701 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
8702 	},
8703 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
8704 		.type = HDA_FIXUP_FUNC,
8705 		.v.func = alc_fixup_headset_mode_dell_alc288,
8706 		.chained = true,
8707 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
8708 	},
8709 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8710 		.type = HDA_FIXUP_PINS,
8711 		.v.pins = (const struct hda_pintbl[]) {
8712 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8713 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8714 			{ }
8715 		},
8716 		.chained = true,
8717 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8718 	},
8719 	[ALC288_FIXUP_DISABLE_AAMIX] = {
8720 		.type = HDA_FIXUP_FUNC,
8721 		.v.func = alc_fixup_disable_aamix,
8722 		.chained = true,
8723 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8724 	},
8725 	[ALC288_FIXUP_DELL_XPS_13] = {
8726 		.type = HDA_FIXUP_FUNC,
8727 		.v.func = alc_fixup_dell_xps13,
8728 		.chained = true,
8729 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
8730 	},
8731 	[ALC292_FIXUP_DISABLE_AAMIX] = {
8732 		.type = HDA_FIXUP_FUNC,
8733 		.v.func = alc_fixup_disable_aamix,
8734 		.chained = true,
8735 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8736 	},
8737 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8738 		.type = HDA_FIXUP_FUNC,
8739 		.v.func = alc_fixup_disable_aamix,
8740 		.chained = true,
8741 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8742 	},
8743 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
8744 		.type = HDA_FIXUP_FUNC,
8745 		.v.func = alc_fixup_dell_xps13,
8746 		.chained = true,
8747 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
8748 	},
8749 	[ALC292_FIXUP_DELL_E7X] = {
8750 		.type = HDA_FIXUP_FUNC,
8751 		.v.func = alc_fixup_micmute_led,
8752 		/* micmute fixup must be applied at last */
8753 		.chained_before = true,
8754 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8755 	},
8756 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8757 		.type = HDA_FIXUP_PINS,
8758 		.v.pins = (const struct hda_pintbl[]) {
8759 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8760 			{ }
8761 		},
8762 		.chained_before = true,
8763 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8764 	},
8765 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8766 		.type = HDA_FIXUP_PINS,
8767 		.v.pins = (const struct hda_pintbl[]) {
8768 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8769 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8770 			{ }
8771 		},
8772 		.chained = true,
8773 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8774 	},
8775 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8776 		.type = HDA_FIXUP_PINS,
8777 		.v.pins = (const struct hda_pintbl[]) {
8778 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8779 			{ }
8780 		},
8781 		.chained = true,
8782 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8783 	},
8784 	[ALC275_FIXUP_DELL_XPS] = {
8785 		.type = HDA_FIXUP_VERBS,
8786 		.v.verbs = (const struct hda_verb[]) {
8787 			/* Enables internal speaker */
8788 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8789 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8790 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8791 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8792 			{}
8793 		}
8794 	},
8795 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8796 		.type = HDA_FIXUP_FUNC,
8797 		.v.func = alc_fixup_disable_aamix,
8798 		.chained = true,
8799 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8800 	},
8801 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8802 		.type = HDA_FIXUP_FUNC,
8803 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8804 	},
8805 	[ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED] = {
8806 		.type = HDA_FIXUP_FUNC,
8807 		.v.func = alc233_fixup_lenovo_low_en_micmute_led,
8808 	},
8809 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8810 		.type = HDA_FIXUP_FUNC,
8811 		.v.func = alc_fixup_inv_dmic,
8812 		.chained = true,
8813 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8814 	},
8815 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8816 		.type = HDA_FIXUP_FUNC,
8817 		.v.func = alc269_fixup_limit_int_mic_boost
8818 	},
8819 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
8820 		.type = HDA_FIXUP_FUNC,
8821 		.v.func = alc_fixup_disable_aamix,
8822 		.chained = true,
8823 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8824 	},
8825 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
8826 		.type = HDA_FIXUP_FUNC,
8827 		.v.func = alc_fixup_disable_mic_vref,
8828 		.chained = true,
8829 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8830 	},
8831 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8832 		.type = HDA_FIXUP_VERBS,
8833 		.v.verbs = (const struct hda_verb[]) {
8834 			/* Disable pass-through path for FRONT 14h */
8835 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8836 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8837 			{}
8838 		},
8839 		.chained = true,
8840 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8841 	},
8842 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
8843 		.type = HDA_FIXUP_FUNC,
8844 		.v.func = alc_fixup_disable_aamix,
8845 		.chained = true,
8846 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
8847 	},
8848 	[ALC221_FIXUP_HP_FRONT_MIC] = {
8849 		.type = HDA_FIXUP_PINS,
8850 		.v.pins = (const struct hda_pintbl[]) {
8851 			{ 0x19, 0x02a19020 }, /* Front Mic */
8852 			{ }
8853 		},
8854 	},
8855 	[ALC292_FIXUP_TPT460] = {
8856 		.type = HDA_FIXUP_FUNC,
8857 		.v.func = alc_fixup_tpt440_dock,
8858 		.chained = true,
8859 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8860 	},
8861 	[ALC298_FIXUP_SPK_VOLUME] = {
8862 		.type = HDA_FIXUP_FUNC,
8863 		.v.func = alc298_fixup_speaker_volume,
8864 		.chained = true,
8865 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8866 	},
8867 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8868 		.type = HDA_FIXUP_FUNC,
8869 		.v.func = alc298_fixup_speaker_volume,
8870 	},
8871 	[ALC295_FIXUP_DISABLE_DAC3] = {
8872 		.type = HDA_FIXUP_FUNC,
8873 		.v.func = alc295_fixup_disable_dac3,
8874 	},
8875 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8876 		.type = HDA_FIXUP_FUNC,
8877 		.v.func = alc285_fixup_speaker2_to_dac1,
8878 		.chained = true,
8879 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8880 	},
8881 	[ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8882 		.type = HDA_FIXUP_FUNC,
8883 		.v.func = alc285_fixup_speaker2_to_dac1,
8884 		.chained = true,
8885 		.chain_id = ALC245_FIXUP_CS35L41_SPI_2
8886 	},
8887 	[ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8888 		.type = HDA_FIXUP_PINS,
8889 		.v.pins = (const struct hda_pintbl[]) {
8890 			{ 0x19, 0x03a11050 },
8891 			{ 0x1b, 0x03a11c30 },
8892 			{ }
8893 		},
8894 		.chained = true,
8895 		.chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8896 	},
8897 	[ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8898 		.type = HDA_FIXUP_PINS,
8899 		.v.pins = (const struct hda_pintbl[]) {
8900 			{ 0x14, 0x90170120 },
8901 			{ }
8902 		},
8903 		.chained = true,
8904 		.chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8905 	},
8906 	[ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8907 		.type = HDA_FIXUP_FUNC,
8908 		.v.func = alc285_fixup_speaker2_to_dac1,
8909 		.chained = true,
8910 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2
8911 	},
8912 	[ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8913 		.type = HDA_FIXUP_PINS,
8914 		.v.pins = (const struct hda_pintbl[]) {
8915 			{ 0x19, 0x03a11050 },
8916 			{ 0x1b, 0x03a11c30 },
8917 			{ }
8918 		},
8919 		.chained = true,
8920 		.chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8921 	},
8922 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8923 		.type = HDA_FIXUP_PINS,
8924 		.v.pins = (const struct hda_pintbl[]) {
8925 			{ 0x1b, 0x90170151 },
8926 			{ }
8927 		},
8928 		.chained = true,
8929 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8930 	},
8931 	[ALC269_FIXUP_ATIV_BOOK_8] = {
8932 		.type = HDA_FIXUP_FUNC,
8933 		.v.func = alc_fixup_auto_mute_via_amp,
8934 		.chained = true,
8935 		.chain_id = ALC269_FIXUP_NO_SHUTUP
8936 	},
8937 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8938 		.type = HDA_FIXUP_PINS,
8939 		.v.pins = (const struct hda_pintbl[]) {
8940 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8941 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8942 			{ }
8943 		},
8944 		.chained = true,
8945 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8946 	},
8947 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8948 		.type = HDA_FIXUP_PINS,
8949 		.v.pins = (const struct hda_pintbl[]) {
8950 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8951 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8952 			{ }
8953 		},
8954 		.chained = true,
8955 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8956 	},
8957 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8958 		.type = HDA_FIXUP_FUNC,
8959 		.v.func = alc_fixup_headset_mode,
8960 	},
8961 	[ALC256_FIXUP_ASUS_MIC] = {
8962 		.type = HDA_FIXUP_PINS,
8963 		.v.pins = (const struct hda_pintbl[]) {
8964 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8965 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8966 			{ }
8967 		},
8968 		.chained = true,
8969 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8970 	},
8971 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8972 		.type = HDA_FIXUP_FUNC,
8973 		/* Set up GPIO2 for the speaker amp */
8974 		.v.func = alc_fixup_gpio4,
8975 	},
8976 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8977 		.type = HDA_FIXUP_PINS,
8978 		.v.pins = (const struct hda_pintbl[]) {
8979 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8980 			{ }
8981 		},
8982 		.chained = true,
8983 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8984 	},
8985 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8986 		.type = HDA_FIXUP_VERBS,
8987 		.v.verbs = (const struct hda_verb[]) {
8988 			/* Enables internal speaker */
8989 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8990 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8991 			{}
8992 		},
8993 		.chained = true,
8994 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8995 	},
8996 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8997 		.type = HDA_FIXUP_FUNC,
8998 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8999 		.chained = true,
9000 		.chain_id = ALC269_FIXUP_GPIO2
9001 	},
9002 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
9003 		.type = HDA_FIXUP_VERBS,
9004 		.v.verbs = (const struct hda_verb[]) {
9005 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9006 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9007 			{ }
9008 		},
9009 		.chained = true,
9010 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
9011 	},
9012 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
9013 		.type = HDA_FIXUP_PINS,
9014 		.v.pins = (const struct hda_pintbl[]) {
9015 			/* Change the mic location from front to right, otherwise there are
9016 			   two front mics with the same name, pulseaudio can't handle them.
9017 			   This is just a temporary workaround, after applying this fixup,
9018 			   there will be one "Front Mic" and one "Mic" in this machine.
9019 			 */
9020 			{ 0x1a, 0x04a19040 },
9021 			{ }
9022 		},
9023 	},
9024 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
9025 		.type = HDA_FIXUP_PINS,
9026 		.v.pins = (const struct hda_pintbl[]) {
9027 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
9028 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
9029 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
9030 			{ 0x1b, 0x02011020 },
9031 			{ }
9032 		},
9033 		.chained = true,
9034 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
9035 	},
9036 	[ALC225_FIXUP_S3_POP_NOISE] = {
9037 		.type = HDA_FIXUP_FUNC,
9038 		.v.func = alc225_fixup_s3_pop_noise,
9039 		.chained = true,
9040 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9041 	},
9042 	[ALC700_FIXUP_INTEL_REFERENCE] = {
9043 		.type = HDA_FIXUP_VERBS,
9044 		.v.verbs = (const struct hda_verb[]) {
9045 			/* Enables internal speaker */
9046 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
9047 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
9048 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
9049 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
9050 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
9051 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
9052 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
9053 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
9054 			{}
9055 		}
9056 	},
9057 	[ALC274_FIXUP_DELL_BIND_DACS] = {
9058 		.type = HDA_FIXUP_FUNC,
9059 		.v.func = alc274_fixup_bind_dacs,
9060 		.chained = true,
9061 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
9062 	},
9063 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
9064 		.type = HDA_FIXUP_PINS,
9065 		.v.pins = (const struct hda_pintbl[]) {
9066 			{ 0x1b, 0x0401102f },
9067 			{ }
9068 		},
9069 		.chained = true,
9070 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
9071 	},
9072 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
9073 		.type = HDA_FIXUP_FUNC,
9074 		.v.func = alc_fixup_tpt470_dock,
9075 		.chained = true,
9076 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
9077 	},
9078 	[ALC298_FIXUP_TPT470_DOCK] = {
9079 		.type = HDA_FIXUP_FUNC,
9080 		.v.func = alc_fixup_tpt470_dacs,
9081 		.chained = true,
9082 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
9083 	},
9084 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
9085 		.type = HDA_FIXUP_PINS,
9086 		.v.pins = (const struct hda_pintbl[]) {
9087 			{ 0x14, 0x0201101f },
9088 			{ }
9089 		},
9090 		.chained = true,
9091 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9092 	},
9093 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
9094 		.type = HDA_FIXUP_PINS,
9095 		.v.pins = (const struct hda_pintbl[]) {
9096 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9097 			{ }
9098 		},
9099 		.chained = true,
9100 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9101 	},
9102 	[ALC295_FIXUP_HP_X360] = {
9103 		.type = HDA_FIXUP_FUNC,
9104 		.v.func = alc295_fixup_hp_top_speakers,
9105 		.chained = true,
9106 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
9107 	},
9108 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
9109 		.type = HDA_FIXUP_PINS,
9110 		.v.pins = (const struct hda_pintbl[]) {
9111 			{ 0x19, 0x0181313f},
9112 			{ }
9113 		},
9114 		.chained = true,
9115 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9116 	},
9117 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
9118 		.type = HDA_FIXUP_FUNC,
9119 		.v.func = alc285_fixup_invalidate_dacs,
9120 		.chained = true,
9121 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9122 	},
9123 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
9124 		.type = HDA_FIXUP_FUNC,
9125 		.v.func = alc_fixup_auto_mute_via_amp,
9126 	},
9127 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
9128 		.type = HDA_FIXUP_PINS,
9129 		.v.pins = (const struct hda_pintbl[]) {
9130 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9131 			{ }
9132 		},
9133 		.chained = true,
9134 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9135 	},
9136 	[ALC294_FIXUP_ASUS_MIC] = {
9137 		.type = HDA_FIXUP_PINS,
9138 		.v.pins = (const struct hda_pintbl[]) {
9139 			{ 0x13, 0x90a60160 }, /* use as internal mic */
9140 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
9141 			{ }
9142 		},
9143 		.chained = true,
9144 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9145 	},
9146 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
9147 		.type = HDA_FIXUP_PINS,
9148 		.v.pins = (const struct hda_pintbl[]) {
9149 			{ 0x19, 0x01a1103c }, /* use as headset mic */
9150 			{ }
9151 		},
9152 		.chained = true,
9153 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9154 	},
9155 	[ALC294_FIXUP_ASUS_SPK] = {
9156 		.type = HDA_FIXUP_VERBS,
9157 		.v.verbs = (const struct hda_verb[]) {
9158 			/* Set EAPD high */
9159 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
9160 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
9161 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9162 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
9163 			{ }
9164 		},
9165 		.chained = true,
9166 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9167 	},
9168 	[ALC295_FIXUP_CHROME_BOOK] = {
9169 		.type = HDA_FIXUP_FUNC,
9170 		.v.func = alc295_fixup_chromebook,
9171 		.chained = true,
9172 		.chain_id = ALC225_FIXUP_HEADSET_JACK
9173 	},
9174 	[ALC225_FIXUP_HEADSET_JACK] = {
9175 		.type = HDA_FIXUP_FUNC,
9176 		.v.func = alc_fixup_headset_jack,
9177 	},
9178 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9179 		.type = HDA_FIXUP_PINS,
9180 		.v.pins = (const struct hda_pintbl[]) {
9181 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9182 			{ }
9183 		},
9184 		.chained = true,
9185 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9186 	},
9187 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
9188 		.type = HDA_FIXUP_VERBS,
9189 		.v.verbs = (const struct hda_verb[]) {
9190 			/* Disable PCBEEP-IN passthrough */
9191 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
9192 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
9193 			{ }
9194 		},
9195 		.chained = true,
9196 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
9197 	},
9198 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
9199 		.type = HDA_FIXUP_PINS,
9200 		.v.pins = (const struct hda_pintbl[]) {
9201 			{ 0x19, 0x03a11130 },
9202 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
9203 			{ }
9204 		},
9205 		.chained = true,
9206 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
9207 	},
9208 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
9209 		.type = HDA_FIXUP_PINS,
9210 		.v.pins = (const struct hda_pintbl[]) {
9211 			{ 0x16, 0x01011020 }, /* Rear Line out */
9212 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
9213 			{ }
9214 		},
9215 		.chained = true,
9216 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
9217 	},
9218 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
9219 		.type = HDA_FIXUP_FUNC,
9220 		.v.func = alc_fixup_auto_mute_via_amp,
9221 		.chained = true,
9222 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
9223 	},
9224 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
9225 		.type = HDA_FIXUP_FUNC,
9226 		.v.func = alc_fixup_disable_mic_vref,
9227 		.chained = true,
9228 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9229 	},
9230 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
9231 		.type = HDA_FIXUP_VERBS,
9232 		.v.verbs = (const struct hda_verb[]) {
9233 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
9234 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
9235 			{ }
9236 		},
9237 		.chained = true,
9238 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
9239 	},
9240 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
9241 		.type = HDA_FIXUP_PINS,
9242 		.v.pins = (const struct hda_pintbl[]) {
9243 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9244 			{ }
9245 		},
9246 		.chained = true,
9247 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9248 	},
9249 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9250 		.type = HDA_FIXUP_PINS,
9251 		.v.pins = (const struct hda_pintbl[]) {
9252 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
9253 			{ }
9254 		},
9255 		.chained = true,
9256 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9257 	},
9258 	[ALC255_FIXUP_PREDATOR_SUBWOOFER] = {
9259 		.type = HDA_FIXUP_PINS,
9260 		.v.pins = (const struct hda_pintbl[]) {
9261 			{ 0x17, 0x90170151 }, /* use as internal speaker (LFE) */
9262 			{ 0x1b, 0x90170152 } /* use as internal speaker (back) */
9263 		}
9264 	},
9265 	[ALC299_FIXUP_PREDATOR_SPK] = {
9266 		.type = HDA_FIXUP_PINS,
9267 		.v.pins = (const struct hda_pintbl[]) {
9268 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
9269 			{ }
9270 		}
9271 	},
9272 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
9273 		.type = HDA_FIXUP_PINS,
9274 		.v.pins = (const struct hda_pintbl[]) {
9275 			{ 0x19, 0x04a11040 },
9276 			{ 0x21, 0x04211020 },
9277 			{ }
9278 		},
9279 		.chained = true,
9280 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9281 	},
9282 	[ALC289_FIXUP_DELL_SPK1] = {
9283 		.type = HDA_FIXUP_PINS,
9284 		.v.pins = (const struct hda_pintbl[]) {
9285 			{ 0x14, 0x90170140 },
9286 			{ }
9287 		},
9288 		.chained = true,
9289 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
9290 	},
9291 	[ALC289_FIXUP_DELL_SPK2] = {
9292 		.type = HDA_FIXUP_PINS,
9293 		.v.pins = (const struct hda_pintbl[]) {
9294 			{ 0x17, 0x90170130 }, /* bass spk */
9295 			{ }
9296 		},
9297 		.chained = true,
9298 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
9299 	},
9300 	[ALC289_FIXUP_DUAL_SPK] = {
9301 		.type = HDA_FIXUP_FUNC,
9302 		.v.func = alc285_fixup_speaker2_to_dac1,
9303 		.chained = true,
9304 		.chain_id = ALC289_FIXUP_DELL_SPK2
9305 	},
9306 	[ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
9307 		.type = HDA_FIXUP_FUNC,
9308 		.v.func = alc285_fixup_speaker2_to_dac1,
9309 		.chained = true,
9310 		.chain_id = ALC289_FIXUP_DELL_SPK1
9311 	},
9312 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
9313 		.type = HDA_FIXUP_FUNC,
9314 		.v.func = alc285_fixup_speaker2_to_dac1,
9315 		.chained = true,
9316 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9317 	},
9318 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
9319 		.type = HDA_FIXUP_FUNC,
9320 		/* The GPIO must be pulled to initialize the AMP */
9321 		.v.func = alc_fixup_gpio4,
9322 		.chained = true,
9323 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
9324 	},
9325 	[ALC294_FIXUP_ASUS_ALLY] = {
9326 		.type = HDA_FIXUP_FUNC,
9327 		.v.func = cs35l41_fixup_i2c_two,
9328 		.chained = true,
9329 		.chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
9330 	},
9331 	[ALC294_FIXUP_ASUS_ALLY_PINS] = {
9332 		.type = HDA_FIXUP_PINS,
9333 		.v.pins = (const struct hda_pintbl[]) {
9334 			{ 0x19, 0x03a11050 },
9335 			{ 0x1a, 0x03a11c30 },
9336 			{ 0x21, 0x03211420 },
9337 			{ }
9338 		},
9339 		.chained = true,
9340 		.chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
9341 	},
9342 	[ALC294_FIXUP_ASUS_ALLY_VERBS] = {
9343 		.type = HDA_FIXUP_VERBS,
9344 		.v.verbs = (const struct hda_verb[]) {
9345 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9346 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9347 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
9348 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
9349 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
9350 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
9351 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
9352 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
9353 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
9354 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
9355 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
9356 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
9357 			{ }
9358 		},
9359 		.chained = true,
9360 		.chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
9361 	},
9362 	[ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
9363 		.type = HDA_FIXUP_FUNC,
9364 		.v.func = alc285_fixup_speaker2_to_dac1,
9365 	},
9366 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
9367 		.type = HDA_FIXUP_FUNC,
9368 		.v.func = alc285_fixup_thinkpad_x1_gen7,
9369 		.chained = true,
9370 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9371 	},
9372 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
9373 		.type = HDA_FIXUP_FUNC,
9374 		.v.func = alc_fixup_headset_jack,
9375 		.chained = true,
9376 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
9377 	},
9378 	[ALC294_FIXUP_ASUS_HPE] = {
9379 		.type = HDA_FIXUP_VERBS,
9380 		.v.verbs = (const struct hda_verb[]) {
9381 			/* Set EAPD high */
9382 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9383 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
9384 			{ }
9385 		},
9386 		.chained = true,
9387 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9388 	},
9389 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
9390 		.type = HDA_FIXUP_PINS,
9391 		.v.pins = (const struct hda_pintbl[]) {
9392 			{ 0x19, 0x03a11050 }, /* front HP mic */
9393 			{ 0x1a, 0x01a11830 }, /* rear external mic */
9394 			{ 0x21, 0x03211020 }, /* front HP out */
9395 			{ }
9396 		},
9397 		.chained = true,
9398 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
9399 	},
9400 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
9401 		.type = HDA_FIXUP_VERBS,
9402 		.v.verbs = (const struct hda_verb[]) {
9403 			/* set 0x15 to HP-OUT ctrl */
9404 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9405 			/* unmute the 0x15 amp */
9406 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
9407 			{ }
9408 		},
9409 		.chained = true,
9410 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
9411 	},
9412 	[ALC294_FIXUP_ASUS_GX502_HP] = {
9413 		.type = HDA_FIXUP_FUNC,
9414 		.v.func = alc294_fixup_gx502_hp,
9415 	},
9416 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
9417 		.type = HDA_FIXUP_PINS,
9418 		.v.pins = (const struct hda_pintbl[]) {
9419 			{ 0x19, 0x01a11050 }, /* rear HP mic */
9420 			{ 0x1a, 0x01a11830 }, /* rear external mic */
9421 			{ 0x21, 0x012110f0 }, /* rear HP out */
9422 			{ }
9423 		},
9424 		.chained = true,
9425 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
9426 	},
9427 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
9428 		.type = HDA_FIXUP_VERBS,
9429 		.v.verbs = (const struct hda_verb[]) {
9430 			/* set 0x15 to HP-OUT ctrl */
9431 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9432 			/* unmute the 0x15 amp */
9433 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
9434 			/* set 0x1b to HP-OUT */
9435 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9436 			{ }
9437 		},
9438 		.chained = true,
9439 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
9440 	},
9441 	[ALC294_FIXUP_ASUS_GU502_HP] = {
9442 		.type = HDA_FIXUP_FUNC,
9443 		.v.func = alc294_fixup_gu502_hp,
9444 	},
9445 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
9446 		.type = HDA_FIXUP_PINS,
9447 		.v.pins = (const struct hda_pintbl[]) {
9448 				{ 0x19, 0x03a11050 }, /* front HP mic */
9449 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
9450 				{ 0x21, 0x03211420 }, /* front HP out */
9451 				{ }
9452 		},
9453 	},
9454 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
9455 		.type = HDA_FIXUP_PINS,
9456 		.v.pins = (const struct hda_pintbl[]) {
9457 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
9458 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
9459 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
9460 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
9461 			{ 0x21, 0x03211420 },
9462 			{ }
9463 		},
9464 	},
9465 	[ALC294_FIXUP_ASUS_COEF_1B] = {
9466 		.type = HDA_FIXUP_VERBS,
9467 		.v.verbs = (const struct hda_verb[]) {
9468 			/* Set bit 10 to correct noisy output after reboot from
9469 			 * Windows 10 (due to pop noise reduction?)
9470 			 */
9471 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
9472 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
9473 			{ }
9474 		},
9475 		.chained = true,
9476 		.chain_id = ALC289_FIXUP_ASUS_GA401,
9477 	},
9478 	[ALC285_FIXUP_HP_GPIO_LED] = {
9479 		.type = HDA_FIXUP_FUNC,
9480 		.v.func = alc285_fixup_hp_gpio_led,
9481 	},
9482 	[ALC285_FIXUP_HP_MUTE_LED] = {
9483 		.type = HDA_FIXUP_FUNC,
9484 		.v.func = alc285_fixup_hp_mute_led,
9485 	},
9486 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
9487 		.type = HDA_FIXUP_FUNC,
9488 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
9489 	},
9490 	[ALC285_FIXUP_HP_BEEP_MICMUTE_LED] = {
9491 		.type = HDA_FIXUP_FUNC,
9492 		.v.func = alc285_fixup_hp_beep,
9493 		.chained = true,
9494 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9495 	},
9496 	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
9497 	    .type = HDA_FIXUP_FUNC,
9498 	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
9499 	},
9500 	[ALC236_FIXUP_HP_GPIO_LED] = {
9501 		.type = HDA_FIXUP_FUNC,
9502 		.v.func = alc236_fixup_hp_gpio_led,
9503 	},
9504 	[ALC236_FIXUP_HP_MUTE_LED] = {
9505 		.type = HDA_FIXUP_FUNC,
9506 		.v.func = alc236_fixup_hp_mute_led,
9507 	},
9508 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
9509 		.type = HDA_FIXUP_FUNC,
9510 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
9511 	},
9512 	[ALC236_FIXUP_LENOVO_INV_DMIC] = {
9513 		.type = HDA_FIXUP_FUNC,
9514 		.v.func = alc_fixup_inv_dmic,
9515 		.chained = true,
9516 		.chain_id = ALC283_FIXUP_INT_MIC,
9517 	},
9518 	[ALC295_FIXUP_HP_MUTE_LED_COEFBIT11] = {
9519 		.type = HDA_FIXUP_FUNC,
9520 		.v.func = alc295_fixup_hp_mute_led_coefbit11,
9521 	},
9522 	[ALC298_FIXUP_SAMSUNG_AMP] = {
9523 		.type = HDA_FIXUP_FUNC,
9524 		.v.func = alc298_fixup_samsung_amp,
9525 		.chained = true,
9526 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
9527 	},
9528 	[ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS] = {
9529 		.type = HDA_FIXUP_FUNC,
9530 		.v.func = alc298_fixup_samsung_amp_v2_2_amps
9531 	},
9532 	[ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS] = {
9533 		.type = HDA_FIXUP_FUNC,
9534 		.v.func = alc298_fixup_samsung_amp_v2_4_amps
9535 	},
9536 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9537 		.type = HDA_FIXUP_VERBS,
9538 		.v.verbs = (const struct hda_verb[]) {
9539 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
9540 			{ }
9541 		},
9542 	},
9543 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9544 		.type = HDA_FIXUP_VERBS,
9545 		.v.verbs = (const struct hda_verb[]) {
9546 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
9547 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
9548 			{ }
9549 		},
9550 	},
9551 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9552 		.type = HDA_FIXUP_PINS,
9553 		.v.pins = (const struct hda_pintbl[]) {
9554 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9555 			{ }
9556 		},
9557 		.chained = true,
9558 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9559 	},
9560 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
9561 		.type = HDA_FIXUP_PINS,
9562 		.v.pins = (const struct hda_pintbl[]) {
9563 			{ 0x14, 0x90100120 }, /* use as internal speaker */
9564 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
9565 			{ 0x1a, 0x01011020 }, /* use as line out */
9566 			{ },
9567 		},
9568 		.chained = true,
9569 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9570 	},
9571 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9572 		.type = HDA_FIXUP_PINS,
9573 		.v.pins = (const struct hda_pintbl[]) {
9574 			{ 0x18, 0x02a11030 }, /* use as headset mic */
9575 			{ }
9576 		},
9577 		.chained = true,
9578 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9579 	},
9580 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9581 		.type = HDA_FIXUP_PINS,
9582 		.v.pins = (const struct hda_pintbl[]) {
9583 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9584 			{ }
9585 		},
9586 		.chained = true,
9587 		.chain_id = ALC269_FIXUP_HEADSET_MIC
9588 	},
9589 	[ALC289_FIXUP_ASUS_GA401] = {
9590 		.type = HDA_FIXUP_FUNC,
9591 		.v.func = alc289_fixup_asus_ga401,
9592 		.chained = true,
9593 		.chain_id = ALC289_FIXUP_ASUS_GA502,
9594 	},
9595 	[ALC289_FIXUP_ASUS_GA502] = {
9596 		.type = HDA_FIXUP_PINS,
9597 		.v.pins = (const struct hda_pintbl[]) {
9598 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
9599 			{ }
9600 		},
9601 	},
9602 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9603 		.type = HDA_FIXUP_PINS,
9604 		.v.pins = (const struct hda_pintbl[]) {
9605 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9606 			{ }
9607 		},
9608 		.chained = true,
9609 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9610 	},
9611 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9612 		.type = HDA_FIXUP_FUNC,
9613 		.v.func = alc285_fixup_hp_gpio_amp_init,
9614 		.chained = true,
9615 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
9616 	},
9617 	[ALC269_FIXUP_CZC_B20] = {
9618 		.type = HDA_FIXUP_PINS,
9619 		.v.pins = (const struct hda_pintbl[]) {
9620 			{ 0x12, 0x411111f0 },
9621 			{ 0x14, 0x90170110 }, /* speaker */
9622 			{ 0x15, 0x032f1020 }, /* HP out */
9623 			{ 0x17, 0x411111f0 },
9624 			{ 0x18, 0x03ab1040 }, /* mic */
9625 			{ 0x19, 0xb7a7013f },
9626 			{ 0x1a, 0x0181305f },
9627 			{ 0x1b, 0x411111f0 },
9628 			{ 0x1d, 0x411111f0 },
9629 			{ 0x1e, 0x411111f0 },
9630 			{ }
9631 		},
9632 		.chain_id = ALC269_FIXUP_DMIC,
9633 	},
9634 	[ALC269_FIXUP_CZC_TMI] = {
9635 		.type = HDA_FIXUP_PINS,
9636 		.v.pins = (const struct hda_pintbl[]) {
9637 			{ 0x12, 0x4000c000 },
9638 			{ 0x14, 0x90170110 }, /* speaker */
9639 			{ 0x15, 0x0421401f }, /* HP out */
9640 			{ 0x17, 0x411111f0 },
9641 			{ 0x18, 0x04a19020 }, /* mic */
9642 			{ 0x19, 0x411111f0 },
9643 			{ 0x1a, 0x411111f0 },
9644 			{ 0x1b, 0x411111f0 },
9645 			{ 0x1d, 0x40448505 },
9646 			{ 0x1e, 0x411111f0 },
9647 			{ 0x20, 0x8000ffff },
9648 			{ }
9649 		},
9650 		.chain_id = ALC269_FIXUP_DMIC,
9651 	},
9652 	[ALC269_FIXUP_CZC_L101] = {
9653 		.type = HDA_FIXUP_PINS,
9654 		.v.pins = (const struct hda_pintbl[]) {
9655 			{ 0x12, 0x40000000 },
9656 			{ 0x14, 0x01014010 }, /* speaker */
9657 			{ 0x15, 0x411111f0 }, /* HP out */
9658 			{ 0x16, 0x411111f0 },
9659 			{ 0x18, 0x01a19020 }, /* mic */
9660 			{ 0x19, 0x02a19021 },
9661 			{ 0x1a, 0x0181302f },
9662 			{ 0x1b, 0x0221401f },
9663 			{ 0x1c, 0x411111f0 },
9664 			{ 0x1d, 0x4044c601 },
9665 			{ 0x1e, 0x411111f0 },
9666 			{ }
9667 		},
9668 		.chain_id = ALC269_FIXUP_DMIC,
9669 	},
9670 	[ALC269_FIXUP_LEMOTE_A1802] = {
9671 		.type = HDA_FIXUP_PINS,
9672 		.v.pins = (const struct hda_pintbl[]) {
9673 			{ 0x12, 0x40000000 },
9674 			{ 0x14, 0x90170110 }, /* speaker */
9675 			{ 0x17, 0x411111f0 },
9676 			{ 0x18, 0x03a19040 }, /* mic1 */
9677 			{ 0x19, 0x90a70130 }, /* mic2 */
9678 			{ 0x1a, 0x411111f0 },
9679 			{ 0x1b, 0x411111f0 },
9680 			{ 0x1d, 0x40489d2d },
9681 			{ 0x1e, 0x411111f0 },
9682 			{ 0x20, 0x0003ffff },
9683 			{ 0x21, 0x03214020 },
9684 			{ }
9685 		},
9686 		.chain_id = ALC269_FIXUP_DMIC,
9687 	},
9688 	[ALC269_FIXUP_LEMOTE_A190X] = {
9689 		.type = HDA_FIXUP_PINS,
9690 		.v.pins = (const struct hda_pintbl[]) {
9691 			{ 0x14, 0x99130110 }, /* speaker */
9692 			{ 0x15, 0x0121401f }, /* HP out */
9693 			{ 0x18, 0x01a19c20 }, /* rear  mic */
9694 			{ 0x19, 0x99a3092f }, /* front mic */
9695 			{ 0x1b, 0x0201401f }, /* front lineout */
9696 			{ }
9697 		},
9698 		.chain_id = ALC269_FIXUP_DMIC,
9699 	},
9700 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9701 		.type = HDA_FIXUP_PINS,
9702 		.v.pins = (const struct hda_pintbl[]) {
9703 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9704 			{ }
9705 		},
9706 		.chained = true,
9707 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9708 	},
9709 	[ALC256_FIXUP_INTEL_NUC10] = {
9710 		.type = HDA_FIXUP_PINS,
9711 		.v.pins = (const struct hda_pintbl[]) {
9712 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9713 			{ }
9714 		},
9715 		.chained = true,
9716 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9717 	},
9718 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9719 		.type = HDA_FIXUP_VERBS,
9720 		.v.verbs = (const struct hda_verb[]) {
9721 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9722 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9723 			{ }
9724 		},
9725 		.chained = true,
9726 		.chain_id = ALC289_FIXUP_ASUS_GA502
9727 	},
9728 	[ALC274_FIXUP_HP_MIC] = {
9729 		.type = HDA_FIXUP_VERBS,
9730 		.v.verbs = (const struct hda_verb[]) {
9731 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9732 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9733 			{ }
9734 		},
9735 	},
9736 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
9737 		.type = HDA_FIXUP_FUNC,
9738 		.v.func = alc274_fixup_hp_headset_mic,
9739 		.chained = true,
9740 		.chain_id = ALC274_FIXUP_HP_MIC
9741 	},
9742 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
9743 		.type = HDA_FIXUP_FUNC,
9744 		.v.func = alc274_fixup_hp_envy_gpio,
9745 	},
9746 	[ALC274_FIXUP_ASUS_ZEN_AIO_27] = {
9747 		.type = HDA_FIXUP_VERBS,
9748 		.v.verbs = (const struct hda_verb[]) {
9749 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x10 },
9750 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc420 },
9751 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
9752 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
9753 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
9754 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0249 },
9755 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
9756 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x202b },
9757 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x62 },
9758 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xa007 },
9759 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
9760 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5060 },
9761 			{}
9762 		},
9763 		.chained = true,
9764 		.chain_id = ALC2XX_FIXUP_HEADSET_MIC,
9765 	},
9766 	[ALC256_FIXUP_ASUS_HPE] = {
9767 		.type = HDA_FIXUP_VERBS,
9768 		.v.verbs = (const struct hda_verb[]) {
9769 			/* Set EAPD high */
9770 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9771 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9772 			{ }
9773 		},
9774 		.chained = true,
9775 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9776 	},
9777 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9778 		.type = HDA_FIXUP_FUNC,
9779 		.v.func = alc_fixup_headset_jack,
9780 		.chained = true,
9781 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
9782 	},
9783 	[ALC287_FIXUP_HP_GPIO_LED] = {
9784 		.type = HDA_FIXUP_FUNC,
9785 		.v.func = alc287_fixup_hp_gpio_led,
9786 	},
9787 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
9788 		.type = HDA_FIXUP_FUNC,
9789 		.v.func = alc274_fixup_hp_headset_mic,
9790 	},
9791 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9792 		.type = HDA_FIXUP_FUNC,
9793 		.v.func = alc_fixup_no_int_mic,
9794 		.chained = true,
9795 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9796 	},
9797 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9798 		.type = HDA_FIXUP_PINS,
9799 		.v.pins = (const struct hda_pintbl[]) {
9800 			{ 0x1b, 0x411111f0 },
9801 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9802 			{ },
9803 		},
9804 		.chained = true,
9805 		.chain_id = ALC269_FIXUP_HEADSET_MODE
9806 	},
9807 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9808 		.type = HDA_FIXUP_FUNC,
9809 		.v.func = alc269_fixup_limit_int_mic_boost,
9810 		.chained = true,
9811 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9812 	},
9813 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
9814 		.type = HDA_FIXUP_PINS,
9815 		.v.pins = (const struct hda_pintbl[]) {
9816 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9817 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
9818 			{ }
9819 		},
9820 		.chained = true,
9821 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9822 	},
9823 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9824 		.type = HDA_FIXUP_FUNC,
9825 		.v.func = alc285_fixup_ideapad_s740_coef,
9826 		.chained = true,
9827 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9828 	},
9829 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9830 		.type = HDA_FIXUP_FUNC,
9831 		.v.func = alc269_fixup_limit_int_mic_boost,
9832 		.chained = true,
9833 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9834 	},
9835 	[ALC295_FIXUP_ASUS_DACS] = {
9836 		.type = HDA_FIXUP_FUNC,
9837 		.v.func = alc295_fixup_asus_dacs,
9838 	},
9839 	[ALC295_FIXUP_HP_OMEN] = {
9840 		.type = HDA_FIXUP_PINS,
9841 		.v.pins = (const struct hda_pintbl[]) {
9842 			{ 0x12, 0xb7a60130 },
9843 			{ 0x13, 0x40000000 },
9844 			{ 0x14, 0x411111f0 },
9845 			{ 0x16, 0x411111f0 },
9846 			{ 0x17, 0x90170110 },
9847 			{ 0x18, 0x411111f0 },
9848 			{ 0x19, 0x02a11030 },
9849 			{ 0x1a, 0x411111f0 },
9850 			{ 0x1b, 0x04a19030 },
9851 			{ 0x1d, 0x40600001 },
9852 			{ 0x1e, 0x411111f0 },
9853 			{ 0x21, 0x03211020 },
9854 			{}
9855 		},
9856 		.chained = true,
9857 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9858 	},
9859 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
9860 		.type = HDA_FIXUP_FUNC,
9861 		.v.func = alc285_fixup_hp_spectre_x360,
9862 	},
9863 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9864 		.type = HDA_FIXUP_FUNC,
9865 		.v.func = alc285_fixup_hp_spectre_x360_eb1
9866 	},
9867 	[ALC285_FIXUP_HP_SPECTRE_X360_DF1] = {
9868 		.type = HDA_FIXUP_FUNC,
9869 		.v.func = alc285_fixup_hp_spectre_x360_df1
9870 	},
9871 	[ALC285_FIXUP_HP_ENVY_X360] = {
9872 		.type = HDA_FIXUP_FUNC,
9873 		.v.func = alc285_fixup_hp_envy_x360,
9874 		.chained = true,
9875 		.chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9876 	},
9877 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9878 		.type = HDA_FIXUP_FUNC,
9879 		.v.func = alc285_fixup_ideapad_s740_coef,
9880 		.chained = true,
9881 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9882 	},
9883 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9884 		.type = HDA_FIXUP_FUNC,
9885 		.v.func = alc_fixup_no_shutup,
9886 		.chained = true,
9887 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
9888 	},
9889 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9890 		.type = HDA_FIXUP_PINS,
9891 		.v.pins = (const struct hda_pintbl[]) {
9892 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9893 			{ }
9894 		},
9895 		.chained = true,
9896 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9897 	},
9898 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9899 		.type = HDA_FIXUP_FUNC,
9900 		.v.func = alc269_fixup_limit_int_mic_boost,
9901 		.chained = true,
9902 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9903 	},
9904 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9905 		.type = HDA_FIXUP_FUNC,
9906 		.v.func = alc285_fixup_ideapad_s740_coef,
9907 		.chained = true,
9908 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9909 	},
9910 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9911 		.type = HDA_FIXUP_FUNC,
9912 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9913 		.chained = true,
9914 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9915 	},
9916 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9917 		.type = HDA_FIXUP_VERBS,
9918 		//.v.verbs = legion_15imhg05_coefs,
9919 		.v.verbs = (const struct hda_verb[]) {
9920 			 // set left speaker Legion 7i.
9921 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9922 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9923 
9924 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9925 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9926 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9927 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9928 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9929 
9930 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9931 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9932 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9933 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9934 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9935 
9936 			 // set right speaker Legion 7i.
9937 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9938 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9939 
9940 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9941 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9942 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9943 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9944 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9945 
9946 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9947 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9948 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9949 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9950 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9951 			 {}
9952 		},
9953 		.chained = true,
9954 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9955 	},
9956 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9957 		.type = HDA_FIXUP_FUNC,
9958 		.v.func = alc287_fixup_legion_15imhg05_speakers,
9959 		.chained = true,
9960 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
9961 	},
9962 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9963 		.type = HDA_FIXUP_VERBS,
9964 		.v.verbs = (const struct hda_verb[]) {
9965 			 // set left speaker Yoga 7i.
9966 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9967 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9968 
9969 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9970 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9971 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9972 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9973 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9974 
9975 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9976 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9977 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9978 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9979 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9980 
9981 			 // set right speaker Yoga 7i.
9982 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9983 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9984 
9985 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9986 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9987 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9988 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9989 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9990 
9991 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9992 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9993 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9994 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9995 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9996 			 {}
9997 		},
9998 		.chained = true,
9999 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
10000 	},
10001 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
10002 		.type = HDA_FIXUP_FUNC,
10003 		.v.func = alc298_fixup_lenovo_c940_duet7,
10004 	},
10005 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
10006 		.type = HDA_FIXUP_VERBS,
10007 		.v.verbs = (const struct hda_verb[]) {
10008 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10009 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
10010 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10011 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10012 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10013 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10014 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10015 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10016 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
10017 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10018 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10019 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10020 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10021 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10022 			{}
10023 		},
10024 		.chained = true,
10025 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
10026 	},
10027 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
10028 		.type = HDA_FIXUP_FUNC,
10029 		.v.func = alc256_fixup_set_coef_defaults,
10030 	},
10031 	[ALC245_FIXUP_HP_GPIO_LED] = {
10032 		.type = HDA_FIXUP_FUNC,
10033 		.v.func = alc245_fixup_hp_gpio_led,
10034 	},
10035 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
10036 		.type = HDA_FIXUP_PINS,
10037 		.v.pins = (const struct hda_pintbl[]) {
10038 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
10039 			{ }
10040 		},
10041 		.chained = true,
10042 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
10043 	},
10044 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
10045 		.type = HDA_FIXUP_FUNC,
10046 		.v.func = alc233_fixup_no_audio_jack,
10047 	},
10048 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
10049 		.type = HDA_FIXUP_FUNC,
10050 		.v.func = alc256_fixup_mic_no_presence_and_resume,
10051 		.chained = true,
10052 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
10053 	},
10054 	[ALC287_FIXUP_LEGION_16ACHG6] = {
10055 		.type = HDA_FIXUP_FUNC,
10056 		.v.func = alc287_fixup_legion_16achg6_speakers,
10057 	},
10058 	[ALC287_FIXUP_CS35L41_I2C_2] = {
10059 		.type = HDA_FIXUP_FUNC,
10060 		.v.func = cs35l41_fixup_i2c_two,
10061 	},
10062 	[ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
10063 		.type = HDA_FIXUP_FUNC,
10064 		.v.func = cs35l41_fixup_i2c_two,
10065 		.chained = true,
10066 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
10067 	},
10068 	[ALC287_FIXUP_CS35L41_I2C_4] = {
10069 		.type = HDA_FIXUP_FUNC,
10070 		.v.func = cs35l41_fixup_i2c_four,
10071 	},
10072 	[ALC245_FIXUP_CS35L41_SPI_2] = {
10073 		.type = HDA_FIXUP_FUNC,
10074 		.v.func = cs35l41_fixup_spi_two,
10075 	},
10076 	[ALC245_FIXUP_CS35L41_SPI_1] = {
10077 		.type = HDA_FIXUP_FUNC,
10078 		.v.func = cs35l41_fixup_spi_one,
10079 	},
10080 	[ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
10081 		.type = HDA_FIXUP_FUNC,
10082 		.v.func = cs35l41_fixup_spi_two,
10083 		.chained = true,
10084 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
10085 	},
10086 	[ALC245_FIXUP_CS35L41_SPI_4] = {
10087 		.type = HDA_FIXUP_FUNC,
10088 		.v.func = cs35l41_fixup_spi_four,
10089 	},
10090 	[ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
10091 		.type = HDA_FIXUP_FUNC,
10092 		.v.func = cs35l41_fixup_spi_four,
10093 		.chained = true,
10094 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
10095 	},
10096 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
10097 		.type = HDA_FIXUP_VERBS,
10098 		.v.verbs = (const struct hda_verb[]) {
10099 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
10100 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
10101 			 { }
10102 		},
10103 		.chained = true,
10104 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
10105 	},
10106 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
10107 		.type = HDA_FIXUP_FUNC,
10108 		.v.func = alc_fixup_dell4_mic_no_presence_quiet,
10109 		.chained = true,
10110 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10111 	},
10112 	[ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
10113 		.type = HDA_FIXUP_PINS,
10114 		.v.pins = (const struct hda_pintbl[]) {
10115 			{ 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
10116 			{ }
10117 		},
10118 		.chained = true,
10119 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
10120 	},
10121 	[ALC287_FIXUP_LEGION_16ITHG6] = {
10122 		.type = HDA_FIXUP_FUNC,
10123 		.v.func = alc287_fixup_legion_16ithg6_speakers,
10124 	},
10125 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
10126 		.type = HDA_FIXUP_VERBS,
10127 		.v.verbs = (const struct hda_verb[]) {
10128 			// enable left speaker
10129 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10130 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
10131 
10132 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10133 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
10134 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10135 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
10136 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10137 
10138 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10139 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
10140 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10141 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
10142 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10143 
10144 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10145 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
10146 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10147 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
10148 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10149 
10150 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10151 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10152 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10153 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10154 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10155 
10156 			// enable right speaker
10157 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
10158 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
10159 
10160 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10161 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
10162 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10163 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
10164 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10165 
10166 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10167 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
10168 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10169 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
10170 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10171 
10172 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10173 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
10174 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10175 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
10176 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10177 
10178 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
10179 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
10180 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10181 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
10182 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
10183 
10184 			{ },
10185 		},
10186 	},
10187 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
10188 		.type = HDA_FIXUP_FUNC,
10189 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
10190 		.chained = true,
10191 		.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
10192 	},
10193 	[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
10194 		.type = HDA_FIXUP_FUNC,
10195 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
10196 		.chained = true,
10197 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2,
10198 	},
10199 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
10200 		.type = HDA_FIXUP_FUNC,
10201 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
10202 		.chained = true,
10203 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10204 	},
10205 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
10206 		.type = HDA_FIXUP_PINS,
10207 		.v.func = alc1220_fixup_gb_dual_codecs,
10208 		.chained = true,
10209 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10210 	},
10211 	[ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
10212 		.type = HDA_FIXUP_FUNC,
10213 		.v.func = cs35l41_fixup_i2c_two,
10214 		.chained = true,
10215 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10216 	},
10217 	[ALC287_FIXUP_TAS2781_I2C] = {
10218 		.type = HDA_FIXUP_FUNC,
10219 		.v.func = tas2781_fixup_i2c,
10220 		.chained = true,
10221 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10222 	},
10223 	[ALC287_FIXUP_YOGA7_14ARB7_I2C] = {
10224 		.type = HDA_FIXUP_FUNC,
10225 		.v.func = yoga7_14arb7_fixup_i2c,
10226 		.chained = true,
10227 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10228 	},
10229 	[ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
10230 		.type = HDA_FIXUP_FUNC,
10231 		.v.func = alc245_fixup_hp_mute_led_coefbit,
10232 	},
10233 	[ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT] = {
10234 		.type = HDA_FIXUP_FUNC,
10235 		.v.func = alc245_fixup_hp_mute_led_v1_coefbit,
10236 	},
10237 	[ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
10238 		.type = HDA_FIXUP_FUNC,
10239 		.v.func = alc245_fixup_hp_mute_led_coefbit,
10240 		.chained = true,
10241 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
10242 	},
10243 	[ALC287_FIXUP_THINKPAD_I2S_SPK] = {
10244 		.type = HDA_FIXUP_FUNC,
10245 		.v.func = alc287_fixup_bind_dacs,
10246 		.chained = true,
10247 		.chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10248 	},
10249 	[ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
10250 		.type = HDA_FIXUP_FUNC,
10251 		.v.func = alc287_fixup_bind_dacs,
10252 		.chained = true,
10253 		.chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
10254 	},
10255 	[ALC2XX_FIXUP_HEADSET_MIC] = {
10256 		.type = HDA_FIXUP_FUNC,
10257 		.v.func = alc_fixup_headset_mic,
10258 	},
10259 	[ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
10260 		.type = HDA_FIXUP_FUNC,
10261 		.v.func = cs35l41_fixup_spi_two,
10262 		.chained = true,
10263 		.chain_id = ALC289_FIXUP_DUAL_SPK
10264 	},
10265 	[ALC294_FIXUP_CS35L41_I2C_2] = {
10266 		.type = HDA_FIXUP_FUNC,
10267 		.v.func = cs35l41_fixup_i2c_two,
10268 	},
10269 	[ALC256_FIXUP_ACER_SFG16_MICMUTE_LED] = {
10270 		.type = HDA_FIXUP_FUNC,
10271 		.v.func = alc256_fixup_acer_sfg16_micmute_led,
10272 	},
10273 	[ALC256_FIXUP_HEADPHONE_AMP_VOL] = {
10274 		.type = HDA_FIXUP_FUNC,
10275 		.v.func = alc256_decrease_headphone_amp_val,
10276 	},
10277 	[ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX] = {
10278 		.type = HDA_FIXUP_FUNC,
10279 		.v.func = alc245_fixup_hp_spectre_x360_eu0xxx,
10280 	},
10281 	[ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX] = {
10282 		.type = HDA_FIXUP_FUNC,
10283 		.v.func = alc245_fixup_hp_spectre_x360_16_aa0xxx,
10284 	},
10285 	[ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A] = {
10286 		.type = HDA_FIXUP_FUNC,
10287 		.v.func = alc245_fixup_hp_zbook_firefly_g12a,
10288 	},
10289 	[ALC285_FIXUP_ASUS_GA403U] = {
10290 		.type = HDA_FIXUP_FUNC,
10291 		.v.func = alc285_fixup_asus_ga403u,
10292 	},
10293 	[ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC] = {
10294 		.type = HDA_FIXUP_PINS,
10295 		.v.pins = (const struct hda_pintbl[]) {
10296 			{ 0x19, 0x03a11050 },
10297 			{ 0x1b, 0x03a11c30 },
10298 			{ }
10299 		},
10300 		.chained = true,
10301 		.chain_id = ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1
10302 	},
10303 	[ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1] = {
10304 		.type = HDA_FIXUP_FUNC,
10305 		.v.func = alc285_fixup_speaker2_to_dac1,
10306 		.chained = true,
10307 		.chain_id = ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
10308 	},
10309 	[ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC] = {
10310 		.type = HDA_FIXUP_PINS,
10311 		.v.pins = (const struct hda_pintbl[]) {
10312 			{ 0x19, 0x03a11050 },
10313 			{ 0x1b, 0x03a11c30 },
10314 			{ }
10315 		},
10316 	},
10317 	[ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1] = {
10318 		.type = HDA_FIXUP_FUNC,
10319 		.v.func = alc285_fixup_speaker2_to_dac1,
10320 		.chained = true,
10321 		.chain_id = ALC285_FIXUP_ASUS_GA403U,
10322 	},
10323 	[ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318] = {
10324 		.type = HDA_FIXUP_FUNC,
10325 		.v.func = alc287_fixup_lenovo_thinkpad_with_alc1318,
10326 		.chained = true,
10327 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
10328 	},
10329 	[ALC256_FIXUP_CHROME_BOOK] = {
10330 		.type = HDA_FIXUP_FUNC,
10331 		.v.func = alc256_fixup_chromebook,
10332 		.chained = true,
10333 		.chain_id = ALC225_FIXUP_HEADSET_JACK
10334 	},
10335 	[ALC245_FIXUP_CLEVO_NOISY_MIC] = {
10336 		.type = HDA_FIXUP_FUNC,
10337 		.v.func = alc269_fixup_limit_int_mic_boost,
10338 		.chained = true,
10339 		.chain_id = ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
10340 	},
10341 	[ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE] = {
10342 		.type = HDA_FIXUP_PINS,
10343 		.v.pins = (const struct hda_pintbl[]) {
10344 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10345 			{ 0x1b, 0x20a11040 }, /* dock mic */
10346 			{ }
10347 		},
10348 		.chained = true,
10349 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
10350 	},
10351 	[ALC233_FIXUP_MEDION_MTL_SPK] = {
10352 		.type = HDA_FIXUP_PINS,
10353 		.v.pins = (const struct hda_pintbl[]) {
10354 			{ 0x1b, 0x90170110 },
10355 			{ }
10356 		},
10357 	},
10358 	[ALC294_FIXUP_BASS_SPEAKER_15] = {
10359 		.type = HDA_FIXUP_FUNC,
10360 		.v.func = alc294_fixup_bass_speaker_15,
10361 	},
10362 	[ALC283_FIXUP_DELL_HP_RESUME] = {
10363 		.type = HDA_FIXUP_FUNC,
10364 		.v.func = alc283_fixup_dell_hp_resume,
10365 	},
10366 	[ALC294_FIXUP_ASUS_CS35L41_SPI_2] = {
10367 		.type = HDA_FIXUP_FUNC,
10368 		.v.func = cs35l41_fixup_spi_two,
10369 		.chained = true,
10370 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC,
10371 	},
10372 };
10373 
10374 static const struct hda_quirk alc269_fixup_tbl[] = {
10375 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
10376 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
10377 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
10378 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
10379 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10380 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
10381 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
10382 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10383 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10384 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
10385 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10386 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
10387 	SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10388 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
10389 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
10390 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
10391 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
10392 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10393 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10394 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10395 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
10396 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
10397 	SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10398 	SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10399 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
10400 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10401 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
10402 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
10403 	SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10404 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10405 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10406 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10407 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
10408 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10409 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10410 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10411 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
10412 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
10413 	SND_PCI_QUIRK(0x1025, 0x1360, "Acer Aspire A115", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10414 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10415 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10416 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10417 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
10418 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10419 	SND_PCI_QUIRK(0x1025, 0x159c, "Acer Nitro 5 AN515-58", ALC2XX_FIXUP_HEADSET_MIC),
10420 	SND_PCI_QUIRK(0x1025, 0x169a, "Acer Swift SFG16", ALC256_FIXUP_ACER_SFG16_MICMUTE_LED),
10421 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
10422 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
10423 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
10424 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
10425 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
10426 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
10427 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
10428 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
10429 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10430 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10431 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10432 	SND_PCI_QUIRK(0x1028, 0x0604, "Dell Venue 11 Pro 7130", ALC283_FIXUP_DELL_HP_RESUME),
10433 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
10434 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
10435 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
10436 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
10437 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
10438 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10439 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10440 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
10441 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
10442 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
10443 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
10444 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10445 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10446 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10447 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10448 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10449 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10450 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10451 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
10452 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
10453 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
10454 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
10455 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
10456 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
10457 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
10458 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
10459 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10460 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10461 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
10462 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
10463 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
10464 	SND_PCI_QUIRK(0x1028, 0x0879, "Dell Latitude 5420 Rugged", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10465 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
10466 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
10467 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10468 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
10469 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
10470 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
10471 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
10472 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
10473 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
10474 	SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
10475 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
10476 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
10477 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
10478 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10479 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10480 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
10481 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
10482 	SND_PCI_QUIRK(0x1028, 0x0b27, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
10483 	SND_PCI_QUIRK(0x1028, 0x0b28, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
10484 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10485 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10486 	SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10487 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10488 	SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10489 	SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10490 	SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10491 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
10492 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
10493 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
10494 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
10495 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
10496 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
10497 	SND_PCI_QUIRK(0x1028, 0x0c28, "Dell Inspiron 16 Plus 7630", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10498 	SND_PCI_QUIRK(0x1028, 0x0c4d, "Dell", ALC287_FIXUP_CS35L41_I2C_4),
10499 	SND_PCI_QUIRK(0x1028, 0x0c94, "Dell Polaris 3 metal", ALC287_FIXUP_TAS2781_I2C),
10500 	SND_PCI_QUIRK(0x1028, 0x0c96, "Dell Polaris 2in1", ALC287_FIXUP_TAS2781_I2C),
10501 	SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10502 	SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10503 	SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10504 	SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10505 	SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10506 	SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10507 	SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10508 	SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10509 	SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10510 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10511 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10512 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
10513 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
10514 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
10515 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10516 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10517 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10518 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10519 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
10520 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10521 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10522 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10523 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10524 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10525 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10526 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10527 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10528 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10529 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10530 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10531 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10532 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10533 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
10534 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
10535 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10536 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10537 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10538 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10539 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10540 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10541 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10542 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10543 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
10544 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10545 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
10546 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10547 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
10548 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10549 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10550 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10551 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10552 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10553 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10554 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10555 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10556 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10557 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10558 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10559 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10560 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10561 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10562 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
10563 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10564 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10565 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10566 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10567 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10568 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10569 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
10570 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10571 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10572 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
10573 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
10574 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
10575 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
10576 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
10577 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10578 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10579 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10580 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10581 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10582 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10583 	SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10584 	SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10585 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
10586 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10587 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
10588 	SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10589 	SND_PCI_QUIRK(0x103c, 0x8548, "HP EliteBook x360 830 G6", ALC285_FIXUP_HP_GPIO_LED),
10590 	SND_PCI_QUIRK(0x103c, 0x854a, "HP EliteBook 830 G6", ALC285_FIXUP_HP_GPIO_LED),
10591 	SND_PCI_QUIRK(0x103c, 0x85c6, "HP Pavilion x360 Convertible 14-dy1xxx", ALC295_FIXUP_HP_MUTE_LED_COEFBIT11),
10592 	SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
10593 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10594 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10595 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10596 	SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10597 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
10598 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10599 	SND_PCI_QUIRK(0x103c, 0x863e, "HP Spectre x360 15-df1xxx", ALC285_FIXUP_HP_SPECTRE_X360_DF1),
10600 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10601 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
10602 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10603 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10604 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
10605 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
10606 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
10607 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10608 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10609 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10610 	SND_PCI_QUIRK(0x103c, 0x8760, "HP EliteBook 8{4,5}5 G7", ALC285_FIXUP_HP_BEEP_MICMUTE_LED),
10611 	SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10612 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
10613 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10614 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
10615 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10616 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
10617 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
10618 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10619 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10620 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10621 	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10622 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
10623 	SND_PCI_QUIRK(0x103c, 0x87cc, "HP Pavilion 15-eg0xxx", ALC287_FIXUP_HP_GPIO_LED),
10624 	SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10625 	SND_PCI_QUIRK(0x103c, 0x87df, "HP ProBook 430 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10626 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10627 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10628 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10629 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10630 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
10631 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
10632 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10633 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10634 	SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10635 	SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10636 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10637 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10638 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10639 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10640 	SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10641 	SND_PCI_QUIRK(0x103c, 0x881e, "HP Laptop 15s-du3xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10642 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10643 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10644 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10645 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10646 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10647 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10648 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10649 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10650 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10651 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10652 	SND_PCI_QUIRK(0x103c, 0x887c, "HP Laptop 14s-fq1xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10653 	SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10654 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
10655 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
10656 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
10657 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10658 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
10659 	SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
10660 	SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
10661 	SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10662 	SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
10663 	SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10664 	SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10665 	SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10666 	SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10667 	SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10668 	SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10669 	SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10670 	SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
10671 	SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
10672 	SND_PCI_QUIRK(0x103c, 0x898a, "HP Pavilion 15-eg100", ALC287_FIXUP_HP_GPIO_LED),
10673 	SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10674 	SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10675 	SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10676 	SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
10677 	SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10678 	SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
10679 	SND_PCI_QUIRK(0x103c, 0x89a0, "HP Laptop 15-dw4xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10680 	SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
10681 	SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
10682 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
10683 	SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
10684 	SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
10685 	SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10686 	SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10687 	SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10688 	SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10689 	SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10690 	SND_PCI_QUIRK(0x103c, 0x89e7, "HP Elite x2 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10691 	SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
10692 	SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10693 	SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10694 	SND_PCI_QUIRK(0x103c, 0x8a26, "HP Victus 16-d1xxx (MB 8A26)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10695 	SND_PCI_QUIRK(0x103c, 0x8a28, "HP Envy 13", ALC287_FIXUP_CS35L41_I2C_2),
10696 	SND_PCI_QUIRK(0x103c, 0x8a29, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10697 	SND_PCI_QUIRK(0x103c, 0x8a2a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10698 	SND_PCI_QUIRK(0x103c, 0x8a2b, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10699 	SND_PCI_QUIRK(0x103c, 0x8a2c, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10700 	SND_PCI_QUIRK(0x103c, 0x8a2d, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10701 	SND_PCI_QUIRK(0x103c, 0x8a2e, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10702 	SND_PCI_QUIRK(0x103c, 0x8a30, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10703 	SND_PCI_QUIRK(0x103c, 0x8a31, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10704 	SND_PCI_QUIRK(0x103c, 0x8a4f, "HP Victus 15-fa0xxx (MB 8A4F)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10705 	SND_PCI_QUIRK(0x103c, 0x8a6e, "HP EDNA 360", ALC287_FIXUP_CS35L41_I2C_4),
10706 	SND_PCI_QUIRK(0x103c, 0x8a74, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10707 	SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10708 	SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
10709 	SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
10710 	SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
10711 	SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
10712 	SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
10713 	SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10714 	SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10715 	SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10716 	SND_PCI_QUIRK(0x103c, 0x8ad8, "HP 800 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10717 	SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10718 	SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10719 	SND_PCI_QUIRK(0x103c, 0x8b3a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10720 	SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
10721 	SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10722 	SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10723 	SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10724 	SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10725 	SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10726 	SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10727 	SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10728 	SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10729 	SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10730 	SND_PCI_QUIRK(0x103c, 0x8b5f, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10731 	SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10732 	SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10733 	SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10734 	SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10735 	SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10736 	SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10737 	SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
10738 	SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10739 	SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10740 	SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
10741 	SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10742 	SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
10743 	SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10744 	SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10745 	SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10746 	SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10747 	SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10748 	SND_PCI_QUIRK(0x103c, 0x8bb3, "HP Slim OMEN", ALC287_FIXUP_CS35L41_I2C_2),
10749 	SND_PCI_QUIRK(0x103c, 0x8bb4, "HP Slim OMEN", ALC287_FIXUP_CS35L41_I2C_2),
10750 	SND_PCI_QUIRK(0x103c, 0x8bbe, "HP Victus 16-r0xxx (MB 8BBE)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10751 	SND_PCI_QUIRK(0x103c, 0x8bc8, "HP Victus 15-fa1xxx", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10752 	SND_PCI_QUIRK(0x103c, 0x8bcd, "HP Omen 16-xd0xxx", ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT),
10753 	SND_PCI_QUIRK(0x103c, 0x8bd4, "HP Victus 16-s0xxx (MB 8BD4)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10754 	SND_PCI_QUIRK(0x103c, 0x8bdd, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10755 	SND_PCI_QUIRK(0x103c, 0x8bde, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10756 	SND_PCI_QUIRK(0x103c, 0x8bdf, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10757 	SND_PCI_QUIRK(0x103c, 0x8be0, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10758 	SND_PCI_QUIRK(0x103c, 0x8be1, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10759 	SND_PCI_QUIRK(0x103c, 0x8be2, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10760 	SND_PCI_QUIRK(0x103c, 0x8be3, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10761 	SND_PCI_QUIRK(0x103c, 0x8be5, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10762 	SND_PCI_QUIRK(0x103c, 0x8be6, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10763 	SND_PCI_QUIRK(0x103c, 0x8be7, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10764 	SND_PCI_QUIRK(0x103c, 0x8be8, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10765 	SND_PCI_QUIRK(0x103c, 0x8be9, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10766 	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10767 	SND_PCI_QUIRK(0x103c, 0x8c15, "HP Spectre x360 2-in-1 Laptop 14-eu0xxx", ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX),
10768 	SND_PCI_QUIRK(0x103c, 0x8c16, "HP Spectre x360 2-in-1 Laptop 16-aa0xxx", ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX),
10769 	SND_PCI_QUIRK(0x103c, 0x8c17, "HP Spectre 16", ALC287_FIXUP_CS35L41_I2C_2),
10770 	SND_PCI_QUIRK(0x103c, 0x8c21, "HP Pavilion Plus Laptop 14-ey0XXX", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10771 	SND_PCI_QUIRK(0x103c, 0x8c30, "HP Victus 15-fb1xxx", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10772 	SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10773 	SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10774 	SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10775 	SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10776 	SND_PCI_QUIRK(0x103c, 0x8c4d, "HP Omen", ALC287_FIXUP_CS35L41_I2C_2),
10777 	SND_PCI_QUIRK(0x103c, 0x8c4e, "HP Omen", ALC287_FIXUP_CS35L41_I2C_2),
10778 	SND_PCI_QUIRK(0x103c, 0x8c4f, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10779 	SND_PCI_QUIRK(0x103c, 0x8c50, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10780 	SND_PCI_QUIRK(0x103c, 0x8c51, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10781 	SND_PCI_QUIRK(0x103c, 0x8c52, "HP EliteBook 1040 G11", ALC285_FIXUP_HP_GPIO_LED),
10782 	SND_PCI_QUIRK(0x103c, 0x8c53, "HP Elite x360 1040 2-in-1 G11", ALC285_FIXUP_HP_GPIO_LED),
10783 	SND_PCI_QUIRK(0x103c, 0x8c66, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10784 	SND_PCI_QUIRK(0x103c, 0x8c67, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10785 	SND_PCI_QUIRK(0x103c, 0x8c68, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10786 	SND_PCI_QUIRK(0x103c, 0x8c6a, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10787 	SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10788 	SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10789 	SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10790 	SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10791 	SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10792 	SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10793 	SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10794 	SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10795 	SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10796 	SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10797 	SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10798 	SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10799 	SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10800 	SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10801 	SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10802 	SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10803 	SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10804 	SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10805 	SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10806 	SND_PCI_QUIRK(0x103c, 0x8c99, "HP Victus 16-r1xxx (MB 8C99)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10807 	SND_PCI_QUIRK(0x103c, 0x8c9c, "HP Victus 16-s1xxx (MB 8C9C)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10808 	SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10809 	SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10810 	SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10811 	SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10812 	SND_PCI_QUIRK(0x103c, 0x8caf, "HP Elite mt645 G8 Mobile Thin Client", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10813 	SND_PCI_QUIRK(0x103c, 0x8cbd, "HP Pavilion Aero Laptop 13-bg0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10814 	SND_PCI_QUIRK(0x103c, 0x8cdd, "HP Spectre", ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX),
10815 	SND_PCI_QUIRK(0x103c, 0x8cde, "HP OmniBook Ultra Flip Laptop 14t", ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX),
10816 	SND_PCI_QUIRK(0x103c, 0x8cdf, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10817 	SND_PCI_QUIRK(0x103c, 0x8ce0, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10818 	SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10819 	SND_PCI_QUIRK(0x103c, 0x8d01, "HP ZBook Power 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10820 	SND_PCI_QUIRK(0x103c, 0x8d84, "HP EliteBook X G1i", ALC285_FIXUP_HP_GPIO_LED),
10821 	SND_PCI_QUIRK(0x103c, 0x8d85, "HP EliteBook 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10822 	SND_PCI_QUIRK(0x103c, 0x8d86, "HP Elite X360 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10823 	SND_PCI_QUIRK(0x103c, 0x8d8c, "HP EliteBook 13 G12", ALC285_FIXUP_HP_GPIO_LED),
10824 	SND_PCI_QUIRK(0x103c, 0x8d8d, "HP Elite X360 13 G12", ALC285_FIXUP_HP_GPIO_LED),
10825 	SND_PCI_QUIRK(0x103c, 0x8d8e, "HP EliteBook 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10826 	SND_PCI_QUIRK(0x103c, 0x8d8f, "HP EliteBook 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10827 	SND_PCI_QUIRK(0x103c, 0x8d90, "HP EliteBook 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10828 	SND_PCI_QUIRK(0x103c, 0x8d91, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10829 	SND_PCI_QUIRK(0x103c, 0x8d92, "HP ZBook Firefly 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10830 	SND_PCI_QUIRK(0x103c, 0x8d9b, "HP 17 Turbine OmniBook 7 UMA", ALC287_FIXUP_CS35L41_I2C_2),
10831 	SND_PCI_QUIRK(0x103c, 0x8d9c, "HP 17 Turbine OmniBook 7 DIS", ALC287_FIXUP_CS35L41_I2C_2),
10832 	SND_PCI_QUIRK(0x103c, 0x8d9d, "HP 17 Turbine OmniBook X UMA", ALC287_FIXUP_CS35L41_I2C_2),
10833 	SND_PCI_QUIRK(0x103c, 0x8d9e, "HP 17 Turbine OmniBook X DIS", ALC287_FIXUP_CS35L41_I2C_2),
10834 	SND_PCI_QUIRK(0x103c, 0x8d9f, "HP 14 Cadet (x360)", ALC287_FIXUP_CS35L41_I2C_2),
10835 	SND_PCI_QUIRK(0x103c, 0x8da0, "HP 16 Clipper OmniBook 7(X360)", ALC287_FIXUP_CS35L41_I2C_2),
10836 	SND_PCI_QUIRK(0x103c, 0x8da1, "HP 16 Clipper OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10837 	SND_PCI_QUIRK(0x103c, 0x8da7, "HP 14 Enstrom OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10838 	SND_PCI_QUIRK(0x103c, 0x8da8, "HP 16 Piston OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10839 	SND_PCI_QUIRK(0x103c, 0x8dec, "HP EliteBook 640 G12", ALC236_FIXUP_HP_GPIO_LED),
10840 	SND_PCI_QUIRK(0x103c, 0x8dee, "HP EliteBook 660 G12", ALC236_FIXUP_HP_GPIO_LED),
10841 	SND_PCI_QUIRK(0x103c, 0x8df0, "HP EliteBook 630 G12", ALC236_FIXUP_HP_GPIO_LED),
10842 	SND_PCI_QUIRK(0x103c, 0x8dfc, "HP EliteBook 645 G12", ALC236_FIXUP_HP_GPIO_LED),
10843 	SND_PCI_QUIRK(0x103c, 0x8dfe, "HP EliteBook 665 G12", ALC236_FIXUP_HP_GPIO_LED),
10844 	SND_PCI_QUIRK(0x103c, 0x8e11, "HP Trekker", ALC287_FIXUP_CS35L41_I2C_2),
10845 	SND_PCI_QUIRK(0x103c, 0x8e12, "HP Trekker", ALC287_FIXUP_CS35L41_I2C_2),
10846 	SND_PCI_QUIRK(0x103c, 0x8e13, "HP Trekker", ALC287_FIXUP_CS35L41_I2C_2),
10847 	SND_PCI_QUIRK(0x103c, 0x8e14, "HP ZBook Firefly 14 G12", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10848 	SND_PCI_QUIRK(0x103c, 0x8e15, "HP ZBook Firefly 14 G12", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10849 	SND_PCI_QUIRK(0x103c, 0x8e16, "HP ZBook Firefly 14 G12", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10850 	SND_PCI_QUIRK(0x103c, 0x8e17, "HP ZBook Firefly 14 G12", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10851 	SND_PCI_QUIRK(0x103c, 0x8e18, "HP ZBook Firefly 14 G12A", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10852 	SND_PCI_QUIRK(0x103c, 0x8e19, "HP ZBook Firefly 14 G12A", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10853 	SND_PCI_QUIRK(0x103c, 0x8e1a, "HP ZBook Firefly 14 G12A", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10854 	SND_PCI_QUIRK(0x103c, 0x8e1b, "HP EliteBook G12", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10855 	SND_PCI_QUIRK(0x103c, 0x8e1c, "HP EliteBook G12", ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A),
10856 	SND_PCI_QUIRK(0x103c, 0x8e1d, "HP ZBook X Gli 16 G12", ALC236_FIXUP_HP_GPIO_LED),
10857 	SND_PCI_QUIRK(0x103c, 0x8e2c, "HP EliteBook 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10858 	SND_PCI_QUIRK(0x103c, 0x8e36, "HP 14 Enstrom OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10859 	SND_PCI_QUIRK(0x103c, 0x8e37, "HP 16 Piston OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
10860 	SND_PCI_QUIRK(0x103c, 0x8e3a, "HP Agusta", ALC287_FIXUP_CS35L41_I2C_2),
10861 	SND_PCI_QUIRK(0x103c, 0x8e3b, "HP Agusta", ALC287_FIXUP_CS35L41_I2C_2),
10862 	SND_PCI_QUIRK(0x103c, 0x8e60, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2),
10863 	SND_PCI_QUIRK(0x103c, 0x8e61, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2),
10864 	SND_PCI_QUIRK(0x103c, 0x8e62, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2),
10865 	SND_PCI_QUIRK(0x1043, 0x1032, "ASUS VivoBook X513EA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10866 	SND_PCI_QUIRK(0x1043, 0x1034, "ASUS GU605C", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10867 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10868 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10869 	SND_PCI_QUIRK(0x1043, 0x1054, "ASUS G614FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2),
10870 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10871 	SND_PCI_QUIRK(0x1043, 0x106f, "ASUS VivoBook X515UA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10872 	SND_PCI_QUIRK(0x1043, 0x1074, "ASUS G614PH/PM/PP", ALC287_FIXUP_CS35L41_I2C_2),
10873 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10874 	SND_PCI_QUIRK(0x1043, 0x10a4, "ASUS TP3407SA", ALC287_FIXUP_TAS2781_I2C),
10875 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10876 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10877 	SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10878 	SND_PCI_QUIRK(0x1043, 0x1154, "ASUS TP3607SH", ALC287_FIXUP_TAS2781_I2C),
10879 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10880 	SND_PCI_QUIRK(0x1043, 0x1194, "ASUS UM3406KA", ALC287_FIXUP_CS35L41_I2C_2),
10881 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10882 	SND_PCI_QUIRK(0x1043, 0x1204, "ASUS Strix G615JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C),
10883 	SND_PCI_QUIRK(0x1043, 0x1214, "ASUS Strix G615LH_LM_LP", ALC287_FIXUP_TAS2781_I2C),
10884 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10885 	SND_PCI_QUIRK(0x1043, 0x1264, "ASUS UM5606KA", ALC294_FIXUP_BASS_SPEAKER_15),
10886 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10887 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10888 	SND_PCI_QUIRK(0x1043, 0x1294, "ASUS B3405CVA", ALC245_FIXUP_CS35L41_SPI_2),
10889 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10890 	SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10891 	SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10892 	SND_PCI_QUIRK(0x1043, 0x12b4, "ASUS B3405CCA / P3405CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10893 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10894 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10895 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10896 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10897 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10898 	SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVV", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10899 	SND_PCI_QUIRK(0x1043, 0x1460, "Asus VivoBook 15", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10900 	SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X/GA402N", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10901 	SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604VI/VC/VE/VG/VJ/VQ/VU/VV/VY/VZ", ALC285_FIXUP_ASUS_HEADSET_MIC),
10902 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603VQ/VU/VV/VJ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10903 	SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601VV/VU/VJ/VQ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10904 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G614JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10905 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS G513PI/PU/PV", ALC287_FIXUP_CS35L41_I2C_2),
10906 	SND_PCI_QUIRK(0x1043, 0x14f2, "ASUS VivoBook X515JA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10907 	SND_PCI_QUIRK(0x1043, 0x1503, "ASUS G733PY/PZ/PZV/PYV", ALC287_FIXUP_CS35L41_I2C_2),
10908 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10909 	SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA/XJ/XQ/XU/XV/XI", ALC287_FIXUP_CS35L41_I2C_2),
10910 	SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301VV/VQ/VU/VJ/VA/VC/VE/VVC/VQC/VUC/VJC/VEC/VCC", ALC285_FIXUP_ASUS_HEADSET_MIC),
10911 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10912 	SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZI/ZJ/ZQ/ZU/ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10913 	SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10914 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10915 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10916 	SND_PCI_QUIRK(0x1043, 0x16d3, "ASUS UX5304VA", ALC245_FIXUP_CS35L41_SPI_2),
10917 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10918 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS UX7602VI/BZ", ALC245_FIXUP_CS35L41_SPI_2),
10919 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10920 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10921 	SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally NR2301L/X", ALC294_FIXUP_ASUS_ALLY),
10922 	SND_PCI_QUIRK(0x1043, 0x1863, "ASUS UX6404VI/VV", ALC245_FIXUP_CS35L41_SPI_2),
10923 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10924 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10925 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10926 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10927 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10928 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10929 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10930 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10931 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10932 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10933 	SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10934 	SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10935 	SND_PCI_QUIRK(0x1043, 0x1a8e, "ASUS G712LWS", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10936 	SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10937 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10938 	SND_PCI_QUIRK(0x1043, 0x1b13, "ASUS U41SV/GA403U", ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC),
10939 	SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10940 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10941 	SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10942 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10943 	SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10944 	SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10945 	SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10946 	SND_PCI_QUIRK(0x1043, 0x1c63, "ASUS GU605M", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10947 	SND_PCI_QUIRK(0x1043, 0x1c80, "ASUS VivoBook TP401", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10948 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10949 	SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JU/JV/JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10950 	SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JY/JZ/JI/JG", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10951 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10952 	SND_PCI_QUIRK(0x1043, 0x1ccf, "ASUS G814JU/JV/JI", ALC245_FIXUP_CS35L41_SPI_2),
10953 	SND_PCI_QUIRK(0x1043, 0x1cdf, "ASUS G814JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10954 	SND_PCI_QUIRK(0x1043, 0x1cef, "ASUS G834JY/JZ/JI/JG", ALC285_FIXUP_ASUS_HEADSET_MIC),
10955 	SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS G713PI/PU/PV/PVN", ALC287_FIXUP_CS35L41_I2C_2),
10956 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10957 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10958 	SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10959 	SND_PCI_QUIRK(0x1043, 0x1df3, "ASUS UM5606WA", ALC294_FIXUP_BASS_SPEAKER_15),
10960 	SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10961 	SND_PCI_QUIRK(0x1043, 0x1e10, "ASUS VivoBook X507UAR", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10962 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10963 	SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10964 	SND_PCI_QUIRK(0x1043, 0x1e1f, "ASUS Vivobook 15 X1504VAP", ALC2XX_FIXUP_HEADSET_MIC),
10965 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10966 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10967 	SND_PCI_QUIRK(0x1043, 0x1e63, "ASUS H7606W", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10968 	SND_PCI_QUIRK(0x1043, 0x1e83, "ASUS GA605W", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10969 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10970 	SND_PCI_QUIRK(0x1043, 0x1eb3, "ASUS Ally RCLA72", ALC287_FIXUP_TAS2781_I2C),
10971 	SND_PCI_QUIRK(0x1043, 0x1ed3, "ASUS HN7306W", ALC287_FIXUP_CS35L41_I2C_2),
10972 	SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10973 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10974 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10975 	SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10976 	SND_PCI_QUIRK(0x1043, 0x1f1f, "ASUS H7604JI/JV/J3D", ALC245_FIXUP_CS35L41_SPI_2),
10977 	SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10978 	SND_PCI_QUIRK(0x1043, 0x1f63, "ASUS P5405CSA", ALC245_FIXUP_CS35L41_SPI_2),
10979 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10980 	SND_PCI_QUIRK(0x1043, 0x1fb3, "ASUS ROG Flow Z13 GZ302EA", ALC287_FIXUP_CS35L41_I2C_2),
10981 	SND_PCI_QUIRK(0x1043, 0x3011, "ASUS B5605CVA", ALC245_FIXUP_CS35L41_SPI_2),
10982 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10983 	SND_PCI_QUIRK(0x1043, 0x3061, "ASUS B3405CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10984 	SND_PCI_QUIRK(0x1043, 0x3071, "ASUS B5405CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10985 	SND_PCI_QUIRK(0x1043, 0x30c1, "ASUS B3605CCA / P3605CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10986 	SND_PCI_QUIRK(0x1043, 0x30d1, "ASUS B5405CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10987 	SND_PCI_QUIRK(0x1043, 0x30e1, "ASUS B5605CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10988 	SND_PCI_QUIRK(0x1043, 0x31d0, "ASUS Zen AIO 27 Z272SD_A272SD", ALC274_FIXUP_ASUS_ZEN_AIO_27),
10989 	SND_PCI_QUIRK(0x1043, 0x31e1, "ASUS B5605CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10990 	SND_PCI_QUIRK(0x1043, 0x31f1, "ASUS B3605CCA", ALC294_FIXUP_ASUS_CS35L41_SPI_2),
10991 	SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10992 	SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10993 	SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10994 	SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10995 	SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10996 	SND_PCI_QUIRK(0x1043, 0x3d78, "ASUS GA603KH", ALC287_FIXUP_CS35L41_I2C_2),
10997 	SND_PCI_QUIRK(0x1043, 0x3d88, "ASUS GA603KM", ALC287_FIXUP_CS35L41_I2C_2),
10998 	SND_PCI_QUIRK(0x1043, 0x3e00, "ASUS G814FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2),
10999 	SND_PCI_QUIRK(0x1043, 0x3e20, "ASUS G814PH/PM/PP", ALC287_FIXUP_CS35L41_I2C_2),
11000 	SND_PCI_QUIRK(0x1043, 0x3e30, "ASUS TP3607SA", ALC287_FIXUP_TAS2781_I2C),
11001 	SND_PCI_QUIRK(0x1043, 0x3ee0, "ASUS Strix G815_JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C),
11002 	SND_PCI_QUIRK(0x1043, 0x3ef0, "ASUS Strix G635LR_LW_LX", ALC287_FIXUP_TAS2781_I2C),
11003 	SND_PCI_QUIRK(0x1043, 0x3f00, "ASUS Strix G815LH_LM_LP", ALC287_FIXUP_TAS2781_I2C),
11004 	SND_PCI_QUIRK(0x1043, 0x3f10, "ASUS Strix G835LR_LW_LX", ALC287_FIXUP_TAS2781_I2C),
11005 	SND_PCI_QUIRK(0x1043, 0x3f20, "ASUS Strix G615LR_LW", ALC287_FIXUP_TAS2781_I2C),
11006 	SND_PCI_QUIRK(0x1043, 0x3f30, "ASUS Strix G815LR_LW", ALC287_FIXUP_TAS2781_I2C),
11007 	SND_PCI_QUIRK(0x1043, 0x3fd0, "ASUS B3605CVA", ALC245_FIXUP_CS35L41_SPI_2),
11008 	SND_PCI_QUIRK(0x1043, 0x3ff0, "ASUS B5405CVA", ALC245_FIXUP_CS35L41_SPI_2),
11009 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
11010 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
11011 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
11012 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
11013 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
11014 	SND_PCI_QUIRK(0x1043, 0x88f4, "ASUS NUC14LNS", ALC245_FIXUP_CS35L41_SPI_1),
11015 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
11016 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
11017 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
11018 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
11019 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
11020 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
11021 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
11022 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
11023 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
11024 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
11025 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
11026 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
11027 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
11028 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
11029 	SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
11030 	SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11031 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
11032 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
11033 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
11034 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
11035 	SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
11036 	SND_PCI_QUIRK(0x10ec, 0x12f6, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
11037 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
11038 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
11039 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
11040 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
11041 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
11042 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
11043 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
11044 	SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
11045 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
11046 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
11047 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
11048 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
11049 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
11050 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
11051 	SND_PCI_QUIRK(0x144d, 0xca06, "Samsung Galaxy Book3 360 (NP730QFG)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
11052 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
11053 	SND_PCI_QUIRK(0x144d, 0xc870, "Samsung Galaxy Book2 Pro (NP950XED)", ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS),
11054 	SND_PCI_QUIRK(0x144d, 0xc872, "Samsung Galaxy Book2 Pro (NP950XEE)", ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS),
11055 	SND_PCI_QUIRK(0x144d, 0xc886, "Samsung Galaxy Book3 Pro (NP964XFG)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11056 	SND_PCI_QUIRK(0x144d, 0xc1ca, "Samsung Galaxy Book3 Pro 360 (NP960QFG)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11057 	SND_PCI_QUIRK(0x144d, 0xc1cc, "Samsung Galaxy Book3 Ultra (NT960XFH)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11058 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
11059 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
11060 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
11061 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
11062 	SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
11063 	SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11064 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11065 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11066 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11067 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11068 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11069 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11070 	SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11071 	SND_PCI_QUIRK(0x1558, 0x28c1, "Clevo V370VND", ALC2XX_FIXUP_HEADSET_MIC),
11072 	SND_PCI_QUIRK(0x1558, 0x35a1, "Clevo V3[56]0EN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11073 	SND_PCI_QUIRK(0x1558, 0x35b1, "Clevo V3[57]0WN[MNP]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11074 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11075 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11076 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11077 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11078 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11079 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11080 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11081 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11082 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11083 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11084 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11085 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11086 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11087 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11088 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11089 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11090 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11091 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11092 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11093 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11094 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11095 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11096 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11097 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11098 	SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11099 	SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11100 	SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11101 	SND_PCI_QUIRK(0x1558, 0x5700, "Clevo X560WN[RST]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11102 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11103 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11104 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11105 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11106 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11107 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11108 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11109 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11110 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11111 	SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11112 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11113 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11114 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11115 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11116 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11117 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11118 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11119 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
11120 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
11121 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
11122 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11123 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11124 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11125 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11126 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11127 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
11128 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11129 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11130 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11131 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11132 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11133 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11134 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11135 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11136 	SND_PCI_QUIRK(0x1558, 0xa554, "VAIO VJFH52", ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE),
11137 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11138 	SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11139 	SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11140 	SND_PCI_QUIRK(0x1558, 0xa741, "Clevo V54x_6x_TNE", ALC245_FIXUP_CLEVO_NOISY_MIC),
11141 	SND_PCI_QUIRK(0x1558, 0xa743, "Clevo V54x_6x_TU", ALC245_FIXUP_CLEVO_NOISY_MIC),
11142 	SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC245_FIXUP_CLEVO_NOISY_MIC),
11143 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11144 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11145 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11146 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11147 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11148 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11149 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
11150 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
11151 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
11152 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
11153 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
11154 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
11155 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
11156 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
11157 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
11158 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
11159 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
11160 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
11161 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
11162 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
11163 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
11164 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
11165 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
11166 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
11167 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
11168 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11169 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
11170 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
11171 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
11172 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11173 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11174 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
11175 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
11176 	SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
11177 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
11178 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11179 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11180 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
11181 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11182 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11183 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11184 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11185 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
11186 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
11187 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
11188 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
11189 	SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11190 	SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11191 	SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11192 	SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11193 	SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11194 	SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11195 	SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11196 	SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11197 	SND_PCI_QUIRK(0x17aa, 0x231e, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
11198 	SND_PCI_QUIRK(0x17aa, 0x231f, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
11199 	SND_PCI_QUIRK(0x17aa, 0x2326, "Hera2", ALC287_FIXUP_TAS2781_I2C),
11200 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
11201 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
11202 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11203 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11204 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11205 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11206 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
11207 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11208 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11209 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
11210 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
11211 	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
11212 	SND_PCI_QUIRK(0x17aa, 0x3384, "ThinkCentre M90a PRO", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11213 	SND_PCI_QUIRK(0x17aa, 0x3386, "ThinkCentre M90a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11214 	SND_PCI_QUIRK(0x17aa, 0x3387, "ThinkCentre M70a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED),
11215 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11216 	HDA_CODEC_QUIRK(0x17aa, 0x3802, "DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11217 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8", ALC287_FIXUP_TAS2781_I2C),
11218 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
11219 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
11220 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
11221 	HDA_CODEC_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
11222 	SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11223 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
11224 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
11225 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11226 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
11227 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
11228 	SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
11229 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11230 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11231 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
11232 	SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
11233 	SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
11234 	SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
11235 	SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11236 	HDA_CODEC_QUIRK(0x17aa, 0x386e, "Legion Y9000X 2022 IAH7", ALC287_FIXUP_CS35L41_I2C_2),
11237 	SND_PCI_QUIRK(0x17aa, 0x386e, "Yoga Pro 7 14ARP8", ALC285_FIXUP_SPEAKER2_TO_DAC1),
11238 	HDA_CODEC_QUIRK(0x17aa, 0x38a8, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C), /* this must match before PCI SSID 17aa:386f below */
11239 	SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7i 16IAX7", ALC287_FIXUP_CS35L41_I2C_2),
11240 	SND_PCI_QUIRK(0x17aa, 0x3870, "Lenovo Yoga 7 14ARB7", ALC287_FIXUP_YOGA7_14ARB7_I2C),
11241 	SND_PCI_QUIRK(0x17aa, 0x3877, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
11242 	SND_PCI_QUIRK(0x17aa, 0x3878, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
11243 	SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
11244 	SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
11245 	SND_PCI_QUIRK(0x17aa, 0x387f, "Yoga S780-16 pro dual LX", ALC287_FIXUP_TAS2781_I2C),
11246 	SND_PCI_QUIRK(0x17aa, 0x3880, "Yoga S780-16 pro dual YC", ALC287_FIXUP_TAS2781_I2C),
11247 	SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
11248 	SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11249 	SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11250 	SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
11251 	SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11252 	SND_PCI_QUIRK(0x17aa, 0x38a5, "Y580P AMD dual", ALC287_FIXUP_TAS2781_I2C),
11253 	SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
11254 	SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
11255 	SND_PCI_QUIRK(0x17aa, 0x38a9, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11256 	SND_PCI_QUIRK(0x17aa, 0x38ab, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11257 	SND_PCI_QUIRK(0x17aa, 0x38b4, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
11258 	SND_PCI_QUIRK(0x17aa, 0x38b5, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
11259 	SND_PCI_QUIRK(0x17aa, 0x38b6, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
11260 	SND_PCI_QUIRK(0x17aa, 0x38b7, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
11261 	SND_PCI_QUIRK(0x17aa, 0x38b8, "Yoga S780-14.5 proX AMD YC Dual", ALC287_FIXUP_TAS2781_I2C),
11262 	SND_PCI_QUIRK(0x17aa, 0x38b9, "Yoga S780-14.5 proX AMD LX Dual", ALC287_FIXUP_TAS2781_I2C),
11263 	SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
11264 	SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
11265 	SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
11266 	SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
11267 	SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
11268 	SND_PCI_QUIRK(0x17aa, 0x38c7, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
11269 	SND_PCI_QUIRK(0x17aa, 0x38c8, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
11270 	SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11271 	SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
11272 	SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
11273 	SND_PCI_QUIRK(0x17aa, 0x38d3, "Yoga S990-16 Pro IMH YC Dual", ALC287_FIXUP_TAS2781_I2C),
11274 	SND_PCI_QUIRK(0x17aa, 0x38d4, "Yoga S990-16 Pro IMH VECO Dual", ALC287_FIXUP_TAS2781_I2C),
11275 	SND_PCI_QUIRK(0x17aa, 0x38d5, "Yoga S990-16 Pro IMH YC Quad", ALC287_FIXUP_TAS2781_I2C),
11276 	SND_PCI_QUIRK(0x17aa, 0x38d6, "Yoga S990-16 Pro IMH VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11277 	SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
11278 	SND_PCI_QUIRK(0x17aa, 0x38df, "Yoga Y990 Intel YC Dual", ALC287_FIXUP_TAS2781_I2C),
11279 	SND_PCI_QUIRK(0x17aa, 0x38e0, "Yoga Y990 Intel VECO Dual", ALC287_FIXUP_TAS2781_I2C),
11280 	SND_PCI_QUIRK(0x17aa, 0x38f8, "Yoga Book 9i", ALC287_FIXUP_TAS2781_I2C),
11281 	SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
11282 	SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11283 	SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
11284 	SND_PCI_QUIRK(0x17aa, 0x38fd, "ThinkBook plus Gen5 Hybrid", ALC287_FIXUP_TAS2781_I2C),
11285 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11286 	SND_PCI_QUIRK(0x17aa, 0x390d, "Lenovo Yoga Pro 7 14ASP10", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
11287 	SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
11288 	SND_PCI_QUIRK(0x17aa, 0x391f, "Yoga S990-16 pro Quad YC Quad", ALC287_FIXUP_TAS2781_I2C),
11289 	SND_PCI_QUIRK(0x17aa, 0x3920, "Yoga S990-16 pro Quad VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11290 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
11291 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11292 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
11293 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11294 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
11295 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
11296 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11297 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
11298 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
11299 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
11300 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
11301 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
11302 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
11303 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
11304 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
11305 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11306 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11307 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11308 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
11309 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11310 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11311 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
11312 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
11313 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
11314 	SND_PCI_QUIRK(0x1849, 0x0269, "Positivo Master C6400", ALC269VB_FIXUP_ASUS_ZENBOOK),
11315 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
11316 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
11317 	SND_PCI_QUIRK(0x1854, 0x0440, "LG CQ6", ALC256_FIXUP_HEADPHONE_AMP_VOL),
11318 	SND_PCI_QUIRK(0x1854, 0x0441, "LG CQ6 AIO", ALC256_FIXUP_HEADPHONE_AMP_VOL),
11319 	SND_PCI_QUIRK(0x1854, 0x0488, "LG gram 16 (16Z90R)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11320 	SND_PCI_QUIRK(0x1854, 0x0489, "LG gram 16 (16Z90R-A)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11321 	SND_PCI_QUIRK(0x1854, 0x048a, "LG gram 17 (17ZD90R)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
11322 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
11323 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
11324 	SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
11325 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
11326 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
11327 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
11328 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
11329 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
11330 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
11331 	SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11332 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
11333 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
11334 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
11335 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
11336 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11337 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11338 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
11339 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
11340 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
11341 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
11342 	SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
11343 	SND_PCI_QUIRK(0x1d05, 0x1409, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
11344 	SND_PCI_QUIRK(0x1d05, 0x300f, "TongFang X6AR5xxY", ALC2XX_FIXUP_HEADSET_MIC),
11345 	SND_PCI_QUIRK(0x1d05, 0x3019, "TongFang X6FR5xxY", ALC2XX_FIXUP_HEADSET_MIC),
11346 	SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
11347 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
11348 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
11349 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
11350 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
11351 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
11352 	SND_PCI_QUIRK(0x1ee7, 0x2078, "HONOR BRB-X M1010", ALC2XX_FIXUP_HEADSET_MIC),
11353 	SND_PCI_QUIRK(0x1f66, 0x0105, "Ayaneo Portable Game Player", ALC287_FIXUP_CS35L41_I2C_2),
11354 	SND_PCI_QUIRK(0x2014, 0x800a, "Positivo ARN50", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11355 	SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11356 	SND_PCI_QUIRK(0x2782, 0x0228, "Infinix ZERO BOOK 13", ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13),
11357 	SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
11358 	SND_PCI_QUIRK(0x2782, 0x1701, "Infinix Y4 Max", ALC269VC_FIXUP_INFINIX_Y4_MAX),
11359 	SND_PCI_QUIRK(0x2782, 0x1705, "MEDION E15433", ALC269VC_FIXUP_INFINIX_Y4_MAX),
11360 	SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
11361 	SND_PCI_QUIRK(0x2782, 0x4900, "MEDION E15443", ALC233_FIXUP_MEDION_MTL_SPK),
11362 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
11363 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
11364 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
11365 	SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
11366 	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11367 	SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11368 	SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11369 	SND_PCI_QUIRK(0xf111, 0x000b, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11370 	SND_PCI_QUIRK(0xf111, 0x000c, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11371 
11372 #if 0
11373 	/* Below is a quirk table taken from the old code.
11374 	 * Basically the device should work as is without the fixup table.
11375 	 * If BIOS doesn't give a proper info, enable the corresponding
11376 	 * fixup entry.
11377 	 */
11378 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
11379 		      ALC269_FIXUP_AMIC),
11380 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
11381 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
11382 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
11383 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
11384 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
11385 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
11386 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
11387 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
11388 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
11389 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
11390 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
11391 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
11392 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
11393 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
11394 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
11395 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
11396 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
11397 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
11398 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
11399 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
11400 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
11401 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
11402 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
11403 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
11404 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
11405 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
11406 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
11407 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
11408 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
11409 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
11410 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
11411 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
11412 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
11413 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
11414 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
11415 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
11416 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
11417 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
11418 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
11419 #endif
11420 	{}
11421 };
11422 
11423 static const struct hda_quirk alc269_fixup_vendor_tbl[] = {
11424 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
11425 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
11426 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
11427 	SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
11428 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
11429 	{}
11430 };
11431 
11432 static const struct hda_model_fixup alc269_fixup_models[] = {
11433 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
11434 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
11435 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
11436 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
11437 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
11438 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
11439 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
11440 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
11441 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
11442 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
11443 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11444 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
11445 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
11446 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
11447 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
11448 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
11449 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
11450 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
11451 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
11452 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
11453 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
11454 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
11455 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
11456 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
11457 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
11458 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
11459 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
11460 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
11461 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
11462 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
11463 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
11464 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
11465 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
11466 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
11467 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
11468 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
11469 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
11470 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
11471 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
11472 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
11473 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
11474 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
11475 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
11476 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
11477 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
11478 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
11479 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
11480 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
11481 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
11482 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
11483 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
11484 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
11485 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
11486 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
11487 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
11488 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
11489 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
11490 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
11491 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
11492 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
11493 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
11494 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
11495 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
11496 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
11497 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
11498 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
11499 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
11500 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
11501 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
11502 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
11503 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11504 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
11505 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
11506 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
11507 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
11508 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
11509 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
11510 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
11511 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
11512 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
11513 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
11514 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
11515 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
11516 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
11517 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
11518 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
11519 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
11520 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
11521 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
11522 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
11523 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
11524 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
11525 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
11526 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
11527 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
11528 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
11529 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
11530 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
11531 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
11532 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
11533 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
11534 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
11535 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
11536 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
11537 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
11538 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
11539 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
11540 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
11541 	{.id = ALC256_FIXUP_CHROME_BOOK, .name = "alc-2024y-chromebook"},
11542 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
11543 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
11544 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
11545 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
11546 	{.id = ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS, .name = "alc298-samsung-amp-v2-2-amps"},
11547 	{.id = ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS, .name = "alc298-samsung-amp-v2-4-amps"},
11548 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
11549 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
11550 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
11551 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
11552 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
11553 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
11554 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
11555 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_DF1, .name = "alc285-hp-spectre-x360-df1"},
11556 	{.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
11557 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
11558 	{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
11559 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
11560 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
11561 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
11562 	{.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
11563 	{.id = ALC2XX_FIXUP_HEADSET_MIC, .name = "alc2xx-fixup-headset-mic"},
11564 	{}
11565 };
11566 #define ALC225_STANDARD_PINS \
11567 	{0x21, 0x04211020}
11568 
11569 #define ALC256_STANDARD_PINS \
11570 	{0x12, 0x90a60140}, \
11571 	{0x14, 0x90170110}, \
11572 	{0x21, 0x02211020}
11573 
11574 #define ALC282_STANDARD_PINS \
11575 	{0x14, 0x90170110}
11576 
11577 #define ALC290_STANDARD_PINS \
11578 	{0x12, 0x99a30130}
11579 
11580 #define ALC292_STANDARD_PINS \
11581 	{0x14, 0x90170110}, \
11582 	{0x15, 0x0221401f}
11583 
11584 #define ALC295_STANDARD_PINS \
11585 	{0x12, 0xb7a60130}, \
11586 	{0x14, 0x90170110}, \
11587 	{0x21, 0x04211020}
11588 
11589 #define ALC298_STANDARD_PINS \
11590 	{0x12, 0x90a60130}, \
11591 	{0x21, 0x03211020}
11592 
11593 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
11594 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
11595 		{0x14, 0x01014020},
11596 		{0x17, 0x90170110},
11597 		{0x18, 0x02a11030},
11598 		{0x19, 0x0181303F},
11599 		{0x21, 0x0221102f}),
11600 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
11601 		{0x12, 0x90a601c0},
11602 		{0x14, 0x90171120},
11603 		{0x21, 0x02211030}),
11604 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
11605 		{0x14, 0x90170110},
11606 		{0x1b, 0x90a70130},
11607 		{0x21, 0x03211020}),
11608 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
11609 		{0x1a, 0x90a70130},
11610 		{0x1b, 0x90170110},
11611 		{0x21, 0x03211020}),
11612 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11613 		ALC225_STANDARD_PINS,
11614 		{0x12, 0xb7a60130},
11615 		{0x14, 0x901701a0}),
11616 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11617 		ALC225_STANDARD_PINS,
11618 		{0x12, 0xb7a60130},
11619 		{0x14, 0x901701b0}),
11620 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11621 		ALC225_STANDARD_PINS,
11622 		{0x12, 0xb7a60150},
11623 		{0x14, 0x901701a0}),
11624 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11625 		ALC225_STANDARD_PINS,
11626 		{0x12, 0xb7a60150},
11627 		{0x14, 0x901701b0}),
11628 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11629 		ALC225_STANDARD_PINS,
11630 		{0x12, 0xb7a60130},
11631 		{0x1b, 0x90170110}),
11632 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11633 		{0x1b, 0x01111010},
11634 		{0x1e, 0x01451130},
11635 		{0x21, 0x02211020}),
11636 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
11637 		{0x12, 0x90a60140},
11638 		{0x14, 0x90170110},
11639 		{0x19, 0x02a11030},
11640 		{0x21, 0x02211020}),
11641 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11642 		{0x14, 0x90170110},
11643 		{0x19, 0x02a11030},
11644 		{0x1a, 0x02a11040},
11645 		{0x1b, 0x01014020},
11646 		{0x21, 0x0221101f}),
11647 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11648 		{0x14, 0x90170110},
11649 		{0x19, 0x02a11030},
11650 		{0x1a, 0x02a11040},
11651 		{0x1b, 0x01011020},
11652 		{0x21, 0x0221101f}),
11653 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11654 		{0x14, 0x90170110},
11655 		{0x19, 0x02a11020},
11656 		{0x1a, 0x02a11030},
11657 		{0x21, 0x0221101f}),
11658 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
11659 		{0x21, 0x02211010}),
11660 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
11661 		{0x14, 0x90170110},
11662 		{0x19, 0x02a11020},
11663 		{0x21, 0x02211030}),
11664 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
11665 		{0x14, 0x90170110},
11666 		{0x21, 0x02211020}),
11667 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11668 		{0x14, 0x90170130},
11669 		{0x21, 0x02211040}),
11670 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11671 		{0x12, 0x90a60140},
11672 		{0x14, 0x90170110},
11673 		{0x21, 0x02211020}),
11674 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11675 		{0x12, 0x90a60160},
11676 		{0x14, 0x90170120},
11677 		{0x21, 0x02211030}),
11678 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11679 		{0x14, 0x90170110},
11680 		{0x1b, 0x02011020},
11681 		{0x21, 0x0221101f}),
11682 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11683 		{0x14, 0x90170110},
11684 		{0x1b, 0x01011020},
11685 		{0x21, 0x0221101f}),
11686 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11687 		{0x14, 0x90170130},
11688 		{0x1b, 0x01014020},
11689 		{0x21, 0x0221103f}),
11690 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11691 		{0x14, 0x90170130},
11692 		{0x1b, 0x01011020},
11693 		{0x21, 0x0221103f}),
11694 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11695 		{0x14, 0x90170130},
11696 		{0x1b, 0x02011020},
11697 		{0x21, 0x0221103f}),
11698 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11699 		{0x14, 0x90170150},
11700 		{0x1b, 0x02011020},
11701 		{0x21, 0x0221105f}),
11702 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11703 		{0x14, 0x90170110},
11704 		{0x1b, 0x01014020},
11705 		{0x21, 0x0221101f}),
11706 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11707 		{0x12, 0x90a60160},
11708 		{0x14, 0x90170120},
11709 		{0x17, 0x90170140},
11710 		{0x21, 0x0321102f}),
11711 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11712 		{0x12, 0x90a60160},
11713 		{0x14, 0x90170130},
11714 		{0x21, 0x02211040}),
11715 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11716 		{0x12, 0x90a60160},
11717 		{0x14, 0x90170140},
11718 		{0x21, 0x02211050}),
11719 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11720 		{0x12, 0x90a60170},
11721 		{0x14, 0x90170120},
11722 		{0x21, 0x02211030}),
11723 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11724 		{0x12, 0x90a60170},
11725 		{0x14, 0x90170130},
11726 		{0x21, 0x02211040}),
11727 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11728 		{0x12, 0x90a60170},
11729 		{0x14, 0x90171130},
11730 		{0x21, 0x02211040}),
11731 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11732 		{0x12, 0x90a60170},
11733 		{0x14, 0x90170140},
11734 		{0x21, 0x02211050}),
11735 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11736 		{0x12, 0x90a60180},
11737 		{0x14, 0x90170130},
11738 		{0x21, 0x02211040}),
11739 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11740 		{0x12, 0x90a60180},
11741 		{0x14, 0x90170120},
11742 		{0x21, 0x02211030}),
11743 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11744 		{0x1b, 0x01011020},
11745 		{0x21, 0x02211010}),
11746 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
11747 		{0x14, 0x90170110},
11748 		{0x1b, 0x90a70130},
11749 		{0x21, 0x04211020}),
11750 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
11751 		{0x14, 0x90170110},
11752 		{0x1b, 0x90a70130},
11753 		{0x21, 0x03211020}),
11754 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11755 		{0x12, 0x90a60130},
11756 		{0x14, 0x90170110},
11757 		{0x21, 0x03211020}),
11758 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11759 		{0x12, 0x90a60130},
11760 		{0x14, 0x90170110},
11761 		{0x21, 0x04211020}),
11762 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11763 		{0x1a, 0x90a70130},
11764 		{0x1b, 0x90170110},
11765 		{0x21, 0x03211020}),
11766        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
11767 		{0x14, 0x90170110},
11768 		{0x19, 0x02a11020},
11769 		{0x21, 0x0221101f}),
11770        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
11771 		{0x17, 0x90170110},
11772 		{0x19, 0x03a11030},
11773 		{0x21, 0x03211020}),
11774 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
11775 		{0x12, 0x90a60130},
11776 		{0x14, 0x90170110},
11777 		{0x15, 0x0421101f},
11778 		{0x1a, 0x04a11020}),
11779 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
11780 		{0x12, 0x90a60140},
11781 		{0x14, 0x90170110},
11782 		{0x15, 0x0421101f},
11783 		{0x18, 0x02811030},
11784 		{0x1a, 0x04a1103f},
11785 		{0x1b, 0x02011020}),
11786 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11787 		ALC282_STANDARD_PINS,
11788 		{0x12, 0x99a30130},
11789 		{0x19, 0x03a11020},
11790 		{0x21, 0x0321101f}),
11791 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11792 		ALC282_STANDARD_PINS,
11793 		{0x12, 0x99a30130},
11794 		{0x19, 0x03a11020},
11795 		{0x21, 0x03211040}),
11796 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11797 		ALC282_STANDARD_PINS,
11798 		{0x12, 0x99a30130},
11799 		{0x19, 0x03a11030},
11800 		{0x21, 0x03211020}),
11801 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11802 		ALC282_STANDARD_PINS,
11803 		{0x12, 0x99a30130},
11804 		{0x19, 0x04a11020},
11805 		{0x21, 0x0421101f}),
11806 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
11807 		ALC282_STANDARD_PINS,
11808 		{0x12, 0x90a60140},
11809 		{0x19, 0x04a11030},
11810 		{0x21, 0x04211020}),
11811 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11812 		ALC282_STANDARD_PINS,
11813 		{0x12, 0x90a609c0},
11814 		{0x18, 0x03a11830},
11815 		{0x19, 0x04a19831},
11816 		{0x1a, 0x0481303f},
11817 		{0x1b, 0x04211020},
11818 		{0x21, 0x0321101f}),
11819 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11820 		ALC282_STANDARD_PINS,
11821 		{0x12, 0x90a60940},
11822 		{0x18, 0x03a11830},
11823 		{0x19, 0x04a19831},
11824 		{0x1a, 0x0481303f},
11825 		{0x1b, 0x04211020},
11826 		{0x21, 0x0321101f}),
11827 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11828 		ALC282_STANDARD_PINS,
11829 		{0x12, 0x90a60130},
11830 		{0x21, 0x0321101f}),
11831 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11832 		{0x12, 0x90a60160},
11833 		{0x14, 0x90170120},
11834 		{0x21, 0x02211030}),
11835 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11836 		ALC282_STANDARD_PINS,
11837 		{0x12, 0x90a60130},
11838 		{0x19, 0x03a11020},
11839 		{0x21, 0x0321101f}),
11840 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11841 		{0x12, 0x90a60130},
11842 		{0x14, 0x90170110},
11843 		{0x19, 0x04a11040},
11844 		{0x21, 0x04211020}),
11845 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11846 		{0x14, 0x90170110},
11847 		{0x19, 0x04a11040},
11848 		{0x1d, 0x40600001},
11849 		{0x21, 0x04211020}),
11850 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
11851 		{0x14, 0x90170110},
11852 		{0x19, 0x04a11040},
11853 		{0x21, 0x04211020}),
11854 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
11855 		{0x14, 0x90170110},
11856 		{0x17, 0x90170111},
11857 		{0x19, 0x03a11030},
11858 		{0x21, 0x03211020}),
11859 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11860 		{0x17, 0x90170110},
11861 		{0x19, 0x03a11030},
11862 		{0x21, 0x03211020}),
11863 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11864 		{0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
11865 		{0x19, 0x04a11040},
11866 		{0x21, 0x04211020}),
11867 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
11868 		{0x12, 0x90a60130},
11869 		{0x17, 0x90170110},
11870 		{0x21, 0x02211020}),
11871 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
11872 		{0x12, 0x90a60120},
11873 		{0x14, 0x90170110},
11874 		{0x21, 0x0321101f}),
11875 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11876 		ALC290_STANDARD_PINS,
11877 		{0x15, 0x04211040},
11878 		{0x18, 0x90170112},
11879 		{0x1a, 0x04a11020}),
11880 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11881 		ALC290_STANDARD_PINS,
11882 		{0x15, 0x04211040},
11883 		{0x18, 0x90170110},
11884 		{0x1a, 0x04a11020}),
11885 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11886 		ALC290_STANDARD_PINS,
11887 		{0x15, 0x0421101f},
11888 		{0x1a, 0x04a11020}),
11889 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11890 		ALC290_STANDARD_PINS,
11891 		{0x15, 0x04211020},
11892 		{0x1a, 0x04a11040}),
11893 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11894 		ALC290_STANDARD_PINS,
11895 		{0x14, 0x90170110},
11896 		{0x15, 0x04211020},
11897 		{0x1a, 0x04a11040}),
11898 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11899 		ALC290_STANDARD_PINS,
11900 		{0x14, 0x90170110},
11901 		{0x15, 0x04211020},
11902 		{0x1a, 0x04a11020}),
11903 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11904 		ALC290_STANDARD_PINS,
11905 		{0x14, 0x90170110},
11906 		{0x15, 0x0421101f},
11907 		{0x1a, 0x04a11020}),
11908 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11909 		ALC292_STANDARD_PINS,
11910 		{0x12, 0x90a60140},
11911 		{0x16, 0x01014020},
11912 		{0x19, 0x01a19030}),
11913 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11914 		ALC292_STANDARD_PINS,
11915 		{0x12, 0x90a60140},
11916 		{0x16, 0x01014020},
11917 		{0x18, 0x02a19031},
11918 		{0x19, 0x01a1903e}),
11919 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
11920 		ALC292_STANDARD_PINS,
11921 		{0x12, 0x90a60140}),
11922 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11923 		ALC292_STANDARD_PINS,
11924 		{0x13, 0x90a60140},
11925 		{0x16, 0x21014020},
11926 		{0x19, 0x21a19030}),
11927 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11928 		ALC292_STANDARD_PINS,
11929 		{0x13, 0x90a60140}),
11930 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
11931 		{0x17, 0x90170110},
11932 		{0x21, 0x04211020}),
11933 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
11934 		{0x14, 0x90170110},
11935 		{0x1b, 0x90a70130},
11936 		{0x21, 0x04211020}),
11937 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11938 		{0x12, 0x90a60130},
11939 		{0x17, 0x90170110},
11940 		{0x21, 0x03211020}),
11941 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11942 		{0x12, 0x90a60130},
11943 		{0x17, 0x90170110},
11944 		{0x21, 0x04211020}),
11945 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11946 		{0x12, 0x90a60130},
11947 		{0x17, 0x90170110},
11948 		{0x21, 0x03211020}),
11949 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11950 		{0x12, 0x90a60120},
11951 		{0x17, 0x90170110},
11952 		{0x21, 0x04211030}),
11953 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11954 		{0x12, 0x90a60130},
11955 		{0x17, 0x90170110},
11956 		{0x21, 0x03211020}),
11957 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11958 		{0x12, 0x90a60130},
11959 		{0x17, 0x90170110},
11960 		{0x21, 0x03211020}),
11961 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11962 		ALC298_STANDARD_PINS,
11963 		{0x17, 0x90170110}),
11964 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11965 		ALC298_STANDARD_PINS,
11966 		{0x17, 0x90170140}),
11967 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11968 		ALC298_STANDARD_PINS,
11969 		{0x17, 0x90170150}),
11970 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11971 		{0x12, 0xb7a60140},
11972 		{0x13, 0xb7a60150},
11973 		{0x17, 0x90170110},
11974 		{0x1a, 0x03011020},
11975 		{0x21, 0x03211030}),
11976 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11977 		{0x12, 0xb7a60140},
11978 		{0x17, 0x90170110},
11979 		{0x1a, 0x03a11030},
11980 		{0x21, 0x03211020}),
11981 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11982 		ALC225_STANDARD_PINS,
11983 		{0x12, 0xb7a60130},
11984 		{0x17, 0x90170110}),
11985 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11986 		{0x14, 0x01014010},
11987 		{0x17, 0x90170120},
11988 		{0x18, 0x02a11030},
11989 		{0x19, 0x02a1103f},
11990 		{0x21, 0x0221101f}),
11991 	{}
11992 };
11993 
11994 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11995  * more machines, don't need to match all valid pins, just need to match
11996  * all the pins defined in the tbl. Just because of this reason, it is possible
11997  * that a single machine matches multiple tbls, so there is one limitation:
11998  *   at most one tbl is allowed to define for the same vendor and same codec
11999  */
12000 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
12001 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
12002 		{0x19, 0x40000000}),
12003 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
12004 		{0x19, 0x40000000},
12005 		{0x1b, 0x40000000}),
12006 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
12007 		{0x19, 0x40000000},
12008 		{0x1b, 0x40000000}),
12009 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
12010 		{0x19, 0x40000000},
12011 		{0x1a, 0x40000000}),
12012 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
12013 		{0x19, 0x40000000},
12014 		{0x1a, 0x40000000}),
12015 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
12016 		{0x19, 0x40000000},
12017 		{0x1a, 0x40000000}),
12018 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
12019 		{0x19, 0x40000000}),
12020 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1558, "Clevo", ALC2XX_FIXUP_HEADSET_MIC,
12021 		{0x19, 0x40000000}),
12022 	{}
12023 };
12024 
alc269_fill_coef(struct hda_codec * codec)12025 static void alc269_fill_coef(struct hda_codec *codec)
12026 {
12027 	struct alc_spec *spec = codec->spec;
12028 	int val;
12029 
12030 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
12031 		return;
12032 
12033 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
12034 		alc_write_coef_idx(codec, 0xf, 0x960b);
12035 		alc_write_coef_idx(codec, 0xe, 0x8817);
12036 	}
12037 
12038 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
12039 		alc_write_coef_idx(codec, 0xf, 0x960b);
12040 		alc_write_coef_idx(codec, 0xe, 0x8814);
12041 	}
12042 
12043 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
12044 		/* Power up output pin */
12045 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
12046 	}
12047 
12048 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
12049 		val = alc_read_coef_idx(codec, 0xd);
12050 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
12051 			/* Capless ramp up clock control */
12052 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
12053 		}
12054 		val = alc_read_coef_idx(codec, 0x17);
12055 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
12056 			/* Class D power on reset */
12057 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
12058 		}
12059 	}
12060 
12061 	/* HP */
12062 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
12063 }
12064 
12065 /*
12066  */
patch_alc269(struct hda_codec * codec)12067 static int patch_alc269(struct hda_codec *codec)
12068 {
12069 	struct alc_spec *spec;
12070 	int err;
12071 
12072 	err = alc_alloc_spec(codec, 0x0b);
12073 	if (err < 0)
12074 		return err;
12075 
12076 	spec = codec->spec;
12077 	spec->gen.shared_mic_vref_pin = 0x18;
12078 	codec->power_save_node = 0;
12079 	spec->en_3kpull_low = true;
12080 
12081 	codec->patch_ops.suspend = alc269_suspend;
12082 	codec->patch_ops.resume = alc269_resume;
12083 	spec->shutup = alc_default_shutup;
12084 	spec->init_hook = alc_default_init;
12085 
12086 	switch (codec->core.vendor_id) {
12087 	case 0x10ec0269:
12088 		spec->codec_variant = ALC269_TYPE_ALC269VA;
12089 		switch (alc_get_coef0(codec) & 0x00f0) {
12090 		case 0x0010:
12091 			if (codec->bus->pci &&
12092 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
12093 			    spec->cdefine.platform_type == 1)
12094 				err = alc_codec_rename(codec, "ALC271X");
12095 			spec->codec_variant = ALC269_TYPE_ALC269VB;
12096 			break;
12097 		case 0x0020:
12098 			if (codec->bus->pci &&
12099 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
12100 			    codec->bus->pci->subsystem_device == 0x21f3)
12101 				err = alc_codec_rename(codec, "ALC3202");
12102 			spec->codec_variant = ALC269_TYPE_ALC269VC;
12103 			break;
12104 		case 0x0030:
12105 			spec->codec_variant = ALC269_TYPE_ALC269VD;
12106 			break;
12107 		default:
12108 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
12109 		}
12110 		if (err < 0)
12111 			goto error;
12112 		spec->shutup = alc269_shutup;
12113 		spec->init_hook = alc269_fill_coef;
12114 		alc269_fill_coef(codec);
12115 		break;
12116 
12117 	case 0x10ec0280:
12118 	case 0x10ec0290:
12119 		spec->codec_variant = ALC269_TYPE_ALC280;
12120 		break;
12121 	case 0x10ec0282:
12122 		spec->codec_variant = ALC269_TYPE_ALC282;
12123 		spec->shutup = alc282_shutup;
12124 		spec->init_hook = alc282_init;
12125 		break;
12126 	case 0x10ec0233:
12127 	case 0x10ec0283:
12128 		spec->codec_variant = ALC269_TYPE_ALC283;
12129 		spec->shutup = alc283_shutup;
12130 		spec->init_hook = alc283_init;
12131 		break;
12132 	case 0x10ec0284:
12133 	case 0x10ec0292:
12134 		spec->codec_variant = ALC269_TYPE_ALC284;
12135 		break;
12136 	case 0x10ec0293:
12137 		spec->codec_variant = ALC269_TYPE_ALC293;
12138 		break;
12139 	case 0x10ec0286:
12140 	case 0x10ec0288:
12141 		spec->codec_variant = ALC269_TYPE_ALC286;
12142 		break;
12143 	case 0x10ec0298:
12144 		spec->codec_variant = ALC269_TYPE_ALC298;
12145 		break;
12146 	case 0x10ec0235:
12147 	case 0x10ec0255:
12148 		spec->codec_variant = ALC269_TYPE_ALC255;
12149 		spec->shutup = alc256_shutup;
12150 		spec->init_hook = alc256_init;
12151 		break;
12152 	case 0x10ec0230:
12153 	case 0x10ec0236:
12154 	case 0x10ec0256:
12155 	case 0x19e58326:
12156 		spec->codec_variant = ALC269_TYPE_ALC256;
12157 		spec->shutup = alc256_shutup;
12158 		spec->init_hook = alc256_init;
12159 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
12160 		if (codec->core.vendor_id == 0x10ec0236 &&
12161 		    codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
12162 			spec->en_3kpull_low = false;
12163 		break;
12164 	case 0x10ec0257:
12165 		spec->codec_variant = ALC269_TYPE_ALC257;
12166 		spec->shutup = alc256_shutup;
12167 		spec->init_hook = alc256_init;
12168 		spec->gen.mixer_nid = 0;
12169 		spec->en_3kpull_low = false;
12170 		break;
12171 	case 0x10ec0215:
12172 	case 0x10ec0245:
12173 	case 0x10ec0285:
12174 	case 0x10ec0289:
12175 		if (alc_get_coef0(codec) & 0x0010)
12176 			spec->codec_variant = ALC269_TYPE_ALC245;
12177 		else
12178 			spec->codec_variant = ALC269_TYPE_ALC215;
12179 		spec->shutup = alc225_shutup;
12180 		spec->init_hook = alc225_init;
12181 		spec->gen.mixer_nid = 0;
12182 		break;
12183 	case 0x10ec0225:
12184 	case 0x10ec0295:
12185 	case 0x10ec0299:
12186 		spec->codec_variant = ALC269_TYPE_ALC225;
12187 		spec->shutup = alc225_shutup;
12188 		spec->init_hook = alc225_init;
12189 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
12190 		break;
12191 	case 0x10ec0287:
12192 		spec->codec_variant = ALC269_TYPE_ALC287;
12193 		spec->shutup = alc225_shutup;
12194 		spec->init_hook = alc225_init;
12195 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
12196 		break;
12197 	case 0x10ec0234:
12198 	case 0x10ec0274:
12199 	case 0x10ec0294:
12200 		spec->codec_variant = ALC269_TYPE_ALC294;
12201 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
12202 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
12203 		spec->init_hook = alc294_init;
12204 		break;
12205 	case 0x10ec0300:
12206 		spec->codec_variant = ALC269_TYPE_ALC300;
12207 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
12208 		break;
12209 	case 0x10ec0222:
12210 	case 0x10ec0623:
12211 		spec->codec_variant = ALC269_TYPE_ALC623;
12212 		spec->shutup = alc222_shutup;
12213 		spec->init_hook = alc222_init;
12214 		break;
12215 	case 0x10ec0700:
12216 	case 0x10ec0701:
12217 	case 0x10ec0703:
12218 	case 0x10ec0711:
12219 		spec->codec_variant = ALC269_TYPE_ALC700;
12220 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
12221 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
12222 		spec->init_hook = alc294_init;
12223 		break;
12224 
12225 	}
12226 
12227 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
12228 		spec->has_alc5505_dsp = 1;
12229 		spec->init_hook = alc5505_dsp_init;
12230 	}
12231 
12232 	alc_pre_init(codec);
12233 
12234 	snd_hda_pick_fixup(codec, alc269_fixup_models,
12235 		       alc269_fixup_tbl, alc269_fixups);
12236 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
12237 	 * the quirk breaks the latter (bko#214101).
12238 	 * Clear the wrong entry.
12239 	 */
12240 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
12241 	    codec->core.vendor_id == 0x10ec0294) {
12242 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
12243 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
12244 	}
12245 
12246 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
12247 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
12248 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
12249 			   alc269_fixups);
12250 
12251 	/*
12252 	 * Check whether ACPI describes companion amplifiers that require
12253 	 * component binding
12254 	 */
12255 	find_cirrus_companion_amps(codec);
12256 
12257 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12258 
12259 	alc_auto_parse_customize_define(codec);
12260 
12261 	if (has_cdefine_beep(codec))
12262 		spec->gen.beep_nid = 0x01;
12263 
12264 	/* automatic parse from the BIOS config */
12265 	err = alc269_parse_auto_config(codec);
12266 	if (err < 0)
12267 		goto error;
12268 
12269 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
12270 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
12271 		if (err < 0)
12272 			goto error;
12273 	}
12274 
12275 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12276 
12277 	return 0;
12278 
12279  error:
12280 	alc_free(codec);
12281 	return err;
12282 }
12283 
12284 /*
12285  * ALC861
12286  */
12287 
alc861_parse_auto_config(struct hda_codec * codec)12288 static int alc861_parse_auto_config(struct hda_codec *codec)
12289 {
12290 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
12291 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
12292 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
12293 }
12294 
12295 /* Pin config fixes */
12296 enum {
12297 	ALC861_FIXUP_FSC_AMILO_PI1505,
12298 	ALC861_FIXUP_AMP_VREF_0F,
12299 	ALC861_FIXUP_NO_JACK_DETECT,
12300 	ALC861_FIXUP_ASUS_A6RP,
12301 	ALC660_FIXUP_ASUS_W7J,
12302 };
12303 
12304 /* 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)12305 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
12306 			const struct hda_fixup *fix, int action)
12307 {
12308 	struct alc_spec *spec = codec->spec;
12309 	unsigned int val;
12310 
12311 	if (action != HDA_FIXUP_ACT_INIT)
12312 		return;
12313 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
12314 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
12315 		val |= AC_PINCTL_IN_EN;
12316 	val |= AC_PINCTL_VREF_50;
12317 	snd_hda_set_pin_ctl(codec, 0x0f, val);
12318 	spec->gen.keep_vref_in_automute = 1;
12319 }
12320 
12321 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)12322 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
12323 				     const struct hda_fixup *fix, int action)
12324 {
12325 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
12326 		codec->no_jack_detect = 1;
12327 }
12328 
12329 static const struct hda_fixup alc861_fixups[] = {
12330 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
12331 		.type = HDA_FIXUP_PINS,
12332 		.v.pins = (const struct hda_pintbl[]) {
12333 			{ 0x0b, 0x0221101f }, /* HP */
12334 			{ 0x0f, 0x90170310 }, /* speaker */
12335 			{ }
12336 		}
12337 	},
12338 	[ALC861_FIXUP_AMP_VREF_0F] = {
12339 		.type = HDA_FIXUP_FUNC,
12340 		.v.func = alc861_fixup_asus_amp_vref_0f,
12341 	},
12342 	[ALC861_FIXUP_NO_JACK_DETECT] = {
12343 		.type = HDA_FIXUP_FUNC,
12344 		.v.func = alc_fixup_no_jack_detect,
12345 	},
12346 	[ALC861_FIXUP_ASUS_A6RP] = {
12347 		.type = HDA_FIXUP_FUNC,
12348 		.v.func = alc861_fixup_asus_amp_vref_0f,
12349 		.chained = true,
12350 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
12351 	},
12352 	[ALC660_FIXUP_ASUS_W7J] = {
12353 		.type = HDA_FIXUP_VERBS,
12354 		.v.verbs = (const struct hda_verb[]) {
12355 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
12356 			 * for enabling outputs
12357 			 */
12358 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12359 			{ }
12360 		},
12361 	}
12362 };
12363 
12364 static const struct hda_quirk alc861_fixup_tbl[] = {
12365 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
12366 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
12367 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
12368 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
12369 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
12370 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
12371 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
12372 	{}
12373 };
12374 
12375 /*
12376  */
patch_alc861(struct hda_codec * codec)12377 static int patch_alc861(struct hda_codec *codec)
12378 {
12379 	struct alc_spec *spec;
12380 	int err;
12381 
12382 	err = alc_alloc_spec(codec, 0x15);
12383 	if (err < 0)
12384 		return err;
12385 
12386 	spec = codec->spec;
12387 	if (has_cdefine_beep(codec))
12388 		spec->gen.beep_nid = 0x23;
12389 
12390 	spec->power_hook = alc_power_eapd;
12391 
12392 	alc_pre_init(codec);
12393 
12394 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
12395 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12396 
12397 	/* automatic parse from the BIOS config */
12398 	err = alc861_parse_auto_config(codec);
12399 	if (err < 0)
12400 		goto error;
12401 
12402 	if (!spec->gen.no_analog) {
12403 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
12404 		if (err < 0)
12405 			goto error;
12406 	}
12407 
12408 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12409 
12410 	return 0;
12411 
12412  error:
12413 	alc_free(codec);
12414 	return err;
12415 }
12416 
12417 /*
12418  * ALC861-VD support
12419  *
12420  * Based on ALC882
12421  *
12422  * In addition, an independent DAC
12423  */
alc861vd_parse_auto_config(struct hda_codec * codec)12424 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12425 {
12426 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12427 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
12428 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
12429 }
12430 
12431 enum {
12432 	ALC660VD_FIX_ASUS_GPIO1,
12433 	ALC861VD_FIX_DALLAS,
12434 };
12435 
12436 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)12437 static void alc861vd_fixup_dallas(struct hda_codec *codec,
12438 				  const struct hda_fixup *fix, int action)
12439 {
12440 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12441 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
12442 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
12443 	}
12444 }
12445 
12446 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)12447 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
12448 				      const struct hda_fixup *fix, int action)
12449 {
12450 	struct alc_spec *spec = codec->spec;
12451 
12452 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
12453 		spec->gpio_mask |= 0x02;
12454 	alc_fixup_gpio(codec, action, 0x01);
12455 }
12456 
12457 static const struct hda_fixup alc861vd_fixups[] = {
12458 	[ALC660VD_FIX_ASUS_GPIO1] = {
12459 		.type = HDA_FIXUP_FUNC,
12460 		.v.func = alc660vd_fixup_asus_gpio1,
12461 	},
12462 	[ALC861VD_FIX_DALLAS] = {
12463 		.type = HDA_FIXUP_FUNC,
12464 		.v.func = alc861vd_fixup_dallas,
12465 	},
12466 };
12467 
12468 static const struct hda_quirk alc861vd_fixup_tbl[] = {
12469 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
12470 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
12471 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
12472 	{}
12473 };
12474 
12475 /*
12476  */
patch_alc861vd(struct hda_codec * codec)12477 static int patch_alc861vd(struct hda_codec *codec)
12478 {
12479 	struct alc_spec *spec;
12480 	int err;
12481 
12482 	err = alc_alloc_spec(codec, 0x0b);
12483 	if (err < 0)
12484 		return err;
12485 
12486 	spec = codec->spec;
12487 	if (has_cdefine_beep(codec))
12488 		spec->gen.beep_nid = 0x23;
12489 
12490 	spec->shutup = alc_eapd_shutup;
12491 
12492 	alc_pre_init(codec);
12493 
12494 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
12495 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12496 
12497 	/* automatic parse from the BIOS config */
12498 	err = alc861vd_parse_auto_config(codec);
12499 	if (err < 0)
12500 		goto error;
12501 
12502 	if (!spec->gen.no_analog) {
12503 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12504 		if (err < 0)
12505 			goto error;
12506 	}
12507 
12508 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12509 
12510 	return 0;
12511 
12512  error:
12513 	alc_free(codec);
12514 	return err;
12515 }
12516 
12517 /*
12518  * ALC662 support
12519  *
12520  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12521  * configuration.  Each pin widget can choose any input DACs and a mixer.
12522  * Each ADC is connected from a mixer of all inputs.  This makes possible
12523  * 6-channel independent captures.
12524  *
12525  * In addition, an independent DAC for the multi-playback (not used in this
12526  * driver yet).
12527  */
12528 
12529 /*
12530  * BIOS auto configuration
12531  */
12532 
alc662_parse_auto_config(struct hda_codec * codec)12533 static int alc662_parse_auto_config(struct hda_codec *codec)
12534 {
12535 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
12536 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
12537 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
12538 	const hda_nid_t *ssids;
12539 
12540 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
12541 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
12542 	    codec->core.vendor_id == 0x10ec0671)
12543 		ssids = alc663_ssids;
12544 	else
12545 		ssids = alc662_ssids;
12546 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
12547 }
12548 
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)12549 static void alc272_fixup_mario(struct hda_codec *codec,
12550 			       const struct hda_fixup *fix, int action)
12551 {
12552 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
12553 		return;
12554 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
12555 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
12556 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
12557 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12558 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
12559 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
12560 }
12561 
12562 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
12563 	{ .channels = 2,
12564 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
12565 	{ .channels = 4,
12566 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
12567 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
12568 	{ }
12569 };
12570 
12571 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)12572 static void alc_fixup_bass_chmap(struct hda_codec *codec,
12573 				    const struct hda_fixup *fix, int action)
12574 {
12575 	if (action == HDA_FIXUP_ACT_BUILD) {
12576 		struct alc_spec *spec = codec->spec;
12577 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
12578 	}
12579 }
12580 
12581 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)12582 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
12583 					  hda_nid_t nid,
12584 					  unsigned int power_state)
12585 {
12586 	struct alc_spec *spec = codec->spec;
12587 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
12588 		return AC_PWRST_D0;
12589 	return power_state;
12590 }
12591 
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)12592 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
12593 				   const struct hda_fixup *fix, int action)
12594 {
12595 	struct alc_spec *spec = codec->spec;
12596 
12597 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
12598 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12599 		spec->mute_led_polarity = 1;
12600 		codec->power_filter = gpio_led_power_filter;
12601 	}
12602 }
12603 
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)12604 static void alc662_usi_automute_hook(struct hda_codec *codec,
12605 					 struct hda_jack_callback *jack)
12606 {
12607 	struct alc_spec *spec = codec->spec;
12608 	int vref;
12609 	msleep(200);
12610 	snd_hda_gen_hp_automute(codec, jack);
12611 
12612 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
12613 	msleep(100);
12614 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
12615 			    vref);
12616 }
12617 
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)12618 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
12619 				     const struct hda_fixup *fix, int action)
12620 {
12621 	struct alc_spec *spec = codec->spec;
12622 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12623 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12624 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
12625 	}
12626 }
12627 
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)12628 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
12629 					struct hda_jack_callback *cb)
12630 {
12631 	/* surround speakers at 0x1b already get muted automatically when
12632 	 * headphones are plugged in, but we have to mute/unmute the remaining
12633 	 * channels manually:
12634 	 * 0x15 - front left/front right
12635 	 * 0x18 - front center/ LFE
12636 	 */
12637 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
12638 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
12639 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
12640 	} else {
12641 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
12642 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
12643 	}
12644 }
12645 
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)12646 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
12647 					const struct hda_fixup *fix, int action)
12648 {
12649     /* Pin 0x1b: shared headphones jack and surround speakers */
12650 	if (!is_jack_detectable(codec, 0x1b))
12651 		return;
12652 
12653 	switch (action) {
12654 	case HDA_FIXUP_ACT_PRE_PROBE:
12655 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
12656 				alc662_aspire_ethos_mute_speakers);
12657 		/* subwoofer needs an extra GPIO setting to become audible */
12658 		alc_setup_gpio(codec, 0x02);
12659 		break;
12660 	case HDA_FIXUP_ACT_INIT:
12661 		/* Make sure to start in a correct state, i.e. if
12662 		 * headphones have been plugged in before powering up the system
12663 		 */
12664 		alc662_aspire_ethos_mute_speakers(codec, NULL);
12665 		break;
12666 	}
12667 }
12668 
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)12669 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
12670 					     const struct hda_fixup *fix, int action)
12671 {
12672 	struct alc_spec *spec = codec->spec;
12673 
12674 	static const struct hda_pintbl pincfgs[] = {
12675 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
12676 		{ 0x1b, 0x0181304f },
12677 		{ }
12678 	};
12679 
12680 	switch (action) {
12681 	case HDA_FIXUP_ACT_PRE_PROBE:
12682 		spec->gen.mixer_nid = 0;
12683 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12684 		snd_hda_apply_pincfgs(codec, pincfgs);
12685 		break;
12686 	case HDA_FIXUP_ACT_INIT:
12687 		alc_write_coef_idx(codec, 0x19, 0xa054);
12688 		break;
12689 	}
12690 }
12691 
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)12692 static void alc897_hp_automute_hook(struct hda_codec *codec,
12693 					 struct hda_jack_callback *jack)
12694 {
12695 	struct alc_spec *spec = codec->spec;
12696 	int vref;
12697 
12698 	snd_hda_gen_hp_automute(codec, jack);
12699 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
12700 	snd_hda_set_pin_ctl(codec, 0x1b, vref);
12701 }
12702 
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)12703 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
12704 				     const struct hda_fixup *fix, int action)
12705 {
12706 	struct alc_spec *spec = codec->spec;
12707 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12708 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
12709 		spec->no_shutup_pins = 1;
12710 	}
12711 	if (action == HDA_FIXUP_ACT_PROBE) {
12712 		snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
12713 	}
12714 }
12715 
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)12716 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
12717 				     const struct hda_fixup *fix, int action)
12718 {
12719 	struct alc_spec *spec = codec->spec;
12720 
12721 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12722 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12723 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
12724 	}
12725 }
12726 
12727 static const struct coef_fw alc668_coefs[] = {
12728 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
12729 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
12730 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
12731 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
12732 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
12733 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
12734 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
12735 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
12736 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
12737 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
12738 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
12739 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
12740 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
12741 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
12742 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
12743 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
12744 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
12745 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
12746 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
12747 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
12748 	{}
12749 };
12750 
alc668_restore_default_value(struct hda_codec * codec)12751 static void alc668_restore_default_value(struct hda_codec *codec)
12752 {
12753 	alc_process_coef_fw(codec, alc668_coefs);
12754 }
12755 
12756 enum {
12757 	ALC662_FIXUP_ASPIRE,
12758 	ALC662_FIXUP_LED_GPIO1,
12759 	ALC662_FIXUP_IDEAPAD,
12760 	ALC272_FIXUP_MARIO,
12761 	ALC662_FIXUP_CZC_ET26,
12762 	ALC662_FIXUP_CZC_P10T,
12763 	ALC662_FIXUP_SKU_IGNORE,
12764 	ALC662_FIXUP_HP_RP5800,
12765 	ALC662_FIXUP_ASUS_MODE1,
12766 	ALC662_FIXUP_ASUS_MODE2,
12767 	ALC662_FIXUP_ASUS_MODE3,
12768 	ALC662_FIXUP_ASUS_MODE4,
12769 	ALC662_FIXUP_ASUS_MODE5,
12770 	ALC662_FIXUP_ASUS_MODE6,
12771 	ALC662_FIXUP_ASUS_MODE7,
12772 	ALC662_FIXUP_ASUS_MODE8,
12773 	ALC662_FIXUP_NO_JACK_DETECT,
12774 	ALC662_FIXUP_ZOTAC_Z68,
12775 	ALC662_FIXUP_INV_DMIC,
12776 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12777 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
12778 	ALC662_FIXUP_HEADSET_MODE,
12779 	ALC668_FIXUP_HEADSET_MODE,
12780 	ALC662_FIXUP_BASS_MODE4_CHMAP,
12781 	ALC662_FIXUP_BASS_16,
12782 	ALC662_FIXUP_BASS_1A,
12783 	ALC662_FIXUP_BASS_CHMAP,
12784 	ALC668_FIXUP_AUTO_MUTE,
12785 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
12786 	ALC668_FIXUP_DELL_XPS13,
12787 	ALC662_FIXUP_ASUS_Nx50,
12788 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12789 	ALC668_FIXUP_ASUS_Nx51,
12790 	ALC668_FIXUP_MIC_COEF,
12791 	ALC668_FIXUP_ASUS_G751,
12792 	ALC891_FIXUP_HEADSET_MODE,
12793 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12794 	ALC662_FIXUP_ACER_VERITON,
12795 	ALC892_FIXUP_ASROCK_MOBO,
12796 	ALC662_FIXUP_USI_FUNC,
12797 	ALC662_FIXUP_USI_HEADSET_MODE,
12798 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
12799 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
12800 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
12801 	ALC671_FIXUP_HP_HEADSET_MIC2,
12802 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
12803 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
12804 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
12805 	ALC668_FIXUP_HEADSET_MIC,
12806 	ALC668_FIXUP_MIC_DET_COEF,
12807 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
12808 	ALC897_FIXUP_HEADSET_MIC_PIN,
12809 	ALC897_FIXUP_HP_HSMIC_VERB,
12810 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
12811 	ALC897_FIXUP_HEADSET_MIC_PIN2,
12812 	ALC897_FIXUP_UNIS_H3C_X500S,
12813 	ALC897_FIXUP_HEADSET_MIC_PIN3,
12814 };
12815 
12816 static const struct hda_fixup alc662_fixups[] = {
12817 	[ALC662_FIXUP_ASPIRE] = {
12818 		.type = HDA_FIXUP_PINS,
12819 		.v.pins = (const struct hda_pintbl[]) {
12820 			{ 0x15, 0x99130112 }, /* subwoofer */
12821 			{ }
12822 		}
12823 	},
12824 	[ALC662_FIXUP_LED_GPIO1] = {
12825 		.type = HDA_FIXUP_FUNC,
12826 		.v.func = alc662_fixup_led_gpio1,
12827 	},
12828 	[ALC662_FIXUP_IDEAPAD] = {
12829 		.type = HDA_FIXUP_PINS,
12830 		.v.pins = (const struct hda_pintbl[]) {
12831 			{ 0x17, 0x99130112 }, /* subwoofer */
12832 			{ }
12833 		},
12834 		.chained = true,
12835 		.chain_id = ALC662_FIXUP_LED_GPIO1,
12836 	},
12837 	[ALC272_FIXUP_MARIO] = {
12838 		.type = HDA_FIXUP_FUNC,
12839 		.v.func = alc272_fixup_mario,
12840 	},
12841 	[ALC662_FIXUP_CZC_ET26] = {
12842 		.type = HDA_FIXUP_PINS,
12843 		.v.pins = (const struct hda_pintbl[]) {
12844 			{0x12, 0x403cc000},
12845 			{0x14, 0x90170110}, /* speaker */
12846 			{0x15, 0x411111f0},
12847 			{0x16, 0x411111f0},
12848 			{0x18, 0x01a19030}, /* mic */
12849 			{0x19, 0x90a7013f}, /* int-mic */
12850 			{0x1a, 0x01014020},
12851 			{0x1b, 0x0121401f},
12852 			{0x1c, 0x411111f0},
12853 			{0x1d, 0x411111f0},
12854 			{0x1e, 0x40478e35},
12855 			{}
12856 		},
12857 		.chained = true,
12858 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12859 	},
12860 	[ALC662_FIXUP_CZC_P10T] = {
12861 		.type = HDA_FIXUP_VERBS,
12862 		.v.verbs = (const struct hda_verb[]) {
12863 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
12864 			{}
12865 		}
12866 	},
12867 	[ALC662_FIXUP_SKU_IGNORE] = {
12868 		.type = HDA_FIXUP_FUNC,
12869 		.v.func = alc_fixup_sku_ignore,
12870 	},
12871 	[ALC662_FIXUP_HP_RP5800] = {
12872 		.type = HDA_FIXUP_PINS,
12873 		.v.pins = (const struct hda_pintbl[]) {
12874 			{ 0x14, 0x0221201f }, /* HP out */
12875 			{ }
12876 		},
12877 		.chained = true,
12878 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12879 	},
12880 	[ALC662_FIXUP_ASUS_MODE1] = {
12881 		.type = HDA_FIXUP_PINS,
12882 		.v.pins = (const struct hda_pintbl[]) {
12883 			{ 0x14, 0x99130110 }, /* speaker */
12884 			{ 0x18, 0x01a19c20 }, /* mic */
12885 			{ 0x19, 0x99a3092f }, /* int-mic */
12886 			{ 0x21, 0x0121401f }, /* HP out */
12887 			{ }
12888 		},
12889 		.chained = true,
12890 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12891 	},
12892 	[ALC662_FIXUP_ASUS_MODE2] = {
12893 		.type = HDA_FIXUP_PINS,
12894 		.v.pins = (const struct hda_pintbl[]) {
12895 			{ 0x14, 0x99130110 }, /* speaker */
12896 			{ 0x18, 0x01a19820 }, /* mic */
12897 			{ 0x19, 0x99a3092f }, /* int-mic */
12898 			{ 0x1b, 0x0121401f }, /* HP out */
12899 			{ }
12900 		},
12901 		.chained = true,
12902 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12903 	},
12904 	[ALC662_FIXUP_ASUS_MODE3] = {
12905 		.type = HDA_FIXUP_PINS,
12906 		.v.pins = (const struct hda_pintbl[]) {
12907 			{ 0x14, 0x99130110 }, /* speaker */
12908 			{ 0x15, 0x0121441f }, /* HP */
12909 			{ 0x18, 0x01a19840 }, /* mic */
12910 			{ 0x19, 0x99a3094f }, /* int-mic */
12911 			{ 0x21, 0x01211420 }, /* HP2 */
12912 			{ }
12913 		},
12914 		.chained = true,
12915 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12916 	},
12917 	[ALC662_FIXUP_ASUS_MODE4] = {
12918 		.type = HDA_FIXUP_PINS,
12919 		.v.pins = (const struct hda_pintbl[]) {
12920 			{ 0x14, 0x99130110 }, /* speaker */
12921 			{ 0x16, 0x99130111 }, /* speaker */
12922 			{ 0x18, 0x01a19840 }, /* mic */
12923 			{ 0x19, 0x99a3094f }, /* int-mic */
12924 			{ 0x21, 0x0121441f }, /* HP */
12925 			{ }
12926 		},
12927 		.chained = true,
12928 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12929 	},
12930 	[ALC662_FIXUP_ASUS_MODE5] = {
12931 		.type = HDA_FIXUP_PINS,
12932 		.v.pins = (const struct hda_pintbl[]) {
12933 			{ 0x14, 0x99130110 }, /* speaker */
12934 			{ 0x15, 0x0121441f }, /* HP */
12935 			{ 0x16, 0x99130111 }, /* speaker */
12936 			{ 0x18, 0x01a19840 }, /* mic */
12937 			{ 0x19, 0x99a3094f }, /* int-mic */
12938 			{ }
12939 		},
12940 		.chained = true,
12941 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12942 	},
12943 	[ALC662_FIXUP_ASUS_MODE6] = {
12944 		.type = HDA_FIXUP_PINS,
12945 		.v.pins = (const struct hda_pintbl[]) {
12946 			{ 0x14, 0x99130110 }, /* speaker */
12947 			{ 0x15, 0x01211420 }, /* HP2 */
12948 			{ 0x18, 0x01a19840 }, /* mic */
12949 			{ 0x19, 0x99a3094f }, /* int-mic */
12950 			{ 0x1b, 0x0121441f }, /* HP */
12951 			{ }
12952 		},
12953 		.chained = true,
12954 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12955 	},
12956 	[ALC662_FIXUP_ASUS_MODE7] = {
12957 		.type = HDA_FIXUP_PINS,
12958 		.v.pins = (const struct hda_pintbl[]) {
12959 			{ 0x14, 0x99130110 }, /* speaker */
12960 			{ 0x17, 0x99130111 }, /* speaker */
12961 			{ 0x18, 0x01a19840 }, /* mic */
12962 			{ 0x19, 0x99a3094f }, /* int-mic */
12963 			{ 0x1b, 0x01214020 }, /* HP */
12964 			{ 0x21, 0x0121401f }, /* HP */
12965 			{ }
12966 		},
12967 		.chained = true,
12968 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12969 	},
12970 	[ALC662_FIXUP_ASUS_MODE8] = {
12971 		.type = HDA_FIXUP_PINS,
12972 		.v.pins = (const struct hda_pintbl[]) {
12973 			{ 0x14, 0x99130110 }, /* speaker */
12974 			{ 0x12, 0x99a30970 }, /* int-mic */
12975 			{ 0x15, 0x01214020 }, /* HP */
12976 			{ 0x17, 0x99130111 }, /* speaker */
12977 			{ 0x18, 0x01a19840 }, /* mic */
12978 			{ 0x21, 0x0121401f }, /* HP */
12979 			{ }
12980 		},
12981 		.chained = true,
12982 		.chain_id = ALC662_FIXUP_SKU_IGNORE
12983 	},
12984 	[ALC662_FIXUP_NO_JACK_DETECT] = {
12985 		.type = HDA_FIXUP_FUNC,
12986 		.v.func = alc_fixup_no_jack_detect,
12987 	},
12988 	[ALC662_FIXUP_ZOTAC_Z68] = {
12989 		.type = HDA_FIXUP_PINS,
12990 		.v.pins = (const struct hda_pintbl[]) {
12991 			{ 0x1b, 0x02214020 }, /* Front HP */
12992 			{ }
12993 		}
12994 	},
12995 	[ALC662_FIXUP_INV_DMIC] = {
12996 		.type = HDA_FIXUP_FUNC,
12997 		.v.func = alc_fixup_inv_dmic,
12998 	},
12999 	[ALC668_FIXUP_DELL_XPS13] = {
13000 		.type = HDA_FIXUP_FUNC,
13001 		.v.func = alc_fixup_dell_xps13,
13002 		.chained = true,
13003 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
13004 	},
13005 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
13006 		.type = HDA_FIXUP_FUNC,
13007 		.v.func = alc_fixup_disable_aamix,
13008 		.chained = true,
13009 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
13010 	},
13011 	[ALC668_FIXUP_AUTO_MUTE] = {
13012 		.type = HDA_FIXUP_FUNC,
13013 		.v.func = alc_fixup_auto_mute_via_amp,
13014 		.chained = true,
13015 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
13016 	},
13017 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
13018 		.type = HDA_FIXUP_PINS,
13019 		.v.pins = (const struct hda_pintbl[]) {
13020 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
13021 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
13022 			{ }
13023 		},
13024 		.chained = true,
13025 		.chain_id = ALC662_FIXUP_HEADSET_MODE
13026 	},
13027 	[ALC662_FIXUP_HEADSET_MODE] = {
13028 		.type = HDA_FIXUP_FUNC,
13029 		.v.func = alc_fixup_headset_mode_alc662,
13030 	},
13031 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
13032 		.type = HDA_FIXUP_PINS,
13033 		.v.pins = (const struct hda_pintbl[]) {
13034 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
13035 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
13036 			{ }
13037 		},
13038 		.chained = true,
13039 		.chain_id = ALC668_FIXUP_HEADSET_MODE
13040 	},
13041 	[ALC668_FIXUP_HEADSET_MODE] = {
13042 		.type = HDA_FIXUP_FUNC,
13043 		.v.func = alc_fixup_headset_mode_alc668,
13044 	},
13045 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
13046 		.type = HDA_FIXUP_FUNC,
13047 		.v.func = alc_fixup_bass_chmap,
13048 		.chained = true,
13049 		.chain_id = ALC662_FIXUP_ASUS_MODE4
13050 	},
13051 	[ALC662_FIXUP_BASS_16] = {
13052 		.type = HDA_FIXUP_PINS,
13053 		.v.pins = (const struct hda_pintbl[]) {
13054 			{0x16, 0x80106111}, /* bass speaker */
13055 			{}
13056 		},
13057 		.chained = true,
13058 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
13059 	},
13060 	[ALC662_FIXUP_BASS_1A] = {
13061 		.type = HDA_FIXUP_PINS,
13062 		.v.pins = (const struct hda_pintbl[]) {
13063 			{0x1a, 0x80106111}, /* bass speaker */
13064 			{}
13065 		},
13066 		.chained = true,
13067 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
13068 	},
13069 	[ALC662_FIXUP_BASS_CHMAP] = {
13070 		.type = HDA_FIXUP_FUNC,
13071 		.v.func = alc_fixup_bass_chmap,
13072 	},
13073 	[ALC662_FIXUP_ASUS_Nx50] = {
13074 		.type = HDA_FIXUP_FUNC,
13075 		.v.func = alc_fixup_auto_mute_via_amp,
13076 		.chained = true,
13077 		.chain_id = ALC662_FIXUP_BASS_1A
13078 	},
13079 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
13080 		.type = HDA_FIXUP_FUNC,
13081 		.v.func = alc_fixup_headset_mode_alc668,
13082 		.chain_id = ALC662_FIXUP_BASS_CHMAP
13083 	},
13084 	[ALC668_FIXUP_ASUS_Nx51] = {
13085 		.type = HDA_FIXUP_PINS,
13086 		.v.pins = (const struct hda_pintbl[]) {
13087 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
13088 			{ 0x1a, 0x90170151 }, /* bass speaker */
13089 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
13090 			{}
13091 		},
13092 		.chained = true,
13093 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
13094 	},
13095 	[ALC668_FIXUP_MIC_COEF] = {
13096 		.type = HDA_FIXUP_VERBS,
13097 		.v.verbs = (const struct hda_verb[]) {
13098 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
13099 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
13100 			{}
13101 		},
13102 	},
13103 	[ALC668_FIXUP_ASUS_G751] = {
13104 		.type = HDA_FIXUP_PINS,
13105 		.v.pins = (const struct hda_pintbl[]) {
13106 			{ 0x16, 0x0421101f }, /* HP */
13107 			{}
13108 		},
13109 		.chained = true,
13110 		.chain_id = ALC668_FIXUP_MIC_COEF
13111 	},
13112 	[ALC891_FIXUP_HEADSET_MODE] = {
13113 		.type = HDA_FIXUP_FUNC,
13114 		.v.func = alc_fixup_headset_mode,
13115 	},
13116 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
13117 		.type = HDA_FIXUP_PINS,
13118 		.v.pins = (const struct hda_pintbl[]) {
13119 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
13120 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
13121 			{ }
13122 		},
13123 		.chained = true,
13124 		.chain_id = ALC891_FIXUP_HEADSET_MODE
13125 	},
13126 	[ALC662_FIXUP_ACER_VERITON] = {
13127 		.type = HDA_FIXUP_PINS,
13128 		.v.pins = (const struct hda_pintbl[]) {
13129 			{ 0x15, 0x50170120 }, /* no internal speaker */
13130 			{ }
13131 		}
13132 	},
13133 	[ALC892_FIXUP_ASROCK_MOBO] = {
13134 		.type = HDA_FIXUP_PINS,
13135 		.v.pins = (const struct hda_pintbl[]) {
13136 			{ 0x15, 0x40f000f0 }, /* disabled */
13137 			{ 0x16, 0x40f000f0 }, /* disabled */
13138 			{ }
13139 		}
13140 	},
13141 	[ALC662_FIXUP_USI_FUNC] = {
13142 		.type = HDA_FIXUP_FUNC,
13143 		.v.func = alc662_fixup_usi_headset_mic,
13144 	},
13145 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
13146 		.type = HDA_FIXUP_PINS,
13147 		.v.pins = (const struct hda_pintbl[]) {
13148 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
13149 			{ 0x18, 0x01a1903d },
13150 			{ }
13151 		},
13152 		.chained = true,
13153 		.chain_id = ALC662_FIXUP_USI_FUNC
13154 	},
13155 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
13156 		.type = HDA_FIXUP_FUNC,
13157 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
13158 	},
13159 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
13160 		.type = HDA_FIXUP_FUNC,
13161 		.v.func = alc662_fixup_aspire_ethos_hp,
13162 	},
13163 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
13164 		.type = HDA_FIXUP_PINS,
13165 		.v.pins = (const struct hda_pintbl[]) {
13166 			{ 0x15, 0x92130110 }, /* front speakers */
13167 			{ 0x18, 0x99130111 }, /* center/subwoofer */
13168 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
13169 			{ }
13170 		},
13171 		.chained = true,
13172 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
13173 	},
13174 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
13175 		.type = HDA_FIXUP_FUNC,
13176 		.v.func = alc671_fixup_hp_headset_mic2,
13177 	},
13178 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
13179 		.type = HDA_FIXUP_PINS,
13180 		.v.pins = (const struct hda_pintbl[]) {
13181 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
13182 			{ }
13183 		},
13184 		.chained = true,
13185 		.chain_id = ALC662_FIXUP_USI_FUNC
13186 	},
13187 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
13188 		.type = HDA_FIXUP_PINS,
13189 		.v.pins = (const struct hda_pintbl[]) {
13190 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
13191 			{ 0x1b, 0x0221144f },
13192 			{ }
13193 		},
13194 		.chained = true,
13195 		.chain_id = ALC662_FIXUP_USI_FUNC
13196 	},
13197 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
13198 		.type = HDA_FIXUP_PINS,
13199 		.v.pins = (const struct hda_pintbl[]) {
13200 			{ 0x1b, 0x04a1112c },
13201 			{ }
13202 		},
13203 		.chained = true,
13204 		.chain_id = ALC668_FIXUP_HEADSET_MIC
13205 	},
13206 	[ALC668_FIXUP_HEADSET_MIC] = {
13207 		.type = HDA_FIXUP_FUNC,
13208 		.v.func = alc269_fixup_headset_mic,
13209 		.chained = true,
13210 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
13211 	},
13212 	[ALC668_FIXUP_MIC_DET_COEF] = {
13213 		.type = HDA_FIXUP_VERBS,
13214 		.v.verbs = (const struct hda_verb[]) {
13215 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
13216 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
13217 			{}
13218 		},
13219 	},
13220 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
13221 		.type = HDA_FIXUP_FUNC,
13222 		.v.func = alc897_fixup_lenovo_headset_mic,
13223 	},
13224 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
13225 		.type = HDA_FIXUP_PINS,
13226 		.v.pins = (const struct hda_pintbl[]) {
13227 			{ 0x1a, 0x03a11050 },
13228 			{ }
13229 		},
13230 		.chained = true,
13231 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
13232 	},
13233 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
13234 		.type = HDA_FIXUP_PINS,
13235 		.v.pins = (const struct hda_pintbl[]) {
13236 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
13237 			{ }
13238 		},
13239 	},
13240 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
13241 		.type = HDA_FIXUP_FUNC,
13242 		.v.func = alc897_fixup_lenovo_headset_mode,
13243 	},
13244 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
13245 		.type = HDA_FIXUP_PINS,
13246 		.v.pins = (const struct hda_pintbl[]) {
13247 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
13248 			{ }
13249 		},
13250 		.chained = true,
13251 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
13252 	},
13253 	[ALC897_FIXUP_UNIS_H3C_X500S] = {
13254 		.type = HDA_FIXUP_VERBS,
13255 		.v.verbs = (const struct hda_verb[]) {
13256 			{ 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
13257 			{}
13258 		},
13259 	},
13260 	[ALC897_FIXUP_HEADSET_MIC_PIN3] = {
13261 		.type = HDA_FIXUP_PINS,
13262 		.v.pins = (const struct hda_pintbl[]) {
13263 			{ 0x19, 0x03a11050 }, /* use as headset mic */
13264 			{ }
13265 		},
13266 	},
13267 };
13268 
13269 static const struct hda_quirk alc662_fixup_tbl[] = {
13270 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
13271 	SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
13272 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
13273 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
13274 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
13275 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
13276 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
13277 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
13278 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
13279 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
13280 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
13281 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
13282 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13283 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13284 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
13285 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
13286 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
13287 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13288 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13289 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13290 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13291 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
13292 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
13293 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13294 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13295 	SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
13296 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
13297 	SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
13298 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
13299 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
13300 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
13301 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
13302 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
13303 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
13304 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
13305 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
13306 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
13307 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
13308 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
13309 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
13310 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
13311 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
13312 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
13313 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
13314 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
13315 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
13316 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
13317 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
13318 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
13319 	SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
13320 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
13321 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
13322 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
13323 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
13324 	SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
13325 	SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
13326 	SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
13327 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
13328 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
13329 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
13330 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
13331 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
13332 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
13333 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
13334 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
13335 	SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
13336 
13337 #if 0
13338 	/* Below is a quirk table taken from the old code.
13339 	 * Basically the device should work as is without the fixup table.
13340 	 * If BIOS doesn't give a proper info, enable the corresponding
13341 	 * fixup entry.
13342 	 */
13343 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
13344 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
13345 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
13346 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
13347 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13348 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13349 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13350 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
13351 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
13352 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13353 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
13354 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
13355 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
13356 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
13357 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
13358 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13359 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
13360 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
13361 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13362 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13363 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13364 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13365 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
13366 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
13367 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
13368 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13369 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
13370 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13371 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13372 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
13373 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13374 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13375 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
13376 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
13377 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
13378 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
13379 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
13380 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
13381 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
13382 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13383 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
13384 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
13385 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13386 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
13387 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
13388 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
13389 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
13390 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
13391 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13392 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
13393 #endif
13394 	{}
13395 };
13396 
13397 static const struct hda_model_fixup alc662_fixup_models[] = {
13398 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
13399 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
13400 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
13401 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
13402 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
13403 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
13404 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
13405 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
13406 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
13407 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
13408 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
13409 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
13410 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
13411 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
13412 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
13413 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
13414 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
13415 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
13416 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
13417 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
13418 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
13419 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
13420 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
13421 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
13422 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
13423 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
13424 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
13425 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
13426 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
13427 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
13428 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
13429 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
13430 	{.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
13431 	{}
13432 };
13433 
13434 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
13435 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
13436 		{0x17, 0x02211010},
13437 		{0x18, 0x01a19030},
13438 		{0x1a, 0x01813040},
13439 		{0x21, 0x01014020}),
13440 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
13441 		{0x16, 0x01813030},
13442 		{0x17, 0x02211010},
13443 		{0x18, 0x01a19040},
13444 		{0x21, 0x01014020}),
13445 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
13446 		{0x14, 0x01014010},
13447 		{0x18, 0x01a19020},
13448 		{0x1a, 0x0181302f},
13449 		{0x1b, 0x0221401f}),
13450 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13451 		{0x12, 0x99a30130},
13452 		{0x14, 0x90170110},
13453 		{0x15, 0x0321101f},
13454 		{0x16, 0x03011020}),
13455 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13456 		{0x12, 0x99a30140},
13457 		{0x14, 0x90170110},
13458 		{0x15, 0x0321101f},
13459 		{0x16, 0x03011020}),
13460 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13461 		{0x12, 0x99a30150},
13462 		{0x14, 0x90170110},
13463 		{0x15, 0x0321101f},
13464 		{0x16, 0x03011020}),
13465 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13466 		{0x14, 0x90170110},
13467 		{0x15, 0x0321101f},
13468 		{0x16, 0x03011020}),
13469 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
13470 		{0x12, 0x90a60130},
13471 		{0x14, 0x90170110},
13472 		{0x15, 0x0321101f}),
13473 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13474 		{0x14, 0x01014010},
13475 		{0x17, 0x90170150},
13476 		{0x19, 0x02a11060},
13477 		{0x1b, 0x01813030},
13478 		{0x21, 0x02211020}),
13479 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13480 		{0x14, 0x01014010},
13481 		{0x18, 0x01a19040},
13482 		{0x1b, 0x01813030},
13483 		{0x21, 0x02211020}),
13484 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13485 		{0x14, 0x01014020},
13486 		{0x17, 0x90170110},
13487 		{0x18, 0x01a19050},
13488 		{0x1b, 0x01813040},
13489 		{0x21, 0x02211030}),
13490 	{}
13491 };
13492 
13493 /*
13494  */
patch_alc662(struct hda_codec * codec)13495 static int patch_alc662(struct hda_codec *codec)
13496 {
13497 	struct alc_spec *spec;
13498 	int err;
13499 
13500 	err = alc_alloc_spec(codec, 0x0b);
13501 	if (err < 0)
13502 		return err;
13503 
13504 	spec = codec->spec;
13505 
13506 	spec->shutup = alc_eapd_shutup;
13507 
13508 	/* handle multiple HPs as is */
13509 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
13510 
13511 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
13512 
13513 	switch (codec->core.vendor_id) {
13514 	case 0x10ec0668:
13515 		spec->init_hook = alc668_restore_default_value;
13516 		break;
13517 	}
13518 
13519 	alc_pre_init(codec);
13520 
13521 	snd_hda_pick_fixup(codec, alc662_fixup_models,
13522 		       alc662_fixup_tbl, alc662_fixups);
13523 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
13524 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
13525 
13526 	alc_auto_parse_customize_define(codec);
13527 
13528 	if (has_cdefine_beep(codec))
13529 		spec->gen.beep_nid = 0x01;
13530 
13531 	if ((alc_get_coef0(codec) & (1 << 14)) &&
13532 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
13533 	    spec->cdefine.platform_type == 1) {
13534 		err = alc_codec_rename(codec, "ALC272X");
13535 		if (err < 0)
13536 			goto error;
13537 	}
13538 
13539 	/* automatic parse from the BIOS config */
13540 	err = alc662_parse_auto_config(codec);
13541 	if (err < 0)
13542 		goto error;
13543 
13544 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
13545 		switch (codec->core.vendor_id) {
13546 		case 0x10ec0662:
13547 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13548 			break;
13549 		case 0x10ec0272:
13550 		case 0x10ec0663:
13551 		case 0x10ec0665:
13552 		case 0x10ec0668:
13553 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13554 			break;
13555 		case 0x10ec0273:
13556 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
13557 			break;
13558 		}
13559 		if (err < 0)
13560 			goto error;
13561 	}
13562 
13563 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
13564 
13565 	return 0;
13566 
13567  error:
13568 	alc_free(codec);
13569 	return err;
13570 }
13571 
13572 /*
13573  * ALC680 support
13574  */
13575 
alc680_parse_auto_config(struct hda_codec * codec)13576 static int alc680_parse_auto_config(struct hda_codec *codec)
13577 {
13578 	return alc_parse_auto_config(codec, NULL, NULL);
13579 }
13580 
13581 /*
13582  */
patch_alc680(struct hda_codec * codec)13583 static int patch_alc680(struct hda_codec *codec)
13584 {
13585 	int err;
13586 
13587 	/* ALC680 has no aa-loopback mixer */
13588 	err = alc_alloc_spec(codec, 0);
13589 	if (err < 0)
13590 		return err;
13591 
13592 	/* automatic parse from the BIOS config */
13593 	err = alc680_parse_auto_config(codec);
13594 	if (err < 0) {
13595 		alc_free(codec);
13596 		return err;
13597 	}
13598 
13599 	return 0;
13600 }
13601 
13602 /*
13603  * patch entries
13604  */
13605 static const struct hda_device_id snd_hda_id_realtek[] = {
13606 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
13607 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
13608 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
13609 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
13610 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
13611 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
13612 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
13613 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
13614 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
13615 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
13616 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
13617 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
13618 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
13619 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
13620 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
13621 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
13622 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
13623 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
13624 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
13625 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
13626 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
13627 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
13628 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
13629 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
13630 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
13631 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
13632 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
13633 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
13634 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
13635 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
13636 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
13637 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
13638 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
13639 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
13640 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
13641 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
13642 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
13643 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
13644 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
13645 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
13646 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
13647 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
13648 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
13649 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
13650 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
13651 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
13652 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
13653 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
13654 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
13655 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
13656 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
13657 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
13658 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
13659 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
13660 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
13661 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
13662 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
13663 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
13664 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
13665 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
13666 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
13667 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
13668 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
13669 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
13670 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
13671 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
13672 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
13673 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
13674 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
13675 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
13676 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
13677 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
13678 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
13679 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
13680 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
13681 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
13682 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
13683 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
13684 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
13685 	{} /* terminator */
13686 };
13687 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
13688 
13689 MODULE_LICENSE("GPL");
13690 MODULE_DESCRIPTION("Realtek HD-audio codec");
13691 MODULE_IMPORT_NS(SND_HDA_SCODEC_COMPONENT);
13692 
13693 static struct hda_codec_driver realtek_driver = {
13694 	.id = snd_hda_id_realtek,
13695 };
13696 
13697 module_hda_codec_driver(realtek_driver);
13698