• 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/init.h>
14 #include <linux/delay.h>
15 #include <linux/slab.h>
16 #include <linux/pci.h>
17 #include <linux/dmi.h>
18 #include <linux/module.h>
19 #include <linux/input.h>
20 #include <linux/leds.h>
21 #include <sound/core.h>
22 #include <sound/jack.h>
23 #include <sound/hda_codec.h>
24 #include "hda_local.h"
25 #include "hda_auto_parser.h"
26 #include "hda_jack.h"
27 #include "hda_generic.h"
28 
29 /* keep halting ALC5505 DSP, for power saving */
30 #define HALT_REALTEK_ALC5505
31 
32 /* extra amp-initialization sequence types */
33 enum {
34 	ALC_INIT_UNDEFINED,
35 	ALC_INIT_NONE,
36 	ALC_INIT_DEFAULT,
37 };
38 
39 enum {
40 	ALC_HEADSET_MODE_UNKNOWN,
41 	ALC_HEADSET_MODE_UNPLUGGED,
42 	ALC_HEADSET_MODE_HEADSET,
43 	ALC_HEADSET_MODE_MIC,
44 	ALC_HEADSET_MODE_HEADPHONE,
45 };
46 
47 enum {
48 	ALC_HEADSET_TYPE_UNKNOWN,
49 	ALC_HEADSET_TYPE_CTIA,
50 	ALC_HEADSET_TYPE_OMTP,
51 };
52 
53 enum {
54 	ALC_KEY_MICMUTE_INDEX,
55 };
56 
57 struct alc_customize_define {
58 	unsigned int  sku_cfg;
59 	unsigned char port_connectivity;
60 	unsigned char check_sum;
61 	unsigned char customization;
62 	unsigned char external_amp;
63 	unsigned int  enable_pcbeep:1;
64 	unsigned int  platform_type:1;
65 	unsigned int  swap:1;
66 	unsigned int  override:1;
67 	unsigned int  fixup:1; /* Means that this sku is set by driver, not read from hw */
68 };
69 
70 struct alc_coef_led {
71 	unsigned int idx;
72 	unsigned int mask;
73 	unsigned int on;
74 	unsigned int off;
75 };
76 
77 struct alc_spec {
78 	struct hda_gen_spec gen; /* must be at head */
79 
80 	/* codec parameterization */
81 	struct alc_customize_define cdefine;
82 	unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
83 
84 	/* GPIO bits */
85 	unsigned int gpio_mask;
86 	unsigned int gpio_dir;
87 	unsigned int gpio_data;
88 	bool gpio_write_delay;	/* add a delay before writing gpio_data */
89 
90 	/* mute LED for HP laptops, see vref_mute_led_set() */
91 	int mute_led_polarity;
92 	int micmute_led_polarity;
93 	hda_nid_t mute_led_nid;
94 	hda_nid_t cap_mute_led_nid;
95 
96 	unsigned int gpio_mute_led_mask;
97 	unsigned int gpio_mic_led_mask;
98 	struct alc_coef_led mute_led_coef;
99 	struct alc_coef_led mic_led_coef;
100 	struct mutex coef_mutex;
101 
102 	hda_nid_t headset_mic_pin;
103 	hda_nid_t headphone_mic_pin;
104 	int current_headset_mode;
105 	int current_headset_type;
106 
107 	/* hooks */
108 	void (*init_hook)(struct hda_codec *codec);
109 #ifdef CONFIG_PM
110 	void (*power_hook)(struct hda_codec *codec);
111 #endif
112 	void (*shutup)(struct hda_codec *codec);
113 	void (*reboot_notify)(struct hda_codec *codec);
114 
115 	int init_amp;
116 	int codec_variant;	/* flag for other variants */
117 	unsigned int has_alc5505_dsp:1;
118 	unsigned int no_depop_delay:1;
119 	unsigned int done_hp_init:1;
120 	unsigned int no_shutup_pins:1;
121 	unsigned int ultra_low_power:1;
122 	unsigned int has_hs_key:1;
123 	unsigned int no_internal_mic_pin:1;
124 	unsigned int en_3kpull_low:1;
125 
126 	/* for PLL fix */
127 	hda_nid_t pll_nid;
128 	unsigned int pll_coef_idx, pll_coef_bit;
129 	unsigned int coef0;
130 	struct input_dev *kb_dev;
131 	u8 alc_mute_keycode_map[1];
132 };
133 
134 /*
135  * COEF access helper functions
136  */
137 
coef_mutex_lock(struct hda_codec * codec)138 static void coef_mutex_lock(struct hda_codec *codec)
139 {
140 	struct alc_spec *spec = codec->spec;
141 
142 	snd_hda_power_up_pm(codec);
143 	mutex_lock(&spec->coef_mutex);
144 }
145 
coef_mutex_unlock(struct hda_codec * codec)146 static void coef_mutex_unlock(struct hda_codec *codec)
147 {
148 	struct alc_spec *spec = codec->spec;
149 
150 	mutex_unlock(&spec->coef_mutex);
151 	snd_hda_power_down_pm(codec);
152 }
153 
__alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)154 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
155 				 unsigned int coef_idx)
156 {
157 	unsigned int val;
158 
159 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
160 	val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
161 	return val;
162 }
163 
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)164 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
165 			       unsigned int coef_idx)
166 {
167 	unsigned int val;
168 
169 	coef_mutex_lock(codec);
170 	val = __alc_read_coefex_idx(codec, nid, coef_idx);
171 	coef_mutex_unlock(codec);
172 	return val;
173 }
174 
175 #define alc_read_coef_idx(codec, coef_idx) \
176 	alc_read_coefex_idx(codec, 0x20, coef_idx)
177 
__alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)178 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
179 				   unsigned int coef_idx, unsigned int coef_val)
180 {
181 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
182 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
183 }
184 
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)185 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
186 				 unsigned int coef_idx, unsigned int coef_val)
187 {
188 	coef_mutex_lock(codec);
189 	__alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
190 	coef_mutex_unlock(codec);
191 }
192 
193 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
194 	alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
195 
__alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)196 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
197 				    unsigned int coef_idx, unsigned int mask,
198 				    unsigned int bits_set)
199 {
200 	unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
201 
202 	if (val != -1)
203 		__alc_write_coefex_idx(codec, nid, coef_idx,
204 				       (val & ~mask) | bits_set);
205 }
206 
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)207 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
208 				  unsigned int coef_idx, unsigned int mask,
209 				  unsigned int bits_set)
210 {
211 	coef_mutex_lock(codec);
212 	__alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
213 	coef_mutex_unlock(codec);
214 }
215 
216 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set)	\
217 	alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
218 
219 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)220 static unsigned int alc_get_coef0(struct hda_codec *codec)
221 {
222 	struct alc_spec *spec = codec->spec;
223 
224 	if (!spec->coef0)
225 		spec->coef0 = alc_read_coef_idx(codec, 0);
226 	return spec->coef0;
227 }
228 
229 /* coef writes/updates batch */
230 struct coef_fw {
231 	unsigned char nid;
232 	unsigned char idx;
233 	unsigned short mask;
234 	unsigned short val;
235 };
236 
237 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
238 	{ .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
239 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
240 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
241 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
242 
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)243 static void alc_process_coef_fw(struct hda_codec *codec,
244 				const struct coef_fw *fw)
245 {
246 	coef_mutex_lock(codec);
247 	for (; fw->nid; fw++) {
248 		if (fw->mask == (unsigned short)-1)
249 			__alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
250 		else
251 			__alc_update_coefex_idx(codec, fw->nid, fw->idx,
252 						fw->mask, fw->val);
253 	}
254 	coef_mutex_unlock(codec);
255 }
256 
257 /*
258  * GPIO setup tables, used in initialization
259  */
260 
261 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)262 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
263 {
264 	struct alc_spec *spec = codec->spec;
265 
266 	spec->gpio_mask |= mask;
267 	spec->gpio_dir |= mask;
268 	spec->gpio_data |= mask;
269 }
270 
alc_write_gpio_data(struct hda_codec * codec)271 static void alc_write_gpio_data(struct hda_codec *codec)
272 {
273 	struct alc_spec *spec = codec->spec;
274 
275 	snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
276 			    spec->gpio_data);
277 }
278 
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)279 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
280 				 bool on)
281 {
282 	struct alc_spec *spec = codec->spec;
283 	unsigned int oldval = spec->gpio_data;
284 
285 	if (on)
286 		spec->gpio_data |= mask;
287 	else
288 		spec->gpio_data &= ~mask;
289 	if (oldval != spec->gpio_data)
290 		alc_write_gpio_data(codec);
291 }
292 
alc_write_gpio(struct hda_codec * codec)293 static void alc_write_gpio(struct hda_codec *codec)
294 {
295 	struct alc_spec *spec = codec->spec;
296 
297 	if (!spec->gpio_mask)
298 		return;
299 
300 	snd_hda_codec_write(codec, codec->core.afg, 0,
301 			    AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
302 	snd_hda_codec_write(codec, codec->core.afg, 0,
303 			    AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
304 	if (spec->gpio_write_delay)
305 		msleep(1);
306 	alc_write_gpio_data(codec);
307 }
308 
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)309 static void alc_fixup_gpio(struct hda_codec *codec, int action,
310 			   unsigned int mask)
311 {
312 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
313 		alc_setup_gpio(codec, mask);
314 }
315 
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)316 static void alc_fixup_gpio1(struct hda_codec *codec,
317 			    const struct hda_fixup *fix, int action)
318 {
319 	alc_fixup_gpio(codec, action, 0x01);
320 }
321 
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)322 static void alc_fixup_gpio2(struct hda_codec *codec,
323 			    const struct hda_fixup *fix, int action)
324 {
325 	alc_fixup_gpio(codec, action, 0x02);
326 }
327 
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)328 static void alc_fixup_gpio3(struct hda_codec *codec,
329 			    const struct hda_fixup *fix, int action)
330 {
331 	alc_fixup_gpio(codec, action, 0x03);
332 }
333 
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)334 static void alc_fixup_gpio4(struct hda_codec *codec,
335 			    const struct hda_fixup *fix, int action)
336 {
337 	alc_fixup_gpio(codec, action, 0x04);
338 }
339 
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)340 static void alc_fixup_micmute_led(struct hda_codec *codec,
341 				  const struct hda_fixup *fix, int action)
342 {
343 	if (action == HDA_FIXUP_ACT_PROBE)
344 		snd_hda_gen_add_micmute_led_cdev(codec, NULL);
345 }
346 
347 /*
348  * Fix hardware PLL issue
349  * On some codecs, the analog PLL gating control must be off while
350  * the default value is 1.
351  */
alc_fix_pll(struct hda_codec * codec)352 static void alc_fix_pll(struct hda_codec *codec)
353 {
354 	struct alc_spec *spec = codec->spec;
355 
356 	if (spec->pll_nid)
357 		alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
358 				      1 << spec->pll_coef_bit, 0);
359 }
360 
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)361 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
362 			     unsigned int coef_idx, unsigned int coef_bit)
363 {
364 	struct alc_spec *spec = codec->spec;
365 	spec->pll_nid = nid;
366 	spec->pll_coef_idx = coef_idx;
367 	spec->pll_coef_bit = coef_bit;
368 	alc_fix_pll(codec);
369 }
370 
371 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)372 static void alc_update_knob_master(struct hda_codec *codec,
373 				   struct hda_jack_callback *jack)
374 {
375 	unsigned int val;
376 	struct snd_kcontrol *kctl;
377 	struct snd_ctl_elem_value *uctl;
378 
379 	kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
380 	if (!kctl)
381 		return;
382 	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
383 	if (!uctl)
384 		return;
385 	val = snd_hda_codec_read(codec, jack->nid, 0,
386 				 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
387 	val &= HDA_AMP_VOLMASK;
388 	uctl->value.integer.value[0] = val;
389 	uctl->value.integer.value[1] = val;
390 	kctl->put(kctl, uctl);
391 	kfree(uctl);
392 }
393 
alc880_unsol_event(struct hda_codec * codec,unsigned int res)394 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
395 {
396 	/* For some reason, the res given from ALC880 is broken.
397 	   Here we adjust it properly. */
398 	snd_hda_jack_unsol_event(codec, res >> 2);
399 }
400 
401 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)402 static void alc_fill_eapd_coef(struct hda_codec *codec)
403 {
404 	int coef;
405 
406 	coef = alc_get_coef0(codec);
407 
408 	switch (codec->core.vendor_id) {
409 	case 0x10ec0262:
410 		alc_update_coef_idx(codec, 0x7, 0, 1<<5);
411 		break;
412 	case 0x10ec0267:
413 	case 0x10ec0268:
414 		alc_update_coef_idx(codec, 0x7, 0, 1<<13);
415 		break;
416 	case 0x10ec0269:
417 		if ((coef & 0x00f0) == 0x0010)
418 			alc_update_coef_idx(codec, 0xd, 0, 1<<14);
419 		if ((coef & 0x00f0) == 0x0020)
420 			alc_update_coef_idx(codec, 0x4, 1<<15, 0);
421 		if ((coef & 0x00f0) == 0x0030)
422 			alc_update_coef_idx(codec, 0x10, 1<<9, 0);
423 		break;
424 	case 0x10ec0280:
425 	case 0x10ec0284:
426 	case 0x10ec0290:
427 	case 0x10ec0292:
428 		alc_update_coef_idx(codec, 0x4, 1<<15, 0);
429 		break;
430 	case 0x10ec0225:
431 	case 0x10ec0295:
432 	case 0x10ec0299:
433 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
434 		fallthrough;
435 	case 0x10ec0215:
436 	case 0x10ec0230:
437 	case 0x10ec0233:
438 	case 0x10ec0235:
439 	case 0x10ec0236:
440 	case 0x10ec0245:
441 	case 0x10ec0255:
442 	case 0x10ec0256:
443 	case 0x19e58326:
444 	case 0x10ec0257:
445 	case 0x10ec0282:
446 	case 0x10ec0283:
447 	case 0x10ec0286:
448 	case 0x10ec0288:
449 	case 0x10ec0285:
450 	case 0x10ec0298:
451 	case 0x10ec0289:
452 	case 0x10ec0300:
453 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
454 		break;
455 	case 0x10ec0275:
456 		alc_update_coef_idx(codec, 0xe, 0, 1<<0);
457 		break;
458 	case 0x10ec0287:
459 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
460 		alc_write_coef_idx(codec, 0x8, 0x4ab7);
461 		break;
462 	case 0x10ec0293:
463 		alc_update_coef_idx(codec, 0xa, 1<<13, 0);
464 		break;
465 	case 0x10ec0234:
466 	case 0x10ec0274:
467 	case 0x10ec0294:
468 	case 0x10ec0700:
469 	case 0x10ec0701:
470 	case 0x10ec0703:
471 	case 0x10ec0711:
472 		alc_update_coef_idx(codec, 0x10, 1<<15, 0);
473 		break;
474 	case 0x10ec0662:
475 		if ((coef & 0x00f0) == 0x0030)
476 			alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
477 		break;
478 	case 0x10ec0272:
479 	case 0x10ec0273:
480 	case 0x10ec0663:
481 	case 0x10ec0665:
482 	case 0x10ec0670:
483 	case 0x10ec0671:
484 	case 0x10ec0672:
485 		alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
486 		break;
487 	case 0x10ec0222:
488 	case 0x10ec0623:
489 		alc_update_coef_idx(codec, 0x19, 1<<13, 0);
490 		break;
491 	case 0x10ec0668:
492 		alc_update_coef_idx(codec, 0x7, 3<<13, 0);
493 		break;
494 	case 0x10ec0867:
495 		alc_update_coef_idx(codec, 0x4, 1<<10, 0);
496 		break;
497 	case 0x10ec0888:
498 		if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
499 			alc_update_coef_idx(codec, 0x7, 1<<5, 0);
500 		break;
501 	case 0x10ec0892:
502 	case 0x10ec0897:
503 		alc_update_coef_idx(codec, 0x7, 1<<5, 0);
504 		break;
505 	case 0x10ec0899:
506 	case 0x10ec0900:
507 	case 0x10ec0b00:
508 	case 0x10ec1168:
509 	case 0x10ec1220:
510 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
511 		break;
512 	}
513 }
514 
515 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)516 static void alc888_coef_init(struct hda_codec *codec)
517 {
518 	switch (alc_get_coef0(codec) & 0x00f0) {
519 	/* alc888-VA */
520 	case 0x00:
521 	/* alc888-VB */
522 	case 0x10:
523 		alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
524 		break;
525 	}
526 }
527 
528 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)529 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
530 {
531 	if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
532 		return;
533 	if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
534 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
535 				    on ? 2 : 0);
536 }
537 
538 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)539 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
540 {
541 	/* We currently only handle front, HP */
542 	static const hda_nid_t pins[] = {
543 		0x0f, 0x10, 0x14, 0x15, 0x17, 0
544 	};
545 	const hda_nid_t *p;
546 	for (p = pins; *p; p++)
547 		set_eapd(codec, *p, on);
548 }
549 
550 static int find_ext_mic_pin(struct hda_codec *codec);
551 
alc_headset_mic_no_shutup(struct hda_codec * codec)552 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
553 {
554 	const struct hda_pincfg *pin;
555 	int mic_pin = find_ext_mic_pin(codec);
556 	int i;
557 
558 	/* don't shut up pins when unloading the driver; otherwise it breaks
559 	 * the default pin setup at the next load of the driver
560 	 */
561 	if (codec->bus->shutdown)
562 		return;
563 
564 	snd_array_for_each(&codec->init_pins, i, pin) {
565 		/* use read here for syncing after issuing each verb */
566 		if (pin->nid != mic_pin)
567 			snd_hda_codec_read(codec, pin->nid, 0,
568 					AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
569 	}
570 
571 	codec->pins_shutup = 1;
572 }
573 
alc_shutup_pins(struct hda_codec * codec)574 static void alc_shutup_pins(struct hda_codec *codec)
575 {
576 	struct alc_spec *spec = codec->spec;
577 
578 	switch (codec->core.vendor_id) {
579 	case 0x10ec0236:
580 	case 0x10ec0256:
581 	case 0x19e58326:
582 	case 0x10ec0283:
583 	case 0x10ec0286:
584 	case 0x10ec0288:
585 	case 0x10ec0298:
586 		alc_headset_mic_no_shutup(codec);
587 		break;
588 	default:
589 		if (!spec->no_shutup_pins)
590 			snd_hda_shutup_pins(codec);
591 		break;
592 	}
593 }
594 
595 /* generic shutup callback;
596  * just turning off EAPD and a little pause for avoiding pop-noise
597  */
alc_eapd_shutup(struct hda_codec * codec)598 static void alc_eapd_shutup(struct hda_codec *codec)
599 {
600 	struct alc_spec *spec = codec->spec;
601 
602 	alc_auto_setup_eapd(codec, false);
603 	if (!spec->no_depop_delay)
604 		msleep(200);
605 	alc_shutup_pins(codec);
606 }
607 
608 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)609 static void alc_auto_init_amp(struct hda_codec *codec, int type)
610 {
611 	alc_auto_setup_eapd(codec, true);
612 	alc_write_gpio(codec);
613 	switch (type) {
614 	case ALC_INIT_DEFAULT:
615 		switch (codec->core.vendor_id) {
616 		case 0x10ec0260:
617 			alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
618 			break;
619 		case 0x10ec0880:
620 		case 0x10ec0882:
621 		case 0x10ec0883:
622 		case 0x10ec0885:
623 			alc_update_coef_idx(codec, 7, 0, 0x2030);
624 			break;
625 		case 0x10ec0888:
626 			alc888_coef_init(codec);
627 			break;
628 		}
629 		break;
630 	}
631 }
632 
633 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)634 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
635 {
636 	if (spec->gen.autocfg.hp_pins[0])
637 		return spec->gen.autocfg.hp_pins[0];
638 	if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
639 		return spec->gen.autocfg.line_out_pins[0];
640 	return 0;
641 }
642 
643 /*
644  * Realtek SSID verification
645  */
646 
647 /* Could be any non-zero and even value. When used as fixup, tells
648  * the driver to ignore any present sku defines.
649  */
650 #define ALC_FIXUP_SKU_IGNORE (2)
651 
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)652 static void alc_fixup_sku_ignore(struct hda_codec *codec,
653 				 const struct hda_fixup *fix, int action)
654 {
655 	struct alc_spec *spec = codec->spec;
656 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
657 		spec->cdefine.fixup = 1;
658 		spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
659 	}
660 }
661 
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)662 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
663 				    const struct hda_fixup *fix, int action)
664 {
665 	struct alc_spec *spec = codec->spec;
666 
667 	if (action == HDA_FIXUP_ACT_PROBE) {
668 		spec->no_depop_delay = 1;
669 		codec->depop_delay = 0;
670 	}
671 }
672 
alc_auto_parse_customize_define(struct hda_codec * codec)673 static int alc_auto_parse_customize_define(struct hda_codec *codec)
674 {
675 	unsigned int ass, tmp, i;
676 	unsigned nid = 0;
677 	struct alc_spec *spec = codec->spec;
678 
679 	spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
680 
681 	if (spec->cdefine.fixup) {
682 		ass = spec->cdefine.sku_cfg;
683 		if (ass == ALC_FIXUP_SKU_IGNORE)
684 			return -1;
685 		goto do_sku;
686 	}
687 
688 	if (!codec->bus->pci)
689 		return -1;
690 	ass = codec->core.subsystem_id & 0xffff;
691 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
692 		goto do_sku;
693 
694 	nid = 0x1d;
695 	if (codec->core.vendor_id == 0x10ec0260)
696 		nid = 0x17;
697 	ass = snd_hda_codec_get_pincfg(codec, nid);
698 
699 	if (!(ass & 1)) {
700 		codec_info(codec, "%s: SKU not ready 0x%08x\n",
701 			   codec->core.chip_name, ass);
702 		return -1;
703 	}
704 
705 	/* check sum */
706 	tmp = 0;
707 	for (i = 1; i < 16; i++) {
708 		if ((ass >> i) & 1)
709 			tmp++;
710 	}
711 	if (((ass >> 16) & 0xf) != tmp)
712 		return -1;
713 
714 	spec->cdefine.port_connectivity = ass >> 30;
715 	spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
716 	spec->cdefine.check_sum = (ass >> 16) & 0xf;
717 	spec->cdefine.customization = ass >> 8;
718 do_sku:
719 	spec->cdefine.sku_cfg = ass;
720 	spec->cdefine.external_amp = (ass & 0x38) >> 3;
721 	spec->cdefine.platform_type = (ass & 0x4) >> 2;
722 	spec->cdefine.swap = (ass & 0x2) >> 1;
723 	spec->cdefine.override = ass & 0x1;
724 
725 	codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
726 		   nid, spec->cdefine.sku_cfg);
727 	codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
728 		   spec->cdefine.port_connectivity);
729 	codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
730 	codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
731 	codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
732 	codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
733 	codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
734 	codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
735 	codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
736 
737 	return 0;
738 }
739 
740 /* 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)741 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
742 {
743 	int i;
744 	for (i = 0; i < nums; i++)
745 		if (list[i] == nid)
746 			return i;
747 	return -1;
748 }
749 /* 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)750 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
751 {
752 	return find_idx_in_nid_list(nid, list, nums) >= 0;
753 }
754 
755 /* check subsystem ID and set up device-specific initialization;
756  * return 1 if initialized, 0 if invalid SSID
757  */
758 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
759  *	31 ~ 16 :	Manufacture ID
760  *	15 ~ 8	:	SKU ID
761  *	7  ~ 0	:	Assembly ID
762  *	port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
763  */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)764 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
765 {
766 	unsigned int ass, tmp, i;
767 	unsigned nid;
768 	struct alc_spec *spec = codec->spec;
769 
770 	if (spec->cdefine.fixup) {
771 		ass = spec->cdefine.sku_cfg;
772 		if (ass == ALC_FIXUP_SKU_IGNORE)
773 			return 0;
774 		goto do_sku;
775 	}
776 
777 	ass = codec->core.subsystem_id & 0xffff;
778 	if (codec->bus->pci &&
779 	    ass != codec->bus->pci->subsystem_device && (ass & 1))
780 		goto do_sku;
781 
782 	/* invalid SSID, check the special NID pin defcfg instead */
783 	/*
784 	 * 31~30	: port connectivity
785 	 * 29~21	: reserve
786 	 * 20		: PCBEEP input
787 	 * 19~16	: Check sum (15:1)
788 	 * 15~1		: Custom
789 	 * 0		: override
790 	*/
791 	nid = 0x1d;
792 	if (codec->core.vendor_id == 0x10ec0260)
793 		nid = 0x17;
794 	ass = snd_hda_codec_get_pincfg(codec, nid);
795 	codec_dbg(codec,
796 		  "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
797 		   ass, nid);
798 	if (!(ass & 1))
799 		return 0;
800 	if ((ass >> 30) != 1)	/* no physical connection */
801 		return 0;
802 
803 	/* check sum */
804 	tmp = 0;
805 	for (i = 1; i < 16; i++) {
806 		if ((ass >> i) & 1)
807 			tmp++;
808 	}
809 	if (((ass >> 16) & 0xf) != tmp)
810 		return 0;
811 do_sku:
812 	codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
813 		   ass & 0xffff, codec->core.vendor_id);
814 	/*
815 	 * 0 : override
816 	 * 1 :	Swap Jack
817 	 * 2 : 0 --> Desktop, 1 --> Laptop
818 	 * 3~5 : External Amplifier control
819 	 * 7~6 : Reserved
820 	*/
821 	tmp = (ass & 0x38) >> 3;	/* external Amp control */
822 	if (spec->init_amp == ALC_INIT_UNDEFINED) {
823 		switch (tmp) {
824 		case 1:
825 			alc_setup_gpio(codec, 0x01);
826 			break;
827 		case 3:
828 			alc_setup_gpio(codec, 0x02);
829 			break;
830 		case 7:
831 			alc_setup_gpio(codec, 0x04);
832 			break;
833 		case 5:
834 		default:
835 			spec->init_amp = ALC_INIT_DEFAULT;
836 			break;
837 		}
838 	}
839 
840 	/* is laptop or Desktop and enable the function "Mute internal speaker
841 	 * when the external headphone out jack is plugged"
842 	 */
843 	if (!(ass & 0x8000))
844 		return 1;
845 	/*
846 	 * 10~8 : Jack location
847 	 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
848 	 * 14~13: Resvered
849 	 * 15   : 1 --> enable the function "Mute internal speaker
850 	 *	        when the external headphone out jack is plugged"
851 	 */
852 	if (!alc_get_hp_pin(spec)) {
853 		hda_nid_t nid;
854 		tmp = (ass >> 11) & 0x3;	/* HP to chassis */
855 		nid = ports[tmp];
856 		if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
857 				      spec->gen.autocfg.line_outs))
858 			return 1;
859 		spec->gen.autocfg.hp_pins[0] = nid;
860 	}
861 	return 1;
862 }
863 
864 /* Check the validity of ALC subsystem-id
865  * 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)866 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
867 {
868 	if (!alc_subsystem_id(codec, ports)) {
869 		struct alc_spec *spec = codec->spec;
870 		if (spec->init_amp == ALC_INIT_UNDEFINED) {
871 			codec_dbg(codec,
872 				  "realtek: Enable default setup for auto mode as fallback\n");
873 			spec->init_amp = ALC_INIT_DEFAULT;
874 		}
875 	}
876 }
877 
878 /*
879  */
880 
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)881 static void alc_fixup_inv_dmic(struct hda_codec *codec,
882 			       const struct hda_fixup *fix, int action)
883 {
884 	struct alc_spec *spec = codec->spec;
885 
886 	spec->gen.inv_dmic_split = 1;
887 }
888 
889 
alc_build_controls(struct hda_codec * codec)890 static int alc_build_controls(struct hda_codec *codec)
891 {
892 	int err;
893 
894 	err = snd_hda_gen_build_controls(codec);
895 	if (err < 0)
896 		return err;
897 
898 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
899 	return 0;
900 }
901 
902 
903 /*
904  * Common callbacks
905  */
906 
alc_pre_init(struct hda_codec * codec)907 static void alc_pre_init(struct hda_codec *codec)
908 {
909 	alc_fill_eapd_coef(codec);
910 }
911 
912 #define is_s3_resume(codec) \
913 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
914 #define is_s4_resume(codec) \
915 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
916 
alc_init(struct hda_codec * codec)917 static int alc_init(struct hda_codec *codec)
918 {
919 	struct alc_spec *spec = codec->spec;
920 
921 	/* hibernation resume needs the full chip initialization */
922 	if (is_s4_resume(codec))
923 		alc_pre_init(codec);
924 
925 	if (spec->init_hook)
926 		spec->init_hook(codec);
927 
928 	spec->gen.skip_verbs = 1; /* applied in below */
929 	snd_hda_gen_init(codec);
930 	alc_fix_pll(codec);
931 	alc_auto_init_amp(codec, spec->init_amp);
932 	snd_hda_apply_verbs(codec); /* apply verbs here after own init */
933 
934 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
935 
936 	return 0;
937 }
938 
alc_shutup(struct hda_codec * codec)939 static inline void alc_shutup(struct hda_codec *codec)
940 {
941 	struct alc_spec *spec = codec->spec;
942 
943 	if (!snd_hda_get_bool_hint(codec, "shutup"))
944 		return; /* disabled explicitly by hints */
945 
946 	if (spec && spec->shutup)
947 		spec->shutup(codec);
948 	else
949 		alc_shutup_pins(codec);
950 }
951 
alc_reboot_notify(struct hda_codec * codec)952 static void alc_reboot_notify(struct hda_codec *codec)
953 {
954 	struct alc_spec *spec = codec->spec;
955 
956 	if (spec && spec->reboot_notify)
957 		spec->reboot_notify(codec);
958 	else
959 		alc_shutup(codec);
960 }
961 
962 #define alc_free	snd_hda_gen_free
963 
964 #ifdef CONFIG_PM
alc_power_eapd(struct hda_codec * codec)965 static void alc_power_eapd(struct hda_codec *codec)
966 {
967 	alc_auto_setup_eapd(codec, false);
968 }
969 
alc_suspend(struct hda_codec * codec)970 static int alc_suspend(struct hda_codec *codec)
971 {
972 	struct alc_spec *spec = codec->spec;
973 	alc_shutup(codec);
974 	if (spec && spec->power_hook)
975 		spec->power_hook(codec);
976 	return 0;
977 }
978 #endif
979 
980 #ifdef CONFIG_PM
alc_resume(struct hda_codec * codec)981 static int alc_resume(struct hda_codec *codec)
982 {
983 	struct alc_spec *spec = codec->spec;
984 
985 	if (!spec->no_depop_delay)
986 		msleep(150); /* to avoid pop noise */
987 	codec->patch_ops.init(codec);
988 	snd_hda_regmap_sync(codec);
989 	hda_call_check_power_status(codec, 0x01);
990 	return 0;
991 }
992 #endif
993 
994 /*
995  */
996 static const struct hda_codec_ops alc_patch_ops = {
997 	.build_controls = alc_build_controls,
998 	.build_pcms = snd_hda_gen_build_pcms,
999 	.init = alc_init,
1000 	.free = alc_free,
1001 	.unsol_event = snd_hda_jack_unsol_event,
1002 #ifdef CONFIG_PM
1003 	.resume = alc_resume,
1004 	.suspend = alc_suspend,
1005 	.check_power_status = snd_hda_gen_check_power_status,
1006 #endif
1007 	.reboot_notify = alc_reboot_notify,
1008 };
1009 
1010 
1011 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1012 
1013 /*
1014  * Rename codecs appropriately from COEF value or subvendor id
1015  */
1016 struct alc_codec_rename_table {
1017 	unsigned int vendor_id;
1018 	unsigned short coef_mask;
1019 	unsigned short coef_bits;
1020 	const char *name;
1021 };
1022 
1023 struct alc_codec_rename_pci_table {
1024 	unsigned int codec_vendor_id;
1025 	unsigned short pci_subvendor;
1026 	unsigned short pci_subdevice;
1027 	const char *name;
1028 };
1029 
1030 static const struct alc_codec_rename_table rename_tbl[] = {
1031 	{ 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1032 	{ 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1033 	{ 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1034 	{ 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1035 	{ 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1036 	{ 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1037 	{ 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1038 	{ 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1039 	{ 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1040 	{ 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1041 	{ 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1042 	{ 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1043 	{ 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1044 	{ 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1045 	{ 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1046 	{ 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1047 	{ 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1048 	{ } /* terminator */
1049 };
1050 
1051 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1052 	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
1053 	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
1054 	{ 0x10ec0283, 0x1028, 0, "ALC3223" },
1055 	{ 0x10ec0288, 0x1028, 0, "ALC3263" },
1056 	{ 0x10ec0292, 0x1028, 0, "ALC3226" },
1057 	{ 0x10ec0293, 0x1028, 0, "ALC3235" },
1058 	{ 0x10ec0255, 0x1028, 0, "ALC3234" },
1059 	{ 0x10ec0668, 0x1028, 0, "ALC3661" },
1060 	{ 0x10ec0275, 0x1028, 0, "ALC3260" },
1061 	{ 0x10ec0899, 0x1028, 0, "ALC3861" },
1062 	{ 0x10ec0298, 0x1028, 0, "ALC3266" },
1063 	{ 0x10ec0236, 0x1028, 0, "ALC3204" },
1064 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
1065 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
1066 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
1067 	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
1068 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
1069 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
1070 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
1071 	{ 0x10ec0233, 0x1043, 0, "ALC3236" },
1072 	{ 0x10ec0280, 0x103c, 0, "ALC3228" },
1073 	{ 0x10ec0282, 0x103c, 0, "ALC3227" },
1074 	{ 0x10ec0286, 0x103c, 0, "ALC3242" },
1075 	{ 0x10ec0290, 0x103c, 0, "ALC3241" },
1076 	{ 0x10ec0668, 0x103c, 0, "ALC3662" },
1077 	{ 0x10ec0283, 0x17aa, 0, "ALC3239" },
1078 	{ 0x10ec0292, 0x17aa, 0, "ALC3232" },
1079 	{ } /* terminator */
1080 };
1081 
alc_codec_rename_from_preset(struct hda_codec * codec)1082 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1083 {
1084 	const struct alc_codec_rename_table *p;
1085 	const struct alc_codec_rename_pci_table *q;
1086 
1087 	for (p = rename_tbl; p->vendor_id; p++) {
1088 		if (p->vendor_id != codec->core.vendor_id)
1089 			continue;
1090 		if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1091 			return alc_codec_rename(codec, p->name);
1092 	}
1093 
1094 	if (!codec->bus->pci)
1095 		return 0;
1096 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1097 		if (q->codec_vendor_id != codec->core.vendor_id)
1098 			continue;
1099 		if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1100 			continue;
1101 		if (!q->pci_subdevice ||
1102 		    q->pci_subdevice == codec->bus->pci->subsystem_device)
1103 			return alc_codec_rename(codec, q->name);
1104 	}
1105 
1106 	return 0;
1107 }
1108 
1109 
1110 /*
1111  * Digital-beep handlers
1112  */
1113 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1114 
1115 /* additional beep mixers; private_value will be overwritten */
1116 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1117 	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1118 	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1119 };
1120 
1121 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1122 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1123 			int idx, int dir)
1124 {
1125 	struct snd_kcontrol_new *knew;
1126 	unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1127 	int i;
1128 
1129 	for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1130 		knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1131 					    &alc_beep_mixer[i]);
1132 		if (!knew)
1133 			return -ENOMEM;
1134 		knew->private_value = beep_amp;
1135 	}
1136 	return 0;
1137 }
1138 
1139 static const struct snd_pci_quirk beep_allow_list[] = {
1140 	SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1141 	SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1142 	SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1143 	SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1144 	SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1145 	SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1146 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1147 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1148 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1149 	/* denylist -- no beep available */
1150 	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1151 	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1152 	{}
1153 };
1154 
has_cdefine_beep(struct hda_codec * codec)1155 static inline int has_cdefine_beep(struct hda_codec *codec)
1156 {
1157 	struct alc_spec *spec = codec->spec;
1158 	const struct snd_pci_quirk *q;
1159 	q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1160 	if (q)
1161 		return q->value;
1162 	return spec->cdefine.enable_pcbeep;
1163 }
1164 #else
1165 #define set_beep_amp(spec, nid, idx, dir)	0
1166 #define has_cdefine_beep(codec)		0
1167 #endif
1168 
1169 /* parse the BIOS configuration and set up the alc_spec */
1170 /* return 1 if successful, 0 if the proper config is not found,
1171  * or a negative error code
1172  */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1173 static int alc_parse_auto_config(struct hda_codec *codec,
1174 				 const hda_nid_t *ignore_nids,
1175 				 const hda_nid_t *ssid_nids)
1176 {
1177 	struct alc_spec *spec = codec->spec;
1178 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1179 	int err;
1180 
1181 	err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1182 				       spec->parse_flags);
1183 	if (err < 0)
1184 		return err;
1185 
1186 	if (ssid_nids)
1187 		alc_ssid_check(codec, ssid_nids);
1188 
1189 	err = snd_hda_gen_parse_auto_config(codec, cfg);
1190 	if (err < 0)
1191 		return err;
1192 
1193 	return 1;
1194 }
1195 
1196 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1197 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1198 {
1199 	struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1200 	int err;
1201 
1202 	if (!spec)
1203 		return -ENOMEM;
1204 	codec->spec = spec;
1205 	snd_hda_gen_spec_init(&spec->gen);
1206 	spec->gen.mixer_nid = mixer_nid;
1207 	spec->gen.own_eapd_ctl = 1;
1208 	codec->single_adc_amp = 1;
1209 	/* FIXME: do we need this for all Realtek codec models? */
1210 	codec->spdif_status_reset = 1;
1211 	codec->forced_resume = 1;
1212 	codec->patch_ops = alc_patch_ops;
1213 	mutex_init(&spec->coef_mutex);
1214 
1215 	err = alc_codec_rename_from_preset(codec);
1216 	if (err < 0) {
1217 		kfree(spec);
1218 		return err;
1219 	}
1220 	return 0;
1221 }
1222 
alc880_parse_auto_config(struct hda_codec * codec)1223 static int alc880_parse_auto_config(struct hda_codec *codec)
1224 {
1225 	static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1226 	static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1227 	return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1228 }
1229 
1230 /*
1231  * ALC880 fix-ups
1232  */
1233 enum {
1234 	ALC880_FIXUP_GPIO1,
1235 	ALC880_FIXUP_GPIO2,
1236 	ALC880_FIXUP_MEDION_RIM,
1237 	ALC880_FIXUP_LG,
1238 	ALC880_FIXUP_LG_LW25,
1239 	ALC880_FIXUP_W810,
1240 	ALC880_FIXUP_EAPD_COEF,
1241 	ALC880_FIXUP_TCL_S700,
1242 	ALC880_FIXUP_VOL_KNOB,
1243 	ALC880_FIXUP_FUJITSU,
1244 	ALC880_FIXUP_F1734,
1245 	ALC880_FIXUP_UNIWILL,
1246 	ALC880_FIXUP_UNIWILL_DIG,
1247 	ALC880_FIXUP_Z71V,
1248 	ALC880_FIXUP_ASUS_W5A,
1249 	ALC880_FIXUP_3ST_BASE,
1250 	ALC880_FIXUP_3ST,
1251 	ALC880_FIXUP_3ST_DIG,
1252 	ALC880_FIXUP_5ST_BASE,
1253 	ALC880_FIXUP_5ST,
1254 	ALC880_FIXUP_5ST_DIG,
1255 	ALC880_FIXUP_6ST_BASE,
1256 	ALC880_FIXUP_6ST,
1257 	ALC880_FIXUP_6ST_DIG,
1258 	ALC880_FIXUP_6ST_AUTOMUTE,
1259 };
1260 
1261 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1262 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1263 				  const struct hda_fixup *fix, int action)
1264 {
1265 	if (action == HDA_FIXUP_ACT_PROBE)
1266 		snd_hda_jack_detect_enable_callback(codec, 0x21,
1267 						    alc_update_knob_master);
1268 }
1269 
1270 static const struct hda_fixup alc880_fixups[] = {
1271 	[ALC880_FIXUP_GPIO1] = {
1272 		.type = HDA_FIXUP_FUNC,
1273 		.v.func = alc_fixup_gpio1,
1274 	},
1275 	[ALC880_FIXUP_GPIO2] = {
1276 		.type = HDA_FIXUP_FUNC,
1277 		.v.func = alc_fixup_gpio2,
1278 	},
1279 	[ALC880_FIXUP_MEDION_RIM] = {
1280 		.type = HDA_FIXUP_VERBS,
1281 		.v.verbs = (const struct hda_verb[]) {
1282 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1283 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1284 			{ }
1285 		},
1286 		.chained = true,
1287 		.chain_id = ALC880_FIXUP_GPIO2,
1288 	},
1289 	[ALC880_FIXUP_LG] = {
1290 		.type = HDA_FIXUP_PINS,
1291 		.v.pins = (const struct hda_pintbl[]) {
1292 			/* disable bogus unused pins */
1293 			{ 0x16, 0x411111f0 },
1294 			{ 0x18, 0x411111f0 },
1295 			{ 0x1a, 0x411111f0 },
1296 			{ }
1297 		}
1298 	},
1299 	[ALC880_FIXUP_LG_LW25] = {
1300 		.type = HDA_FIXUP_PINS,
1301 		.v.pins = (const struct hda_pintbl[]) {
1302 			{ 0x1a, 0x0181344f }, /* line-in */
1303 			{ 0x1b, 0x0321403f }, /* headphone */
1304 			{ }
1305 		}
1306 	},
1307 	[ALC880_FIXUP_W810] = {
1308 		.type = HDA_FIXUP_PINS,
1309 		.v.pins = (const struct hda_pintbl[]) {
1310 			/* disable bogus unused pins */
1311 			{ 0x17, 0x411111f0 },
1312 			{ }
1313 		},
1314 		.chained = true,
1315 		.chain_id = ALC880_FIXUP_GPIO2,
1316 	},
1317 	[ALC880_FIXUP_EAPD_COEF] = {
1318 		.type = HDA_FIXUP_VERBS,
1319 		.v.verbs = (const struct hda_verb[]) {
1320 			/* change to EAPD mode */
1321 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1322 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1323 			{}
1324 		},
1325 	},
1326 	[ALC880_FIXUP_TCL_S700] = {
1327 		.type = HDA_FIXUP_VERBS,
1328 		.v.verbs = (const struct hda_verb[]) {
1329 			/* change to EAPD mode */
1330 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1331 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3070 },
1332 			{}
1333 		},
1334 		.chained = true,
1335 		.chain_id = ALC880_FIXUP_GPIO2,
1336 	},
1337 	[ALC880_FIXUP_VOL_KNOB] = {
1338 		.type = HDA_FIXUP_FUNC,
1339 		.v.func = alc880_fixup_vol_knob,
1340 	},
1341 	[ALC880_FIXUP_FUJITSU] = {
1342 		/* override all pins as BIOS on old Amilo is broken */
1343 		.type = HDA_FIXUP_PINS,
1344 		.v.pins = (const struct hda_pintbl[]) {
1345 			{ 0x14, 0x0121401f }, /* HP */
1346 			{ 0x15, 0x99030120 }, /* speaker */
1347 			{ 0x16, 0x99030130 }, /* bass speaker */
1348 			{ 0x17, 0x411111f0 }, /* N/A */
1349 			{ 0x18, 0x411111f0 }, /* N/A */
1350 			{ 0x19, 0x01a19950 }, /* mic-in */
1351 			{ 0x1a, 0x411111f0 }, /* N/A */
1352 			{ 0x1b, 0x411111f0 }, /* N/A */
1353 			{ 0x1c, 0x411111f0 }, /* N/A */
1354 			{ 0x1d, 0x411111f0 }, /* N/A */
1355 			{ 0x1e, 0x01454140 }, /* SPDIF out */
1356 			{ }
1357 		},
1358 		.chained = true,
1359 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1360 	},
1361 	[ALC880_FIXUP_F1734] = {
1362 		/* almost compatible with FUJITSU, but no bass and SPDIF */
1363 		.type = HDA_FIXUP_PINS,
1364 		.v.pins = (const struct hda_pintbl[]) {
1365 			{ 0x14, 0x0121401f }, /* HP */
1366 			{ 0x15, 0x99030120 }, /* speaker */
1367 			{ 0x16, 0x411111f0 }, /* N/A */
1368 			{ 0x17, 0x411111f0 }, /* N/A */
1369 			{ 0x18, 0x411111f0 }, /* N/A */
1370 			{ 0x19, 0x01a19950 }, /* mic-in */
1371 			{ 0x1a, 0x411111f0 }, /* N/A */
1372 			{ 0x1b, 0x411111f0 }, /* N/A */
1373 			{ 0x1c, 0x411111f0 }, /* N/A */
1374 			{ 0x1d, 0x411111f0 }, /* N/A */
1375 			{ 0x1e, 0x411111f0 }, /* N/A */
1376 			{ }
1377 		},
1378 		.chained = true,
1379 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1380 	},
1381 	[ALC880_FIXUP_UNIWILL] = {
1382 		/* need to fix HP and speaker pins to be parsed correctly */
1383 		.type = HDA_FIXUP_PINS,
1384 		.v.pins = (const struct hda_pintbl[]) {
1385 			{ 0x14, 0x0121411f }, /* HP */
1386 			{ 0x15, 0x99030120 }, /* speaker */
1387 			{ 0x16, 0x99030130 }, /* bass speaker */
1388 			{ }
1389 		},
1390 	},
1391 	[ALC880_FIXUP_UNIWILL_DIG] = {
1392 		.type = HDA_FIXUP_PINS,
1393 		.v.pins = (const struct hda_pintbl[]) {
1394 			/* disable bogus unused pins */
1395 			{ 0x17, 0x411111f0 },
1396 			{ 0x19, 0x411111f0 },
1397 			{ 0x1b, 0x411111f0 },
1398 			{ 0x1f, 0x411111f0 },
1399 			{ }
1400 		}
1401 	},
1402 	[ALC880_FIXUP_Z71V] = {
1403 		.type = HDA_FIXUP_PINS,
1404 		.v.pins = (const struct hda_pintbl[]) {
1405 			/* set up the whole pins as BIOS is utterly broken */
1406 			{ 0x14, 0x99030120 }, /* speaker */
1407 			{ 0x15, 0x0121411f }, /* HP */
1408 			{ 0x16, 0x411111f0 }, /* N/A */
1409 			{ 0x17, 0x411111f0 }, /* N/A */
1410 			{ 0x18, 0x01a19950 }, /* mic-in */
1411 			{ 0x19, 0x411111f0 }, /* N/A */
1412 			{ 0x1a, 0x01813031 }, /* line-in */
1413 			{ 0x1b, 0x411111f0 }, /* N/A */
1414 			{ 0x1c, 0x411111f0 }, /* N/A */
1415 			{ 0x1d, 0x411111f0 }, /* N/A */
1416 			{ 0x1e, 0x0144111e }, /* SPDIF */
1417 			{ }
1418 		}
1419 	},
1420 	[ALC880_FIXUP_ASUS_W5A] = {
1421 		.type = HDA_FIXUP_PINS,
1422 		.v.pins = (const struct hda_pintbl[]) {
1423 			/* set up the whole pins as BIOS is utterly broken */
1424 			{ 0x14, 0x0121411f }, /* HP */
1425 			{ 0x15, 0x411111f0 }, /* N/A */
1426 			{ 0x16, 0x411111f0 }, /* N/A */
1427 			{ 0x17, 0x411111f0 }, /* N/A */
1428 			{ 0x18, 0x90a60160 }, /* mic */
1429 			{ 0x19, 0x411111f0 }, /* N/A */
1430 			{ 0x1a, 0x411111f0 }, /* N/A */
1431 			{ 0x1b, 0x411111f0 }, /* N/A */
1432 			{ 0x1c, 0x411111f0 }, /* N/A */
1433 			{ 0x1d, 0x411111f0 }, /* N/A */
1434 			{ 0x1e, 0xb743111e }, /* SPDIF out */
1435 			{ }
1436 		},
1437 		.chained = true,
1438 		.chain_id = ALC880_FIXUP_GPIO1,
1439 	},
1440 	[ALC880_FIXUP_3ST_BASE] = {
1441 		.type = HDA_FIXUP_PINS,
1442 		.v.pins = (const struct hda_pintbl[]) {
1443 			{ 0x14, 0x01014010 }, /* line-out */
1444 			{ 0x15, 0x411111f0 }, /* N/A */
1445 			{ 0x16, 0x411111f0 }, /* N/A */
1446 			{ 0x17, 0x411111f0 }, /* N/A */
1447 			{ 0x18, 0x01a19c30 }, /* mic-in */
1448 			{ 0x19, 0x0121411f }, /* HP */
1449 			{ 0x1a, 0x01813031 }, /* line-in */
1450 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1451 			{ 0x1c, 0x411111f0 }, /* N/A */
1452 			{ 0x1d, 0x411111f0 }, /* N/A */
1453 			/* 0x1e is filled in below */
1454 			{ 0x1f, 0x411111f0 }, /* N/A */
1455 			{ }
1456 		}
1457 	},
1458 	[ALC880_FIXUP_3ST] = {
1459 		.type = HDA_FIXUP_PINS,
1460 		.v.pins = (const struct hda_pintbl[]) {
1461 			{ 0x1e, 0x411111f0 }, /* N/A */
1462 			{ }
1463 		},
1464 		.chained = true,
1465 		.chain_id = ALC880_FIXUP_3ST_BASE,
1466 	},
1467 	[ALC880_FIXUP_3ST_DIG] = {
1468 		.type = HDA_FIXUP_PINS,
1469 		.v.pins = (const struct hda_pintbl[]) {
1470 			{ 0x1e, 0x0144111e }, /* SPDIF */
1471 			{ }
1472 		},
1473 		.chained = true,
1474 		.chain_id = ALC880_FIXUP_3ST_BASE,
1475 	},
1476 	[ALC880_FIXUP_5ST_BASE] = {
1477 		.type = HDA_FIXUP_PINS,
1478 		.v.pins = (const struct hda_pintbl[]) {
1479 			{ 0x14, 0x01014010 }, /* front */
1480 			{ 0x15, 0x411111f0 }, /* N/A */
1481 			{ 0x16, 0x01011411 }, /* CLFE */
1482 			{ 0x17, 0x01016412 }, /* surr */
1483 			{ 0x18, 0x01a19c30 }, /* mic-in */
1484 			{ 0x19, 0x0121411f }, /* HP */
1485 			{ 0x1a, 0x01813031 }, /* line-in */
1486 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1487 			{ 0x1c, 0x411111f0 }, /* N/A */
1488 			{ 0x1d, 0x411111f0 }, /* N/A */
1489 			/* 0x1e is filled in below */
1490 			{ 0x1f, 0x411111f0 }, /* N/A */
1491 			{ }
1492 		}
1493 	},
1494 	[ALC880_FIXUP_5ST] = {
1495 		.type = HDA_FIXUP_PINS,
1496 		.v.pins = (const struct hda_pintbl[]) {
1497 			{ 0x1e, 0x411111f0 }, /* N/A */
1498 			{ }
1499 		},
1500 		.chained = true,
1501 		.chain_id = ALC880_FIXUP_5ST_BASE,
1502 	},
1503 	[ALC880_FIXUP_5ST_DIG] = {
1504 		.type = HDA_FIXUP_PINS,
1505 		.v.pins = (const struct hda_pintbl[]) {
1506 			{ 0x1e, 0x0144111e }, /* SPDIF */
1507 			{ }
1508 		},
1509 		.chained = true,
1510 		.chain_id = ALC880_FIXUP_5ST_BASE,
1511 	},
1512 	[ALC880_FIXUP_6ST_BASE] = {
1513 		.type = HDA_FIXUP_PINS,
1514 		.v.pins = (const struct hda_pintbl[]) {
1515 			{ 0x14, 0x01014010 }, /* front */
1516 			{ 0x15, 0x01016412 }, /* surr */
1517 			{ 0x16, 0x01011411 }, /* CLFE */
1518 			{ 0x17, 0x01012414 }, /* side */
1519 			{ 0x18, 0x01a19c30 }, /* mic-in */
1520 			{ 0x19, 0x02a19c40 }, /* front-mic */
1521 			{ 0x1a, 0x01813031 }, /* line-in */
1522 			{ 0x1b, 0x0121411f }, /* HP */
1523 			{ 0x1c, 0x411111f0 }, /* N/A */
1524 			{ 0x1d, 0x411111f0 }, /* N/A */
1525 			/* 0x1e is filled in below */
1526 			{ 0x1f, 0x411111f0 }, /* N/A */
1527 			{ }
1528 		}
1529 	},
1530 	[ALC880_FIXUP_6ST] = {
1531 		.type = HDA_FIXUP_PINS,
1532 		.v.pins = (const struct hda_pintbl[]) {
1533 			{ 0x1e, 0x411111f0 }, /* N/A */
1534 			{ }
1535 		},
1536 		.chained = true,
1537 		.chain_id = ALC880_FIXUP_6ST_BASE,
1538 	},
1539 	[ALC880_FIXUP_6ST_DIG] = {
1540 		.type = HDA_FIXUP_PINS,
1541 		.v.pins = (const struct hda_pintbl[]) {
1542 			{ 0x1e, 0x0144111e }, /* SPDIF */
1543 			{ }
1544 		},
1545 		.chained = true,
1546 		.chain_id = ALC880_FIXUP_6ST_BASE,
1547 	},
1548 	[ALC880_FIXUP_6ST_AUTOMUTE] = {
1549 		.type = HDA_FIXUP_PINS,
1550 		.v.pins = (const struct hda_pintbl[]) {
1551 			{ 0x1b, 0x0121401f }, /* HP with jack detect */
1552 			{ }
1553 		},
1554 		.chained_before = true,
1555 		.chain_id = ALC880_FIXUP_6ST_BASE,
1556 	},
1557 };
1558 
1559 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1560 	SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1561 	SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1562 	SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1563 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1564 	SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1565 	SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1566 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1567 	SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1568 	SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1569 	SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1570 	SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1571 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1572 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1573 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1574 	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1575 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1576 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1577 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1578 	SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1579 	SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1580 	SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1581 	SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1582 	SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1583 
1584 	/* Below is the copied entries from alc880_quirks.c.
1585 	 * It's not quite sure whether BIOS sets the correct pin-config table
1586 	 * on these machines, thus they are kept to be compatible with
1587 	 * the old static quirks.  Once when it's confirmed to work without
1588 	 * these overrides, it'd be better to remove.
1589 	 */
1590 	SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1591 	SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1592 	SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1593 	SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1594 	SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1595 	SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1596 	SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1597 	SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1598 	SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1599 	SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1600 	SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1601 	SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1602 	SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1603 	SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1604 	SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1605 	SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1606 	SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1607 	SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1608 	SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1609 	SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1610 	SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1611 	SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1612 	SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1613 	SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1614 	SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1615 	SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1616 	SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1617 	SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1618 	SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1619 	SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1620 	SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1621 	SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1622 	SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1623 	/* default Intel */
1624 	SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1625 	SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1626 	SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1627 	{}
1628 };
1629 
1630 static const struct hda_model_fixup alc880_fixup_models[] = {
1631 	{.id = ALC880_FIXUP_3ST, .name = "3stack"},
1632 	{.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1633 	{.id = ALC880_FIXUP_5ST, .name = "5stack"},
1634 	{.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1635 	{.id = ALC880_FIXUP_6ST, .name = "6stack"},
1636 	{.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1637 	{.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1638 	{}
1639 };
1640 
1641 
1642 /*
1643  * OK, here we have finally the patch for ALC880
1644  */
patch_alc880(struct hda_codec * codec)1645 static int patch_alc880(struct hda_codec *codec)
1646 {
1647 	struct alc_spec *spec;
1648 	int err;
1649 
1650 	err = alc_alloc_spec(codec, 0x0b);
1651 	if (err < 0)
1652 		return err;
1653 
1654 	spec = codec->spec;
1655 	spec->gen.need_dac_fix = 1;
1656 	spec->gen.beep_nid = 0x01;
1657 
1658 	codec->patch_ops.unsol_event = alc880_unsol_event;
1659 
1660 	alc_pre_init(codec);
1661 
1662 	snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1663 		       alc880_fixups);
1664 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1665 
1666 	/* automatic parse from the BIOS config */
1667 	err = alc880_parse_auto_config(codec);
1668 	if (err < 0)
1669 		goto error;
1670 
1671 	if (!spec->gen.no_analog) {
1672 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1673 		if (err < 0)
1674 			goto error;
1675 	}
1676 
1677 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1678 
1679 	return 0;
1680 
1681  error:
1682 	alc_free(codec);
1683 	return err;
1684 }
1685 
1686 
1687 /*
1688  * ALC260 support
1689  */
alc260_parse_auto_config(struct hda_codec * codec)1690 static int alc260_parse_auto_config(struct hda_codec *codec)
1691 {
1692 	static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1693 	static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1694 	return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1695 }
1696 
1697 /*
1698  * Pin config fixes
1699  */
1700 enum {
1701 	ALC260_FIXUP_HP_DC5750,
1702 	ALC260_FIXUP_HP_PIN_0F,
1703 	ALC260_FIXUP_COEF,
1704 	ALC260_FIXUP_GPIO1,
1705 	ALC260_FIXUP_GPIO1_TOGGLE,
1706 	ALC260_FIXUP_REPLACER,
1707 	ALC260_FIXUP_HP_B1900,
1708 	ALC260_FIXUP_KN1,
1709 	ALC260_FIXUP_FSC_S7020,
1710 	ALC260_FIXUP_FSC_S7020_JWSE,
1711 	ALC260_FIXUP_VAIO_PINS,
1712 };
1713 
alc260_gpio1_automute(struct hda_codec * codec)1714 static void alc260_gpio1_automute(struct hda_codec *codec)
1715 {
1716 	struct alc_spec *spec = codec->spec;
1717 
1718 	alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1719 }
1720 
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1721 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1722 				      const struct hda_fixup *fix, int action)
1723 {
1724 	struct alc_spec *spec = codec->spec;
1725 	if (action == HDA_FIXUP_ACT_PROBE) {
1726 		/* although the machine has only one output pin, we need to
1727 		 * toggle GPIO1 according to the jack state
1728 		 */
1729 		spec->gen.automute_hook = alc260_gpio1_automute;
1730 		spec->gen.detect_hp = 1;
1731 		spec->gen.automute_speaker = 1;
1732 		spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1733 		snd_hda_jack_detect_enable_callback(codec, 0x0f,
1734 						    snd_hda_gen_hp_automute);
1735 		alc_setup_gpio(codec, 0x01);
1736 	}
1737 }
1738 
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1739 static void alc260_fixup_kn1(struct hda_codec *codec,
1740 			     const struct hda_fixup *fix, int action)
1741 {
1742 	struct alc_spec *spec = codec->spec;
1743 	static const struct hda_pintbl pincfgs[] = {
1744 		{ 0x0f, 0x02214000 }, /* HP/speaker */
1745 		{ 0x12, 0x90a60160 }, /* int mic */
1746 		{ 0x13, 0x02a19000 }, /* ext mic */
1747 		{ 0x18, 0x01446000 }, /* SPDIF out */
1748 		/* disable bogus I/O pins */
1749 		{ 0x10, 0x411111f0 },
1750 		{ 0x11, 0x411111f0 },
1751 		{ 0x14, 0x411111f0 },
1752 		{ 0x15, 0x411111f0 },
1753 		{ 0x16, 0x411111f0 },
1754 		{ 0x17, 0x411111f0 },
1755 		{ 0x19, 0x411111f0 },
1756 		{ }
1757 	};
1758 
1759 	switch (action) {
1760 	case HDA_FIXUP_ACT_PRE_PROBE:
1761 		snd_hda_apply_pincfgs(codec, pincfgs);
1762 		spec->init_amp = ALC_INIT_NONE;
1763 		break;
1764 	}
1765 }
1766 
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1767 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1768 				   const struct hda_fixup *fix, int action)
1769 {
1770 	struct alc_spec *spec = codec->spec;
1771 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
1772 		spec->init_amp = ALC_INIT_NONE;
1773 }
1774 
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1775 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1776 				   const struct hda_fixup *fix, int action)
1777 {
1778 	struct alc_spec *spec = codec->spec;
1779 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1780 		spec->gen.add_jack_modes = 1;
1781 		spec->gen.hp_mic = 1;
1782 	}
1783 }
1784 
1785 static const struct hda_fixup alc260_fixups[] = {
1786 	[ALC260_FIXUP_HP_DC5750] = {
1787 		.type = HDA_FIXUP_PINS,
1788 		.v.pins = (const struct hda_pintbl[]) {
1789 			{ 0x11, 0x90130110 }, /* speaker */
1790 			{ }
1791 		}
1792 	},
1793 	[ALC260_FIXUP_HP_PIN_0F] = {
1794 		.type = HDA_FIXUP_PINS,
1795 		.v.pins = (const struct hda_pintbl[]) {
1796 			{ 0x0f, 0x01214000 }, /* HP */
1797 			{ }
1798 		}
1799 	},
1800 	[ALC260_FIXUP_COEF] = {
1801 		.type = HDA_FIXUP_VERBS,
1802 		.v.verbs = (const struct hda_verb[]) {
1803 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1804 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3040 },
1805 			{ }
1806 		},
1807 	},
1808 	[ALC260_FIXUP_GPIO1] = {
1809 		.type = HDA_FIXUP_FUNC,
1810 		.v.func = alc_fixup_gpio1,
1811 	},
1812 	[ALC260_FIXUP_GPIO1_TOGGLE] = {
1813 		.type = HDA_FIXUP_FUNC,
1814 		.v.func = alc260_fixup_gpio1_toggle,
1815 		.chained = true,
1816 		.chain_id = ALC260_FIXUP_HP_PIN_0F,
1817 	},
1818 	[ALC260_FIXUP_REPLACER] = {
1819 		.type = HDA_FIXUP_VERBS,
1820 		.v.verbs = (const struct hda_verb[]) {
1821 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1822 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3050 },
1823 			{ }
1824 		},
1825 		.chained = true,
1826 		.chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1827 	},
1828 	[ALC260_FIXUP_HP_B1900] = {
1829 		.type = HDA_FIXUP_FUNC,
1830 		.v.func = alc260_fixup_gpio1_toggle,
1831 		.chained = true,
1832 		.chain_id = ALC260_FIXUP_COEF,
1833 	},
1834 	[ALC260_FIXUP_KN1] = {
1835 		.type = HDA_FIXUP_FUNC,
1836 		.v.func = alc260_fixup_kn1,
1837 	},
1838 	[ALC260_FIXUP_FSC_S7020] = {
1839 		.type = HDA_FIXUP_FUNC,
1840 		.v.func = alc260_fixup_fsc_s7020,
1841 	},
1842 	[ALC260_FIXUP_FSC_S7020_JWSE] = {
1843 		.type = HDA_FIXUP_FUNC,
1844 		.v.func = alc260_fixup_fsc_s7020_jwse,
1845 		.chained = true,
1846 		.chain_id = ALC260_FIXUP_FSC_S7020,
1847 	},
1848 	[ALC260_FIXUP_VAIO_PINS] = {
1849 		.type = HDA_FIXUP_PINS,
1850 		.v.pins = (const struct hda_pintbl[]) {
1851 			/* Pin configs are missing completely on some VAIOs */
1852 			{ 0x0f, 0x01211020 },
1853 			{ 0x10, 0x0001003f },
1854 			{ 0x11, 0x411111f0 },
1855 			{ 0x12, 0x01a15930 },
1856 			{ 0x13, 0x411111f0 },
1857 			{ 0x14, 0x411111f0 },
1858 			{ 0x15, 0x411111f0 },
1859 			{ 0x16, 0x411111f0 },
1860 			{ 0x17, 0x411111f0 },
1861 			{ 0x18, 0x411111f0 },
1862 			{ 0x19, 0x411111f0 },
1863 			{ }
1864 		}
1865 	},
1866 };
1867 
1868 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1869 	SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1870 	SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1871 	SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1872 	SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1873 	SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1874 	SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1875 	SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1876 	SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1877 	SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1878 	SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1879 	SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1880 	SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1881 	{}
1882 };
1883 
1884 static const struct hda_model_fixup alc260_fixup_models[] = {
1885 	{.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1886 	{.id = ALC260_FIXUP_COEF, .name = "coef"},
1887 	{.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1888 	{.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1889 	{}
1890 };
1891 
1892 /*
1893  */
patch_alc260(struct hda_codec * codec)1894 static int patch_alc260(struct hda_codec *codec)
1895 {
1896 	struct alc_spec *spec;
1897 	int err;
1898 
1899 	err = alc_alloc_spec(codec, 0x07);
1900 	if (err < 0)
1901 		return err;
1902 
1903 	spec = codec->spec;
1904 	/* as quite a few machines require HP amp for speaker outputs,
1905 	 * it's easier to enable it unconditionally; even if it's unneeded,
1906 	 * it's almost harmless.
1907 	 */
1908 	spec->gen.prefer_hp_amp = 1;
1909 	spec->gen.beep_nid = 0x01;
1910 
1911 	spec->shutup = alc_eapd_shutup;
1912 
1913 	alc_pre_init(codec);
1914 
1915 	snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1916 			   alc260_fixups);
1917 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1918 
1919 	/* automatic parse from the BIOS config */
1920 	err = alc260_parse_auto_config(codec);
1921 	if (err < 0)
1922 		goto error;
1923 
1924 	if (!spec->gen.no_analog) {
1925 		err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1926 		if (err < 0)
1927 			goto error;
1928 	}
1929 
1930 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1931 
1932 	return 0;
1933 
1934  error:
1935 	alc_free(codec);
1936 	return err;
1937 }
1938 
1939 
1940 /*
1941  * ALC882/883/885/888/889 support
1942  *
1943  * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1944  * configuration.  Each pin widget can choose any input DACs and a mixer.
1945  * Each ADC is connected from a mixer of all inputs.  This makes possible
1946  * 6-channel independent captures.
1947  *
1948  * In addition, an independent DAC for the multi-playback (not used in this
1949  * driver yet).
1950  */
1951 
1952 /*
1953  * Pin config fixes
1954  */
1955 enum {
1956 	ALC882_FIXUP_ABIT_AW9D_MAX,
1957 	ALC882_FIXUP_LENOVO_Y530,
1958 	ALC882_FIXUP_PB_M5210,
1959 	ALC882_FIXUP_ACER_ASPIRE_7736,
1960 	ALC882_FIXUP_ASUS_W90V,
1961 	ALC889_FIXUP_CD,
1962 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1963 	ALC889_FIXUP_VAIO_TT,
1964 	ALC888_FIXUP_EEE1601,
1965 	ALC886_FIXUP_EAPD,
1966 	ALC882_FIXUP_EAPD,
1967 	ALC883_FIXUP_EAPD,
1968 	ALC883_FIXUP_ACER_EAPD,
1969 	ALC882_FIXUP_GPIO1,
1970 	ALC882_FIXUP_GPIO2,
1971 	ALC882_FIXUP_GPIO3,
1972 	ALC889_FIXUP_COEF,
1973 	ALC882_FIXUP_ASUS_W2JC,
1974 	ALC882_FIXUP_ACER_ASPIRE_4930G,
1975 	ALC882_FIXUP_ACER_ASPIRE_8930G,
1976 	ALC882_FIXUP_ASPIRE_8930G_VERBS,
1977 	ALC885_FIXUP_MACPRO_GPIO,
1978 	ALC889_FIXUP_DAC_ROUTE,
1979 	ALC889_FIXUP_MBP_VREF,
1980 	ALC889_FIXUP_IMAC91_VREF,
1981 	ALC889_FIXUP_MBA11_VREF,
1982 	ALC889_FIXUP_MBA21_VREF,
1983 	ALC889_FIXUP_MP11_VREF,
1984 	ALC889_FIXUP_MP41_VREF,
1985 	ALC882_FIXUP_INV_DMIC,
1986 	ALC882_FIXUP_NO_PRIMARY_HP,
1987 	ALC887_FIXUP_ASUS_BASS,
1988 	ALC887_FIXUP_BASS_CHMAP,
1989 	ALC1220_FIXUP_GB_DUAL_CODECS,
1990 	ALC1220_FIXUP_GB_X570,
1991 	ALC1220_FIXUP_CLEVO_P950,
1992 	ALC1220_FIXUP_CLEVO_PB51ED,
1993 	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1994 	ALC887_FIXUP_ASUS_AUDIO,
1995 	ALC887_FIXUP_ASUS_HMIC,
1996 	ALCS1200A_FIXUP_MIC_VREF,
1997 	ALC888VD_FIXUP_MIC_100VREF,
1998 };
1999 
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)2000 static void alc889_fixup_coef(struct hda_codec *codec,
2001 			      const struct hda_fixup *fix, int action)
2002 {
2003 	if (action != HDA_FIXUP_ACT_INIT)
2004 		return;
2005 	alc_update_coef_idx(codec, 7, 0, 0x2030);
2006 }
2007 
2008 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2009 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2010 				     const struct hda_fixup *fix, int action)
2011 {
2012 	struct alc_spec *spec = codec->spec;
2013 
2014 	spec->gpio_write_delay = true;
2015 	alc_fixup_gpio3(codec, fix, action);
2016 }
2017 
2018 /* Fix the connection of some pins for ALC889:
2019  * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2020  * work correctly (bko#42740)
2021  */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2022 static void alc889_fixup_dac_route(struct hda_codec *codec,
2023 				   const struct hda_fixup *fix, int action)
2024 {
2025 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2026 		/* fake the connections during parsing the tree */
2027 		static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2028 		static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2029 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2030 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2031 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2032 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2033 	} else if (action == HDA_FIXUP_ACT_PROBE) {
2034 		/* restore the connections */
2035 		static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2036 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2037 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2038 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2039 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2040 	}
2041 }
2042 
2043 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2044 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2045 				  const struct hda_fixup *fix, int action)
2046 {
2047 	static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2048 	struct alc_spec *spec = codec->spec;
2049 	int i;
2050 
2051 	if (action != HDA_FIXUP_ACT_INIT)
2052 		return;
2053 	for (i = 0; i < ARRAY_SIZE(nids); i++) {
2054 		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2055 		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2056 			continue;
2057 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2058 		val |= AC_PINCTL_VREF_80;
2059 		snd_hda_set_pin_ctl(codec, nids[i], val);
2060 		spec->gen.keep_vref_in_automute = 1;
2061 		break;
2062 	}
2063 }
2064 
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2065 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2066 				  const hda_nid_t *nids, int num_nids)
2067 {
2068 	struct alc_spec *spec = codec->spec;
2069 	int i;
2070 
2071 	for (i = 0; i < num_nids; i++) {
2072 		unsigned int val;
2073 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2074 		val |= AC_PINCTL_VREF_50;
2075 		snd_hda_set_pin_ctl(codec, nids[i], val);
2076 	}
2077 	spec->gen.keep_vref_in_automute = 1;
2078 }
2079 
2080 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2081 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2082 				     const struct hda_fixup *fix, int action)
2083 {
2084 	static const hda_nid_t nids[] = { 0x18, 0x1a };
2085 
2086 	if (action == HDA_FIXUP_ACT_INIT)
2087 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2088 }
2089 
2090 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2091 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2092 				    const struct hda_fixup *fix, int action)
2093 {
2094 	static const hda_nid_t nids[] = { 0x18 };
2095 
2096 	if (action == HDA_FIXUP_ACT_INIT)
2097 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2098 }
2099 
2100 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2101 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2102 				    const struct hda_fixup *fix, int action)
2103 {
2104 	static const hda_nid_t nids[] = { 0x18, 0x19 };
2105 
2106 	if (action == HDA_FIXUP_ACT_INIT)
2107 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2108 }
2109 
2110 /* Don't take HP output as primary
2111  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2112  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2113  */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2114 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2115 				       const struct hda_fixup *fix, int action)
2116 {
2117 	struct alc_spec *spec = codec->spec;
2118 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2119 		spec->gen.no_primary_hp = 1;
2120 		spec->gen.no_multi_io = 1;
2121 	}
2122 }
2123 
2124 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2125 				 const struct hda_fixup *fix, int action);
2126 
2127 /* For dual-codec configuration, we need to disable some features to avoid
2128  * conflicts of kctls and PCM streams
2129  */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2130 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2131 				  const struct hda_fixup *fix, int action)
2132 {
2133 	struct alc_spec *spec = codec->spec;
2134 
2135 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2136 		return;
2137 	/* disable vmaster */
2138 	spec->gen.suppress_vmaster = 1;
2139 	/* auto-mute and auto-mic switch don't work with multiple codecs */
2140 	spec->gen.suppress_auto_mute = 1;
2141 	spec->gen.suppress_auto_mic = 1;
2142 	/* disable aamix as well */
2143 	spec->gen.mixer_nid = 0;
2144 	/* add location prefix to avoid conflicts */
2145 	codec->force_pin_prefix = 1;
2146 }
2147 
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2148 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2149 		       const char *newname)
2150 {
2151 	struct snd_kcontrol *kctl;
2152 
2153 	kctl = snd_hda_find_mixer_ctl(codec, oldname);
2154 	if (kctl)
2155 		strcpy(kctl->id.name, newname);
2156 }
2157 
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2158 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2159 					 const struct hda_fixup *fix,
2160 					 int action)
2161 {
2162 	alc_fixup_dual_codecs(codec, fix, action);
2163 	switch (action) {
2164 	case HDA_FIXUP_ACT_PRE_PROBE:
2165 		/* override card longname to provide a unique UCM profile */
2166 		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2167 		break;
2168 	case HDA_FIXUP_ACT_BUILD:
2169 		/* rename Capture controls depending on the codec */
2170 		rename_ctl(codec, "Capture Volume",
2171 			   codec->addr == 0 ?
2172 			   "Rear-Panel Capture Volume" :
2173 			   "Front-Panel Capture Volume");
2174 		rename_ctl(codec, "Capture Switch",
2175 			   codec->addr == 0 ?
2176 			   "Rear-Panel Capture Switch" :
2177 			   "Front-Panel Capture Switch");
2178 		break;
2179 	}
2180 }
2181 
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2182 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2183 				     const struct hda_fixup *fix,
2184 				     int action)
2185 {
2186 	static const hda_nid_t conn1[] = { 0x0c };
2187 	static const struct coef_fw gb_x570_coefs[] = {
2188 		WRITE_COEF(0x07, 0x03c0),
2189 		WRITE_COEF(0x1a, 0x01c1),
2190 		WRITE_COEF(0x1b, 0x0202),
2191 		WRITE_COEF(0x43, 0x3005),
2192 		{}
2193 	};
2194 
2195 	switch (action) {
2196 	case HDA_FIXUP_ACT_PRE_PROBE:
2197 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2198 		snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2199 		break;
2200 	case HDA_FIXUP_ACT_INIT:
2201 		alc_process_coef_fw(codec, gb_x570_coefs);
2202 		break;
2203 	}
2204 }
2205 
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2206 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2207 				     const struct hda_fixup *fix,
2208 				     int action)
2209 {
2210 	static const hda_nid_t conn1[] = { 0x0c };
2211 
2212 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2213 		return;
2214 
2215 	alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2216 	/* We therefore want to make sure 0x14 (front headphone) and
2217 	 * 0x1b (speakers) use the stereo DAC 0x02
2218 	 */
2219 	snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2220 	snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2221 }
2222 
2223 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2224 				const struct hda_fixup *fix, int action);
2225 
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2226 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2227 				     const struct hda_fixup *fix,
2228 				     int action)
2229 {
2230 	alc1220_fixup_clevo_p950(codec, fix, action);
2231 	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2232 }
2233 
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2234 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2235 					 struct hda_jack_callback *jack)
2236 {
2237 	struct alc_spec *spec = codec->spec;
2238 	unsigned int vref;
2239 
2240 	snd_hda_gen_hp_automute(codec, jack);
2241 
2242 	if (spec->gen.hp_jack_present)
2243 		vref = AC_PINCTL_VREF_80;
2244 	else
2245 		vref = AC_PINCTL_VREF_HIZ;
2246 	snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2247 }
2248 
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2249 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2250 				     const struct hda_fixup *fix, int action)
2251 {
2252 	struct alc_spec *spec = codec->spec;
2253 	if (action != HDA_FIXUP_ACT_PROBE)
2254 		return;
2255 	snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2256 	spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2257 }
2258 
2259 static const struct hda_fixup alc882_fixups[] = {
2260 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
2261 		.type = HDA_FIXUP_PINS,
2262 		.v.pins = (const struct hda_pintbl[]) {
2263 			{ 0x15, 0x01080104 }, /* side */
2264 			{ 0x16, 0x01011012 }, /* rear */
2265 			{ 0x17, 0x01016011 }, /* clfe */
2266 			{ }
2267 		}
2268 	},
2269 	[ALC882_FIXUP_LENOVO_Y530] = {
2270 		.type = HDA_FIXUP_PINS,
2271 		.v.pins = (const struct hda_pintbl[]) {
2272 			{ 0x15, 0x99130112 }, /* rear int speakers */
2273 			{ 0x16, 0x99130111 }, /* subwoofer */
2274 			{ }
2275 		}
2276 	},
2277 	[ALC882_FIXUP_PB_M5210] = {
2278 		.type = HDA_FIXUP_PINCTLS,
2279 		.v.pins = (const struct hda_pintbl[]) {
2280 			{ 0x19, PIN_VREF50 },
2281 			{}
2282 		}
2283 	},
2284 	[ALC882_FIXUP_ACER_ASPIRE_7736] = {
2285 		.type = HDA_FIXUP_FUNC,
2286 		.v.func = alc_fixup_sku_ignore,
2287 	},
2288 	[ALC882_FIXUP_ASUS_W90V] = {
2289 		.type = HDA_FIXUP_PINS,
2290 		.v.pins = (const struct hda_pintbl[]) {
2291 			{ 0x16, 0x99130110 }, /* fix sequence for CLFE */
2292 			{ }
2293 		}
2294 	},
2295 	[ALC889_FIXUP_CD] = {
2296 		.type = HDA_FIXUP_PINS,
2297 		.v.pins = (const struct hda_pintbl[]) {
2298 			{ 0x1c, 0x993301f0 }, /* CD */
2299 			{ }
2300 		}
2301 	},
2302 	[ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2303 		.type = HDA_FIXUP_PINS,
2304 		.v.pins = (const struct hda_pintbl[]) {
2305 			{ 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2306 			{ }
2307 		},
2308 		.chained = true,
2309 		.chain_id = ALC889_FIXUP_CD,
2310 	},
2311 	[ALC889_FIXUP_VAIO_TT] = {
2312 		.type = HDA_FIXUP_PINS,
2313 		.v.pins = (const struct hda_pintbl[]) {
2314 			{ 0x17, 0x90170111 }, /* hidden surround speaker */
2315 			{ }
2316 		}
2317 	},
2318 	[ALC888_FIXUP_EEE1601] = {
2319 		.type = HDA_FIXUP_VERBS,
2320 		.v.verbs = (const struct hda_verb[]) {
2321 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2322 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x0838 },
2323 			{ }
2324 		}
2325 	},
2326 	[ALC886_FIXUP_EAPD] = {
2327 		.type = HDA_FIXUP_VERBS,
2328 		.v.verbs = (const struct hda_verb[]) {
2329 			/* change to EAPD mode */
2330 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2331 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2332 			{ }
2333 		}
2334 	},
2335 	[ALC882_FIXUP_EAPD] = {
2336 		.type = HDA_FIXUP_VERBS,
2337 		.v.verbs = (const struct hda_verb[]) {
2338 			/* change to EAPD mode */
2339 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2340 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2341 			{ }
2342 		}
2343 	},
2344 	[ALC883_FIXUP_EAPD] = {
2345 		.type = HDA_FIXUP_VERBS,
2346 		.v.verbs = (const struct hda_verb[]) {
2347 			/* change to EAPD mode */
2348 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2349 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2350 			{ }
2351 		}
2352 	},
2353 	[ALC883_FIXUP_ACER_EAPD] = {
2354 		.type = HDA_FIXUP_VERBS,
2355 		.v.verbs = (const struct hda_verb[]) {
2356 			/* eanable EAPD on Acer laptops */
2357 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2358 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2359 			{ }
2360 		}
2361 	},
2362 	[ALC882_FIXUP_GPIO1] = {
2363 		.type = HDA_FIXUP_FUNC,
2364 		.v.func = alc_fixup_gpio1,
2365 	},
2366 	[ALC882_FIXUP_GPIO2] = {
2367 		.type = HDA_FIXUP_FUNC,
2368 		.v.func = alc_fixup_gpio2,
2369 	},
2370 	[ALC882_FIXUP_GPIO3] = {
2371 		.type = HDA_FIXUP_FUNC,
2372 		.v.func = alc_fixup_gpio3,
2373 	},
2374 	[ALC882_FIXUP_ASUS_W2JC] = {
2375 		.type = HDA_FIXUP_FUNC,
2376 		.v.func = alc_fixup_gpio1,
2377 		.chained = true,
2378 		.chain_id = ALC882_FIXUP_EAPD,
2379 	},
2380 	[ALC889_FIXUP_COEF] = {
2381 		.type = HDA_FIXUP_FUNC,
2382 		.v.func = alc889_fixup_coef,
2383 	},
2384 	[ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2385 		.type = HDA_FIXUP_PINS,
2386 		.v.pins = (const struct hda_pintbl[]) {
2387 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2388 			{ 0x17, 0x99130112 }, /* surround speaker */
2389 			{ }
2390 		},
2391 		.chained = true,
2392 		.chain_id = ALC882_FIXUP_GPIO1,
2393 	},
2394 	[ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2395 		.type = HDA_FIXUP_PINS,
2396 		.v.pins = (const struct hda_pintbl[]) {
2397 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2398 			{ 0x1b, 0x99130112 }, /* surround speaker */
2399 			{ }
2400 		},
2401 		.chained = true,
2402 		.chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2403 	},
2404 	[ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2405 		/* additional init verbs for Acer Aspire 8930G */
2406 		.type = HDA_FIXUP_VERBS,
2407 		.v.verbs = (const struct hda_verb[]) {
2408 			/* Enable all DACs */
2409 			/* DAC DISABLE/MUTE 1? */
2410 			/*  setting bits 1-5 disables DAC nids 0x02-0x06
2411 			 *  apparently. Init=0x38 */
2412 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2413 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2414 			/* DAC DISABLE/MUTE 2? */
2415 			/*  some bit here disables the other DACs.
2416 			 *  Init=0x4900 */
2417 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2418 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2419 			/* DMIC fix
2420 			 * This laptop has a stereo digital microphone.
2421 			 * The mics are only 1cm apart which makes the stereo
2422 			 * useless. However, either the mic or the ALC889
2423 			 * makes the signal become a difference/sum signal
2424 			 * instead of standard stereo, which is annoying.
2425 			 * So instead we flip this bit which makes the
2426 			 * codec replicate the sum signal to both channels,
2427 			 * turning it into a normal mono mic.
2428 			 */
2429 			/* DMIC_CONTROL? Init value = 0x0001 */
2430 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2431 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2432 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2433 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2434 			{ }
2435 		},
2436 		.chained = true,
2437 		.chain_id = ALC882_FIXUP_GPIO1,
2438 	},
2439 	[ALC885_FIXUP_MACPRO_GPIO] = {
2440 		.type = HDA_FIXUP_FUNC,
2441 		.v.func = alc885_fixup_macpro_gpio,
2442 	},
2443 	[ALC889_FIXUP_DAC_ROUTE] = {
2444 		.type = HDA_FIXUP_FUNC,
2445 		.v.func = alc889_fixup_dac_route,
2446 	},
2447 	[ALC889_FIXUP_MBP_VREF] = {
2448 		.type = HDA_FIXUP_FUNC,
2449 		.v.func = alc889_fixup_mbp_vref,
2450 		.chained = true,
2451 		.chain_id = ALC882_FIXUP_GPIO1,
2452 	},
2453 	[ALC889_FIXUP_IMAC91_VREF] = {
2454 		.type = HDA_FIXUP_FUNC,
2455 		.v.func = alc889_fixup_imac91_vref,
2456 		.chained = true,
2457 		.chain_id = ALC882_FIXUP_GPIO1,
2458 	},
2459 	[ALC889_FIXUP_MBA11_VREF] = {
2460 		.type = HDA_FIXUP_FUNC,
2461 		.v.func = alc889_fixup_mba11_vref,
2462 		.chained = true,
2463 		.chain_id = ALC889_FIXUP_MBP_VREF,
2464 	},
2465 	[ALC889_FIXUP_MBA21_VREF] = {
2466 		.type = HDA_FIXUP_FUNC,
2467 		.v.func = alc889_fixup_mba21_vref,
2468 		.chained = true,
2469 		.chain_id = ALC889_FIXUP_MBP_VREF,
2470 	},
2471 	[ALC889_FIXUP_MP11_VREF] = {
2472 		.type = HDA_FIXUP_FUNC,
2473 		.v.func = alc889_fixup_mba11_vref,
2474 		.chained = true,
2475 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2476 	},
2477 	[ALC889_FIXUP_MP41_VREF] = {
2478 		.type = HDA_FIXUP_FUNC,
2479 		.v.func = alc889_fixup_mbp_vref,
2480 		.chained = true,
2481 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2482 	},
2483 	[ALC882_FIXUP_INV_DMIC] = {
2484 		.type = HDA_FIXUP_FUNC,
2485 		.v.func = alc_fixup_inv_dmic,
2486 	},
2487 	[ALC882_FIXUP_NO_PRIMARY_HP] = {
2488 		.type = HDA_FIXUP_FUNC,
2489 		.v.func = alc882_fixup_no_primary_hp,
2490 	},
2491 	[ALC887_FIXUP_ASUS_BASS] = {
2492 		.type = HDA_FIXUP_PINS,
2493 		.v.pins = (const struct hda_pintbl[]) {
2494 			{0x16, 0x99130130}, /* bass speaker */
2495 			{}
2496 		},
2497 		.chained = true,
2498 		.chain_id = ALC887_FIXUP_BASS_CHMAP,
2499 	},
2500 	[ALC887_FIXUP_BASS_CHMAP] = {
2501 		.type = HDA_FIXUP_FUNC,
2502 		.v.func = alc_fixup_bass_chmap,
2503 	},
2504 	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
2505 		.type = HDA_FIXUP_FUNC,
2506 		.v.func = alc1220_fixup_gb_dual_codecs,
2507 	},
2508 	[ALC1220_FIXUP_GB_X570] = {
2509 		.type = HDA_FIXUP_FUNC,
2510 		.v.func = alc1220_fixup_gb_x570,
2511 	},
2512 	[ALC1220_FIXUP_CLEVO_P950] = {
2513 		.type = HDA_FIXUP_FUNC,
2514 		.v.func = alc1220_fixup_clevo_p950,
2515 	},
2516 	[ALC1220_FIXUP_CLEVO_PB51ED] = {
2517 		.type = HDA_FIXUP_FUNC,
2518 		.v.func = alc1220_fixup_clevo_pb51ed,
2519 	},
2520 	[ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2521 		.type = HDA_FIXUP_PINS,
2522 		.v.pins = (const struct hda_pintbl[]) {
2523 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2524 			{}
2525 		},
2526 		.chained = true,
2527 		.chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2528 	},
2529 	[ALC887_FIXUP_ASUS_AUDIO] = {
2530 		.type = HDA_FIXUP_PINS,
2531 		.v.pins = (const struct hda_pintbl[]) {
2532 			{ 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2533 			{ 0x19, 0x22219420 },
2534 			{}
2535 		},
2536 	},
2537 	[ALC887_FIXUP_ASUS_HMIC] = {
2538 		.type = HDA_FIXUP_FUNC,
2539 		.v.func = alc887_fixup_asus_jack,
2540 		.chained = true,
2541 		.chain_id = ALC887_FIXUP_ASUS_AUDIO,
2542 	},
2543 	[ALCS1200A_FIXUP_MIC_VREF] = {
2544 		.type = HDA_FIXUP_PINCTLS,
2545 		.v.pins = (const struct hda_pintbl[]) {
2546 			{ 0x18, PIN_VREF50 }, /* rear mic */
2547 			{ 0x19, PIN_VREF50 }, /* front mic */
2548 			{}
2549 		}
2550 	},
2551 	[ALC888VD_FIXUP_MIC_100VREF] = {
2552 		.type = HDA_FIXUP_PINCTLS,
2553 		.v.pins = (const struct hda_pintbl[]) {
2554 			{ 0x18, PIN_VREF100 }, /* headset mic */
2555 			{}
2556 		}
2557 	},
2558 };
2559 
2560 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2561 	SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2562 	SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2563 	SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2564 	SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2565 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2566 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2567 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2568 	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2569 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2570 	SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2571 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2572 	SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2573 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2574 	SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2575 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2576 	SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2577 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2578 	SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2579 	SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2580 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2581 	SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2582 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2583 	SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2584 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2585 	SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2586 	SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2587 	SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2588 	SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2589 	SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2590 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2591 	SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2592 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2593 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2594 	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2595 	SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2596 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2597 	SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2598 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2599 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2600 	SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2601 
2602 	/* All Apple entries are in codec SSIDs */
2603 	SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2604 	SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2605 	SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2606 	SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2607 	SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2608 	SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2609 	SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2610 	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2611 	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2612 	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2613 	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2614 	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2615 	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2616 	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2617 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2618 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2619 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2620 	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2621 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2622 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2623 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2624 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2625 
2626 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2627 	SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2628 	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2629 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2630 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2631 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2632 	SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2633 	SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2634 	SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2635 	SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2636 	SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2637 	SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2638 	SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2639 	SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2640 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2641 	SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2642 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2643 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2644 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2645 	SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2646 	SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2647 	SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2648 	SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2649 	SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2650 	SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2651 	SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2652 	SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2653 	SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2654 	SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2655 	SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2656 	SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 	SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 	SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 	SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 	SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2661 	SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2662 	SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2663 	SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2664 	SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2665 	SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2666 	SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2667 	SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2668 	SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2669 	SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2670 	SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2671 	SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2672 	SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2673 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2674 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2675 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2676 	SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2677 	{}
2678 };
2679 
2680 static const struct hda_model_fixup alc882_fixup_models[] = {
2681 	{.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2682 	{.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2683 	{.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2684 	{.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2685 	{.id = ALC889_FIXUP_CD, .name = "cd"},
2686 	{.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2687 	{.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2688 	{.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2689 	{.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2690 	{.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2691 	{.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2692 	{.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2693 	{.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2694 	{.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2695 	{.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2696 	{.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2697 	{.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2698 	{.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2699 	{.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2700 	{.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2701 	{.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2702 	{.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2703 	{.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2704 	{.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2705 	{.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2706 	{.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2707 	{.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2708 	{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2709 	{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2710 	{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2711 	{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2712 	{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2713 	{}
2714 };
2715 
2716 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2717 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2718 		{0x14, 0x01014010},
2719 		{0x15, 0x01011012},
2720 		{0x16, 0x01016011},
2721 		{0x18, 0x01a19040},
2722 		{0x19, 0x02a19050},
2723 		{0x1a, 0x0181304f},
2724 		{0x1b, 0x0221401f},
2725 		{0x1e, 0x01456130}),
2726 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2727 		{0x14, 0x01015010},
2728 		{0x15, 0x01011012},
2729 		{0x16, 0x01011011},
2730 		{0x18, 0x01a11040},
2731 		{0x19, 0x02a19050},
2732 		{0x1a, 0x0181104f},
2733 		{0x1b, 0x0221401f},
2734 		{0x1e, 0x01451130}),
2735 	{}
2736 };
2737 
2738 /*
2739  * BIOS auto configuration
2740  */
2741 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2742 static int alc882_parse_auto_config(struct hda_codec *codec)
2743 {
2744 	static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2745 	static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2746 	return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2747 }
2748 
2749 /*
2750  */
patch_alc882(struct hda_codec * codec)2751 static int patch_alc882(struct hda_codec *codec)
2752 {
2753 	struct alc_spec *spec;
2754 	int err;
2755 
2756 	err = alc_alloc_spec(codec, 0x0b);
2757 	if (err < 0)
2758 		return err;
2759 
2760 	spec = codec->spec;
2761 
2762 	switch (codec->core.vendor_id) {
2763 	case 0x10ec0882:
2764 	case 0x10ec0885:
2765 	case 0x10ec0900:
2766 	case 0x10ec0b00:
2767 	case 0x10ec1220:
2768 		break;
2769 	default:
2770 		/* ALC883 and variants */
2771 		alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2772 		break;
2773 	}
2774 
2775 	alc_pre_init(codec);
2776 
2777 	snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2778 		       alc882_fixups);
2779 	snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2780 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2781 
2782 	alc_auto_parse_customize_define(codec);
2783 
2784 	if (has_cdefine_beep(codec))
2785 		spec->gen.beep_nid = 0x01;
2786 
2787 	/* automatic parse from the BIOS config */
2788 	err = alc882_parse_auto_config(codec);
2789 	if (err < 0)
2790 		goto error;
2791 
2792 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2793 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2794 		if (err < 0)
2795 			goto error;
2796 	}
2797 
2798 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2799 
2800 	return 0;
2801 
2802  error:
2803 	alc_free(codec);
2804 	return err;
2805 }
2806 
2807 
2808 /*
2809  * ALC262 support
2810  */
alc262_parse_auto_config(struct hda_codec * codec)2811 static int alc262_parse_auto_config(struct hda_codec *codec)
2812 {
2813 	static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2814 	static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2815 	return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2816 }
2817 
2818 /*
2819  * Pin config fixes
2820  */
2821 enum {
2822 	ALC262_FIXUP_FSC_H270,
2823 	ALC262_FIXUP_FSC_S7110,
2824 	ALC262_FIXUP_HP_Z200,
2825 	ALC262_FIXUP_TYAN,
2826 	ALC262_FIXUP_LENOVO_3000,
2827 	ALC262_FIXUP_BENQ,
2828 	ALC262_FIXUP_BENQ_T31,
2829 	ALC262_FIXUP_INV_DMIC,
2830 	ALC262_FIXUP_INTEL_BAYLEYBAY,
2831 };
2832 
2833 static const struct hda_fixup alc262_fixups[] = {
2834 	[ALC262_FIXUP_FSC_H270] = {
2835 		.type = HDA_FIXUP_PINS,
2836 		.v.pins = (const struct hda_pintbl[]) {
2837 			{ 0x14, 0x99130110 }, /* speaker */
2838 			{ 0x15, 0x0221142f }, /* front HP */
2839 			{ 0x1b, 0x0121141f }, /* rear HP */
2840 			{ }
2841 		}
2842 	},
2843 	[ALC262_FIXUP_FSC_S7110] = {
2844 		.type = HDA_FIXUP_PINS,
2845 		.v.pins = (const struct hda_pintbl[]) {
2846 			{ 0x15, 0x90170110 }, /* speaker */
2847 			{ }
2848 		},
2849 		.chained = true,
2850 		.chain_id = ALC262_FIXUP_BENQ,
2851 	},
2852 	[ALC262_FIXUP_HP_Z200] = {
2853 		.type = HDA_FIXUP_PINS,
2854 		.v.pins = (const struct hda_pintbl[]) {
2855 			{ 0x16, 0x99130120 }, /* internal speaker */
2856 			{ }
2857 		}
2858 	},
2859 	[ALC262_FIXUP_TYAN] = {
2860 		.type = HDA_FIXUP_PINS,
2861 		.v.pins = (const struct hda_pintbl[]) {
2862 			{ 0x14, 0x1993e1f0 }, /* int AUX */
2863 			{ }
2864 		}
2865 	},
2866 	[ALC262_FIXUP_LENOVO_3000] = {
2867 		.type = HDA_FIXUP_PINCTLS,
2868 		.v.pins = (const struct hda_pintbl[]) {
2869 			{ 0x19, PIN_VREF50 },
2870 			{}
2871 		},
2872 		.chained = true,
2873 		.chain_id = ALC262_FIXUP_BENQ,
2874 	},
2875 	[ALC262_FIXUP_BENQ] = {
2876 		.type = HDA_FIXUP_VERBS,
2877 		.v.verbs = (const struct hda_verb[]) {
2878 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2879 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2880 			{}
2881 		}
2882 	},
2883 	[ALC262_FIXUP_BENQ_T31] = {
2884 		.type = HDA_FIXUP_VERBS,
2885 		.v.verbs = (const struct hda_verb[]) {
2886 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2887 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2888 			{}
2889 		}
2890 	},
2891 	[ALC262_FIXUP_INV_DMIC] = {
2892 		.type = HDA_FIXUP_FUNC,
2893 		.v.func = alc_fixup_inv_dmic,
2894 	},
2895 	[ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2896 		.type = HDA_FIXUP_FUNC,
2897 		.v.func = alc_fixup_no_depop_delay,
2898 	},
2899 };
2900 
2901 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2902 	SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2903 	SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2904 	SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2905 	SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2906 	SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2907 	SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2908 	SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2909 	SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2910 	SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2911 	SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2912 	{}
2913 };
2914 
2915 static const struct hda_model_fixup alc262_fixup_models[] = {
2916 	{.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2917 	{.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2918 	{.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2919 	{.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2920 	{.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2921 	{.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2922 	{.id = ALC262_FIXUP_BENQ, .name = "benq"},
2923 	{.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2924 	{.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2925 	{}
2926 };
2927 
2928 /*
2929  */
patch_alc262(struct hda_codec * codec)2930 static int patch_alc262(struct hda_codec *codec)
2931 {
2932 	struct alc_spec *spec;
2933 	int err;
2934 
2935 	err = alc_alloc_spec(codec, 0x0b);
2936 	if (err < 0)
2937 		return err;
2938 
2939 	spec = codec->spec;
2940 	spec->gen.shared_mic_vref_pin = 0x18;
2941 
2942 	spec->shutup = alc_eapd_shutup;
2943 
2944 #if 0
2945 	/* pshou 07/11/05  set a zero PCM sample to DAC when FIFO is
2946 	 * under-run
2947 	 */
2948 	alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2949 #endif
2950 	alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2951 
2952 	alc_pre_init(codec);
2953 
2954 	snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2955 		       alc262_fixups);
2956 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2957 
2958 	alc_auto_parse_customize_define(codec);
2959 
2960 	if (has_cdefine_beep(codec))
2961 		spec->gen.beep_nid = 0x01;
2962 
2963 	/* automatic parse from the BIOS config */
2964 	err = alc262_parse_auto_config(codec);
2965 	if (err < 0)
2966 		goto error;
2967 
2968 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2969 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2970 		if (err < 0)
2971 			goto error;
2972 	}
2973 
2974 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2975 
2976 	return 0;
2977 
2978  error:
2979 	alc_free(codec);
2980 	return err;
2981 }
2982 
2983 /*
2984  *  ALC268
2985  */
2986 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)2987 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2988 				  struct snd_ctl_elem_value *ucontrol)
2989 {
2990 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2991 	unsigned long pval;
2992 	int err;
2993 
2994 	mutex_lock(&codec->control_mutex);
2995 	pval = kcontrol->private_value;
2996 	kcontrol->private_value = (pval & ~0xff) | 0x0f;
2997 	err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2998 	if (err >= 0) {
2999 		kcontrol->private_value = (pval & ~0xff) | 0x10;
3000 		err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3001 	}
3002 	kcontrol->private_value = pval;
3003 	mutex_unlock(&codec->control_mutex);
3004 	return err;
3005 }
3006 
3007 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3008 	HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3009 	{
3010 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3011 		.name = "Beep Playback Switch",
3012 		.subdevice = HDA_SUBDEV_AMP_FLAG,
3013 		.info = snd_hda_mixer_amp_switch_info,
3014 		.get = snd_hda_mixer_amp_switch_get,
3015 		.put = alc268_beep_switch_put,
3016 		.private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3017 	},
3018 };
3019 
3020 /* set PCBEEP vol = 0, mute connections */
3021 static const struct hda_verb alc268_beep_init_verbs[] = {
3022 	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3023 	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3024 	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3025 	{ }
3026 };
3027 
3028 enum {
3029 	ALC268_FIXUP_INV_DMIC,
3030 	ALC268_FIXUP_HP_EAPD,
3031 	ALC268_FIXUP_SPDIF,
3032 };
3033 
3034 static const struct hda_fixup alc268_fixups[] = {
3035 	[ALC268_FIXUP_INV_DMIC] = {
3036 		.type = HDA_FIXUP_FUNC,
3037 		.v.func = alc_fixup_inv_dmic,
3038 	},
3039 	[ALC268_FIXUP_HP_EAPD] = {
3040 		.type = HDA_FIXUP_VERBS,
3041 		.v.verbs = (const struct hda_verb[]) {
3042 			{0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3043 			{}
3044 		}
3045 	},
3046 	[ALC268_FIXUP_SPDIF] = {
3047 		.type = HDA_FIXUP_PINS,
3048 		.v.pins = (const struct hda_pintbl[]) {
3049 			{ 0x1e, 0x014b1180 }, /* enable SPDIF out */
3050 			{}
3051 		}
3052 	},
3053 };
3054 
3055 static const struct hda_model_fixup alc268_fixup_models[] = {
3056 	{.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3057 	{.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3058 	{.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3059 	{}
3060 };
3061 
3062 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
3063 	SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3064 	SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3065 	/* below is codec SSID since multiple Toshiba laptops have the
3066 	 * same PCI SSID 1179:ff00
3067 	 */
3068 	SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3069 	{}
3070 };
3071 
3072 /*
3073  * BIOS auto configuration
3074  */
alc268_parse_auto_config(struct hda_codec * codec)3075 static int alc268_parse_auto_config(struct hda_codec *codec)
3076 {
3077 	static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3078 	return alc_parse_auto_config(codec, NULL, alc268_ssids);
3079 }
3080 
3081 /*
3082  */
patch_alc268(struct hda_codec * codec)3083 static int patch_alc268(struct hda_codec *codec)
3084 {
3085 	struct alc_spec *spec;
3086 	int i, err;
3087 
3088 	/* ALC268 has no aa-loopback mixer */
3089 	err = alc_alloc_spec(codec, 0);
3090 	if (err < 0)
3091 		return err;
3092 
3093 	spec = codec->spec;
3094 	if (has_cdefine_beep(codec))
3095 		spec->gen.beep_nid = 0x01;
3096 
3097 	spec->shutup = alc_eapd_shutup;
3098 
3099 	alc_pre_init(codec);
3100 
3101 	snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3102 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3103 
3104 	/* automatic parse from the BIOS config */
3105 	err = alc268_parse_auto_config(codec);
3106 	if (err < 0)
3107 		goto error;
3108 
3109 	if (err > 0 && !spec->gen.no_analog &&
3110 	    spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3111 		for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3112 			if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3113 						  &alc268_beep_mixer[i])) {
3114 				err = -ENOMEM;
3115 				goto error;
3116 			}
3117 		}
3118 		snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3119 		if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3120 			/* override the amp caps for beep generator */
3121 			snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3122 					  (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3123 					  (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3124 					  (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3125 					  (0 << AC_AMPCAP_MUTE_SHIFT));
3126 	}
3127 
3128 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3129 
3130 	return 0;
3131 
3132  error:
3133 	alc_free(codec);
3134 	return err;
3135 }
3136 
3137 /*
3138  * ALC269
3139  */
3140 
3141 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3142 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3143 };
3144 
3145 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3146 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3147 };
3148 
3149 /* different alc269-variants */
3150 enum {
3151 	ALC269_TYPE_ALC269VA,
3152 	ALC269_TYPE_ALC269VB,
3153 	ALC269_TYPE_ALC269VC,
3154 	ALC269_TYPE_ALC269VD,
3155 	ALC269_TYPE_ALC280,
3156 	ALC269_TYPE_ALC282,
3157 	ALC269_TYPE_ALC283,
3158 	ALC269_TYPE_ALC284,
3159 	ALC269_TYPE_ALC293,
3160 	ALC269_TYPE_ALC286,
3161 	ALC269_TYPE_ALC298,
3162 	ALC269_TYPE_ALC255,
3163 	ALC269_TYPE_ALC256,
3164 	ALC269_TYPE_ALC257,
3165 	ALC269_TYPE_ALC215,
3166 	ALC269_TYPE_ALC225,
3167 	ALC269_TYPE_ALC294,
3168 	ALC269_TYPE_ALC300,
3169 	ALC269_TYPE_ALC623,
3170 	ALC269_TYPE_ALC700,
3171 };
3172 
3173 /*
3174  * BIOS auto configuration
3175  */
alc269_parse_auto_config(struct hda_codec * codec)3176 static int alc269_parse_auto_config(struct hda_codec *codec)
3177 {
3178 	static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3179 	static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3180 	static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3181 	struct alc_spec *spec = codec->spec;
3182 	const hda_nid_t *ssids;
3183 
3184 	switch (spec->codec_variant) {
3185 	case ALC269_TYPE_ALC269VA:
3186 	case ALC269_TYPE_ALC269VC:
3187 	case ALC269_TYPE_ALC280:
3188 	case ALC269_TYPE_ALC284:
3189 	case ALC269_TYPE_ALC293:
3190 		ssids = alc269va_ssids;
3191 		break;
3192 	case ALC269_TYPE_ALC269VB:
3193 	case ALC269_TYPE_ALC269VD:
3194 	case ALC269_TYPE_ALC282:
3195 	case ALC269_TYPE_ALC283:
3196 	case ALC269_TYPE_ALC286:
3197 	case ALC269_TYPE_ALC298:
3198 	case ALC269_TYPE_ALC255:
3199 	case ALC269_TYPE_ALC256:
3200 	case ALC269_TYPE_ALC257:
3201 	case ALC269_TYPE_ALC215:
3202 	case ALC269_TYPE_ALC225:
3203 	case ALC269_TYPE_ALC294:
3204 	case ALC269_TYPE_ALC300:
3205 	case ALC269_TYPE_ALC623:
3206 	case ALC269_TYPE_ALC700:
3207 		ssids = alc269_ssids;
3208 		break;
3209 	default:
3210 		ssids = alc269_ssids;
3211 		break;
3212 	}
3213 
3214 	return alc_parse_auto_config(codec, alc269_ignore, ssids);
3215 }
3216 
3217 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3218 	{ SND_JACK_BTN_0, KEY_PLAYPAUSE },
3219 	{ SND_JACK_BTN_1, KEY_VOICECOMMAND },
3220 	{ SND_JACK_BTN_2, KEY_VOLUMEUP },
3221 	{ SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3222 	{}
3223 };
3224 
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3225 static void alc_headset_btn_callback(struct hda_codec *codec,
3226 				     struct hda_jack_callback *jack)
3227 {
3228 	int report = 0;
3229 
3230 	if (jack->unsol_res & (7 << 13))
3231 		report |= SND_JACK_BTN_0;
3232 
3233 	if (jack->unsol_res  & (1 << 16 | 3 << 8))
3234 		report |= SND_JACK_BTN_1;
3235 
3236 	/* Volume up key */
3237 	if (jack->unsol_res & (7 << 23))
3238 		report |= SND_JACK_BTN_2;
3239 
3240 	/* Volume down key */
3241 	if (jack->unsol_res & (7 << 10))
3242 		report |= SND_JACK_BTN_3;
3243 
3244 	jack->jack->button_state = report;
3245 }
3246 
alc_disable_headset_jack_key(struct hda_codec * codec)3247 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3248 {
3249 	struct alc_spec *spec = codec->spec;
3250 
3251 	if (!spec->has_hs_key)
3252 		return;
3253 
3254 	switch (codec->core.vendor_id) {
3255 	case 0x10ec0215:
3256 	case 0x10ec0225:
3257 	case 0x10ec0285:
3258 	case 0x10ec0287:
3259 	case 0x10ec0295:
3260 	case 0x10ec0289:
3261 	case 0x10ec0299:
3262 		alc_write_coef_idx(codec, 0x48, 0x0);
3263 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3264 		alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3265 		break;
3266 	case 0x10ec0230:
3267 	case 0x10ec0236:
3268 	case 0x10ec0256:
3269 	case 0x10ec0257:
3270 	case 0x19e58326:
3271 		alc_write_coef_idx(codec, 0x48, 0x0);
3272 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3273 		break;
3274 	}
3275 }
3276 
alc_enable_headset_jack_key(struct hda_codec * codec)3277 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3278 {
3279 	struct alc_spec *spec = codec->spec;
3280 
3281 	if (!spec->has_hs_key)
3282 		return;
3283 
3284 	switch (codec->core.vendor_id) {
3285 	case 0x10ec0215:
3286 	case 0x10ec0225:
3287 	case 0x10ec0285:
3288 	case 0x10ec0287:
3289 	case 0x10ec0295:
3290 	case 0x10ec0289:
3291 	case 0x10ec0299:
3292 		alc_write_coef_idx(codec, 0x48, 0xd011);
3293 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3294 		alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3295 		break;
3296 	case 0x10ec0230:
3297 	case 0x10ec0236:
3298 	case 0x10ec0256:
3299 	case 0x10ec0257:
3300 	case 0x19e58326:
3301 		alc_write_coef_idx(codec, 0x48, 0xd011);
3302 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3303 		break;
3304 	}
3305 }
3306 
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3307 static void alc_fixup_headset_jack(struct hda_codec *codec,
3308 				    const struct hda_fixup *fix, int action)
3309 {
3310 	struct alc_spec *spec = codec->spec;
3311 
3312 	switch (action) {
3313 	case HDA_FIXUP_ACT_PRE_PROBE:
3314 		spec->has_hs_key = 1;
3315 		snd_hda_jack_detect_enable_callback(codec, 0x55,
3316 						    alc_headset_btn_callback);
3317 		snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
3318 				      SND_JACK_HEADSET, alc_headset_btn_keymap);
3319 		break;
3320 	case HDA_FIXUP_ACT_INIT:
3321 		alc_enable_headset_jack_key(codec);
3322 		break;
3323 	}
3324 }
3325 
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3326 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3327 {
3328 	alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3329 }
3330 
alc269_shutup(struct hda_codec * codec)3331 static void alc269_shutup(struct hda_codec *codec)
3332 {
3333 	struct alc_spec *spec = codec->spec;
3334 
3335 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3336 		alc269vb_toggle_power_output(codec, 0);
3337 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3338 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3339 		msleep(150);
3340 	}
3341 	alc_shutup_pins(codec);
3342 }
3343 
3344 static const struct coef_fw alc282_coefs[] = {
3345 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3346 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3347 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3348 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3349 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3350 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3351 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3352 	WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3353 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3354 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3355 	WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3356 	UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3357 	WRITE_COEF(0x34, 0xa0c0), /* ANC */
3358 	UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3359 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3360 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3361 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3362 	WRITE_COEF(0x63, 0x2902), /* PLL */
3363 	WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3364 	WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3365 	WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3366 	WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3367 	UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3368 	WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3369 	UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3370 	WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3371 	WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3372 	UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3373 	WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3374 	{}
3375 };
3376 
alc282_restore_default_value(struct hda_codec * codec)3377 static void alc282_restore_default_value(struct hda_codec *codec)
3378 {
3379 	alc_process_coef_fw(codec, alc282_coefs);
3380 }
3381 
alc282_init(struct hda_codec * codec)3382 static void alc282_init(struct hda_codec *codec)
3383 {
3384 	struct alc_spec *spec = codec->spec;
3385 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3386 	bool hp_pin_sense;
3387 	int coef78;
3388 
3389 	alc282_restore_default_value(codec);
3390 
3391 	if (!hp_pin)
3392 		return;
3393 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3394 	coef78 = alc_read_coef_idx(codec, 0x78);
3395 
3396 	/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3397 	/* Headphone capless set to high power mode */
3398 	alc_write_coef_idx(codec, 0x78, 0x9004);
3399 
3400 	if (hp_pin_sense)
3401 		msleep(2);
3402 
3403 	snd_hda_codec_write(codec, hp_pin, 0,
3404 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3405 
3406 	if (hp_pin_sense)
3407 		msleep(85);
3408 
3409 	snd_hda_codec_write(codec, hp_pin, 0,
3410 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3411 
3412 	if (hp_pin_sense)
3413 		msleep(100);
3414 
3415 	/* Headphone capless set to normal mode */
3416 	alc_write_coef_idx(codec, 0x78, coef78);
3417 }
3418 
alc282_shutup(struct hda_codec * codec)3419 static void alc282_shutup(struct hda_codec *codec)
3420 {
3421 	struct alc_spec *spec = codec->spec;
3422 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3423 	bool hp_pin_sense;
3424 	int coef78;
3425 
3426 	if (!hp_pin) {
3427 		alc269_shutup(codec);
3428 		return;
3429 	}
3430 
3431 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3432 	coef78 = alc_read_coef_idx(codec, 0x78);
3433 	alc_write_coef_idx(codec, 0x78, 0x9004);
3434 
3435 	if (hp_pin_sense)
3436 		msleep(2);
3437 
3438 	snd_hda_codec_write(codec, hp_pin, 0,
3439 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3440 
3441 	if (hp_pin_sense)
3442 		msleep(85);
3443 
3444 	if (!spec->no_shutup_pins)
3445 		snd_hda_codec_write(codec, hp_pin, 0,
3446 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3447 
3448 	if (hp_pin_sense)
3449 		msleep(100);
3450 
3451 	alc_auto_setup_eapd(codec, false);
3452 	alc_shutup_pins(codec);
3453 	alc_write_coef_idx(codec, 0x78, coef78);
3454 }
3455 
3456 static const struct coef_fw alc283_coefs[] = {
3457 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3458 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3459 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3460 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3461 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3462 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3463 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3464 	WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3465 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3466 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3467 	WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3468 	UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3469 	WRITE_COEF(0x22, 0xa0c0), /* ANC */
3470 	UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3471 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3472 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3473 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3474 	WRITE_COEF(0x2e, 0x2902), /* PLL */
3475 	WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3476 	WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3477 	WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3478 	WRITE_COEF(0x36, 0x0), /* capless control 5 */
3479 	UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3480 	WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3481 	UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3482 	WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3483 	WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3484 	UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3485 	WRITE_COEF(0x49, 0x0), /* test mode */
3486 	UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3487 	UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3488 	WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3489 	UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3490 	{}
3491 };
3492 
alc283_restore_default_value(struct hda_codec * codec)3493 static void alc283_restore_default_value(struct hda_codec *codec)
3494 {
3495 	alc_process_coef_fw(codec, alc283_coefs);
3496 }
3497 
alc283_init(struct hda_codec * codec)3498 static void alc283_init(struct hda_codec *codec)
3499 {
3500 	struct alc_spec *spec = codec->spec;
3501 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3502 	bool hp_pin_sense;
3503 
3504 	alc283_restore_default_value(codec);
3505 
3506 	if (!hp_pin)
3507 		return;
3508 
3509 	msleep(30);
3510 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3511 
3512 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3513 	/* Headphone capless set to high power mode */
3514 	alc_write_coef_idx(codec, 0x43, 0x9004);
3515 
3516 	snd_hda_codec_write(codec, hp_pin, 0,
3517 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3518 
3519 	if (hp_pin_sense)
3520 		msleep(85);
3521 
3522 	snd_hda_codec_write(codec, hp_pin, 0,
3523 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3524 
3525 	if (hp_pin_sense)
3526 		msleep(85);
3527 	/* Index 0x46 Combo jack auto switch control 2 */
3528 	/* 3k pull low control for Headset jack. */
3529 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3530 	/* Headphone capless set to normal mode */
3531 	alc_write_coef_idx(codec, 0x43, 0x9614);
3532 }
3533 
alc283_shutup(struct hda_codec * codec)3534 static void alc283_shutup(struct hda_codec *codec)
3535 {
3536 	struct alc_spec *spec = codec->spec;
3537 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3538 	bool hp_pin_sense;
3539 
3540 	if (!hp_pin) {
3541 		alc269_shutup(codec);
3542 		return;
3543 	}
3544 
3545 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3546 
3547 	alc_write_coef_idx(codec, 0x43, 0x9004);
3548 
3549 	/*depop hp during suspend*/
3550 	alc_write_coef_idx(codec, 0x06, 0x2100);
3551 
3552 	snd_hda_codec_write(codec, hp_pin, 0,
3553 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3554 
3555 	if (hp_pin_sense)
3556 		msleep(100);
3557 
3558 	if (!spec->no_shutup_pins)
3559 		snd_hda_codec_write(codec, hp_pin, 0,
3560 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3561 
3562 	alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3563 
3564 	if (hp_pin_sense)
3565 		msleep(100);
3566 	alc_auto_setup_eapd(codec, false);
3567 	alc_shutup_pins(codec);
3568 	alc_write_coef_idx(codec, 0x43, 0x9614);
3569 }
3570 
alc256_init(struct hda_codec * codec)3571 static void alc256_init(struct hda_codec *codec)
3572 {
3573 	struct alc_spec *spec = codec->spec;
3574 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3575 	bool hp_pin_sense;
3576 
3577 	if (spec->ultra_low_power) {
3578 		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3579 		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3580 		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3581 		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3582 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3583 		msleep(30);
3584 	}
3585 
3586 	if (!hp_pin)
3587 		hp_pin = 0x21;
3588 
3589 	msleep(30);
3590 
3591 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3592 
3593 	if (hp_pin_sense)
3594 		msleep(2);
3595 
3596 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3597 
3598 	snd_hda_codec_write(codec, hp_pin, 0,
3599 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3600 
3601 	if (hp_pin_sense || spec->ultra_low_power)
3602 		msleep(85);
3603 
3604 	snd_hda_codec_write(codec, hp_pin, 0,
3605 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3606 
3607 	if (hp_pin_sense || spec->ultra_low_power)
3608 		msleep(100);
3609 
3610 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3611 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3612 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3613 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3614 	/*
3615 	 * Expose headphone mic (or possibly Line In on some machines) instead
3616 	 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3617 	 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3618 	 * this register.
3619 	 */
3620 	alc_write_coef_idx(codec, 0x36, 0x5757);
3621 }
3622 
alc256_shutup(struct hda_codec * codec)3623 static void alc256_shutup(struct hda_codec *codec)
3624 {
3625 	struct alc_spec *spec = codec->spec;
3626 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3627 	bool hp_pin_sense;
3628 
3629 	if (!hp_pin)
3630 		hp_pin = 0x21;
3631 
3632 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3633 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3634 
3635 	if (hp_pin_sense)
3636 		msleep(2);
3637 
3638 	snd_hda_codec_write(codec, hp_pin, 0,
3639 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3640 
3641 	if (hp_pin_sense || spec->ultra_low_power)
3642 		msleep(85);
3643 
3644 	/* 3k pull low control for Headset jack. */
3645 	/* NOTE: call this before clearing the pin, otherwise codec stalls */
3646 	/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3647 	 * when booting with headset plugged. So skip setting it for the codec alc257
3648 	 */
3649 	if (spec->en_3kpull_low)
3650 		alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3651 
3652 	if (!spec->no_shutup_pins)
3653 		snd_hda_codec_write(codec, hp_pin, 0,
3654 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3655 
3656 	if (hp_pin_sense || spec->ultra_low_power)
3657 		msleep(100);
3658 
3659 	alc_auto_setup_eapd(codec, false);
3660 	alc_shutup_pins(codec);
3661 	if (spec->ultra_low_power) {
3662 		msleep(50);
3663 		alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3664 		alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3665 		alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3666 		alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3667 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3668 		msleep(30);
3669 	}
3670 }
3671 
alc225_init(struct hda_codec * codec)3672 static void alc225_init(struct hda_codec *codec)
3673 {
3674 	struct alc_spec *spec = codec->spec;
3675 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3676 	bool hp1_pin_sense, hp2_pin_sense;
3677 
3678 	if (spec->ultra_low_power) {
3679 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3680 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3681 		alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3682 		msleep(30);
3683 	}
3684 
3685 	if (!hp_pin)
3686 		hp_pin = 0x21;
3687 	msleep(30);
3688 
3689 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3690 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3691 
3692 	if (hp1_pin_sense || hp2_pin_sense)
3693 		msleep(2);
3694 
3695 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3696 
3697 	if (hp1_pin_sense || spec->ultra_low_power)
3698 		snd_hda_codec_write(codec, hp_pin, 0,
3699 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3700 	if (hp2_pin_sense)
3701 		snd_hda_codec_write(codec, 0x16, 0,
3702 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3703 
3704 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3705 		msleep(85);
3706 
3707 	if (hp1_pin_sense || spec->ultra_low_power)
3708 		snd_hda_codec_write(codec, hp_pin, 0,
3709 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3710 	if (hp2_pin_sense)
3711 		snd_hda_codec_write(codec, 0x16, 0,
3712 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3713 
3714 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3715 		msleep(100);
3716 
3717 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3718 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3719 }
3720 
alc225_shutup(struct hda_codec * codec)3721 static void alc225_shutup(struct hda_codec *codec)
3722 {
3723 	struct alc_spec *spec = codec->spec;
3724 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3725 	bool hp1_pin_sense, hp2_pin_sense;
3726 
3727 	if (!hp_pin)
3728 		hp_pin = 0x21;
3729 
3730 	alc_disable_headset_jack_key(codec);
3731 	/* 3k pull low control for Headset jack. */
3732 	alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3733 
3734 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3735 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3736 
3737 	if (hp1_pin_sense || hp2_pin_sense)
3738 		msleep(2);
3739 
3740 	if (hp1_pin_sense || spec->ultra_low_power)
3741 		snd_hda_codec_write(codec, hp_pin, 0,
3742 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3743 	if (hp2_pin_sense)
3744 		snd_hda_codec_write(codec, 0x16, 0,
3745 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3746 
3747 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3748 		msleep(85);
3749 
3750 	if (hp1_pin_sense || spec->ultra_low_power)
3751 		snd_hda_codec_write(codec, hp_pin, 0,
3752 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3753 	if (hp2_pin_sense)
3754 		snd_hda_codec_write(codec, 0x16, 0,
3755 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3756 
3757 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3758 		msleep(100);
3759 
3760 	alc_auto_setup_eapd(codec, false);
3761 	alc_shutup_pins(codec);
3762 	if (spec->ultra_low_power) {
3763 		msleep(50);
3764 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3765 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3766 		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3767 		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3768 		msleep(30);
3769 	}
3770 
3771 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3772 	alc_enable_headset_jack_key(codec);
3773 }
3774 
alc_default_init(struct hda_codec * codec)3775 static void alc_default_init(struct hda_codec *codec)
3776 {
3777 	struct alc_spec *spec = codec->spec;
3778 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3779 	bool hp_pin_sense;
3780 
3781 	if (!hp_pin)
3782 		return;
3783 
3784 	msleep(30);
3785 
3786 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3787 
3788 	if (hp_pin_sense)
3789 		msleep(2);
3790 
3791 	snd_hda_codec_write(codec, hp_pin, 0,
3792 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3793 
3794 	if (hp_pin_sense)
3795 		msleep(85);
3796 
3797 	snd_hda_codec_write(codec, hp_pin, 0,
3798 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3799 
3800 	if (hp_pin_sense)
3801 		msleep(100);
3802 }
3803 
alc_default_shutup(struct hda_codec * codec)3804 static void alc_default_shutup(struct hda_codec *codec)
3805 {
3806 	struct alc_spec *spec = codec->spec;
3807 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3808 	bool hp_pin_sense;
3809 
3810 	if (!hp_pin) {
3811 		alc269_shutup(codec);
3812 		return;
3813 	}
3814 
3815 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3816 
3817 	if (hp_pin_sense)
3818 		msleep(2);
3819 
3820 	snd_hda_codec_write(codec, hp_pin, 0,
3821 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3822 
3823 	if (hp_pin_sense)
3824 		msleep(85);
3825 
3826 	if (!spec->no_shutup_pins)
3827 		snd_hda_codec_write(codec, hp_pin, 0,
3828 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3829 
3830 	if (hp_pin_sense)
3831 		msleep(100);
3832 
3833 	alc_auto_setup_eapd(codec, false);
3834 	alc_shutup_pins(codec);
3835 }
3836 
alc294_hp_init(struct hda_codec * codec)3837 static void alc294_hp_init(struct hda_codec *codec)
3838 {
3839 	struct alc_spec *spec = codec->spec;
3840 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3841 	int i, val;
3842 
3843 	if (!hp_pin)
3844 		return;
3845 
3846 	snd_hda_codec_write(codec, hp_pin, 0,
3847 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3848 
3849 	msleep(100);
3850 
3851 	if (!spec->no_shutup_pins)
3852 		snd_hda_codec_write(codec, hp_pin, 0,
3853 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3854 
3855 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3856 	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3857 
3858 	/* Wait for depop procedure finish  */
3859 	val = alc_read_coefex_idx(codec, 0x58, 0x01);
3860 	for (i = 0; i < 20 && val & 0x0080; i++) {
3861 		msleep(50);
3862 		val = alc_read_coefex_idx(codec, 0x58, 0x01);
3863 	}
3864 	/* Set HP depop to auto mode */
3865 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3866 	msleep(50);
3867 }
3868 
alc294_init(struct hda_codec * codec)3869 static void alc294_init(struct hda_codec *codec)
3870 {
3871 	struct alc_spec *spec = codec->spec;
3872 
3873 	/* required only at boot or S4 resume time */
3874 	if (!spec->done_hp_init ||
3875 	    codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3876 		alc294_hp_init(codec);
3877 		spec->done_hp_init = true;
3878 	}
3879 	alc_default_init(codec);
3880 }
3881 
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)3882 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3883 			     unsigned int val)
3884 {
3885 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3886 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3887 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3888 }
3889 
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)3890 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3891 {
3892 	unsigned int val;
3893 
3894 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3895 	val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3896 		& 0xffff;
3897 	val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3898 		<< 16;
3899 	return val;
3900 }
3901 
alc5505_dsp_halt(struct hda_codec * codec)3902 static void alc5505_dsp_halt(struct hda_codec *codec)
3903 {
3904 	unsigned int val;
3905 
3906 	alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3907 	alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3908 	alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3909 	alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3910 	alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3911 	alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3912 	alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3913 	val = alc5505_coef_get(codec, 0x6220);
3914 	alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3915 }
3916 
alc5505_dsp_back_from_halt(struct hda_codec * codec)3917 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3918 {
3919 	alc5505_coef_set(codec, 0x61b8, 0x04133302);
3920 	alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3921 	alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3922 	alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3923 	alc5505_coef_set(codec, 0x6220, 0x2002010f);
3924 	alc5505_coef_set(codec, 0x880c, 0x00000004);
3925 }
3926 
alc5505_dsp_init(struct hda_codec * codec)3927 static void alc5505_dsp_init(struct hda_codec *codec)
3928 {
3929 	unsigned int val;
3930 
3931 	alc5505_dsp_halt(codec);
3932 	alc5505_dsp_back_from_halt(codec);
3933 	alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3934 	alc5505_coef_set(codec, 0x61b0, 0x5b16);
3935 	alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3936 	alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3937 	alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3938 	alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3939 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3940 	alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3941 	alc5505_coef_set(codec, 0x61b8, 0x04173302);
3942 	alc5505_coef_set(codec, 0x61b8, 0x04163302);
3943 	alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3944 	alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3945 	alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3946 
3947 	val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3948 	if (val <= 3)
3949 		alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3950 	else
3951 		alc5505_coef_set(codec, 0x6220, 0x6002018f);
3952 
3953 	alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3954 	alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3955 	alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3956 	alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3957 	alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3958 	alc5505_coef_set(codec, 0x880c, 0x00000003);
3959 	alc5505_coef_set(codec, 0x880c, 0x00000010);
3960 
3961 #ifdef HALT_REALTEK_ALC5505
3962 	alc5505_dsp_halt(codec);
3963 #endif
3964 }
3965 
3966 #ifdef HALT_REALTEK_ALC5505
3967 #define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
3968 #define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
3969 #else
3970 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
3971 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
3972 #endif
3973 
3974 #ifdef CONFIG_PM
alc269_suspend(struct hda_codec * codec)3975 static int alc269_suspend(struct hda_codec *codec)
3976 {
3977 	struct alc_spec *spec = codec->spec;
3978 
3979 	if (spec->has_alc5505_dsp)
3980 		alc5505_dsp_suspend(codec);
3981 	return alc_suspend(codec);
3982 }
3983 
alc269_resume(struct hda_codec * codec)3984 static int alc269_resume(struct hda_codec *codec)
3985 {
3986 	struct alc_spec *spec = codec->spec;
3987 
3988 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3989 		alc269vb_toggle_power_output(codec, 0);
3990 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3991 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3992 		msleep(150);
3993 	}
3994 
3995 	codec->patch_ops.init(codec);
3996 
3997 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3998 		alc269vb_toggle_power_output(codec, 1);
3999 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4000 			(alc_get_coef0(codec) & 0x00ff) == 0x017) {
4001 		msleep(200);
4002 	}
4003 
4004 	snd_hda_regmap_sync(codec);
4005 	hda_call_check_power_status(codec, 0x01);
4006 
4007 	/* on some machine, the BIOS will clear the codec gpio data when enter
4008 	 * suspend, and won't restore the data after resume, so we restore it
4009 	 * in the driver.
4010 	 */
4011 	if (spec->gpio_data)
4012 		alc_write_gpio_data(codec);
4013 
4014 	if (spec->has_alc5505_dsp)
4015 		alc5505_dsp_resume(codec);
4016 
4017 	return 0;
4018 }
4019 #endif /* CONFIG_PM */
4020 
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4021 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4022 						 const struct hda_fixup *fix, int action)
4023 {
4024 	struct alc_spec *spec = codec->spec;
4025 
4026 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4027 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4028 }
4029 
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4030 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4031 						 const struct hda_fixup *fix,
4032 						 int action)
4033 {
4034 	unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4035 	unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4036 
4037 	if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4038 		snd_hda_codec_set_pincfg(codec, 0x19,
4039 			(cfg_headphone & ~AC_DEFCFG_DEVICE) |
4040 			(AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4041 }
4042 
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4043 static void alc269_fixup_hweq(struct hda_codec *codec,
4044 			       const struct hda_fixup *fix, int action)
4045 {
4046 	if (action == HDA_FIXUP_ACT_INIT)
4047 		alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4048 }
4049 
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4050 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4051 				       const struct hda_fixup *fix, int action)
4052 {
4053 	struct alc_spec *spec = codec->spec;
4054 
4055 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4056 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4057 }
4058 
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4059 static void alc271_fixup_dmic(struct hda_codec *codec,
4060 			      const struct hda_fixup *fix, int action)
4061 {
4062 	static const struct hda_verb verbs[] = {
4063 		{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4064 		{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4065 		{}
4066 	};
4067 	unsigned int cfg;
4068 
4069 	if (strcmp(codec->core.chip_name, "ALC271X") &&
4070 	    strcmp(codec->core.chip_name, "ALC269VB"))
4071 		return;
4072 	cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4073 	if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4074 		snd_hda_sequence_write(codec, verbs);
4075 }
4076 
4077 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4078 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4079 					  const struct hda_fixup *fix,
4080 					  int action)
4081 {
4082 	if (action == HDA_FIXUP_ACT_INIT)
4083 		alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4084 }
4085 
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4086 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4087 				 const struct hda_fixup *fix, int action)
4088 {
4089 	struct alc_spec *spec = codec->spec;
4090 
4091 	if (action != HDA_FIXUP_ACT_PROBE)
4092 		return;
4093 
4094 	/* Due to a hardware problem on Lenovo Ideadpad, we need to
4095 	 * fix the sample rate of analog I/O to 44.1kHz
4096 	 */
4097 	spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4098 	spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4099 }
4100 
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4101 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4102 				     const struct hda_fixup *fix, int action)
4103 {
4104 	/* The digital-mic unit sends PDM (differential signal) instead of
4105 	 * the standard PCM, thus you can't record a valid mono stream as is.
4106 	 * Below is a workaround specific to ALC269 to control the dmic
4107 	 * signal source as mono.
4108 	 */
4109 	if (action == HDA_FIXUP_ACT_INIT)
4110 		alc_update_coef_idx(codec, 0x07, 0, 0x80);
4111 }
4112 
alc269_quanta_automute(struct hda_codec * codec)4113 static void alc269_quanta_automute(struct hda_codec *codec)
4114 {
4115 	snd_hda_gen_update_outputs(codec);
4116 
4117 	alc_write_coef_idx(codec, 0x0c, 0x680);
4118 	alc_write_coef_idx(codec, 0x0c, 0x480);
4119 }
4120 
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4121 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4122 				     const struct hda_fixup *fix, int action)
4123 {
4124 	struct alc_spec *spec = codec->spec;
4125 	if (action != HDA_FIXUP_ACT_PROBE)
4126 		return;
4127 	spec->gen.automute_hook = alc269_quanta_automute;
4128 }
4129 
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4130 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4131 					 struct hda_jack_callback *jack)
4132 {
4133 	struct alc_spec *spec = codec->spec;
4134 	int vref;
4135 	msleep(200);
4136 	snd_hda_gen_hp_automute(codec, jack);
4137 
4138 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4139 	msleep(100);
4140 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4141 			    vref);
4142 	msleep(500);
4143 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4144 			    vref);
4145 }
4146 
4147 /*
4148  * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4149  */
4150 struct hda_alc298_mbxinit {
4151 	unsigned char value_0x23;
4152 	unsigned char value_0x25;
4153 };
4154 
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4155 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4156 					 const struct hda_alc298_mbxinit *initval,
4157 					 bool first)
4158 {
4159 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4160 	alc_write_coef_idx(codec, 0x26, 0xb000);
4161 
4162 	if (first)
4163 		snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4164 
4165 	snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4166 	alc_write_coef_idx(codec, 0x26, 0xf000);
4167 	alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4168 
4169 	if (initval->value_0x23 != 0x1e)
4170 		alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4171 
4172 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4173 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4174 }
4175 
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4176 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4177 					   const struct hda_fixup *fix,
4178 					   int action)
4179 {
4180 	/* Initialization magic */
4181 	static const struct hda_alc298_mbxinit dac_init[] = {
4182 		{0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4183 		{0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4184 		{0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4185 		{0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4186 		{0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4187 		{0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4188 		{0x2f, 0x00},
4189 		{0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4190 		{0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4191 		{0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4192 		{}
4193 	};
4194 	const struct hda_alc298_mbxinit *seq;
4195 
4196 	if (action != HDA_FIXUP_ACT_INIT)
4197 		return;
4198 
4199 	/* Start */
4200 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4201 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4202 	alc_write_coef_idx(codec, 0x26, 0xf000);
4203 	alc_write_coef_idx(codec, 0x22, 0x31);
4204 	alc_write_coef_idx(codec, 0x23, 0x0b);
4205 	alc_write_coef_idx(codec, 0x25, 0x00);
4206 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4207 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4208 
4209 	for (seq = dac_init; seq->value_0x23; seq++)
4210 		alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4211 }
4212 
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4213 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4214 				     const struct hda_fixup *fix, int action)
4215 {
4216 	struct alc_spec *spec = codec->spec;
4217 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4218 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4219 		spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4220 	}
4221 }
4222 
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4223 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4224 				bool polarity, bool on)
4225 {
4226 	unsigned int pinval;
4227 
4228 	if (!pin)
4229 		return;
4230 	if (polarity)
4231 		on = !on;
4232 	pinval = snd_hda_codec_get_pin_target(codec, pin);
4233 	pinval &= ~AC_PINCTL_VREFEN;
4234 	pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4235 	/* temporarily power up/down for setting VREF */
4236 	snd_hda_power_up_pm(codec);
4237 	snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4238 	snd_hda_power_down_pm(codec);
4239 }
4240 
4241 /* 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)4242 static int vref_mute_led_set(struct led_classdev *led_cdev,
4243 			     enum led_brightness brightness)
4244 {
4245 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4246 	struct alc_spec *spec = codec->spec;
4247 
4248 	alc_update_vref_led(codec, spec->mute_led_nid,
4249 			    spec->mute_led_polarity, brightness);
4250 	return 0;
4251 }
4252 
4253 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4254 static unsigned int led_power_filter(struct hda_codec *codec,
4255 						  hda_nid_t nid,
4256 						  unsigned int power_state)
4257 {
4258 	struct alc_spec *spec = codec->spec;
4259 
4260 	if (power_state != AC_PWRST_D3 || nid == 0 ||
4261 	    (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4262 		return power_state;
4263 
4264 	/* Set pin ctl again, it might have just been set to 0 */
4265 	snd_hda_set_pin_ctl(codec, nid,
4266 			    snd_hda_codec_get_pin_target(codec, nid));
4267 
4268 	return snd_hda_gen_path_power_filter(codec, nid, power_state);
4269 }
4270 
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4271 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4272 				     const struct hda_fixup *fix, int action)
4273 {
4274 	struct alc_spec *spec = codec->spec;
4275 	const struct dmi_device *dev = NULL;
4276 
4277 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4278 		return;
4279 
4280 	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4281 		int pol, pin;
4282 		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4283 			continue;
4284 		if (pin < 0x0a || pin >= 0x10)
4285 			break;
4286 		spec->mute_led_polarity = pol;
4287 		spec->mute_led_nid = pin - 0x0a + 0x18;
4288 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4289 		codec->power_filter = led_power_filter;
4290 		codec_dbg(codec,
4291 			  "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4292 			   spec->mute_led_polarity);
4293 		break;
4294 	}
4295 }
4296 
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4297 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4298 					  const struct hda_fixup *fix,
4299 					  int action, hda_nid_t pin)
4300 {
4301 	struct alc_spec *spec = codec->spec;
4302 
4303 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4304 		spec->mute_led_polarity = 0;
4305 		spec->mute_led_nid = pin;
4306 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4307 		codec->power_filter = led_power_filter;
4308 	}
4309 }
4310 
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4311 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4312 				const struct hda_fixup *fix, int action)
4313 {
4314 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4315 }
4316 
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4317 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4318 				const struct hda_fixup *fix, int action)
4319 {
4320 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4321 }
4322 
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4323 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4324 				const struct hda_fixup *fix, int action)
4325 {
4326 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4327 }
4328 
4329 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4330 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4331 				int polarity, bool enabled)
4332 {
4333 	if (polarity)
4334 		enabled = !enabled;
4335 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4336 }
4337 
4338 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4339 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4340 			     enum led_brightness brightness)
4341 {
4342 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4343 	struct alc_spec *spec = codec->spec;
4344 
4345 	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4346 			    spec->mute_led_polarity, !brightness);
4347 	return 0;
4348 }
4349 
4350 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4351 static int micmute_led_set(struct led_classdev *led_cdev,
4352 			   enum led_brightness brightness)
4353 {
4354 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4355 	struct alc_spec *spec = codec->spec;
4356 
4357 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4358 			    spec->micmute_led_polarity, !brightness);
4359 	return 0;
4360 }
4361 
4362 /* 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)4363 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4364 				  int action,
4365 				  unsigned int mute_mask,
4366 				  unsigned int micmute_mask)
4367 {
4368 	struct alc_spec *spec = codec->spec;
4369 
4370 	alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4371 
4372 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4373 		return;
4374 	if (mute_mask) {
4375 		spec->gpio_mute_led_mask = mute_mask;
4376 		snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4377 	}
4378 	if (micmute_mask) {
4379 		spec->gpio_mic_led_mask = micmute_mask;
4380 		snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4381 	}
4382 }
4383 
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4384 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4385 				const struct hda_fixup *fix, int action)
4386 {
4387 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4388 }
4389 
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4390 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4391 				const struct hda_fixup *fix, int action)
4392 {
4393 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4394 }
4395 
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4396 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4397 				const struct hda_fixup *fix, int action)
4398 {
4399 	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4400 }
4401 
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4402 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4403 				const struct hda_fixup *fix, int action)
4404 {
4405 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4406 }
4407 
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4408 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4409 				const struct hda_fixup *fix, int action)
4410 {
4411 	alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4412 }
4413 
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4414 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4415 				const struct hda_fixup *fix, int action)
4416 {
4417 	struct alc_spec *spec = codec->spec;
4418 
4419 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4420 		spec->micmute_led_polarity = 1;
4421 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4422 }
4423 
4424 /* 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)4425 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4426 				enum led_brightness brightness)
4427 {
4428 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4429 	struct alc_spec *spec = codec->spec;
4430 
4431 	alc_update_vref_led(codec, spec->cap_mute_led_nid,
4432 			    spec->micmute_led_polarity, brightness);
4433 	return 0;
4434 }
4435 
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4436 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4437 				const struct hda_fixup *fix, int action)
4438 {
4439 	struct alc_spec *spec = codec->spec;
4440 
4441 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4442 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4443 		/* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4444 		 * enable headphone amp
4445 		 */
4446 		spec->gpio_mask |= 0x10;
4447 		spec->gpio_dir |= 0x10;
4448 		spec->cap_mute_led_nid = 0x18;
4449 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4450 		codec->power_filter = led_power_filter;
4451 	}
4452 }
4453 
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4454 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4455 				   const struct hda_fixup *fix, int action)
4456 {
4457 	struct alc_spec *spec = codec->spec;
4458 
4459 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4460 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4461 		spec->cap_mute_led_nid = 0x18;
4462 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4463 		codec->power_filter = led_power_filter;
4464 	}
4465 }
4466 
4467 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4468  * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4469  */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4470 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4471 				     const struct hda_fixup *fix, int action)
4472 {
4473 	struct alc_spec *spec = codec->spec;
4474 
4475 	switch (action) {
4476 	case HDA_FIXUP_ACT_PRE_PROBE:
4477 		spec->gpio_mask |= 0x01;
4478 		spec->gpio_dir |= 0x01;
4479 		break;
4480 	case HDA_FIXUP_ACT_INIT:
4481 		/* need to toggle GPIO to enable the amp */
4482 		alc_update_gpio_data(codec, 0x01, true);
4483 		msleep(100);
4484 		alc_update_gpio_data(codec, 0x01, false);
4485 		break;
4486 	}
4487 }
4488 
4489 /* 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)4490 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4491 				    struct hda_codec *codec,
4492 				    struct snd_pcm_substream *substream,
4493 				    int action)
4494 {
4495 	switch (action) {
4496 	case HDA_GEN_PCM_ACT_PREPARE:
4497 		alc_update_gpio_data(codec, 0x04, true);
4498 		break;
4499 	case HDA_GEN_PCM_ACT_CLEANUP:
4500 		alc_update_gpio_data(codec, 0x04, false);
4501 		break;
4502 	}
4503 }
4504 
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4505 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4506 				      const struct hda_fixup *fix,
4507 				      int action)
4508 {
4509 	struct alc_spec *spec = codec->spec;
4510 
4511 	if (action == HDA_FIXUP_ACT_PROBE) {
4512 		spec->gpio_mask |= 0x04;
4513 		spec->gpio_dir |= 0x04;
4514 		spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4515 	}
4516 }
4517 
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4518 static void alc_update_coef_led(struct hda_codec *codec,
4519 				struct alc_coef_led *led,
4520 				bool polarity, bool on)
4521 {
4522 	if (polarity)
4523 		on = !on;
4524 	/* temporarily power up/down for setting COEF bit */
4525 	alc_update_coef_idx(codec, led->idx, led->mask,
4526 			    on ? led->on : led->off);
4527 }
4528 
4529 /* 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)4530 static int coef_mute_led_set(struct led_classdev *led_cdev,
4531 			     enum led_brightness brightness)
4532 {
4533 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4534 	struct alc_spec *spec = codec->spec;
4535 
4536 	alc_update_coef_led(codec, &spec->mute_led_coef,
4537 			    spec->mute_led_polarity, brightness);
4538 	return 0;
4539 }
4540 
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4541 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4542 					  const struct hda_fixup *fix,
4543 					  int action)
4544 {
4545 	struct alc_spec *spec = codec->spec;
4546 
4547 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4548 		spec->mute_led_polarity = 0;
4549 		spec->mute_led_coef.idx = 0x0b;
4550 		spec->mute_led_coef.mask = 1 << 3;
4551 		spec->mute_led_coef.on = 1 << 3;
4552 		spec->mute_led_coef.off = 0;
4553 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4554 	}
4555 }
4556 
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4557 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4558 					  const struct hda_fixup *fix,
4559 					  int action)
4560 {
4561 	struct alc_spec *spec = codec->spec;
4562 
4563 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4564 		spec->mute_led_polarity = 0;
4565 		spec->mute_led_coef.idx = 0x34;
4566 		spec->mute_led_coef.mask = 1 << 5;
4567 		spec->mute_led_coef.on = 0;
4568 		spec->mute_led_coef.off = 1 << 5;
4569 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4570 	}
4571 }
4572 
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4573 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4574 					  const struct hda_fixup *fix, int action)
4575 {
4576 	struct alc_spec *spec = codec->spec;
4577 
4578 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4579 		spec->mute_led_polarity = 0;
4580 		spec->mute_led_coef.idx = 0x07;
4581 		spec->mute_led_coef.mask = 1;
4582 		spec->mute_led_coef.on = 1;
4583 		spec->mute_led_coef.off = 0;
4584 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4585 	}
4586 }
4587 
4588 /* 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)4589 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4590 				enum led_brightness brightness)
4591 {
4592 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4593 	struct alc_spec *spec = codec->spec;
4594 
4595 	alc_update_coef_led(codec, &spec->mic_led_coef,
4596 			    spec->micmute_led_polarity, brightness);
4597 	return 0;
4598 }
4599 
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4600 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4601 				const struct hda_fixup *fix, int action)
4602 {
4603 	struct alc_spec *spec = codec->spec;
4604 
4605 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4606 		spec->mic_led_coef.idx = 0x19;
4607 		spec->mic_led_coef.mask = 1 << 13;
4608 		spec->mic_led_coef.on = 1 << 13;
4609 		spec->mic_led_coef.off = 0;
4610 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4611 	}
4612 }
4613 
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4614 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4615 				const struct hda_fixup *fix, int action)
4616 {
4617 	struct alc_spec *spec = codec->spec;
4618 
4619 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4620 		spec->micmute_led_polarity = 1;
4621 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4622 }
4623 
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4624 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4625 				const struct hda_fixup *fix, int action)
4626 {
4627 	struct alc_spec *spec = codec->spec;
4628 
4629 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4630 		spec->mic_led_coef.idx = 0x35;
4631 		spec->mic_led_coef.mask = 3 << 2;
4632 		spec->mic_led_coef.on = 2 << 2;
4633 		spec->mic_led_coef.off = 1 << 2;
4634 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4635 	}
4636 }
4637 
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4638 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4639 				const struct hda_fixup *fix, int action)
4640 {
4641 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4642 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4643 }
4644 
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4645 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4646 				const struct hda_fixup *fix, int action)
4647 {
4648 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4649 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4650 }
4651 
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4652 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4653 				const struct hda_fixup *fix, int action)
4654 {
4655 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4656 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4657 }
4658 
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4659 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4660 				const struct hda_fixup *fix, int action)
4661 {
4662 	struct alc_spec *spec = codec->spec;
4663 
4664 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4665 		spec->cap_mute_led_nid = 0x1a;
4666 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4667 		codec->power_filter = led_power_filter;
4668 	}
4669 }
4670 
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4671 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4672 				const struct hda_fixup *fix, int action)
4673 {
4674 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4675 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4676 }
4677 
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4678 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4679 						  const unsigned short coefs[2])
4680 {
4681 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4682 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4683 	alc_write_coef_idx(codec, 0x26, 0xb011);
4684 }
4685 
4686 struct alc298_samsung_amp_desc {
4687 	unsigned char nid;
4688 	unsigned short init_seq[2][2];
4689 };
4690 
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4691 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4692 				     const struct hda_fixup *fix, int action)
4693 {
4694 	int i, j;
4695 	static const unsigned short init_seq[][2] = {
4696 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4697 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4698 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4699 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4700 	};
4701 	static const struct alc298_samsung_amp_desc amps[] = {
4702 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4703 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4704 	};
4705 
4706 	if (action != HDA_FIXUP_ACT_INIT)
4707 		return;
4708 
4709 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4710 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4711 
4712 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4713 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4714 
4715 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4716 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4717 	}
4718 }
4719 
4720 #if IS_REACHABLE(CONFIG_INPUT)
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)4721 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4722 				   struct hda_jack_callback *event)
4723 {
4724 	struct alc_spec *spec = codec->spec;
4725 
4726 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4727 	   send both key on and key off event for every interrupt. */
4728 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4729 	input_sync(spec->kb_dev);
4730 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4731 	input_sync(spec->kb_dev);
4732 }
4733 
alc_register_micmute_input_device(struct hda_codec * codec)4734 static int alc_register_micmute_input_device(struct hda_codec *codec)
4735 {
4736 	struct alc_spec *spec = codec->spec;
4737 	int i;
4738 
4739 	spec->kb_dev = input_allocate_device();
4740 	if (!spec->kb_dev) {
4741 		codec_err(codec, "Out of memory (input_allocate_device)\n");
4742 		return -ENOMEM;
4743 	}
4744 
4745 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4746 
4747 	spec->kb_dev->name = "Microphone Mute Button";
4748 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4749 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4750 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4751 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4752 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4753 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4754 
4755 	if (input_register_device(spec->kb_dev)) {
4756 		codec_err(codec, "input_register_device failed\n");
4757 		input_free_device(spec->kb_dev);
4758 		spec->kb_dev = NULL;
4759 		return -ENOMEM;
4760 	}
4761 
4762 	return 0;
4763 }
4764 
4765 /* GPIO1 = set according to SKU external amp
4766  * GPIO2 = mic mute hotkey
4767  * GPIO3 = mute LED
4768  * GPIO4 = mic mute LED
4769  */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4770 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4771 					     const struct hda_fixup *fix, int action)
4772 {
4773 	struct alc_spec *spec = codec->spec;
4774 
4775 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4776 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4777 		spec->init_amp = ALC_INIT_DEFAULT;
4778 		if (alc_register_micmute_input_device(codec) != 0)
4779 			return;
4780 
4781 		spec->gpio_mask |= 0x06;
4782 		spec->gpio_dir |= 0x02;
4783 		spec->gpio_data |= 0x02;
4784 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4785 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4786 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4787 						    gpio2_mic_hotkey_event);
4788 		return;
4789 	}
4790 
4791 	if (!spec->kb_dev)
4792 		return;
4793 
4794 	switch (action) {
4795 	case HDA_FIXUP_ACT_FREE:
4796 		input_unregister_device(spec->kb_dev);
4797 		spec->kb_dev = NULL;
4798 	}
4799 }
4800 
4801 /* Line2 = mic mute hotkey
4802  * GPIO2 = mic mute LED
4803  */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4804 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4805 					     const struct hda_fixup *fix, int action)
4806 {
4807 	struct alc_spec *spec = codec->spec;
4808 
4809 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4810 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4811 		spec->init_amp = ALC_INIT_DEFAULT;
4812 		if (alc_register_micmute_input_device(codec) != 0)
4813 			return;
4814 
4815 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
4816 						    gpio2_mic_hotkey_event);
4817 		return;
4818 	}
4819 
4820 	if (!spec->kb_dev)
4821 		return;
4822 
4823 	switch (action) {
4824 	case HDA_FIXUP_ACT_FREE:
4825 		input_unregister_device(spec->kb_dev);
4826 		spec->kb_dev = NULL;
4827 	}
4828 }
4829 #else /* INPUT */
4830 #define alc280_fixup_hp_gpio2_mic_hotkey	NULL
4831 #define alc233_fixup_lenovo_line2_mic_hotkey	NULL
4832 #endif /* INPUT */
4833 
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4834 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4835 				const struct hda_fixup *fix, int action)
4836 {
4837 	struct alc_spec *spec = codec->spec;
4838 
4839 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4840 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4841 		spec->cap_mute_led_nid = 0x18;
4842 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4843 	}
4844 }
4845 
4846 static const struct coef_fw alc225_pre_hsmode[] = {
4847 	UPDATE_COEF(0x4a, 1<<8, 0),
4848 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4849 	UPDATE_COEF(0x63, 3<<14, 3<<14),
4850 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
4851 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
4852 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4853 	UPDATE_COEF(0x4a, 3<<10, 0),
4854 	{}
4855 };
4856 
alc_headset_mode_unplugged(struct hda_codec * codec)4857 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4858 {
4859 	struct alc_spec *spec = codec->spec;
4860 	static const struct coef_fw coef0255[] = {
4861 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4862 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4863 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4864 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4865 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4866 		{}
4867 	};
4868 	static const struct coef_fw coef0256[] = {
4869 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4870 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4871 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4872 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4873 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4874 		{}
4875 	};
4876 	static const struct coef_fw coef0233[] = {
4877 		WRITE_COEF(0x1b, 0x0c0b),
4878 		WRITE_COEF(0x45, 0xc429),
4879 		UPDATE_COEF(0x35, 0x4000, 0),
4880 		WRITE_COEF(0x06, 0x2104),
4881 		WRITE_COEF(0x1a, 0x0001),
4882 		WRITE_COEF(0x26, 0x0004),
4883 		WRITE_COEF(0x32, 0x42a3),
4884 		{}
4885 	};
4886 	static const struct coef_fw coef0288[] = {
4887 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4888 		UPDATE_COEF(0x50, 0x2000, 0x2000),
4889 		UPDATE_COEF(0x56, 0x0006, 0x0006),
4890 		UPDATE_COEF(0x66, 0x0008, 0),
4891 		UPDATE_COEF(0x67, 0x2000, 0),
4892 		{}
4893 	};
4894 	static const struct coef_fw coef0298[] = {
4895 		UPDATE_COEF(0x19, 0x1300, 0x0300),
4896 		{}
4897 	};
4898 	static const struct coef_fw coef0292[] = {
4899 		WRITE_COEF(0x76, 0x000e),
4900 		WRITE_COEF(0x6c, 0x2400),
4901 		WRITE_COEF(0x18, 0x7308),
4902 		WRITE_COEF(0x6b, 0xc429),
4903 		{}
4904 	};
4905 	static const struct coef_fw coef0293[] = {
4906 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4907 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4908 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4909 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4910 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4911 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4912 		{}
4913 	};
4914 	static const struct coef_fw coef0668[] = {
4915 		WRITE_COEF(0x15, 0x0d40),
4916 		WRITE_COEF(0xb7, 0x802b),
4917 		{}
4918 	};
4919 	static const struct coef_fw coef0225[] = {
4920 		UPDATE_COEF(0x63, 3<<14, 0),
4921 		{}
4922 	};
4923 	static const struct coef_fw coef0274[] = {
4924 		UPDATE_COEF(0x4a, 0x0100, 0),
4925 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4926 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
4927 		UPDATE_COEF(0x4a, 0x0010, 0),
4928 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4929 		WRITE_COEF(0x45, 0x5289),
4930 		UPDATE_COEF(0x4a, 0x0c00, 0),
4931 		{}
4932 	};
4933 
4934 	if (spec->no_internal_mic_pin) {
4935 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4936 		return;
4937 	}
4938 
4939 	switch (codec->core.vendor_id) {
4940 	case 0x10ec0255:
4941 		alc_process_coef_fw(codec, coef0255);
4942 		break;
4943 	case 0x10ec0230:
4944 	case 0x10ec0236:
4945 	case 0x10ec0256:
4946 	case 0x19e58326:
4947 		alc_process_coef_fw(codec, coef0256);
4948 		break;
4949 	case 0x10ec0234:
4950 	case 0x10ec0274:
4951 	case 0x10ec0294:
4952 		alc_process_coef_fw(codec, coef0274);
4953 		break;
4954 	case 0x10ec0233:
4955 	case 0x10ec0283:
4956 		alc_process_coef_fw(codec, coef0233);
4957 		break;
4958 	case 0x10ec0286:
4959 	case 0x10ec0288:
4960 		alc_process_coef_fw(codec, coef0288);
4961 		break;
4962 	case 0x10ec0298:
4963 		alc_process_coef_fw(codec, coef0298);
4964 		alc_process_coef_fw(codec, coef0288);
4965 		break;
4966 	case 0x10ec0292:
4967 		alc_process_coef_fw(codec, coef0292);
4968 		break;
4969 	case 0x10ec0293:
4970 		alc_process_coef_fw(codec, coef0293);
4971 		break;
4972 	case 0x10ec0668:
4973 		alc_process_coef_fw(codec, coef0668);
4974 		break;
4975 	case 0x10ec0215:
4976 	case 0x10ec0225:
4977 	case 0x10ec0285:
4978 	case 0x10ec0295:
4979 	case 0x10ec0289:
4980 	case 0x10ec0299:
4981 		alc_process_coef_fw(codec, alc225_pre_hsmode);
4982 		alc_process_coef_fw(codec, coef0225);
4983 		break;
4984 	case 0x10ec0867:
4985 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4986 		break;
4987 	}
4988 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
4989 }
4990 
4991 
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)4992 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4993 				    hda_nid_t mic_pin)
4994 {
4995 	static const struct coef_fw coef0255[] = {
4996 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4997 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4998 		{}
4999 	};
5000 	static const struct coef_fw coef0256[] = {
5001 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5002 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5003 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5004 		{}
5005 	};
5006 	static const struct coef_fw coef0233[] = {
5007 		UPDATE_COEF(0x35, 0, 1<<14),
5008 		WRITE_COEF(0x06, 0x2100),
5009 		WRITE_COEF(0x1a, 0x0021),
5010 		WRITE_COEF(0x26, 0x008c),
5011 		{}
5012 	};
5013 	static const struct coef_fw coef0288[] = {
5014 		UPDATE_COEF(0x4f, 0x00c0, 0),
5015 		UPDATE_COEF(0x50, 0x2000, 0),
5016 		UPDATE_COEF(0x56, 0x0006, 0),
5017 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5018 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5019 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5020 		{}
5021 	};
5022 	static const struct coef_fw coef0292[] = {
5023 		WRITE_COEF(0x19, 0xa208),
5024 		WRITE_COEF(0x2e, 0xacf0),
5025 		{}
5026 	};
5027 	static const struct coef_fw coef0293[] = {
5028 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5029 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5030 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5031 		{}
5032 	};
5033 	static const struct coef_fw coef0688[] = {
5034 		WRITE_COEF(0xb7, 0x802b),
5035 		WRITE_COEF(0xb5, 0x1040),
5036 		UPDATE_COEF(0xc3, 0, 1<<12),
5037 		{}
5038 	};
5039 	static const struct coef_fw coef0225[] = {
5040 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5041 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5042 		UPDATE_COEF(0x63, 3<<14, 0),
5043 		{}
5044 	};
5045 	static const struct coef_fw coef0274[] = {
5046 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5047 		UPDATE_COEF(0x4a, 0x0010, 0),
5048 		UPDATE_COEF(0x6b, 0xf000, 0),
5049 		{}
5050 	};
5051 
5052 	switch (codec->core.vendor_id) {
5053 	case 0x10ec0255:
5054 		alc_write_coef_idx(codec, 0x45, 0xc489);
5055 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5056 		alc_process_coef_fw(codec, coef0255);
5057 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5058 		break;
5059 	case 0x10ec0230:
5060 	case 0x10ec0236:
5061 	case 0x10ec0256:
5062 	case 0x19e58326:
5063 		alc_write_coef_idx(codec, 0x45, 0xc489);
5064 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5065 		alc_process_coef_fw(codec, coef0256);
5066 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5067 		break;
5068 	case 0x10ec0234:
5069 	case 0x10ec0274:
5070 	case 0x10ec0294:
5071 		alc_write_coef_idx(codec, 0x45, 0x4689);
5072 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5073 		alc_process_coef_fw(codec, coef0274);
5074 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5075 		break;
5076 	case 0x10ec0233:
5077 	case 0x10ec0283:
5078 		alc_write_coef_idx(codec, 0x45, 0xc429);
5079 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5080 		alc_process_coef_fw(codec, coef0233);
5081 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5082 		break;
5083 	case 0x10ec0286:
5084 	case 0x10ec0288:
5085 	case 0x10ec0298:
5086 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5087 		alc_process_coef_fw(codec, coef0288);
5088 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5089 		break;
5090 	case 0x10ec0292:
5091 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5092 		alc_process_coef_fw(codec, coef0292);
5093 		break;
5094 	case 0x10ec0293:
5095 		/* Set to TRS mode */
5096 		alc_write_coef_idx(codec, 0x45, 0xc429);
5097 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5098 		alc_process_coef_fw(codec, coef0293);
5099 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5100 		break;
5101 	case 0x10ec0867:
5102 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5103 		fallthrough;
5104 	case 0x10ec0221:
5105 	case 0x10ec0662:
5106 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5107 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5108 		break;
5109 	case 0x10ec0668:
5110 		alc_write_coef_idx(codec, 0x11, 0x0001);
5111 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5112 		alc_process_coef_fw(codec, coef0688);
5113 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5114 		break;
5115 	case 0x10ec0215:
5116 	case 0x10ec0225:
5117 	case 0x10ec0285:
5118 	case 0x10ec0295:
5119 	case 0x10ec0289:
5120 	case 0x10ec0299:
5121 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5122 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5123 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5124 		alc_process_coef_fw(codec, coef0225);
5125 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5126 		break;
5127 	}
5128 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5129 }
5130 
alc_headset_mode_default(struct hda_codec * codec)5131 static void alc_headset_mode_default(struct hda_codec *codec)
5132 {
5133 	static const struct coef_fw coef0225[] = {
5134 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5135 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5136 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5137 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5138 		UPDATE_COEF(0x63, 3<<14, 0),
5139 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5140 		{}
5141 	};
5142 	static const struct coef_fw coef0255[] = {
5143 		WRITE_COEF(0x45, 0xc089),
5144 		WRITE_COEF(0x45, 0xc489),
5145 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5146 		WRITE_COEF(0x49, 0x0049),
5147 		{}
5148 	};
5149 	static const struct coef_fw coef0256[] = {
5150 		WRITE_COEF(0x45, 0xc489),
5151 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5152 		WRITE_COEF(0x49, 0x0049),
5153 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5154 		WRITE_COEF(0x06, 0x6100),
5155 		{}
5156 	};
5157 	static const struct coef_fw coef0233[] = {
5158 		WRITE_COEF(0x06, 0x2100),
5159 		WRITE_COEF(0x32, 0x4ea3),
5160 		{}
5161 	};
5162 	static const struct coef_fw coef0288[] = {
5163 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5164 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5165 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5166 		UPDATE_COEF(0x66, 0x0008, 0),
5167 		UPDATE_COEF(0x67, 0x2000, 0),
5168 		{}
5169 	};
5170 	static const struct coef_fw coef0292[] = {
5171 		WRITE_COEF(0x76, 0x000e),
5172 		WRITE_COEF(0x6c, 0x2400),
5173 		WRITE_COEF(0x6b, 0xc429),
5174 		WRITE_COEF(0x18, 0x7308),
5175 		{}
5176 	};
5177 	static const struct coef_fw coef0293[] = {
5178 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5179 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5180 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5181 		{}
5182 	};
5183 	static const struct coef_fw coef0688[] = {
5184 		WRITE_COEF(0x11, 0x0041),
5185 		WRITE_COEF(0x15, 0x0d40),
5186 		WRITE_COEF(0xb7, 0x802b),
5187 		{}
5188 	};
5189 	static const struct coef_fw coef0274[] = {
5190 		WRITE_COEF(0x45, 0x4289),
5191 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5192 		UPDATE_COEF(0x6b, 0x0f00, 0),
5193 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5194 		{}
5195 	};
5196 
5197 	switch (codec->core.vendor_id) {
5198 	case 0x10ec0215:
5199 	case 0x10ec0225:
5200 	case 0x10ec0285:
5201 	case 0x10ec0295:
5202 	case 0x10ec0289:
5203 	case 0x10ec0299:
5204 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5205 		alc_process_coef_fw(codec, coef0225);
5206 		break;
5207 	case 0x10ec0255:
5208 		alc_process_coef_fw(codec, coef0255);
5209 		break;
5210 	case 0x10ec0230:
5211 	case 0x10ec0236:
5212 	case 0x10ec0256:
5213 	case 0x19e58326:
5214 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5215 		alc_write_coef_idx(codec, 0x45, 0xc089);
5216 		msleep(50);
5217 		alc_process_coef_fw(codec, coef0256);
5218 		break;
5219 	case 0x10ec0234:
5220 	case 0x10ec0274:
5221 	case 0x10ec0294:
5222 		alc_process_coef_fw(codec, coef0274);
5223 		break;
5224 	case 0x10ec0233:
5225 	case 0x10ec0283:
5226 		alc_process_coef_fw(codec, coef0233);
5227 		break;
5228 	case 0x10ec0286:
5229 	case 0x10ec0288:
5230 	case 0x10ec0298:
5231 		alc_process_coef_fw(codec, coef0288);
5232 		break;
5233 	case 0x10ec0292:
5234 		alc_process_coef_fw(codec, coef0292);
5235 		break;
5236 	case 0x10ec0293:
5237 		alc_process_coef_fw(codec, coef0293);
5238 		break;
5239 	case 0x10ec0668:
5240 		alc_process_coef_fw(codec, coef0688);
5241 		break;
5242 	case 0x10ec0867:
5243 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5244 		break;
5245 	}
5246 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5247 }
5248 
5249 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5250 static void alc_headset_mode_ctia(struct hda_codec *codec)
5251 {
5252 	int val;
5253 
5254 	static const struct coef_fw coef0255[] = {
5255 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5256 		WRITE_COEF(0x1b, 0x0c2b),
5257 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5258 		{}
5259 	};
5260 	static const struct coef_fw coef0256[] = {
5261 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5262 		WRITE_COEF(0x1b, 0x0e6b),
5263 		{}
5264 	};
5265 	static const struct coef_fw coef0233[] = {
5266 		WRITE_COEF(0x45, 0xd429),
5267 		WRITE_COEF(0x1b, 0x0c2b),
5268 		WRITE_COEF(0x32, 0x4ea3),
5269 		{}
5270 	};
5271 	static const struct coef_fw coef0288[] = {
5272 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5273 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5274 		UPDATE_COEF(0x66, 0x0008, 0),
5275 		UPDATE_COEF(0x67, 0x2000, 0),
5276 		{}
5277 	};
5278 	static const struct coef_fw coef0292[] = {
5279 		WRITE_COEF(0x6b, 0xd429),
5280 		WRITE_COEF(0x76, 0x0008),
5281 		WRITE_COEF(0x18, 0x7388),
5282 		{}
5283 	};
5284 	static const struct coef_fw coef0293[] = {
5285 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5286 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5287 		{}
5288 	};
5289 	static const struct coef_fw coef0688[] = {
5290 		WRITE_COEF(0x11, 0x0001),
5291 		WRITE_COEF(0x15, 0x0d60),
5292 		WRITE_COEF(0xc3, 0x0000),
5293 		{}
5294 	};
5295 	static const struct coef_fw coef0225_1[] = {
5296 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5297 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5298 		{}
5299 	};
5300 	static const struct coef_fw coef0225_2[] = {
5301 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5302 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5303 		{}
5304 	};
5305 
5306 	switch (codec->core.vendor_id) {
5307 	case 0x10ec0255:
5308 		alc_process_coef_fw(codec, coef0255);
5309 		break;
5310 	case 0x10ec0230:
5311 	case 0x10ec0236:
5312 	case 0x10ec0256:
5313 	case 0x19e58326:
5314 		alc_process_coef_fw(codec, coef0256);
5315 		break;
5316 	case 0x10ec0234:
5317 	case 0x10ec0274:
5318 	case 0x10ec0294:
5319 		alc_write_coef_idx(codec, 0x45, 0xd689);
5320 		break;
5321 	case 0x10ec0233:
5322 	case 0x10ec0283:
5323 		alc_process_coef_fw(codec, coef0233);
5324 		break;
5325 	case 0x10ec0298:
5326 		val = alc_read_coef_idx(codec, 0x50);
5327 		if (val & (1 << 12)) {
5328 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5329 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5330 			msleep(300);
5331 		} else {
5332 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5333 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5334 			msleep(300);
5335 		}
5336 		break;
5337 	case 0x10ec0286:
5338 	case 0x10ec0288:
5339 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5340 		msleep(300);
5341 		alc_process_coef_fw(codec, coef0288);
5342 		break;
5343 	case 0x10ec0292:
5344 		alc_process_coef_fw(codec, coef0292);
5345 		break;
5346 	case 0x10ec0293:
5347 		alc_process_coef_fw(codec, coef0293);
5348 		break;
5349 	case 0x10ec0668:
5350 		alc_process_coef_fw(codec, coef0688);
5351 		break;
5352 	case 0x10ec0215:
5353 	case 0x10ec0225:
5354 	case 0x10ec0285:
5355 	case 0x10ec0295:
5356 	case 0x10ec0289:
5357 	case 0x10ec0299:
5358 		val = alc_read_coef_idx(codec, 0x45);
5359 		if (val & (1 << 9))
5360 			alc_process_coef_fw(codec, coef0225_2);
5361 		else
5362 			alc_process_coef_fw(codec, coef0225_1);
5363 		break;
5364 	case 0x10ec0867:
5365 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5366 		break;
5367 	}
5368 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5369 }
5370 
5371 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5372 static void alc_headset_mode_omtp(struct hda_codec *codec)
5373 {
5374 	static const struct coef_fw coef0255[] = {
5375 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5376 		WRITE_COEF(0x1b, 0x0c2b),
5377 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5378 		{}
5379 	};
5380 	static const struct coef_fw coef0256[] = {
5381 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5382 		WRITE_COEF(0x1b, 0x0e6b),
5383 		{}
5384 	};
5385 	static const struct coef_fw coef0233[] = {
5386 		WRITE_COEF(0x45, 0xe429),
5387 		WRITE_COEF(0x1b, 0x0c2b),
5388 		WRITE_COEF(0x32, 0x4ea3),
5389 		{}
5390 	};
5391 	static const struct coef_fw coef0288[] = {
5392 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5393 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5394 		UPDATE_COEF(0x66, 0x0008, 0),
5395 		UPDATE_COEF(0x67, 0x2000, 0),
5396 		{}
5397 	};
5398 	static const struct coef_fw coef0292[] = {
5399 		WRITE_COEF(0x6b, 0xe429),
5400 		WRITE_COEF(0x76, 0x0008),
5401 		WRITE_COEF(0x18, 0x7388),
5402 		{}
5403 	};
5404 	static const struct coef_fw coef0293[] = {
5405 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5406 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5407 		{}
5408 	};
5409 	static const struct coef_fw coef0688[] = {
5410 		WRITE_COEF(0x11, 0x0001),
5411 		WRITE_COEF(0x15, 0x0d50),
5412 		WRITE_COEF(0xc3, 0x0000),
5413 		{}
5414 	};
5415 	static const struct coef_fw coef0225[] = {
5416 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5417 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5418 		{}
5419 	};
5420 
5421 	switch (codec->core.vendor_id) {
5422 	case 0x10ec0255:
5423 		alc_process_coef_fw(codec, coef0255);
5424 		break;
5425 	case 0x10ec0230:
5426 	case 0x10ec0236:
5427 	case 0x10ec0256:
5428 	case 0x19e58326:
5429 		alc_process_coef_fw(codec, coef0256);
5430 		break;
5431 	case 0x10ec0234:
5432 	case 0x10ec0274:
5433 	case 0x10ec0294:
5434 		alc_write_coef_idx(codec, 0x45, 0xe689);
5435 		break;
5436 	case 0x10ec0233:
5437 	case 0x10ec0283:
5438 		alc_process_coef_fw(codec, coef0233);
5439 		break;
5440 	case 0x10ec0298:
5441 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5442 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5443 		msleep(300);
5444 		break;
5445 	case 0x10ec0286:
5446 	case 0x10ec0288:
5447 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5448 		msleep(300);
5449 		alc_process_coef_fw(codec, coef0288);
5450 		break;
5451 	case 0x10ec0292:
5452 		alc_process_coef_fw(codec, coef0292);
5453 		break;
5454 	case 0x10ec0293:
5455 		alc_process_coef_fw(codec, coef0293);
5456 		break;
5457 	case 0x10ec0668:
5458 		alc_process_coef_fw(codec, coef0688);
5459 		break;
5460 	case 0x10ec0215:
5461 	case 0x10ec0225:
5462 	case 0x10ec0285:
5463 	case 0x10ec0295:
5464 	case 0x10ec0289:
5465 	case 0x10ec0299:
5466 		alc_process_coef_fw(codec, coef0225);
5467 		break;
5468 	}
5469 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5470 }
5471 
alc_determine_headset_type(struct hda_codec * codec)5472 static void alc_determine_headset_type(struct hda_codec *codec)
5473 {
5474 	int val;
5475 	bool is_ctia = false;
5476 	struct alc_spec *spec = codec->spec;
5477 	static const struct coef_fw coef0255[] = {
5478 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5479 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5480  conteol) */
5481 		{}
5482 	};
5483 	static const struct coef_fw coef0288[] = {
5484 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5485 		{}
5486 	};
5487 	static const struct coef_fw coef0298[] = {
5488 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5489 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5490 		UPDATE_COEF(0x66, 0x0008, 0),
5491 		UPDATE_COEF(0x67, 0x2000, 0),
5492 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5493 		{}
5494 	};
5495 	static const struct coef_fw coef0293[] = {
5496 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5497 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5498 		{}
5499 	};
5500 	static const struct coef_fw coef0688[] = {
5501 		WRITE_COEF(0x11, 0x0001),
5502 		WRITE_COEF(0xb7, 0x802b),
5503 		WRITE_COEF(0x15, 0x0d60),
5504 		WRITE_COEF(0xc3, 0x0c00),
5505 		{}
5506 	};
5507 	static const struct coef_fw coef0274[] = {
5508 		UPDATE_COEF(0x4a, 0x0010, 0),
5509 		UPDATE_COEF(0x4a, 0x8000, 0),
5510 		WRITE_COEF(0x45, 0xd289),
5511 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5512 		{}
5513 	};
5514 
5515 	if (spec->no_internal_mic_pin) {
5516 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5517 		return;
5518 	}
5519 
5520 	switch (codec->core.vendor_id) {
5521 	case 0x10ec0255:
5522 		alc_process_coef_fw(codec, coef0255);
5523 		msleep(300);
5524 		val = alc_read_coef_idx(codec, 0x46);
5525 		is_ctia = (val & 0x0070) == 0x0070;
5526 		break;
5527 	case 0x10ec0230:
5528 	case 0x10ec0236:
5529 	case 0x10ec0256:
5530 	case 0x19e58326:
5531 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5532 		alc_write_coef_idx(codec, 0x06, 0x6104);
5533 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5534 
5535 		snd_hda_codec_write(codec, 0x21, 0,
5536 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5537 		msleep(80);
5538 		snd_hda_codec_write(codec, 0x21, 0,
5539 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5540 
5541 		alc_process_coef_fw(codec, coef0255);
5542 		msleep(300);
5543 		val = alc_read_coef_idx(codec, 0x46);
5544 		is_ctia = (val & 0x0070) == 0x0070;
5545 
5546 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5547 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5548 
5549 		snd_hda_codec_write(codec, 0x21, 0,
5550 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5551 		msleep(80);
5552 		snd_hda_codec_write(codec, 0x21, 0,
5553 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5554 		break;
5555 	case 0x10ec0234:
5556 	case 0x10ec0274:
5557 	case 0x10ec0294:
5558 		alc_process_coef_fw(codec, coef0274);
5559 		msleep(850);
5560 		val = alc_read_coef_idx(codec, 0x46);
5561 		is_ctia = (val & 0x00f0) == 0x00f0;
5562 		break;
5563 	case 0x10ec0233:
5564 	case 0x10ec0283:
5565 		alc_write_coef_idx(codec, 0x45, 0xd029);
5566 		msleep(300);
5567 		val = alc_read_coef_idx(codec, 0x46);
5568 		is_ctia = (val & 0x0070) == 0x0070;
5569 		break;
5570 	case 0x10ec0298:
5571 		snd_hda_codec_write(codec, 0x21, 0,
5572 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5573 		msleep(100);
5574 		snd_hda_codec_write(codec, 0x21, 0,
5575 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5576 		msleep(200);
5577 
5578 		val = alc_read_coef_idx(codec, 0x50);
5579 		if (val & (1 << 12)) {
5580 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5581 			alc_process_coef_fw(codec, coef0288);
5582 			msleep(350);
5583 			val = alc_read_coef_idx(codec, 0x50);
5584 			is_ctia = (val & 0x0070) == 0x0070;
5585 		} else {
5586 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5587 			alc_process_coef_fw(codec, coef0288);
5588 			msleep(350);
5589 			val = alc_read_coef_idx(codec, 0x50);
5590 			is_ctia = (val & 0x0070) == 0x0070;
5591 		}
5592 		alc_process_coef_fw(codec, coef0298);
5593 		snd_hda_codec_write(codec, 0x21, 0,
5594 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5595 		msleep(75);
5596 		snd_hda_codec_write(codec, 0x21, 0,
5597 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5598 		break;
5599 	case 0x10ec0286:
5600 	case 0x10ec0288:
5601 		alc_process_coef_fw(codec, coef0288);
5602 		msleep(350);
5603 		val = alc_read_coef_idx(codec, 0x50);
5604 		is_ctia = (val & 0x0070) == 0x0070;
5605 		break;
5606 	case 0x10ec0292:
5607 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5608 		msleep(300);
5609 		val = alc_read_coef_idx(codec, 0x6c);
5610 		is_ctia = (val & 0x001c) == 0x001c;
5611 		break;
5612 	case 0x10ec0293:
5613 		alc_process_coef_fw(codec, coef0293);
5614 		msleep(300);
5615 		val = alc_read_coef_idx(codec, 0x46);
5616 		is_ctia = (val & 0x0070) == 0x0070;
5617 		break;
5618 	case 0x10ec0668:
5619 		alc_process_coef_fw(codec, coef0688);
5620 		msleep(300);
5621 		val = alc_read_coef_idx(codec, 0xbe);
5622 		is_ctia = (val & 0x1c02) == 0x1c02;
5623 		break;
5624 	case 0x10ec0215:
5625 	case 0x10ec0225:
5626 	case 0x10ec0285:
5627 	case 0x10ec0295:
5628 	case 0x10ec0289:
5629 	case 0x10ec0299:
5630 		snd_hda_codec_write(codec, 0x21, 0,
5631 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5632 		msleep(80);
5633 		snd_hda_codec_write(codec, 0x21, 0,
5634 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5635 
5636 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5637 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5638 		val = alc_read_coef_idx(codec, 0x45);
5639 		if (val & (1 << 9)) {
5640 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5641 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5642 			msleep(800);
5643 			val = alc_read_coef_idx(codec, 0x46);
5644 			is_ctia = (val & 0x00f0) == 0x00f0;
5645 		} else {
5646 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5647 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5648 			msleep(800);
5649 			val = alc_read_coef_idx(codec, 0x46);
5650 			is_ctia = (val & 0x00f0) == 0x00f0;
5651 		}
5652 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5653 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5654 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5655 
5656 		snd_hda_codec_write(codec, 0x21, 0,
5657 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5658 		msleep(80);
5659 		snd_hda_codec_write(codec, 0x21, 0,
5660 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5661 		break;
5662 	case 0x10ec0867:
5663 		is_ctia = true;
5664 		break;
5665 	}
5666 
5667 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5668 		    is_ctia ? "yes" : "no");
5669 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5670 }
5671 
alc_update_headset_mode(struct hda_codec * codec)5672 static void alc_update_headset_mode(struct hda_codec *codec)
5673 {
5674 	struct alc_spec *spec = codec->spec;
5675 
5676 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5677 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
5678 
5679 	int new_headset_mode;
5680 
5681 	if (!snd_hda_jack_detect(codec, hp_pin))
5682 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5683 	else if (mux_pin == spec->headset_mic_pin)
5684 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5685 	else if (mux_pin == spec->headphone_mic_pin)
5686 		new_headset_mode = ALC_HEADSET_MODE_MIC;
5687 	else
5688 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5689 
5690 	if (new_headset_mode == spec->current_headset_mode) {
5691 		snd_hda_gen_update_outputs(codec);
5692 		return;
5693 	}
5694 
5695 	switch (new_headset_mode) {
5696 	case ALC_HEADSET_MODE_UNPLUGGED:
5697 		alc_headset_mode_unplugged(codec);
5698 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5699 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5700 		spec->gen.hp_jack_present = false;
5701 		break;
5702 	case ALC_HEADSET_MODE_HEADSET:
5703 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5704 			alc_determine_headset_type(codec);
5705 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5706 			alc_headset_mode_ctia(codec);
5707 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5708 			alc_headset_mode_omtp(codec);
5709 		spec->gen.hp_jack_present = true;
5710 		break;
5711 	case ALC_HEADSET_MODE_MIC:
5712 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5713 		spec->gen.hp_jack_present = false;
5714 		break;
5715 	case ALC_HEADSET_MODE_HEADPHONE:
5716 		alc_headset_mode_default(codec);
5717 		spec->gen.hp_jack_present = true;
5718 		break;
5719 	}
5720 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5721 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
5722 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5723 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5724 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5725 						  PIN_VREFHIZ);
5726 	}
5727 	spec->current_headset_mode = new_headset_mode;
5728 
5729 	snd_hda_gen_update_outputs(codec);
5730 }
5731 
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)5732 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5733 					 struct snd_kcontrol *kcontrol,
5734 					 struct snd_ctl_elem_value *ucontrol)
5735 {
5736 	alc_update_headset_mode(codec);
5737 }
5738 
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5739 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5740 				       struct hda_jack_callback *jack)
5741 {
5742 	snd_hda_gen_hp_automute(codec, jack);
5743 	alc_update_headset_mode(codec);
5744 }
5745 
alc_probe_headset_mode(struct hda_codec * codec)5746 static void alc_probe_headset_mode(struct hda_codec *codec)
5747 {
5748 	int i;
5749 	struct alc_spec *spec = codec->spec;
5750 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5751 
5752 	/* Find mic pins */
5753 	for (i = 0; i < cfg->num_inputs; i++) {
5754 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5755 			spec->headset_mic_pin = cfg->inputs[i].pin;
5756 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5757 			spec->headphone_mic_pin = cfg->inputs[i].pin;
5758 	}
5759 
5760 	WARN_ON(spec->gen.cap_sync_hook);
5761 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5762 	spec->gen.automute_hook = alc_update_headset_mode;
5763 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5764 }
5765 
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)5766 static void alc_fixup_headset_mode(struct hda_codec *codec,
5767 				const struct hda_fixup *fix, int action)
5768 {
5769 	struct alc_spec *spec = codec->spec;
5770 
5771 	switch (action) {
5772 	case HDA_FIXUP_ACT_PRE_PROBE:
5773 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5774 		break;
5775 	case HDA_FIXUP_ACT_PROBE:
5776 		alc_probe_headset_mode(codec);
5777 		break;
5778 	case HDA_FIXUP_ACT_INIT:
5779 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
5780 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5781 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5782 		}
5783 		alc_update_headset_mode(codec);
5784 		break;
5785 	}
5786 }
5787 
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5788 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5789 				const struct hda_fixup *fix, int action)
5790 {
5791 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5792 		struct alc_spec *spec = codec->spec;
5793 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5794 	}
5795 	else
5796 		alc_fixup_headset_mode(codec, fix, action);
5797 }
5798 
alc255_set_default_jack_type(struct hda_codec * codec)5799 static void alc255_set_default_jack_type(struct hda_codec *codec)
5800 {
5801 	/* Set to iphone type */
5802 	static const struct coef_fw alc255fw[] = {
5803 		WRITE_COEF(0x1b, 0x880b),
5804 		WRITE_COEF(0x45, 0xd089),
5805 		WRITE_COEF(0x1b, 0x080b),
5806 		WRITE_COEF(0x46, 0x0004),
5807 		WRITE_COEF(0x1b, 0x0c0b),
5808 		{}
5809 	};
5810 	static const struct coef_fw alc256fw[] = {
5811 		WRITE_COEF(0x1b, 0x884b),
5812 		WRITE_COEF(0x45, 0xd089),
5813 		WRITE_COEF(0x1b, 0x084b),
5814 		WRITE_COEF(0x46, 0x0004),
5815 		WRITE_COEF(0x1b, 0x0c4b),
5816 		{}
5817 	};
5818 	switch (codec->core.vendor_id) {
5819 	case 0x10ec0255:
5820 		alc_process_coef_fw(codec, alc255fw);
5821 		break;
5822 	case 0x10ec0230:
5823 	case 0x10ec0236:
5824 	case 0x10ec0256:
5825 	case 0x19e58326:
5826 		alc_process_coef_fw(codec, alc256fw);
5827 		break;
5828 	}
5829 	msleep(30);
5830 }
5831 
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)5832 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5833 				const struct hda_fixup *fix, int action)
5834 {
5835 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5836 		alc255_set_default_jack_type(codec);
5837 	}
5838 	alc_fixup_headset_mode(codec, fix, action);
5839 }
5840 
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5841 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5842 				const struct hda_fixup *fix, int action)
5843 {
5844 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5845 		struct alc_spec *spec = codec->spec;
5846 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5847 		alc255_set_default_jack_type(codec);
5848 	}
5849 	else
5850 		alc_fixup_headset_mode(codec, fix, action);
5851 }
5852 
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5853 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5854 				       struct hda_jack_callback *jack)
5855 {
5856 	struct alc_spec *spec = codec->spec;
5857 
5858 	alc_update_headset_jack_cb(codec, jack);
5859 	/* Headset Mic enable or disable, only for Dell Dino */
5860 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5861 }
5862 
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)5863 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5864 				const struct hda_fixup *fix, int action)
5865 {
5866 	alc_fixup_headset_mode(codec, fix, action);
5867 	if (action == HDA_FIXUP_ACT_PROBE) {
5868 		struct alc_spec *spec = codec->spec;
5869 		/* toggled via hp_automute_hook */
5870 		spec->gpio_mask |= 0x40;
5871 		spec->gpio_dir |= 0x40;
5872 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5873 	}
5874 }
5875 
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)5876 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5877 					const struct hda_fixup *fix, int action)
5878 {
5879 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5880 		struct alc_spec *spec = codec->spec;
5881 		spec->gen.auto_mute_via_amp = 1;
5882 	}
5883 }
5884 
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)5885 static void alc_fixup_no_shutup(struct hda_codec *codec,
5886 				const struct hda_fixup *fix, int action)
5887 {
5888 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5889 		struct alc_spec *spec = codec->spec;
5890 		spec->no_shutup_pins = 1;
5891 	}
5892 }
5893 
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)5894 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5895 				    const struct hda_fixup *fix, int action)
5896 {
5897 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5898 		struct alc_spec *spec = codec->spec;
5899 		/* Disable AA-loopback as it causes white noise */
5900 		spec->gen.mixer_nid = 0;
5901 	}
5902 }
5903 
5904 /* 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)5905 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5906 				  const struct hda_fixup *fix, int action)
5907 {
5908 	static const struct hda_pintbl pincfgs[] = {
5909 		{ 0x16, 0x21211010 }, /* dock headphone */
5910 		{ 0x19, 0x21a11010 }, /* dock mic */
5911 		{ }
5912 	};
5913 	struct alc_spec *spec = codec->spec;
5914 
5915 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5916 		spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
5917 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5918 		codec->power_save_node = 0; /* avoid click noises */
5919 		snd_hda_apply_pincfgs(codec, pincfgs);
5920 	}
5921 }
5922 
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)5923 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5924 				  const struct hda_fixup *fix, int action)
5925 {
5926 	static const struct hda_pintbl pincfgs[] = {
5927 		{ 0x17, 0x21211010 }, /* dock headphone */
5928 		{ 0x19, 0x21a11010 }, /* dock mic */
5929 		{ }
5930 	};
5931 	struct alc_spec *spec = codec->spec;
5932 
5933 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5934 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5935 		snd_hda_apply_pincfgs(codec, pincfgs);
5936 	} else if (action == HDA_FIXUP_ACT_INIT) {
5937 		/* Enable DOCK device */
5938 		snd_hda_codec_write(codec, 0x17, 0,
5939 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5940 		/* Enable DOCK device */
5941 		snd_hda_codec_write(codec, 0x19, 0,
5942 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5943 	}
5944 }
5945 
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)5946 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5947 				  const struct hda_fixup *fix, int action)
5948 {
5949 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5950 	 * the speaker output becomes too low by some reason on Thinkpads with
5951 	 * ALC298 codec
5952 	 */
5953 	static const hda_nid_t preferred_pairs[] = {
5954 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5955 		0
5956 	};
5957 	struct alc_spec *spec = codec->spec;
5958 
5959 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
5960 		spec->gen.preferred_dacs = preferred_pairs;
5961 }
5962 
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)5963 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5964 				   const struct hda_fixup *fix, int action)
5965 {
5966 	static const hda_nid_t preferred_pairs[] = {
5967 		0x17, 0x02, 0x21, 0x03, 0
5968 	};
5969 	struct alc_spec *spec = codec->spec;
5970 
5971 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
5972 		spec->gen.preferred_dacs = preferred_pairs;
5973 }
5974 
alc_shutup_dell_xps13(struct hda_codec * codec)5975 static void alc_shutup_dell_xps13(struct hda_codec *codec)
5976 {
5977 	struct alc_spec *spec = codec->spec;
5978 	int hp_pin = alc_get_hp_pin(spec);
5979 
5980 	/* Prevent pop noises when headphones are plugged in */
5981 	snd_hda_codec_write(codec, hp_pin, 0,
5982 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5983 	msleep(20);
5984 }
5985 
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)5986 static void alc_fixup_dell_xps13(struct hda_codec *codec,
5987 				const struct hda_fixup *fix, int action)
5988 {
5989 	struct alc_spec *spec = codec->spec;
5990 	struct hda_input_mux *imux = &spec->gen.input_mux;
5991 	int i;
5992 
5993 	switch (action) {
5994 	case HDA_FIXUP_ACT_PRE_PROBE:
5995 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5996 		 * it causes a click noise at start up
5997 		 */
5998 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5999 		spec->shutup = alc_shutup_dell_xps13;
6000 		break;
6001 	case HDA_FIXUP_ACT_PROBE:
6002 		/* Make the internal mic the default input source. */
6003 		for (i = 0; i < imux->num_items; i++) {
6004 			if (spec->gen.imux_pins[i] == 0x12) {
6005 				spec->gen.cur_mux[0] = i;
6006 				break;
6007 			}
6008 		}
6009 		break;
6010 	}
6011 }
6012 
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6013 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6014 				const struct hda_fixup *fix, int action)
6015 {
6016 	struct alc_spec *spec = codec->spec;
6017 
6018 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6019 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6020 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6021 
6022 		/* Disable boost for mic-in permanently. (This code is only called
6023 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6024 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6025 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6026 	} else
6027 		alc_fixup_headset_mode(codec, fix, action);
6028 }
6029 
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6030 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6031 				const struct hda_fixup *fix, int action)
6032 {
6033 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6034 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6035 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6036 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6037 	}
6038 	alc_fixup_headset_mode(codec, fix, action);
6039 }
6040 
6041 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6042 static int find_ext_mic_pin(struct hda_codec *codec)
6043 {
6044 	struct alc_spec *spec = codec->spec;
6045 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6046 	hda_nid_t nid;
6047 	unsigned int defcfg;
6048 	int i;
6049 
6050 	for (i = 0; i < cfg->num_inputs; i++) {
6051 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6052 			continue;
6053 		nid = cfg->inputs[i].pin;
6054 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6055 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6056 			continue;
6057 		return nid;
6058 	}
6059 
6060 	return 0;
6061 }
6062 
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6063 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6064 				    const struct hda_fixup *fix,
6065 				    int action)
6066 {
6067 	struct alc_spec *spec = codec->spec;
6068 
6069 	if (action == HDA_FIXUP_ACT_PROBE) {
6070 		int mic_pin = find_ext_mic_pin(codec);
6071 		int hp_pin = alc_get_hp_pin(spec);
6072 
6073 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6074 			return;
6075 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6076 	}
6077 }
6078 
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6079 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6080 					     const struct hda_fixup *fix,
6081 					     int action)
6082 {
6083 	struct alc_spec *spec = codec->spec;
6084 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6085 	int i;
6086 
6087 	/* The mic boosts on level 2 and 3 are too noisy
6088 	   on the internal mic input.
6089 	   Therefore limit the boost to 0 or 1. */
6090 
6091 	if (action != HDA_FIXUP_ACT_PROBE)
6092 		return;
6093 
6094 	for (i = 0; i < cfg->num_inputs; i++) {
6095 		hda_nid_t nid = cfg->inputs[i].pin;
6096 		unsigned int defcfg;
6097 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6098 			continue;
6099 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6100 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6101 			continue;
6102 
6103 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6104 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6105 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6106 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6107 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6108 	}
6109 }
6110 
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6111 static void alc283_hp_automute_hook(struct hda_codec *codec,
6112 				    struct hda_jack_callback *jack)
6113 {
6114 	struct alc_spec *spec = codec->spec;
6115 	int vref;
6116 
6117 	msleep(200);
6118 	snd_hda_gen_hp_automute(codec, jack);
6119 
6120 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6121 
6122 	msleep(600);
6123 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6124 			    vref);
6125 }
6126 
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6127 static void alc283_fixup_chromebook(struct hda_codec *codec,
6128 				    const struct hda_fixup *fix, int action)
6129 {
6130 	struct alc_spec *spec = codec->spec;
6131 
6132 	switch (action) {
6133 	case HDA_FIXUP_ACT_PRE_PROBE:
6134 		snd_hda_override_wcaps(codec, 0x03, 0);
6135 		/* Disable AA-loopback as it causes white noise */
6136 		spec->gen.mixer_nid = 0;
6137 		break;
6138 	case HDA_FIXUP_ACT_INIT:
6139 		/* MIC2-VREF control */
6140 		/* Set to manual mode */
6141 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6142 		/* Enable Line1 input control by verb */
6143 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6144 		break;
6145 	}
6146 }
6147 
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6148 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6149 				    const struct hda_fixup *fix, int action)
6150 {
6151 	struct alc_spec *spec = codec->spec;
6152 
6153 	switch (action) {
6154 	case HDA_FIXUP_ACT_PRE_PROBE:
6155 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6156 		break;
6157 	case HDA_FIXUP_ACT_INIT:
6158 		/* MIC2-VREF control */
6159 		/* Set to manual mode */
6160 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6161 		break;
6162 	}
6163 }
6164 
6165 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6166 static void asus_tx300_automute(struct hda_codec *codec)
6167 {
6168 	struct alc_spec *spec = codec->spec;
6169 	snd_hda_gen_update_outputs(codec);
6170 	if (snd_hda_jack_detect(codec, 0x1b))
6171 		spec->gen.mute_bits |= (1ULL << 0x14);
6172 }
6173 
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6174 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6175 				    const struct hda_fixup *fix, int action)
6176 {
6177 	struct alc_spec *spec = codec->spec;
6178 	static const struct hda_pintbl dock_pins[] = {
6179 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6180 		{}
6181 	};
6182 
6183 	switch (action) {
6184 	case HDA_FIXUP_ACT_PRE_PROBE:
6185 		spec->init_amp = ALC_INIT_DEFAULT;
6186 		/* TX300 needs to set up GPIO2 for the speaker amp */
6187 		alc_setup_gpio(codec, 0x04);
6188 		snd_hda_apply_pincfgs(codec, dock_pins);
6189 		spec->gen.auto_mute_via_amp = 1;
6190 		spec->gen.automute_hook = asus_tx300_automute;
6191 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6192 						    snd_hda_gen_hp_automute);
6193 		break;
6194 	case HDA_FIXUP_ACT_PROBE:
6195 		spec->init_amp = ALC_INIT_DEFAULT;
6196 		break;
6197 	case HDA_FIXUP_ACT_BUILD:
6198 		/* this is a bit tricky; give more sane names for the main
6199 		 * (tablet) speaker and the dock speaker, respectively
6200 		 */
6201 		rename_ctl(codec, "Speaker Playback Switch",
6202 			   "Dock Speaker Playback Switch");
6203 		rename_ctl(codec, "Bass Speaker Playback Switch",
6204 			   "Speaker Playback Switch");
6205 		break;
6206 	}
6207 }
6208 
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6209 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6210 				       const struct hda_fixup *fix, int action)
6211 {
6212 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6213 		/* DAC node 0x03 is giving mono output. We therefore want to
6214 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6215 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6216 		static const hda_nid_t conn1[] = { 0x0c };
6217 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6218 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6219 	}
6220 }
6221 
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6222 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6223 					const struct hda_fixup *fix, int action)
6224 {
6225 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6226 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6227 		   we can't adjust the speaker's volume since this node does not has
6228 		   Amp-out capability. we change the speaker's route to:
6229 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6230 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6231 		   speaker's volume now. */
6232 
6233 		static const hda_nid_t conn1[] = { 0x0c };
6234 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6235 	}
6236 }
6237 
6238 /* 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)6239 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6240 				      const struct hda_fixup *fix, int action)
6241 {
6242 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6243 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6244 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6245 	}
6246 }
6247 
6248 /* 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)6249 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6250 					  const struct hda_fixup *fix, int action)
6251 {
6252 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6253 		static const hda_nid_t conn[] = { 0x02 };
6254 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6255 	}
6256 }
6257 
6258 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6259 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6260 					  struct hda_jack_callback *jack)
6261 {
6262 	struct alc_spec *spec = codec->spec;
6263 
6264 	snd_hda_gen_hp_automute(codec, jack);
6265 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6266 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6267 			    !spec->gen.hp_jack_present);
6268 }
6269 
6270 /* Manage GPIOs for HP EliteBook Folio 9480m.
6271  *
6272  * GPIO4 is the headphone amplifier power control
6273  * GPIO3 is the audio output mute indicator LED
6274  */
6275 
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6276 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6277 				  const struct hda_fixup *fix,
6278 				  int action)
6279 {
6280 	struct alc_spec *spec = codec->spec;
6281 
6282 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6283 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6284 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6285 		spec->gpio_mask |= 0x10;
6286 		spec->gpio_dir |= 0x10;
6287 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6288 	}
6289 }
6290 
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6291 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6292 				   const struct hda_fixup *fix,
6293 				   int action)
6294 {
6295 	struct alc_spec *spec = codec->spec;
6296 
6297 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6298 		spec->gpio_mask |= 0x04;
6299 		spec->gpio_dir |= 0x04;
6300 		/* set data bit low */
6301 	}
6302 }
6303 
6304 /* Quirk for Thinkpad X1 7th and 8th Gen
6305  * The following fixed routing needed
6306  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6307  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6308  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6309  */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6310 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6311 					  const struct hda_fixup *fix, int action)
6312 {
6313 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6314 	static const hda_nid_t preferred_pairs[] = {
6315 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6316 	};
6317 	struct alc_spec *spec = codec->spec;
6318 
6319 	switch (action) {
6320 	case HDA_FIXUP_ACT_PRE_PROBE:
6321 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6322 		spec->gen.preferred_dacs = preferred_pairs;
6323 		break;
6324 	case HDA_FIXUP_ACT_BUILD:
6325 		/* The generic parser creates somewhat unintuitive volume ctls
6326 		 * with the fixed routing above, and the shared DAC2 may be
6327 		 * confusing for PA.
6328 		 * Rename those to unique names so that PA doesn't touch them
6329 		 * and use only Master volume.
6330 		 */
6331 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6332 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6333 		break;
6334 	}
6335 }
6336 
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6337 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6338 					 const struct hda_fixup *fix,
6339 					 int action)
6340 {
6341 	alc_fixup_dual_codecs(codec, fix, action);
6342 	switch (action) {
6343 	case HDA_FIXUP_ACT_PRE_PROBE:
6344 		/* override card longname to provide a unique UCM profile */
6345 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6346 		break;
6347 	case HDA_FIXUP_ACT_BUILD:
6348 		/* rename Capture controls depending on the codec */
6349 		rename_ctl(codec, "Capture Volume",
6350 			   codec->addr == 0 ?
6351 			   "Rear-Panel Capture Volume" :
6352 			   "Front-Panel Capture Volume");
6353 		rename_ctl(codec, "Capture Switch",
6354 			   codec->addr == 0 ?
6355 			   "Rear-Panel Capture Switch" :
6356 			   "Front-Panel Capture Switch");
6357 		break;
6358 	}
6359 }
6360 
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6361 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6362 				      const struct hda_fixup *fix, int action)
6363 {
6364 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6365 		return;
6366 
6367 	codec->power_save_node = 1;
6368 }
6369 
6370 /* 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)6371 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6372 				    const struct hda_fixup *fix, int action)
6373 {
6374 	struct alc_spec *spec = codec->spec;
6375 	static const hda_nid_t preferred_pairs[] = {
6376 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6377 		0
6378 	};
6379 
6380 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6381 		return;
6382 
6383 	spec->gen.preferred_dacs = preferred_pairs;
6384 	spec->gen.auto_mute_via_amp = 1;
6385 	codec->power_save_node = 0;
6386 }
6387 
6388 /* 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)6389 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6390 				    const struct hda_fixup *fix, int action)
6391 {
6392 	static const hda_nid_t preferred_pairs[] = {
6393 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6394 	};
6395 	struct alc_spec *spec = codec->spec;
6396 
6397 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6398 		spec->gen.preferred_dacs = preferred_pairs;
6399 		spec->gen.obey_preferred_dacs = 1;
6400 	}
6401 }
6402 
6403 /* 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)6404 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6405 			      const struct hda_fixup *fix, int action)
6406 {
6407 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6408 		return;
6409 
6410 	snd_hda_override_wcaps(codec, 0x03, 0);
6411 }
6412 
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6413 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6414 {
6415 	switch (codec->core.vendor_id) {
6416 	case 0x10ec0274:
6417 	case 0x10ec0294:
6418 	case 0x10ec0225:
6419 	case 0x10ec0295:
6420 	case 0x10ec0299:
6421 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6422 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6423 		break;
6424 	case 0x10ec0230:
6425 	case 0x10ec0235:
6426 	case 0x10ec0236:
6427 	case 0x10ec0255:
6428 	case 0x10ec0256:
6429 	case 0x10ec0257:
6430 	case 0x19e58326:
6431 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6432 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6433 		break;
6434 	}
6435 }
6436 
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6437 static void alc295_fixup_chromebook(struct hda_codec *codec,
6438 				    const struct hda_fixup *fix, int action)
6439 {
6440 	struct alc_spec *spec = codec->spec;
6441 
6442 	switch (action) {
6443 	case HDA_FIXUP_ACT_PRE_PROBE:
6444 		spec->ultra_low_power = true;
6445 		break;
6446 	case HDA_FIXUP_ACT_INIT:
6447 		alc_combo_jack_hp_jd_restart(codec);
6448 		break;
6449 	}
6450 }
6451 
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6452 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6453 				  const struct hda_fixup *fix, int action)
6454 {
6455 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6456 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6457 }
6458 
6459 
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6460 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6461 					struct hda_jack_callback *cb)
6462 {
6463 	/* The Windows driver sets the codec up in a very different way where
6464 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6465 	 */
6466 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6467 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6468 	else
6469 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6470 }
6471 
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6472 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6473 					const struct hda_fixup *fix, int action)
6474 {
6475 	/* Pin 0x21: headphones/headset mic */
6476 	if (!is_jack_detectable(codec, 0x21))
6477 		return;
6478 
6479 	switch (action) {
6480 	case HDA_FIXUP_ACT_PRE_PROBE:
6481 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6482 				alc294_gx502_toggle_output);
6483 		break;
6484 	case HDA_FIXUP_ACT_INIT:
6485 		/* Make sure to start in a correct state, i.e. if
6486 		 * headphones have been plugged in before powering up the system
6487 		 */
6488 		alc294_gx502_toggle_output(codec, NULL);
6489 		break;
6490 	}
6491 }
6492 
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6493 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6494 				       struct hda_jack_callback *cb)
6495 {
6496 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6497 	 * responsible from changes between speakers and headphones
6498 	 */
6499 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6500 		alc_write_coef_idx(codec, 0x10, 0x8420);
6501 	else
6502 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6503 }
6504 
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6505 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6506 				  const struct hda_fixup *fix, int action)
6507 {
6508 	if (!is_jack_detectable(codec, 0x21))
6509 		return;
6510 
6511 	switch (action) {
6512 	case HDA_FIXUP_ACT_PRE_PROBE:
6513 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6514 				alc294_gu502_toggle_output);
6515 		break;
6516 	case HDA_FIXUP_ACT_INIT:
6517 		alc294_gu502_toggle_output(codec, NULL);
6518 		break;
6519 	}
6520 }
6521 
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6522 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6523 			      const struct hda_fixup *fix, int action)
6524 {
6525 	if (action != HDA_FIXUP_ACT_INIT)
6526 		return;
6527 
6528 	msleep(100);
6529 	alc_write_coef_idx(codec, 0x65, 0x0);
6530 }
6531 
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6532 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6533 				    const struct hda_fixup *fix, int action)
6534 {
6535 	switch (action) {
6536 	case HDA_FIXUP_ACT_INIT:
6537 		alc_combo_jack_hp_jd_restart(codec);
6538 		break;
6539 	}
6540 }
6541 
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6542 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6543 				    const struct hda_fixup *fix, int action)
6544 {
6545 	struct alc_spec *spec = codec->spec;
6546 
6547 	switch (action) {
6548 	case HDA_FIXUP_ACT_PRE_PROBE:
6549 		/* Mic RING SLEEVE swap for combo jack */
6550 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6551 		spec->no_internal_mic_pin = true;
6552 		break;
6553 	case HDA_FIXUP_ACT_INIT:
6554 		alc_combo_jack_hp_jd_restart(codec);
6555 		break;
6556 	}
6557 }
6558 
6559 /* GPIO1 = amplifier on/off
6560  * GPIO3 = mic mute LED
6561  */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6562 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6563 					  const struct hda_fixup *fix, int action)
6564 {
6565 	static const hda_nid_t conn[] = { 0x02 };
6566 
6567 	struct alc_spec *spec = codec->spec;
6568 	static const struct hda_pintbl pincfgs[] = {
6569 		{ 0x14, 0x90170110 },  /* front/high speakers */
6570 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6571 		{ }
6572 	};
6573 
6574 	//enable micmute led
6575 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6576 
6577 	switch (action) {
6578 	case HDA_FIXUP_ACT_PRE_PROBE:
6579 		spec->micmute_led_polarity = 1;
6580 		/* needed for amp of back speakers */
6581 		spec->gpio_mask |= 0x01;
6582 		spec->gpio_dir |= 0x01;
6583 		snd_hda_apply_pincfgs(codec, pincfgs);
6584 		/* share DAC to have unified volume control */
6585 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6586 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6587 		break;
6588 	case HDA_FIXUP_ACT_INIT:
6589 		/* need to toggle GPIO to enable the amp of back speakers */
6590 		alc_update_gpio_data(codec, 0x01, true);
6591 		msleep(100);
6592 		alc_update_gpio_data(codec, 0x01, false);
6593 		break;
6594 	}
6595 }
6596 
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6597 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6598 					  const struct hda_fixup *fix, int action)
6599 {
6600 	static const hda_nid_t conn[] = { 0x02 };
6601 	static const struct hda_pintbl pincfgs[] = {
6602 		{ 0x14, 0x90170110 },  /* rear speaker */
6603 		{ }
6604 	};
6605 
6606 	switch (action) {
6607 	case HDA_FIXUP_ACT_PRE_PROBE:
6608 		snd_hda_apply_pincfgs(codec, pincfgs);
6609 		/* force front speaker to DAC1 */
6610 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6611 		break;
6612 	}
6613 }
6614 
6615 /* for hda_fixup_thinkpad_acpi() */
6616 #include "thinkpad_helper.c"
6617 
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)6618 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6619 				    const struct hda_fixup *fix, int action)
6620 {
6621 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6622 	hda_fixup_thinkpad_acpi(codec, fix, action);
6623 }
6624 
6625 /* 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)6626 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6627 						  const struct hda_fixup *fix,
6628 						  int action)
6629 {
6630 	struct alc_spec *spec = codec->spec;
6631 
6632 	switch (action) {
6633 	case HDA_FIXUP_ACT_PRE_PROBE:
6634 		spec->gen.suppress_auto_mute = 1;
6635 		break;
6636 	}
6637 }
6638 
6639 /* for alc295_fixup_hp_top_speakers */
6640 #include "hp_x360_helper.c"
6641 
6642 /* for alc285_fixup_ideapad_s740_coef() */
6643 #include "ideapad_s740_helper.c"
6644 
6645 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6646 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6647 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6648 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6649 	{}
6650 };
6651 
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)6652 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6653 					   const struct hda_fixup *fix,
6654 					   int action)
6655 {
6656 	/*
6657 	 * A certain other OS sets these coeffs to different values. On at least
6658 	 * one TongFang barebone these settings might survive even a cold
6659 	 * reboot. So to restore a clean slate the values are explicitly reset
6660 	 * to default here. Without this, the external microphone is always in a
6661 	 * plugged-in state, while the internal microphone is always in an
6662 	 * unplugged state, breaking the ability to use the internal microphone.
6663 	 */
6664 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
6665 }
6666 
6667 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6668 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6669 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6670 	WRITE_COEF(0x49, 0x0149),
6671 	{}
6672 };
6673 
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6674 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6675 				       const struct hda_fixup *fix,
6676 				       int action)
6677 {
6678 	/*
6679 	 * The audio jack input and output is not detected on the ASRock NUC Box
6680 	 * 1100 series when cold booting without this fix. Warm rebooting from a
6681 	 * certain other OS makes the audio functional, as COEF settings are
6682 	 * preserved in this case. This fix sets these altered COEF values as
6683 	 * the default.
6684 	 */
6685 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6686 }
6687 
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6688 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6689 						    const struct hda_fixup *fix,
6690 						    int action)
6691 {
6692 	/*
6693 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6694 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6695 	 * needs an additional quirk for sound working after suspend and resume.
6696 	 */
6697 	if (codec->core.vendor_id == 0x10ec0256) {
6698 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6699 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6700 	} else {
6701 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6702 	}
6703 }
6704 
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6705 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
6706 					  const struct hda_fixup *fix, int action)
6707 {
6708 	static const struct hda_pintbl pincfgs[] = {
6709 		{ 0x14, 0x90170151 },
6710 		{ 0x17, 0x90170150 },
6711 		{ }
6712 	};
6713 	static const hda_nid_t conn[] = { 0x02, 0x03 };
6714 	static const hda_nid_t preferred_pairs[] = {
6715 		0x14, 0x02,
6716 		0x17, 0x03,
6717 		0x21, 0x02,
6718 		0
6719 	};
6720 	struct alc_spec *spec = codec->spec;
6721 
6722 	alc_fixup_no_shutup(codec, fix, action);
6723 
6724 	switch (action) {
6725 	case HDA_FIXUP_ACT_PRE_PROBE:
6726 		snd_hda_apply_pincfgs(codec, pincfgs);
6727 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6728 		spec->gen.preferred_dacs = preferred_pairs;
6729 		break;
6730 	}
6731 }
6732 
6733 enum {
6734 	ALC269_FIXUP_GPIO2,
6735 	ALC269_FIXUP_SONY_VAIO,
6736 	ALC275_FIXUP_SONY_VAIO_GPIO2,
6737 	ALC269_FIXUP_DELL_M101Z,
6738 	ALC269_FIXUP_SKU_IGNORE,
6739 	ALC269_FIXUP_ASUS_G73JW,
6740 	ALC269_FIXUP_LENOVO_EAPD,
6741 	ALC275_FIXUP_SONY_HWEQ,
6742 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
6743 	ALC271_FIXUP_DMIC,
6744 	ALC269_FIXUP_PCM_44K,
6745 	ALC269_FIXUP_STEREO_DMIC,
6746 	ALC269_FIXUP_HEADSET_MIC,
6747 	ALC269_FIXUP_QUANTA_MUTE,
6748 	ALC269_FIXUP_LIFEBOOK,
6749 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
6750 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
6751 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
6752 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
6753 	ALC269_FIXUP_AMIC,
6754 	ALC269_FIXUP_DMIC,
6755 	ALC269VB_FIXUP_AMIC,
6756 	ALC269VB_FIXUP_DMIC,
6757 	ALC269_FIXUP_HP_MUTE_LED,
6758 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
6759 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
6760 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
6761 	ALC269_FIXUP_HP_GPIO_LED,
6762 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
6763 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
6764 	ALC269_FIXUP_INV_DMIC,
6765 	ALC269_FIXUP_LENOVO_DOCK,
6766 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
6767 	ALC269_FIXUP_NO_SHUTUP,
6768 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
6769 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
6770 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6771 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6772 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6773 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6774 	ALC269_FIXUP_HEADSET_MODE,
6775 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
6776 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
6777 	ALC269_FIXUP_ASUS_X101_FUNC,
6778 	ALC269_FIXUP_ASUS_X101_VERB,
6779 	ALC269_FIXUP_ASUS_X101,
6780 	ALC271_FIXUP_AMIC_MIC2,
6781 	ALC271_FIXUP_HP_GATE_MIC_JACK,
6782 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
6783 	ALC269_FIXUP_ACER_AC700,
6784 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
6785 	ALC269VB_FIXUP_ASUS_ZENBOOK,
6786 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
6787 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
6788 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
6789 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
6790 	ALC283_FIXUP_CHROME_BOOK,
6791 	ALC283_FIXUP_SENSE_COMBO_JACK,
6792 	ALC282_FIXUP_ASUS_TX300,
6793 	ALC283_FIXUP_INT_MIC,
6794 	ALC290_FIXUP_MONO_SPEAKERS,
6795 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6796 	ALC290_FIXUP_SUBWOOFER,
6797 	ALC290_FIXUP_SUBWOOFER_HSJACK,
6798 	ALC269_FIXUP_THINKPAD_ACPI,
6799 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
6800 	ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
6801 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
6802 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6803 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6804 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
6805 	ALC255_FIXUP_HEADSET_MODE,
6806 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
6807 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
6808 	ALC292_FIXUP_TPT440_DOCK,
6809 	ALC292_FIXUP_TPT440,
6810 	ALC283_FIXUP_HEADSET_MIC,
6811 	ALC255_FIXUP_MIC_MUTE_LED,
6812 	ALC282_FIXUP_ASPIRE_V5_PINS,
6813 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
6814 	ALC280_FIXUP_HP_GPIO4,
6815 	ALC286_FIXUP_HP_GPIO_LED,
6816 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
6817 	ALC280_FIXUP_HP_DOCK_PINS,
6818 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
6819 	ALC280_FIXUP_HP_9480M,
6820 	ALC245_FIXUP_HP_X360_AMP,
6821 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
6822 	ALC288_FIXUP_DELL_HEADSET_MODE,
6823 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
6824 	ALC288_FIXUP_DELL_XPS_13,
6825 	ALC288_FIXUP_DISABLE_AAMIX,
6826 	ALC292_FIXUP_DELL_E7X_AAMIX,
6827 	ALC292_FIXUP_DELL_E7X,
6828 	ALC292_FIXUP_DISABLE_AAMIX,
6829 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
6830 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
6831 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6832 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6833 	ALC275_FIXUP_DELL_XPS,
6834 	ALC293_FIXUP_LENOVO_SPK_NOISE,
6835 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
6836 	ALC255_FIXUP_DELL_SPK_NOISE,
6837 	ALC225_FIXUP_DISABLE_MIC_VREF,
6838 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6839 	ALC295_FIXUP_DISABLE_DAC3,
6840 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
6841 	ALC280_FIXUP_HP_HEADSET_MIC,
6842 	ALC221_FIXUP_HP_FRONT_MIC,
6843 	ALC292_FIXUP_TPT460,
6844 	ALC298_FIXUP_SPK_VOLUME,
6845 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
6846 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
6847 	ALC269_FIXUP_ATIV_BOOK_8,
6848 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
6849 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
6850 	ALC256_FIXUP_ASUS_HEADSET_MODE,
6851 	ALC256_FIXUP_ASUS_MIC,
6852 	ALC256_FIXUP_ASUS_AIO_GPIO2,
6853 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6854 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
6855 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
6856 	ALC233_FIXUP_ACER_HEADSET_MIC,
6857 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
6858 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
6859 	ALC225_FIXUP_S3_POP_NOISE,
6860 	ALC700_FIXUP_INTEL_REFERENCE,
6861 	ALC274_FIXUP_DELL_BIND_DACS,
6862 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
6863 	ALC298_FIXUP_TPT470_DOCK_FIX,
6864 	ALC298_FIXUP_TPT470_DOCK,
6865 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
6866 	ALC255_FIXUP_DELL_HEADSET_MIC,
6867 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
6868 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
6869 	ALC295_FIXUP_HP_X360,
6870 	ALC221_FIXUP_HP_HEADSET_MIC,
6871 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
6872 	ALC295_FIXUP_HP_AUTO_MUTE,
6873 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
6874 	ALC294_FIXUP_ASUS_MIC,
6875 	ALC294_FIXUP_ASUS_HEADSET_MIC,
6876 	ALC294_FIXUP_ASUS_SPK,
6877 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
6878 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
6879 	ALC255_FIXUP_ACER_HEADSET_MIC,
6880 	ALC295_FIXUP_CHROME_BOOK,
6881 	ALC225_FIXUP_HEADSET_JACK,
6882 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6883 	ALC225_FIXUP_WYSE_AUTO_MUTE,
6884 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
6885 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
6886 	ALC256_FIXUP_ASUS_HEADSET_MIC,
6887 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
6888 	ALC299_FIXUP_PREDATOR_SPK,
6889 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
6890 	ALC289_FIXUP_DELL_SPK2,
6891 	ALC289_FIXUP_DUAL_SPK,
6892 	ALC294_FIXUP_SPK2_TO_DAC1,
6893 	ALC294_FIXUP_ASUS_DUAL_SPK,
6894 	ALC285_FIXUP_THINKPAD_X1_GEN7,
6895 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
6896 	ALC294_FIXUP_ASUS_HPE,
6897 	ALC294_FIXUP_ASUS_COEF_1B,
6898 	ALC294_FIXUP_ASUS_GX502_HP,
6899 	ALC294_FIXUP_ASUS_GX502_PINS,
6900 	ALC294_FIXUP_ASUS_GX502_VERBS,
6901 	ALC294_FIXUP_ASUS_GU502_HP,
6902 	ALC294_FIXUP_ASUS_GU502_PINS,
6903 	ALC294_FIXUP_ASUS_GU502_VERBS,
6904 	ALC294_FIXUP_ASUS_G513_PINS,
6905 	ALC285_FIXUP_ASUS_G533Z_PINS,
6906 	ALC285_FIXUP_HP_GPIO_LED,
6907 	ALC285_FIXUP_HP_MUTE_LED,
6908 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
6909 	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
6910 	ALC236_FIXUP_HP_GPIO_LED,
6911 	ALC236_FIXUP_HP_MUTE_LED,
6912 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
6913 	ALC298_FIXUP_SAMSUNG_AMP,
6914 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
6915 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
6916 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
6917 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6918 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
6919 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
6920 	ALC289_FIXUP_ASUS_GA401,
6921 	ALC289_FIXUP_ASUS_GA502,
6922 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
6923 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
6924 	ALC269_FIXUP_CZC_B20,
6925 	ALC269_FIXUP_CZC_TMI,
6926 	ALC269_FIXUP_CZC_L101,
6927 	ALC269_FIXUP_LEMOTE_A1802,
6928 	ALC269_FIXUP_LEMOTE_A190X,
6929 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
6930 	ALC233_FIXUP_INTEL_NUC8_DMIC,
6931 	ALC233_FIXUP_INTEL_NUC8_BOOST,
6932 	ALC256_FIXUP_INTEL_NUC10,
6933 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
6934 	ALC274_FIXUP_HP_MIC,
6935 	ALC274_FIXUP_HP_HEADSET_MIC,
6936 	ALC274_FIXUP_HP_ENVY_GPIO,
6937 	ALC256_FIXUP_ASUS_HPE,
6938 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
6939 	ALC287_FIXUP_HP_GPIO_LED,
6940 	ALC256_FIXUP_HP_HEADSET_MIC,
6941 	ALC245_FIXUP_HP_GPIO_LED,
6942 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
6943 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
6944 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
6945 	ALC256_FIXUP_ACER_HEADSET_MIC,
6946 	ALC285_FIXUP_IDEAPAD_S740_COEF,
6947 	ALC295_FIXUP_ASUS_DACS,
6948 	ALC295_FIXUP_HP_OMEN,
6949 	ALC285_FIXUP_HP_SPECTRE_X360,
6950 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
6951 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
6952 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
6953 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
6954 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6955 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6956 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
6957 	ALC298_FIXUP_LENOVO_C940_DUET7,
6958 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
6959 	ALC256_FIXUP_SET_COEF_DEFAULTS,
6960 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
6961 	ALC233_FIXUP_NO_AUDIO_JACK,
6962 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
6963 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
6964 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
6965 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
6966 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
6967 	ALC236_FIXUP_DELL_DUAL_CODECS,
6968 };
6969 
6970 /* A special fixup for Lenovo C940 and Yoga Duet 7;
6971  * both have the very same PCI SSID, and we need to apply different fixups
6972  * depending on the codec ID
6973  */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6974 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
6975 					   const struct hda_fixup *fix,
6976 					   int action)
6977 {
6978 	int id;
6979 
6980 	if (codec->core.vendor_id == 0x10ec0298)
6981 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
6982 	else
6983 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
6984 	__snd_hda_apply_fixup(codec, id, action, 0);
6985 }
6986 
6987 static const struct hda_fixup alc269_fixups[] = {
6988 	[ALC269_FIXUP_GPIO2] = {
6989 		.type = HDA_FIXUP_FUNC,
6990 		.v.func = alc_fixup_gpio2,
6991 	},
6992 	[ALC269_FIXUP_SONY_VAIO] = {
6993 		.type = HDA_FIXUP_PINCTLS,
6994 		.v.pins = (const struct hda_pintbl[]) {
6995 			{0x19, PIN_VREFGRD},
6996 			{}
6997 		}
6998 	},
6999 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7000 		.type = HDA_FIXUP_FUNC,
7001 		.v.func = alc275_fixup_gpio4_off,
7002 		.chained = true,
7003 		.chain_id = ALC269_FIXUP_SONY_VAIO
7004 	},
7005 	[ALC269_FIXUP_DELL_M101Z] = {
7006 		.type = HDA_FIXUP_VERBS,
7007 		.v.verbs = (const struct hda_verb[]) {
7008 			/* Enables internal speaker */
7009 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
7010 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7011 			{}
7012 		}
7013 	},
7014 	[ALC269_FIXUP_SKU_IGNORE] = {
7015 		.type = HDA_FIXUP_FUNC,
7016 		.v.func = alc_fixup_sku_ignore,
7017 	},
7018 	[ALC269_FIXUP_ASUS_G73JW] = {
7019 		.type = HDA_FIXUP_PINS,
7020 		.v.pins = (const struct hda_pintbl[]) {
7021 			{ 0x17, 0x99130111 }, /* subwoofer */
7022 			{ }
7023 		}
7024 	},
7025 	[ALC269_FIXUP_LENOVO_EAPD] = {
7026 		.type = HDA_FIXUP_VERBS,
7027 		.v.verbs = (const struct hda_verb[]) {
7028 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7029 			{}
7030 		}
7031 	},
7032 	[ALC275_FIXUP_SONY_HWEQ] = {
7033 		.type = HDA_FIXUP_FUNC,
7034 		.v.func = alc269_fixup_hweq,
7035 		.chained = true,
7036 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7037 	},
7038 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7039 		.type = HDA_FIXUP_FUNC,
7040 		.v.func = alc_fixup_disable_aamix,
7041 		.chained = true,
7042 		.chain_id = ALC269_FIXUP_SONY_VAIO
7043 	},
7044 	[ALC271_FIXUP_DMIC] = {
7045 		.type = HDA_FIXUP_FUNC,
7046 		.v.func = alc271_fixup_dmic,
7047 	},
7048 	[ALC269_FIXUP_PCM_44K] = {
7049 		.type = HDA_FIXUP_FUNC,
7050 		.v.func = alc269_fixup_pcm_44k,
7051 		.chained = true,
7052 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7053 	},
7054 	[ALC269_FIXUP_STEREO_DMIC] = {
7055 		.type = HDA_FIXUP_FUNC,
7056 		.v.func = alc269_fixup_stereo_dmic,
7057 	},
7058 	[ALC269_FIXUP_HEADSET_MIC] = {
7059 		.type = HDA_FIXUP_FUNC,
7060 		.v.func = alc269_fixup_headset_mic,
7061 	},
7062 	[ALC269_FIXUP_QUANTA_MUTE] = {
7063 		.type = HDA_FIXUP_FUNC,
7064 		.v.func = alc269_fixup_quanta_mute,
7065 	},
7066 	[ALC269_FIXUP_LIFEBOOK] = {
7067 		.type = HDA_FIXUP_PINS,
7068 		.v.pins = (const struct hda_pintbl[]) {
7069 			{ 0x1a, 0x2101103f }, /* dock line-out */
7070 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
7071 			{ }
7072 		},
7073 		.chained = true,
7074 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7075 	},
7076 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7077 		.type = HDA_FIXUP_PINS,
7078 		.v.pins = (const struct hda_pintbl[]) {
7079 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7080 			{ }
7081 		},
7082 	},
7083 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7084 		.type = HDA_FIXUP_PINS,
7085 		.v.pins = (const struct hda_pintbl[]) {
7086 			{ 0x21, 0x0221102f }, /* HP out */
7087 			{ }
7088 		},
7089 	},
7090 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7091 		.type = HDA_FIXUP_FUNC,
7092 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7093 	},
7094 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7095 		.type = HDA_FIXUP_FUNC,
7096 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7097 	},
7098 	[ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
7099 		.type = HDA_FIXUP_PINS,
7100 		.v.pins = (const struct hda_pintbl[]) {
7101 			{ 0x18, 0x03a19020 }, /* headset mic */
7102 			{ 0x1b, 0x90170150 }, /* speaker */
7103 			{ }
7104 		},
7105 	},
7106 	[ALC269_FIXUP_AMIC] = {
7107 		.type = HDA_FIXUP_PINS,
7108 		.v.pins = (const struct hda_pintbl[]) {
7109 			{ 0x14, 0x99130110 }, /* speaker */
7110 			{ 0x15, 0x0121401f }, /* HP out */
7111 			{ 0x18, 0x01a19c20 }, /* mic */
7112 			{ 0x19, 0x99a3092f }, /* int-mic */
7113 			{ }
7114 		},
7115 	},
7116 	[ALC269_FIXUP_DMIC] = {
7117 		.type = HDA_FIXUP_PINS,
7118 		.v.pins = (const struct hda_pintbl[]) {
7119 			{ 0x12, 0x99a3092f }, /* int-mic */
7120 			{ 0x14, 0x99130110 }, /* speaker */
7121 			{ 0x15, 0x0121401f }, /* HP out */
7122 			{ 0x18, 0x01a19c20 }, /* mic */
7123 			{ }
7124 		},
7125 	},
7126 	[ALC269VB_FIXUP_AMIC] = {
7127 		.type = HDA_FIXUP_PINS,
7128 		.v.pins = (const struct hda_pintbl[]) {
7129 			{ 0x14, 0x99130110 }, /* speaker */
7130 			{ 0x18, 0x01a19c20 }, /* mic */
7131 			{ 0x19, 0x99a3092f }, /* int-mic */
7132 			{ 0x21, 0x0121401f }, /* HP out */
7133 			{ }
7134 		},
7135 	},
7136 	[ALC269VB_FIXUP_DMIC] = {
7137 		.type = HDA_FIXUP_PINS,
7138 		.v.pins = (const struct hda_pintbl[]) {
7139 			{ 0x12, 0x99a3092f }, /* int-mic */
7140 			{ 0x14, 0x99130110 }, /* speaker */
7141 			{ 0x18, 0x01a19c20 }, /* mic */
7142 			{ 0x21, 0x0121401f }, /* HP out */
7143 			{ }
7144 		},
7145 	},
7146 	[ALC269_FIXUP_HP_MUTE_LED] = {
7147 		.type = HDA_FIXUP_FUNC,
7148 		.v.func = alc269_fixup_hp_mute_led,
7149 	},
7150 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7151 		.type = HDA_FIXUP_FUNC,
7152 		.v.func = alc269_fixup_hp_mute_led_mic1,
7153 	},
7154 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7155 		.type = HDA_FIXUP_FUNC,
7156 		.v.func = alc269_fixup_hp_mute_led_mic2,
7157 	},
7158 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7159 		.type = HDA_FIXUP_FUNC,
7160 		.v.func = alc269_fixup_hp_mute_led_mic3,
7161 		.chained = true,
7162 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7163 	},
7164 	[ALC269_FIXUP_HP_GPIO_LED] = {
7165 		.type = HDA_FIXUP_FUNC,
7166 		.v.func = alc269_fixup_hp_gpio_led,
7167 	},
7168 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7169 		.type = HDA_FIXUP_FUNC,
7170 		.v.func = alc269_fixup_hp_gpio_mic1_led,
7171 	},
7172 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7173 		.type = HDA_FIXUP_FUNC,
7174 		.v.func = alc269_fixup_hp_line1_mic1_led,
7175 	},
7176 	[ALC269_FIXUP_INV_DMIC] = {
7177 		.type = HDA_FIXUP_FUNC,
7178 		.v.func = alc_fixup_inv_dmic,
7179 	},
7180 	[ALC269_FIXUP_NO_SHUTUP] = {
7181 		.type = HDA_FIXUP_FUNC,
7182 		.v.func = alc_fixup_no_shutup,
7183 	},
7184 	[ALC269_FIXUP_LENOVO_DOCK] = {
7185 		.type = HDA_FIXUP_PINS,
7186 		.v.pins = (const struct hda_pintbl[]) {
7187 			{ 0x19, 0x23a11040 }, /* dock mic */
7188 			{ 0x1b, 0x2121103f }, /* dock headphone */
7189 			{ }
7190 		},
7191 		.chained = true,
7192 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7193 	},
7194 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7195 		.type = HDA_FIXUP_FUNC,
7196 		.v.func = alc269_fixup_limit_int_mic_boost,
7197 		.chained = true,
7198 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
7199 	},
7200 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7201 		.type = HDA_FIXUP_FUNC,
7202 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7203 		.chained = true,
7204 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7205 	},
7206 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7207 		.type = HDA_FIXUP_PINS,
7208 		.v.pins = (const struct hda_pintbl[]) {
7209 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7210 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7211 			{ }
7212 		},
7213 		.chained = true,
7214 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7215 	},
7216 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7217 		.type = HDA_FIXUP_PINS,
7218 		.v.pins = (const struct hda_pintbl[]) {
7219 			{ 0x16, 0x21014020 }, /* dock line out */
7220 			{ 0x19, 0x21a19030 }, /* dock mic */
7221 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7222 			{ }
7223 		},
7224 		.chained = true,
7225 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7226 	},
7227 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7228 		.type = HDA_FIXUP_PINS,
7229 		.v.pins = (const struct hda_pintbl[]) {
7230 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7231 			{ }
7232 		},
7233 		.chained = true,
7234 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7235 	},
7236 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7237 		.type = HDA_FIXUP_PINS,
7238 		.v.pins = (const struct hda_pintbl[]) {
7239 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7240 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7241 			{ }
7242 		},
7243 		.chained = true,
7244 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7245 	},
7246 	[ALC269_FIXUP_HEADSET_MODE] = {
7247 		.type = HDA_FIXUP_FUNC,
7248 		.v.func = alc_fixup_headset_mode,
7249 		.chained = true,
7250 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7251 	},
7252 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7253 		.type = HDA_FIXUP_FUNC,
7254 		.v.func = alc_fixup_headset_mode_no_hp_mic,
7255 	},
7256 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7257 		.type = HDA_FIXUP_PINS,
7258 		.v.pins = (const struct hda_pintbl[]) {
7259 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7260 			{ }
7261 		},
7262 		.chained = true,
7263 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
7264 	},
7265 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7266 		.type = HDA_FIXUP_PINS,
7267 		.v.pins = (const struct hda_pintbl[]) {
7268 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7269 			{ }
7270 		},
7271 		.chained = true,
7272 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7273 	},
7274 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7275 		.type = HDA_FIXUP_PINS,
7276 		.v.pins = (const struct hda_pintbl[]) {
7277 			{0x12, 0x90a60130},
7278 			{0x13, 0x40000000},
7279 			{0x14, 0x90170110},
7280 			{0x18, 0x411111f0},
7281 			{0x19, 0x04a11040},
7282 			{0x1a, 0x411111f0},
7283 			{0x1b, 0x90170112},
7284 			{0x1d, 0x40759a05},
7285 			{0x1e, 0x411111f0},
7286 			{0x21, 0x04211020},
7287 			{ }
7288 		},
7289 		.chained = true,
7290 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7291 	},
7292 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7293 		.type = HDA_FIXUP_FUNC,
7294 		.v.func = alc298_fixup_huawei_mbx_stereo,
7295 		.chained = true,
7296 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7297 	},
7298 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
7299 		.type = HDA_FIXUP_FUNC,
7300 		.v.func = alc269_fixup_x101_headset_mic,
7301 	},
7302 	[ALC269_FIXUP_ASUS_X101_VERB] = {
7303 		.type = HDA_FIXUP_VERBS,
7304 		.v.verbs = (const struct hda_verb[]) {
7305 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7306 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7307 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
7308 			{ }
7309 		},
7310 		.chained = true,
7311 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7312 	},
7313 	[ALC269_FIXUP_ASUS_X101] = {
7314 		.type = HDA_FIXUP_PINS,
7315 		.v.pins = (const struct hda_pintbl[]) {
7316 			{ 0x18, 0x04a1182c }, /* Headset mic */
7317 			{ }
7318 		},
7319 		.chained = true,
7320 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
7321 	},
7322 	[ALC271_FIXUP_AMIC_MIC2] = {
7323 		.type = HDA_FIXUP_PINS,
7324 		.v.pins = (const struct hda_pintbl[]) {
7325 			{ 0x14, 0x99130110 }, /* speaker */
7326 			{ 0x19, 0x01a19c20 }, /* mic */
7327 			{ 0x1b, 0x99a7012f }, /* int-mic */
7328 			{ 0x21, 0x0121401f }, /* HP out */
7329 			{ }
7330 		},
7331 	},
7332 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7333 		.type = HDA_FIXUP_FUNC,
7334 		.v.func = alc271_hp_gate_mic_jack,
7335 		.chained = true,
7336 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
7337 	},
7338 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7339 		.type = HDA_FIXUP_FUNC,
7340 		.v.func = alc269_fixup_limit_int_mic_boost,
7341 		.chained = true,
7342 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7343 	},
7344 	[ALC269_FIXUP_ACER_AC700] = {
7345 		.type = HDA_FIXUP_PINS,
7346 		.v.pins = (const struct hda_pintbl[]) {
7347 			{ 0x12, 0x99a3092f }, /* int-mic */
7348 			{ 0x14, 0x99130110 }, /* speaker */
7349 			{ 0x18, 0x03a11c20 }, /* mic */
7350 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
7351 			{ 0x21, 0x0321101f }, /* HP out */
7352 			{ }
7353 		},
7354 		.chained = true,
7355 		.chain_id = ALC271_FIXUP_DMIC,
7356 	},
7357 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7358 		.type = HDA_FIXUP_FUNC,
7359 		.v.func = alc269_fixup_limit_int_mic_boost,
7360 		.chained = true,
7361 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7362 	},
7363 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7364 		.type = HDA_FIXUP_FUNC,
7365 		.v.func = alc269_fixup_limit_int_mic_boost,
7366 		.chained = true,
7367 		.chain_id = ALC269VB_FIXUP_DMIC,
7368 	},
7369 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7370 		.type = HDA_FIXUP_VERBS,
7371 		.v.verbs = (const struct hda_verb[]) {
7372 			/* class-D output amp +5dB */
7373 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7374 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7375 			{}
7376 		},
7377 		.chained = true,
7378 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7379 	},
7380 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7381 		.type = HDA_FIXUP_PINS,
7382 		.v.pins = (const struct hda_pintbl[]) {
7383 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
7384 			{ }
7385 		},
7386 		.chained = true,
7387 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7388 	},
7389 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7390 		.type = HDA_FIXUP_FUNC,
7391 		.v.func = alc269_fixup_limit_int_mic_boost,
7392 		.chained = true,
7393 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7394 	},
7395 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7396 		.type = HDA_FIXUP_PINS,
7397 		.v.pins = (const struct hda_pintbl[]) {
7398 			{ 0x12, 0x99a3092f }, /* int-mic */
7399 			{ 0x18, 0x03a11d20 }, /* mic */
7400 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
7401 			{ }
7402 		},
7403 	},
7404 	[ALC283_FIXUP_CHROME_BOOK] = {
7405 		.type = HDA_FIXUP_FUNC,
7406 		.v.func = alc283_fixup_chromebook,
7407 	},
7408 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
7409 		.type = HDA_FIXUP_FUNC,
7410 		.v.func = alc283_fixup_sense_combo_jack,
7411 		.chained = true,
7412 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
7413 	},
7414 	[ALC282_FIXUP_ASUS_TX300] = {
7415 		.type = HDA_FIXUP_FUNC,
7416 		.v.func = alc282_fixup_asus_tx300,
7417 	},
7418 	[ALC283_FIXUP_INT_MIC] = {
7419 		.type = HDA_FIXUP_VERBS,
7420 		.v.verbs = (const struct hda_verb[]) {
7421 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7422 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7423 			{ }
7424 		},
7425 		.chained = true,
7426 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7427 	},
7428 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7429 		.type = HDA_FIXUP_PINS,
7430 		.v.pins = (const struct hda_pintbl[]) {
7431 			{ 0x17, 0x90170112 }, /* subwoofer */
7432 			{ }
7433 		},
7434 		.chained = true,
7435 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7436 	},
7437 	[ALC290_FIXUP_SUBWOOFER] = {
7438 		.type = HDA_FIXUP_PINS,
7439 		.v.pins = (const struct hda_pintbl[]) {
7440 			{ 0x17, 0x90170112 }, /* subwoofer */
7441 			{ }
7442 		},
7443 		.chained = true,
7444 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7445 	},
7446 	[ALC290_FIXUP_MONO_SPEAKERS] = {
7447 		.type = HDA_FIXUP_FUNC,
7448 		.v.func = alc290_fixup_mono_speakers,
7449 	},
7450 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7451 		.type = HDA_FIXUP_FUNC,
7452 		.v.func = alc290_fixup_mono_speakers,
7453 		.chained = true,
7454 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7455 	},
7456 	[ALC269_FIXUP_THINKPAD_ACPI] = {
7457 		.type = HDA_FIXUP_FUNC,
7458 		.v.func = alc_fixup_thinkpad_acpi,
7459 		.chained = true,
7460 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
7461 	},
7462 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7463 		.type = HDA_FIXUP_FUNC,
7464 		.v.func = alc_fixup_inv_dmic,
7465 		.chained = true,
7466 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7467 	},
7468 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
7469 		.type = HDA_FIXUP_PINS,
7470 		.v.pins = (const struct hda_pintbl[]) {
7471 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7472 			{ }
7473 		},
7474 		.chained = true,
7475 		.chain_id = ALC255_FIXUP_HEADSET_MODE
7476 	},
7477 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7478 		.type = HDA_FIXUP_PINS,
7479 		.v.pins = (const struct hda_pintbl[]) {
7480 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7481 			{ }
7482 		},
7483 		.chained = true,
7484 		.chain_id = ALC255_FIXUP_HEADSET_MODE
7485 	},
7486 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7487 		.type = HDA_FIXUP_PINS,
7488 		.v.pins = (const struct hda_pintbl[]) {
7489 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7490 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7491 			{ }
7492 		},
7493 		.chained = true,
7494 		.chain_id = ALC255_FIXUP_HEADSET_MODE
7495 	},
7496 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7497 		.type = HDA_FIXUP_PINS,
7498 		.v.pins = (const struct hda_pintbl[]) {
7499 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7500 			{ }
7501 		},
7502 		.chained = true,
7503 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7504 	},
7505 	[ALC255_FIXUP_HEADSET_MODE] = {
7506 		.type = HDA_FIXUP_FUNC,
7507 		.v.func = alc_fixup_headset_mode_alc255,
7508 		.chained = true,
7509 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7510 	},
7511 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7512 		.type = HDA_FIXUP_FUNC,
7513 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7514 	},
7515 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7516 		.type = HDA_FIXUP_PINS,
7517 		.v.pins = (const struct hda_pintbl[]) {
7518 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7519 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7520 			{ }
7521 		},
7522 		.chained = true,
7523 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7524 	},
7525 	[ALC292_FIXUP_TPT440_DOCK] = {
7526 		.type = HDA_FIXUP_FUNC,
7527 		.v.func = alc_fixup_tpt440_dock,
7528 		.chained = true,
7529 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7530 	},
7531 	[ALC292_FIXUP_TPT440] = {
7532 		.type = HDA_FIXUP_FUNC,
7533 		.v.func = alc_fixup_disable_aamix,
7534 		.chained = true,
7535 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
7536 	},
7537 	[ALC283_FIXUP_HEADSET_MIC] = {
7538 		.type = HDA_FIXUP_PINS,
7539 		.v.pins = (const struct hda_pintbl[]) {
7540 			{ 0x19, 0x04a110f0 },
7541 			{ },
7542 		},
7543 	},
7544 	[ALC255_FIXUP_MIC_MUTE_LED] = {
7545 		.type = HDA_FIXUP_FUNC,
7546 		.v.func = alc_fixup_micmute_led,
7547 	},
7548 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
7549 		.type = HDA_FIXUP_PINS,
7550 		.v.pins = (const struct hda_pintbl[]) {
7551 			{ 0x12, 0x90a60130 },
7552 			{ 0x14, 0x90170110 },
7553 			{ 0x17, 0x40000008 },
7554 			{ 0x18, 0x411111f0 },
7555 			{ 0x19, 0x01a1913c },
7556 			{ 0x1a, 0x411111f0 },
7557 			{ 0x1b, 0x411111f0 },
7558 			{ 0x1d, 0x40f89b2d },
7559 			{ 0x1e, 0x411111f0 },
7560 			{ 0x21, 0x0321101f },
7561 			{ },
7562 		},
7563 	},
7564 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7565 		.type = HDA_FIXUP_FUNC,
7566 		.v.func = alc269vb_fixup_aspire_e1_coef,
7567 	},
7568 	[ALC280_FIXUP_HP_GPIO4] = {
7569 		.type = HDA_FIXUP_FUNC,
7570 		.v.func = alc280_fixup_hp_gpio4,
7571 	},
7572 	[ALC286_FIXUP_HP_GPIO_LED] = {
7573 		.type = HDA_FIXUP_FUNC,
7574 		.v.func = alc286_fixup_hp_gpio_led,
7575 	},
7576 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7577 		.type = HDA_FIXUP_FUNC,
7578 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7579 	},
7580 	[ALC280_FIXUP_HP_DOCK_PINS] = {
7581 		.type = HDA_FIXUP_PINS,
7582 		.v.pins = (const struct hda_pintbl[]) {
7583 			{ 0x1b, 0x21011020 }, /* line-out */
7584 			{ 0x1a, 0x01a1903c }, /* headset mic */
7585 			{ 0x18, 0x2181103f }, /* line-in */
7586 			{ },
7587 		},
7588 		.chained = true,
7589 		.chain_id = ALC280_FIXUP_HP_GPIO4
7590 	},
7591 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7592 		.type = HDA_FIXUP_PINS,
7593 		.v.pins = (const struct hda_pintbl[]) {
7594 			{ 0x1b, 0x21011020 }, /* line-out */
7595 			{ 0x18, 0x2181103f }, /* line-in */
7596 			{ },
7597 		},
7598 		.chained = true,
7599 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7600 	},
7601 	[ALC280_FIXUP_HP_9480M] = {
7602 		.type = HDA_FIXUP_FUNC,
7603 		.v.func = alc280_fixup_hp_9480m,
7604 	},
7605 	[ALC245_FIXUP_HP_X360_AMP] = {
7606 		.type = HDA_FIXUP_FUNC,
7607 		.v.func = alc245_fixup_hp_x360_amp,
7608 		.chained = true,
7609 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
7610 	},
7611 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
7612 		.type = HDA_FIXUP_FUNC,
7613 		.v.func = alc_fixup_headset_mode_dell_alc288,
7614 		.chained = true,
7615 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7616 	},
7617 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7618 		.type = HDA_FIXUP_PINS,
7619 		.v.pins = (const struct hda_pintbl[]) {
7620 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7621 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7622 			{ }
7623 		},
7624 		.chained = true,
7625 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7626 	},
7627 	[ALC288_FIXUP_DISABLE_AAMIX] = {
7628 		.type = HDA_FIXUP_FUNC,
7629 		.v.func = alc_fixup_disable_aamix,
7630 		.chained = true,
7631 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
7632 	},
7633 	[ALC288_FIXUP_DELL_XPS_13] = {
7634 		.type = HDA_FIXUP_FUNC,
7635 		.v.func = alc_fixup_dell_xps13,
7636 		.chained = true,
7637 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
7638 	},
7639 	[ALC292_FIXUP_DISABLE_AAMIX] = {
7640 		.type = HDA_FIXUP_FUNC,
7641 		.v.func = alc_fixup_disable_aamix,
7642 		.chained = true,
7643 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
7644 	},
7645 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7646 		.type = HDA_FIXUP_FUNC,
7647 		.v.func = alc_fixup_disable_aamix,
7648 		.chained = true,
7649 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7650 	},
7651 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
7652 		.type = HDA_FIXUP_FUNC,
7653 		.v.func = alc_fixup_dell_xps13,
7654 		.chained = true,
7655 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
7656 	},
7657 	[ALC292_FIXUP_DELL_E7X] = {
7658 		.type = HDA_FIXUP_FUNC,
7659 		.v.func = alc_fixup_micmute_led,
7660 		/* micmute fixup must be applied at last */
7661 		.chained_before = true,
7662 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7663 	},
7664 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7665 		.type = HDA_FIXUP_PINS,
7666 		.v.pins = (const struct hda_pintbl[]) {
7667 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7668 			{ }
7669 		},
7670 		.chained_before = true,
7671 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
7672 	},
7673 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7674 		.type = HDA_FIXUP_PINS,
7675 		.v.pins = (const struct hda_pintbl[]) {
7676 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7677 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7678 			{ }
7679 		},
7680 		.chained = true,
7681 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7682 	},
7683 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7684 		.type = HDA_FIXUP_PINS,
7685 		.v.pins = (const struct hda_pintbl[]) {
7686 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7687 			{ }
7688 		},
7689 		.chained = true,
7690 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7691 	},
7692 	[ALC275_FIXUP_DELL_XPS] = {
7693 		.type = HDA_FIXUP_VERBS,
7694 		.v.verbs = (const struct hda_verb[]) {
7695 			/* Enables internal speaker */
7696 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7697 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7698 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7699 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7700 			{}
7701 		}
7702 	},
7703 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7704 		.type = HDA_FIXUP_FUNC,
7705 		.v.func = alc_fixup_disable_aamix,
7706 		.chained = true,
7707 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
7708 	},
7709 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7710 		.type = HDA_FIXUP_FUNC,
7711 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7712 	},
7713 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7714 		.type = HDA_FIXUP_FUNC,
7715 		.v.func = alc_fixup_inv_dmic,
7716 		.chained = true,
7717 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7718 	},
7719 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7720 		.type = HDA_FIXUP_FUNC,
7721 		.v.func = alc269_fixup_limit_int_mic_boost
7722 	},
7723 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
7724 		.type = HDA_FIXUP_FUNC,
7725 		.v.func = alc_fixup_disable_aamix,
7726 		.chained = true,
7727 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7728 	},
7729 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
7730 		.type = HDA_FIXUP_FUNC,
7731 		.v.func = alc_fixup_disable_mic_vref,
7732 		.chained = true,
7733 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7734 	},
7735 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7736 		.type = HDA_FIXUP_VERBS,
7737 		.v.verbs = (const struct hda_verb[]) {
7738 			/* Disable pass-through path for FRONT 14h */
7739 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7740 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7741 			{}
7742 		},
7743 		.chained = true,
7744 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
7745 	},
7746 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
7747 		.type = HDA_FIXUP_FUNC,
7748 		.v.func = alc_fixup_disable_aamix,
7749 		.chained = true,
7750 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
7751 	},
7752 	[ALC221_FIXUP_HP_FRONT_MIC] = {
7753 		.type = HDA_FIXUP_PINS,
7754 		.v.pins = (const struct hda_pintbl[]) {
7755 			{ 0x19, 0x02a19020 }, /* Front Mic */
7756 			{ }
7757 		},
7758 	},
7759 	[ALC292_FIXUP_TPT460] = {
7760 		.type = HDA_FIXUP_FUNC,
7761 		.v.func = alc_fixup_tpt440_dock,
7762 		.chained = true,
7763 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7764 	},
7765 	[ALC298_FIXUP_SPK_VOLUME] = {
7766 		.type = HDA_FIXUP_FUNC,
7767 		.v.func = alc298_fixup_speaker_volume,
7768 		.chained = true,
7769 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7770 	},
7771 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7772 		.type = HDA_FIXUP_FUNC,
7773 		.v.func = alc298_fixup_speaker_volume,
7774 	},
7775 	[ALC295_FIXUP_DISABLE_DAC3] = {
7776 		.type = HDA_FIXUP_FUNC,
7777 		.v.func = alc295_fixup_disable_dac3,
7778 	},
7779 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7780 		.type = HDA_FIXUP_FUNC,
7781 		.v.func = alc285_fixup_speaker2_to_dac1,
7782 		.chained = true,
7783 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
7784 	},
7785 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7786 		.type = HDA_FIXUP_PINS,
7787 		.v.pins = (const struct hda_pintbl[]) {
7788 			{ 0x1b, 0x90170151 },
7789 			{ }
7790 		},
7791 		.chained = true,
7792 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7793 	},
7794 	[ALC269_FIXUP_ATIV_BOOK_8] = {
7795 		.type = HDA_FIXUP_FUNC,
7796 		.v.func = alc_fixup_auto_mute_via_amp,
7797 		.chained = true,
7798 		.chain_id = ALC269_FIXUP_NO_SHUTUP
7799 	},
7800 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
7801 		.type = HDA_FIXUP_PINS,
7802 		.v.pins = (const struct hda_pintbl[]) {
7803 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7804 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
7805 			{ }
7806 		},
7807 		.chained = true,
7808 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7809 	},
7810 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7811 		.type = HDA_FIXUP_PINS,
7812 		.v.pins = (const struct hda_pintbl[]) {
7813 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7814 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7815 			{ }
7816 		},
7817 		.chained = true,
7818 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7819 	},
7820 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7821 		.type = HDA_FIXUP_FUNC,
7822 		.v.func = alc_fixup_headset_mode,
7823 	},
7824 	[ALC256_FIXUP_ASUS_MIC] = {
7825 		.type = HDA_FIXUP_PINS,
7826 		.v.pins = (const struct hda_pintbl[]) {
7827 			{ 0x13, 0x90a60160 }, /* use as internal mic */
7828 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7829 			{ }
7830 		},
7831 		.chained = true,
7832 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7833 	},
7834 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
7835 		.type = HDA_FIXUP_FUNC,
7836 		/* Set up GPIO2 for the speaker amp */
7837 		.v.func = alc_fixup_gpio4,
7838 	},
7839 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7840 		.type = HDA_FIXUP_PINS,
7841 		.v.pins = (const struct hda_pintbl[]) {
7842 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7843 			{ }
7844 		},
7845 		.chained = true,
7846 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7847 	},
7848 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7849 		.type = HDA_FIXUP_VERBS,
7850 		.v.verbs = (const struct hda_verb[]) {
7851 			/* Enables internal speaker */
7852 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7853 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7854 			{}
7855 		},
7856 		.chained = true,
7857 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7858 	},
7859 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7860 		.type = HDA_FIXUP_FUNC,
7861 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
7862 		.chained = true,
7863 		.chain_id = ALC269_FIXUP_GPIO2
7864 	},
7865 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
7866 		.type = HDA_FIXUP_VERBS,
7867 		.v.verbs = (const struct hda_verb[]) {
7868 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7869 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7870 			{ }
7871 		},
7872 		.chained = true,
7873 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7874 	},
7875 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7876 		.type = HDA_FIXUP_PINS,
7877 		.v.pins = (const struct hda_pintbl[]) {
7878 			/* Change the mic location from front to right, otherwise there are
7879 			   two front mics with the same name, pulseaudio can't handle them.
7880 			   This is just a temporary workaround, after applying this fixup,
7881 			   there will be one "Front Mic" and one "Mic" in this machine.
7882 			 */
7883 			{ 0x1a, 0x04a19040 },
7884 			{ }
7885 		},
7886 	},
7887 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7888 		.type = HDA_FIXUP_PINS,
7889 		.v.pins = (const struct hda_pintbl[]) {
7890 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
7891 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7892 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7893 			{ 0x1b, 0x02011020 },
7894 			{ }
7895 		},
7896 		.chained = true,
7897 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
7898 	},
7899 	[ALC225_FIXUP_S3_POP_NOISE] = {
7900 		.type = HDA_FIXUP_FUNC,
7901 		.v.func = alc225_fixup_s3_pop_noise,
7902 		.chained = true,
7903 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7904 	},
7905 	[ALC700_FIXUP_INTEL_REFERENCE] = {
7906 		.type = HDA_FIXUP_VERBS,
7907 		.v.verbs = (const struct hda_verb[]) {
7908 			/* Enables internal speaker */
7909 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7910 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7911 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7912 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7913 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7914 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7915 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7916 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7917 			{}
7918 		}
7919 	},
7920 	[ALC274_FIXUP_DELL_BIND_DACS] = {
7921 		.type = HDA_FIXUP_FUNC,
7922 		.v.func = alc274_fixup_bind_dacs,
7923 		.chained = true,
7924 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7925 	},
7926 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7927 		.type = HDA_FIXUP_PINS,
7928 		.v.pins = (const struct hda_pintbl[]) {
7929 			{ 0x1b, 0x0401102f },
7930 			{ }
7931 		},
7932 		.chained = true,
7933 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
7934 	},
7935 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
7936 		.type = HDA_FIXUP_FUNC,
7937 		.v.func = alc_fixup_tpt470_dock,
7938 		.chained = true,
7939 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7940 	},
7941 	[ALC298_FIXUP_TPT470_DOCK] = {
7942 		.type = HDA_FIXUP_FUNC,
7943 		.v.func = alc_fixup_tpt470_dacs,
7944 		.chained = true,
7945 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7946 	},
7947 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7948 		.type = HDA_FIXUP_PINS,
7949 		.v.pins = (const struct hda_pintbl[]) {
7950 			{ 0x14, 0x0201101f },
7951 			{ }
7952 		},
7953 		.chained = true,
7954 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7955 	},
7956 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
7957 		.type = HDA_FIXUP_PINS,
7958 		.v.pins = (const struct hda_pintbl[]) {
7959 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7960 			{ }
7961 		},
7962 		.chained = true,
7963 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7964 	},
7965 	[ALC295_FIXUP_HP_X360] = {
7966 		.type = HDA_FIXUP_FUNC,
7967 		.v.func = alc295_fixup_hp_top_speakers,
7968 		.chained = true,
7969 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
7970 	},
7971 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
7972 		.type = HDA_FIXUP_PINS,
7973 		.v.pins = (const struct hda_pintbl[]) {
7974 			{ 0x19, 0x0181313f},
7975 			{ }
7976 		},
7977 		.chained = true,
7978 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7979 	},
7980 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7981 		.type = HDA_FIXUP_FUNC,
7982 		.v.func = alc285_fixup_invalidate_dacs,
7983 		.chained = true,
7984 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
7985 	},
7986 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
7987 		.type = HDA_FIXUP_FUNC,
7988 		.v.func = alc_fixup_auto_mute_via_amp,
7989 	},
7990 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7991 		.type = HDA_FIXUP_PINS,
7992 		.v.pins = (const struct hda_pintbl[]) {
7993 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7994 			{ }
7995 		},
7996 		.chained = true,
7997 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7998 	},
7999 	[ALC294_FIXUP_ASUS_MIC] = {
8000 		.type = HDA_FIXUP_PINS,
8001 		.v.pins = (const struct hda_pintbl[]) {
8002 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8003 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8004 			{ }
8005 		},
8006 		.chained = true,
8007 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8008 	},
8009 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8010 		.type = HDA_FIXUP_PINS,
8011 		.v.pins = (const struct hda_pintbl[]) {
8012 			{ 0x19, 0x01a1103c }, /* use as headset mic */
8013 			{ }
8014 		},
8015 		.chained = true,
8016 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8017 	},
8018 	[ALC294_FIXUP_ASUS_SPK] = {
8019 		.type = HDA_FIXUP_VERBS,
8020 		.v.verbs = (const struct hda_verb[]) {
8021 			/* Set EAPD high */
8022 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8023 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8024 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8025 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8026 			{ }
8027 		},
8028 		.chained = true,
8029 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8030 	},
8031 	[ALC295_FIXUP_CHROME_BOOK] = {
8032 		.type = HDA_FIXUP_FUNC,
8033 		.v.func = alc295_fixup_chromebook,
8034 		.chained = true,
8035 		.chain_id = ALC225_FIXUP_HEADSET_JACK
8036 	},
8037 	[ALC225_FIXUP_HEADSET_JACK] = {
8038 		.type = HDA_FIXUP_FUNC,
8039 		.v.func = alc_fixup_headset_jack,
8040 	},
8041 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8042 		.type = HDA_FIXUP_PINS,
8043 		.v.pins = (const struct hda_pintbl[]) {
8044 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8045 			{ }
8046 		},
8047 		.chained = true,
8048 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8049 	},
8050 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8051 		.type = HDA_FIXUP_VERBS,
8052 		.v.verbs = (const struct hda_verb[]) {
8053 			/* Disable PCBEEP-IN passthrough */
8054 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8055 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8056 			{ }
8057 		},
8058 		.chained = true,
8059 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8060 	},
8061 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
8062 		.type = HDA_FIXUP_PINS,
8063 		.v.pins = (const struct hda_pintbl[]) {
8064 			{ 0x19, 0x03a11130 },
8065 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
8066 			{ }
8067 		},
8068 		.chained = true,
8069 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8070 	},
8071 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8072 		.type = HDA_FIXUP_PINS,
8073 		.v.pins = (const struct hda_pintbl[]) {
8074 			{ 0x16, 0x01011020 }, /* Rear Line out */
8075 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8076 			{ }
8077 		},
8078 		.chained = true,
8079 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8080 	},
8081 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8082 		.type = HDA_FIXUP_FUNC,
8083 		.v.func = alc_fixup_auto_mute_via_amp,
8084 		.chained = true,
8085 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8086 	},
8087 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8088 		.type = HDA_FIXUP_FUNC,
8089 		.v.func = alc_fixup_disable_mic_vref,
8090 		.chained = true,
8091 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8092 	},
8093 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8094 		.type = HDA_FIXUP_VERBS,
8095 		.v.verbs = (const struct hda_verb[]) {
8096 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8097 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8098 			{ }
8099 		},
8100 		.chained = true,
8101 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8102 	},
8103 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8104 		.type = HDA_FIXUP_PINS,
8105 		.v.pins = (const struct hda_pintbl[]) {
8106 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
8107 			{ }
8108 		},
8109 		.chained = true,
8110 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8111 	},
8112 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8113 		.type = HDA_FIXUP_PINS,
8114 		.v.pins = (const struct hda_pintbl[]) {
8115 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8116 			{ }
8117 		},
8118 		.chained = true,
8119 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8120 	},
8121 	[ALC299_FIXUP_PREDATOR_SPK] = {
8122 		.type = HDA_FIXUP_PINS,
8123 		.v.pins = (const struct hda_pintbl[]) {
8124 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8125 			{ }
8126 		}
8127 	},
8128 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8129 		.type = HDA_FIXUP_PINS,
8130 		.v.pins = (const struct hda_pintbl[]) {
8131 			{ 0x19, 0x04a11040 },
8132 			{ 0x21, 0x04211020 },
8133 			{ }
8134 		},
8135 		.chained = true,
8136 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8137 	},
8138 	[ALC289_FIXUP_DELL_SPK2] = {
8139 		.type = HDA_FIXUP_PINS,
8140 		.v.pins = (const struct hda_pintbl[]) {
8141 			{ 0x17, 0x90170130 }, /* bass spk */
8142 			{ }
8143 		},
8144 		.chained = true,
8145 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8146 	},
8147 	[ALC289_FIXUP_DUAL_SPK] = {
8148 		.type = HDA_FIXUP_FUNC,
8149 		.v.func = alc285_fixup_speaker2_to_dac1,
8150 		.chained = true,
8151 		.chain_id = ALC289_FIXUP_DELL_SPK2
8152 	},
8153 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
8154 		.type = HDA_FIXUP_FUNC,
8155 		.v.func = alc285_fixup_speaker2_to_dac1,
8156 		.chained = true,
8157 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8158 	},
8159 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
8160 		.type = HDA_FIXUP_FUNC,
8161 		/* The GPIO must be pulled to initialize the AMP */
8162 		.v.func = alc_fixup_gpio4,
8163 		.chained = true,
8164 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8165 	},
8166 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8167 		.type = HDA_FIXUP_FUNC,
8168 		.v.func = alc285_fixup_thinkpad_x1_gen7,
8169 		.chained = true,
8170 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8171 	},
8172 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8173 		.type = HDA_FIXUP_FUNC,
8174 		.v.func = alc_fixup_headset_jack,
8175 		.chained = true,
8176 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8177 	},
8178 	[ALC294_FIXUP_ASUS_HPE] = {
8179 		.type = HDA_FIXUP_VERBS,
8180 		.v.verbs = (const struct hda_verb[]) {
8181 			/* Set EAPD high */
8182 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8183 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8184 			{ }
8185 		},
8186 		.chained = true,
8187 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8188 	},
8189 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
8190 		.type = HDA_FIXUP_PINS,
8191 		.v.pins = (const struct hda_pintbl[]) {
8192 			{ 0x19, 0x03a11050 }, /* front HP mic */
8193 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8194 			{ 0x21, 0x03211020 }, /* front HP out */
8195 			{ }
8196 		},
8197 		.chained = true,
8198 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8199 	},
8200 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
8201 		.type = HDA_FIXUP_VERBS,
8202 		.v.verbs = (const struct hda_verb[]) {
8203 			/* set 0x15 to HP-OUT ctrl */
8204 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8205 			/* unmute the 0x15 amp */
8206 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8207 			{ }
8208 		},
8209 		.chained = true,
8210 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
8211 	},
8212 	[ALC294_FIXUP_ASUS_GX502_HP] = {
8213 		.type = HDA_FIXUP_FUNC,
8214 		.v.func = alc294_fixup_gx502_hp,
8215 	},
8216 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
8217 		.type = HDA_FIXUP_PINS,
8218 		.v.pins = (const struct hda_pintbl[]) {
8219 			{ 0x19, 0x01a11050 }, /* rear HP mic */
8220 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8221 			{ 0x21, 0x012110f0 }, /* rear HP out */
8222 			{ }
8223 		},
8224 		.chained = true,
8225 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8226 	},
8227 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
8228 		.type = HDA_FIXUP_VERBS,
8229 		.v.verbs = (const struct hda_verb[]) {
8230 			/* set 0x15 to HP-OUT ctrl */
8231 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8232 			/* unmute the 0x15 amp */
8233 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8234 			/* set 0x1b to HP-OUT */
8235 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8236 			{ }
8237 		},
8238 		.chained = true,
8239 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
8240 	},
8241 	[ALC294_FIXUP_ASUS_GU502_HP] = {
8242 		.type = HDA_FIXUP_FUNC,
8243 		.v.func = alc294_fixup_gu502_hp,
8244 	},
8245 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
8246 		.type = HDA_FIXUP_PINS,
8247 		.v.pins = (const struct hda_pintbl[]) {
8248 				{ 0x19, 0x03a11050 }, /* front HP mic */
8249 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
8250 				{ 0x21, 0x03211420 }, /* front HP out */
8251 				{ }
8252 		},
8253 	},
8254 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
8255 		.type = HDA_FIXUP_PINS,
8256 		.v.pins = (const struct hda_pintbl[]) {
8257 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
8258 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
8259 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
8260 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
8261 			{ 0x21, 0x03211420 },
8262 			{ }
8263 		},
8264 	},
8265 	[ALC294_FIXUP_ASUS_COEF_1B] = {
8266 		.type = HDA_FIXUP_VERBS,
8267 		.v.verbs = (const struct hda_verb[]) {
8268 			/* Set bit 10 to correct noisy output after reboot from
8269 			 * Windows 10 (due to pop noise reduction?)
8270 			 */
8271 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8272 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8273 			{ }
8274 		},
8275 		.chained = true,
8276 		.chain_id = ALC289_FIXUP_ASUS_GA401,
8277 	},
8278 	[ALC285_FIXUP_HP_GPIO_LED] = {
8279 		.type = HDA_FIXUP_FUNC,
8280 		.v.func = alc285_fixup_hp_gpio_led,
8281 	},
8282 	[ALC285_FIXUP_HP_MUTE_LED] = {
8283 		.type = HDA_FIXUP_FUNC,
8284 		.v.func = alc285_fixup_hp_mute_led,
8285 	},
8286 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
8287 		.type = HDA_FIXUP_FUNC,
8288 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
8289 	},
8290 	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
8291 	    .type = HDA_FIXUP_FUNC,
8292 	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
8293 	},
8294 	[ALC236_FIXUP_HP_GPIO_LED] = {
8295 		.type = HDA_FIXUP_FUNC,
8296 		.v.func = alc236_fixup_hp_gpio_led,
8297 	},
8298 	[ALC236_FIXUP_HP_MUTE_LED] = {
8299 		.type = HDA_FIXUP_FUNC,
8300 		.v.func = alc236_fixup_hp_mute_led,
8301 	},
8302 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8303 		.type = HDA_FIXUP_FUNC,
8304 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
8305 	},
8306 	[ALC298_FIXUP_SAMSUNG_AMP] = {
8307 		.type = HDA_FIXUP_FUNC,
8308 		.v.func = alc298_fixup_samsung_amp,
8309 		.chained = true,
8310 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
8311 	},
8312 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8313 		.type = HDA_FIXUP_VERBS,
8314 		.v.verbs = (const struct hda_verb[]) {
8315 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8316 			{ }
8317 		},
8318 	},
8319 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8320 		.type = HDA_FIXUP_VERBS,
8321 		.v.verbs = (const struct hda_verb[]) {
8322 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8323 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
8324 			{ }
8325 		},
8326 	},
8327 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8328 		.type = HDA_FIXUP_PINS,
8329 		.v.pins = (const struct hda_pintbl[]) {
8330 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8331 			{ }
8332 		},
8333 		.chained = true,
8334 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8335 	},
8336 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8337 		.type = HDA_FIXUP_PINS,
8338 		.v.pins = (const struct hda_pintbl[]) {
8339 			{ 0x14, 0x90100120 }, /* use as internal speaker */
8340 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8341 			{ 0x1a, 0x01011020 }, /* use as line out */
8342 			{ },
8343 		},
8344 		.chained = true,
8345 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8346 	},
8347 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8348 		.type = HDA_FIXUP_PINS,
8349 		.v.pins = (const struct hda_pintbl[]) {
8350 			{ 0x18, 0x02a11030 }, /* use as headset mic */
8351 			{ }
8352 		},
8353 		.chained = true,
8354 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8355 	},
8356 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8357 		.type = HDA_FIXUP_PINS,
8358 		.v.pins = (const struct hda_pintbl[]) {
8359 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8360 			{ }
8361 		},
8362 		.chained = true,
8363 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8364 	},
8365 	[ALC289_FIXUP_ASUS_GA401] = {
8366 		.type = HDA_FIXUP_FUNC,
8367 		.v.func = alc289_fixup_asus_ga401,
8368 		.chained = true,
8369 		.chain_id = ALC289_FIXUP_ASUS_GA502,
8370 	},
8371 	[ALC289_FIXUP_ASUS_GA502] = {
8372 		.type = HDA_FIXUP_PINS,
8373 		.v.pins = (const struct hda_pintbl[]) {
8374 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
8375 			{ }
8376 		},
8377 	},
8378 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8379 		.type = HDA_FIXUP_PINS,
8380 		.v.pins = (const struct hda_pintbl[]) {
8381 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8382 			{ }
8383 		},
8384 		.chained = true,
8385 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8386 	},
8387 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8388 		.type = HDA_FIXUP_FUNC,
8389 		.v.func = alc285_fixup_hp_gpio_amp_init,
8390 		.chained = true,
8391 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
8392 	},
8393 	[ALC269_FIXUP_CZC_B20] = {
8394 		.type = HDA_FIXUP_PINS,
8395 		.v.pins = (const struct hda_pintbl[]) {
8396 			{ 0x12, 0x411111f0 },
8397 			{ 0x14, 0x90170110 }, /* speaker */
8398 			{ 0x15, 0x032f1020 }, /* HP out */
8399 			{ 0x17, 0x411111f0 },
8400 			{ 0x18, 0x03ab1040 }, /* mic */
8401 			{ 0x19, 0xb7a7013f },
8402 			{ 0x1a, 0x0181305f },
8403 			{ 0x1b, 0x411111f0 },
8404 			{ 0x1d, 0x411111f0 },
8405 			{ 0x1e, 0x411111f0 },
8406 			{ }
8407 		},
8408 		.chain_id = ALC269_FIXUP_DMIC,
8409 	},
8410 	[ALC269_FIXUP_CZC_TMI] = {
8411 		.type = HDA_FIXUP_PINS,
8412 		.v.pins = (const struct hda_pintbl[]) {
8413 			{ 0x12, 0x4000c000 },
8414 			{ 0x14, 0x90170110 }, /* speaker */
8415 			{ 0x15, 0x0421401f }, /* HP out */
8416 			{ 0x17, 0x411111f0 },
8417 			{ 0x18, 0x04a19020 }, /* mic */
8418 			{ 0x19, 0x411111f0 },
8419 			{ 0x1a, 0x411111f0 },
8420 			{ 0x1b, 0x411111f0 },
8421 			{ 0x1d, 0x40448505 },
8422 			{ 0x1e, 0x411111f0 },
8423 			{ 0x20, 0x8000ffff },
8424 			{ }
8425 		},
8426 		.chain_id = ALC269_FIXUP_DMIC,
8427 	},
8428 	[ALC269_FIXUP_CZC_L101] = {
8429 		.type = HDA_FIXUP_PINS,
8430 		.v.pins = (const struct hda_pintbl[]) {
8431 			{ 0x12, 0x40000000 },
8432 			{ 0x14, 0x01014010 }, /* speaker */
8433 			{ 0x15, 0x411111f0 }, /* HP out */
8434 			{ 0x16, 0x411111f0 },
8435 			{ 0x18, 0x01a19020 }, /* mic */
8436 			{ 0x19, 0x02a19021 },
8437 			{ 0x1a, 0x0181302f },
8438 			{ 0x1b, 0x0221401f },
8439 			{ 0x1c, 0x411111f0 },
8440 			{ 0x1d, 0x4044c601 },
8441 			{ 0x1e, 0x411111f0 },
8442 			{ }
8443 		},
8444 		.chain_id = ALC269_FIXUP_DMIC,
8445 	},
8446 	[ALC269_FIXUP_LEMOTE_A1802] = {
8447 		.type = HDA_FIXUP_PINS,
8448 		.v.pins = (const struct hda_pintbl[]) {
8449 			{ 0x12, 0x40000000 },
8450 			{ 0x14, 0x90170110 }, /* speaker */
8451 			{ 0x17, 0x411111f0 },
8452 			{ 0x18, 0x03a19040 }, /* mic1 */
8453 			{ 0x19, 0x90a70130 }, /* mic2 */
8454 			{ 0x1a, 0x411111f0 },
8455 			{ 0x1b, 0x411111f0 },
8456 			{ 0x1d, 0x40489d2d },
8457 			{ 0x1e, 0x411111f0 },
8458 			{ 0x20, 0x0003ffff },
8459 			{ 0x21, 0x03214020 },
8460 			{ }
8461 		},
8462 		.chain_id = ALC269_FIXUP_DMIC,
8463 	},
8464 	[ALC269_FIXUP_LEMOTE_A190X] = {
8465 		.type = HDA_FIXUP_PINS,
8466 		.v.pins = (const struct hda_pintbl[]) {
8467 			{ 0x14, 0x99130110 }, /* speaker */
8468 			{ 0x15, 0x0121401f }, /* HP out */
8469 			{ 0x18, 0x01a19c20 }, /* rear  mic */
8470 			{ 0x19, 0x99a3092f }, /* front mic */
8471 			{ 0x1b, 0x0201401f }, /* front lineout */
8472 			{ }
8473 		},
8474 		.chain_id = ALC269_FIXUP_DMIC,
8475 	},
8476 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8477 		.type = HDA_FIXUP_PINS,
8478 		.v.pins = (const struct hda_pintbl[]) {
8479 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8480 			{ }
8481 		},
8482 		.chained = true,
8483 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8484 	},
8485 	[ALC256_FIXUP_INTEL_NUC10] = {
8486 		.type = HDA_FIXUP_PINS,
8487 		.v.pins = (const struct hda_pintbl[]) {
8488 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8489 			{ }
8490 		},
8491 		.chained = true,
8492 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8493 	},
8494 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8495 		.type = HDA_FIXUP_VERBS,
8496 		.v.verbs = (const struct hda_verb[]) {
8497 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8498 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8499 			{ }
8500 		},
8501 		.chained = true,
8502 		.chain_id = ALC289_FIXUP_ASUS_GA502
8503 	},
8504 	[ALC274_FIXUP_HP_MIC] = {
8505 		.type = HDA_FIXUP_VERBS,
8506 		.v.verbs = (const struct hda_verb[]) {
8507 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8508 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8509 			{ }
8510 		},
8511 	},
8512 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
8513 		.type = HDA_FIXUP_FUNC,
8514 		.v.func = alc274_fixup_hp_headset_mic,
8515 		.chained = true,
8516 		.chain_id = ALC274_FIXUP_HP_MIC
8517 	},
8518 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
8519 		.type = HDA_FIXUP_FUNC,
8520 		.v.func = alc274_fixup_hp_envy_gpio,
8521 	},
8522 	[ALC256_FIXUP_ASUS_HPE] = {
8523 		.type = HDA_FIXUP_VERBS,
8524 		.v.verbs = (const struct hda_verb[]) {
8525 			/* Set EAPD high */
8526 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8527 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8528 			{ }
8529 		},
8530 		.chained = true,
8531 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8532 	},
8533 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8534 		.type = HDA_FIXUP_FUNC,
8535 		.v.func = alc_fixup_headset_jack,
8536 		.chained = true,
8537 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8538 	},
8539 	[ALC287_FIXUP_HP_GPIO_LED] = {
8540 		.type = HDA_FIXUP_FUNC,
8541 		.v.func = alc287_fixup_hp_gpio_led,
8542 	},
8543 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
8544 		.type = HDA_FIXUP_FUNC,
8545 		.v.func = alc274_fixup_hp_headset_mic,
8546 	},
8547 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8548 		.type = HDA_FIXUP_FUNC,
8549 		.v.func = alc_fixup_no_int_mic,
8550 		.chained = true,
8551 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8552 	},
8553 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8554 		.type = HDA_FIXUP_PINS,
8555 		.v.pins = (const struct hda_pintbl[]) {
8556 			{ 0x1b, 0x411111f0 },
8557 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8558 			{ },
8559 		},
8560 		.chained = true,
8561 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8562 	},
8563 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8564 		.type = HDA_FIXUP_FUNC,
8565 		.v.func = alc269_fixup_limit_int_mic_boost,
8566 		.chained = true,
8567 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8568 	},
8569 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
8570 		.type = HDA_FIXUP_PINS,
8571 		.v.pins = (const struct hda_pintbl[]) {
8572 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8573 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
8574 			{ }
8575 		},
8576 		.chained = true,
8577 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8578 	},
8579 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8580 		.type = HDA_FIXUP_FUNC,
8581 		.v.func = alc285_fixup_ideapad_s740_coef,
8582 		.chained = true,
8583 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8584 	},
8585 	[ALC295_FIXUP_ASUS_DACS] = {
8586 		.type = HDA_FIXUP_FUNC,
8587 		.v.func = alc295_fixup_asus_dacs,
8588 	},
8589 	[ALC295_FIXUP_HP_OMEN] = {
8590 		.type = HDA_FIXUP_PINS,
8591 		.v.pins = (const struct hda_pintbl[]) {
8592 			{ 0x12, 0xb7a60130 },
8593 			{ 0x13, 0x40000000 },
8594 			{ 0x14, 0x411111f0 },
8595 			{ 0x16, 0x411111f0 },
8596 			{ 0x17, 0x90170110 },
8597 			{ 0x18, 0x411111f0 },
8598 			{ 0x19, 0x02a11030 },
8599 			{ 0x1a, 0x411111f0 },
8600 			{ 0x1b, 0x04a19030 },
8601 			{ 0x1d, 0x40600001 },
8602 			{ 0x1e, 0x411111f0 },
8603 			{ 0x21, 0x03211020 },
8604 			{}
8605 		},
8606 		.chained = true,
8607 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8608 	},
8609 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
8610 		.type = HDA_FIXUP_FUNC,
8611 		.v.func = alc285_fixup_hp_spectre_x360,
8612 	},
8613 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8614 		.type = HDA_FIXUP_FUNC,
8615 		.v.func = alc285_fixup_hp_spectre_x360_eb1
8616 	},
8617 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8618 		.type = HDA_FIXUP_FUNC,
8619 		.v.func = alc285_fixup_ideapad_s740_coef,
8620 		.chained = true,
8621 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8622 	},
8623 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8624 		.type = HDA_FIXUP_FUNC,
8625 		.v.func = alc_fixup_no_shutup,
8626 		.chained = true,
8627 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
8628 	},
8629 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8630 		.type = HDA_FIXUP_PINS,
8631 		.v.pins = (const struct hda_pintbl[]) {
8632 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8633 			{ }
8634 		},
8635 		.chained = true,
8636 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8637 	},
8638 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8639 		.type = HDA_FIXUP_FUNC,
8640 		.v.func = alc269_fixup_limit_int_mic_boost,
8641 		.chained = true,
8642 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8643 	},
8644 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8645 		.type = HDA_FIXUP_FUNC,
8646 		.v.func = alc285_fixup_ideapad_s740_coef,
8647 		.chained = true,
8648 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8649 	},
8650 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8651 		.type = HDA_FIXUP_FUNC,
8652 		.v.func = alc287_fixup_legion_15imhg05_speakers,
8653 		.chained = true,
8654 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8655 	},
8656 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8657 		.type = HDA_FIXUP_VERBS,
8658 		//.v.verbs = legion_15imhg05_coefs,
8659 		.v.verbs = (const struct hda_verb[]) {
8660 			 // set left speaker Legion 7i.
8661 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8662 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8663 
8664 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8665 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8666 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8667 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8668 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8669 
8670 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8671 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8672 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8673 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8674 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8675 
8676 			 // set right speaker Legion 7i.
8677 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8678 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8679 
8680 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8681 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8682 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8683 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8684 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8685 
8686 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8687 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8688 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8689 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8690 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8691 			 {}
8692 		},
8693 		.chained = true,
8694 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8695 	},
8696 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8697 		.type = HDA_FIXUP_FUNC,
8698 		.v.func = alc287_fixup_legion_15imhg05_speakers,
8699 		.chained = true,
8700 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8701 	},
8702 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8703 		.type = HDA_FIXUP_VERBS,
8704 		.v.verbs = (const struct hda_verb[]) {
8705 			 // set left speaker Yoga 7i.
8706 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8707 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8708 
8709 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8710 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8711 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8712 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8713 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8714 
8715 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8716 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8717 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8718 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8719 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8720 
8721 			 // set right speaker Yoga 7i.
8722 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8723 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8724 
8725 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8726 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8727 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8728 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8729 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8730 
8731 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8732 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8733 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8734 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8735 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8736 			 {}
8737 		},
8738 		.chained = true,
8739 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8740 	},
8741 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
8742 		.type = HDA_FIXUP_FUNC,
8743 		.v.func = alc298_fixup_lenovo_c940_duet7,
8744 	},
8745 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8746 		.type = HDA_FIXUP_VERBS,
8747 		.v.verbs = (const struct hda_verb[]) {
8748 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8749 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8750 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8751 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8752 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8753 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8754 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8755 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8756 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8757 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8758 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8759 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8760 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8761 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8762 			{}
8763 		},
8764 		.chained = true,
8765 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8766 	},
8767 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
8768 		.type = HDA_FIXUP_FUNC,
8769 		.v.func = alc256_fixup_set_coef_defaults,
8770 	},
8771 	[ALC245_FIXUP_HP_GPIO_LED] = {
8772 		.type = HDA_FIXUP_FUNC,
8773 		.v.func = alc245_fixup_hp_gpio_led,
8774 	},
8775 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8776 		.type = HDA_FIXUP_PINS,
8777 		.v.pins = (const struct hda_pintbl[]) {
8778 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8779 			{ }
8780 		},
8781 		.chained = true,
8782 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8783 	},
8784 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
8785 		.type = HDA_FIXUP_FUNC,
8786 		.v.func = alc233_fixup_no_audio_jack,
8787 	},
8788 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
8789 		.type = HDA_FIXUP_FUNC,
8790 		.v.func = alc256_fixup_mic_no_presence_and_resume,
8791 		.chained = true,
8792 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8793 	},
8794 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
8795 		.type = HDA_FIXUP_VERBS,
8796 		.v.verbs = (const struct hda_verb[]) {
8797 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
8798 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
8799 			 { }
8800 		},
8801 		.chained = true,
8802 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
8803 	},
8804 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
8805 		.type = HDA_FIXUP_FUNC,
8806 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
8807 		.chained = true,
8808 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8809 	},
8810 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
8811 		.type = HDA_FIXUP_PINS,
8812 		.v.func = alc1220_fixup_gb_dual_codecs,
8813 		.chained = true,
8814 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8815 	},
8816 };
8817 
8818 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
8819 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
8820 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8821 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
8822 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
8823 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
8824 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8825 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
8826 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8827 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8828 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
8829 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
8830 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
8831 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
8832 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
8833 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
8834 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
8835 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
8836 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8837 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8838 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8839 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
8840 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
8841 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
8842 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
8843 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
8844 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8845 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8846 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8847 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
8848 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8849 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8850 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8851 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
8852 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
8853 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8854 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8855 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8856 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
8857 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8858 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
8859 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
8860 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
8861 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
8862 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8863 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8864 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
8865 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
8866 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8867 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8868 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8869 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8870 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8871 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
8872 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
8873 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
8874 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8875 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8876 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
8877 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
8878 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8879 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
8880 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8881 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8882 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8883 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8884 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8885 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8886 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8887 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
8888 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
8889 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
8890 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
8891 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
8892 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
8893 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
8894 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
8895 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8896 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8897 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8898 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8899 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
8900 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
8901 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
8902 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8903 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
8904 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
8905 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8906 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8907 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8908 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8909 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
8910 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
8911 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
8912 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8913 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8914 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
8915 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
8916 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
8917 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
8918 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8919 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
8920 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
8921 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
8922 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
8923 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
8924 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
8925 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8926 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8927 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
8928 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8929 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
8930 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8931 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8932 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8933 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8934 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8935 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8936 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8937 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8938 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8939 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8940 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8941 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8942 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8943 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8944 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8945 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8946 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8947 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8948 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
8949 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
8950 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8951 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8952 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8953 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8954 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8955 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8956 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8957 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8958 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
8959 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8960 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
8961 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8962 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
8963 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8964 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8965 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8966 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8967 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8968 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8969 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8970 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8971 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8972 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8973 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8974 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8975 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8976 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8977 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8978 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8979 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8980 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8981 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8982 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8983 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8984 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
8985 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8986 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8987 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8988 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8989 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
8990 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
8991 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
8992 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8993 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8994 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8995 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8996 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8997 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8998 	SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
8999 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
9000 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9001 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
9002 	SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9003 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9004 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9005 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9006 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
9007 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9008 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9009 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
9010 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9011 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9012 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
9013 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
9014 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
9015 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9016 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9017 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9018 	SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
9019 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
9020 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9021 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
9022 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
9023 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
9024 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
9025 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9026 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9027 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9028 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
9029 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9030 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9031 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9032 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9033 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
9034 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
9035 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9036 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9037 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9038 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9039 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9040 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9041 	SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9042 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9043 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9044 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9045 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9046 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9047 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9048 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9049 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9050 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9051 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9052 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
9053 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
9054 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
9055 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
9056 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
9057 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
9058 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9059 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
9060 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
9061 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9062 	SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
9063 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9064 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9065 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9066 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
9067 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
9068 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
9069 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
9070 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
9071 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
9072 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
9073 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
9074 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
9075 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
9076 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
9077 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
9078 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
9079 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
9080 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
9081 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
9082 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
9083 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
9084 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
9085 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
9086 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
9087 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
9088 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
9089 	SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
9090 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
9091 	SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
9092 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9093 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9094 	SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
9095 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
9096 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
9097 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
9098 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
9099 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
9100 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
9101 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
9102 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
9103 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
9104 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
9105 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
9106 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
9107 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
9108 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
9109 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
9110 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
9111 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
9112 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
9113 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
9114 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
9115 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
9116 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
9117 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
9118 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
9119 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
9120 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
9121 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
9122 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
9123 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
9124 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
9125 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
9126 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9127 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9128 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9129 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9130 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
9131 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
9132 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
9133 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
9134 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
9135 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
9136 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
9137 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
9138 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
9139 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
9140 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
9141 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
9142 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
9143 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
9144 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
9145 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
9146 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
9147 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
9148 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9149 	SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9150 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9151 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9152 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9153 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9154 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9155 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9156 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9157 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9158 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9159 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9160 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9161 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9162 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9163 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9164 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9165 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9166 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9167 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9168 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9169 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9170 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9171 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9172 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9173 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9174 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9175 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9176 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9177 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9178 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9179 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9180 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9181 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9182 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9183 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9184 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9185 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9186 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9187 	SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9188 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9189 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9190 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9191 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9192 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9193 	SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9194 	SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9195 	SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
9196 	SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
9197 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
9198 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9199 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9200 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9201 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9202 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9203 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
9204 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9205 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9206 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9207 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9208 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9209 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9210 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9211 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9212 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL5XNU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9213 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9214 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9215 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9216 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9217 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9218 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9219 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
9220 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
9221 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
9222 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
9223 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
9224 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
9225 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
9226 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
9227 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
9228 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
9229 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
9230 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
9231 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9232 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
9233 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
9234 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
9235 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
9236 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
9237 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
9238 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9239 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
9240 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
9241 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
9242 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9243 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9244 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
9245 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
9246 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
9247 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9248 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9249 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
9250 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9251 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9252 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9253 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9254 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
9255 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
9256 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9257 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9258 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
9259 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
9260 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9261 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9262 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9263 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9264 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9265 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9266 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9267 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9268 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
9269 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9270 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
9271 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
9272 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
9273 	SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9274 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
9275 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
9276 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9277 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
9278 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
9279 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9280 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9281 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9282 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
9283 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
9284 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
9285 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
9286 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9287 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
9288 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
9289 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9290 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
9291 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
9292 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
9293 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
9294 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
9295 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9296 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
9297 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
9298 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9299 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9300 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9301 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
9302 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9303 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9304 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9305 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
9306 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
9307 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
9308 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
9309 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
9310 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
9311 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
9312 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
9313 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
9314 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
9315 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
9316 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
9317 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
9318 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
9319 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
9320 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
9321 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9322 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9323 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9324 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
9325 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
9326 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
9327 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
9328 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
9329 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
9330 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
9331 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
9332 	SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
9333 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
9334 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
9335 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
9336 
9337 #if 0
9338 	/* Below is a quirk table taken from the old code.
9339 	 * Basically the device should work as is without the fixup table.
9340 	 * If BIOS doesn't give a proper info, enable the corresponding
9341 	 * fixup entry.
9342 	 */
9343 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
9344 		      ALC269_FIXUP_AMIC),
9345 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
9346 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
9347 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
9348 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
9349 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
9350 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
9351 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
9352 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
9353 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
9354 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
9355 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
9356 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
9357 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
9358 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
9359 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
9360 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
9361 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
9362 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
9363 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
9364 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
9365 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
9366 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
9367 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
9368 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
9369 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
9370 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
9371 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
9372 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
9373 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
9374 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
9375 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
9376 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
9377 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
9378 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
9379 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
9380 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
9381 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
9382 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
9383 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
9384 #endif
9385 	{}
9386 };
9387 
9388 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9389 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9390 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9391 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9392 	SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
9393 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
9394 	{}
9395 };
9396 
9397 static const struct hda_model_fixup alc269_fixup_models[] = {
9398 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9399 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
9400 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9401 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9402 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
9403 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
9404 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9405 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
9406 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
9407 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9408 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9409 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
9410 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9411 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
9412 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9413 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
9414 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
9415 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
9416 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9417 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
9418 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
9419 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
9420 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
9421 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
9422 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
9423 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9424 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9425 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9426 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9427 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9428 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9429 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9430 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9431 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9432 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9433 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9434 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9435 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9436 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9437 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9438 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9439 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9440 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9441 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9442 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9443 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9444 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9445 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9446 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9447 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9448 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9449 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9450 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9451 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9452 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9453 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9454 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9455 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9456 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9457 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9458 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9459 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9460 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9461 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9462 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
9463 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
9464 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
9465 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
9466 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9467 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9468 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9469 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9470 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9471 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9472 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9473 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9474 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9475 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9476 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9477 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9478 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9479 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
9480 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9481 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9482 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
9483 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
9484 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
9485 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
9486 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9487 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9488 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9489 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9490 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9491 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9492 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9493 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9494 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9495 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9496 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9497 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9498 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9499 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9500 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9501 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9502 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
9503 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9504 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
9505 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
9506 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
9507 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
9508 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
9509 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
9510 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
9511 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
9512 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
9513 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
9514 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
9515 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
9516 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
9517 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
9518 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
9519 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
9520 	{}
9521 };
9522 #define ALC225_STANDARD_PINS \
9523 	{0x21, 0x04211020}
9524 
9525 #define ALC256_STANDARD_PINS \
9526 	{0x12, 0x90a60140}, \
9527 	{0x14, 0x90170110}, \
9528 	{0x21, 0x02211020}
9529 
9530 #define ALC282_STANDARD_PINS \
9531 	{0x14, 0x90170110}
9532 
9533 #define ALC290_STANDARD_PINS \
9534 	{0x12, 0x99a30130}
9535 
9536 #define ALC292_STANDARD_PINS \
9537 	{0x14, 0x90170110}, \
9538 	{0x15, 0x0221401f}
9539 
9540 #define ALC295_STANDARD_PINS \
9541 	{0x12, 0xb7a60130}, \
9542 	{0x14, 0x90170110}, \
9543 	{0x21, 0x04211020}
9544 
9545 #define ALC298_STANDARD_PINS \
9546 	{0x12, 0x90a60130}, \
9547 	{0x21, 0x03211020}
9548 
9549 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
9550 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9551 		{0x14, 0x01014020},
9552 		{0x17, 0x90170110},
9553 		{0x18, 0x02a11030},
9554 		{0x19, 0x0181303F},
9555 		{0x21, 0x0221102f}),
9556 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9557 		{0x12, 0x90a601c0},
9558 		{0x14, 0x90171120},
9559 		{0x21, 0x02211030}),
9560 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9561 		{0x14, 0x90170110},
9562 		{0x1b, 0x90a70130},
9563 		{0x21, 0x03211020}),
9564 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9565 		{0x1a, 0x90a70130},
9566 		{0x1b, 0x90170110},
9567 		{0x21, 0x03211020}),
9568 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9569 		ALC225_STANDARD_PINS,
9570 		{0x12, 0xb7a60130},
9571 		{0x14, 0x901701a0}),
9572 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9573 		ALC225_STANDARD_PINS,
9574 		{0x12, 0xb7a60130},
9575 		{0x14, 0x901701b0}),
9576 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9577 		ALC225_STANDARD_PINS,
9578 		{0x12, 0xb7a60150},
9579 		{0x14, 0x901701a0}),
9580 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9581 		ALC225_STANDARD_PINS,
9582 		{0x12, 0xb7a60150},
9583 		{0x14, 0x901701b0}),
9584 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9585 		ALC225_STANDARD_PINS,
9586 		{0x12, 0xb7a60130},
9587 		{0x1b, 0x90170110}),
9588 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9589 		{0x1b, 0x01111010},
9590 		{0x1e, 0x01451130},
9591 		{0x21, 0x02211020}),
9592 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9593 		{0x12, 0x90a60140},
9594 		{0x14, 0x90170110},
9595 		{0x19, 0x02a11030},
9596 		{0x21, 0x02211020}),
9597 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9598 		{0x14, 0x90170110},
9599 		{0x19, 0x02a11030},
9600 		{0x1a, 0x02a11040},
9601 		{0x1b, 0x01014020},
9602 		{0x21, 0x0221101f}),
9603 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9604 		{0x14, 0x90170110},
9605 		{0x19, 0x02a11030},
9606 		{0x1a, 0x02a11040},
9607 		{0x1b, 0x01011020},
9608 		{0x21, 0x0221101f}),
9609 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9610 		{0x14, 0x90170110},
9611 		{0x19, 0x02a11020},
9612 		{0x1a, 0x02a11030},
9613 		{0x21, 0x0221101f}),
9614 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9615 		{0x21, 0x02211010}),
9616 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9617 		{0x14, 0x90170110},
9618 		{0x19, 0x02a11020},
9619 		{0x21, 0x02211030}),
9620 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9621 		{0x14, 0x90170110},
9622 		{0x21, 0x02211020}),
9623 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9624 		{0x14, 0x90170130},
9625 		{0x21, 0x02211040}),
9626 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9627 		{0x12, 0x90a60140},
9628 		{0x14, 0x90170110},
9629 		{0x21, 0x02211020}),
9630 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9631 		{0x12, 0x90a60160},
9632 		{0x14, 0x90170120},
9633 		{0x21, 0x02211030}),
9634 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9635 		{0x14, 0x90170110},
9636 		{0x1b, 0x02011020},
9637 		{0x21, 0x0221101f}),
9638 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9639 		{0x14, 0x90170110},
9640 		{0x1b, 0x01011020},
9641 		{0x21, 0x0221101f}),
9642 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9643 		{0x14, 0x90170130},
9644 		{0x1b, 0x01014020},
9645 		{0x21, 0x0221103f}),
9646 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9647 		{0x14, 0x90170130},
9648 		{0x1b, 0x01011020},
9649 		{0x21, 0x0221103f}),
9650 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9651 		{0x14, 0x90170130},
9652 		{0x1b, 0x02011020},
9653 		{0x21, 0x0221103f}),
9654 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9655 		{0x14, 0x90170150},
9656 		{0x1b, 0x02011020},
9657 		{0x21, 0x0221105f}),
9658 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9659 		{0x14, 0x90170110},
9660 		{0x1b, 0x01014020},
9661 		{0x21, 0x0221101f}),
9662 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9663 		{0x12, 0x90a60160},
9664 		{0x14, 0x90170120},
9665 		{0x17, 0x90170140},
9666 		{0x21, 0x0321102f}),
9667 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9668 		{0x12, 0x90a60160},
9669 		{0x14, 0x90170130},
9670 		{0x21, 0x02211040}),
9671 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9672 		{0x12, 0x90a60160},
9673 		{0x14, 0x90170140},
9674 		{0x21, 0x02211050}),
9675 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9676 		{0x12, 0x90a60170},
9677 		{0x14, 0x90170120},
9678 		{0x21, 0x02211030}),
9679 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9680 		{0x12, 0x90a60170},
9681 		{0x14, 0x90170130},
9682 		{0x21, 0x02211040}),
9683 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9684 		{0x12, 0x90a60170},
9685 		{0x14, 0x90171130},
9686 		{0x21, 0x02211040}),
9687 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9688 		{0x12, 0x90a60170},
9689 		{0x14, 0x90170140},
9690 		{0x21, 0x02211050}),
9691 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9692 		{0x12, 0x90a60180},
9693 		{0x14, 0x90170130},
9694 		{0x21, 0x02211040}),
9695 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9696 		{0x12, 0x90a60180},
9697 		{0x14, 0x90170120},
9698 		{0x21, 0x02211030}),
9699 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9700 		{0x1b, 0x01011020},
9701 		{0x21, 0x02211010}),
9702 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9703 		{0x14, 0x90170110},
9704 		{0x1b, 0x90a70130},
9705 		{0x21, 0x04211020}),
9706 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9707 		{0x14, 0x90170110},
9708 		{0x1b, 0x90a70130},
9709 		{0x21, 0x03211020}),
9710 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9711 		{0x12, 0x90a60130},
9712 		{0x14, 0x90170110},
9713 		{0x21, 0x03211020}),
9714 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9715 		{0x12, 0x90a60130},
9716 		{0x14, 0x90170110},
9717 		{0x21, 0x04211020}),
9718 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9719 		{0x1a, 0x90a70130},
9720 		{0x1b, 0x90170110},
9721 		{0x21, 0x03211020}),
9722        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9723 		{0x14, 0x90170110},
9724 		{0x19, 0x02a11020},
9725 		{0x21, 0x0221101f}),
9726        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9727 		{0x17, 0x90170110},
9728 		{0x19, 0x03a11030},
9729 		{0x21, 0x03211020}),
9730 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9731 		{0x12, 0x90a60130},
9732 		{0x14, 0x90170110},
9733 		{0x15, 0x0421101f},
9734 		{0x1a, 0x04a11020}),
9735 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9736 		{0x12, 0x90a60140},
9737 		{0x14, 0x90170110},
9738 		{0x15, 0x0421101f},
9739 		{0x18, 0x02811030},
9740 		{0x1a, 0x04a1103f},
9741 		{0x1b, 0x02011020}),
9742 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9743 		ALC282_STANDARD_PINS,
9744 		{0x12, 0x99a30130},
9745 		{0x19, 0x03a11020},
9746 		{0x21, 0x0321101f}),
9747 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9748 		ALC282_STANDARD_PINS,
9749 		{0x12, 0x99a30130},
9750 		{0x19, 0x03a11020},
9751 		{0x21, 0x03211040}),
9752 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9753 		ALC282_STANDARD_PINS,
9754 		{0x12, 0x99a30130},
9755 		{0x19, 0x03a11030},
9756 		{0x21, 0x03211020}),
9757 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9758 		ALC282_STANDARD_PINS,
9759 		{0x12, 0x99a30130},
9760 		{0x19, 0x04a11020},
9761 		{0x21, 0x0421101f}),
9762 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
9763 		ALC282_STANDARD_PINS,
9764 		{0x12, 0x90a60140},
9765 		{0x19, 0x04a11030},
9766 		{0x21, 0x04211020}),
9767 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9768 		ALC282_STANDARD_PINS,
9769 		{0x12, 0x90a609c0},
9770 		{0x18, 0x03a11830},
9771 		{0x19, 0x04a19831},
9772 		{0x1a, 0x0481303f},
9773 		{0x1b, 0x04211020},
9774 		{0x21, 0x0321101f}),
9775 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9776 		ALC282_STANDARD_PINS,
9777 		{0x12, 0x90a60940},
9778 		{0x18, 0x03a11830},
9779 		{0x19, 0x04a19831},
9780 		{0x1a, 0x0481303f},
9781 		{0x1b, 0x04211020},
9782 		{0x21, 0x0321101f}),
9783 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9784 		ALC282_STANDARD_PINS,
9785 		{0x12, 0x90a60130},
9786 		{0x21, 0x0321101f}),
9787 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9788 		{0x12, 0x90a60160},
9789 		{0x14, 0x90170120},
9790 		{0x21, 0x02211030}),
9791 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9792 		ALC282_STANDARD_PINS,
9793 		{0x12, 0x90a60130},
9794 		{0x19, 0x03a11020},
9795 		{0x21, 0x0321101f}),
9796 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9797 		{0x12, 0x90a60130},
9798 		{0x14, 0x90170110},
9799 		{0x19, 0x04a11040},
9800 		{0x21, 0x04211020}),
9801 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9802 		{0x14, 0x90170110},
9803 		{0x19, 0x04a11040},
9804 		{0x1d, 0x40600001},
9805 		{0x21, 0x04211020}),
9806 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9807 		{0x14, 0x90170110},
9808 		{0x19, 0x04a11040},
9809 		{0x21, 0x04211020}),
9810 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9811 		{0x14, 0x90170110},
9812 		{0x17, 0x90170111},
9813 		{0x19, 0x03a11030},
9814 		{0x21, 0x03211020}),
9815 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9816 		{0x12, 0x90a60130},
9817 		{0x17, 0x90170110},
9818 		{0x21, 0x02211020}),
9819 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
9820 		{0x12, 0x90a60120},
9821 		{0x14, 0x90170110},
9822 		{0x21, 0x0321101f}),
9823 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9824 		ALC290_STANDARD_PINS,
9825 		{0x15, 0x04211040},
9826 		{0x18, 0x90170112},
9827 		{0x1a, 0x04a11020}),
9828 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9829 		ALC290_STANDARD_PINS,
9830 		{0x15, 0x04211040},
9831 		{0x18, 0x90170110},
9832 		{0x1a, 0x04a11020}),
9833 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9834 		ALC290_STANDARD_PINS,
9835 		{0x15, 0x0421101f},
9836 		{0x1a, 0x04a11020}),
9837 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9838 		ALC290_STANDARD_PINS,
9839 		{0x15, 0x04211020},
9840 		{0x1a, 0x04a11040}),
9841 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9842 		ALC290_STANDARD_PINS,
9843 		{0x14, 0x90170110},
9844 		{0x15, 0x04211020},
9845 		{0x1a, 0x04a11040}),
9846 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9847 		ALC290_STANDARD_PINS,
9848 		{0x14, 0x90170110},
9849 		{0x15, 0x04211020},
9850 		{0x1a, 0x04a11020}),
9851 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9852 		ALC290_STANDARD_PINS,
9853 		{0x14, 0x90170110},
9854 		{0x15, 0x0421101f},
9855 		{0x1a, 0x04a11020}),
9856 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
9857 		ALC292_STANDARD_PINS,
9858 		{0x12, 0x90a60140},
9859 		{0x16, 0x01014020},
9860 		{0x19, 0x01a19030}),
9861 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
9862 		ALC292_STANDARD_PINS,
9863 		{0x12, 0x90a60140},
9864 		{0x16, 0x01014020},
9865 		{0x18, 0x02a19031},
9866 		{0x19, 0x01a1903e}),
9867 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
9868 		ALC292_STANDARD_PINS,
9869 		{0x12, 0x90a60140}),
9870 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
9871 		ALC292_STANDARD_PINS,
9872 		{0x13, 0x90a60140},
9873 		{0x16, 0x21014020},
9874 		{0x19, 0x21a19030}),
9875 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
9876 		ALC292_STANDARD_PINS,
9877 		{0x13, 0x90a60140}),
9878 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9879 		{0x17, 0x90170110},
9880 		{0x21, 0x04211020}),
9881 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9882 		{0x14, 0x90170110},
9883 		{0x1b, 0x90a70130},
9884 		{0x21, 0x04211020}),
9885 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9886 		{0x12, 0x90a60130},
9887 		{0x17, 0x90170110},
9888 		{0x21, 0x03211020}),
9889 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9890 		{0x12, 0x90a60130},
9891 		{0x17, 0x90170110},
9892 		{0x21, 0x04211020}),
9893 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9894 		{0x12, 0x90a60130},
9895 		{0x17, 0x90170110},
9896 		{0x21, 0x03211020}),
9897 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9898 		{0x12, 0x90a60120},
9899 		{0x17, 0x90170110},
9900 		{0x21, 0x04211030}),
9901 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9902 		{0x12, 0x90a60130},
9903 		{0x17, 0x90170110},
9904 		{0x21, 0x03211020}),
9905 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9906 		{0x12, 0x90a60130},
9907 		{0x17, 0x90170110},
9908 		{0x21, 0x03211020}),
9909 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9910 		ALC298_STANDARD_PINS,
9911 		{0x17, 0x90170110}),
9912 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9913 		ALC298_STANDARD_PINS,
9914 		{0x17, 0x90170140}),
9915 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9916 		ALC298_STANDARD_PINS,
9917 		{0x17, 0x90170150}),
9918 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9919 		{0x12, 0xb7a60140},
9920 		{0x13, 0xb7a60150},
9921 		{0x17, 0x90170110},
9922 		{0x1a, 0x03011020},
9923 		{0x21, 0x03211030}),
9924 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9925 		{0x12, 0xb7a60140},
9926 		{0x17, 0x90170110},
9927 		{0x1a, 0x03a11030},
9928 		{0x21, 0x03211020}),
9929 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9930 		ALC225_STANDARD_PINS,
9931 		{0x12, 0xb7a60130},
9932 		{0x17, 0x90170110}),
9933 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9934 		{0x14, 0x01014010},
9935 		{0x17, 0x90170120},
9936 		{0x18, 0x02a11030},
9937 		{0x19, 0x02a1103f},
9938 		{0x21, 0x0221101f}),
9939 	{}
9940 };
9941 
9942 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9943  * more machines, don't need to match all valid pins, just need to match
9944  * all the pins defined in the tbl. Just because of this reason, it is possible
9945  * that a single machine matches multiple tbls, so there is one limitation:
9946  *   at most one tbl is allowed to define for the same vendor and same codec
9947  */
9948 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9949 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9950 		{0x19, 0x40000000},
9951 		{0x1b, 0x40000000}),
9952 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9953 		{0x19, 0x40000000},
9954 		{0x1b, 0x40000000}),
9955 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9956 		{0x19, 0x40000000},
9957 		{0x1a, 0x40000000}),
9958 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9959 		{0x19, 0x40000000},
9960 		{0x1a, 0x40000000}),
9961 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9962 		{0x19, 0x40000000},
9963 		{0x1a, 0x40000000}),
9964 	{}
9965 };
9966 
alc269_fill_coef(struct hda_codec * codec)9967 static void alc269_fill_coef(struct hda_codec *codec)
9968 {
9969 	struct alc_spec *spec = codec->spec;
9970 	int val;
9971 
9972 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
9973 		return;
9974 
9975 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
9976 		alc_write_coef_idx(codec, 0xf, 0x960b);
9977 		alc_write_coef_idx(codec, 0xe, 0x8817);
9978 	}
9979 
9980 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
9981 		alc_write_coef_idx(codec, 0xf, 0x960b);
9982 		alc_write_coef_idx(codec, 0xe, 0x8814);
9983 	}
9984 
9985 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
9986 		/* Power up output pin */
9987 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
9988 	}
9989 
9990 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
9991 		val = alc_read_coef_idx(codec, 0xd);
9992 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
9993 			/* Capless ramp up clock control */
9994 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
9995 		}
9996 		val = alc_read_coef_idx(codec, 0x17);
9997 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
9998 			/* Class D power on reset */
9999 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
10000 		}
10001 	}
10002 
10003 	/* HP */
10004 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
10005 }
10006 
10007 /*
10008  */
patch_alc269(struct hda_codec * codec)10009 static int patch_alc269(struct hda_codec *codec)
10010 {
10011 	struct alc_spec *spec;
10012 	int err;
10013 
10014 	err = alc_alloc_spec(codec, 0x0b);
10015 	if (err < 0)
10016 		return err;
10017 
10018 	spec = codec->spec;
10019 	spec->gen.shared_mic_vref_pin = 0x18;
10020 	codec->power_save_node = 0;
10021 	spec->en_3kpull_low = true;
10022 
10023 #ifdef CONFIG_PM
10024 	codec->patch_ops.suspend = alc269_suspend;
10025 	codec->patch_ops.resume = alc269_resume;
10026 #endif
10027 	spec->shutup = alc_default_shutup;
10028 	spec->init_hook = alc_default_init;
10029 
10030 	switch (codec->core.vendor_id) {
10031 	case 0x10ec0269:
10032 		spec->codec_variant = ALC269_TYPE_ALC269VA;
10033 		switch (alc_get_coef0(codec) & 0x00f0) {
10034 		case 0x0010:
10035 			if (codec->bus->pci &&
10036 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
10037 			    spec->cdefine.platform_type == 1)
10038 				err = alc_codec_rename(codec, "ALC271X");
10039 			spec->codec_variant = ALC269_TYPE_ALC269VB;
10040 			break;
10041 		case 0x0020:
10042 			if (codec->bus->pci &&
10043 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
10044 			    codec->bus->pci->subsystem_device == 0x21f3)
10045 				err = alc_codec_rename(codec, "ALC3202");
10046 			spec->codec_variant = ALC269_TYPE_ALC269VC;
10047 			break;
10048 		case 0x0030:
10049 			spec->codec_variant = ALC269_TYPE_ALC269VD;
10050 			break;
10051 		default:
10052 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
10053 		}
10054 		if (err < 0)
10055 			goto error;
10056 		spec->shutup = alc269_shutup;
10057 		spec->init_hook = alc269_fill_coef;
10058 		alc269_fill_coef(codec);
10059 		break;
10060 
10061 	case 0x10ec0280:
10062 	case 0x10ec0290:
10063 		spec->codec_variant = ALC269_TYPE_ALC280;
10064 		break;
10065 	case 0x10ec0282:
10066 		spec->codec_variant = ALC269_TYPE_ALC282;
10067 		spec->shutup = alc282_shutup;
10068 		spec->init_hook = alc282_init;
10069 		break;
10070 	case 0x10ec0233:
10071 	case 0x10ec0283:
10072 		spec->codec_variant = ALC269_TYPE_ALC283;
10073 		spec->shutup = alc283_shutup;
10074 		spec->init_hook = alc283_init;
10075 		break;
10076 	case 0x10ec0284:
10077 	case 0x10ec0292:
10078 		spec->codec_variant = ALC269_TYPE_ALC284;
10079 		break;
10080 	case 0x10ec0293:
10081 		spec->codec_variant = ALC269_TYPE_ALC293;
10082 		break;
10083 	case 0x10ec0286:
10084 	case 0x10ec0288:
10085 		spec->codec_variant = ALC269_TYPE_ALC286;
10086 		break;
10087 	case 0x10ec0298:
10088 		spec->codec_variant = ALC269_TYPE_ALC298;
10089 		break;
10090 	case 0x10ec0235:
10091 	case 0x10ec0255:
10092 		spec->codec_variant = ALC269_TYPE_ALC255;
10093 		spec->shutup = alc256_shutup;
10094 		spec->init_hook = alc256_init;
10095 		break;
10096 	case 0x10ec0230:
10097 	case 0x10ec0236:
10098 	case 0x10ec0256:
10099 	case 0x19e58326:
10100 		spec->codec_variant = ALC269_TYPE_ALC256;
10101 		spec->shutup = alc256_shutup;
10102 		spec->init_hook = alc256_init;
10103 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
10104 		if (codec->core.vendor_id == 0x10ec0236 &&
10105 		    codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
10106 			spec->en_3kpull_low = false;
10107 		break;
10108 	case 0x10ec0257:
10109 		spec->codec_variant = ALC269_TYPE_ALC257;
10110 		spec->shutup = alc256_shutup;
10111 		spec->init_hook = alc256_init;
10112 		spec->gen.mixer_nid = 0;
10113 		spec->en_3kpull_low = false;
10114 		break;
10115 	case 0x10ec0215:
10116 	case 0x10ec0245:
10117 	case 0x10ec0285:
10118 	case 0x10ec0287:
10119 	case 0x10ec0289:
10120 		spec->codec_variant = ALC269_TYPE_ALC215;
10121 		spec->shutup = alc225_shutup;
10122 		spec->init_hook = alc225_init;
10123 		spec->gen.mixer_nid = 0;
10124 		break;
10125 	case 0x10ec0225:
10126 	case 0x10ec0295:
10127 	case 0x10ec0299:
10128 		spec->codec_variant = ALC269_TYPE_ALC225;
10129 		spec->shutup = alc225_shutup;
10130 		spec->init_hook = alc225_init;
10131 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
10132 		break;
10133 	case 0x10ec0234:
10134 	case 0x10ec0274:
10135 	case 0x10ec0294:
10136 		spec->codec_variant = ALC269_TYPE_ALC294;
10137 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
10138 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
10139 		spec->init_hook = alc294_init;
10140 		break;
10141 	case 0x10ec0300:
10142 		spec->codec_variant = ALC269_TYPE_ALC300;
10143 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
10144 		break;
10145 	case 0x10ec0623:
10146 		spec->codec_variant = ALC269_TYPE_ALC623;
10147 		break;
10148 	case 0x10ec0700:
10149 	case 0x10ec0701:
10150 	case 0x10ec0703:
10151 	case 0x10ec0711:
10152 		spec->codec_variant = ALC269_TYPE_ALC700;
10153 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
10154 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
10155 		spec->init_hook = alc294_init;
10156 		break;
10157 
10158 	}
10159 
10160 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
10161 		spec->has_alc5505_dsp = 1;
10162 		spec->init_hook = alc5505_dsp_init;
10163 	}
10164 
10165 	alc_pre_init(codec);
10166 
10167 	snd_hda_pick_fixup(codec, alc269_fixup_models,
10168 		       alc269_fixup_tbl, alc269_fixups);
10169 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
10170 	 * the quirk breaks the latter (bko#214101).
10171 	 * Clear the wrong entry.
10172 	 */
10173 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
10174 	    codec->core.vendor_id == 0x10ec0294) {
10175 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
10176 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
10177 	}
10178 
10179 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
10180 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
10181 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
10182 			   alc269_fixups);
10183 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10184 
10185 	alc_auto_parse_customize_define(codec);
10186 
10187 	if (has_cdefine_beep(codec))
10188 		spec->gen.beep_nid = 0x01;
10189 
10190 	/* automatic parse from the BIOS config */
10191 	err = alc269_parse_auto_config(codec);
10192 	if (err < 0)
10193 		goto error;
10194 
10195 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
10196 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
10197 		if (err < 0)
10198 			goto error;
10199 	}
10200 
10201 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10202 
10203 	return 0;
10204 
10205  error:
10206 	alc_free(codec);
10207 	return err;
10208 }
10209 
10210 /*
10211  * ALC861
10212  */
10213 
alc861_parse_auto_config(struct hda_codec * codec)10214 static int alc861_parse_auto_config(struct hda_codec *codec)
10215 {
10216 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
10217 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
10218 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
10219 }
10220 
10221 /* Pin config fixes */
10222 enum {
10223 	ALC861_FIXUP_FSC_AMILO_PI1505,
10224 	ALC861_FIXUP_AMP_VREF_0F,
10225 	ALC861_FIXUP_NO_JACK_DETECT,
10226 	ALC861_FIXUP_ASUS_A6RP,
10227 	ALC660_FIXUP_ASUS_W7J,
10228 };
10229 
10230 /* 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)10231 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
10232 			const struct hda_fixup *fix, int action)
10233 {
10234 	struct alc_spec *spec = codec->spec;
10235 	unsigned int val;
10236 
10237 	if (action != HDA_FIXUP_ACT_INIT)
10238 		return;
10239 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
10240 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
10241 		val |= AC_PINCTL_IN_EN;
10242 	val |= AC_PINCTL_VREF_50;
10243 	snd_hda_set_pin_ctl(codec, 0x0f, val);
10244 	spec->gen.keep_vref_in_automute = 1;
10245 }
10246 
10247 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)10248 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
10249 				     const struct hda_fixup *fix, int action)
10250 {
10251 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
10252 		codec->no_jack_detect = 1;
10253 }
10254 
10255 static const struct hda_fixup alc861_fixups[] = {
10256 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
10257 		.type = HDA_FIXUP_PINS,
10258 		.v.pins = (const struct hda_pintbl[]) {
10259 			{ 0x0b, 0x0221101f }, /* HP */
10260 			{ 0x0f, 0x90170310 }, /* speaker */
10261 			{ }
10262 		}
10263 	},
10264 	[ALC861_FIXUP_AMP_VREF_0F] = {
10265 		.type = HDA_FIXUP_FUNC,
10266 		.v.func = alc861_fixup_asus_amp_vref_0f,
10267 	},
10268 	[ALC861_FIXUP_NO_JACK_DETECT] = {
10269 		.type = HDA_FIXUP_FUNC,
10270 		.v.func = alc_fixup_no_jack_detect,
10271 	},
10272 	[ALC861_FIXUP_ASUS_A6RP] = {
10273 		.type = HDA_FIXUP_FUNC,
10274 		.v.func = alc861_fixup_asus_amp_vref_0f,
10275 		.chained = true,
10276 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
10277 	},
10278 	[ALC660_FIXUP_ASUS_W7J] = {
10279 		.type = HDA_FIXUP_VERBS,
10280 		.v.verbs = (const struct hda_verb[]) {
10281 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
10282 			 * for enabling outputs
10283 			 */
10284 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10285 			{ }
10286 		},
10287 	}
10288 };
10289 
10290 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
10291 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
10292 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
10293 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
10294 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
10295 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
10296 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
10297 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
10298 	{}
10299 };
10300 
10301 /*
10302  */
patch_alc861(struct hda_codec * codec)10303 static int patch_alc861(struct hda_codec *codec)
10304 {
10305 	struct alc_spec *spec;
10306 	int err;
10307 
10308 	err = alc_alloc_spec(codec, 0x15);
10309 	if (err < 0)
10310 		return err;
10311 
10312 	spec = codec->spec;
10313 	if (has_cdefine_beep(codec))
10314 		spec->gen.beep_nid = 0x23;
10315 
10316 #ifdef CONFIG_PM
10317 	spec->power_hook = alc_power_eapd;
10318 #endif
10319 
10320 	alc_pre_init(codec);
10321 
10322 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10323 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10324 
10325 	/* automatic parse from the BIOS config */
10326 	err = alc861_parse_auto_config(codec);
10327 	if (err < 0)
10328 		goto error;
10329 
10330 	if (!spec->gen.no_analog) {
10331 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
10332 		if (err < 0)
10333 			goto error;
10334 	}
10335 
10336 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10337 
10338 	return 0;
10339 
10340  error:
10341 	alc_free(codec);
10342 	return err;
10343 }
10344 
10345 /*
10346  * ALC861-VD support
10347  *
10348  * Based on ALC882
10349  *
10350  * In addition, an independent DAC
10351  */
alc861vd_parse_auto_config(struct hda_codec * codec)10352 static int alc861vd_parse_auto_config(struct hda_codec *codec)
10353 {
10354 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
10355 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10356 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
10357 }
10358 
10359 enum {
10360 	ALC660VD_FIX_ASUS_GPIO1,
10361 	ALC861VD_FIX_DALLAS,
10362 };
10363 
10364 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)10365 static void alc861vd_fixup_dallas(struct hda_codec *codec,
10366 				  const struct hda_fixup *fix, int action)
10367 {
10368 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10369 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10370 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
10371 	}
10372 }
10373 
10374 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)10375 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10376 				      const struct hda_fixup *fix, int action)
10377 {
10378 	struct alc_spec *spec = codec->spec;
10379 
10380 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
10381 		spec->gpio_mask |= 0x02;
10382 	alc_fixup_gpio(codec, action, 0x01);
10383 }
10384 
10385 static const struct hda_fixup alc861vd_fixups[] = {
10386 	[ALC660VD_FIX_ASUS_GPIO1] = {
10387 		.type = HDA_FIXUP_FUNC,
10388 		.v.func = alc660vd_fixup_asus_gpio1,
10389 	},
10390 	[ALC861VD_FIX_DALLAS] = {
10391 		.type = HDA_FIXUP_FUNC,
10392 		.v.func = alc861vd_fixup_dallas,
10393 	},
10394 };
10395 
10396 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
10397 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
10398 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
10399 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
10400 	{}
10401 };
10402 
10403 /*
10404  */
patch_alc861vd(struct hda_codec * codec)10405 static int patch_alc861vd(struct hda_codec *codec)
10406 {
10407 	struct alc_spec *spec;
10408 	int err;
10409 
10410 	err = alc_alloc_spec(codec, 0x0b);
10411 	if (err < 0)
10412 		return err;
10413 
10414 	spec = codec->spec;
10415 	if (has_cdefine_beep(codec))
10416 		spec->gen.beep_nid = 0x23;
10417 
10418 	spec->shutup = alc_eapd_shutup;
10419 
10420 	alc_pre_init(codec);
10421 
10422 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10423 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10424 
10425 	/* automatic parse from the BIOS config */
10426 	err = alc861vd_parse_auto_config(codec);
10427 	if (err < 0)
10428 		goto error;
10429 
10430 	if (!spec->gen.no_analog) {
10431 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10432 		if (err < 0)
10433 			goto error;
10434 	}
10435 
10436 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10437 
10438 	return 0;
10439 
10440  error:
10441 	alc_free(codec);
10442 	return err;
10443 }
10444 
10445 /*
10446  * ALC662 support
10447  *
10448  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10449  * configuration.  Each pin widget can choose any input DACs and a mixer.
10450  * Each ADC is connected from a mixer of all inputs.  This makes possible
10451  * 6-channel independent captures.
10452  *
10453  * In addition, an independent DAC for the multi-playback (not used in this
10454  * driver yet).
10455  */
10456 
10457 /*
10458  * BIOS auto configuration
10459  */
10460 
alc662_parse_auto_config(struct hda_codec * codec)10461 static int alc662_parse_auto_config(struct hda_codec *codec)
10462 {
10463 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
10464 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10465 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10466 	const hda_nid_t *ssids;
10467 
10468 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10469 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10470 	    codec->core.vendor_id == 0x10ec0671)
10471 		ssids = alc663_ssids;
10472 	else
10473 		ssids = alc662_ssids;
10474 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
10475 }
10476 
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)10477 static void alc272_fixup_mario(struct hda_codec *codec,
10478 			       const struct hda_fixup *fix, int action)
10479 {
10480 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
10481 		return;
10482 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10483 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10484 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10485 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10486 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
10487 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
10488 }
10489 
10490 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10491 	{ .channels = 2,
10492 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10493 	{ .channels = 4,
10494 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10495 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10496 	{ }
10497 };
10498 
10499 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)10500 static void alc_fixup_bass_chmap(struct hda_codec *codec,
10501 				    const struct hda_fixup *fix, int action)
10502 {
10503 	if (action == HDA_FIXUP_ACT_BUILD) {
10504 		struct alc_spec *spec = codec->spec;
10505 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
10506 	}
10507 }
10508 
10509 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)10510 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10511 					  hda_nid_t nid,
10512 					  unsigned int power_state)
10513 {
10514 	struct alc_spec *spec = codec->spec;
10515 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
10516 		return AC_PWRST_D0;
10517 	return power_state;
10518 }
10519 
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)10520 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10521 				   const struct hda_fixup *fix, int action)
10522 {
10523 	struct alc_spec *spec = codec->spec;
10524 
10525 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
10526 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10527 		spec->mute_led_polarity = 1;
10528 		codec->power_filter = gpio_led_power_filter;
10529 	}
10530 }
10531 
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)10532 static void alc662_usi_automute_hook(struct hda_codec *codec,
10533 					 struct hda_jack_callback *jack)
10534 {
10535 	struct alc_spec *spec = codec->spec;
10536 	int vref;
10537 	msleep(200);
10538 	snd_hda_gen_hp_automute(codec, jack);
10539 
10540 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10541 	msleep(100);
10542 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10543 			    vref);
10544 }
10545 
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)10546 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10547 				     const struct hda_fixup *fix, int action)
10548 {
10549 	struct alc_spec *spec = codec->spec;
10550 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10551 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10552 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10553 	}
10554 }
10555 
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)10556 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10557 					struct hda_jack_callback *cb)
10558 {
10559 	/* surround speakers at 0x1b already get muted automatically when
10560 	 * headphones are plugged in, but we have to mute/unmute the remaining
10561 	 * channels manually:
10562 	 * 0x15 - front left/front right
10563 	 * 0x18 - front center/ LFE
10564 	 */
10565 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10566 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10567 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10568 	} else {
10569 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10570 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10571 	}
10572 }
10573 
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)10574 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10575 					const struct hda_fixup *fix, int action)
10576 {
10577     /* Pin 0x1b: shared headphones jack and surround speakers */
10578 	if (!is_jack_detectable(codec, 0x1b))
10579 		return;
10580 
10581 	switch (action) {
10582 	case HDA_FIXUP_ACT_PRE_PROBE:
10583 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
10584 				alc662_aspire_ethos_mute_speakers);
10585 		/* subwoofer needs an extra GPIO setting to become audible */
10586 		alc_setup_gpio(codec, 0x02);
10587 		break;
10588 	case HDA_FIXUP_ACT_INIT:
10589 		/* Make sure to start in a correct state, i.e. if
10590 		 * headphones have been plugged in before powering up the system
10591 		 */
10592 		alc662_aspire_ethos_mute_speakers(codec, NULL);
10593 		break;
10594 	}
10595 }
10596 
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)10597 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10598 					     const struct hda_fixup *fix, int action)
10599 {
10600 	struct alc_spec *spec = codec->spec;
10601 
10602 	static const struct hda_pintbl pincfgs[] = {
10603 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10604 		{ 0x1b, 0x0181304f },
10605 		{ }
10606 	};
10607 
10608 	switch (action) {
10609 	case HDA_FIXUP_ACT_PRE_PROBE:
10610 		spec->gen.mixer_nid = 0;
10611 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10612 		snd_hda_apply_pincfgs(codec, pincfgs);
10613 		break;
10614 	case HDA_FIXUP_ACT_INIT:
10615 		alc_write_coef_idx(codec, 0x19, 0xa054);
10616 		break;
10617 	}
10618 }
10619 
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)10620 static void alc897_hp_automute_hook(struct hda_codec *codec,
10621 					 struct hda_jack_callback *jack)
10622 {
10623 	struct alc_spec *spec = codec->spec;
10624 	int vref;
10625 
10626 	snd_hda_gen_hp_automute(codec, jack);
10627 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10628 	snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10629 			    vref);
10630 }
10631 
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)10632 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10633 				     const struct hda_fixup *fix, int action)
10634 {
10635 	struct alc_spec *spec = codec->spec;
10636 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10637 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10638 	}
10639 }
10640 
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)10641 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
10642 				     const struct hda_fixup *fix, int action)
10643 {
10644 	struct alc_spec *spec = codec->spec;
10645 
10646 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10647 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10648 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10649 	}
10650 }
10651 
10652 static const struct coef_fw alc668_coefs[] = {
10653 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
10654 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
10655 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
10656 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10657 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10658 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10659 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
10660 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
10661 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10662 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10663 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10664 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10665 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
10666 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10667 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
10668 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
10669 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10670 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10671 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10672 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10673 	{}
10674 };
10675 
alc668_restore_default_value(struct hda_codec * codec)10676 static void alc668_restore_default_value(struct hda_codec *codec)
10677 {
10678 	alc_process_coef_fw(codec, alc668_coefs);
10679 }
10680 
10681 enum {
10682 	ALC662_FIXUP_ASPIRE,
10683 	ALC662_FIXUP_LED_GPIO1,
10684 	ALC662_FIXUP_IDEAPAD,
10685 	ALC272_FIXUP_MARIO,
10686 	ALC662_FIXUP_CZC_ET26,
10687 	ALC662_FIXUP_CZC_P10T,
10688 	ALC662_FIXUP_SKU_IGNORE,
10689 	ALC662_FIXUP_HP_RP5800,
10690 	ALC662_FIXUP_ASUS_MODE1,
10691 	ALC662_FIXUP_ASUS_MODE2,
10692 	ALC662_FIXUP_ASUS_MODE3,
10693 	ALC662_FIXUP_ASUS_MODE4,
10694 	ALC662_FIXUP_ASUS_MODE5,
10695 	ALC662_FIXUP_ASUS_MODE6,
10696 	ALC662_FIXUP_ASUS_MODE7,
10697 	ALC662_FIXUP_ASUS_MODE8,
10698 	ALC662_FIXUP_NO_JACK_DETECT,
10699 	ALC662_FIXUP_ZOTAC_Z68,
10700 	ALC662_FIXUP_INV_DMIC,
10701 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
10702 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
10703 	ALC662_FIXUP_HEADSET_MODE,
10704 	ALC668_FIXUP_HEADSET_MODE,
10705 	ALC662_FIXUP_BASS_MODE4_CHMAP,
10706 	ALC662_FIXUP_BASS_16,
10707 	ALC662_FIXUP_BASS_1A,
10708 	ALC662_FIXUP_BASS_CHMAP,
10709 	ALC668_FIXUP_AUTO_MUTE,
10710 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
10711 	ALC668_FIXUP_DELL_XPS13,
10712 	ALC662_FIXUP_ASUS_Nx50,
10713 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
10714 	ALC668_FIXUP_ASUS_Nx51,
10715 	ALC668_FIXUP_MIC_COEF,
10716 	ALC668_FIXUP_ASUS_G751,
10717 	ALC891_FIXUP_HEADSET_MODE,
10718 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10719 	ALC662_FIXUP_ACER_VERITON,
10720 	ALC892_FIXUP_ASROCK_MOBO,
10721 	ALC662_FIXUP_USI_FUNC,
10722 	ALC662_FIXUP_USI_HEADSET_MODE,
10723 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
10724 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
10725 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
10726 	ALC671_FIXUP_HP_HEADSET_MIC2,
10727 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
10728 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
10729 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10730 	ALC668_FIXUP_HEADSET_MIC,
10731 	ALC668_FIXUP_MIC_DET_COEF,
10732 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
10733 	ALC897_FIXUP_HEADSET_MIC_PIN,
10734 	ALC897_FIXUP_HP_HSMIC_VERB,
10735 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
10736 	ALC897_FIXUP_HEADSET_MIC_PIN2,
10737 	ALC897_FIXUP_UNIS_H3C_X500S,
10738 };
10739 
10740 static const struct hda_fixup alc662_fixups[] = {
10741 	[ALC662_FIXUP_ASPIRE] = {
10742 		.type = HDA_FIXUP_PINS,
10743 		.v.pins = (const struct hda_pintbl[]) {
10744 			{ 0x15, 0x99130112 }, /* subwoofer */
10745 			{ }
10746 		}
10747 	},
10748 	[ALC662_FIXUP_LED_GPIO1] = {
10749 		.type = HDA_FIXUP_FUNC,
10750 		.v.func = alc662_fixup_led_gpio1,
10751 	},
10752 	[ALC662_FIXUP_IDEAPAD] = {
10753 		.type = HDA_FIXUP_PINS,
10754 		.v.pins = (const struct hda_pintbl[]) {
10755 			{ 0x17, 0x99130112 }, /* subwoofer */
10756 			{ }
10757 		},
10758 		.chained = true,
10759 		.chain_id = ALC662_FIXUP_LED_GPIO1,
10760 	},
10761 	[ALC272_FIXUP_MARIO] = {
10762 		.type = HDA_FIXUP_FUNC,
10763 		.v.func = alc272_fixup_mario,
10764 	},
10765 	[ALC662_FIXUP_CZC_ET26] = {
10766 		.type = HDA_FIXUP_PINS,
10767 		.v.pins = (const struct hda_pintbl[]) {
10768 			{0x12, 0x403cc000},
10769 			{0x14, 0x90170110}, /* speaker */
10770 			{0x15, 0x411111f0},
10771 			{0x16, 0x411111f0},
10772 			{0x18, 0x01a19030}, /* mic */
10773 			{0x19, 0x90a7013f}, /* int-mic */
10774 			{0x1a, 0x01014020},
10775 			{0x1b, 0x0121401f},
10776 			{0x1c, 0x411111f0},
10777 			{0x1d, 0x411111f0},
10778 			{0x1e, 0x40478e35},
10779 			{}
10780 		},
10781 		.chained = true,
10782 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10783 	},
10784 	[ALC662_FIXUP_CZC_P10T] = {
10785 		.type = HDA_FIXUP_VERBS,
10786 		.v.verbs = (const struct hda_verb[]) {
10787 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10788 			{}
10789 		}
10790 	},
10791 	[ALC662_FIXUP_SKU_IGNORE] = {
10792 		.type = HDA_FIXUP_FUNC,
10793 		.v.func = alc_fixup_sku_ignore,
10794 	},
10795 	[ALC662_FIXUP_HP_RP5800] = {
10796 		.type = HDA_FIXUP_PINS,
10797 		.v.pins = (const struct hda_pintbl[]) {
10798 			{ 0x14, 0x0221201f }, /* HP out */
10799 			{ }
10800 		},
10801 		.chained = true,
10802 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10803 	},
10804 	[ALC662_FIXUP_ASUS_MODE1] = {
10805 		.type = HDA_FIXUP_PINS,
10806 		.v.pins = (const struct hda_pintbl[]) {
10807 			{ 0x14, 0x99130110 }, /* speaker */
10808 			{ 0x18, 0x01a19c20 }, /* mic */
10809 			{ 0x19, 0x99a3092f }, /* int-mic */
10810 			{ 0x21, 0x0121401f }, /* HP out */
10811 			{ }
10812 		},
10813 		.chained = true,
10814 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10815 	},
10816 	[ALC662_FIXUP_ASUS_MODE2] = {
10817 		.type = HDA_FIXUP_PINS,
10818 		.v.pins = (const struct hda_pintbl[]) {
10819 			{ 0x14, 0x99130110 }, /* speaker */
10820 			{ 0x18, 0x01a19820 }, /* mic */
10821 			{ 0x19, 0x99a3092f }, /* int-mic */
10822 			{ 0x1b, 0x0121401f }, /* HP out */
10823 			{ }
10824 		},
10825 		.chained = true,
10826 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10827 	},
10828 	[ALC662_FIXUP_ASUS_MODE3] = {
10829 		.type = HDA_FIXUP_PINS,
10830 		.v.pins = (const struct hda_pintbl[]) {
10831 			{ 0x14, 0x99130110 }, /* speaker */
10832 			{ 0x15, 0x0121441f }, /* HP */
10833 			{ 0x18, 0x01a19840 }, /* mic */
10834 			{ 0x19, 0x99a3094f }, /* int-mic */
10835 			{ 0x21, 0x01211420 }, /* HP2 */
10836 			{ }
10837 		},
10838 		.chained = true,
10839 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10840 	},
10841 	[ALC662_FIXUP_ASUS_MODE4] = {
10842 		.type = HDA_FIXUP_PINS,
10843 		.v.pins = (const struct hda_pintbl[]) {
10844 			{ 0x14, 0x99130110 }, /* speaker */
10845 			{ 0x16, 0x99130111 }, /* speaker */
10846 			{ 0x18, 0x01a19840 }, /* mic */
10847 			{ 0x19, 0x99a3094f }, /* int-mic */
10848 			{ 0x21, 0x0121441f }, /* HP */
10849 			{ }
10850 		},
10851 		.chained = true,
10852 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10853 	},
10854 	[ALC662_FIXUP_ASUS_MODE5] = {
10855 		.type = HDA_FIXUP_PINS,
10856 		.v.pins = (const struct hda_pintbl[]) {
10857 			{ 0x14, 0x99130110 }, /* speaker */
10858 			{ 0x15, 0x0121441f }, /* HP */
10859 			{ 0x16, 0x99130111 }, /* speaker */
10860 			{ 0x18, 0x01a19840 }, /* mic */
10861 			{ 0x19, 0x99a3094f }, /* int-mic */
10862 			{ }
10863 		},
10864 		.chained = true,
10865 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10866 	},
10867 	[ALC662_FIXUP_ASUS_MODE6] = {
10868 		.type = HDA_FIXUP_PINS,
10869 		.v.pins = (const struct hda_pintbl[]) {
10870 			{ 0x14, 0x99130110 }, /* speaker */
10871 			{ 0x15, 0x01211420 }, /* HP2 */
10872 			{ 0x18, 0x01a19840 }, /* mic */
10873 			{ 0x19, 0x99a3094f }, /* int-mic */
10874 			{ 0x1b, 0x0121441f }, /* HP */
10875 			{ }
10876 		},
10877 		.chained = true,
10878 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10879 	},
10880 	[ALC662_FIXUP_ASUS_MODE7] = {
10881 		.type = HDA_FIXUP_PINS,
10882 		.v.pins = (const struct hda_pintbl[]) {
10883 			{ 0x14, 0x99130110 }, /* speaker */
10884 			{ 0x17, 0x99130111 }, /* speaker */
10885 			{ 0x18, 0x01a19840 }, /* mic */
10886 			{ 0x19, 0x99a3094f }, /* int-mic */
10887 			{ 0x1b, 0x01214020 }, /* HP */
10888 			{ 0x21, 0x0121401f }, /* HP */
10889 			{ }
10890 		},
10891 		.chained = true,
10892 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10893 	},
10894 	[ALC662_FIXUP_ASUS_MODE8] = {
10895 		.type = HDA_FIXUP_PINS,
10896 		.v.pins = (const struct hda_pintbl[]) {
10897 			{ 0x14, 0x99130110 }, /* speaker */
10898 			{ 0x12, 0x99a30970 }, /* int-mic */
10899 			{ 0x15, 0x01214020 }, /* HP */
10900 			{ 0x17, 0x99130111 }, /* speaker */
10901 			{ 0x18, 0x01a19840 }, /* mic */
10902 			{ 0x21, 0x0121401f }, /* HP */
10903 			{ }
10904 		},
10905 		.chained = true,
10906 		.chain_id = ALC662_FIXUP_SKU_IGNORE
10907 	},
10908 	[ALC662_FIXUP_NO_JACK_DETECT] = {
10909 		.type = HDA_FIXUP_FUNC,
10910 		.v.func = alc_fixup_no_jack_detect,
10911 	},
10912 	[ALC662_FIXUP_ZOTAC_Z68] = {
10913 		.type = HDA_FIXUP_PINS,
10914 		.v.pins = (const struct hda_pintbl[]) {
10915 			{ 0x1b, 0x02214020 }, /* Front HP */
10916 			{ }
10917 		}
10918 	},
10919 	[ALC662_FIXUP_INV_DMIC] = {
10920 		.type = HDA_FIXUP_FUNC,
10921 		.v.func = alc_fixup_inv_dmic,
10922 	},
10923 	[ALC668_FIXUP_DELL_XPS13] = {
10924 		.type = HDA_FIXUP_FUNC,
10925 		.v.func = alc_fixup_dell_xps13,
10926 		.chained = true,
10927 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10928 	},
10929 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10930 		.type = HDA_FIXUP_FUNC,
10931 		.v.func = alc_fixup_disable_aamix,
10932 		.chained = true,
10933 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10934 	},
10935 	[ALC668_FIXUP_AUTO_MUTE] = {
10936 		.type = HDA_FIXUP_FUNC,
10937 		.v.func = alc_fixup_auto_mute_via_amp,
10938 		.chained = true,
10939 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10940 	},
10941 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10942 		.type = HDA_FIXUP_PINS,
10943 		.v.pins = (const struct hda_pintbl[]) {
10944 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10945 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10946 			{ }
10947 		},
10948 		.chained = true,
10949 		.chain_id = ALC662_FIXUP_HEADSET_MODE
10950 	},
10951 	[ALC662_FIXUP_HEADSET_MODE] = {
10952 		.type = HDA_FIXUP_FUNC,
10953 		.v.func = alc_fixup_headset_mode_alc662,
10954 	},
10955 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10956 		.type = HDA_FIXUP_PINS,
10957 		.v.pins = (const struct hda_pintbl[]) {
10958 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10959 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10960 			{ }
10961 		},
10962 		.chained = true,
10963 		.chain_id = ALC668_FIXUP_HEADSET_MODE
10964 	},
10965 	[ALC668_FIXUP_HEADSET_MODE] = {
10966 		.type = HDA_FIXUP_FUNC,
10967 		.v.func = alc_fixup_headset_mode_alc668,
10968 	},
10969 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
10970 		.type = HDA_FIXUP_FUNC,
10971 		.v.func = alc_fixup_bass_chmap,
10972 		.chained = true,
10973 		.chain_id = ALC662_FIXUP_ASUS_MODE4
10974 	},
10975 	[ALC662_FIXUP_BASS_16] = {
10976 		.type = HDA_FIXUP_PINS,
10977 		.v.pins = (const struct hda_pintbl[]) {
10978 			{0x16, 0x80106111}, /* bass speaker */
10979 			{}
10980 		},
10981 		.chained = true,
10982 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
10983 	},
10984 	[ALC662_FIXUP_BASS_1A] = {
10985 		.type = HDA_FIXUP_PINS,
10986 		.v.pins = (const struct hda_pintbl[]) {
10987 			{0x1a, 0x80106111}, /* bass speaker */
10988 			{}
10989 		},
10990 		.chained = true,
10991 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
10992 	},
10993 	[ALC662_FIXUP_BASS_CHMAP] = {
10994 		.type = HDA_FIXUP_FUNC,
10995 		.v.func = alc_fixup_bass_chmap,
10996 	},
10997 	[ALC662_FIXUP_ASUS_Nx50] = {
10998 		.type = HDA_FIXUP_FUNC,
10999 		.v.func = alc_fixup_auto_mute_via_amp,
11000 		.chained = true,
11001 		.chain_id = ALC662_FIXUP_BASS_1A
11002 	},
11003 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
11004 		.type = HDA_FIXUP_FUNC,
11005 		.v.func = alc_fixup_headset_mode_alc668,
11006 		.chain_id = ALC662_FIXUP_BASS_CHMAP
11007 	},
11008 	[ALC668_FIXUP_ASUS_Nx51] = {
11009 		.type = HDA_FIXUP_PINS,
11010 		.v.pins = (const struct hda_pintbl[]) {
11011 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11012 			{ 0x1a, 0x90170151 }, /* bass speaker */
11013 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11014 			{}
11015 		},
11016 		.chained = true,
11017 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11018 	},
11019 	[ALC668_FIXUP_MIC_COEF] = {
11020 		.type = HDA_FIXUP_VERBS,
11021 		.v.verbs = (const struct hda_verb[]) {
11022 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
11023 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
11024 			{}
11025 		},
11026 	},
11027 	[ALC668_FIXUP_ASUS_G751] = {
11028 		.type = HDA_FIXUP_PINS,
11029 		.v.pins = (const struct hda_pintbl[]) {
11030 			{ 0x16, 0x0421101f }, /* HP */
11031 			{}
11032 		},
11033 		.chained = true,
11034 		.chain_id = ALC668_FIXUP_MIC_COEF
11035 	},
11036 	[ALC891_FIXUP_HEADSET_MODE] = {
11037 		.type = HDA_FIXUP_FUNC,
11038 		.v.func = alc_fixup_headset_mode,
11039 	},
11040 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
11041 		.type = HDA_FIXUP_PINS,
11042 		.v.pins = (const struct hda_pintbl[]) {
11043 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11044 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11045 			{ }
11046 		},
11047 		.chained = true,
11048 		.chain_id = ALC891_FIXUP_HEADSET_MODE
11049 	},
11050 	[ALC662_FIXUP_ACER_VERITON] = {
11051 		.type = HDA_FIXUP_PINS,
11052 		.v.pins = (const struct hda_pintbl[]) {
11053 			{ 0x15, 0x50170120 }, /* no internal speaker */
11054 			{ }
11055 		}
11056 	},
11057 	[ALC892_FIXUP_ASROCK_MOBO] = {
11058 		.type = HDA_FIXUP_PINS,
11059 		.v.pins = (const struct hda_pintbl[]) {
11060 			{ 0x15, 0x40f000f0 }, /* disabled */
11061 			{ 0x16, 0x40f000f0 }, /* disabled */
11062 			{ }
11063 		}
11064 	},
11065 	[ALC662_FIXUP_USI_FUNC] = {
11066 		.type = HDA_FIXUP_FUNC,
11067 		.v.func = alc662_fixup_usi_headset_mic,
11068 	},
11069 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
11070 		.type = HDA_FIXUP_PINS,
11071 		.v.pins = (const struct hda_pintbl[]) {
11072 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
11073 			{ 0x18, 0x01a1903d },
11074 			{ }
11075 		},
11076 		.chained = true,
11077 		.chain_id = ALC662_FIXUP_USI_FUNC
11078 	},
11079 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
11080 		.type = HDA_FIXUP_FUNC,
11081 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
11082 	},
11083 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
11084 		.type = HDA_FIXUP_FUNC,
11085 		.v.func = alc662_fixup_aspire_ethos_hp,
11086 	},
11087 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
11088 		.type = HDA_FIXUP_PINS,
11089 		.v.pins = (const struct hda_pintbl[]) {
11090 			{ 0x15, 0x92130110 }, /* front speakers */
11091 			{ 0x18, 0x99130111 }, /* center/subwoofer */
11092 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
11093 			{ }
11094 		},
11095 		.chained = true,
11096 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
11097 	},
11098 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
11099 		.type = HDA_FIXUP_FUNC,
11100 		.v.func = alc671_fixup_hp_headset_mic2,
11101 	},
11102 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
11103 		.type = HDA_FIXUP_PINS,
11104 		.v.pins = (const struct hda_pintbl[]) {
11105 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
11106 			{ }
11107 		},
11108 		.chained = true,
11109 		.chain_id = ALC662_FIXUP_USI_FUNC
11110 	},
11111 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
11112 		.type = HDA_FIXUP_PINS,
11113 		.v.pins = (const struct hda_pintbl[]) {
11114 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
11115 			{ 0x1b, 0x0221144f },
11116 			{ }
11117 		},
11118 		.chained = true,
11119 		.chain_id = ALC662_FIXUP_USI_FUNC
11120 	},
11121 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
11122 		.type = HDA_FIXUP_PINS,
11123 		.v.pins = (const struct hda_pintbl[]) {
11124 			{ 0x1b, 0x04a1112c },
11125 			{ }
11126 		},
11127 		.chained = true,
11128 		.chain_id = ALC668_FIXUP_HEADSET_MIC
11129 	},
11130 	[ALC668_FIXUP_HEADSET_MIC] = {
11131 		.type = HDA_FIXUP_FUNC,
11132 		.v.func = alc269_fixup_headset_mic,
11133 		.chained = true,
11134 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
11135 	},
11136 	[ALC668_FIXUP_MIC_DET_COEF] = {
11137 		.type = HDA_FIXUP_VERBS,
11138 		.v.verbs = (const struct hda_verb[]) {
11139 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
11140 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
11141 			{}
11142 		},
11143 	},
11144 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
11145 		.type = HDA_FIXUP_FUNC,
11146 		.v.func = alc897_fixup_lenovo_headset_mic,
11147 	},
11148 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
11149 		.type = HDA_FIXUP_PINS,
11150 		.v.pins = (const struct hda_pintbl[]) {
11151 			{ 0x1a, 0x03a11050 },
11152 			{ }
11153 		},
11154 		.chained = true,
11155 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
11156 	},
11157 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
11158 		.type = HDA_FIXUP_PINS,
11159 		.v.pins = (const struct hda_pintbl[]) {
11160 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
11161 			{ }
11162 		},
11163 	},
11164 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
11165 		.type = HDA_FIXUP_FUNC,
11166 		.v.func = alc897_fixup_lenovo_headset_mode,
11167 	},
11168 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
11169 		.type = HDA_FIXUP_PINS,
11170 		.v.pins = (const struct hda_pintbl[]) {
11171 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
11172 			{ }
11173 		},
11174 		.chained = true,
11175 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
11176 	},
11177 	[ALC897_FIXUP_UNIS_H3C_X500S] = {
11178 		.type = HDA_FIXUP_VERBS,
11179 		.v.verbs = (const struct hda_verb[]) {
11180 			{ 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
11181 			{}
11182 		},
11183 	},
11184 };
11185 
11186 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
11187 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
11188 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
11189 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
11190 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
11191 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
11192 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
11193 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
11194 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
11195 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
11196 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
11197 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
11198 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11199 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11200 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
11201 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
11202 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
11203 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11204 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11205 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11206 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11207 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11208 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
11209 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
11210 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
11211 	SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
11212 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
11213 	SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
11214 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
11215 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
11216 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
11217 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
11218 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11219 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
11220 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
11221 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
11222 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
11223 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
11224 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
11225 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
11226 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
11227 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
11228 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
11229 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
11230 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
11231 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
11232 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
11233 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
11234 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
11235 	SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
11236 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
11237 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
11238 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
11239 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
11240 	SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
11241 	SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
11242 	SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
11243 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
11244 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
11245 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
11246 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
11247 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
11248 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
11249 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
11250 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
11251 	SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
11252 
11253 #if 0
11254 	/* Below is a quirk table taken from the old code.
11255 	 * Basically the device should work as is without the fixup table.
11256 	 * If BIOS doesn't give a proper info, enable the corresponding
11257 	 * fixup entry.
11258 	 */
11259 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
11260 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
11261 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
11262 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
11263 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11264 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11265 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11266 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
11267 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
11268 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11269 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
11270 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
11271 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
11272 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
11273 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
11274 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11275 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
11276 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
11277 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11278 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11279 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11280 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11281 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
11282 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
11283 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
11284 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11285 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
11286 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11287 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11288 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
11289 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11290 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11291 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
11292 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
11293 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
11294 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
11295 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
11296 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
11297 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
11298 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11299 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
11300 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
11301 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11302 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
11303 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
11304 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
11305 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
11306 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
11307 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11308 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
11309 #endif
11310 	{}
11311 };
11312 
11313 static const struct hda_model_fixup alc662_fixup_models[] = {
11314 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
11315 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
11316 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
11317 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
11318 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
11319 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
11320 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
11321 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
11322 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
11323 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
11324 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
11325 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
11326 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
11327 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
11328 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
11329 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
11330 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
11331 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
11332 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
11333 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
11334 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
11335 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
11336 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
11337 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
11338 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
11339 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
11340 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
11341 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
11342 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
11343 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
11344 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
11345 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
11346 	{.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
11347 	{}
11348 };
11349 
11350 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
11351 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11352 		{0x17, 0x02211010},
11353 		{0x18, 0x01a19030},
11354 		{0x1a, 0x01813040},
11355 		{0x21, 0x01014020}),
11356 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11357 		{0x16, 0x01813030},
11358 		{0x17, 0x02211010},
11359 		{0x18, 0x01a19040},
11360 		{0x21, 0x01014020}),
11361 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11362 		{0x14, 0x01014010},
11363 		{0x18, 0x01a19020},
11364 		{0x1a, 0x0181302f},
11365 		{0x1b, 0x0221401f}),
11366 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11367 		{0x12, 0x99a30130},
11368 		{0x14, 0x90170110},
11369 		{0x15, 0x0321101f},
11370 		{0x16, 0x03011020}),
11371 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11372 		{0x12, 0x99a30140},
11373 		{0x14, 0x90170110},
11374 		{0x15, 0x0321101f},
11375 		{0x16, 0x03011020}),
11376 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11377 		{0x12, 0x99a30150},
11378 		{0x14, 0x90170110},
11379 		{0x15, 0x0321101f},
11380 		{0x16, 0x03011020}),
11381 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11382 		{0x14, 0x90170110},
11383 		{0x15, 0x0321101f},
11384 		{0x16, 0x03011020}),
11385 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
11386 		{0x12, 0x90a60130},
11387 		{0x14, 0x90170110},
11388 		{0x15, 0x0321101f}),
11389 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11390 		{0x14, 0x01014010},
11391 		{0x17, 0x90170150},
11392 		{0x19, 0x02a11060},
11393 		{0x1b, 0x01813030},
11394 		{0x21, 0x02211020}),
11395 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11396 		{0x14, 0x01014010},
11397 		{0x18, 0x01a19040},
11398 		{0x1b, 0x01813030},
11399 		{0x21, 0x02211020}),
11400 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11401 		{0x14, 0x01014020},
11402 		{0x17, 0x90170110},
11403 		{0x18, 0x01a19050},
11404 		{0x1b, 0x01813040},
11405 		{0x21, 0x02211030}),
11406 	{}
11407 };
11408 
11409 /*
11410  */
patch_alc662(struct hda_codec * codec)11411 static int patch_alc662(struct hda_codec *codec)
11412 {
11413 	struct alc_spec *spec;
11414 	int err;
11415 
11416 	err = alc_alloc_spec(codec, 0x0b);
11417 	if (err < 0)
11418 		return err;
11419 
11420 	spec = codec->spec;
11421 
11422 	spec->shutup = alc_eapd_shutup;
11423 
11424 	/* handle multiple HPs as is */
11425 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
11426 
11427 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
11428 
11429 	switch (codec->core.vendor_id) {
11430 	case 0x10ec0668:
11431 		spec->init_hook = alc668_restore_default_value;
11432 		break;
11433 	}
11434 
11435 	alc_pre_init(codec);
11436 
11437 	snd_hda_pick_fixup(codec, alc662_fixup_models,
11438 		       alc662_fixup_tbl, alc662_fixups);
11439 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
11440 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11441 
11442 	alc_auto_parse_customize_define(codec);
11443 
11444 	if (has_cdefine_beep(codec))
11445 		spec->gen.beep_nid = 0x01;
11446 
11447 	if ((alc_get_coef0(codec) & (1 << 14)) &&
11448 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
11449 	    spec->cdefine.platform_type == 1) {
11450 		err = alc_codec_rename(codec, "ALC272X");
11451 		if (err < 0)
11452 			goto error;
11453 	}
11454 
11455 	/* automatic parse from the BIOS config */
11456 	err = alc662_parse_auto_config(codec);
11457 	if (err < 0)
11458 		goto error;
11459 
11460 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
11461 		switch (codec->core.vendor_id) {
11462 		case 0x10ec0662:
11463 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11464 			break;
11465 		case 0x10ec0272:
11466 		case 0x10ec0663:
11467 		case 0x10ec0665:
11468 		case 0x10ec0668:
11469 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
11470 			break;
11471 		case 0x10ec0273:
11472 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
11473 			break;
11474 		}
11475 		if (err < 0)
11476 			goto error;
11477 	}
11478 
11479 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11480 
11481 	return 0;
11482 
11483  error:
11484 	alc_free(codec);
11485 	return err;
11486 }
11487 
11488 /*
11489  * ALC680 support
11490  */
11491 
alc680_parse_auto_config(struct hda_codec * codec)11492 static int alc680_parse_auto_config(struct hda_codec *codec)
11493 {
11494 	return alc_parse_auto_config(codec, NULL, NULL);
11495 }
11496 
11497 /*
11498  */
patch_alc680(struct hda_codec * codec)11499 static int patch_alc680(struct hda_codec *codec)
11500 {
11501 	int err;
11502 
11503 	/* ALC680 has no aa-loopback mixer */
11504 	err = alc_alloc_spec(codec, 0);
11505 	if (err < 0)
11506 		return err;
11507 
11508 	/* automatic parse from the BIOS config */
11509 	err = alc680_parse_auto_config(codec);
11510 	if (err < 0) {
11511 		alc_free(codec);
11512 		return err;
11513 	}
11514 
11515 	return 0;
11516 }
11517 
11518 /*
11519  * patch entries
11520  */
11521 static const struct hda_device_id snd_hda_id_realtek[] = {
11522 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
11523 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
11524 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
11525 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
11526 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
11527 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11528 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
11529 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
11530 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
11531 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
11532 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
11533 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11534 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
11535 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
11536 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11537 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11538 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11539 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11540 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11541 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11542 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
11543 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
11544 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11545 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11546 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11547 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11548 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11549 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
11550 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
11551 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
11552 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
11553 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
11554 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
11555 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11556 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11557 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
11558 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
11559 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
11560 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
11561 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
11562 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
11563 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
11564 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11565 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11566 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11567 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11568 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11569 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11570 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11571 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11572 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11573 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11574 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11575 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11576 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11577 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
11578 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11579 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11580 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
11581 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
11582 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
11583 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11584 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11585 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11586 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11587 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11588 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11589 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11590 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11591 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11592 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11593 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
11594 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
11595 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11596 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
11597 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
11598 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
11599 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
11600 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
11601 	{} /* terminator */
11602 };
11603 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
11604 
11605 MODULE_LICENSE("GPL");
11606 MODULE_DESCRIPTION("Realtek HD-audio codec");
11607 
11608 static struct hda_codec_driver realtek_driver = {
11609 	.id = snd_hda_id_realtek,
11610 };
11611 
11612 module_hda_codec_driver(realtek_driver);
11613