]> git.ipfire.org Git - thirdparty/linux.git/blob - sound/pci/hda/patch_realtek.c
ALSA: hda/realtek: Add quirk for HP Zbook Firefly 14 G9 model
[thirdparty/linux.git] / sound / pci / hda / patch_realtek.c
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 #include "hda_component.h"
29
30 /* keep halting ALC5505 DSP, for power saving */
31 #define HALT_REALTEK_ALC5505
32
33 /* extra amp-initialization sequence types */
34 enum {
35 ALC_INIT_UNDEFINED,
36 ALC_INIT_NONE,
37 ALC_INIT_DEFAULT,
38 };
39
40 enum {
41 ALC_HEADSET_MODE_UNKNOWN,
42 ALC_HEADSET_MODE_UNPLUGGED,
43 ALC_HEADSET_MODE_HEADSET,
44 ALC_HEADSET_MODE_MIC,
45 ALC_HEADSET_MODE_HEADPHONE,
46 };
47
48 enum {
49 ALC_HEADSET_TYPE_UNKNOWN,
50 ALC_HEADSET_TYPE_CTIA,
51 ALC_HEADSET_TYPE_OMTP,
52 };
53
54 enum {
55 ALC_KEY_MICMUTE_INDEX,
56 };
57
58 struct alc_customize_define {
59 unsigned int sku_cfg;
60 unsigned char port_connectivity;
61 unsigned char check_sum;
62 unsigned char customization;
63 unsigned char external_amp;
64 unsigned int enable_pcbeep:1;
65 unsigned int platform_type:1;
66 unsigned int swap:1;
67 unsigned int override:1;
68 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
69 };
70
71 struct alc_coef_led {
72 unsigned int idx;
73 unsigned int mask;
74 unsigned int on;
75 unsigned int off;
76 };
77
78 struct alc_spec {
79 struct hda_gen_spec gen; /* must be at head */
80
81 /* codec parameterization */
82 struct alc_customize_define cdefine;
83 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
84
85 /* GPIO bits */
86 unsigned int gpio_mask;
87 unsigned int gpio_dir;
88 unsigned int gpio_data;
89 bool gpio_write_delay; /* add a delay before writing gpio_data */
90
91 /* mute LED for HP laptops, see vref_mute_led_set() */
92 int mute_led_polarity;
93 int micmute_led_polarity;
94 hda_nid_t mute_led_nid;
95 hda_nid_t cap_mute_led_nid;
96
97 unsigned int gpio_mute_led_mask;
98 unsigned int gpio_mic_led_mask;
99 struct alc_coef_led mute_led_coef;
100 struct alc_coef_led mic_led_coef;
101 struct mutex coef_mutex;
102
103 hda_nid_t headset_mic_pin;
104 hda_nid_t headphone_mic_pin;
105 int current_headset_mode;
106 int current_headset_type;
107
108 /* hooks */
109 void (*init_hook)(struct hda_codec *codec);
110 #ifdef CONFIG_PM
111 void (*power_hook)(struct hda_codec *codec);
112 #endif
113 void (*shutup)(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
125 /* for PLL fix */
126 hda_nid_t pll_nid;
127 unsigned int pll_coef_idx, pll_coef_bit;
128 unsigned int coef0;
129 struct input_dev *kb_dev;
130 u8 alc_mute_keycode_map[1];
131
132 /* component binding */
133 struct component_match *match;
134 struct hda_component comps[HDA_MAX_COMPONENTS];
135 };
136
137 /*
138 * COEF access helper functions
139 */
140
141 static void coef_mutex_lock(struct hda_codec *codec)
142 {
143 struct alc_spec *spec = codec->spec;
144
145 snd_hda_power_up_pm(codec);
146 mutex_lock(&spec->coef_mutex);
147 }
148
149 static void coef_mutex_unlock(struct hda_codec *codec)
150 {
151 struct alc_spec *spec = codec->spec;
152
153 mutex_unlock(&spec->coef_mutex);
154 snd_hda_power_down_pm(codec);
155 }
156
157 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
158 unsigned int coef_idx)
159 {
160 unsigned int val;
161
162 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
163 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
164 return val;
165 }
166
167 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
168 unsigned int coef_idx)
169 {
170 unsigned int val;
171
172 coef_mutex_lock(codec);
173 val = __alc_read_coefex_idx(codec, nid, coef_idx);
174 coef_mutex_unlock(codec);
175 return val;
176 }
177
178 #define alc_read_coef_idx(codec, coef_idx) \
179 alc_read_coefex_idx(codec, 0x20, coef_idx)
180
181 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
182 unsigned int coef_idx, unsigned int coef_val)
183 {
184 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
185 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
186 }
187
188 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
189 unsigned int coef_idx, unsigned int coef_val)
190 {
191 coef_mutex_lock(codec);
192 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
193 coef_mutex_unlock(codec);
194 }
195
196 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
197 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
198
199 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
200 unsigned int coef_idx, unsigned int mask,
201 unsigned int bits_set)
202 {
203 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
204
205 if (val != -1)
206 __alc_write_coefex_idx(codec, nid, coef_idx,
207 (val & ~mask) | bits_set);
208 }
209
210 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
211 unsigned int coef_idx, unsigned int mask,
212 unsigned int bits_set)
213 {
214 coef_mutex_lock(codec);
215 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
216 coef_mutex_unlock(codec);
217 }
218
219 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
220 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
221
222 /* a special bypass for COEF 0; read the cached value at the second time */
223 static unsigned int alc_get_coef0(struct hda_codec *codec)
224 {
225 struct alc_spec *spec = codec->spec;
226
227 if (!spec->coef0)
228 spec->coef0 = alc_read_coef_idx(codec, 0);
229 return spec->coef0;
230 }
231
232 /* coef writes/updates batch */
233 struct coef_fw {
234 unsigned char nid;
235 unsigned char idx;
236 unsigned short mask;
237 unsigned short val;
238 };
239
240 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
241 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
242 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
243 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
244 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
245
246 static void alc_process_coef_fw(struct hda_codec *codec,
247 const struct coef_fw *fw)
248 {
249 coef_mutex_lock(codec);
250 for (; fw->nid; fw++) {
251 if (fw->mask == (unsigned short)-1)
252 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
253 else
254 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
255 fw->mask, fw->val);
256 }
257 coef_mutex_unlock(codec);
258 }
259
260 /*
261 * GPIO setup tables, used in initialization
262 */
263
264 /* Enable GPIO mask and set output */
265 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
266 {
267 struct alc_spec *spec = codec->spec;
268
269 spec->gpio_mask |= mask;
270 spec->gpio_dir |= mask;
271 spec->gpio_data |= mask;
272 }
273
274 static void alc_write_gpio_data(struct hda_codec *codec)
275 {
276 struct alc_spec *spec = codec->spec;
277
278 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
279 spec->gpio_data);
280 }
281
282 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
283 bool on)
284 {
285 struct alc_spec *spec = codec->spec;
286 unsigned int oldval = spec->gpio_data;
287
288 if (on)
289 spec->gpio_data |= mask;
290 else
291 spec->gpio_data &= ~mask;
292 if (oldval != spec->gpio_data)
293 alc_write_gpio_data(codec);
294 }
295
296 static void alc_write_gpio(struct hda_codec *codec)
297 {
298 struct alc_spec *spec = codec->spec;
299
300 if (!spec->gpio_mask)
301 return;
302
303 snd_hda_codec_write(codec, codec->core.afg, 0,
304 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
305 snd_hda_codec_write(codec, codec->core.afg, 0,
306 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
307 if (spec->gpio_write_delay)
308 msleep(1);
309 alc_write_gpio_data(codec);
310 }
311
312 static void alc_fixup_gpio(struct hda_codec *codec, int action,
313 unsigned int mask)
314 {
315 if (action == HDA_FIXUP_ACT_PRE_PROBE)
316 alc_setup_gpio(codec, mask);
317 }
318
319 static void alc_fixup_gpio1(struct hda_codec *codec,
320 const struct hda_fixup *fix, int action)
321 {
322 alc_fixup_gpio(codec, action, 0x01);
323 }
324
325 static void alc_fixup_gpio2(struct hda_codec *codec,
326 const struct hda_fixup *fix, int action)
327 {
328 alc_fixup_gpio(codec, action, 0x02);
329 }
330
331 static void alc_fixup_gpio3(struct hda_codec *codec,
332 const struct hda_fixup *fix, int action)
333 {
334 alc_fixup_gpio(codec, action, 0x03);
335 }
336
337 static void alc_fixup_gpio4(struct hda_codec *codec,
338 const struct hda_fixup *fix, int action)
339 {
340 alc_fixup_gpio(codec, action, 0x04);
341 }
342
343 static void alc_fixup_micmute_led(struct hda_codec *codec,
344 const struct hda_fixup *fix, int action)
345 {
346 if (action == HDA_FIXUP_ACT_PRE_PROBE)
347 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
348 }
349
350 /*
351 * Fix hardware PLL issue
352 * On some codecs, the analog PLL gating control must be off while
353 * the default value is 1.
354 */
355 static void alc_fix_pll(struct hda_codec *codec)
356 {
357 struct alc_spec *spec = codec->spec;
358
359 if (spec->pll_nid)
360 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
361 1 << spec->pll_coef_bit, 0);
362 }
363
364 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
365 unsigned int coef_idx, unsigned int coef_bit)
366 {
367 struct alc_spec *spec = codec->spec;
368 spec->pll_nid = nid;
369 spec->pll_coef_idx = coef_idx;
370 spec->pll_coef_bit = coef_bit;
371 alc_fix_pll(codec);
372 }
373
374 /* update the master volume per volume-knob's unsol event */
375 static void alc_update_knob_master(struct hda_codec *codec,
376 struct hda_jack_callback *jack)
377 {
378 unsigned int val;
379 struct snd_kcontrol *kctl;
380 struct snd_ctl_elem_value *uctl;
381
382 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
383 if (!kctl)
384 return;
385 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
386 if (!uctl)
387 return;
388 val = snd_hda_codec_read(codec, jack->nid, 0,
389 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
390 val &= HDA_AMP_VOLMASK;
391 uctl->value.integer.value[0] = val;
392 uctl->value.integer.value[1] = val;
393 kctl->put(kctl, uctl);
394 kfree(uctl);
395 }
396
397 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
398 {
399 /* For some reason, the res given from ALC880 is broken.
400 Here we adjust it properly. */
401 snd_hda_jack_unsol_event(codec, res >> 2);
402 }
403
404 /* Change EAPD to verb control */
405 static void alc_fill_eapd_coef(struct hda_codec *codec)
406 {
407 int coef;
408
409 coef = alc_get_coef0(codec);
410
411 switch (codec->core.vendor_id) {
412 case 0x10ec0262:
413 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
414 break;
415 case 0x10ec0267:
416 case 0x10ec0268:
417 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
418 break;
419 case 0x10ec0269:
420 if ((coef & 0x00f0) == 0x0010)
421 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
422 if ((coef & 0x00f0) == 0x0020)
423 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
424 if ((coef & 0x00f0) == 0x0030)
425 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
426 break;
427 case 0x10ec0280:
428 case 0x10ec0284:
429 case 0x10ec0290:
430 case 0x10ec0292:
431 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
432 break;
433 case 0x10ec0225:
434 case 0x10ec0295:
435 case 0x10ec0299:
436 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
437 fallthrough;
438 case 0x10ec0215:
439 case 0x10ec0230:
440 case 0x10ec0233:
441 case 0x10ec0235:
442 case 0x10ec0236:
443 case 0x10ec0245:
444 case 0x10ec0255:
445 case 0x10ec0256:
446 case 0x19e58326:
447 case 0x10ec0257:
448 case 0x10ec0282:
449 case 0x10ec0283:
450 case 0x10ec0286:
451 case 0x10ec0288:
452 case 0x10ec0285:
453 case 0x10ec0298:
454 case 0x10ec0289:
455 case 0x10ec0300:
456 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
457 break;
458 case 0x10ec0275:
459 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
460 break;
461 case 0x10ec0287:
462 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
463 alc_write_coef_idx(codec, 0x8, 0x4ab7);
464 break;
465 case 0x10ec0293:
466 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
467 break;
468 case 0x10ec0234:
469 case 0x10ec0274:
470 case 0x10ec0294:
471 case 0x10ec0700:
472 case 0x10ec0701:
473 case 0x10ec0703:
474 case 0x10ec0711:
475 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
476 break;
477 case 0x10ec0662:
478 if ((coef & 0x00f0) == 0x0030)
479 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
480 break;
481 case 0x10ec0272:
482 case 0x10ec0273:
483 case 0x10ec0663:
484 case 0x10ec0665:
485 case 0x10ec0670:
486 case 0x10ec0671:
487 case 0x10ec0672:
488 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
489 break;
490 case 0x10ec0222:
491 case 0x10ec0623:
492 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
493 break;
494 case 0x10ec0668:
495 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
496 break;
497 case 0x10ec0867:
498 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
499 break;
500 case 0x10ec0888:
501 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
502 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
503 break;
504 case 0x10ec0892:
505 case 0x10ec0897:
506 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
507 break;
508 case 0x10ec0899:
509 case 0x10ec0900:
510 case 0x10ec0b00:
511 case 0x10ec1168:
512 case 0x10ec1220:
513 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
514 break;
515 }
516 }
517
518 /* additional initialization for ALC888 variants */
519 static void alc888_coef_init(struct hda_codec *codec)
520 {
521 switch (alc_get_coef0(codec) & 0x00f0) {
522 /* alc888-VA */
523 case 0x00:
524 /* alc888-VB */
525 case 0x10:
526 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
527 break;
528 }
529 }
530
531 /* turn on/off EAPD control (only if available) */
532 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
533 {
534 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
535 return;
536 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
537 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
538 on ? 2 : 0);
539 }
540
541 /* turn on/off EAPD controls of the codec */
542 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
543 {
544 /* We currently only handle front, HP */
545 static const hda_nid_t pins[] = {
546 0x0f, 0x10, 0x14, 0x15, 0x17, 0
547 };
548 const hda_nid_t *p;
549 for (p = pins; *p; p++)
550 set_eapd(codec, *p, on);
551 }
552
553 static int find_ext_mic_pin(struct hda_codec *codec);
554
555 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
556 {
557 const struct hda_pincfg *pin;
558 int mic_pin = find_ext_mic_pin(codec);
559 int i;
560
561 /* don't shut up pins when unloading the driver; otherwise it breaks
562 * the default pin setup at the next load of the driver
563 */
564 if (codec->bus->shutdown)
565 return;
566
567 snd_array_for_each(&codec->init_pins, i, pin) {
568 /* use read here for syncing after issuing each verb */
569 if (pin->nid != mic_pin)
570 snd_hda_codec_read(codec, pin->nid, 0,
571 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
572 }
573
574 codec->pins_shutup = 1;
575 }
576
577 static void alc_shutup_pins(struct hda_codec *codec)
578 {
579 struct alc_spec *spec = codec->spec;
580
581 switch (codec->core.vendor_id) {
582 case 0x10ec0236:
583 case 0x10ec0256:
584 case 0x19e58326:
585 case 0x10ec0283:
586 case 0x10ec0286:
587 case 0x10ec0288:
588 case 0x10ec0298:
589 alc_headset_mic_no_shutup(codec);
590 break;
591 default:
592 if (!spec->no_shutup_pins)
593 snd_hda_shutup_pins(codec);
594 break;
595 }
596 }
597
598 /* generic shutup callback;
599 * just turning off EAPD and a little pause for avoiding pop-noise
600 */
601 static void alc_eapd_shutup(struct hda_codec *codec)
602 {
603 struct alc_spec *spec = codec->spec;
604
605 alc_auto_setup_eapd(codec, false);
606 if (!spec->no_depop_delay)
607 msleep(200);
608 alc_shutup_pins(codec);
609 }
610
611 /* generic EAPD initialization */
612 static void alc_auto_init_amp(struct hda_codec *codec, int type)
613 {
614 alc_auto_setup_eapd(codec, true);
615 alc_write_gpio(codec);
616 switch (type) {
617 case ALC_INIT_DEFAULT:
618 switch (codec->core.vendor_id) {
619 case 0x10ec0260:
620 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
621 break;
622 case 0x10ec0880:
623 case 0x10ec0882:
624 case 0x10ec0883:
625 case 0x10ec0885:
626 alc_update_coef_idx(codec, 7, 0, 0x2030);
627 break;
628 case 0x10ec0888:
629 alc888_coef_init(codec);
630 break;
631 }
632 break;
633 }
634 }
635
636 /* get a primary headphone pin if available */
637 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
638 {
639 if (spec->gen.autocfg.hp_pins[0])
640 return spec->gen.autocfg.hp_pins[0];
641 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
642 return spec->gen.autocfg.line_out_pins[0];
643 return 0;
644 }
645
646 /*
647 * Realtek SSID verification
648 */
649
650 /* Could be any non-zero and even value. When used as fixup, tells
651 * the driver to ignore any present sku defines.
652 */
653 #define ALC_FIXUP_SKU_IGNORE (2)
654
655 static void alc_fixup_sku_ignore(struct hda_codec *codec,
656 const struct hda_fixup *fix, int action)
657 {
658 struct alc_spec *spec = codec->spec;
659 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
660 spec->cdefine.fixup = 1;
661 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
662 }
663 }
664
665 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
666 const struct hda_fixup *fix, int action)
667 {
668 struct alc_spec *spec = codec->spec;
669
670 if (action == HDA_FIXUP_ACT_PROBE) {
671 spec->no_depop_delay = 1;
672 codec->depop_delay = 0;
673 }
674 }
675
676 static int alc_auto_parse_customize_define(struct hda_codec *codec)
677 {
678 unsigned int ass, tmp, i;
679 unsigned nid = 0;
680 struct alc_spec *spec = codec->spec;
681
682 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
683
684 if (spec->cdefine.fixup) {
685 ass = spec->cdefine.sku_cfg;
686 if (ass == ALC_FIXUP_SKU_IGNORE)
687 return -1;
688 goto do_sku;
689 }
690
691 if (!codec->bus->pci)
692 return -1;
693 ass = codec->core.subsystem_id & 0xffff;
694 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
695 goto do_sku;
696
697 nid = 0x1d;
698 if (codec->core.vendor_id == 0x10ec0260)
699 nid = 0x17;
700 ass = snd_hda_codec_get_pincfg(codec, nid);
701
702 if (!(ass & 1)) {
703 codec_info(codec, "%s: SKU not ready 0x%08x\n",
704 codec->core.chip_name, ass);
705 return -1;
706 }
707
708 /* check sum */
709 tmp = 0;
710 for (i = 1; i < 16; i++) {
711 if ((ass >> i) & 1)
712 tmp++;
713 }
714 if (((ass >> 16) & 0xf) != tmp)
715 return -1;
716
717 spec->cdefine.port_connectivity = ass >> 30;
718 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
719 spec->cdefine.check_sum = (ass >> 16) & 0xf;
720 spec->cdefine.customization = ass >> 8;
721 do_sku:
722 spec->cdefine.sku_cfg = ass;
723 spec->cdefine.external_amp = (ass & 0x38) >> 3;
724 spec->cdefine.platform_type = (ass & 0x4) >> 2;
725 spec->cdefine.swap = (ass & 0x2) >> 1;
726 spec->cdefine.override = ass & 0x1;
727
728 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
729 nid, spec->cdefine.sku_cfg);
730 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
731 spec->cdefine.port_connectivity);
732 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
733 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
734 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
735 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
736 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
737 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
738 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
739
740 return 0;
741 }
742
743 /* return the position of NID in the list, or -1 if not found */
744 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
745 {
746 int i;
747 for (i = 0; i < nums; i++)
748 if (list[i] == nid)
749 return i;
750 return -1;
751 }
752 /* return true if the given NID is found in the list */
753 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
754 {
755 return find_idx_in_nid_list(nid, list, nums) >= 0;
756 }
757
758 /* check subsystem ID and set up device-specific initialization;
759 * return 1 if initialized, 0 if invalid SSID
760 */
761 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
762 * 31 ~ 16 : Manufacture ID
763 * 15 ~ 8 : SKU ID
764 * 7 ~ 0 : Assembly ID
765 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
766 */
767 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
768 {
769 unsigned int ass, tmp, i;
770 unsigned nid;
771 struct alc_spec *spec = codec->spec;
772
773 if (spec->cdefine.fixup) {
774 ass = spec->cdefine.sku_cfg;
775 if (ass == ALC_FIXUP_SKU_IGNORE)
776 return 0;
777 goto do_sku;
778 }
779
780 ass = codec->core.subsystem_id & 0xffff;
781 if (codec->bus->pci &&
782 ass != codec->bus->pci->subsystem_device && (ass & 1))
783 goto do_sku;
784
785 /* invalid SSID, check the special NID pin defcfg instead */
786 /*
787 * 31~30 : port connectivity
788 * 29~21 : reserve
789 * 20 : PCBEEP input
790 * 19~16 : Check sum (15:1)
791 * 15~1 : Custom
792 * 0 : override
793 */
794 nid = 0x1d;
795 if (codec->core.vendor_id == 0x10ec0260)
796 nid = 0x17;
797 ass = snd_hda_codec_get_pincfg(codec, nid);
798 codec_dbg(codec,
799 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
800 ass, nid);
801 if (!(ass & 1))
802 return 0;
803 if ((ass >> 30) != 1) /* no physical connection */
804 return 0;
805
806 /* check sum */
807 tmp = 0;
808 for (i = 1; i < 16; i++) {
809 if ((ass >> i) & 1)
810 tmp++;
811 }
812 if (((ass >> 16) & 0xf) != tmp)
813 return 0;
814 do_sku:
815 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
816 ass & 0xffff, codec->core.vendor_id);
817 /*
818 * 0 : override
819 * 1 : Swap Jack
820 * 2 : 0 --> Desktop, 1 --> Laptop
821 * 3~5 : External Amplifier control
822 * 7~6 : Reserved
823 */
824 tmp = (ass & 0x38) >> 3; /* external Amp control */
825 if (spec->init_amp == ALC_INIT_UNDEFINED) {
826 switch (tmp) {
827 case 1:
828 alc_setup_gpio(codec, 0x01);
829 break;
830 case 3:
831 alc_setup_gpio(codec, 0x02);
832 break;
833 case 7:
834 alc_setup_gpio(codec, 0x03);
835 break;
836 case 5:
837 default:
838 spec->init_amp = ALC_INIT_DEFAULT;
839 break;
840 }
841 }
842
843 /* is laptop or Desktop and enable the function "Mute internal speaker
844 * when the external headphone out jack is plugged"
845 */
846 if (!(ass & 0x8000))
847 return 1;
848 /*
849 * 10~8 : Jack location
850 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
851 * 14~13: Resvered
852 * 15 : 1 --> enable the function "Mute internal speaker
853 * when the external headphone out jack is plugged"
854 */
855 if (!alc_get_hp_pin(spec)) {
856 hda_nid_t nid;
857 tmp = (ass >> 11) & 0x3; /* HP to chassis */
858 nid = ports[tmp];
859 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
860 spec->gen.autocfg.line_outs))
861 return 1;
862 spec->gen.autocfg.hp_pins[0] = nid;
863 }
864 return 1;
865 }
866
867 /* Check the validity of ALC subsystem-id
868 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
869 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
870 {
871 if (!alc_subsystem_id(codec, ports)) {
872 struct alc_spec *spec = codec->spec;
873 if (spec->init_amp == ALC_INIT_UNDEFINED) {
874 codec_dbg(codec,
875 "realtek: Enable default setup for auto mode as fallback\n");
876 spec->init_amp = ALC_INIT_DEFAULT;
877 }
878 }
879 }
880
881 /*
882 */
883
884 static void alc_fixup_inv_dmic(struct hda_codec *codec,
885 const struct hda_fixup *fix, int action)
886 {
887 struct alc_spec *spec = codec->spec;
888
889 spec->gen.inv_dmic_split = 1;
890 }
891
892
893 static int alc_build_controls(struct hda_codec *codec)
894 {
895 int err;
896
897 err = snd_hda_gen_build_controls(codec);
898 if (err < 0)
899 return err;
900
901 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
902 return 0;
903 }
904
905
906 /*
907 * Common callbacks
908 */
909
910 static void alc_pre_init(struct hda_codec *codec)
911 {
912 alc_fill_eapd_coef(codec);
913 }
914
915 #define is_s3_resume(codec) \
916 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
917 #define is_s4_resume(codec) \
918 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
919
920 static int alc_init(struct hda_codec *codec)
921 {
922 struct alc_spec *spec = codec->spec;
923
924 /* hibernation resume needs the full chip initialization */
925 if (is_s4_resume(codec))
926 alc_pre_init(codec);
927
928 if (spec->init_hook)
929 spec->init_hook(codec);
930
931 spec->gen.skip_verbs = 1; /* applied in below */
932 snd_hda_gen_init(codec);
933 alc_fix_pll(codec);
934 alc_auto_init_amp(codec, spec->init_amp);
935 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
936
937 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
938
939 return 0;
940 }
941
942 #define alc_free snd_hda_gen_free
943
944 #ifdef CONFIG_PM
945 static inline void alc_shutup(struct hda_codec *codec)
946 {
947 struct alc_spec *spec = codec->spec;
948
949 if (!snd_hda_get_bool_hint(codec, "shutup"))
950 return; /* disabled explicitly by hints */
951
952 if (spec && spec->shutup)
953 spec->shutup(codec);
954 else
955 alc_shutup_pins(codec);
956 }
957
958 static void alc_power_eapd(struct hda_codec *codec)
959 {
960 alc_auto_setup_eapd(codec, false);
961 }
962
963 static int alc_suspend(struct hda_codec *codec)
964 {
965 struct alc_spec *spec = codec->spec;
966 alc_shutup(codec);
967 if (spec && spec->power_hook)
968 spec->power_hook(codec);
969 return 0;
970 }
971
972 static int alc_resume(struct hda_codec *codec)
973 {
974 struct alc_spec *spec = codec->spec;
975
976 if (!spec->no_depop_delay)
977 msleep(150); /* to avoid pop noise */
978 codec->patch_ops.init(codec);
979 snd_hda_regmap_sync(codec);
980 hda_call_check_power_status(codec, 0x01);
981 return 0;
982 }
983 #endif
984
985 /*
986 */
987 static const struct hda_codec_ops alc_patch_ops = {
988 .build_controls = alc_build_controls,
989 .build_pcms = snd_hda_gen_build_pcms,
990 .init = alc_init,
991 .free = alc_free,
992 .unsol_event = snd_hda_jack_unsol_event,
993 #ifdef CONFIG_PM
994 .resume = alc_resume,
995 .suspend = alc_suspend,
996 .check_power_status = snd_hda_gen_check_power_status,
997 #endif
998 };
999
1000
1001 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1002
1003 /*
1004 * Rename codecs appropriately from COEF value or subvendor id
1005 */
1006 struct alc_codec_rename_table {
1007 unsigned int vendor_id;
1008 unsigned short coef_mask;
1009 unsigned short coef_bits;
1010 const char *name;
1011 };
1012
1013 struct alc_codec_rename_pci_table {
1014 unsigned int codec_vendor_id;
1015 unsigned short pci_subvendor;
1016 unsigned short pci_subdevice;
1017 const char *name;
1018 };
1019
1020 static const struct alc_codec_rename_table rename_tbl[] = {
1021 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1022 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1023 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1024 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1025 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1026 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1027 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1028 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1029 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1030 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1031 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1032 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1033 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1034 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1035 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1036 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1037 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1038 { } /* terminator */
1039 };
1040
1041 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1042 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1043 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1044 { 0x10ec0283, 0x1028, 0, "ALC3223" },
1045 { 0x10ec0288, 0x1028, 0, "ALC3263" },
1046 { 0x10ec0292, 0x1028, 0, "ALC3226" },
1047 { 0x10ec0293, 0x1028, 0, "ALC3235" },
1048 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1049 { 0x10ec0668, 0x1028, 0, "ALC3661" },
1050 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1051 { 0x10ec0899, 0x1028, 0, "ALC3861" },
1052 { 0x10ec0298, 0x1028, 0, "ALC3266" },
1053 { 0x10ec0236, 0x1028, 0, "ALC3204" },
1054 { 0x10ec0256, 0x1028, 0, "ALC3246" },
1055 { 0x10ec0225, 0x1028, 0, "ALC3253" },
1056 { 0x10ec0295, 0x1028, 0, "ALC3254" },
1057 { 0x10ec0299, 0x1028, 0, "ALC3271" },
1058 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1059 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1060 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1061 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1062 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1063 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1064 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1065 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1066 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1067 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1068 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
1069 { } /* terminator */
1070 };
1071
1072 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1073 {
1074 const struct alc_codec_rename_table *p;
1075 const struct alc_codec_rename_pci_table *q;
1076
1077 for (p = rename_tbl; p->vendor_id; p++) {
1078 if (p->vendor_id != codec->core.vendor_id)
1079 continue;
1080 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1081 return alc_codec_rename(codec, p->name);
1082 }
1083
1084 if (!codec->bus->pci)
1085 return 0;
1086 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1087 if (q->codec_vendor_id != codec->core.vendor_id)
1088 continue;
1089 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1090 continue;
1091 if (!q->pci_subdevice ||
1092 q->pci_subdevice == codec->bus->pci->subsystem_device)
1093 return alc_codec_rename(codec, q->name);
1094 }
1095
1096 return 0;
1097 }
1098
1099
1100 /*
1101 * Digital-beep handlers
1102 */
1103 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1104
1105 /* additional beep mixers; private_value will be overwritten */
1106 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1107 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1108 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1109 };
1110
1111 /* set up and create beep controls */
1112 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1113 int idx, int dir)
1114 {
1115 struct snd_kcontrol_new *knew;
1116 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1117 int i;
1118
1119 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1120 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1121 &alc_beep_mixer[i]);
1122 if (!knew)
1123 return -ENOMEM;
1124 knew->private_value = beep_amp;
1125 }
1126 return 0;
1127 }
1128
1129 static const struct snd_pci_quirk beep_allow_list[] = {
1130 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1131 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1132 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1133 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1134 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1135 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1136 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1137 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1138 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1139 /* denylist -- no beep available */
1140 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1141 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1142 {}
1143 };
1144
1145 static inline int has_cdefine_beep(struct hda_codec *codec)
1146 {
1147 struct alc_spec *spec = codec->spec;
1148 const struct snd_pci_quirk *q;
1149 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1150 if (q)
1151 return q->value;
1152 return spec->cdefine.enable_pcbeep;
1153 }
1154 #else
1155 #define set_beep_amp(spec, nid, idx, dir) 0
1156 #define has_cdefine_beep(codec) 0
1157 #endif
1158
1159 /* parse the BIOS configuration and set up the alc_spec */
1160 /* return 1 if successful, 0 if the proper config is not found,
1161 * or a negative error code
1162 */
1163 static int alc_parse_auto_config(struct hda_codec *codec,
1164 const hda_nid_t *ignore_nids,
1165 const hda_nid_t *ssid_nids)
1166 {
1167 struct alc_spec *spec = codec->spec;
1168 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1169 int err;
1170
1171 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1172 spec->parse_flags);
1173 if (err < 0)
1174 return err;
1175
1176 if (ssid_nids)
1177 alc_ssid_check(codec, ssid_nids);
1178
1179 err = snd_hda_gen_parse_auto_config(codec, cfg);
1180 if (err < 0)
1181 return err;
1182
1183 return 1;
1184 }
1185
1186 /* common preparation job for alc_spec */
1187 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1188 {
1189 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1190 int err;
1191
1192 if (!spec)
1193 return -ENOMEM;
1194 codec->spec = spec;
1195 snd_hda_gen_spec_init(&spec->gen);
1196 spec->gen.mixer_nid = mixer_nid;
1197 spec->gen.own_eapd_ctl = 1;
1198 codec->single_adc_amp = 1;
1199 /* FIXME: do we need this for all Realtek codec models? */
1200 codec->spdif_status_reset = 1;
1201 codec->forced_resume = 1;
1202 codec->patch_ops = alc_patch_ops;
1203 mutex_init(&spec->coef_mutex);
1204
1205 err = alc_codec_rename_from_preset(codec);
1206 if (err < 0) {
1207 kfree(spec);
1208 return err;
1209 }
1210 return 0;
1211 }
1212
1213 static int alc880_parse_auto_config(struct hda_codec *codec)
1214 {
1215 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1216 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1217 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1218 }
1219
1220 /*
1221 * ALC880 fix-ups
1222 */
1223 enum {
1224 ALC880_FIXUP_GPIO1,
1225 ALC880_FIXUP_GPIO2,
1226 ALC880_FIXUP_MEDION_RIM,
1227 ALC880_FIXUP_LG,
1228 ALC880_FIXUP_LG_LW25,
1229 ALC880_FIXUP_W810,
1230 ALC880_FIXUP_EAPD_COEF,
1231 ALC880_FIXUP_TCL_S700,
1232 ALC880_FIXUP_VOL_KNOB,
1233 ALC880_FIXUP_FUJITSU,
1234 ALC880_FIXUP_F1734,
1235 ALC880_FIXUP_UNIWILL,
1236 ALC880_FIXUP_UNIWILL_DIG,
1237 ALC880_FIXUP_Z71V,
1238 ALC880_FIXUP_ASUS_W5A,
1239 ALC880_FIXUP_3ST_BASE,
1240 ALC880_FIXUP_3ST,
1241 ALC880_FIXUP_3ST_DIG,
1242 ALC880_FIXUP_5ST_BASE,
1243 ALC880_FIXUP_5ST,
1244 ALC880_FIXUP_5ST_DIG,
1245 ALC880_FIXUP_6ST_BASE,
1246 ALC880_FIXUP_6ST,
1247 ALC880_FIXUP_6ST_DIG,
1248 ALC880_FIXUP_6ST_AUTOMUTE,
1249 };
1250
1251 /* enable the volume-knob widget support on NID 0x21 */
1252 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1253 const struct hda_fixup *fix, int action)
1254 {
1255 if (action == HDA_FIXUP_ACT_PROBE)
1256 snd_hda_jack_detect_enable_callback(codec, 0x21,
1257 alc_update_knob_master);
1258 }
1259
1260 static const struct hda_fixup alc880_fixups[] = {
1261 [ALC880_FIXUP_GPIO1] = {
1262 .type = HDA_FIXUP_FUNC,
1263 .v.func = alc_fixup_gpio1,
1264 },
1265 [ALC880_FIXUP_GPIO2] = {
1266 .type = HDA_FIXUP_FUNC,
1267 .v.func = alc_fixup_gpio2,
1268 },
1269 [ALC880_FIXUP_MEDION_RIM] = {
1270 .type = HDA_FIXUP_VERBS,
1271 .v.verbs = (const struct hda_verb[]) {
1272 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1273 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1274 { }
1275 },
1276 .chained = true,
1277 .chain_id = ALC880_FIXUP_GPIO2,
1278 },
1279 [ALC880_FIXUP_LG] = {
1280 .type = HDA_FIXUP_PINS,
1281 .v.pins = (const struct hda_pintbl[]) {
1282 /* disable bogus unused pins */
1283 { 0x16, 0x411111f0 },
1284 { 0x18, 0x411111f0 },
1285 { 0x1a, 0x411111f0 },
1286 { }
1287 }
1288 },
1289 [ALC880_FIXUP_LG_LW25] = {
1290 .type = HDA_FIXUP_PINS,
1291 .v.pins = (const struct hda_pintbl[]) {
1292 { 0x1a, 0x0181344f }, /* line-in */
1293 { 0x1b, 0x0321403f }, /* headphone */
1294 { }
1295 }
1296 },
1297 [ALC880_FIXUP_W810] = {
1298 .type = HDA_FIXUP_PINS,
1299 .v.pins = (const struct hda_pintbl[]) {
1300 /* disable bogus unused pins */
1301 { 0x17, 0x411111f0 },
1302 { }
1303 },
1304 .chained = true,
1305 .chain_id = ALC880_FIXUP_GPIO2,
1306 },
1307 [ALC880_FIXUP_EAPD_COEF] = {
1308 .type = HDA_FIXUP_VERBS,
1309 .v.verbs = (const struct hda_verb[]) {
1310 /* change to EAPD mode */
1311 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1312 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1313 {}
1314 },
1315 },
1316 [ALC880_FIXUP_TCL_S700] = {
1317 .type = HDA_FIXUP_VERBS,
1318 .v.verbs = (const struct hda_verb[]) {
1319 /* change to EAPD mode */
1320 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1321 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1322 {}
1323 },
1324 .chained = true,
1325 .chain_id = ALC880_FIXUP_GPIO2,
1326 },
1327 [ALC880_FIXUP_VOL_KNOB] = {
1328 .type = HDA_FIXUP_FUNC,
1329 .v.func = alc880_fixup_vol_knob,
1330 },
1331 [ALC880_FIXUP_FUJITSU] = {
1332 /* override all pins as BIOS on old Amilo is broken */
1333 .type = HDA_FIXUP_PINS,
1334 .v.pins = (const struct hda_pintbl[]) {
1335 { 0x14, 0x0121401f }, /* HP */
1336 { 0x15, 0x99030120 }, /* speaker */
1337 { 0x16, 0x99030130 }, /* bass speaker */
1338 { 0x17, 0x411111f0 }, /* N/A */
1339 { 0x18, 0x411111f0 }, /* N/A */
1340 { 0x19, 0x01a19950 }, /* mic-in */
1341 { 0x1a, 0x411111f0 }, /* N/A */
1342 { 0x1b, 0x411111f0 }, /* N/A */
1343 { 0x1c, 0x411111f0 }, /* N/A */
1344 { 0x1d, 0x411111f0 }, /* N/A */
1345 { 0x1e, 0x01454140 }, /* SPDIF out */
1346 { }
1347 },
1348 .chained = true,
1349 .chain_id = ALC880_FIXUP_VOL_KNOB,
1350 },
1351 [ALC880_FIXUP_F1734] = {
1352 /* almost compatible with FUJITSU, but no bass and SPDIF */
1353 .type = HDA_FIXUP_PINS,
1354 .v.pins = (const struct hda_pintbl[]) {
1355 { 0x14, 0x0121401f }, /* HP */
1356 { 0x15, 0x99030120 }, /* speaker */
1357 { 0x16, 0x411111f0 }, /* N/A */
1358 { 0x17, 0x411111f0 }, /* N/A */
1359 { 0x18, 0x411111f0 }, /* N/A */
1360 { 0x19, 0x01a19950 }, /* mic-in */
1361 { 0x1a, 0x411111f0 }, /* N/A */
1362 { 0x1b, 0x411111f0 }, /* N/A */
1363 { 0x1c, 0x411111f0 }, /* N/A */
1364 { 0x1d, 0x411111f0 }, /* N/A */
1365 { 0x1e, 0x411111f0 }, /* N/A */
1366 { }
1367 },
1368 .chained = true,
1369 .chain_id = ALC880_FIXUP_VOL_KNOB,
1370 },
1371 [ALC880_FIXUP_UNIWILL] = {
1372 /* need to fix HP and speaker pins to be parsed correctly */
1373 .type = HDA_FIXUP_PINS,
1374 .v.pins = (const struct hda_pintbl[]) {
1375 { 0x14, 0x0121411f }, /* HP */
1376 { 0x15, 0x99030120 }, /* speaker */
1377 { 0x16, 0x99030130 }, /* bass speaker */
1378 { }
1379 },
1380 },
1381 [ALC880_FIXUP_UNIWILL_DIG] = {
1382 .type = HDA_FIXUP_PINS,
1383 .v.pins = (const struct hda_pintbl[]) {
1384 /* disable bogus unused pins */
1385 { 0x17, 0x411111f0 },
1386 { 0x19, 0x411111f0 },
1387 { 0x1b, 0x411111f0 },
1388 { 0x1f, 0x411111f0 },
1389 { }
1390 }
1391 },
1392 [ALC880_FIXUP_Z71V] = {
1393 .type = HDA_FIXUP_PINS,
1394 .v.pins = (const struct hda_pintbl[]) {
1395 /* set up the whole pins as BIOS is utterly broken */
1396 { 0x14, 0x99030120 }, /* speaker */
1397 { 0x15, 0x0121411f }, /* HP */
1398 { 0x16, 0x411111f0 }, /* N/A */
1399 { 0x17, 0x411111f0 }, /* N/A */
1400 { 0x18, 0x01a19950 }, /* mic-in */
1401 { 0x19, 0x411111f0 }, /* N/A */
1402 { 0x1a, 0x01813031 }, /* line-in */
1403 { 0x1b, 0x411111f0 }, /* N/A */
1404 { 0x1c, 0x411111f0 }, /* N/A */
1405 { 0x1d, 0x411111f0 }, /* N/A */
1406 { 0x1e, 0x0144111e }, /* SPDIF */
1407 { }
1408 }
1409 },
1410 [ALC880_FIXUP_ASUS_W5A] = {
1411 .type = HDA_FIXUP_PINS,
1412 .v.pins = (const struct hda_pintbl[]) {
1413 /* set up the whole pins as BIOS is utterly broken */
1414 { 0x14, 0x0121411f }, /* HP */
1415 { 0x15, 0x411111f0 }, /* N/A */
1416 { 0x16, 0x411111f0 }, /* N/A */
1417 { 0x17, 0x411111f0 }, /* N/A */
1418 { 0x18, 0x90a60160 }, /* mic */
1419 { 0x19, 0x411111f0 }, /* N/A */
1420 { 0x1a, 0x411111f0 }, /* N/A */
1421 { 0x1b, 0x411111f0 }, /* N/A */
1422 { 0x1c, 0x411111f0 }, /* N/A */
1423 { 0x1d, 0x411111f0 }, /* N/A */
1424 { 0x1e, 0xb743111e }, /* SPDIF out */
1425 { }
1426 },
1427 .chained = true,
1428 .chain_id = ALC880_FIXUP_GPIO1,
1429 },
1430 [ALC880_FIXUP_3ST_BASE] = {
1431 .type = HDA_FIXUP_PINS,
1432 .v.pins = (const struct hda_pintbl[]) {
1433 { 0x14, 0x01014010 }, /* line-out */
1434 { 0x15, 0x411111f0 }, /* N/A */
1435 { 0x16, 0x411111f0 }, /* N/A */
1436 { 0x17, 0x411111f0 }, /* N/A */
1437 { 0x18, 0x01a19c30 }, /* mic-in */
1438 { 0x19, 0x0121411f }, /* HP */
1439 { 0x1a, 0x01813031 }, /* line-in */
1440 { 0x1b, 0x02a19c40 }, /* front-mic */
1441 { 0x1c, 0x411111f0 }, /* N/A */
1442 { 0x1d, 0x411111f0 }, /* N/A */
1443 /* 0x1e is filled in below */
1444 { 0x1f, 0x411111f0 }, /* N/A */
1445 { }
1446 }
1447 },
1448 [ALC880_FIXUP_3ST] = {
1449 .type = HDA_FIXUP_PINS,
1450 .v.pins = (const struct hda_pintbl[]) {
1451 { 0x1e, 0x411111f0 }, /* N/A */
1452 { }
1453 },
1454 .chained = true,
1455 .chain_id = ALC880_FIXUP_3ST_BASE,
1456 },
1457 [ALC880_FIXUP_3ST_DIG] = {
1458 .type = HDA_FIXUP_PINS,
1459 .v.pins = (const struct hda_pintbl[]) {
1460 { 0x1e, 0x0144111e }, /* SPDIF */
1461 { }
1462 },
1463 .chained = true,
1464 .chain_id = ALC880_FIXUP_3ST_BASE,
1465 },
1466 [ALC880_FIXUP_5ST_BASE] = {
1467 .type = HDA_FIXUP_PINS,
1468 .v.pins = (const struct hda_pintbl[]) {
1469 { 0x14, 0x01014010 }, /* front */
1470 { 0x15, 0x411111f0 }, /* N/A */
1471 { 0x16, 0x01011411 }, /* CLFE */
1472 { 0x17, 0x01016412 }, /* surr */
1473 { 0x18, 0x01a19c30 }, /* mic-in */
1474 { 0x19, 0x0121411f }, /* HP */
1475 { 0x1a, 0x01813031 }, /* line-in */
1476 { 0x1b, 0x02a19c40 }, /* front-mic */
1477 { 0x1c, 0x411111f0 }, /* N/A */
1478 { 0x1d, 0x411111f0 }, /* N/A */
1479 /* 0x1e is filled in below */
1480 { 0x1f, 0x411111f0 }, /* N/A */
1481 { }
1482 }
1483 },
1484 [ALC880_FIXUP_5ST] = {
1485 .type = HDA_FIXUP_PINS,
1486 .v.pins = (const struct hda_pintbl[]) {
1487 { 0x1e, 0x411111f0 }, /* N/A */
1488 { }
1489 },
1490 .chained = true,
1491 .chain_id = ALC880_FIXUP_5ST_BASE,
1492 },
1493 [ALC880_FIXUP_5ST_DIG] = {
1494 .type = HDA_FIXUP_PINS,
1495 .v.pins = (const struct hda_pintbl[]) {
1496 { 0x1e, 0x0144111e }, /* SPDIF */
1497 { }
1498 },
1499 .chained = true,
1500 .chain_id = ALC880_FIXUP_5ST_BASE,
1501 },
1502 [ALC880_FIXUP_6ST_BASE] = {
1503 .type = HDA_FIXUP_PINS,
1504 .v.pins = (const struct hda_pintbl[]) {
1505 { 0x14, 0x01014010 }, /* front */
1506 { 0x15, 0x01016412 }, /* surr */
1507 { 0x16, 0x01011411 }, /* CLFE */
1508 { 0x17, 0x01012414 }, /* side */
1509 { 0x18, 0x01a19c30 }, /* mic-in */
1510 { 0x19, 0x02a19c40 }, /* front-mic */
1511 { 0x1a, 0x01813031 }, /* line-in */
1512 { 0x1b, 0x0121411f }, /* HP */
1513 { 0x1c, 0x411111f0 }, /* N/A */
1514 { 0x1d, 0x411111f0 }, /* N/A */
1515 /* 0x1e is filled in below */
1516 { 0x1f, 0x411111f0 }, /* N/A */
1517 { }
1518 }
1519 },
1520 [ALC880_FIXUP_6ST] = {
1521 .type = HDA_FIXUP_PINS,
1522 .v.pins = (const struct hda_pintbl[]) {
1523 { 0x1e, 0x411111f0 }, /* N/A */
1524 { }
1525 },
1526 .chained = true,
1527 .chain_id = ALC880_FIXUP_6ST_BASE,
1528 },
1529 [ALC880_FIXUP_6ST_DIG] = {
1530 .type = HDA_FIXUP_PINS,
1531 .v.pins = (const struct hda_pintbl[]) {
1532 { 0x1e, 0x0144111e }, /* SPDIF */
1533 { }
1534 },
1535 .chained = true,
1536 .chain_id = ALC880_FIXUP_6ST_BASE,
1537 },
1538 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1539 .type = HDA_FIXUP_PINS,
1540 .v.pins = (const struct hda_pintbl[]) {
1541 { 0x1b, 0x0121401f }, /* HP with jack detect */
1542 { }
1543 },
1544 .chained_before = true,
1545 .chain_id = ALC880_FIXUP_6ST_BASE,
1546 },
1547 };
1548
1549 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1550 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1551 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1552 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1553 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1554 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1555 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1556 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1557 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1558 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1559 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1560 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1561 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1562 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1563 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1564 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1565 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1566 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1567 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1568 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1569 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1570 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1571 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1572 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1573
1574 /* Below is the copied entries from alc880_quirks.c.
1575 * It's not quite sure whether BIOS sets the correct pin-config table
1576 * on these machines, thus they are kept to be compatible with
1577 * the old static quirks. Once when it's confirmed to work without
1578 * these overrides, it'd be better to remove.
1579 */
1580 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1581 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1582 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1583 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1584 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1585 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1586 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1587 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1588 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1589 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1590 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1591 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1592 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1593 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1594 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1595 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1596 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1597 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1598 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1599 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1600 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1601 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1602 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1603 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1604 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1605 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1606 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1607 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1608 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1609 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1610 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1611 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1612 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1613 /* default Intel */
1614 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1615 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1616 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1617 {}
1618 };
1619
1620 static const struct hda_model_fixup alc880_fixup_models[] = {
1621 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1622 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1623 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1624 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1625 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1626 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1627 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1628 {}
1629 };
1630
1631
1632 /*
1633 * OK, here we have finally the patch for ALC880
1634 */
1635 static int patch_alc880(struct hda_codec *codec)
1636 {
1637 struct alc_spec *spec;
1638 int err;
1639
1640 err = alc_alloc_spec(codec, 0x0b);
1641 if (err < 0)
1642 return err;
1643
1644 spec = codec->spec;
1645 spec->gen.need_dac_fix = 1;
1646 spec->gen.beep_nid = 0x01;
1647
1648 codec->patch_ops.unsol_event = alc880_unsol_event;
1649
1650 alc_pre_init(codec);
1651
1652 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1653 alc880_fixups);
1654 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1655
1656 /* automatic parse from the BIOS config */
1657 err = alc880_parse_auto_config(codec);
1658 if (err < 0)
1659 goto error;
1660
1661 if (!spec->gen.no_analog) {
1662 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1663 if (err < 0)
1664 goto error;
1665 }
1666
1667 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1668
1669 return 0;
1670
1671 error:
1672 alc_free(codec);
1673 return err;
1674 }
1675
1676
1677 /*
1678 * ALC260 support
1679 */
1680 static int alc260_parse_auto_config(struct hda_codec *codec)
1681 {
1682 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1683 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1684 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1685 }
1686
1687 /*
1688 * Pin config fixes
1689 */
1690 enum {
1691 ALC260_FIXUP_HP_DC5750,
1692 ALC260_FIXUP_HP_PIN_0F,
1693 ALC260_FIXUP_COEF,
1694 ALC260_FIXUP_GPIO1,
1695 ALC260_FIXUP_GPIO1_TOGGLE,
1696 ALC260_FIXUP_REPLACER,
1697 ALC260_FIXUP_HP_B1900,
1698 ALC260_FIXUP_KN1,
1699 ALC260_FIXUP_FSC_S7020,
1700 ALC260_FIXUP_FSC_S7020_JWSE,
1701 ALC260_FIXUP_VAIO_PINS,
1702 };
1703
1704 static void alc260_gpio1_automute(struct hda_codec *codec)
1705 {
1706 struct alc_spec *spec = codec->spec;
1707
1708 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1709 }
1710
1711 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1712 const struct hda_fixup *fix, int action)
1713 {
1714 struct alc_spec *spec = codec->spec;
1715 if (action == HDA_FIXUP_ACT_PROBE) {
1716 /* although the machine has only one output pin, we need to
1717 * toggle GPIO1 according to the jack state
1718 */
1719 spec->gen.automute_hook = alc260_gpio1_automute;
1720 spec->gen.detect_hp = 1;
1721 spec->gen.automute_speaker = 1;
1722 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1723 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1724 snd_hda_gen_hp_automute);
1725 alc_setup_gpio(codec, 0x01);
1726 }
1727 }
1728
1729 static void alc260_fixup_kn1(struct hda_codec *codec,
1730 const struct hda_fixup *fix, int action)
1731 {
1732 struct alc_spec *spec = codec->spec;
1733 static const struct hda_pintbl pincfgs[] = {
1734 { 0x0f, 0x02214000 }, /* HP/speaker */
1735 { 0x12, 0x90a60160 }, /* int mic */
1736 { 0x13, 0x02a19000 }, /* ext mic */
1737 { 0x18, 0x01446000 }, /* SPDIF out */
1738 /* disable bogus I/O pins */
1739 { 0x10, 0x411111f0 },
1740 { 0x11, 0x411111f0 },
1741 { 0x14, 0x411111f0 },
1742 { 0x15, 0x411111f0 },
1743 { 0x16, 0x411111f0 },
1744 { 0x17, 0x411111f0 },
1745 { 0x19, 0x411111f0 },
1746 { }
1747 };
1748
1749 switch (action) {
1750 case HDA_FIXUP_ACT_PRE_PROBE:
1751 snd_hda_apply_pincfgs(codec, pincfgs);
1752 spec->init_amp = ALC_INIT_NONE;
1753 break;
1754 }
1755 }
1756
1757 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1758 const struct hda_fixup *fix, int action)
1759 {
1760 struct alc_spec *spec = codec->spec;
1761 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1762 spec->init_amp = ALC_INIT_NONE;
1763 }
1764
1765 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1766 const struct hda_fixup *fix, int action)
1767 {
1768 struct alc_spec *spec = codec->spec;
1769 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1770 spec->gen.add_jack_modes = 1;
1771 spec->gen.hp_mic = 1;
1772 }
1773 }
1774
1775 static const struct hda_fixup alc260_fixups[] = {
1776 [ALC260_FIXUP_HP_DC5750] = {
1777 .type = HDA_FIXUP_PINS,
1778 .v.pins = (const struct hda_pintbl[]) {
1779 { 0x11, 0x90130110 }, /* speaker */
1780 { }
1781 }
1782 },
1783 [ALC260_FIXUP_HP_PIN_0F] = {
1784 .type = HDA_FIXUP_PINS,
1785 .v.pins = (const struct hda_pintbl[]) {
1786 { 0x0f, 0x01214000 }, /* HP */
1787 { }
1788 }
1789 },
1790 [ALC260_FIXUP_COEF] = {
1791 .type = HDA_FIXUP_VERBS,
1792 .v.verbs = (const struct hda_verb[]) {
1793 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1794 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1795 { }
1796 },
1797 },
1798 [ALC260_FIXUP_GPIO1] = {
1799 .type = HDA_FIXUP_FUNC,
1800 .v.func = alc_fixup_gpio1,
1801 },
1802 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1803 .type = HDA_FIXUP_FUNC,
1804 .v.func = alc260_fixup_gpio1_toggle,
1805 .chained = true,
1806 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1807 },
1808 [ALC260_FIXUP_REPLACER] = {
1809 .type = HDA_FIXUP_VERBS,
1810 .v.verbs = (const struct hda_verb[]) {
1811 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1812 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1813 { }
1814 },
1815 .chained = true,
1816 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1817 },
1818 [ALC260_FIXUP_HP_B1900] = {
1819 .type = HDA_FIXUP_FUNC,
1820 .v.func = alc260_fixup_gpio1_toggle,
1821 .chained = true,
1822 .chain_id = ALC260_FIXUP_COEF,
1823 },
1824 [ALC260_FIXUP_KN1] = {
1825 .type = HDA_FIXUP_FUNC,
1826 .v.func = alc260_fixup_kn1,
1827 },
1828 [ALC260_FIXUP_FSC_S7020] = {
1829 .type = HDA_FIXUP_FUNC,
1830 .v.func = alc260_fixup_fsc_s7020,
1831 },
1832 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1833 .type = HDA_FIXUP_FUNC,
1834 .v.func = alc260_fixup_fsc_s7020_jwse,
1835 .chained = true,
1836 .chain_id = ALC260_FIXUP_FSC_S7020,
1837 },
1838 [ALC260_FIXUP_VAIO_PINS] = {
1839 .type = HDA_FIXUP_PINS,
1840 .v.pins = (const struct hda_pintbl[]) {
1841 /* Pin configs are missing completely on some VAIOs */
1842 { 0x0f, 0x01211020 },
1843 { 0x10, 0x0001003f },
1844 { 0x11, 0x411111f0 },
1845 { 0x12, 0x01a15930 },
1846 { 0x13, 0x411111f0 },
1847 { 0x14, 0x411111f0 },
1848 { 0x15, 0x411111f0 },
1849 { 0x16, 0x411111f0 },
1850 { 0x17, 0x411111f0 },
1851 { 0x18, 0x411111f0 },
1852 { 0x19, 0x411111f0 },
1853 { }
1854 }
1855 },
1856 };
1857
1858 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1859 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1860 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1861 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1862 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1863 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1864 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1865 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1866 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1867 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1868 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1869 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1870 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1871 {}
1872 };
1873
1874 static const struct hda_model_fixup alc260_fixup_models[] = {
1875 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1876 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1877 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1878 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1879 {}
1880 };
1881
1882 /*
1883 */
1884 static int patch_alc260(struct hda_codec *codec)
1885 {
1886 struct alc_spec *spec;
1887 int err;
1888
1889 err = alc_alloc_spec(codec, 0x07);
1890 if (err < 0)
1891 return err;
1892
1893 spec = codec->spec;
1894 /* as quite a few machines require HP amp for speaker outputs,
1895 * it's easier to enable it unconditionally; even if it's unneeded,
1896 * it's almost harmless.
1897 */
1898 spec->gen.prefer_hp_amp = 1;
1899 spec->gen.beep_nid = 0x01;
1900
1901 spec->shutup = alc_eapd_shutup;
1902
1903 alc_pre_init(codec);
1904
1905 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1906 alc260_fixups);
1907 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1908
1909 /* automatic parse from the BIOS config */
1910 err = alc260_parse_auto_config(codec);
1911 if (err < 0)
1912 goto error;
1913
1914 if (!spec->gen.no_analog) {
1915 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1916 if (err < 0)
1917 goto error;
1918 }
1919
1920 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1921
1922 return 0;
1923
1924 error:
1925 alc_free(codec);
1926 return err;
1927 }
1928
1929
1930 /*
1931 * ALC882/883/885/888/889 support
1932 *
1933 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1934 * configuration. Each pin widget can choose any input DACs and a mixer.
1935 * Each ADC is connected from a mixer of all inputs. This makes possible
1936 * 6-channel independent captures.
1937 *
1938 * In addition, an independent DAC for the multi-playback (not used in this
1939 * driver yet).
1940 */
1941
1942 /*
1943 * Pin config fixes
1944 */
1945 enum {
1946 ALC882_FIXUP_ABIT_AW9D_MAX,
1947 ALC882_FIXUP_LENOVO_Y530,
1948 ALC882_FIXUP_PB_M5210,
1949 ALC882_FIXUP_ACER_ASPIRE_7736,
1950 ALC882_FIXUP_ASUS_W90V,
1951 ALC889_FIXUP_CD,
1952 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1953 ALC889_FIXUP_VAIO_TT,
1954 ALC888_FIXUP_EEE1601,
1955 ALC886_FIXUP_EAPD,
1956 ALC882_FIXUP_EAPD,
1957 ALC883_FIXUP_EAPD,
1958 ALC883_FIXUP_ACER_EAPD,
1959 ALC882_FIXUP_GPIO1,
1960 ALC882_FIXUP_GPIO2,
1961 ALC882_FIXUP_GPIO3,
1962 ALC889_FIXUP_COEF,
1963 ALC882_FIXUP_ASUS_W2JC,
1964 ALC882_FIXUP_ACER_ASPIRE_4930G,
1965 ALC882_FIXUP_ACER_ASPIRE_8930G,
1966 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1967 ALC885_FIXUP_MACPRO_GPIO,
1968 ALC889_FIXUP_DAC_ROUTE,
1969 ALC889_FIXUP_MBP_VREF,
1970 ALC889_FIXUP_IMAC91_VREF,
1971 ALC889_FIXUP_MBA11_VREF,
1972 ALC889_FIXUP_MBA21_VREF,
1973 ALC889_FIXUP_MP11_VREF,
1974 ALC889_FIXUP_MP41_VREF,
1975 ALC882_FIXUP_INV_DMIC,
1976 ALC882_FIXUP_NO_PRIMARY_HP,
1977 ALC887_FIXUP_ASUS_BASS,
1978 ALC887_FIXUP_BASS_CHMAP,
1979 ALC1220_FIXUP_GB_DUAL_CODECS,
1980 ALC1220_FIXUP_GB_X570,
1981 ALC1220_FIXUP_CLEVO_P950,
1982 ALC1220_FIXUP_CLEVO_PB51ED,
1983 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1984 ALC887_FIXUP_ASUS_AUDIO,
1985 ALC887_FIXUP_ASUS_HMIC,
1986 ALCS1200A_FIXUP_MIC_VREF,
1987 };
1988
1989 static void alc889_fixup_coef(struct hda_codec *codec,
1990 const struct hda_fixup *fix, int action)
1991 {
1992 if (action != HDA_FIXUP_ACT_INIT)
1993 return;
1994 alc_update_coef_idx(codec, 7, 0, 0x2030);
1995 }
1996
1997 /* set up GPIO at initialization */
1998 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1999 const struct hda_fixup *fix, int action)
2000 {
2001 struct alc_spec *spec = codec->spec;
2002
2003 spec->gpio_write_delay = true;
2004 alc_fixup_gpio3(codec, fix, action);
2005 }
2006
2007 /* Fix the connection of some pins for ALC889:
2008 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2009 * work correctly (bko#42740)
2010 */
2011 static void alc889_fixup_dac_route(struct hda_codec *codec,
2012 const struct hda_fixup *fix, int action)
2013 {
2014 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2015 /* fake the connections during parsing the tree */
2016 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2017 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2018 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2019 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2020 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2021 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2022 } else if (action == HDA_FIXUP_ACT_PROBE) {
2023 /* restore the connections */
2024 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2025 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2026 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2027 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2028 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2029 }
2030 }
2031
2032 /* Set VREF on HP pin */
2033 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2034 const struct hda_fixup *fix, int action)
2035 {
2036 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2037 struct alc_spec *spec = codec->spec;
2038 int i;
2039
2040 if (action != HDA_FIXUP_ACT_INIT)
2041 return;
2042 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2043 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2044 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2045 continue;
2046 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2047 val |= AC_PINCTL_VREF_80;
2048 snd_hda_set_pin_ctl(codec, nids[i], val);
2049 spec->gen.keep_vref_in_automute = 1;
2050 break;
2051 }
2052 }
2053
2054 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2055 const hda_nid_t *nids, int num_nids)
2056 {
2057 struct alc_spec *spec = codec->spec;
2058 int i;
2059
2060 for (i = 0; i < num_nids; i++) {
2061 unsigned int val;
2062 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2063 val |= AC_PINCTL_VREF_50;
2064 snd_hda_set_pin_ctl(codec, nids[i], val);
2065 }
2066 spec->gen.keep_vref_in_automute = 1;
2067 }
2068
2069 /* Set VREF on speaker pins on imac91 */
2070 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2071 const struct hda_fixup *fix, int action)
2072 {
2073 static const hda_nid_t nids[] = { 0x18, 0x1a };
2074
2075 if (action == HDA_FIXUP_ACT_INIT)
2076 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2077 }
2078
2079 /* Set VREF on speaker pins on mba11 */
2080 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2081 const struct hda_fixup *fix, int action)
2082 {
2083 static const hda_nid_t nids[] = { 0x18 };
2084
2085 if (action == HDA_FIXUP_ACT_INIT)
2086 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2087 }
2088
2089 /* Set VREF on speaker pins on mba21 */
2090 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2091 const struct hda_fixup *fix, int action)
2092 {
2093 static const hda_nid_t nids[] = { 0x18, 0x19 };
2094
2095 if (action == HDA_FIXUP_ACT_INIT)
2096 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2097 }
2098
2099 /* Don't take HP output as primary
2100 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2101 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2102 */
2103 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2104 const struct hda_fixup *fix, int action)
2105 {
2106 struct alc_spec *spec = codec->spec;
2107 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2108 spec->gen.no_primary_hp = 1;
2109 spec->gen.no_multi_io = 1;
2110 }
2111 }
2112
2113 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2114 const struct hda_fixup *fix, int action);
2115
2116 /* For dual-codec configuration, we need to disable some features to avoid
2117 * conflicts of kctls and PCM streams
2118 */
2119 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2120 const struct hda_fixup *fix, int action)
2121 {
2122 struct alc_spec *spec = codec->spec;
2123
2124 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2125 return;
2126 /* disable vmaster */
2127 spec->gen.suppress_vmaster = 1;
2128 /* auto-mute and auto-mic switch don't work with multiple codecs */
2129 spec->gen.suppress_auto_mute = 1;
2130 spec->gen.suppress_auto_mic = 1;
2131 /* disable aamix as well */
2132 spec->gen.mixer_nid = 0;
2133 /* add location prefix to avoid conflicts */
2134 codec->force_pin_prefix = 1;
2135 }
2136
2137 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2138 const char *newname)
2139 {
2140 struct snd_kcontrol *kctl;
2141
2142 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2143 if (kctl)
2144 strcpy(kctl->id.name, newname);
2145 }
2146
2147 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2148 const struct hda_fixup *fix,
2149 int action)
2150 {
2151 alc_fixup_dual_codecs(codec, fix, action);
2152 switch (action) {
2153 case HDA_FIXUP_ACT_PRE_PROBE:
2154 /* override card longname to provide a unique UCM profile */
2155 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2156 break;
2157 case HDA_FIXUP_ACT_BUILD:
2158 /* rename Capture controls depending on the codec */
2159 rename_ctl(codec, "Capture Volume",
2160 codec->addr == 0 ?
2161 "Rear-Panel Capture Volume" :
2162 "Front-Panel Capture Volume");
2163 rename_ctl(codec, "Capture Switch",
2164 codec->addr == 0 ?
2165 "Rear-Panel Capture Switch" :
2166 "Front-Panel Capture Switch");
2167 break;
2168 }
2169 }
2170
2171 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2172 const struct hda_fixup *fix,
2173 int action)
2174 {
2175 static const hda_nid_t conn1[] = { 0x0c };
2176 static const struct coef_fw gb_x570_coefs[] = {
2177 WRITE_COEF(0x07, 0x03c0),
2178 WRITE_COEF(0x1a, 0x01c1),
2179 WRITE_COEF(0x1b, 0x0202),
2180 WRITE_COEF(0x43, 0x3005),
2181 {}
2182 };
2183
2184 switch (action) {
2185 case HDA_FIXUP_ACT_PRE_PROBE:
2186 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2187 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2188 break;
2189 case HDA_FIXUP_ACT_INIT:
2190 alc_process_coef_fw(codec, gb_x570_coefs);
2191 break;
2192 }
2193 }
2194
2195 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2196 const struct hda_fixup *fix,
2197 int action)
2198 {
2199 static const hda_nid_t conn1[] = { 0x0c };
2200
2201 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2202 return;
2203
2204 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2205 /* We therefore want to make sure 0x14 (front headphone) and
2206 * 0x1b (speakers) use the stereo DAC 0x02
2207 */
2208 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2209 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2210 }
2211
2212 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2213 const struct hda_fixup *fix, int action);
2214
2215 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2216 const struct hda_fixup *fix,
2217 int action)
2218 {
2219 alc1220_fixup_clevo_p950(codec, fix, action);
2220 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2221 }
2222
2223 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2224 struct hda_jack_callback *jack)
2225 {
2226 struct alc_spec *spec = codec->spec;
2227 unsigned int vref;
2228
2229 snd_hda_gen_hp_automute(codec, jack);
2230
2231 if (spec->gen.hp_jack_present)
2232 vref = AC_PINCTL_VREF_80;
2233 else
2234 vref = AC_PINCTL_VREF_HIZ;
2235 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2236 }
2237
2238 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2239 const struct hda_fixup *fix, int action)
2240 {
2241 struct alc_spec *spec = codec->spec;
2242 if (action != HDA_FIXUP_ACT_PROBE)
2243 return;
2244 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2245 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2246 }
2247
2248 static const struct hda_fixup alc882_fixups[] = {
2249 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2250 .type = HDA_FIXUP_PINS,
2251 .v.pins = (const struct hda_pintbl[]) {
2252 { 0x15, 0x01080104 }, /* side */
2253 { 0x16, 0x01011012 }, /* rear */
2254 { 0x17, 0x01016011 }, /* clfe */
2255 { }
2256 }
2257 },
2258 [ALC882_FIXUP_LENOVO_Y530] = {
2259 .type = HDA_FIXUP_PINS,
2260 .v.pins = (const struct hda_pintbl[]) {
2261 { 0x15, 0x99130112 }, /* rear int speakers */
2262 { 0x16, 0x99130111 }, /* subwoofer */
2263 { }
2264 }
2265 },
2266 [ALC882_FIXUP_PB_M5210] = {
2267 .type = HDA_FIXUP_PINCTLS,
2268 .v.pins = (const struct hda_pintbl[]) {
2269 { 0x19, PIN_VREF50 },
2270 {}
2271 }
2272 },
2273 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2274 .type = HDA_FIXUP_FUNC,
2275 .v.func = alc_fixup_sku_ignore,
2276 },
2277 [ALC882_FIXUP_ASUS_W90V] = {
2278 .type = HDA_FIXUP_PINS,
2279 .v.pins = (const struct hda_pintbl[]) {
2280 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2281 { }
2282 }
2283 },
2284 [ALC889_FIXUP_CD] = {
2285 .type = HDA_FIXUP_PINS,
2286 .v.pins = (const struct hda_pintbl[]) {
2287 { 0x1c, 0x993301f0 }, /* CD */
2288 { }
2289 }
2290 },
2291 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2292 .type = HDA_FIXUP_PINS,
2293 .v.pins = (const struct hda_pintbl[]) {
2294 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2295 { }
2296 },
2297 .chained = true,
2298 .chain_id = ALC889_FIXUP_CD,
2299 },
2300 [ALC889_FIXUP_VAIO_TT] = {
2301 .type = HDA_FIXUP_PINS,
2302 .v.pins = (const struct hda_pintbl[]) {
2303 { 0x17, 0x90170111 }, /* hidden surround speaker */
2304 { }
2305 }
2306 },
2307 [ALC888_FIXUP_EEE1601] = {
2308 .type = HDA_FIXUP_VERBS,
2309 .v.verbs = (const struct hda_verb[]) {
2310 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2311 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2312 { }
2313 }
2314 },
2315 [ALC886_FIXUP_EAPD] = {
2316 .type = HDA_FIXUP_VERBS,
2317 .v.verbs = (const struct hda_verb[]) {
2318 /* change to EAPD mode */
2319 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2320 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2321 { }
2322 }
2323 },
2324 [ALC882_FIXUP_EAPD] = {
2325 .type = HDA_FIXUP_VERBS,
2326 .v.verbs = (const struct hda_verb[]) {
2327 /* change to EAPD mode */
2328 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2329 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2330 { }
2331 }
2332 },
2333 [ALC883_FIXUP_EAPD] = {
2334 .type = HDA_FIXUP_VERBS,
2335 .v.verbs = (const struct hda_verb[]) {
2336 /* change to EAPD mode */
2337 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2338 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2339 { }
2340 }
2341 },
2342 [ALC883_FIXUP_ACER_EAPD] = {
2343 .type = HDA_FIXUP_VERBS,
2344 .v.verbs = (const struct hda_verb[]) {
2345 /* eanable EAPD on Acer laptops */
2346 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2347 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2348 { }
2349 }
2350 },
2351 [ALC882_FIXUP_GPIO1] = {
2352 .type = HDA_FIXUP_FUNC,
2353 .v.func = alc_fixup_gpio1,
2354 },
2355 [ALC882_FIXUP_GPIO2] = {
2356 .type = HDA_FIXUP_FUNC,
2357 .v.func = alc_fixup_gpio2,
2358 },
2359 [ALC882_FIXUP_GPIO3] = {
2360 .type = HDA_FIXUP_FUNC,
2361 .v.func = alc_fixup_gpio3,
2362 },
2363 [ALC882_FIXUP_ASUS_W2JC] = {
2364 .type = HDA_FIXUP_FUNC,
2365 .v.func = alc_fixup_gpio1,
2366 .chained = true,
2367 .chain_id = ALC882_FIXUP_EAPD,
2368 },
2369 [ALC889_FIXUP_COEF] = {
2370 .type = HDA_FIXUP_FUNC,
2371 .v.func = alc889_fixup_coef,
2372 },
2373 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2374 .type = HDA_FIXUP_PINS,
2375 .v.pins = (const struct hda_pintbl[]) {
2376 { 0x16, 0x99130111 }, /* CLFE speaker */
2377 { 0x17, 0x99130112 }, /* surround speaker */
2378 { }
2379 },
2380 .chained = true,
2381 .chain_id = ALC882_FIXUP_GPIO1,
2382 },
2383 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2384 .type = HDA_FIXUP_PINS,
2385 .v.pins = (const struct hda_pintbl[]) {
2386 { 0x16, 0x99130111 }, /* CLFE speaker */
2387 { 0x1b, 0x99130112 }, /* surround speaker */
2388 { }
2389 },
2390 .chained = true,
2391 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2392 },
2393 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2394 /* additional init verbs for Acer Aspire 8930G */
2395 .type = HDA_FIXUP_VERBS,
2396 .v.verbs = (const struct hda_verb[]) {
2397 /* Enable all DACs */
2398 /* DAC DISABLE/MUTE 1? */
2399 /* setting bits 1-5 disables DAC nids 0x02-0x06
2400 * apparently. Init=0x38 */
2401 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2402 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2403 /* DAC DISABLE/MUTE 2? */
2404 /* some bit here disables the other DACs.
2405 * Init=0x4900 */
2406 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2407 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2408 /* DMIC fix
2409 * This laptop has a stereo digital microphone.
2410 * The mics are only 1cm apart which makes the stereo
2411 * useless. However, either the mic or the ALC889
2412 * makes the signal become a difference/sum signal
2413 * instead of standard stereo, which is annoying.
2414 * So instead we flip this bit which makes the
2415 * codec replicate the sum signal to both channels,
2416 * turning it into a normal mono mic.
2417 */
2418 /* DMIC_CONTROL? Init value = 0x0001 */
2419 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2420 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2421 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2422 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2423 { }
2424 },
2425 .chained = true,
2426 .chain_id = ALC882_FIXUP_GPIO1,
2427 },
2428 [ALC885_FIXUP_MACPRO_GPIO] = {
2429 .type = HDA_FIXUP_FUNC,
2430 .v.func = alc885_fixup_macpro_gpio,
2431 },
2432 [ALC889_FIXUP_DAC_ROUTE] = {
2433 .type = HDA_FIXUP_FUNC,
2434 .v.func = alc889_fixup_dac_route,
2435 },
2436 [ALC889_FIXUP_MBP_VREF] = {
2437 .type = HDA_FIXUP_FUNC,
2438 .v.func = alc889_fixup_mbp_vref,
2439 .chained = true,
2440 .chain_id = ALC882_FIXUP_GPIO1,
2441 },
2442 [ALC889_FIXUP_IMAC91_VREF] = {
2443 .type = HDA_FIXUP_FUNC,
2444 .v.func = alc889_fixup_imac91_vref,
2445 .chained = true,
2446 .chain_id = ALC882_FIXUP_GPIO1,
2447 },
2448 [ALC889_FIXUP_MBA11_VREF] = {
2449 .type = HDA_FIXUP_FUNC,
2450 .v.func = alc889_fixup_mba11_vref,
2451 .chained = true,
2452 .chain_id = ALC889_FIXUP_MBP_VREF,
2453 },
2454 [ALC889_FIXUP_MBA21_VREF] = {
2455 .type = HDA_FIXUP_FUNC,
2456 .v.func = alc889_fixup_mba21_vref,
2457 .chained = true,
2458 .chain_id = ALC889_FIXUP_MBP_VREF,
2459 },
2460 [ALC889_FIXUP_MP11_VREF] = {
2461 .type = HDA_FIXUP_FUNC,
2462 .v.func = alc889_fixup_mba11_vref,
2463 .chained = true,
2464 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2465 },
2466 [ALC889_FIXUP_MP41_VREF] = {
2467 .type = HDA_FIXUP_FUNC,
2468 .v.func = alc889_fixup_mbp_vref,
2469 .chained = true,
2470 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2471 },
2472 [ALC882_FIXUP_INV_DMIC] = {
2473 .type = HDA_FIXUP_FUNC,
2474 .v.func = alc_fixup_inv_dmic,
2475 },
2476 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2477 .type = HDA_FIXUP_FUNC,
2478 .v.func = alc882_fixup_no_primary_hp,
2479 },
2480 [ALC887_FIXUP_ASUS_BASS] = {
2481 .type = HDA_FIXUP_PINS,
2482 .v.pins = (const struct hda_pintbl[]) {
2483 {0x16, 0x99130130}, /* bass speaker */
2484 {}
2485 },
2486 .chained = true,
2487 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2488 },
2489 [ALC887_FIXUP_BASS_CHMAP] = {
2490 .type = HDA_FIXUP_FUNC,
2491 .v.func = alc_fixup_bass_chmap,
2492 },
2493 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2494 .type = HDA_FIXUP_FUNC,
2495 .v.func = alc1220_fixup_gb_dual_codecs,
2496 },
2497 [ALC1220_FIXUP_GB_X570] = {
2498 .type = HDA_FIXUP_FUNC,
2499 .v.func = alc1220_fixup_gb_x570,
2500 },
2501 [ALC1220_FIXUP_CLEVO_P950] = {
2502 .type = HDA_FIXUP_FUNC,
2503 .v.func = alc1220_fixup_clevo_p950,
2504 },
2505 [ALC1220_FIXUP_CLEVO_PB51ED] = {
2506 .type = HDA_FIXUP_FUNC,
2507 .v.func = alc1220_fixup_clevo_pb51ed,
2508 },
2509 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2510 .type = HDA_FIXUP_PINS,
2511 .v.pins = (const struct hda_pintbl[]) {
2512 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2513 {}
2514 },
2515 .chained = true,
2516 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2517 },
2518 [ALC887_FIXUP_ASUS_AUDIO] = {
2519 .type = HDA_FIXUP_PINS,
2520 .v.pins = (const struct hda_pintbl[]) {
2521 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2522 { 0x19, 0x22219420 },
2523 {}
2524 },
2525 },
2526 [ALC887_FIXUP_ASUS_HMIC] = {
2527 .type = HDA_FIXUP_FUNC,
2528 .v.func = alc887_fixup_asus_jack,
2529 .chained = true,
2530 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2531 },
2532 [ALCS1200A_FIXUP_MIC_VREF] = {
2533 .type = HDA_FIXUP_PINCTLS,
2534 .v.pins = (const struct hda_pintbl[]) {
2535 { 0x18, PIN_VREF50 }, /* rear mic */
2536 { 0x19, PIN_VREF50 }, /* front mic */
2537 {}
2538 }
2539 },
2540 };
2541
2542 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2543 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2544 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2545 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2546 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2547 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2548 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2549 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2550 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2551 ALC882_FIXUP_ACER_ASPIRE_4930G),
2552 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2553 ALC882_FIXUP_ACER_ASPIRE_4930G),
2554 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2555 ALC882_FIXUP_ACER_ASPIRE_8930G),
2556 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2557 ALC882_FIXUP_ACER_ASPIRE_8930G),
2558 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2559 ALC882_FIXUP_ACER_ASPIRE_4930G),
2560 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2561 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2562 ALC882_FIXUP_ACER_ASPIRE_4930G),
2563 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2564 ALC882_FIXUP_ACER_ASPIRE_4930G),
2565 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2566 ALC882_FIXUP_ACER_ASPIRE_4930G),
2567 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2568 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2569 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2570 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2571 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2572 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2573 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2574 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2575 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2576 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2577 SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2578 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2579 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2580 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2581 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2582 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2583
2584 /* All Apple entries are in codec SSIDs */
2585 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2586 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2587 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2588 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2589 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2590 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2591 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2592 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2593 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2594 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2595 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2596 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2597 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2598 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2599 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2600 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2601 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2602 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2603 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2604 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2605 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2606 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2607
2608 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2609 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2610 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2611 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2612 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2613 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2614 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2615 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2616 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2617 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2618 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2619 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2620 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2621 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2622 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2623 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2624 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2625 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2626 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2627 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2628 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2629 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2630 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2631 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2632 SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2633 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2634 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2635 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2636 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2637 SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2638 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2639 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2640 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2641 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2642 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2643 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2644 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2645 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2646 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2647 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2648 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2649 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2650 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2651 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2652 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2653 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2654 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2655 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2656 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2657 {}
2658 };
2659
2660 static const struct hda_model_fixup alc882_fixup_models[] = {
2661 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2662 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2663 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2664 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2665 {.id = ALC889_FIXUP_CD, .name = "cd"},
2666 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2667 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2668 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2669 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2670 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2671 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2672 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2673 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2674 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2675 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2676 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2677 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2678 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2679 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2680 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2681 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2682 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2683 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2684 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2685 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2686 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2687 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2688 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2689 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2690 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2691 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2692 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2693 {}
2694 };
2695
2696 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2697 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2698 {0x14, 0x01014010},
2699 {0x15, 0x01011012},
2700 {0x16, 0x01016011},
2701 {0x18, 0x01a19040},
2702 {0x19, 0x02a19050},
2703 {0x1a, 0x0181304f},
2704 {0x1b, 0x0221401f},
2705 {0x1e, 0x01456130}),
2706 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2707 {0x14, 0x01015010},
2708 {0x15, 0x01011012},
2709 {0x16, 0x01011011},
2710 {0x18, 0x01a11040},
2711 {0x19, 0x02a19050},
2712 {0x1a, 0x0181104f},
2713 {0x1b, 0x0221401f},
2714 {0x1e, 0x01451130}),
2715 {}
2716 };
2717
2718 /*
2719 * BIOS auto configuration
2720 */
2721 /* almost identical with ALC880 parser... */
2722 static int alc882_parse_auto_config(struct hda_codec *codec)
2723 {
2724 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2725 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2726 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2727 }
2728
2729 /*
2730 */
2731 static int patch_alc882(struct hda_codec *codec)
2732 {
2733 struct alc_spec *spec;
2734 int err;
2735
2736 err = alc_alloc_spec(codec, 0x0b);
2737 if (err < 0)
2738 return err;
2739
2740 spec = codec->spec;
2741
2742 switch (codec->core.vendor_id) {
2743 case 0x10ec0882:
2744 case 0x10ec0885:
2745 case 0x10ec0900:
2746 case 0x10ec0b00:
2747 case 0x10ec1220:
2748 break;
2749 default:
2750 /* ALC883 and variants */
2751 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2752 break;
2753 }
2754
2755 alc_pre_init(codec);
2756
2757 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2758 alc882_fixups);
2759 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2760 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2761
2762 alc_auto_parse_customize_define(codec);
2763
2764 if (has_cdefine_beep(codec))
2765 spec->gen.beep_nid = 0x01;
2766
2767 /* automatic parse from the BIOS config */
2768 err = alc882_parse_auto_config(codec);
2769 if (err < 0)
2770 goto error;
2771
2772 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2773 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2774 if (err < 0)
2775 goto error;
2776 }
2777
2778 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2779
2780 return 0;
2781
2782 error:
2783 alc_free(codec);
2784 return err;
2785 }
2786
2787
2788 /*
2789 * ALC262 support
2790 */
2791 static int alc262_parse_auto_config(struct hda_codec *codec)
2792 {
2793 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2794 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2795 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2796 }
2797
2798 /*
2799 * Pin config fixes
2800 */
2801 enum {
2802 ALC262_FIXUP_FSC_H270,
2803 ALC262_FIXUP_FSC_S7110,
2804 ALC262_FIXUP_HP_Z200,
2805 ALC262_FIXUP_TYAN,
2806 ALC262_FIXUP_LENOVO_3000,
2807 ALC262_FIXUP_BENQ,
2808 ALC262_FIXUP_BENQ_T31,
2809 ALC262_FIXUP_INV_DMIC,
2810 ALC262_FIXUP_INTEL_BAYLEYBAY,
2811 };
2812
2813 static const struct hda_fixup alc262_fixups[] = {
2814 [ALC262_FIXUP_FSC_H270] = {
2815 .type = HDA_FIXUP_PINS,
2816 .v.pins = (const struct hda_pintbl[]) {
2817 { 0x14, 0x99130110 }, /* speaker */
2818 { 0x15, 0x0221142f }, /* front HP */
2819 { 0x1b, 0x0121141f }, /* rear HP */
2820 { }
2821 }
2822 },
2823 [ALC262_FIXUP_FSC_S7110] = {
2824 .type = HDA_FIXUP_PINS,
2825 .v.pins = (const struct hda_pintbl[]) {
2826 { 0x15, 0x90170110 }, /* speaker */
2827 { }
2828 },
2829 .chained = true,
2830 .chain_id = ALC262_FIXUP_BENQ,
2831 },
2832 [ALC262_FIXUP_HP_Z200] = {
2833 .type = HDA_FIXUP_PINS,
2834 .v.pins = (const struct hda_pintbl[]) {
2835 { 0x16, 0x99130120 }, /* internal speaker */
2836 { }
2837 }
2838 },
2839 [ALC262_FIXUP_TYAN] = {
2840 .type = HDA_FIXUP_PINS,
2841 .v.pins = (const struct hda_pintbl[]) {
2842 { 0x14, 0x1993e1f0 }, /* int AUX */
2843 { }
2844 }
2845 },
2846 [ALC262_FIXUP_LENOVO_3000] = {
2847 .type = HDA_FIXUP_PINCTLS,
2848 .v.pins = (const struct hda_pintbl[]) {
2849 { 0x19, PIN_VREF50 },
2850 {}
2851 },
2852 .chained = true,
2853 .chain_id = ALC262_FIXUP_BENQ,
2854 },
2855 [ALC262_FIXUP_BENQ] = {
2856 .type = HDA_FIXUP_VERBS,
2857 .v.verbs = (const struct hda_verb[]) {
2858 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2859 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2860 {}
2861 }
2862 },
2863 [ALC262_FIXUP_BENQ_T31] = {
2864 .type = HDA_FIXUP_VERBS,
2865 .v.verbs = (const struct hda_verb[]) {
2866 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2867 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2868 {}
2869 }
2870 },
2871 [ALC262_FIXUP_INV_DMIC] = {
2872 .type = HDA_FIXUP_FUNC,
2873 .v.func = alc_fixup_inv_dmic,
2874 },
2875 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2876 .type = HDA_FIXUP_FUNC,
2877 .v.func = alc_fixup_no_depop_delay,
2878 },
2879 };
2880
2881 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2882 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2883 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2884 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2885 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2886 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2887 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2888 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2889 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2890 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2891 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2892 {}
2893 };
2894
2895 static const struct hda_model_fixup alc262_fixup_models[] = {
2896 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2897 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2898 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2899 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2900 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2901 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2902 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2903 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2904 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2905 {}
2906 };
2907
2908 /*
2909 */
2910 static int patch_alc262(struct hda_codec *codec)
2911 {
2912 struct alc_spec *spec;
2913 int err;
2914
2915 err = alc_alloc_spec(codec, 0x0b);
2916 if (err < 0)
2917 return err;
2918
2919 spec = codec->spec;
2920 spec->gen.shared_mic_vref_pin = 0x18;
2921
2922 spec->shutup = alc_eapd_shutup;
2923
2924 #if 0
2925 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2926 * under-run
2927 */
2928 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2929 #endif
2930 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2931
2932 alc_pre_init(codec);
2933
2934 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2935 alc262_fixups);
2936 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2937
2938 alc_auto_parse_customize_define(codec);
2939
2940 if (has_cdefine_beep(codec))
2941 spec->gen.beep_nid = 0x01;
2942
2943 /* automatic parse from the BIOS config */
2944 err = alc262_parse_auto_config(codec);
2945 if (err < 0)
2946 goto error;
2947
2948 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2949 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2950 if (err < 0)
2951 goto error;
2952 }
2953
2954 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2955
2956 return 0;
2957
2958 error:
2959 alc_free(codec);
2960 return err;
2961 }
2962
2963 /*
2964 * ALC268
2965 */
2966 /* bind Beep switches of both NID 0x0f and 0x10 */
2967 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2968 struct snd_ctl_elem_value *ucontrol)
2969 {
2970 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2971 unsigned long pval;
2972 int err;
2973
2974 mutex_lock(&codec->control_mutex);
2975 pval = kcontrol->private_value;
2976 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2977 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2978 if (err >= 0) {
2979 kcontrol->private_value = (pval & ~0xff) | 0x10;
2980 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2981 }
2982 kcontrol->private_value = pval;
2983 mutex_unlock(&codec->control_mutex);
2984 return err;
2985 }
2986
2987 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2988 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2989 {
2990 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2991 .name = "Beep Playback Switch",
2992 .subdevice = HDA_SUBDEV_AMP_FLAG,
2993 .info = snd_hda_mixer_amp_switch_info,
2994 .get = snd_hda_mixer_amp_switch_get,
2995 .put = alc268_beep_switch_put,
2996 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2997 },
2998 };
2999
3000 /* set PCBEEP vol = 0, mute connections */
3001 static const struct hda_verb alc268_beep_init_verbs[] = {
3002 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3003 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3004 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3005 { }
3006 };
3007
3008 enum {
3009 ALC268_FIXUP_INV_DMIC,
3010 ALC268_FIXUP_HP_EAPD,
3011 ALC268_FIXUP_SPDIF,
3012 };
3013
3014 static const struct hda_fixup alc268_fixups[] = {
3015 [ALC268_FIXUP_INV_DMIC] = {
3016 .type = HDA_FIXUP_FUNC,
3017 .v.func = alc_fixup_inv_dmic,
3018 },
3019 [ALC268_FIXUP_HP_EAPD] = {
3020 .type = HDA_FIXUP_VERBS,
3021 .v.verbs = (const struct hda_verb[]) {
3022 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3023 {}
3024 }
3025 },
3026 [ALC268_FIXUP_SPDIF] = {
3027 .type = HDA_FIXUP_PINS,
3028 .v.pins = (const struct hda_pintbl[]) {
3029 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
3030 {}
3031 }
3032 },
3033 };
3034
3035 static const struct hda_model_fixup alc268_fixup_models[] = {
3036 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3037 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3038 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3039 {}
3040 };
3041
3042 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
3043 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3044 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3045 /* below is codec SSID since multiple Toshiba laptops have the
3046 * same PCI SSID 1179:ff00
3047 */
3048 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3049 {}
3050 };
3051
3052 /*
3053 * BIOS auto configuration
3054 */
3055 static int alc268_parse_auto_config(struct hda_codec *codec)
3056 {
3057 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3058 return alc_parse_auto_config(codec, NULL, alc268_ssids);
3059 }
3060
3061 /*
3062 */
3063 static int patch_alc268(struct hda_codec *codec)
3064 {
3065 struct alc_spec *spec;
3066 int i, err;
3067
3068 /* ALC268 has no aa-loopback mixer */
3069 err = alc_alloc_spec(codec, 0);
3070 if (err < 0)
3071 return err;
3072
3073 spec = codec->spec;
3074 if (has_cdefine_beep(codec))
3075 spec->gen.beep_nid = 0x01;
3076
3077 spec->shutup = alc_eapd_shutup;
3078
3079 alc_pre_init(codec);
3080
3081 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3082 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3083
3084 /* automatic parse from the BIOS config */
3085 err = alc268_parse_auto_config(codec);
3086 if (err < 0)
3087 goto error;
3088
3089 if (err > 0 && !spec->gen.no_analog &&
3090 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3091 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3092 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3093 &alc268_beep_mixer[i])) {
3094 err = -ENOMEM;
3095 goto error;
3096 }
3097 }
3098 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3099 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3100 /* override the amp caps for beep generator */
3101 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3102 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3103 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3104 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3105 (0 << AC_AMPCAP_MUTE_SHIFT));
3106 }
3107
3108 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3109
3110 return 0;
3111
3112 error:
3113 alc_free(codec);
3114 return err;
3115 }
3116
3117 /*
3118 * ALC269
3119 */
3120
3121 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3122 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3123 };
3124
3125 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3126 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3127 };
3128
3129 /* different alc269-variants */
3130 enum {
3131 ALC269_TYPE_ALC269VA,
3132 ALC269_TYPE_ALC269VB,
3133 ALC269_TYPE_ALC269VC,
3134 ALC269_TYPE_ALC269VD,
3135 ALC269_TYPE_ALC280,
3136 ALC269_TYPE_ALC282,
3137 ALC269_TYPE_ALC283,
3138 ALC269_TYPE_ALC284,
3139 ALC269_TYPE_ALC293,
3140 ALC269_TYPE_ALC286,
3141 ALC269_TYPE_ALC298,
3142 ALC269_TYPE_ALC255,
3143 ALC269_TYPE_ALC256,
3144 ALC269_TYPE_ALC257,
3145 ALC269_TYPE_ALC215,
3146 ALC269_TYPE_ALC225,
3147 ALC269_TYPE_ALC245,
3148 ALC269_TYPE_ALC287,
3149 ALC269_TYPE_ALC294,
3150 ALC269_TYPE_ALC300,
3151 ALC269_TYPE_ALC623,
3152 ALC269_TYPE_ALC700,
3153 };
3154
3155 /*
3156 * BIOS auto configuration
3157 */
3158 static int alc269_parse_auto_config(struct hda_codec *codec)
3159 {
3160 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3161 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3162 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3163 struct alc_spec *spec = codec->spec;
3164 const hda_nid_t *ssids;
3165
3166 switch (spec->codec_variant) {
3167 case ALC269_TYPE_ALC269VA:
3168 case ALC269_TYPE_ALC269VC:
3169 case ALC269_TYPE_ALC280:
3170 case ALC269_TYPE_ALC284:
3171 case ALC269_TYPE_ALC293:
3172 ssids = alc269va_ssids;
3173 break;
3174 case ALC269_TYPE_ALC269VB:
3175 case ALC269_TYPE_ALC269VD:
3176 case ALC269_TYPE_ALC282:
3177 case ALC269_TYPE_ALC283:
3178 case ALC269_TYPE_ALC286:
3179 case ALC269_TYPE_ALC298:
3180 case ALC269_TYPE_ALC255:
3181 case ALC269_TYPE_ALC256:
3182 case ALC269_TYPE_ALC257:
3183 case ALC269_TYPE_ALC215:
3184 case ALC269_TYPE_ALC225:
3185 case ALC269_TYPE_ALC245:
3186 case ALC269_TYPE_ALC287:
3187 case ALC269_TYPE_ALC294:
3188 case ALC269_TYPE_ALC300:
3189 case ALC269_TYPE_ALC623:
3190 case ALC269_TYPE_ALC700:
3191 ssids = alc269_ssids;
3192 break;
3193 default:
3194 ssids = alc269_ssids;
3195 break;
3196 }
3197
3198 return alc_parse_auto_config(codec, alc269_ignore, ssids);
3199 }
3200
3201 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3202 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3203 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3204 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3205 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3206 {}
3207 };
3208
3209 static void alc_headset_btn_callback(struct hda_codec *codec,
3210 struct hda_jack_callback *jack)
3211 {
3212 int report = 0;
3213
3214 if (jack->unsol_res & (7 << 13))
3215 report |= SND_JACK_BTN_0;
3216
3217 if (jack->unsol_res & (1 << 16 | 3 << 8))
3218 report |= SND_JACK_BTN_1;
3219
3220 /* Volume up key */
3221 if (jack->unsol_res & (7 << 23))
3222 report |= SND_JACK_BTN_2;
3223
3224 /* Volume down key */
3225 if (jack->unsol_res & (7 << 10))
3226 report |= SND_JACK_BTN_3;
3227
3228 snd_hda_jack_set_button_state(codec, jack->nid, report);
3229 }
3230
3231 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3232 {
3233 struct alc_spec *spec = codec->spec;
3234
3235 if (!spec->has_hs_key)
3236 return;
3237
3238 switch (codec->core.vendor_id) {
3239 case 0x10ec0215:
3240 case 0x10ec0225:
3241 case 0x10ec0285:
3242 case 0x10ec0287:
3243 case 0x10ec0295:
3244 case 0x10ec0289:
3245 case 0x10ec0299:
3246 alc_write_coef_idx(codec, 0x48, 0x0);
3247 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3248 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3249 break;
3250 case 0x10ec0230:
3251 case 0x10ec0236:
3252 case 0x10ec0256:
3253 case 0x19e58326:
3254 alc_write_coef_idx(codec, 0x48, 0x0);
3255 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3256 break;
3257 }
3258 }
3259
3260 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3261 {
3262 struct alc_spec *spec = codec->spec;
3263
3264 if (!spec->has_hs_key)
3265 return;
3266
3267 switch (codec->core.vendor_id) {
3268 case 0x10ec0215:
3269 case 0x10ec0225:
3270 case 0x10ec0285:
3271 case 0x10ec0287:
3272 case 0x10ec0295:
3273 case 0x10ec0289:
3274 case 0x10ec0299:
3275 alc_write_coef_idx(codec, 0x48, 0xd011);
3276 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3277 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3278 break;
3279 case 0x10ec0230:
3280 case 0x10ec0236:
3281 case 0x10ec0256:
3282 case 0x19e58326:
3283 alc_write_coef_idx(codec, 0x48, 0xd011);
3284 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3285 break;
3286 }
3287 }
3288
3289 static void alc_fixup_headset_jack(struct hda_codec *codec,
3290 const struct hda_fixup *fix, int action)
3291 {
3292 struct alc_spec *spec = codec->spec;
3293 hda_nid_t hp_pin;
3294
3295 switch (action) {
3296 case HDA_FIXUP_ACT_PRE_PROBE:
3297 spec->has_hs_key = 1;
3298 snd_hda_jack_detect_enable_callback(codec, 0x55,
3299 alc_headset_btn_callback);
3300 break;
3301 case HDA_FIXUP_ACT_BUILD:
3302 hp_pin = alc_get_hp_pin(spec);
3303 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3304 alc_headset_btn_keymap,
3305 hp_pin))
3306 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3307 false, SND_JACK_HEADSET,
3308 alc_headset_btn_keymap);
3309
3310 alc_enable_headset_jack_key(codec);
3311 break;
3312 }
3313 }
3314
3315 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3316 {
3317 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3318 }
3319
3320 static void alc269_shutup(struct hda_codec *codec)
3321 {
3322 struct alc_spec *spec = codec->spec;
3323
3324 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3325 alc269vb_toggle_power_output(codec, 0);
3326 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3327 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3328 msleep(150);
3329 }
3330 alc_shutup_pins(codec);
3331 }
3332
3333 static const struct coef_fw alc282_coefs[] = {
3334 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3335 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3336 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3337 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3338 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3339 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3340 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3341 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3342 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3343 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3344 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3345 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3346 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3347 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3348 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3349 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3350 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3351 WRITE_COEF(0x63, 0x2902), /* PLL */
3352 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3353 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3354 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3355 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3356 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3357 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3358 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3359 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3360 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3361 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3362 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3363 {}
3364 };
3365
3366 static void alc282_restore_default_value(struct hda_codec *codec)
3367 {
3368 alc_process_coef_fw(codec, alc282_coefs);
3369 }
3370
3371 static void alc282_init(struct hda_codec *codec)
3372 {
3373 struct alc_spec *spec = codec->spec;
3374 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3375 bool hp_pin_sense;
3376 int coef78;
3377
3378 alc282_restore_default_value(codec);
3379
3380 if (!hp_pin)
3381 return;
3382 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3383 coef78 = alc_read_coef_idx(codec, 0x78);
3384
3385 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3386 /* Headphone capless set to high power mode */
3387 alc_write_coef_idx(codec, 0x78, 0x9004);
3388
3389 if (hp_pin_sense)
3390 msleep(2);
3391
3392 snd_hda_codec_write(codec, hp_pin, 0,
3393 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3394
3395 if (hp_pin_sense)
3396 msleep(85);
3397
3398 snd_hda_codec_write(codec, hp_pin, 0,
3399 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3400
3401 if (hp_pin_sense)
3402 msleep(100);
3403
3404 /* Headphone capless set to normal mode */
3405 alc_write_coef_idx(codec, 0x78, coef78);
3406 }
3407
3408 static void alc282_shutup(struct hda_codec *codec)
3409 {
3410 struct alc_spec *spec = codec->spec;
3411 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3412 bool hp_pin_sense;
3413 int coef78;
3414
3415 if (!hp_pin) {
3416 alc269_shutup(codec);
3417 return;
3418 }
3419
3420 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3421 coef78 = alc_read_coef_idx(codec, 0x78);
3422 alc_write_coef_idx(codec, 0x78, 0x9004);
3423
3424 if (hp_pin_sense)
3425 msleep(2);
3426
3427 snd_hda_codec_write(codec, hp_pin, 0,
3428 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3429
3430 if (hp_pin_sense)
3431 msleep(85);
3432
3433 if (!spec->no_shutup_pins)
3434 snd_hda_codec_write(codec, hp_pin, 0,
3435 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3436
3437 if (hp_pin_sense)
3438 msleep(100);
3439
3440 alc_auto_setup_eapd(codec, false);
3441 alc_shutup_pins(codec);
3442 alc_write_coef_idx(codec, 0x78, coef78);
3443 }
3444
3445 static const struct coef_fw alc283_coefs[] = {
3446 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3447 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3448 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3449 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3450 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3451 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3452 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3453 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3454 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3455 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3456 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3457 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3458 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3459 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3460 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3461 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3462 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3463 WRITE_COEF(0x2e, 0x2902), /* PLL */
3464 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3465 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3466 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3467 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3468 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3469 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3470 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3471 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3472 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3473 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3474 WRITE_COEF(0x49, 0x0), /* test mode */
3475 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3476 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3477 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3478 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3479 {}
3480 };
3481
3482 static void alc283_restore_default_value(struct hda_codec *codec)
3483 {
3484 alc_process_coef_fw(codec, alc283_coefs);
3485 }
3486
3487 static void alc283_init(struct hda_codec *codec)
3488 {
3489 struct alc_spec *spec = codec->spec;
3490 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3491 bool hp_pin_sense;
3492
3493 alc283_restore_default_value(codec);
3494
3495 if (!hp_pin)
3496 return;
3497
3498 msleep(30);
3499 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3500
3501 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3502 /* Headphone capless set to high power mode */
3503 alc_write_coef_idx(codec, 0x43, 0x9004);
3504
3505 snd_hda_codec_write(codec, hp_pin, 0,
3506 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3507
3508 if (hp_pin_sense)
3509 msleep(85);
3510
3511 snd_hda_codec_write(codec, hp_pin, 0,
3512 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3513
3514 if (hp_pin_sense)
3515 msleep(85);
3516 /* Index 0x46 Combo jack auto switch control 2 */
3517 /* 3k pull low control for Headset jack. */
3518 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3519 /* Headphone capless set to normal mode */
3520 alc_write_coef_idx(codec, 0x43, 0x9614);
3521 }
3522
3523 static void alc283_shutup(struct hda_codec *codec)
3524 {
3525 struct alc_spec *spec = codec->spec;
3526 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3527 bool hp_pin_sense;
3528
3529 if (!hp_pin) {
3530 alc269_shutup(codec);
3531 return;
3532 }
3533
3534 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3535
3536 alc_write_coef_idx(codec, 0x43, 0x9004);
3537
3538 /*depop hp during suspend*/
3539 alc_write_coef_idx(codec, 0x06, 0x2100);
3540
3541 snd_hda_codec_write(codec, hp_pin, 0,
3542 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3543
3544 if (hp_pin_sense)
3545 msleep(100);
3546
3547 if (!spec->no_shutup_pins)
3548 snd_hda_codec_write(codec, hp_pin, 0,
3549 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3550
3551 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3552
3553 if (hp_pin_sense)
3554 msleep(100);
3555 alc_auto_setup_eapd(codec, false);
3556 alc_shutup_pins(codec);
3557 alc_write_coef_idx(codec, 0x43, 0x9614);
3558 }
3559
3560 static void alc256_init(struct hda_codec *codec)
3561 {
3562 struct alc_spec *spec = codec->spec;
3563 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3564 bool hp_pin_sense;
3565
3566 if (!hp_pin)
3567 hp_pin = 0x21;
3568
3569 msleep(30);
3570
3571 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3572
3573 if (hp_pin_sense)
3574 msleep(2);
3575
3576 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
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 snd_hda_codec_write(codec, hp_pin, 0,
3587 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3588
3589 if (hp_pin_sense || spec->ultra_low_power)
3590 msleep(85);
3591
3592 snd_hda_codec_write(codec, hp_pin, 0,
3593 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3594
3595 if (hp_pin_sense || spec->ultra_low_power)
3596 msleep(100);
3597
3598 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3599 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3600 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3601 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3602 /*
3603 * Expose headphone mic (or possibly Line In on some machines) instead
3604 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3605 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3606 * this register.
3607 */
3608 alc_write_coef_idx(codec, 0x36, 0x5757);
3609 }
3610
3611 static void alc256_shutup(struct hda_codec *codec)
3612 {
3613 struct alc_spec *spec = codec->spec;
3614 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3615 bool hp_pin_sense;
3616
3617 if (!hp_pin)
3618 hp_pin = 0x21;
3619
3620 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3621
3622 if (hp_pin_sense)
3623 msleep(2);
3624
3625 snd_hda_codec_write(codec, hp_pin, 0,
3626 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3627
3628 if (hp_pin_sense || spec->ultra_low_power)
3629 msleep(85);
3630
3631 /* 3k pull low control for Headset jack. */
3632 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3633 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3634 * when booting with headset plugged. So skip setting it for the codec alc257
3635 */
3636 if (codec->core.vendor_id != 0x10ec0236 &&
3637 codec->core.vendor_id != 0x10ec0257)
3638 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3639
3640 if (!spec->no_shutup_pins)
3641 snd_hda_codec_write(codec, hp_pin, 0,
3642 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3643
3644 if (hp_pin_sense || spec->ultra_low_power)
3645 msleep(100);
3646
3647 alc_auto_setup_eapd(codec, false);
3648 alc_shutup_pins(codec);
3649 if (spec->ultra_low_power) {
3650 msleep(50);
3651 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3652 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3653 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3654 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3655 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3656 msleep(30);
3657 }
3658 }
3659
3660 static void alc285_hp_init(struct hda_codec *codec)
3661 {
3662 struct alc_spec *spec = codec->spec;
3663 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3664 int i, val;
3665 int coef38, coef0d, coef36;
3666
3667 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3668 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3669 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3670 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3671 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3672 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3673
3674 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3675
3676 if (hp_pin)
3677 snd_hda_codec_write(codec, hp_pin, 0,
3678 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3679
3680 msleep(130);
3681 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3682 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3683
3684 if (hp_pin)
3685 snd_hda_codec_write(codec, hp_pin, 0,
3686 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3687 msleep(10);
3688 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3689 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3690 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3691 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3692
3693 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3694 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3695 for (i = 0; i < 20 && val & 0x8000; i++) {
3696 msleep(50);
3697 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3698 } /* Wait for depop procedure finish */
3699
3700 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3701 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3702 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3703 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3704
3705 msleep(50);
3706 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3707 }
3708
3709 static void alc225_init(struct hda_codec *codec)
3710 {
3711 struct alc_spec *spec = codec->spec;
3712 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3713 bool hp1_pin_sense, hp2_pin_sense;
3714
3715 if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3716 spec->codec_variant != ALC269_TYPE_ALC245)
3717 /* required only at boot or S3 and S4 resume time */
3718 if (!spec->done_hp_init ||
3719 is_s3_resume(codec) ||
3720 is_s4_resume(codec)) {
3721 alc285_hp_init(codec);
3722 spec->done_hp_init = true;
3723 }
3724
3725 if (!hp_pin)
3726 hp_pin = 0x21;
3727 msleep(30);
3728
3729 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3730 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3731
3732 if (hp1_pin_sense || hp2_pin_sense)
3733 msleep(2);
3734
3735 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3736 if (spec->ultra_low_power) {
3737 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3738 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3739 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3740 msleep(30);
3741 }
3742
3743 if (hp1_pin_sense || spec->ultra_low_power)
3744 snd_hda_codec_write(codec, hp_pin, 0,
3745 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3746 if (hp2_pin_sense)
3747 snd_hda_codec_write(codec, 0x16, 0,
3748 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3749
3750 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3751 msleep(85);
3752
3753 if (hp1_pin_sense || spec->ultra_low_power)
3754 snd_hda_codec_write(codec, hp_pin, 0,
3755 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3756 if (hp2_pin_sense)
3757 snd_hda_codec_write(codec, 0x16, 0,
3758 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3759
3760 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3761 msleep(100);
3762
3763 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3764 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3765 }
3766
3767 static void alc225_shutup(struct hda_codec *codec)
3768 {
3769 struct alc_spec *spec = codec->spec;
3770 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3771 bool hp1_pin_sense, hp2_pin_sense;
3772
3773 if (!hp_pin)
3774 hp_pin = 0x21;
3775
3776 alc_disable_headset_jack_key(codec);
3777 /* 3k pull low control for Headset jack. */
3778 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3779
3780 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3781 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3782
3783 if (hp1_pin_sense || hp2_pin_sense)
3784 msleep(2);
3785
3786 if (hp1_pin_sense || spec->ultra_low_power)
3787 snd_hda_codec_write(codec, hp_pin, 0,
3788 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3789 if (hp2_pin_sense)
3790 snd_hda_codec_write(codec, 0x16, 0,
3791 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3792
3793 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3794 msleep(85);
3795
3796 if (hp1_pin_sense || spec->ultra_low_power)
3797 snd_hda_codec_write(codec, hp_pin, 0,
3798 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3799 if (hp2_pin_sense)
3800 snd_hda_codec_write(codec, 0x16, 0,
3801 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3802
3803 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3804 msleep(100);
3805
3806 alc_auto_setup_eapd(codec, false);
3807 alc_shutup_pins(codec);
3808 if (spec->ultra_low_power) {
3809 msleep(50);
3810 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3811 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3812 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3813 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3814 msleep(30);
3815 }
3816
3817 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3818 alc_enable_headset_jack_key(codec);
3819 }
3820
3821 static void alc_default_init(struct hda_codec *codec)
3822 {
3823 struct alc_spec *spec = codec->spec;
3824 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3825 bool hp_pin_sense;
3826
3827 if (!hp_pin)
3828 return;
3829
3830 msleep(30);
3831
3832 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3833
3834 if (hp_pin_sense)
3835 msleep(2);
3836
3837 snd_hda_codec_write(codec, hp_pin, 0,
3838 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3839
3840 if (hp_pin_sense)
3841 msleep(85);
3842
3843 snd_hda_codec_write(codec, hp_pin, 0,
3844 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3845
3846 if (hp_pin_sense)
3847 msleep(100);
3848 }
3849
3850 static void alc_default_shutup(struct hda_codec *codec)
3851 {
3852 struct alc_spec *spec = codec->spec;
3853 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3854 bool hp_pin_sense;
3855
3856 if (!hp_pin) {
3857 alc269_shutup(codec);
3858 return;
3859 }
3860
3861 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3862
3863 if (hp_pin_sense)
3864 msleep(2);
3865
3866 snd_hda_codec_write(codec, hp_pin, 0,
3867 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3868
3869 if (hp_pin_sense)
3870 msleep(85);
3871
3872 if (!spec->no_shutup_pins)
3873 snd_hda_codec_write(codec, hp_pin, 0,
3874 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3875
3876 if (hp_pin_sense)
3877 msleep(100);
3878
3879 alc_auto_setup_eapd(codec, false);
3880 alc_shutup_pins(codec);
3881 }
3882
3883 static void alc294_hp_init(struct hda_codec *codec)
3884 {
3885 struct alc_spec *spec = codec->spec;
3886 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3887 int i, val;
3888
3889 if (!hp_pin)
3890 return;
3891
3892 snd_hda_codec_write(codec, hp_pin, 0,
3893 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3894
3895 msleep(100);
3896
3897 if (!spec->no_shutup_pins)
3898 snd_hda_codec_write(codec, hp_pin, 0,
3899 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3900
3901 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3902 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3903
3904 /* Wait for depop procedure finish */
3905 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3906 for (i = 0; i < 20 && val & 0x0080; i++) {
3907 msleep(50);
3908 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3909 }
3910 /* Set HP depop to auto mode */
3911 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3912 msleep(50);
3913 }
3914
3915 static void alc294_init(struct hda_codec *codec)
3916 {
3917 struct alc_spec *spec = codec->spec;
3918
3919 /* required only at boot or S4 resume time */
3920 if (!spec->done_hp_init ||
3921 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3922 alc294_hp_init(codec);
3923 spec->done_hp_init = true;
3924 }
3925 alc_default_init(codec);
3926 }
3927
3928 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3929 unsigned int val)
3930 {
3931 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3932 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3933 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3934 }
3935
3936 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3937 {
3938 unsigned int val;
3939
3940 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3941 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3942 & 0xffff;
3943 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3944 << 16;
3945 return val;
3946 }
3947
3948 static void alc5505_dsp_halt(struct hda_codec *codec)
3949 {
3950 unsigned int val;
3951
3952 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3953 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3954 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3955 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3956 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3957 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3958 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3959 val = alc5505_coef_get(codec, 0x6220);
3960 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3961 }
3962
3963 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3964 {
3965 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3966 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3967 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3968 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3969 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3970 alc5505_coef_set(codec, 0x880c, 0x00000004);
3971 }
3972
3973 static void alc5505_dsp_init(struct hda_codec *codec)
3974 {
3975 unsigned int val;
3976
3977 alc5505_dsp_halt(codec);
3978 alc5505_dsp_back_from_halt(codec);
3979 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3980 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3981 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3982 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3983 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3984 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3985 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3986 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3987 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3988 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3989 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3990 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3991 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3992
3993 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3994 if (val <= 3)
3995 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3996 else
3997 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3998
3999 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4000 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4001 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4002 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4003 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4004 alc5505_coef_set(codec, 0x880c, 0x00000003);
4005 alc5505_coef_set(codec, 0x880c, 0x00000010);
4006
4007 #ifdef HALT_REALTEK_ALC5505
4008 alc5505_dsp_halt(codec);
4009 #endif
4010 }
4011
4012 #ifdef HALT_REALTEK_ALC5505
4013 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
4014 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
4015 #else
4016 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
4017 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
4018 #endif
4019
4020 #ifdef CONFIG_PM
4021 static int alc269_suspend(struct hda_codec *codec)
4022 {
4023 struct alc_spec *spec = codec->spec;
4024 int i;
4025
4026 if (spec->has_alc5505_dsp)
4027 alc5505_dsp_suspend(codec);
4028
4029 for (i = 0; i < HDA_MAX_COMPONENTS; i++)
4030 if (spec->comps[i].suspend_hook)
4031 spec->comps[i].suspend_hook(spec->comps[i].dev);
4032
4033 return alc_suspend(codec);
4034 }
4035
4036 static int alc269_resume(struct hda_codec *codec)
4037 {
4038 struct alc_spec *spec = codec->spec;
4039 int i;
4040
4041 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4042 alc269vb_toggle_power_output(codec, 0);
4043 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4044 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
4045 msleep(150);
4046 }
4047
4048 codec->patch_ops.init(codec);
4049
4050 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4051 alc269vb_toggle_power_output(codec, 1);
4052 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4053 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
4054 msleep(200);
4055 }
4056
4057 snd_hda_regmap_sync(codec);
4058 hda_call_check_power_status(codec, 0x01);
4059
4060 /* on some machine, the BIOS will clear the codec gpio data when enter
4061 * suspend, and won't restore the data after resume, so we restore it
4062 * in the driver.
4063 */
4064 if (spec->gpio_data)
4065 alc_write_gpio_data(codec);
4066
4067 if (spec->has_alc5505_dsp)
4068 alc5505_dsp_resume(codec);
4069
4070 for (i = 0; i < HDA_MAX_COMPONENTS; i++)
4071 if (spec->comps[i].resume_hook)
4072 spec->comps[i].resume_hook(spec->comps[i].dev);
4073
4074 return 0;
4075 }
4076 #endif /* CONFIG_PM */
4077
4078 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4079 const struct hda_fixup *fix, int action)
4080 {
4081 struct alc_spec *spec = codec->spec;
4082
4083 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4084 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4085 }
4086
4087 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4088 const struct hda_fixup *fix,
4089 int action)
4090 {
4091 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4092 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4093
4094 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4095 snd_hda_codec_set_pincfg(codec, 0x19,
4096 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4097 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4098 }
4099
4100 static void alc269_fixup_hweq(struct hda_codec *codec,
4101 const struct hda_fixup *fix, int action)
4102 {
4103 if (action == HDA_FIXUP_ACT_INIT)
4104 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4105 }
4106
4107 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4108 const struct hda_fixup *fix, int action)
4109 {
4110 struct alc_spec *spec = codec->spec;
4111
4112 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4113 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4114 }
4115
4116 static void alc271_fixup_dmic(struct hda_codec *codec,
4117 const struct hda_fixup *fix, int action)
4118 {
4119 static const struct hda_verb verbs[] = {
4120 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4121 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4122 {}
4123 };
4124 unsigned int cfg;
4125
4126 if (strcmp(codec->core.chip_name, "ALC271X") &&
4127 strcmp(codec->core.chip_name, "ALC269VB"))
4128 return;
4129 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4130 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4131 snd_hda_sequence_write(codec, verbs);
4132 }
4133
4134 /* Fix the speaker amp after resume, etc */
4135 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4136 const struct hda_fixup *fix,
4137 int action)
4138 {
4139 if (action == HDA_FIXUP_ACT_INIT)
4140 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4141 }
4142
4143 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4144 const struct hda_fixup *fix, int action)
4145 {
4146 struct alc_spec *spec = codec->spec;
4147
4148 if (action != HDA_FIXUP_ACT_PROBE)
4149 return;
4150
4151 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4152 * fix the sample rate of analog I/O to 44.1kHz
4153 */
4154 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4155 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4156 }
4157
4158 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4159 const struct hda_fixup *fix, int action)
4160 {
4161 /* The digital-mic unit sends PDM (differential signal) instead of
4162 * the standard PCM, thus you can't record a valid mono stream as is.
4163 * Below is a workaround specific to ALC269 to control the dmic
4164 * signal source as mono.
4165 */
4166 if (action == HDA_FIXUP_ACT_INIT)
4167 alc_update_coef_idx(codec, 0x07, 0, 0x80);
4168 }
4169
4170 static void alc269_quanta_automute(struct hda_codec *codec)
4171 {
4172 snd_hda_gen_update_outputs(codec);
4173
4174 alc_write_coef_idx(codec, 0x0c, 0x680);
4175 alc_write_coef_idx(codec, 0x0c, 0x480);
4176 }
4177
4178 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4179 const struct hda_fixup *fix, int action)
4180 {
4181 struct alc_spec *spec = codec->spec;
4182 if (action != HDA_FIXUP_ACT_PROBE)
4183 return;
4184 spec->gen.automute_hook = alc269_quanta_automute;
4185 }
4186
4187 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4188 struct hda_jack_callback *jack)
4189 {
4190 struct alc_spec *spec = codec->spec;
4191 int vref;
4192 msleep(200);
4193 snd_hda_gen_hp_automute(codec, jack);
4194
4195 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4196 msleep(100);
4197 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4198 vref);
4199 msleep(500);
4200 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4201 vref);
4202 }
4203
4204 /*
4205 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4206 */
4207 struct hda_alc298_mbxinit {
4208 unsigned char value_0x23;
4209 unsigned char value_0x25;
4210 };
4211
4212 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4213 const struct hda_alc298_mbxinit *initval,
4214 bool first)
4215 {
4216 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4217 alc_write_coef_idx(codec, 0x26, 0xb000);
4218
4219 if (first)
4220 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4221
4222 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4223 alc_write_coef_idx(codec, 0x26, 0xf000);
4224 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4225
4226 if (initval->value_0x23 != 0x1e)
4227 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4228
4229 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4230 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4231 }
4232
4233 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4234 const struct hda_fixup *fix,
4235 int action)
4236 {
4237 /* Initialization magic */
4238 static const struct hda_alc298_mbxinit dac_init[] = {
4239 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4240 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4241 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4242 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4243 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4244 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4245 {0x2f, 0x00},
4246 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4247 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4248 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4249 {}
4250 };
4251 const struct hda_alc298_mbxinit *seq;
4252
4253 if (action != HDA_FIXUP_ACT_INIT)
4254 return;
4255
4256 /* Start */
4257 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4258 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4259 alc_write_coef_idx(codec, 0x26, 0xf000);
4260 alc_write_coef_idx(codec, 0x22, 0x31);
4261 alc_write_coef_idx(codec, 0x23, 0x0b);
4262 alc_write_coef_idx(codec, 0x25, 0x00);
4263 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4264 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4265
4266 for (seq = dac_init; seq->value_0x23; seq++)
4267 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4268 }
4269
4270 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4271 const struct hda_fixup *fix, int action)
4272 {
4273 struct alc_spec *spec = codec->spec;
4274 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4275 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4276 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4277 }
4278 }
4279
4280 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4281 bool polarity, bool on)
4282 {
4283 unsigned int pinval;
4284
4285 if (!pin)
4286 return;
4287 if (polarity)
4288 on = !on;
4289 pinval = snd_hda_codec_get_pin_target(codec, pin);
4290 pinval &= ~AC_PINCTL_VREFEN;
4291 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4292 /* temporarily power up/down for setting VREF */
4293 snd_hda_power_up_pm(codec);
4294 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4295 snd_hda_power_down_pm(codec);
4296 }
4297
4298 /* update mute-LED according to the speaker mute state via mic VREF pin */
4299 static int vref_mute_led_set(struct led_classdev *led_cdev,
4300 enum led_brightness brightness)
4301 {
4302 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4303 struct alc_spec *spec = codec->spec;
4304
4305 alc_update_vref_led(codec, spec->mute_led_nid,
4306 spec->mute_led_polarity, brightness);
4307 return 0;
4308 }
4309
4310 /* Make sure the led works even in runtime suspend */
4311 static unsigned int led_power_filter(struct hda_codec *codec,
4312 hda_nid_t nid,
4313 unsigned int power_state)
4314 {
4315 struct alc_spec *spec = codec->spec;
4316
4317 if (power_state != AC_PWRST_D3 || nid == 0 ||
4318 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4319 return power_state;
4320
4321 /* Set pin ctl again, it might have just been set to 0 */
4322 snd_hda_set_pin_ctl(codec, nid,
4323 snd_hda_codec_get_pin_target(codec, nid));
4324
4325 return snd_hda_gen_path_power_filter(codec, nid, power_state);
4326 }
4327
4328 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4329 const struct hda_fixup *fix, int action)
4330 {
4331 struct alc_spec *spec = codec->spec;
4332 const struct dmi_device *dev = NULL;
4333
4334 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4335 return;
4336
4337 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4338 int pol, pin;
4339 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4340 continue;
4341 if (pin < 0x0a || pin >= 0x10)
4342 break;
4343 spec->mute_led_polarity = pol;
4344 spec->mute_led_nid = pin - 0x0a + 0x18;
4345 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4346 codec->power_filter = led_power_filter;
4347 codec_dbg(codec,
4348 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4349 spec->mute_led_polarity);
4350 break;
4351 }
4352 }
4353
4354 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4355 const struct hda_fixup *fix,
4356 int action, hda_nid_t pin)
4357 {
4358 struct alc_spec *spec = codec->spec;
4359
4360 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4361 spec->mute_led_polarity = 0;
4362 spec->mute_led_nid = pin;
4363 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4364 codec->power_filter = led_power_filter;
4365 }
4366 }
4367
4368 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4369 const struct hda_fixup *fix, int action)
4370 {
4371 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4372 }
4373
4374 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4375 const struct hda_fixup *fix, int action)
4376 {
4377 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4378 }
4379
4380 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4381 const struct hda_fixup *fix, int action)
4382 {
4383 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4384 }
4385
4386 /* update LED status via GPIO */
4387 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4388 int polarity, bool enabled)
4389 {
4390 if (polarity)
4391 enabled = !enabled;
4392 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4393 }
4394
4395 /* turn on/off mute LED via GPIO per vmaster hook */
4396 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4397 enum led_brightness brightness)
4398 {
4399 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4400 struct alc_spec *spec = codec->spec;
4401
4402 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4403 spec->mute_led_polarity, !brightness);
4404 return 0;
4405 }
4406
4407 /* turn on/off mic-mute LED via GPIO per capture hook */
4408 static int micmute_led_set(struct led_classdev *led_cdev,
4409 enum led_brightness brightness)
4410 {
4411 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4412 struct alc_spec *spec = codec->spec;
4413
4414 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4415 spec->micmute_led_polarity, !brightness);
4416 return 0;
4417 }
4418
4419 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
4420 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4421 int action,
4422 unsigned int mute_mask,
4423 unsigned int micmute_mask)
4424 {
4425 struct alc_spec *spec = codec->spec;
4426
4427 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4428
4429 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4430 return;
4431 if (mute_mask) {
4432 spec->gpio_mute_led_mask = mute_mask;
4433 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4434 }
4435 if (micmute_mask) {
4436 spec->gpio_mic_led_mask = micmute_mask;
4437 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4438 }
4439 }
4440
4441 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4442 const struct hda_fixup *fix, int action)
4443 {
4444 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4445 }
4446
4447 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4448 const struct hda_fixup *fix, int action)
4449 {
4450 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4451 }
4452
4453 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4454 const struct hda_fixup *fix, int action)
4455 {
4456 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4457 }
4458
4459 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4460 const struct hda_fixup *fix, int action)
4461 {
4462 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4463 }
4464
4465 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4466 const struct hda_fixup *fix, int action)
4467 {
4468 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4469 }
4470
4471 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4472 const struct hda_fixup *fix, int action)
4473 {
4474 struct alc_spec *spec = codec->spec;
4475
4476 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4477 spec->micmute_led_polarity = 1;
4478 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4479 }
4480
4481 /* turn on/off mic-mute LED per capture hook via VREF change */
4482 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4483 enum led_brightness brightness)
4484 {
4485 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4486 struct alc_spec *spec = codec->spec;
4487
4488 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4489 spec->micmute_led_polarity, brightness);
4490 return 0;
4491 }
4492
4493 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4494 const struct hda_fixup *fix, int action)
4495 {
4496 struct alc_spec *spec = codec->spec;
4497
4498 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4499 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4500 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4501 * enable headphone amp
4502 */
4503 spec->gpio_mask |= 0x10;
4504 spec->gpio_dir |= 0x10;
4505 spec->cap_mute_led_nid = 0x18;
4506 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4507 codec->power_filter = led_power_filter;
4508 }
4509 }
4510
4511 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4512 const struct hda_fixup *fix, int action)
4513 {
4514 struct alc_spec *spec = codec->spec;
4515
4516 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4517 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4518 spec->cap_mute_led_nid = 0x18;
4519 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4520 codec->power_filter = led_power_filter;
4521 }
4522 }
4523
4524 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4525 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4526 */
4527 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4528 const struct hda_fixup *fix, int action)
4529 {
4530 struct alc_spec *spec = codec->spec;
4531
4532 switch (action) {
4533 case HDA_FIXUP_ACT_PRE_PROBE:
4534 spec->gpio_mask |= 0x01;
4535 spec->gpio_dir |= 0x01;
4536 break;
4537 case HDA_FIXUP_ACT_INIT:
4538 /* need to toggle GPIO to enable the amp */
4539 alc_update_gpio_data(codec, 0x01, true);
4540 msleep(100);
4541 alc_update_gpio_data(codec, 0x01, false);
4542 break;
4543 }
4544 }
4545
4546 /* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4547 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4548 struct hda_codec *codec,
4549 struct snd_pcm_substream *substream,
4550 int action)
4551 {
4552 switch (action) {
4553 case HDA_GEN_PCM_ACT_PREPARE:
4554 alc_update_gpio_data(codec, 0x04, true);
4555 break;
4556 case HDA_GEN_PCM_ACT_CLEANUP:
4557 alc_update_gpio_data(codec, 0x04, false);
4558 break;
4559 }
4560 }
4561
4562 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4563 const struct hda_fixup *fix,
4564 int action)
4565 {
4566 struct alc_spec *spec = codec->spec;
4567
4568 if (action == HDA_FIXUP_ACT_PROBE) {
4569 spec->gpio_mask |= 0x04;
4570 spec->gpio_dir |= 0x04;
4571 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4572 }
4573 }
4574
4575 static void alc_update_coef_led(struct hda_codec *codec,
4576 struct alc_coef_led *led,
4577 bool polarity, bool on)
4578 {
4579 if (polarity)
4580 on = !on;
4581 /* temporarily power up/down for setting COEF bit */
4582 alc_update_coef_idx(codec, led->idx, led->mask,
4583 on ? led->on : led->off);
4584 }
4585
4586 /* update mute-LED according to the speaker mute state via COEF bit */
4587 static int coef_mute_led_set(struct led_classdev *led_cdev,
4588 enum led_brightness brightness)
4589 {
4590 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4591 struct alc_spec *spec = codec->spec;
4592
4593 alc_update_coef_led(codec, &spec->mute_led_coef,
4594 spec->mute_led_polarity, brightness);
4595 return 0;
4596 }
4597
4598 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4599 const struct hda_fixup *fix,
4600 int action)
4601 {
4602 struct alc_spec *spec = codec->spec;
4603
4604 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4605 spec->mute_led_polarity = 0;
4606 spec->mute_led_coef.idx = 0x0b;
4607 spec->mute_led_coef.mask = 1 << 3;
4608 spec->mute_led_coef.on = 1 << 3;
4609 spec->mute_led_coef.off = 0;
4610 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4611 }
4612 }
4613
4614 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4615 const struct hda_fixup *fix,
4616 int action)
4617 {
4618 struct alc_spec *spec = codec->spec;
4619
4620 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4621 spec->mute_led_polarity = 0;
4622 spec->mute_led_coef.idx = 0x34;
4623 spec->mute_led_coef.mask = 1 << 5;
4624 spec->mute_led_coef.on = 0;
4625 spec->mute_led_coef.off = 1 << 5;
4626 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4627 }
4628 }
4629
4630 /* turn on/off mic-mute LED per capture hook by coef bit */
4631 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4632 enum led_brightness brightness)
4633 {
4634 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4635 struct alc_spec *spec = codec->spec;
4636
4637 alc_update_coef_led(codec, &spec->mic_led_coef,
4638 spec->micmute_led_polarity, brightness);
4639 return 0;
4640 }
4641
4642 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4643 const struct hda_fixup *fix, int action)
4644 {
4645 struct alc_spec *spec = codec->spec;
4646
4647 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4648 spec->mic_led_coef.idx = 0x19;
4649 spec->mic_led_coef.mask = 1 << 13;
4650 spec->mic_led_coef.on = 1 << 13;
4651 spec->mic_led_coef.off = 0;
4652 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4653 }
4654 }
4655
4656 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4657 const struct hda_fixup *fix, int action)
4658 {
4659 struct alc_spec *spec = codec->spec;
4660
4661 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4662 spec->mic_led_coef.idx = 0x35;
4663 spec->mic_led_coef.mask = 3 << 2;
4664 spec->mic_led_coef.on = 2 << 2;
4665 spec->mic_led_coef.off = 1 << 2;
4666 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4667 }
4668 }
4669
4670 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4671 const struct hda_fixup *fix, int action)
4672 {
4673 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4674 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4675 }
4676
4677 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4678 const struct hda_fixup *fix, int action)
4679 {
4680 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4681 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4682 }
4683
4684 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4685 const struct hda_fixup *fix, int action)
4686 {
4687 struct alc_spec *spec = codec->spec;
4688
4689 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4690 spec->cap_mute_led_nid = 0x1a;
4691 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4692 codec->power_filter = led_power_filter;
4693 }
4694 }
4695
4696 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4697 const struct hda_fixup *fix, int action)
4698 {
4699 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4700 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4701 }
4702
4703 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4704 const unsigned short coefs[2])
4705 {
4706 alc_write_coef_idx(codec, 0x23, coefs[0]);
4707 alc_write_coef_idx(codec, 0x25, coefs[1]);
4708 alc_write_coef_idx(codec, 0x26, 0xb011);
4709 }
4710
4711 struct alc298_samsung_amp_desc {
4712 unsigned char nid;
4713 unsigned short init_seq[2][2];
4714 };
4715
4716 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4717 const struct hda_fixup *fix, int action)
4718 {
4719 int i, j;
4720 static const unsigned short init_seq[][2] = {
4721 { 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4722 { 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4723 { 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4724 { 0x41, 0x07 }, { 0x400, 0x1 }
4725 };
4726 static const struct alc298_samsung_amp_desc amps[] = {
4727 { 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4728 { 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4729 };
4730
4731 if (action != HDA_FIXUP_ACT_INIT)
4732 return;
4733
4734 for (i = 0; i < ARRAY_SIZE(amps); i++) {
4735 alc_write_coef_idx(codec, 0x22, amps[i].nid);
4736
4737 for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4738 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4739
4740 for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4741 alc298_samsung_write_coef_pack(codec, init_seq[j]);
4742 }
4743 }
4744
4745 #if IS_REACHABLE(CONFIG_INPUT)
4746 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4747 struct hda_jack_callback *event)
4748 {
4749 struct alc_spec *spec = codec->spec;
4750
4751 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4752 send both key on and key off event for every interrupt. */
4753 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4754 input_sync(spec->kb_dev);
4755 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4756 input_sync(spec->kb_dev);
4757 }
4758
4759 static int alc_register_micmute_input_device(struct hda_codec *codec)
4760 {
4761 struct alc_spec *spec = codec->spec;
4762 int i;
4763
4764 spec->kb_dev = input_allocate_device();
4765 if (!spec->kb_dev) {
4766 codec_err(codec, "Out of memory (input_allocate_device)\n");
4767 return -ENOMEM;
4768 }
4769
4770 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4771
4772 spec->kb_dev->name = "Microphone Mute Button";
4773 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4774 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4775 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4776 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4777 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4778 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4779
4780 if (input_register_device(spec->kb_dev)) {
4781 codec_err(codec, "input_register_device failed\n");
4782 input_free_device(spec->kb_dev);
4783 spec->kb_dev = NULL;
4784 return -ENOMEM;
4785 }
4786
4787 return 0;
4788 }
4789
4790 /* GPIO1 = set according to SKU external amp
4791 * GPIO2 = mic mute hotkey
4792 * GPIO3 = mute LED
4793 * GPIO4 = mic mute LED
4794 */
4795 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4796 const struct hda_fixup *fix, int action)
4797 {
4798 struct alc_spec *spec = codec->spec;
4799
4800 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4801 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4802 spec->init_amp = ALC_INIT_DEFAULT;
4803 if (alc_register_micmute_input_device(codec) != 0)
4804 return;
4805
4806 spec->gpio_mask |= 0x06;
4807 spec->gpio_dir |= 0x02;
4808 spec->gpio_data |= 0x02;
4809 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4810 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4811 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4812 gpio2_mic_hotkey_event);
4813 return;
4814 }
4815
4816 if (!spec->kb_dev)
4817 return;
4818
4819 switch (action) {
4820 case HDA_FIXUP_ACT_FREE:
4821 input_unregister_device(spec->kb_dev);
4822 spec->kb_dev = NULL;
4823 }
4824 }
4825
4826 /* Line2 = mic mute hotkey
4827 * GPIO2 = mic mute LED
4828 */
4829 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4830 const struct hda_fixup *fix, int action)
4831 {
4832 struct alc_spec *spec = codec->spec;
4833
4834 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4835 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4836 spec->init_amp = ALC_INIT_DEFAULT;
4837 if (alc_register_micmute_input_device(codec) != 0)
4838 return;
4839
4840 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4841 gpio2_mic_hotkey_event);
4842 return;
4843 }
4844
4845 if (!spec->kb_dev)
4846 return;
4847
4848 switch (action) {
4849 case HDA_FIXUP_ACT_FREE:
4850 input_unregister_device(spec->kb_dev);
4851 spec->kb_dev = NULL;
4852 }
4853 }
4854 #else /* INPUT */
4855 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
4856 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
4857 #endif /* INPUT */
4858
4859 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4860 const struct hda_fixup *fix, int action)
4861 {
4862 struct alc_spec *spec = codec->spec;
4863
4864 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4865 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4866 spec->cap_mute_led_nid = 0x18;
4867 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4868 }
4869 }
4870
4871 static const struct coef_fw alc225_pre_hsmode[] = {
4872 UPDATE_COEF(0x4a, 1<<8, 0),
4873 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4874 UPDATE_COEF(0x63, 3<<14, 3<<14),
4875 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4876 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4877 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4878 UPDATE_COEF(0x4a, 3<<10, 0),
4879 {}
4880 };
4881
4882 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4883 {
4884 struct alc_spec *spec = codec->spec;
4885 static const struct coef_fw coef0255[] = {
4886 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4887 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4888 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4889 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4890 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4891 {}
4892 };
4893 static const struct coef_fw coef0256[] = {
4894 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4895 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4896 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4897 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4898 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4899 {}
4900 };
4901 static const struct coef_fw coef0233[] = {
4902 WRITE_COEF(0x1b, 0x0c0b),
4903 WRITE_COEF(0x45, 0xc429),
4904 UPDATE_COEF(0x35, 0x4000, 0),
4905 WRITE_COEF(0x06, 0x2104),
4906 WRITE_COEF(0x1a, 0x0001),
4907 WRITE_COEF(0x26, 0x0004),
4908 WRITE_COEF(0x32, 0x42a3),
4909 {}
4910 };
4911 static const struct coef_fw coef0288[] = {
4912 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4913 UPDATE_COEF(0x50, 0x2000, 0x2000),
4914 UPDATE_COEF(0x56, 0x0006, 0x0006),
4915 UPDATE_COEF(0x66, 0x0008, 0),
4916 UPDATE_COEF(0x67, 0x2000, 0),
4917 {}
4918 };
4919 static const struct coef_fw coef0298[] = {
4920 UPDATE_COEF(0x19, 0x1300, 0x0300),
4921 {}
4922 };
4923 static const struct coef_fw coef0292[] = {
4924 WRITE_COEF(0x76, 0x000e),
4925 WRITE_COEF(0x6c, 0x2400),
4926 WRITE_COEF(0x18, 0x7308),
4927 WRITE_COEF(0x6b, 0xc429),
4928 {}
4929 };
4930 static const struct coef_fw coef0293[] = {
4931 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4932 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4933 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4934 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4935 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4936 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4937 {}
4938 };
4939 static const struct coef_fw coef0668[] = {
4940 WRITE_COEF(0x15, 0x0d40),
4941 WRITE_COEF(0xb7, 0x802b),
4942 {}
4943 };
4944 static const struct coef_fw coef0225[] = {
4945 UPDATE_COEF(0x63, 3<<14, 0),
4946 {}
4947 };
4948 static const struct coef_fw coef0274[] = {
4949 UPDATE_COEF(0x4a, 0x0100, 0),
4950 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4951 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4952 UPDATE_COEF(0x4a, 0x0010, 0),
4953 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4954 WRITE_COEF(0x45, 0x5289),
4955 UPDATE_COEF(0x4a, 0x0c00, 0),
4956 {}
4957 };
4958
4959 if (spec->no_internal_mic_pin) {
4960 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4961 return;
4962 }
4963
4964 switch (codec->core.vendor_id) {
4965 case 0x10ec0255:
4966 alc_process_coef_fw(codec, coef0255);
4967 break;
4968 case 0x10ec0230:
4969 case 0x10ec0236:
4970 case 0x10ec0256:
4971 case 0x19e58326:
4972 alc_process_coef_fw(codec, coef0256);
4973 break;
4974 case 0x10ec0234:
4975 case 0x10ec0274:
4976 case 0x10ec0294:
4977 alc_process_coef_fw(codec, coef0274);
4978 break;
4979 case 0x10ec0233:
4980 case 0x10ec0283:
4981 alc_process_coef_fw(codec, coef0233);
4982 break;
4983 case 0x10ec0286:
4984 case 0x10ec0288:
4985 alc_process_coef_fw(codec, coef0288);
4986 break;
4987 case 0x10ec0298:
4988 alc_process_coef_fw(codec, coef0298);
4989 alc_process_coef_fw(codec, coef0288);
4990 break;
4991 case 0x10ec0292:
4992 alc_process_coef_fw(codec, coef0292);
4993 break;
4994 case 0x10ec0293:
4995 alc_process_coef_fw(codec, coef0293);
4996 break;
4997 case 0x10ec0668:
4998 alc_process_coef_fw(codec, coef0668);
4999 break;
5000 case 0x10ec0215:
5001 case 0x10ec0225:
5002 case 0x10ec0285:
5003 case 0x10ec0295:
5004 case 0x10ec0289:
5005 case 0x10ec0299:
5006 alc_process_coef_fw(codec, alc225_pre_hsmode);
5007 alc_process_coef_fw(codec, coef0225);
5008 break;
5009 case 0x10ec0867:
5010 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5011 break;
5012 }
5013 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5014 }
5015
5016
5017 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5018 hda_nid_t mic_pin)
5019 {
5020 static const struct coef_fw coef0255[] = {
5021 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5022 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5023 {}
5024 };
5025 static const struct coef_fw coef0256[] = {
5026 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5027 WRITE_COEFEX(0x57, 0x03, 0x09a3),
5028 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5029 {}
5030 };
5031 static const struct coef_fw coef0233[] = {
5032 UPDATE_COEF(0x35, 0, 1<<14),
5033 WRITE_COEF(0x06, 0x2100),
5034 WRITE_COEF(0x1a, 0x0021),
5035 WRITE_COEF(0x26, 0x008c),
5036 {}
5037 };
5038 static const struct coef_fw coef0288[] = {
5039 UPDATE_COEF(0x4f, 0x00c0, 0),
5040 UPDATE_COEF(0x50, 0x2000, 0),
5041 UPDATE_COEF(0x56, 0x0006, 0),
5042 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5043 UPDATE_COEF(0x66, 0x0008, 0x0008),
5044 UPDATE_COEF(0x67, 0x2000, 0x2000),
5045 {}
5046 };
5047 static const struct coef_fw coef0292[] = {
5048 WRITE_COEF(0x19, 0xa208),
5049 WRITE_COEF(0x2e, 0xacf0),
5050 {}
5051 };
5052 static const struct coef_fw coef0293[] = {
5053 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5054 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5055 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5056 {}
5057 };
5058 static const struct coef_fw coef0688[] = {
5059 WRITE_COEF(0xb7, 0x802b),
5060 WRITE_COEF(0xb5, 0x1040),
5061 UPDATE_COEF(0xc3, 0, 1<<12),
5062 {}
5063 };
5064 static const struct coef_fw coef0225[] = {
5065 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5066 UPDATE_COEF(0x4a, 3<<4, 2<<4),
5067 UPDATE_COEF(0x63, 3<<14, 0),
5068 {}
5069 };
5070 static const struct coef_fw coef0274[] = {
5071 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5072 UPDATE_COEF(0x4a, 0x0010, 0),
5073 UPDATE_COEF(0x6b, 0xf000, 0),
5074 {}
5075 };
5076
5077 switch (codec->core.vendor_id) {
5078 case 0x10ec0255:
5079 alc_write_coef_idx(codec, 0x45, 0xc489);
5080 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5081 alc_process_coef_fw(codec, coef0255);
5082 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5083 break;
5084 case 0x10ec0230:
5085 case 0x10ec0236:
5086 case 0x10ec0256:
5087 case 0x19e58326:
5088 alc_write_coef_idx(codec, 0x45, 0xc489);
5089 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5090 alc_process_coef_fw(codec, coef0256);
5091 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5092 break;
5093 case 0x10ec0234:
5094 case 0x10ec0274:
5095 case 0x10ec0294:
5096 alc_write_coef_idx(codec, 0x45, 0x4689);
5097 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5098 alc_process_coef_fw(codec, coef0274);
5099 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5100 break;
5101 case 0x10ec0233:
5102 case 0x10ec0283:
5103 alc_write_coef_idx(codec, 0x45, 0xc429);
5104 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5105 alc_process_coef_fw(codec, coef0233);
5106 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5107 break;
5108 case 0x10ec0286:
5109 case 0x10ec0288:
5110 case 0x10ec0298:
5111 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5112 alc_process_coef_fw(codec, coef0288);
5113 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5114 break;
5115 case 0x10ec0292:
5116 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5117 alc_process_coef_fw(codec, coef0292);
5118 break;
5119 case 0x10ec0293:
5120 /* Set to TRS mode */
5121 alc_write_coef_idx(codec, 0x45, 0xc429);
5122 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5123 alc_process_coef_fw(codec, coef0293);
5124 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5125 break;
5126 case 0x10ec0867:
5127 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5128 fallthrough;
5129 case 0x10ec0221:
5130 case 0x10ec0662:
5131 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5132 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5133 break;
5134 case 0x10ec0668:
5135 alc_write_coef_idx(codec, 0x11, 0x0001);
5136 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5137 alc_process_coef_fw(codec, coef0688);
5138 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5139 break;
5140 case 0x10ec0215:
5141 case 0x10ec0225:
5142 case 0x10ec0285:
5143 case 0x10ec0295:
5144 case 0x10ec0289:
5145 case 0x10ec0299:
5146 alc_process_coef_fw(codec, alc225_pre_hsmode);
5147 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5148 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5149 alc_process_coef_fw(codec, coef0225);
5150 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5151 break;
5152 }
5153 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5154 }
5155
5156 static void alc_headset_mode_default(struct hda_codec *codec)
5157 {
5158 static const struct coef_fw coef0225[] = {
5159 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5160 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5161 UPDATE_COEF(0x49, 3<<8, 0<<8),
5162 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5163 UPDATE_COEF(0x63, 3<<14, 0),
5164 UPDATE_COEF(0x67, 0xf000, 0x3000),
5165 {}
5166 };
5167 static const struct coef_fw coef0255[] = {
5168 WRITE_COEF(0x45, 0xc089),
5169 WRITE_COEF(0x45, 0xc489),
5170 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5171 WRITE_COEF(0x49, 0x0049),
5172 {}
5173 };
5174 static const struct coef_fw coef0256[] = {
5175 WRITE_COEF(0x45, 0xc489),
5176 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5177 WRITE_COEF(0x49, 0x0049),
5178 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5179 WRITE_COEF(0x06, 0x6100),
5180 {}
5181 };
5182 static const struct coef_fw coef0233[] = {
5183 WRITE_COEF(0x06, 0x2100),
5184 WRITE_COEF(0x32, 0x4ea3),
5185 {}
5186 };
5187 static const struct coef_fw coef0288[] = {
5188 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5189 UPDATE_COEF(0x50, 0x2000, 0x2000),
5190 UPDATE_COEF(0x56, 0x0006, 0x0006),
5191 UPDATE_COEF(0x66, 0x0008, 0),
5192 UPDATE_COEF(0x67, 0x2000, 0),
5193 {}
5194 };
5195 static const struct coef_fw coef0292[] = {
5196 WRITE_COEF(0x76, 0x000e),
5197 WRITE_COEF(0x6c, 0x2400),
5198 WRITE_COEF(0x6b, 0xc429),
5199 WRITE_COEF(0x18, 0x7308),
5200 {}
5201 };
5202 static const struct coef_fw coef0293[] = {
5203 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5204 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5205 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5206 {}
5207 };
5208 static const struct coef_fw coef0688[] = {
5209 WRITE_COEF(0x11, 0x0041),
5210 WRITE_COEF(0x15, 0x0d40),
5211 WRITE_COEF(0xb7, 0x802b),
5212 {}
5213 };
5214 static const struct coef_fw coef0274[] = {
5215 WRITE_COEF(0x45, 0x4289),
5216 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5217 UPDATE_COEF(0x6b, 0x0f00, 0),
5218 UPDATE_COEF(0x49, 0x0300, 0x0300),
5219 {}
5220 };
5221
5222 switch (codec->core.vendor_id) {
5223 case 0x10ec0215:
5224 case 0x10ec0225:
5225 case 0x10ec0285:
5226 case 0x10ec0295:
5227 case 0x10ec0289:
5228 case 0x10ec0299:
5229 alc_process_coef_fw(codec, alc225_pre_hsmode);
5230 alc_process_coef_fw(codec, coef0225);
5231 break;
5232 case 0x10ec0255:
5233 alc_process_coef_fw(codec, coef0255);
5234 break;
5235 case 0x10ec0230:
5236 case 0x10ec0236:
5237 case 0x10ec0256:
5238 case 0x19e58326:
5239 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5240 alc_write_coef_idx(codec, 0x45, 0xc089);
5241 msleep(50);
5242 alc_process_coef_fw(codec, coef0256);
5243 break;
5244 case 0x10ec0234:
5245 case 0x10ec0274:
5246 case 0x10ec0294:
5247 alc_process_coef_fw(codec, coef0274);
5248 break;
5249 case 0x10ec0233:
5250 case 0x10ec0283:
5251 alc_process_coef_fw(codec, coef0233);
5252 break;
5253 case 0x10ec0286:
5254 case 0x10ec0288:
5255 case 0x10ec0298:
5256 alc_process_coef_fw(codec, coef0288);
5257 break;
5258 case 0x10ec0292:
5259 alc_process_coef_fw(codec, coef0292);
5260 break;
5261 case 0x10ec0293:
5262 alc_process_coef_fw(codec, coef0293);
5263 break;
5264 case 0x10ec0668:
5265 alc_process_coef_fw(codec, coef0688);
5266 break;
5267 case 0x10ec0867:
5268 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5269 break;
5270 }
5271 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5272 }
5273
5274 /* Iphone type */
5275 static void alc_headset_mode_ctia(struct hda_codec *codec)
5276 {
5277 int val;
5278
5279 static const struct coef_fw coef0255[] = {
5280 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5281 WRITE_COEF(0x1b, 0x0c2b),
5282 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5283 {}
5284 };
5285 static const struct coef_fw coef0256[] = {
5286 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5287 WRITE_COEF(0x1b, 0x0e6b),
5288 {}
5289 };
5290 static const struct coef_fw coef0233[] = {
5291 WRITE_COEF(0x45, 0xd429),
5292 WRITE_COEF(0x1b, 0x0c2b),
5293 WRITE_COEF(0x32, 0x4ea3),
5294 {}
5295 };
5296 static const struct coef_fw coef0288[] = {
5297 UPDATE_COEF(0x50, 0x2000, 0x2000),
5298 UPDATE_COEF(0x56, 0x0006, 0x0006),
5299 UPDATE_COEF(0x66, 0x0008, 0),
5300 UPDATE_COEF(0x67, 0x2000, 0),
5301 {}
5302 };
5303 static const struct coef_fw coef0292[] = {
5304 WRITE_COEF(0x6b, 0xd429),
5305 WRITE_COEF(0x76, 0x0008),
5306 WRITE_COEF(0x18, 0x7388),
5307 {}
5308 };
5309 static const struct coef_fw coef0293[] = {
5310 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5311 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5312 {}
5313 };
5314 static const struct coef_fw coef0688[] = {
5315 WRITE_COEF(0x11, 0x0001),
5316 WRITE_COEF(0x15, 0x0d60),
5317 WRITE_COEF(0xc3, 0x0000),
5318 {}
5319 };
5320 static const struct coef_fw coef0225_1[] = {
5321 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5322 UPDATE_COEF(0x63, 3<<14, 2<<14),
5323 {}
5324 };
5325 static const struct coef_fw coef0225_2[] = {
5326 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5327 UPDATE_COEF(0x63, 3<<14, 1<<14),
5328 {}
5329 };
5330
5331 switch (codec->core.vendor_id) {
5332 case 0x10ec0255:
5333 alc_process_coef_fw(codec, coef0255);
5334 break;
5335 case 0x10ec0230:
5336 case 0x10ec0236:
5337 case 0x10ec0256:
5338 case 0x19e58326:
5339 alc_process_coef_fw(codec, coef0256);
5340 break;
5341 case 0x10ec0234:
5342 case 0x10ec0274:
5343 case 0x10ec0294:
5344 alc_write_coef_idx(codec, 0x45, 0xd689);
5345 break;
5346 case 0x10ec0233:
5347 case 0x10ec0283:
5348 alc_process_coef_fw(codec, coef0233);
5349 break;
5350 case 0x10ec0298:
5351 val = alc_read_coef_idx(codec, 0x50);
5352 if (val & (1 << 12)) {
5353 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5354 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5355 msleep(300);
5356 } else {
5357 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5358 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5359 msleep(300);
5360 }
5361 break;
5362 case 0x10ec0286:
5363 case 0x10ec0288:
5364 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5365 msleep(300);
5366 alc_process_coef_fw(codec, coef0288);
5367 break;
5368 case 0x10ec0292:
5369 alc_process_coef_fw(codec, coef0292);
5370 break;
5371 case 0x10ec0293:
5372 alc_process_coef_fw(codec, coef0293);
5373 break;
5374 case 0x10ec0668:
5375 alc_process_coef_fw(codec, coef0688);
5376 break;
5377 case 0x10ec0215:
5378 case 0x10ec0225:
5379 case 0x10ec0285:
5380 case 0x10ec0295:
5381 case 0x10ec0289:
5382 case 0x10ec0299:
5383 val = alc_read_coef_idx(codec, 0x45);
5384 if (val & (1 << 9))
5385 alc_process_coef_fw(codec, coef0225_2);
5386 else
5387 alc_process_coef_fw(codec, coef0225_1);
5388 break;
5389 case 0x10ec0867:
5390 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5391 break;
5392 }
5393 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5394 }
5395
5396 /* Nokia type */
5397 static void alc_headset_mode_omtp(struct hda_codec *codec)
5398 {
5399 static const struct coef_fw coef0255[] = {
5400 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5401 WRITE_COEF(0x1b, 0x0c2b),
5402 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5403 {}
5404 };
5405 static const struct coef_fw coef0256[] = {
5406 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5407 WRITE_COEF(0x1b, 0x0e6b),
5408 {}
5409 };
5410 static const struct coef_fw coef0233[] = {
5411 WRITE_COEF(0x45, 0xe429),
5412 WRITE_COEF(0x1b, 0x0c2b),
5413 WRITE_COEF(0x32, 0x4ea3),
5414 {}
5415 };
5416 static const struct coef_fw coef0288[] = {
5417 UPDATE_COEF(0x50, 0x2000, 0x2000),
5418 UPDATE_COEF(0x56, 0x0006, 0x0006),
5419 UPDATE_COEF(0x66, 0x0008, 0),
5420 UPDATE_COEF(0x67, 0x2000, 0),
5421 {}
5422 };
5423 static const struct coef_fw coef0292[] = {
5424 WRITE_COEF(0x6b, 0xe429),
5425 WRITE_COEF(0x76, 0x0008),
5426 WRITE_COEF(0x18, 0x7388),
5427 {}
5428 };
5429 static const struct coef_fw coef0293[] = {
5430 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5431 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5432 {}
5433 };
5434 static const struct coef_fw coef0688[] = {
5435 WRITE_COEF(0x11, 0x0001),
5436 WRITE_COEF(0x15, 0x0d50),
5437 WRITE_COEF(0xc3, 0x0000),
5438 {}
5439 };
5440 static const struct coef_fw coef0225[] = {
5441 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5442 UPDATE_COEF(0x63, 3<<14, 2<<14),
5443 {}
5444 };
5445
5446 switch (codec->core.vendor_id) {
5447 case 0x10ec0255:
5448 alc_process_coef_fw(codec, coef0255);
5449 break;
5450 case 0x10ec0230:
5451 case 0x10ec0236:
5452 case 0x10ec0256:
5453 case 0x19e58326:
5454 alc_process_coef_fw(codec, coef0256);
5455 break;
5456 case 0x10ec0234:
5457 case 0x10ec0274:
5458 case 0x10ec0294:
5459 alc_write_coef_idx(codec, 0x45, 0xe689);
5460 break;
5461 case 0x10ec0233:
5462 case 0x10ec0283:
5463 alc_process_coef_fw(codec, coef0233);
5464 break;
5465 case 0x10ec0298:
5466 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5467 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5468 msleep(300);
5469 break;
5470 case 0x10ec0286:
5471 case 0x10ec0288:
5472 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5473 msleep(300);
5474 alc_process_coef_fw(codec, coef0288);
5475 break;
5476 case 0x10ec0292:
5477 alc_process_coef_fw(codec, coef0292);
5478 break;
5479 case 0x10ec0293:
5480 alc_process_coef_fw(codec, coef0293);
5481 break;
5482 case 0x10ec0668:
5483 alc_process_coef_fw(codec, coef0688);
5484 break;
5485 case 0x10ec0215:
5486 case 0x10ec0225:
5487 case 0x10ec0285:
5488 case 0x10ec0295:
5489 case 0x10ec0289:
5490 case 0x10ec0299:
5491 alc_process_coef_fw(codec, coef0225);
5492 break;
5493 }
5494 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5495 }
5496
5497 static void alc_determine_headset_type(struct hda_codec *codec)
5498 {
5499 int val;
5500 bool is_ctia = false;
5501 struct alc_spec *spec = codec->spec;
5502 static const struct coef_fw coef0255[] = {
5503 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5504 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5505 conteol) */
5506 {}
5507 };
5508 static const struct coef_fw coef0288[] = {
5509 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5510 {}
5511 };
5512 static const struct coef_fw coef0298[] = {
5513 UPDATE_COEF(0x50, 0x2000, 0x2000),
5514 UPDATE_COEF(0x56, 0x0006, 0x0006),
5515 UPDATE_COEF(0x66, 0x0008, 0),
5516 UPDATE_COEF(0x67, 0x2000, 0),
5517 UPDATE_COEF(0x19, 0x1300, 0x1300),
5518 {}
5519 };
5520 static const struct coef_fw coef0293[] = {
5521 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5522 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5523 {}
5524 };
5525 static const struct coef_fw coef0688[] = {
5526 WRITE_COEF(0x11, 0x0001),
5527 WRITE_COEF(0xb7, 0x802b),
5528 WRITE_COEF(0x15, 0x0d60),
5529 WRITE_COEF(0xc3, 0x0c00),
5530 {}
5531 };
5532 static const struct coef_fw coef0274[] = {
5533 UPDATE_COEF(0x4a, 0x0010, 0),
5534 UPDATE_COEF(0x4a, 0x8000, 0),
5535 WRITE_COEF(0x45, 0xd289),
5536 UPDATE_COEF(0x49, 0x0300, 0x0300),
5537 {}
5538 };
5539
5540 if (spec->no_internal_mic_pin) {
5541 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5542 return;
5543 }
5544
5545 switch (codec->core.vendor_id) {
5546 case 0x10ec0255:
5547 alc_process_coef_fw(codec, coef0255);
5548 msleep(300);
5549 val = alc_read_coef_idx(codec, 0x46);
5550 is_ctia = (val & 0x0070) == 0x0070;
5551 break;
5552 case 0x10ec0230:
5553 case 0x10ec0236:
5554 case 0x10ec0256:
5555 case 0x19e58326:
5556 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5557 alc_write_coef_idx(codec, 0x06, 0x6104);
5558 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5559
5560 snd_hda_codec_write(codec, 0x21, 0,
5561 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5562 msleep(80);
5563 snd_hda_codec_write(codec, 0x21, 0,
5564 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5565
5566 alc_process_coef_fw(codec, coef0255);
5567 msleep(300);
5568 val = alc_read_coef_idx(codec, 0x46);
5569 is_ctia = (val & 0x0070) == 0x0070;
5570
5571 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5572 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5573
5574 snd_hda_codec_write(codec, 0x21, 0,
5575 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5576 msleep(80);
5577 snd_hda_codec_write(codec, 0x21, 0,
5578 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5579 break;
5580 case 0x10ec0234:
5581 case 0x10ec0274:
5582 case 0x10ec0294:
5583 alc_process_coef_fw(codec, coef0274);
5584 msleep(850);
5585 val = alc_read_coef_idx(codec, 0x46);
5586 is_ctia = (val & 0x00f0) == 0x00f0;
5587 break;
5588 case 0x10ec0233:
5589 case 0x10ec0283:
5590 alc_write_coef_idx(codec, 0x45, 0xd029);
5591 msleep(300);
5592 val = alc_read_coef_idx(codec, 0x46);
5593 is_ctia = (val & 0x0070) == 0x0070;
5594 break;
5595 case 0x10ec0298:
5596 snd_hda_codec_write(codec, 0x21, 0,
5597 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5598 msleep(100);
5599 snd_hda_codec_write(codec, 0x21, 0,
5600 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5601 msleep(200);
5602
5603 val = alc_read_coef_idx(codec, 0x50);
5604 if (val & (1 << 12)) {
5605 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5606 alc_process_coef_fw(codec, coef0288);
5607 msleep(350);
5608 val = alc_read_coef_idx(codec, 0x50);
5609 is_ctia = (val & 0x0070) == 0x0070;
5610 } else {
5611 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5612 alc_process_coef_fw(codec, coef0288);
5613 msleep(350);
5614 val = alc_read_coef_idx(codec, 0x50);
5615 is_ctia = (val & 0x0070) == 0x0070;
5616 }
5617 alc_process_coef_fw(codec, coef0298);
5618 snd_hda_codec_write(codec, 0x21, 0,
5619 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5620 msleep(75);
5621 snd_hda_codec_write(codec, 0x21, 0,
5622 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5623 break;
5624 case 0x10ec0286:
5625 case 0x10ec0288:
5626 alc_process_coef_fw(codec, coef0288);
5627 msleep(350);
5628 val = alc_read_coef_idx(codec, 0x50);
5629 is_ctia = (val & 0x0070) == 0x0070;
5630 break;
5631 case 0x10ec0292:
5632 alc_write_coef_idx(codec, 0x6b, 0xd429);
5633 msleep(300);
5634 val = alc_read_coef_idx(codec, 0x6c);
5635 is_ctia = (val & 0x001c) == 0x001c;
5636 break;
5637 case 0x10ec0293:
5638 alc_process_coef_fw(codec, coef0293);
5639 msleep(300);
5640 val = alc_read_coef_idx(codec, 0x46);
5641 is_ctia = (val & 0x0070) == 0x0070;
5642 break;
5643 case 0x10ec0668:
5644 alc_process_coef_fw(codec, coef0688);
5645 msleep(300);
5646 val = alc_read_coef_idx(codec, 0xbe);
5647 is_ctia = (val & 0x1c02) == 0x1c02;
5648 break;
5649 case 0x10ec0215:
5650 case 0x10ec0225:
5651 case 0x10ec0285:
5652 case 0x10ec0295:
5653 case 0x10ec0289:
5654 case 0x10ec0299:
5655 snd_hda_codec_write(codec, 0x21, 0,
5656 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5657 msleep(80);
5658 snd_hda_codec_write(codec, 0x21, 0,
5659 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5660
5661 alc_process_coef_fw(codec, alc225_pre_hsmode);
5662 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5663 val = alc_read_coef_idx(codec, 0x45);
5664 if (val & (1 << 9)) {
5665 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5666 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5667 msleep(800);
5668 val = alc_read_coef_idx(codec, 0x46);
5669 is_ctia = (val & 0x00f0) == 0x00f0;
5670 } else {
5671 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5672 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5673 msleep(800);
5674 val = alc_read_coef_idx(codec, 0x46);
5675 is_ctia = (val & 0x00f0) == 0x00f0;
5676 }
5677 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5678 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5679 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5680
5681 snd_hda_codec_write(codec, 0x21, 0,
5682 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5683 msleep(80);
5684 snd_hda_codec_write(codec, 0x21, 0,
5685 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5686 break;
5687 case 0x10ec0867:
5688 is_ctia = true;
5689 break;
5690 }
5691
5692 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5693 is_ctia ? "yes" : "no");
5694 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5695 }
5696
5697 static void alc_update_headset_mode(struct hda_codec *codec)
5698 {
5699 struct alc_spec *spec = codec->spec;
5700
5701 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5702 hda_nid_t hp_pin = alc_get_hp_pin(spec);
5703
5704 int new_headset_mode;
5705
5706 if (!snd_hda_jack_detect(codec, hp_pin))
5707 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5708 else if (mux_pin == spec->headset_mic_pin)
5709 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5710 else if (mux_pin == spec->headphone_mic_pin)
5711 new_headset_mode = ALC_HEADSET_MODE_MIC;
5712 else
5713 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5714
5715 if (new_headset_mode == spec->current_headset_mode) {
5716 snd_hda_gen_update_outputs(codec);
5717 return;
5718 }
5719
5720 switch (new_headset_mode) {
5721 case ALC_HEADSET_MODE_UNPLUGGED:
5722 alc_headset_mode_unplugged(codec);
5723 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5724 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5725 spec->gen.hp_jack_present = false;
5726 break;
5727 case ALC_HEADSET_MODE_HEADSET:
5728 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5729 alc_determine_headset_type(codec);
5730 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5731 alc_headset_mode_ctia(codec);
5732 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5733 alc_headset_mode_omtp(codec);
5734 spec->gen.hp_jack_present = true;
5735 break;
5736 case ALC_HEADSET_MODE_MIC:
5737 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5738 spec->gen.hp_jack_present = false;
5739 break;
5740 case ALC_HEADSET_MODE_HEADPHONE:
5741 alc_headset_mode_default(codec);
5742 spec->gen.hp_jack_present = true;
5743 break;
5744 }
5745 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5746 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5747 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5748 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5749 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5750 PIN_VREFHIZ);
5751 }
5752 spec->current_headset_mode = new_headset_mode;
5753
5754 snd_hda_gen_update_outputs(codec);
5755 }
5756
5757 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5758 struct snd_kcontrol *kcontrol,
5759 struct snd_ctl_elem_value *ucontrol)
5760 {
5761 alc_update_headset_mode(codec);
5762 }
5763
5764 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5765 struct hda_jack_callback *jack)
5766 {
5767 snd_hda_gen_hp_automute(codec, jack);
5768 alc_update_headset_mode(codec);
5769 }
5770
5771 static void alc_probe_headset_mode(struct hda_codec *codec)
5772 {
5773 int i;
5774 struct alc_spec *spec = codec->spec;
5775 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5776
5777 /* Find mic pins */
5778 for (i = 0; i < cfg->num_inputs; i++) {
5779 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5780 spec->headset_mic_pin = cfg->inputs[i].pin;
5781 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5782 spec->headphone_mic_pin = cfg->inputs[i].pin;
5783 }
5784
5785 WARN_ON(spec->gen.cap_sync_hook);
5786 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5787 spec->gen.automute_hook = alc_update_headset_mode;
5788 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5789 }
5790
5791 static void alc_fixup_headset_mode(struct hda_codec *codec,
5792 const struct hda_fixup *fix, int action)
5793 {
5794 struct alc_spec *spec = codec->spec;
5795
5796 switch (action) {
5797 case HDA_FIXUP_ACT_PRE_PROBE:
5798 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5799 break;
5800 case HDA_FIXUP_ACT_PROBE:
5801 alc_probe_headset_mode(codec);
5802 break;
5803 case HDA_FIXUP_ACT_INIT:
5804 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5805 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5806 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5807 }
5808 alc_update_headset_mode(codec);
5809 break;
5810 }
5811 }
5812
5813 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5814 const struct hda_fixup *fix, int action)
5815 {
5816 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5817 struct alc_spec *spec = codec->spec;
5818 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5819 }
5820 else
5821 alc_fixup_headset_mode(codec, fix, action);
5822 }
5823
5824 static void alc255_set_default_jack_type(struct hda_codec *codec)
5825 {
5826 /* Set to iphone type */
5827 static const struct coef_fw alc255fw[] = {
5828 WRITE_COEF(0x1b, 0x880b),
5829 WRITE_COEF(0x45, 0xd089),
5830 WRITE_COEF(0x1b, 0x080b),
5831 WRITE_COEF(0x46, 0x0004),
5832 WRITE_COEF(0x1b, 0x0c0b),
5833 {}
5834 };
5835 static const struct coef_fw alc256fw[] = {
5836 WRITE_COEF(0x1b, 0x884b),
5837 WRITE_COEF(0x45, 0xd089),
5838 WRITE_COEF(0x1b, 0x084b),
5839 WRITE_COEF(0x46, 0x0004),
5840 WRITE_COEF(0x1b, 0x0c4b),
5841 {}
5842 };
5843 switch (codec->core.vendor_id) {
5844 case 0x10ec0255:
5845 alc_process_coef_fw(codec, alc255fw);
5846 break;
5847 case 0x10ec0230:
5848 case 0x10ec0236:
5849 case 0x10ec0256:
5850 case 0x19e58326:
5851 alc_process_coef_fw(codec, alc256fw);
5852 break;
5853 }
5854 msleep(30);
5855 }
5856
5857 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5858 const struct hda_fixup *fix, int action)
5859 {
5860 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5861 alc255_set_default_jack_type(codec);
5862 }
5863 alc_fixup_headset_mode(codec, fix, action);
5864 }
5865
5866 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5867 const struct hda_fixup *fix, int action)
5868 {
5869 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5870 struct alc_spec *spec = codec->spec;
5871 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5872 alc255_set_default_jack_type(codec);
5873 }
5874 else
5875 alc_fixup_headset_mode(codec, fix, action);
5876 }
5877
5878 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5879 struct hda_jack_callback *jack)
5880 {
5881 struct alc_spec *spec = codec->spec;
5882
5883 alc_update_headset_jack_cb(codec, jack);
5884 /* Headset Mic enable or disable, only for Dell Dino */
5885 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5886 }
5887
5888 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5889 const struct hda_fixup *fix, int action)
5890 {
5891 alc_fixup_headset_mode(codec, fix, action);
5892 if (action == HDA_FIXUP_ACT_PROBE) {
5893 struct alc_spec *spec = codec->spec;
5894 /* toggled via hp_automute_hook */
5895 spec->gpio_mask |= 0x40;
5896 spec->gpio_dir |= 0x40;
5897 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5898 }
5899 }
5900
5901 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5902 const struct hda_fixup *fix, int action)
5903 {
5904 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5905 struct alc_spec *spec = codec->spec;
5906 spec->gen.auto_mute_via_amp = 1;
5907 }
5908 }
5909
5910 static void alc_fixup_no_shutup(struct hda_codec *codec,
5911 const struct hda_fixup *fix, int action)
5912 {
5913 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5914 struct alc_spec *spec = codec->spec;
5915 spec->no_shutup_pins = 1;
5916 }
5917 }
5918
5919 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5920 const struct hda_fixup *fix, int action)
5921 {
5922 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5923 struct alc_spec *spec = codec->spec;
5924 /* Disable AA-loopback as it causes white noise */
5925 spec->gen.mixer_nid = 0;
5926 }
5927 }
5928
5929 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5930 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5931 const struct hda_fixup *fix, int action)
5932 {
5933 static const struct hda_pintbl pincfgs[] = {
5934 { 0x16, 0x21211010 }, /* dock headphone */
5935 { 0x19, 0x21a11010 }, /* dock mic */
5936 { }
5937 };
5938 struct alc_spec *spec = codec->spec;
5939
5940 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5941 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5942 codec->power_save_node = 0; /* avoid click noises */
5943 snd_hda_apply_pincfgs(codec, pincfgs);
5944 }
5945 }
5946
5947 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5948 const struct hda_fixup *fix, int action)
5949 {
5950 static const struct hda_pintbl pincfgs[] = {
5951 { 0x17, 0x21211010 }, /* dock headphone */
5952 { 0x19, 0x21a11010 }, /* dock mic */
5953 { }
5954 };
5955 struct alc_spec *spec = codec->spec;
5956
5957 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5958 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5959 snd_hda_apply_pincfgs(codec, pincfgs);
5960 } else if (action == HDA_FIXUP_ACT_INIT) {
5961 /* Enable DOCK device */
5962 snd_hda_codec_write(codec, 0x17, 0,
5963 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5964 /* Enable DOCK device */
5965 snd_hda_codec_write(codec, 0x19, 0,
5966 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5967 }
5968 }
5969
5970 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5971 const struct hda_fixup *fix, int action)
5972 {
5973 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5974 * the speaker output becomes too low by some reason on Thinkpads with
5975 * ALC298 codec
5976 */
5977 static const hda_nid_t preferred_pairs[] = {
5978 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5979 0
5980 };
5981 struct alc_spec *spec = codec->spec;
5982
5983 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5984 spec->gen.preferred_dacs = preferred_pairs;
5985 }
5986
5987 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5988 const struct hda_fixup *fix, int action)
5989 {
5990 static const hda_nid_t preferred_pairs[] = {
5991 0x17, 0x02, 0x21, 0x03, 0
5992 };
5993 struct alc_spec *spec = codec->spec;
5994
5995 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5996 spec->gen.preferred_dacs = preferred_pairs;
5997 }
5998
5999 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6000 {
6001 struct alc_spec *spec = codec->spec;
6002 int hp_pin = alc_get_hp_pin(spec);
6003
6004 /* Prevent pop noises when headphones are plugged in */
6005 snd_hda_codec_write(codec, hp_pin, 0,
6006 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6007 msleep(20);
6008 }
6009
6010 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6011 const struct hda_fixup *fix, int action)
6012 {
6013 struct alc_spec *spec = codec->spec;
6014 struct hda_input_mux *imux = &spec->gen.input_mux;
6015 int i;
6016
6017 switch (action) {
6018 case HDA_FIXUP_ACT_PRE_PROBE:
6019 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6020 * it causes a click noise at start up
6021 */
6022 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6023 spec->shutup = alc_shutup_dell_xps13;
6024 break;
6025 case HDA_FIXUP_ACT_PROBE:
6026 /* Make the internal mic the default input source. */
6027 for (i = 0; i < imux->num_items; i++) {
6028 if (spec->gen.imux_pins[i] == 0x12) {
6029 spec->gen.cur_mux[0] = i;
6030 break;
6031 }
6032 }
6033 break;
6034 }
6035 }
6036
6037 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6038 const struct hda_fixup *fix, int action)
6039 {
6040 struct alc_spec *spec = codec->spec;
6041
6042 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6043 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6044 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6045
6046 /* Disable boost for mic-in permanently. (This code is only called
6047 from quirks that guarantee that the headphone is at NID 0x1b.) */
6048 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6049 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6050 } else
6051 alc_fixup_headset_mode(codec, fix, action);
6052 }
6053
6054 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6055 const struct hda_fixup *fix, int action)
6056 {
6057 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6058 alc_write_coef_idx(codec, 0xc4, 0x8000);
6059 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6060 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6061 }
6062 alc_fixup_headset_mode(codec, fix, action);
6063 }
6064
6065 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
6066 static int find_ext_mic_pin(struct hda_codec *codec)
6067 {
6068 struct alc_spec *spec = codec->spec;
6069 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6070 hda_nid_t nid;
6071 unsigned int defcfg;
6072 int i;
6073
6074 for (i = 0; i < cfg->num_inputs; i++) {
6075 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6076 continue;
6077 nid = cfg->inputs[i].pin;
6078 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6079 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6080 continue;
6081 return nid;
6082 }
6083
6084 return 0;
6085 }
6086
6087 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6088 const struct hda_fixup *fix,
6089 int action)
6090 {
6091 struct alc_spec *spec = codec->spec;
6092
6093 if (action == HDA_FIXUP_ACT_PROBE) {
6094 int mic_pin = find_ext_mic_pin(codec);
6095 int hp_pin = alc_get_hp_pin(spec);
6096
6097 if (snd_BUG_ON(!mic_pin || !hp_pin))
6098 return;
6099 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6100 }
6101 }
6102
6103 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6104 const struct hda_fixup *fix,
6105 int action)
6106 {
6107 struct alc_spec *spec = codec->spec;
6108 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6109 int i;
6110
6111 /* The mic boosts on level 2 and 3 are too noisy
6112 on the internal mic input.
6113 Therefore limit the boost to 0 or 1. */
6114
6115 if (action != HDA_FIXUP_ACT_PROBE)
6116 return;
6117
6118 for (i = 0; i < cfg->num_inputs; i++) {
6119 hda_nid_t nid = cfg->inputs[i].pin;
6120 unsigned int defcfg;
6121 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6122 continue;
6123 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6124 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6125 continue;
6126
6127 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6128 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6129 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6130 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6131 (0 << AC_AMPCAP_MUTE_SHIFT));
6132 }
6133 }
6134
6135 static void alc283_hp_automute_hook(struct hda_codec *codec,
6136 struct hda_jack_callback *jack)
6137 {
6138 struct alc_spec *spec = codec->spec;
6139 int vref;
6140
6141 msleep(200);
6142 snd_hda_gen_hp_automute(codec, jack);
6143
6144 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6145
6146 msleep(600);
6147 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6148 vref);
6149 }
6150
6151 static void alc283_fixup_chromebook(struct hda_codec *codec,
6152 const struct hda_fixup *fix, int action)
6153 {
6154 struct alc_spec *spec = codec->spec;
6155
6156 switch (action) {
6157 case HDA_FIXUP_ACT_PRE_PROBE:
6158 snd_hda_override_wcaps(codec, 0x03, 0);
6159 /* Disable AA-loopback as it causes white noise */
6160 spec->gen.mixer_nid = 0;
6161 break;
6162 case HDA_FIXUP_ACT_INIT:
6163 /* MIC2-VREF control */
6164 /* Set to manual mode */
6165 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6166 /* Enable Line1 input control by verb */
6167 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6168 break;
6169 }
6170 }
6171
6172 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6173 const struct hda_fixup *fix, int action)
6174 {
6175 struct alc_spec *spec = codec->spec;
6176
6177 switch (action) {
6178 case HDA_FIXUP_ACT_PRE_PROBE:
6179 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6180 break;
6181 case HDA_FIXUP_ACT_INIT:
6182 /* MIC2-VREF control */
6183 /* Set to manual mode */
6184 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6185 break;
6186 }
6187 }
6188
6189 /* mute tablet speaker pin (0x14) via dock plugging in addition */
6190 static void asus_tx300_automute(struct hda_codec *codec)
6191 {
6192 struct alc_spec *spec = codec->spec;
6193 snd_hda_gen_update_outputs(codec);
6194 if (snd_hda_jack_detect(codec, 0x1b))
6195 spec->gen.mute_bits |= (1ULL << 0x14);
6196 }
6197
6198 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6199 const struct hda_fixup *fix, int action)
6200 {
6201 struct alc_spec *spec = codec->spec;
6202 static const struct hda_pintbl dock_pins[] = {
6203 { 0x1b, 0x21114000 }, /* dock speaker pin */
6204 {}
6205 };
6206
6207 switch (action) {
6208 case HDA_FIXUP_ACT_PRE_PROBE:
6209 spec->init_amp = ALC_INIT_DEFAULT;
6210 /* TX300 needs to set up GPIO2 for the speaker amp */
6211 alc_setup_gpio(codec, 0x04);
6212 snd_hda_apply_pincfgs(codec, dock_pins);
6213 spec->gen.auto_mute_via_amp = 1;
6214 spec->gen.automute_hook = asus_tx300_automute;
6215 snd_hda_jack_detect_enable_callback(codec, 0x1b,
6216 snd_hda_gen_hp_automute);
6217 break;
6218 case HDA_FIXUP_ACT_PROBE:
6219 spec->init_amp = ALC_INIT_DEFAULT;
6220 break;
6221 case HDA_FIXUP_ACT_BUILD:
6222 /* this is a bit tricky; give more sane names for the main
6223 * (tablet) speaker and the dock speaker, respectively
6224 */
6225 rename_ctl(codec, "Speaker Playback Switch",
6226 "Dock Speaker Playback Switch");
6227 rename_ctl(codec, "Bass Speaker Playback Switch",
6228 "Speaker Playback Switch");
6229 break;
6230 }
6231 }
6232
6233 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6234 const struct hda_fixup *fix, int action)
6235 {
6236 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6237 /* DAC node 0x03 is giving mono output. We therefore want to
6238 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6239 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6240 static const hda_nid_t conn1[] = { 0x0c };
6241 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6242 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6243 }
6244 }
6245
6246 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6247 const struct hda_fixup *fix, int action)
6248 {
6249 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6250 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6251 we can't adjust the speaker's volume since this node does not has
6252 Amp-out capability. we change the speaker's route to:
6253 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6254 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6255 speaker's volume now. */
6256
6257 static const hda_nid_t conn1[] = { 0x0c };
6258 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6259 }
6260 }
6261
6262 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6263 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6264 const struct hda_fixup *fix, int action)
6265 {
6266 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6267 static const hda_nid_t conn[] = { 0x02, 0x03 };
6268 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6269 }
6270 }
6271
6272 /* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6273 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6274 const struct hda_fixup *fix, int action)
6275 {
6276 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6277 static const hda_nid_t conn[] = { 0x02 };
6278 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6279 }
6280 }
6281
6282 /* Hook to update amp GPIO4 for automute */
6283 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6284 struct hda_jack_callback *jack)
6285 {
6286 struct alc_spec *spec = codec->spec;
6287
6288 snd_hda_gen_hp_automute(codec, jack);
6289 /* mute_led_polarity is set to 0, so we pass inverted value here */
6290 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6291 !spec->gen.hp_jack_present);
6292 }
6293
6294 /* Manage GPIOs for HP EliteBook Folio 9480m.
6295 *
6296 * GPIO4 is the headphone amplifier power control
6297 * GPIO3 is the audio output mute indicator LED
6298 */
6299
6300 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6301 const struct hda_fixup *fix,
6302 int action)
6303 {
6304 struct alc_spec *spec = codec->spec;
6305
6306 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6307 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6308 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6309 spec->gpio_mask |= 0x10;
6310 spec->gpio_dir |= 0x10;
6311 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6312 }
6313 }
6314
6315 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6316 const struct hda_fixup *fix,
6317 int action)
6318 {
6319 struct alc_spec *spec = codec->spec;
6320
6321 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6322 spec->gpio_mask |= 0x04;
6323 spec->gpio_dir |= 0x04;
6324 /* set data bit low */
6325 }
6326 }
6327
6328 /* Quirk for Thinkpad X1 7th and 8th Gen
6329 * The following fixed routing needed
6330 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6331 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6332 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6333 */
6334 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6335 const struct hda_fixup *fix, int action)
6336 {
6337 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6338 static const hda_nid_t preferred_pairs[] = {
6339 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6340 };
6341 struct alc_spec *spec = codec->spec;
6342
6343 switch (action) {
6344 case HDA_FIXUP_ACT_PRE_PROBE:
6345 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6346 spec->gen.preferred_dacs = preferred_pairs;
6347 break;
6348 case HDA_FIXUP_ACT_BUILD:
6349 /* The generic parser creates somewhat unintuitive volume ctls
6350 * with the fixed routing above, and the shared DAC2 may be
6351 * confusing for PA.
6352 * Rename those to unique names so that PA doesn't touch them
6353 * and use only Master volume.
6354 */
6355 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6356 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6357 break;
6358 }
6359 }
6360
6361 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6362 const struct hda_fixup *fix,
6363 int action)
6364 {
6365 alc_fixup_dual_codecs(codec, fix, action);
6366 switch (action) {
6367 case HDA_FIXUP_ACT_PRE_PROBE:
6368 /* override card longname to provide a unique UCM profile */
6369 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6370 break;
6371 case HDA_FIXUP_ACT_BUILD:
6372 /* rename Capture controls depending on the codec */
6373 rename_ctl(codec, "Capture Volume",
6374 codec->addr == 0 ?
6375 "Rear-Panel Capture Volume" :
6376 "Front-Panel Capture Volume");
6377 rename_ctl(codec, "Capture Switch",
6378 codec->addr == 0 ?
6379 "Rear-Panel Capture Switch" :
6380 "Front-Panel Capture Switch");
6381 break;
6382 }
6383 }
6384
6385 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6386 const struct hda_fixup *fix, int action)
6387 {
6388 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6389 return;
6390
6391 codec->power_save_node = 1;
6392 }
6393
6394 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6395 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6396 const struct hda_fixup *fix, int action)
6397 {
6398 struct alc_spec *spec = codec->spec;
6399 static const hda_nid_t preferred_pairs[] = {
6400 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6401 0
6402 };
6403
6404 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6405 return;
6406
6407 spec->gen.preferred_dacs = preferred_pairs;
6408 spec->gen.auto_mute_via_amp = 1;
6409 codec->power_save_node = 0;
6410 }
6411
6412 /* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6413 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6414 const struct hda_fixup *fix, int action)
6415 {
6416 static const hda_nid_t preferred_pairs[] = {
6417 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6418 };
6419 struct alc_spec *spec = codec->spec;
6420
6421 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6422 spec->gen.preferred_dacs = preferred_pairs;
6423 spec->gen.obey_preferred_dacs = 1;
6424 }
6425 }
6426
6427 /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6428 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6429 const struct hda_fixup *fix, int action)
6430 {
6431 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6432 return;
6433
6434 snd_hda_override_wcaps(codec, 0x03, 0);
6435 }
6436
6437 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6438 {
6439 switch (codec->core.vendor_id) {
6440 case 0x10ec0274:
6441 case 0x10ec0294:
6442 case 0x10ec0225:
6443 case 0x10ec0295:
6444 case 0x10ec0299:
6445 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6446 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6447 break;
6448 case 0x10ec0230:
6449 case 0x10ec0235:
6450 case 0x10ec0236:
6451 case 0x10ec0255:
6452 case 0x10ec0256:
6453 case 0x19e58326:
6454 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6455 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6456 break;
6457 }
6458 }
6459
6460 static void alc295_fixup_chromebook(struct hda_codec *codec,
6461 const struct hda_fixup *fix, int action)
6462 {
6463 struct alc_spec *spec = codec->spec;
6464
6465 switch (action) {
6466 case HDA_FIXUP_ACT_PRE_PROBE:
6467 spec->ultra_low_power = true;
6468 break;
6469 case HDA_FIXUP_ACT_INIT:
6470 alc_combo_jack_hp_jd_restart(codec);
6471 break;
6472 }
6473 }
6474
6475 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6476 const struct hda_fixup *fix, int action)
6477 {
6478 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6479 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6480 }
6481
6482
6483 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6484 struct hda_jack_callback *cb)
6485 {
6486 /* The Windows driver sets the codec up in a very different way where
6487 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6488 */
6489 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6490 alc_write_coef_idx(codec, 0x10, 0x8a20);
6491 else
6492 alc_write_coef_idx(codec, 0x10, 0x0a20);
6493 }
6494
6495 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6496 const struct hda_fixup *fix, int action)
6497 {
6498 /* Pin 0x21: headphones/headset mic */
6499 if (!is_jack_detectable(codec, 0x21))
6500 return;
6501
6502 switch (action) {
6503 case HDA_FIXUP_ACT_PRE_PROBE:
6504 snd_hda_jack_detect_enable_callback(codec, 0x21,
6505 alc294_gx502_toggle_output);
6506 break;
6507 case HDA_FIXUP_ACT_INIT:
6508 /* Make sure to start in a correct state, i.e. if
6509 * headphones have been plugged in before powering up the system
6510 */
6511 alc294_gx502_toggle_output(codec, NULL);
6512 break;
6513 }
6514 }
6515
6516 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6517 struct hda_jack_callback *cb)
6518 {
6519 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6520 * responsible from changes between speakers and headphones
6521 */
6522 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6523 alc_write_coef_idx(codec, 0x10, 0x8420);
6524 else
6525 alc_write_coef_idx(codec, 0x10, 0x0a20);
6526 }
6527
6528 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6529 const struct hda_fixup *fix, int action)
6530 {
6531 if (!is_jack_detectable(codec, 0x21))
6532 return;
6533
6534 switch (action) {
6535 case HDA_FIXUP_ACT_PRE_PROBE:
6536 snd_hda_jack_detect_enable_callback(codec, 0x21,
6537 alc294_gu502_toggle_output);
6538 break;
6539 case HDA_FIXUP_ACT_INIT:
6540 alc294_gu502_toggle_output(codec, NULL);
6541 break;
6542 }
6543 }
6544
6545 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6546 const struct hda_fixup *fix, int action)
6547 {
6548 if (action != HDA_FIXUP_ACT_INIT)
6549 return;
6550
6551 msleep(100);
6552 alc_write_coef_idx(codec, 0x65, 0x0);
6553 }
6554
6555 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6556 const struct hda_fixup *fix, int action)
6557 {
6558 switch (action) {
6559 case HDA_FIXUP_ACT_INIT:
6560 alc_combo_jack_hp_jd_restart(codec);
6561 break;
6562 }
6563 }
6564
6565 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6566 const struct hda_fixup *fix, int action)
6567 {
6568 struct alc_spec *spec = codec->spec;
6569
6570 switch (action) {
6571 case HDA_FIXUP_ACT_PRE_PROBE:
6572 /* Mic RING SLEEVE swap for combo jack */
6573 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6574 spec->no_internal_mic_pin = true;
6575 break;
6576 case HDA_FIXUP_ACT_INIT:
6577 alc_combo_jack_hp_jd_restart(codec);
6578 break;
6579 }
6580 }
6581
6582 /* GPIO1 = amplifier on/off
6583 * GPIO3 = mic mute LED
6584 */
6585 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6586 const struct hda_fixup *fix, int action)
6587 {
6588 static const hda_nid_t conn[] = { 0x02 };
6589
6590 struct alc_spec *spec = codec->spec;
6591 static const struct hda_pintbl pincfgs[] = {
6592 { 0x14, 0x90170110 }, /* front/high speakers */
6593 { 0x17, 0x90170130 }, /* back/bass speakers */
6594 { }
6595 };
6596
6597 //enable micmute led
6598 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6599
6600 switch (action) {
6601 case HDA_FIXUP_ACT_PRE_PROBE:
6602 spec->micmute_led_polarity = 1;
6603 /* needed for amp of back speakers */
6604 spec->gpio_mask |= 0x01;
6605 spec->gpio_dir |= 0x01;
6606 snd_hda_apply_pincfgs(codec, pincfgs);
6607 /* share DAC to have unified volume control */
6608 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6609 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6610 break;
6611 case HDA_FIXUP_ACT_INIT:
6612 /* need to toggle GPIO to enable the amp of back speakers */
6613 alc_update_gpio_data(codec, 0x01, true);
6614 msleep(100);
6615 alc_update_gpio_data(codec, 0x01, false);
6616 break;
6617 }
6618 }
6619
6620 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6621 const struct hda_fixup *fix, int action)
6622 {
6623 static const hda_nid_t conn[] = { 0x02 };
6624 static const struct hda_pintbl pincfgs[] = {
6625 { 0x14, 0x90170110 }, /* rear speaker */
6626 { }
6627 };
6628
6629 switch (action) {
6630 case HDA_FIXUP_ACT_PRE_PROBE:
6631 snd_hda_apply_pincfgs(codec, pincfgs);
6632 /* force front speaker to DAC1 */
6633 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6634 break;
6635 }
6636 }
6637
6638 /* for hda_fixup_thinkpad_acpi() */
6639 #include "thinkpad_helper.c"
6640
6641 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6642 const struct hda_fixup *fix, int action)
6643 {
6644 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6645 hda_fixup_thinkpad_acpi(codec, fix, action);
6646 }
6647
6648 /* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6649 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6650 const struct hda_fixup *fix,
6651 int action)
6652 {
6653 struct alc_spec *spec = codec->spec;
6654
6655 switch (action) {
6656 case HDA_FIXUP_ACT_PRE_PROBE:
6657 spec->gen.suppress_auto_mute = 1;
6658 break;
6659 }
6660 }
6661
6662 static int comp_bind(struct device *dev)
6663 {
6664 struct hda_codec *cdc = dev_to_hda_codec(dev);
6665 struct alc_spec *spec = cdc->spec;
6666 int ret, i;
6667
6668 ret = component_bind_all(dev, spec->comps);
6669 if (ret)
6670 return ret;
6671
6672 if (snd_hdac_is_power_on(&cdc->core)) {
6673 codec_dbg(cdc, "Resuming after bind.\n");
6674 for (i = 0; i < HDA_MAX_COMPONENTS; i++)
6675 if (spec->comps[i].resume_hook)
6676 spec->comps[i].resume_hook(spec->comps[i].dev);
6677 }
6678
6679 return 0;
6680 }
6681
6682 static void comp_unbind(struct device *dev)
6683 {
6684 struct hda_codec *cdc = dev_to_hda_codec(dev);
6685 struct alc_spec *spec = cdc->spec;
6686
6687 component_unbind_all(dev, spec->comps);
6688 }
6689
6690 static const struct component_master_ops comp_master_ops = {
6691 .bind = comp_bind,
6692 .unbind = comp_unbind,
6693 };
6694
6695 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6696 struct snd_pcm_substream *sub, int action)
6697 {
6698 struct alc_spec *spec = cdc->spec;
6699 int i;
6700
6701 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6702 if (spec->comps[i].dev)
6703 spec->comps[i].playback_hook(spec->comps[i].dev, action);
6704 }
6705 }
6706
6707 static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6708 const char *hid, int count)
6709 {
6710 struct device *dev = hda_codec_dev(cdc);
6711 struct alc_spec *spec = cdc->spec;
6712 char *name;
6713 int ret, i;
6714
6715 switch (action) {
6716 case HDA_FIXUP_ACT_PRE_PROBE:
6717 for (i = 0; i < count; i++) {
6718 name = devm_kasprintf(dev, GFP_KERNEL,
6719 "%s-%s:00-cs35l41-hda.%d", bus, hid, i);
6720 if (!name)
6721 return;
6722 spec->comps[i].codec = cdc;
6723 component_match_add(dev, &spec->match, component_compare_dev_name, name);
6724 }
6725 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6726 if (ret)
6727 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6728 else
6729 spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6730 break;
6731 }
6732 }
6733
6734 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6735 {
6736 cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6737 }
6738
6739 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6740 {
6741 cs35l41_generic_fixup(codec, action, "spi0", "CSC3551", 2);
6742 }
6743
6744 static void cs35l41_fixup_spi1_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6745 {
6746 cs35l41_generic_fixup(codec, action, "spi1", "CSC3551", 2);
6747 }
6748
6749 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6750 {
6751 cs35l41_generic_fixup(codec, action, "spi0", "CSC3551", 4);
6752 }
6753
6754 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6755 int action)
6756 {
6757 cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
6758 }
6759
6760 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6761 int action)
6762 {
6763 cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0101", 2);
6764 }
6765
6766 /* for alc295_fixup_hp_top_speakers */
6767 #include "hp_x360_helper.c"
6768
6769 /* for alc285_fixup_ideapad_s740_coef() */
6770 #include "ideapad_s740_helper.c"
6771
6772 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6773 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6774 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6775 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6776 {}
6777 };
6778
6779 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6780 const struct hda_fixup *fix,
6781 int action)
6782 {
6783 /*
6784 * A certain other OS sets these coeffs to different values. On at least
6785 * one TongFang barebone these settings might survive even a cold
6786 * reboot. So to restore a clean slate the values are explicitly reset
6787 * to default here. Without this, the external microphone is always in a
6788 * plugged-in state, while the internal microphone is always in an
6789 * unplugged state, breaking the ability to use the internal microphone.
6790 */
6791 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
6792 }
6793
6794 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6795 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6796 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6797 WRITE_COEF(0x49, 0x0149),
6798 {}
6799 };
6800
6801 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6802 const struct hda_fixup *fix,
6803 int action)
6804 {
6805 /*
6806 * The audio jack input and output is not detected on the ASRock NUC Box
6807 * 1100 series when cold booting without this fix. Warm rebooting from a
6808 * certain other OS makes the audio functional, as COEF settings are
6809 * preserved in this case. This fix sets these altered COEF values as
6810 * the default.
6811 */
6812 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6813 }
6814
6815 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6816 const struct hda_fixup *fix,
6817 int action)
6818 {
6819 /*
6820 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6821 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6822 * needs an additional quirk for sound working after suspend and resume.
6823 */
6824 if (codec->core.vendor_id == 0x10ec0256) {
6825 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6826 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6827 } else {
6828 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6829 }
6830 }
6831
6832 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
6833 const struct hda_fixup *fix,
6834 int action)
6835 {
6836 struct alc_spec *spec = codec->spec;
6837 struct hda_input_mux *imux = &spec->gen.input_mux;
6838 int i;
6839
6840 alc269_fixup_limit_int_mic_boost(codec, fix, action);
6841
6842 switch (action) {
6843 case HDA_FIXUP_ACT_PRE_PROBE:
6844 /**
6845 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
6846 * to Hi-Z to avoid pop noises at startup and when plugging and
6847 * unplugging headphones.
6848 */
6849 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6850 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
6851 break;
6852 case HDA_FIXUP_ACT_PROBE:
6853 /**
6854 * Make the internal mic (0x12) the default input source to
6855 * prevent pop noises on cold boot.
6856 */
6857 for (i = 0; i < imux->num_items; i++) {
6858 if (spec->gen.imux_pins[i] == 0x12) {
6859 spec->gen.cur_mux[0] = i;
6860 break;
6861 }
6862 }
6863 break;
6864 }
6865 }
6866
6867 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
6868 const struct hda_fixup *fix, int action)
6869 {
6870 /*
6871 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
6872 * unconnected.
6873 */
6874 static const struct hda_pintbl pincfgs[] = {
6875 { 0x17, 0x90170121 },
6876 { }
6877 };
6878 /*
6879 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
6880 * DAC 0x02 and 0x03 would be fine.
6881 */
6882 static const hda_nid_t conn[] = { 0x02, 0x03 };
6883 /*
6884 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
6885 * Headphones (0x21) are connected to DAC 0x03.
6886 */
6887 static const hda_nid_t preferred_pairs[] = {
6888 0x14, 0x02,
6889 0x17, 0x02,
6890 0x21, 0x03,
6891 0
6892 };
6893 struct alc_spec *spec = codec->spec;
6894
6895 switch (action) {
6896 case HDA_FIXUP_ACT_PRE_PROBE:
6897 snd_hda_apply_pincfgs(codec, pincfgs);
6898 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6899 spec->gen.preferred_dacs = preferred_pairs;
6900 break;
6901 }
6902 }
6903
6904 enum {
6905 ALC269_FIXUP_GPIO2,
6906 ALC269_FIXUP_SONY_VAIO,
6907 ALC275_FIXUP_SONY_VAIO_GPIO2,
6908 ALC269_FIXUP_DELL_M101Z,
6909 ALC269_FIXUP_SKU_IGNORE,
6910 ALC269_FIXUP_ASUS_G73JW,
6911 ALC269_FIXUP_LENOVO_EAPD,
6912 ALC275_FIXUP_SONY_HWEQ,
6913 ALC275_FIXUP_SONY_DISABLE_AAMIX,
6914 ALC271_FIXUP_DMIC,
6915 ALC269_FIXUP_PCM_44K,
6916 ALC269_FIXUP_STEREO_DMIC,
6917 ALC269_FIXUP_HEADSET_MIC,
6918 ALC269_FIXUP_QUANTA_MUTE,
6919 ALC269_FIXUP_LIFEBOOK,
6920 ALC269_FIXUP_LIFEBOOK_EXTMIC,
6921 ALC269_FIXUP_LIFEBOOK_HP_PIN,
6922 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
6923 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
6924 ALC269_FIXUP_AMIC,
6925 ALC269_FIXUP_DMIC,
6926 ALC269VB_FIXUP_AMIC,
6927 ALC269VB_FIXUP_DMIC,
6928 ALC269_FIXUP_HP_MUTE_LED,
6929 ALC269_FIXUP_HP_MUTE_LED_MIC1,
6930 ALC269_FIXUP_HP_MUTE_LED_MIC2,
6931 ALC269_FIXUP_HP_MUTE_LED_MIC3,
6932 ALC269_FIXUP_HP_GPIO_LED,
6933 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6934 ALC269_FIXUP_HP_LINE1_MIC1_LED,
6935 ALC269_FIXUP_INV_DMIC,
6936 ALC269_FIXUP_LENOVO_DOCK,
6937 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
6938 ALC269_FIXUP_NO_SHUTUP,
6939 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
6940 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
6941 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6942 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6943 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6944 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6945 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
6946 ALC269_FIXUP_HEADSET_MODE,
6947 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
6948 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
6949 ALC269_FIXUP_ASUS_X101_FUNC,
6950 ALC269_FIXUP_ASUS_X101_VERB,
6951 ALC269_FIXUP_ASUS_X101,
6952 ALC271_FIXUP_AMIC_MIC2,
6953 ALC271_FIXUP_HP_GATE_MIC_JACK,
6954 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
6955 ALC269_FIXUP_ACER_AC700,
6956 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
6957 ALC269VB_FIXUP_ASUS_ZENBOOK,
6958 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
6959 ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
6960 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
6961 ALC269VB_FIXUP_ORDISSIMO_EVE2,
6962 ALC283_FIXUP_CHROME_BOOK,
6963 ALC283_FIXUP_SENSE_COMBO_JACK,
6964 ALC282_FIXUP_ASUS_TX300,
6965 ALC283_FIXUP_INT_MIC,
6966 ALC290_FIXUP_MONO_SPEAKERS,
6967 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6968 ALC290_FIXUP_SUBWOOFER,
6969 ALC290_FIXUP_SUBWOOFER_HSJACK,
6970 ALC269_FIXUP_THINKPAD_ACPI,
6971 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
6972 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
6973 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6974 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6975 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
6976 ALC255_FIXUP_HEADSET_MODE,
6977 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
6978 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
6979 ALC292_FIXUP_TPT440_DOCK,
6980 ALC292_FIXUP_TPT440,
6981 ALC283_FIXUP_HEADSET_MIC,
6982 ALC255_FIXUP_MIC_MUTE_LED,
6983 ALC282_FIXUP_ASPIRE_V5_PINS,
6984 ALC269VB_FIXUP_ASPIRE_E1_COEF,
6985 ALC280_FIXUP_HP_GPIO4,
6986 ALC286_FIXUP_HP_GPIO_LED,
6987 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
6988 ALC280_FIXUP_HP_DOCK_PINS,
6989 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
6990 ALC280_FIXUP_HP_9480M,
6991 ALC245_FIXUP_HP_X360_AMP,
6992 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
6993 ALC288_FIXUP_DELL_HEADSET_MODE,
6994 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
6995 ALC288_FIXUP_DELL_XPS_13,
6996 ALC288_FIXUP_DISABLE_AAMIX,
6997 ALC292_FIXUP_DELL_E7X_AAMIX,
6998 ALC292_FIXUP_DELL_E7X,
6999 ALC292_FIXUP_DISABLE_AAMIX,
7000 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7001 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7002 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7003 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7004 ALC275_FIXUP_DELL_XPS,
7005 ALC293_FIXUP_LENOVO_SPK_NOISE,
7006 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7007 ALC255_FIXUP_DELL_SPK_NOISE,
7008 ALC225_FIXUP_DISABLE_MIC_VREF,
7009 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7010 ALC295_FIXUP_DISABLE_DAC3,
7011 ALC285_FIXUP_SPEAKER2_TO_DAC1,
7012 ALC280_FIXUP_HP_HEADSET_MIC,
7013 ALC221_FIXUP_HP_FRONT_MIC,
7014 ALC292_FIXUP_TPT460,
7015 ALC298_FIXUP_SPK_VOLUME,
7016 ALC298_FIXUP_LENOVO_SPK_VOLUME,
7017 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7018 ALC269_FIXUP_ATIV_BOOK_8,
7019 ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7020 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7021 ALC256_FIXUP_ASUS_HEADSET_MODE,
7022 ALC256_FIXUP_ASUS_MIC,
7023 ALC256_FIXUP_ASUS_AIO_GPIO2,
7024 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7025 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7026 ALC233_FIXUP_LENOVO_MULTI_CODECS,
7027 ALC233_FIXUP_ACER_HEADSET_MIC,
7028 ALC294_FIXUP_LENOVO_MIC_LOCATION,
7029 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7030 ALC225_FIXUP_S3_POP_NOISE,
7031 ALC700_FIXUP_INTEL_REFERENCE,
7032 ALC274_FIXUP_DELL_BIND_DACS,
7033 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7034 ALC298_FIXUP_TPT470_DOCK_FIX,
7035 ALC298_FIXUP_TPT470_DOCK,
7036 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7037 ALC255_FIXUP_DELL_HEADSET_MIC,
7038 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7039 ALC298_FIXUP_HUAWEI_MBX_STEREO,
7040 ALC295_FIXUP_HP_X360,
7041 ALC221_FIXUP_HP_HEADSET_MIC,
7042 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7043 ALC295_FIXUP_HP_AUTO_MUTE,
7044 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7045 ALC294_FIXUP_ASUS_MIC,
7046 ALC294_FIXUP_ASUS_HEADSET_MIC,
7047 ALC294_FIXUP_ASUS_SPK,
7048 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7049 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7050 ALC255_FIXUP_ACER_HEADSET_MIC,
7051 ALC295_FIXUP_CHROME_BOOK,
7052 ALC225_FIXUP_HEADSET_JACK,
7053 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7054 ALC225_FIXUP_WYSE_AUTO_MUTE,
7055 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7056 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7057 ALC256_FIXUP_ASUS_HEADSET_MIC,
7058 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7059 ALC299_FIXUP_PREDATOR_SPK,
7060 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7061 ALC289_FIXUP_DELL_SPK2,
7062 ALC289_FIXUP_DUAL_SPK,
7063 ALC294_FIXUP_SPK2_TO_DAC1,
7064 ALC294_FIXUP_ASUS_DUAL_SPK,
7065 ALC285_FIXUP_THINKPAD_X1_GEN7,
7066 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7067 ALC294_FIXUP_ASUS_HPE,
7068 ALC294_FIXUP_ASUS_COEF_1B,
7069 ALC294_FIXUP_ASUS_GX502_HP,
7070 ALC294_FIXUP_ASUS_GX502_PINS,
7071 ALC294_FIXUP_ASUS_GX502_VERBS,
7072 ALC294_FIXUP_ASUS_GU502_HP,
7073 ALC294_FIXUP_ASUS_GU502_PINS,
7074 ALC294_FIXUP_ASUS_GU502_VERBS,
7075 ALC294_FIXUP_ASUS_G513_PINS,
7076 ALC285_FIXUP_ASUS_G533Z_PINS,
7077 ALC285_FIXUP_HP_GPIO_LED,
7078 ALC285_FIXUP_HP_MUTE_LED,
7079 ALC236_FIXUP_HP_GPIO_LED,
7080 ALC236_FIXUP_HP_MUTE_LED,
7081 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7082 ALC298_FIXUP_SAMSUNG_AMP,
7083 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7084 ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7085 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7086 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7087 ALC269VC_FIXUP_ACER_HEADSET_MIC,
7088 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7089 ALC289_FIXUP_ASUS_GA401,
7090 ALC289_FIXUP_ASUS_GA502,
7091 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7092 ALC285_FIXUP_HP_GPIO_AMP_INIT,
7093 ALC269_FIXUP_CZC_B20,
7094 ALC269_FIXUP_CZC_TMI,
7095 ALC269_FIXUP_CZC_L101,
7096 ALC269_FIXUP_LEMOTE_A1802,
7097 ALC269_FIXUP_LEMOTE_A190X,
7098 ALC256_FIXUP_INTEL_NUC8_RUGGED,
7099 ALC233_FIXUP_INTEL_NUC8_DMIC,
7100 ALC233_FIXUP_INTEL_NUC8_BOOST,
7101 ALC256_FIXUP_INTEL_NUC10,
7102 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7103 ALC274_FIXUP_HP_MIC,
7104 ALC274_FIXUP_HP_HEADSET_MIC,
7105 ALC274_FIXUP_HP_ENVY_GPIO,
7106 ALC256_FIXUP_ASUS_HPE,
7107 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7108 ALC287_FIXUP_HP_GPIO_LED,
7109 ALC256_FIXUP_HP_HEADSET_MIC,
7110 ALC245_FIXUP_HP_GPIO_LED,
7111 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7112 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7113 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7114 ALC256_FIXUP_ACER_HEADSET_MIC,
7115 ALC285_FIXUP_IDEAPAD_S740_COEF,
7116 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7117 ALC295_FIXUP_ASUS_DACS,
7118 ALC295_FIXUP_HP_OMEN,
7119 ALC285_FIXUP_HP_SPECTRE_X360,
7120 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7121 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7122 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7123 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7124 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7125 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7126 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7127 ALC298_FIXUP_LENOVO_C940_DUET7,
7128 ALC287_FIXUP_13S_GEN2_SPEAKERS,
7129 ALC256_FIXUP_SET_COEF_DEFAULTS,
7130 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7131 ALC233_FIXUP_NO_AUDIO_JACK,
7132 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7133 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7134 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7135 ALC287_FIXUP_LEGION_16ACHG6,
7136 ALC287_FIXUP_CS35L41_I2C_2,
7137 ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7138 ALC245_FIXUP_CS35L41_SPI_2,
7139 ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7140 ALC245_FIXUP_CS35L41_SPI1_2,
7141 ALC245_FIXUP_CS35L41_SPI1_2_HP_GPIO_LED,
7142 ALC245_FIXUP_CS35L41_SPI_4,
7143 ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7144 ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7145 ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7146 ALC287_FIXUP_LEGION_16ITHG6,
7147 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7148 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7149 };
7150
7151 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7152 * both have the very same PCI SSID, and we need to apply different fixups
7153 * depending on the codec ID
7154 */
7155 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7156 const struct hda_fixup *fix,
7157 int action)
7158 {
7159 int id;
7160
7161 if (codec->core.vendor_id == 0x10ec0298)
7162 id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7163 else
7164 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7165 __snd_hda_apply_fixup(codec, id, action, 0);
7166 }
7167
7168 static const struct hda_fixup alc269_fixups[] = {
7169 [ALC269_FIXUP_GPIO2] = {
7170 .type = HDA_FIXUP_FUNC,
7171 .v.func = alc_fixup_gpio2,
7172 },
7173 [ALC269_FIXUP_SONY_VAIO] = {
7174 .type = HDA_FIXUP_PINCTLS,
7175 .v.pins = (const struct hda_pintbl[]) {
7176 {0x19, PIN_VREFGRD},
7177 {}
7178 }
7179 },
7180 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7181 .type = HDA_FIXUP_FUNC,
7182 .v.func = alc275_fixup_gpio4_off,
7183 .chained = true,
7184 .chain_id = ALC269_FIXUP_SONY_VAIO
7185 },
7186 [ALC269_FIXUP_DELL_M101Z] = {
7187 .type = HDA_FIXUP_VERBS,
7188 .v.verbs = (const struct hda_verb[]) {
7189 /* Enables internal speaker */
7190 {0x20, AC_VERB_SET_COEF_INDEX, 13},
7191 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7192 {}
7193 }
7194 },
7195 [ALC269_FIXUP_SKU_IGNORE] = {
7196 .type = HDA_FIXUP_FUNC,
7197 .v.func = alc_fixup_sku_ignore,
7198 },
7199 [ALC269_FIXUP_ASUS_G73JW] = {
7200 .type = HDA_FIXUP_PINS,
7201 .v.pins = (const struct hda_pintbl[]) {
7202 { 0x17, 0x99130111 }, /* subwoofer */
7203 { }
7204 }
7205 },
7206 [ALC269_FIXUP_LENOVO_EAPD] = {
7207 .type = HDA_FIXUP_VERBS,
7208 .v.verbs = (const struct hda_verb[]) {
7209 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7210 {}
7211 }
7212 },
7213 [ALC275_FIXUP_SONY_HWEQ] = {
7214 .type = HDA_FIXUP_FUNC,
7215 .v.func = alc269_fixup_hweq,
7216 .chained = true,
7217 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7218 },
7219 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7220 .type = HDA_FIXUP_FUNC,
7221 .v.func = alc_fixup_disable_aamix,
7222 .chained = true,
7223 .chain_id = ALC269_FIXUP_SONY_VAIO
7224 },
7225 [ALC271_FIXUP_DMIC] = {
7226 .type = HDA_FIXUP_FUNC,
7227 .v.func = alc271_fixup_dmic,
7228 },
7229 [ALC269_FIXUP_PCM_44K] = {
7230 .type = HDA_FIXUP_FUNC,
7231 .v.func = alc269_fixup_pcm_44k,
7232 .chained = true,
7233 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7234 },
7235 [ALC269_FIXUP_STEREO_DMIC] = {
7236 .type = HDA_FIXUP_FUNC,
7237 .v.func = alc269_fixup_stereo_dmic,
7238 },
7239 [ALC269_FIXUP_HEADSET_MIC] = {
7240 .type = HDA_FIXUP_FUNC,
7241 .v.func = alc269_fixup_headset_mic,
7242 },
7243 [ALC269_FIXUP_QUANTA_MUTE] = {
7244 .type = HDA_FIXUP_FUNC,
7245 .v.func = alc269_fixup_quanta_mute,
7246 },
7247 [ALC269_FIXUP_LIFEBOOK] = {
7248 .type = HDA_FIXUP_PINS,
7249 .v.pins = (const struct hda_pintbl[]) {
7250 { 0x1a, 0x2101103f }, /* dock line-out */
7251 { 0x1b, 0x23a11040 }, /* dock mic-in */
7252 { }
7253 },
7254 .chained = true,
7255 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7256 },
7257 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7258 .type = HDA_FIXUP_PINS,
7259 .v.pins = (const struct hda_pintbl[]) {
7260 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7261 { }
7262 },
7263 },
7264 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7265 .type = HDA_FIXUP_PINS,
7266 .v.pins = (const struct hda_pintbl[]) {
7267 { 0x21, 0x0221102f }, /* HP out */
7268 { }
7269 },
7270 },
7271 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7272 .type = HDA_FIXUP_FUNC,
7273 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7274 },
7275 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7276 .type = HDA_FIXUP_FUNC,
7277 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7278 },
7279 [ALC269_FIXUP_AMIC] = {
7280 .type = HDA_FIXUP_PINS,
7281 .v.pins = (const struct hda_pintbl[]) {
7282 { 0x14, 0x99130110 }, /* speaker */
7283 { 0x15, 0x0121401f }, /* HP out */
7284 { 0x18, 0x01a19c20 }, /* mic */
7285 { 0x19, 0x99a3092f }, /* int-mic */
7286 { }
7287 },
7288 },
7289 [ALC269_FIXUP_DMIC] = {
7290 .type = HDA_FIXUP_PINS,
7291 .v.pins = (const struct hda_pintbl[]) {
7292 { 0x12, 0x99a3092f }, /* int-mic */
7293 { 0x14, 0x99130110 }, /* speaker */
7294 { 0x15, 0x0121401f }, /* HP out */
7295 { 0x18, 0x01a19c20 }, /* mic */
7296 { }
7297 },
7298 },
7299 [ALC269VB_FIXUP_AMIC] = {
7300 .type = HDA_FIXUP_PINS,
7301 .v.pins = (const struct hda_pintbl[]) {
7302 { 0x14, 0x99130110 }, /* speaker */
7303 { 0x18, 0x01a19c20 }, /* mic */
7304 { 0x19, 0x99a3092f }, /* int-mic */
7305 { 0x21, 0x0121401f }, /* HP out */
7306 { }
7307 },
7308 },
7309 [ALC269VB_FIXUP_DMIC] = {
7310 .type = HDA_FIXUP_PINS,
7311 .v.pins = (const struct hda_pintbl[]) {
7312 { 0x12, 0x99a3092f }, /* int-mic */
7313 { 0x14, 0x99130110 }, /* speaker */
7314 { 0x18, 0x01a19c20 }, /* mic */
7315 { 0x21, 0x0121401f }, /* HP out */
7316 { }
7317 },
7318 },
7319 [ALC269_FIXUP_HP_MUTE_LED] = {
7320 .type = HDA_FIXUP_FUNC,
7321 .v.func = alc269_fixup_hp_mute_led,
7322 },
7323 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7324 .type = HDA_FIXUP_FUNC,
7325 .v.func = alc269_fixup_hp_mute_led_mic1,
7326 },
7327 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7328 .type = HDA_FIXUP_FUNC,
7329 .v.func = alc269_fixup_hp_mute_led_mic2,
7330 },
7331 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7332 .type = HDA_FIXUP_FUNC,
7333 .v.func = alc269_fixup_hp_mute_led_mic3,
7334 .chained = true,
7335 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7336 },
7337 [ALC269_FIXUP_HP_GPIO_LED] = {
7338 .type = HDA_FIXUP_FUNC,
7339 .v.func = alc269_fixup_hp_gpio_led,
7340 },
7341 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7342 .type = HDA_FIXUP_FUNC,
7343 .v.func = alc269_fixup_hp_gpio_mic1_led,
7344 },
7345 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7346 .type = HDA_FIXUP_FUNC,
7347 .v.func = alc269_fixup_hp_line1_mic1_led,
7348 },
7349 [ALC269_FIXUP_INV_DMIC] = {
7350 .type = HDA_FIXUP_FUNC,
7351 .v.func = alc_fixup_inv_dmic,
7352 },
7353 [ALC269_FIXUP_NO_SHUTUP] = {
7354 .type = HDA_FIXUP_FUNC,
7355 .v.func = alc_fixup_no_shutup,
7356 },
7357 [ALC269_FIXUP_LENOVO_DOCK] = {
7358 .type = HDA_FIXUP_PINS,
7359 .v.pins = (const struct hda_pintbl[]) {
7360 { 0x19, 0x23a11040 }, /* dock mic */
7361 { 0x1b, 0x2121103f }, /* dock headphone */
7362 { }
7363 },
7364 .chained = true,
7365 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7366 },
7367 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7368 .type = HDA_FIXUP_FUNC,
7369 .v.func = alc269_fixup_limit_int_mic_boost,
7370 .chained = true,
7371 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7372 },
7373 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7374 .type = HDA_FIXUP_FUNC,
7375 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7376 .chained = true,
7377 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7378 },
7379 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7380 .type = HDA_FIXUP_PINS,
7381 .v.pins = (const struct hda_pintbl[]) {
7382 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7383 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7384 { }
7385 },
7386 .chained = true,
7387 .chain_id = ALC269_FIXUP_HEADSET_MODE
7388 },
7389 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7390 .type = HDA_FIXUP_PINS,
7391 .v.pins = (const struct hda_pintbl[]) {
7392 { 0x16, 0x21014020 }, /* dock line out */
7393 { 0x19, 0x21a19030 }, /* dock mic */
7394 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7395 { }
7396 },
7397 .chained = true,
7398 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7399 },
7400 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7401 .type = HDA_FIXUP_PINS,
7402 .v.pins = (const struct hda_pintbl[]) {
7403 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7404 { }
7405 },
7406 .chained = true,
7407 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7408 },
7409 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7410 .type = HDA_FIXUP_PINS,
7411 .v.pins = (const struct hda_pintbl[]) {
7412 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7413 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7414 { }
7415 },
7416 .chained = true,
7417 .chain_id = ALC269_FIXUP_HEADSET_MODE
7418 },
7419 [ALC269_FIXUP_HEADSET_MODE] = {
7420 .type = HDA_FIXUP_FUNC,
7421 .v.func = alc_fixup_headset_mode,
7422 .chained = true,
7423 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7424 },
7425 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7426 .type = HDA_FIXUP_FUNC,
7427 .v.func = alc_fixup_headset_mode_no_hp_mic,
7428 },
7429 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7430 .type = HDA_FIXUP_PINS,
7431 .v.pins = (const struct hda_pintbl[]) {
7432 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7433 { }
7434 },
7435 .chained = true,
7436 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7437 },
7438 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7439 .type = HDA_FIXUP_PINS,
7440 .v.pins = (const struct hda_pintbl[]) {
7441 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7442 { }
7443 },
7444 .chained = true,
7445 .chain_id = ALC269_FIXUP_HEADSET_MIC
7446 },
7447 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7448 .type = HDA_FIXUP_PINS,
7449 .v.pins = (const struct hda_pintbl[]) {
7450 {0x12, 0x90a60130},
7451 {0x13, 0x40000000},
7452 {0x14, 0x90170110},
7453 {0x18, 0x411111f0},
7454 {0x19, 0x04a11040},
7455 {0x1a, 0x411111f0},
7456 {0x1b, 0x90170112},
7457 {0x1d, 0x40759a05},
7458 {0x1e, 0x411111f0},
7459 {0x21, 0x04211020},
7460 { }
7461 },
7462 .chained = true,
7463 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7464 },
7465 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7466 .type = HDA_FIXUP_FUNC,
7467 .v.func = alc298_fixup_huawei_mbx_stereo,
7468 .chained = true,
7469 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7470 },
7471 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7472 .type = HDA_FIXUP_FUNC,
7473 .v.func = alc269_fixup_x101_headset_mic,
7474 },
7475 [ALC269_FIXUP_ASUS_X101_VERB] = {
7476 .type = HDA_FIXUP_VERBS,
7477 .v.verbs = (const struct hda_verb[]) {
7478 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7479 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7480 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7481 { }
7482 },
7483 .chained = true,
7484 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7485 },
7486 [ALC269_FIXUP_ASUS_X101] = {
7487 .type = HDA_FIXUP_PINS,
7488 .v.pins = (const struct hda_pintbl[]) {
7489 { 0x18, 0x04a1182c }, /* Headset mic */
7490 { }
7491 },
7492 .chained = true,
7493 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7494 },
7495 [ALC271_FIXUP_AMIC_MIC2] = {
7496 .type = HDA_FIXUP_PINS,
7497 .v.pins = (const struct hda_pintbl[]) {
7498 { 0x14, 0x99130110 }, /* speaker */
7499 { 0x19, 0x01a19c20 }, /* mic */
7500 { 0x1b, 0x99a7012f }, /* int-mic */
7501 { 0x21, 0x0121401f }, /* HP out */
7502 { }
7503 },
7504 },
7505 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7506 .type = HDA_FIXUP_FUNC,
7507 .v.func = alc271_hp_gate_mic_jack,
7508 .chained = true,
7509 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7510 },
7511 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7512 .type = HDA_FIXUP_FUNC,
7513 .v.func = alc269_fixup_limit_int_mic_boost,
7514 .chained = true,
7515 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7516 },
7517 [ALC269_FIXUP_ACER_AC700] = {
7518 .type = HDA_FIXUP_PINS,
7519 .v.pins = (const struct hda_pintbl[]) {
7520 { 0x12, 0x99a3092f }, /* int-mic */
7521 { 0x14, 0x99130110 }, /* speaker */
7522 { 0x18, 0x03a11c20 }, /* mic */
7523 { 0x1e, 0x0346101e }, /* SPDIF1 */
7524 { 0x21, 0x0321101f }, /* HP out */
7525 { }
7526 },
7527 .chained = true,
7528 .chain_id = ALC271_FIXUP_DMIC,
7529 },
7530 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7531 .type = HDA_FIXUP_FUNC,
7532 .v.func = alc269_fixup_limit_int_mic_boost,
7533 .chained = true,
7534 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7535 },
7536 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7537 .type = HDA_FIXUP_FUNC,
7538 .v.func = alc269_fixup_limit_int_mic_boost,
7539 .chained = true,
7540 .chain_id = ALC269VB_FIXUP_DMIC,
7541 },
7542 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7543 .type = HDA_FIXUP_VERBS,
7544 .v.verbs = (const struct hda_verb[]) {
7545 /* class-D output amp +5dB */
7546 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7547 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7548 {}
7549 },
7550 .chained = true,
7551 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7552 },
7553 [ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7554 .type = HDA_FIXUP_PINS,
7555 .v.pins = (const struct hda_pintbl[]) {
7556 { 0x18, 0x01a110f0 }, /* use as headset mic */
7557 { }
7558 },
7559 .chained = true,
7560 .chain_id = ALC269_FIXUP_HEADSET_MIC
7561 },
7562 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7563 .type = HDA_FIXUP_FUNC,
7564 .v.func = alc269_fixup_limit_int_mic_boost,
7565 .chained = true,
7566 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7567 },
7568 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7569 .type = HDA_FIXUP_PINS,
7570 .v.pins = (const struct hda_pintbl[]) {
7571 { 0x12, 0x99a3092f }, /* int-mic */
7572 { 0x18, 0x03a11d20 }, /* mic */
7573 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7574 { }
7575 },
7576 },
7577 [ALC283_FIXUP_CHROME_BOOK] = {
7578 .type = HDA_FIXUP_FUNC,
7579 .v.func = alc283_fixup_chromebook,
7580 },
7581 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7582 .type = HDA_FIXUP_FUNC,
7583 .v.func = alc283_fixup_sense_combo_jack,
7584 .chained = true,
7585 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7586 },
7587 [ALC282_FIXUP_ASUS_TX300] = {
7588 .type = HDA_FIXUP_FUNC,
7589 .v.func = alc282_fixup_asus_tx300,
7590 },
7591 [ALC283_FIXUP_INT_MIC] = {
7592 .type = HDA_FIXUP_VERBS,
7593 .v.verbs = (const struct hda_verb[]) {
7594 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7595 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7596 { }
7597 },
7598 .chained = true,
7599 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7600 },
7601 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7602 .type = HDA_FIXUP_PINS,
7603 .v.pins = (const struct hda_pintbl[]) {
7604 { 0x17, 0x90170112 }, /* subwoofer */
7605 { }
7606 },
7607 .chained = true,
7608 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7609 },
7610 [ALC290_FIXUP_SUBWOOFER] = {
7611 .type = HDA_FIXUP_PINS,
7612 .v.pins = (const struct hda_pintbl[]) {
7613 { 0x17, 0x90170112 }, /* subwoofer */
7614 { }
7615 },
7616 .chained = true,
7617 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7618 },
7619 [ALC290_FIXUP_MONO_SPEAKERS] = {
7620 .type = HDA_FIXUP_FUNC,
7621 .v.func = alc290_fixup_mono_speakers,
7622 },
7623 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7624 .type = HDA_FIXUP_FUNC,
7625 .v.func = alc290_fixup_mono_speakers,
7626 .chained = true,
7627 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7628 },
7629 [ALC269_FIXUP_THINKPAD_ACPI] = {
7630 .type = HDA_FIXUP_FUNC,
7631 .v.func = alc_fixup_thinkpad_acpi,
7632 .chained = true,
7633 .chain_id = ALC269_FIXUP_SKU_IGNORE,
7634 },
7635 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7636 .type = HDA_FIXUP_FUNC,
7637 .v.func = alc_fixup_inv_dmic,
7638 .chained = true,
7639 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7640 },
7641 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
7642 .type = HDA_FIXUP_PINS,
7643 .v.pins = (const struct hda_pintbl[]) {
7644 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7645 { }
7646 },
7647 .chained = true,
7648 .chain_id = ALC255_FIXUP_HEADSET_MODE
7649 },
7650 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7651 .type = HDA_FIXUP_PINS,
7652 .v.pins = (const struct hda_pintbl[]) {
7653 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7654 { }
7655 },
7656 .chained = true,
7657 .chain_id = ALC255_FIXUP_HEADSET_MODE
7658 },
7659 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7660 .type = HDA_FIXUP_PINS,
7661 .v.pins = (const struct hda_pintbl[]) {
7662 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7663 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7664 { }
7665 },
7666 .chained = true,
7667 .chain_id = ALC255_FIXUP_HEADSET_MODE
7668 },
7669 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7670 .type = HDA_FIXUP_PINS,
7671 .v.pins = (const struct hda_pintbl[]) {
7672 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7673 { }
7674 },
7675 .chained = true,
7676 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7677 },
7678 [ALC255_FIXUP_HEADSET_MODE] = {
7679 .type = HDA_FIXUP_FUNC,
7680 .v.func = alc_fixup_headset_mode_alc255,
7681 .chained = true,
7682 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7683 },
7684 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7685 .type = HDA_FIXUP_FUNC,
7686 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7687 },
7688 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7689 .type = HDA_FIXUP_PINS,
7690 .v.pins = (const struct hda_pintbl[]) {
7691 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7692 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7693 { }
7694 },
7695 .chained = true,
7696 .chain_id = ALC269_FIXUP_HEADSET_MODE
7697 },
7698 [ALC292_FIXUP_TPT440_DOCK] = {
7699 .type = HDA_FIXUP_FUNC,
7700 .v.func = alc_fixup_tpt440_dock,
7701 .chained = true,
7702 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7703 },
7704 [ALC292_FIXUP_TPT440] = {
7705 .type = HDA_FIXUP_FUNC,
7706 .v.func = alc_fixup_disable_aamix,
7707 .chained = true,
7708 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7709 },
7710 [ALC283_FIXUP_HEADSET_MIC] = {
7711 .type = HDA_FIXUP_PINS,
7712 .v.pins = (const struct hda_pintbl[]) {
7713 { 0x19, 0x04a110f0 },
7714 { },
7715 },
7716 },
7717 [ALC255_FIXUP_MIC_MUTE_LED] = {
7718 .type = HDA_FIXUP_FUNC,
7719 .v.func = alc_fixup_micmute_led,
7720 },
7721 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7722 .type = HDA_FIXUP_PINS,
7723 .v.pins = (const struct hda_pintbl[]) {
7724 { 0x12, 0x90a60130 },
7725 { 0x14, 0x90170110 },
7726 { 0x17, 0x40000008 },
7727 { 0x18, 0x411111f0 },
7728 { 0x19, 0x01a1913c },
7729 { 0x1a, 0x411111f0 },
7730 { 0x1b, 0x411111f0 },
7731 { 0x1d, 0x40f89b2d },
7732 { 0x1e, 0x411111f0 },
7733 { 0x21, 0x0321101f },
7734 { },
7735 },
7736 },
7737 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7738 .type = HDA_FIXUP_FUNC,
7739 .v.func = alc269vb_fixup_aspire_e1_coef,
7740 },
7741 [ALC280_FIXUP_HP_GPIO4] = {
7742 .type = HDA_FIXUP_FUNC,
7743 .v.func = alc280_fixup_hp_gpio4,
7744 },
7745 [ALC286_FIXUP_HP_GPIO_LED] = {
7746 .type = HDA_FIXUP_FUNC,
7747 .v.func = alc286_fixup_hp_gpio_led,
7748 },
7749 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7750 .type = HDA_FIXUP_FUNC,
7751 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7752 },
7753 [ALC280_FIXUP_HP_DOCK_PINS] = {
7754 .type = HDA_FIXUP_PINS,
7755 .v.pins = (const struct hda_pintbl[]) {
7756 { 0x1b, 0x21011020 }, /* line-out */
7757 { 0x1a, 0x01a1903c }, /* headset mic */
7758 { 0x18, 0x2181103f }, /* line-in */
7759 { },
7760 },
7761 .chained = true,
7762 .chain_id = ALC280_FIXUP_HP_GPIO4
7763 },
7764 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7765 .type = HDA_FIXUP_PINS,
7766 .v.pins = (const struct hda_pintbl[]) {
7767 { 0x1b, 0x21011020 }, /* line-out */
7768 { 0x18, 0x2181103f }, /* line-in */
7769 { },
7770 },
7771 .chained = true,
7772 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7773 },
7774 [ALC280_FIXUP_HP_9480M] = {
7775 .type = HDA_FIXUP_FUNC,
7776 .v.func = alc280_fixup_hp_9480m,
7777 },
7778 [ALC245_FIXUP_HP_X360_AMP] = {
7779 .type = HDA_FIXUP_FUNC,
7780 .v.func = alc245_fixup_hp_x360_amp,
7781 .chained = true,
7782 .chain_id = ALC245_FIXUP_HP_GPIO_LED
7783 },
7784 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7785 .type = HDA_FIXUP_FUNC,
7786 .v.func = alc_fixup_headset_mode_dell_alc288,
7787 .chained = true,
7788 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7789 },
7790 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7791 .type = HDA_FIXUP_PINS,
7792 .v.pins = (const struct hda_pintbl[]) {
7793 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7794 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7795 { }
7796 },
7797 .chained = true,
7798 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7799 },
7800 [ALC288_FIXUP_DISABLE_AAMIX] = {
7801 .type = HDA_FIXUP_FUNC,
7802 .v.func = alc_fixup_disable_aamix,
7803 .chained = true,
7804 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
7805 },
7806 [ALC288_FIXUP_DELL_XPS_13] = {
7807 .type = HDA_FIXUP_FUNC,
7808 .v.func = alc_fixup_dell_xps13,
7809 .chained = true,
7810 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7811 },
7812 [ALC292_FIXUP_DISABLE_AAMIX] = {
7813 .type = HDA_FIXUP_FUNC,
7814 .v.func = alc_fixup_disable_aamix,
7815 .chained = true,
7816 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
7817 },
7818 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7819 .type = HDA_FIXUP_FUNC,
7820 .v.func = alc_fixup_disable_aamix,
7821 .chained = true,
7822 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7823 },
7824 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
7825 .type = HDA_FIXUP_FUNC,
7826 .v.func = alc_fixup_dell_xps13,
7827 .chained = true,
7828 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7829 },
7830 [ALC292_FIXUP_DELL_E7X] = {
7831 .type = HDA_FIXUP_FUNC,
7832 .v.func = alc_fixup_micmute_led,
7833 /* micmute fixup must be applied at last */
7834 .chained_before = true,
7835 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7836 },
7837 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7838 .type = HDA_FIXUP_PINS,
7839 .v.pins = (const struct hda_pintbl[]) {
7840 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7841 { }
7842 },
7843 .chained_before = true,
7844 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7845 },
7846 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7847 .type = HDA_FIXUP_PINS,
7848 .v.pins = (const struct hda_pintbl[]) {
7849 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7850 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7851 { }
7852 },
7853 .chained = true,
7854 .chain_id = ALC269_FIXUP_HEADSET_MODE
7855 },
7856 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7857 .type = HDA_FIXUP_PINS,
7858 .v.pins = (const struct hda_pintbl[]) {
7859 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7860 { }
7861 },
7862 .chained = true,
7863 .chain_id = ALC269_FIXUP_HEADSET_MODE
7864 },
7865 [ALC275_FIXUP_DELL_XPS] = {
7866 .type = HDA_FIXUP_VERBS,
7867 .v.verbs = (const struct hda_verb[]) {
7868 /* Enables internal speaker */
7869 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7870 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7871 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7872 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7873 {}
7874 }
7875 },
7876 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7877 .type = HDA_FIXUP_FUNC,
7878 .v.func = alc_fixup_disable_aamix,
7879 .chained = true,
7880 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7881 },
7882 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7883 .type = HDA_FIXUP_FUNC,
7884 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7885 },
7886 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7887 .type = HDA_FIXUP_FUNC,
7888 .v.func = alc_fixup_inv_dmic,
7889 .chained = true,
7890 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7891 },
7892 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7893 .type = HDA_FIXUP_FUNC,
7894 .v.func = alc269_fixup_limit_int_mic_boost
7895 },
7896 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7897 .type = HDA_FIXUP_FUNC,
7898 .v.func = alc_fixup_disable_aamix,
7899 .chained = true,
7900 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7901 },
7902 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7903 .type = HDA_FIXUP_FUNC,
7904 .v.func = alc_fixup_disable_mic_vref,
7905 .chained = true,
7906 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7907 },
7908 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7909 .type = HDA_FIXUP_VERBS,
7910 .v.verbs = (const struct hda_verb[]) {
7911 /* Disable pass-through path for FRONT 14h */
7912 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7913 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7914 {}
7915 },
7916 .chained = true,
7917 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
7918 },
7919 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7920 .type = HDA_FIXUP_FUNC,
7921 .v.func = alc_fixup_disable_aamix,
7922 .chained = true,
7923 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7924 },
7925 [ALC221_FIXUP_HP_FRONT_MIC] = {
7926 .type = HDA_FIXUP_PINS,
7927 .v.pins = (const struct hda_pintbl[]) {
7928 { 0x19, 0x02a19020 }, /* Front Mic */
7929 { }
7930 },
7931 },
7932 [ALC292_FIXUP_TPT460] = {
7933 .type = HDA_FIXUP_FUNC,
7934 .v.func = alc_fixup_tpt440_dock,
7935 .chained = true,
7936 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7937 },
7938 [ALC298_FIXUP_SPK_VOLUME] = {
7939 .type = HDA_FIXUP_FUNC,
7940 .v.func = alc298_fixup_speaker_volume,
7941 .chained = true,
7942 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7943 },
7944 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7945 .type = HDA_FIXUP_FUNC,
7946 .v.func = alc298_fixup_speaker_volume,
7947 },
7948 [ALC295_FIXUP_DISABLE_DAC3] = {
7949 .type = HDA_FIXUP_FUNC,
7950 .v.func = alc295_fixup_disable_dac3,
7951 },
7952 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7953 .type = HDA_FIXUP_FUNC,
7954 .v.func = alc285_fixup_speaker2_to_dac1,
7955 .chained = true,
7956 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7957 },
7958 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7959 .type = HDA_FIXUP_PINS,
7960 .v.pins = (const struct hda_pintbl[]) {
7961 { 0x1b, 0x90170151 },
7962 { }
7963 },
7964 .chained = true,
7965 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7966 },
7967 [ALC269_FIXUP_ATIV_BOOK_8] = {
7968 .type = HDA_FIXUP_FUNC,
7969 .v.func = alc_fixup_auto_mute_via_amp,
7970 .chained = true,
7971 .chain_id = ALC269_FIXUP_NO_SHUTUP
7972 },
7973 [ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
7974 .type = HDA_FIXUP_PINS,
7975 .v.pins = (const struct hda_pintbl[]) {
7976 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7977 { 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
7978 { }
7979 },
7980 .chained = true,
7981 .chain_id = ALC269_FIXUP_HEADSET_MODE
7982 },
7983 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7984 .type = HDA_FIXUP_PINS,
7985 .v.pins = (const struct hda_pintbl[]) {
7986 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7987 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7988 { }
7989 },
7990 .chained = true,
7991 .chain_id = ALC269_FIXUP_HEADSET_MODE
7992 },
7993 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7994 .type = HDA_FIXUP_FUNC,
7995 .v.func = alc_fixup_headset_mode,
7996 },
7997 [ALC256_FIXUP_ASUS_MIC] = {
7998 .type = HDA_FIXUP_PINS,
7999 .v.pins = (const struct hda_pintbl[]) {
8000 { 0x13, 0x90a60160 }, /* use as internal mic */
8001 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8002 { }
8003 },
8004 .chained = true,
8005 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8006 },
8007 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8008 .type = HDA_FIXUP_FUNC,
8009 /* Set up GPIO2 for the speaker amp */
8010 .v.func = alc_fixup_gpio4,
8011 },
8012 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8013 .type = HDA_FIXUP_PINS,
8014 .v.pins = (const struct hda_pintbl[]) {
8015 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8016 { }
8017 },
8018 .chained = true,
8019 .chain_id = ALC269_FIXUP_HEADSET_MIC
8020 },
8021 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8022 .type = HDA_FIXUP_VERBS,
8023 .v.verbs = (const struct hda_verb[]) {
8024 /* Enables internal speaker */
8025 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8026 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8027 {}
8028 },
8029 .chained = true,
8030 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8031 },
8032 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8033 .type = HDA_FIXUP_FUNC,
8034 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8035 .chained = true,
8036 .chain_id = ALC269_FIXUP_GPIO2
8037 },
8038 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
8039 .type = HDA_FIXUP_VERBS,
8040 .v.verbs = (const struct hda_verb[]) {
8041 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8042 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8043 { }
8044 },
8045 .chained = true,
8046 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8047 },
8048 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8049 .type = HDA_FIXUP_PINS,
8050 .v.pins = (const struct hda_pintbl[]) {
8051 /* Change the mic location from front to right, otherwise there are
8052 two front mics with the same name, pulseaudio can't handle them.
8053 This is just a temporary workaround, after applying this fixup,
8054 there will be one "Front Mic" and one "Mic" in this machine.
8055 */
8056 { 0x1a, 0x04a19040 },
8057 { }
8058 },
8059 },
8060 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8061 .type = HDA_FIXUP_PINS,
8062 .v.pins = (const struct hda_pintbl[]) {
8063 { 0x16, 0x0101102f }, /* Rear Headset HP */
8064 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8065 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8066 { 0x1b, 0x02011020 },
8067 { }
8068 },
8069 .chained = true,
8070 .chain_id = ALC225_FIXUP_S3_POP_NOISE
8071 },
8072 [ALC225_FIXUP_S3_POP_NOISE] = {
8073 .type = HDA_FIXUP_FUNC,
8074 .v.func = alc225_fixup_s3_pop_noise,
8075 .chained = true,
8076 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8077 },
8078 [ALC700_FIXUP_INTEL_REFERENCE] = {
8079 .type = HDA_FIXUP_VERBS,
8080 .v.verbs = (const struct hda_verb[]) {
8081 /* Enables internal speaker */
8082 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8083 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8084 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8085 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8086 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8087 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8088 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8089 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8090 {}
8091 }
8092 },
8093 [ALC274_FIXUP_DELL_BIND_DACS] = {
8094 .type = HDA_FIXUP_FUNC,
8095 .v.func = alc274_fixup_bind_dacs,
8096 .chained = true,
8097 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8098 },
8099 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8100 .type = HDA_FIXUP_PINS,
8101 .v.pins = (const struct hda_pintbl[]) {
8102 { 0x1b, 0x0401102f },
8103 { }
8104 },
8105 .chained = true,
8106 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
8107 },
8108 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
8109 .type = HDA_FIXUP_FUNC,
8110 .v.func = alc_fixup_tpt470_dock,
8111 .chained = true,
8112 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8113 },
8114 [ALC298_FIXUP_TPT470_DOCK] = {
8115 .type = HDA_FIXUP_FUNC,
8116 .v.func = alc_fixup_tpt470_dacs,
8117 .chained = true,
8118 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8119 },
8120 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8121 .type = HDA_FIXUP_PINS,
8122 .v.pins = (const struct hda_pintbl[]) {
8123 { 0x14, 0x0201101f },
8124 { }
8125 },
8126 .chained = true,
8127 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8128 },
8129 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
8130 .type = HDA_FIXUP_PINS,
8131 .v.pins = (const struct hda_pintbl[]) {
8132 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8133 { }
8134 },
8135 .chained = true,
8136 .chain_id = ALC269_FIXUP_HEADSET_MIC
8137 },
8138 [ALC295_FIXUP_HP_X360] = {
8139 .type = HDA_FIXUP_FUNC,
8140 .v.func = alc295_fixup_hp_top_speakers,
8141 .chained = true,
8142 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8143 },
8144 [ALC221_FIXUP_HP_HEADSET_MIC] = {
8145 .type = HDA_FIXUP_PINS,
8146 .v.pins = (const struct hda_pintbl[]) {
8147 { 0x19, 0x0181313f},
8148 { }
8149 },
8150 .chained = true,
8151 .chain_id = ALC269_FIXUP_HEADSET_MIC
8152 },
8153 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8154 .type = HDA_FIXUP_FUNC,
8155 .v.func = alc285_fixup_invalidate_dacs,
8156 .chained = true,
8157 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8158 },
8159 [ALC295_FIXUP_HP_AUTO_MUTE] = {
8160 .type = HDA_FIXUP_FUNC,
8161 .v.func = alc_fixup_auto_mute_via_amp,
8162 },
8163 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8164 .type = HDA_FIXUP_PINS,
8165 .v.pins = (const struct hda_pintbl[]) {
8166 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8167 { }
8168 },
8169 .chained = true,
8170 .chain_id = ALC269_FIXUP_HEADSET_MIC
8171 },
8172 [ALC294_FIXUP_ASUS_MIC] = {
8173 .type = HDA_FIXUP_PINS,
8174 .v.pins = (const struct hda_pintbl[]) {
8175 { 0x13, 0x90a60160 }, /* use as internal mic */
8176 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8177 { }
8178 },
8179 .chained = true,
8180 .chain_id = ALC269_FIXUP_HEADSET_MIC
8181 },
8182 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8183 .type = HDA_FIXUP_PINS,
8184 .v.pins = (const struct hda_pintbl[]) {
8185 { 0x19, 0x01a1103c }, /* use as headset mic */
8186 { }
8187 },
8188 .chained = true,
8189 .chain_id = ALC269_FIXUP_HEADSET_MIC
8190 },
8191 [ALC294_FIXUP_ASUS_SPK] = {
8192 .type = HDA_FIXUP_VERBS,
8193 .v.verbs = (const struct hda_verb[]) {
8194 /* Set EAPD high */
8195 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8196 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8197 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8198 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8199 { }
8200 },
8201 .chained = true,
8202 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8203 },
8204 [ALC295_FIXUP_CHROME_BOOK] = {
8205 .type = HDA_FIXUP_FUNC,
8206 .v.func = alc295_fixup_chromebook,
8207 .chained = true,
8208 .chain_id = ALC225_FIXUP_HEADSET_JACK
8209 },
8210 [ALC225_FIXUP_HEADSET_JACK] = {
8211 .type = HDA_FIXUP_FUNC,
8212 .v.func = alc_fixup_headset_jack,
8213 },
8214 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8215 .type = HDA_FIXUP_PINS,
8216 .v.pins = (const struct hda_pintbl[]) {
8217 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8218 { }
8219 },
8220 .chained = true,
8221 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8222 },
8223 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8224 .type = HDA_FIXUP_VERBS,
8225 .v.verbs = (const struct hda_verb[]) {
8226 /* Disable PCBEEP-IN passthrough */
8227 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8228 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8229 { }
8230 },
8231 .chained = true,
8232 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8233 },
8234 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
8235 .type = HDA_FIXUP_PINS,
8236 .v.pins = (const struct hda_pintbl[]) {
8237 { 0x19, 0x03a11130 },
8238 { 0x1a, 0x90a60140 }, /* use as internal mic */
8239 { }
8240 },
8241 .chained = true,
8242 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8243 },
8244 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8245 .type = HDA_FIXUP_PINS,
8246 .v.pins = (const struct hda_pintbl[]) {
8247 { 0x16, 0x01011020 }, /* Rear Line out */
8248 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8249 { }
8250 },
8251 .chained = true,
8252 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8253 },
8254 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8255 .type = HDA_FIXUP_FUNC,
8256 .v.func = alc_fixup_auto_mute_via_amp,
8257 .chained = true,
8258 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8259 },
8260 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8261 .type = HDA_FIXUP_FUNC,
8262 .v.func = alc_fixup_disable_mic_vref,
8263 .chained = true,
8264 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8265 },
8266 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8267 .type = HDA_FIXUP_VERBS,
8268 .v.verbs = (const struct hda_verb[]) {
8269 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8270 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8271 { }
8272 },
8273 .chained = true,
8274 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8275 },
8276 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8277 .type = HDA_FIXUP_PINS,
8278 .v.pins = (const struct hda_pintbl[]) {
8279 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8280 { }
8281 },
8282 .chained = true,
8283 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8284 },
8285 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8286 .type = HDA_FIXUP_PINS,
8287 .v.pins = (const struct hda_pintbl[]) {
8288 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8289 { }
8290 },
8291 .chained = true,
8292 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8293 },
8294 [ALC299_FIXUP_PREDATOR_SPK] = {
8295 .type = HDA_FIXUP_PINS,
8296 .v.pins = (const struct hda_pintbl[]) {
8297 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8298 { }
8299 }
8300 },
8301 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8302 .type = HDA_FIXUP_PINS,
8303 .v.pins = (const struct hda_pintbl[]) {
8304 { 0x19, 0x04a11040 },
8305 { 0x21, 0x04211020 },
8306 { }
8307 },
8308 .chained = true,
8309 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8310 },
8311 [ALC289_FIXUP_DELL_SPK2] = {
8312 .type = HDA_FIXUP_PINS,
8313 .v.pins = (const struct hda_pintbl[]) {
8314 { 0x17, 0x90170130 }, /* bass spk */
8315 { }
8316 },
8317 .chained = true,
8318 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8319 },
8320 [ALC289_FIXUP_DUAL_SPK] = {
8321 .type = HDA_FIXUP_FUNC,
8322 .v.func = alc285_fixup_speaker2_to_dac1,
8323 .chained = true,
8324 .chain_id = ALC289_FIXUP_DELL_SPK2
8325 },
8326 [ALC294_FIXUP_SPK2_TO_DAC1] = {
8327 .type = HDA_FIXUP_FUNC,
8328 .v.func = alc285_fixup_speaker2_to_dac1,
8329 .chained = true,
8330 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8331 },
8332 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
8333 .type = HDA_FIXUP_FUNC,
8334 /* The GPIO must be pulled to initialize the AMP */
8335 .v.func = alc_fixup_gpio4,
8336 .chained = true,
8337 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8338 },
8339 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8340 .type = HDA_FIXUP_FUNC,
8341 .v.func = alc285_fixup_thinkpad_x1_gen7,
8342 .chained = true,
8343 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8344 },
8345 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8346 .type = HDA_FIXUP_FUNC,
8347 .v.func = alc_fixup_headset_jack,
8348 .chained = true,
8349 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8350 },
8351 [ALC294_FIXUP_ASUS_HPE] = {
8352 .type = HDA_FIXUP_VERBS,
8353 .v.verbs = (const struct hda_verb[]) {
8354 /* Set EAPD high */
8355 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8356 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8357 { }
8358 },
8359 .chained = true,
8360 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8361 },
8362 [ALC294_FIXUP_ASUS_GX502_PINS] = {
8363 .type = HDA_FIXUP_PINS,
8364 .v.pins = (const struct hda_pintbl[]) {
8365 { 0x19, 0x03a11050 }, /* front HP mic */
8366 { 0x1a, 0x01a11830 }, /* rear external mic */
8367 { 0x21, 0x03211020 }, /* front HP out */
8368 { }
8369 },
8370 .chained = true,
8371 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8372 },
8373 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8374 .type = HDA_FIXUP_VERBS,
8375 .v.verbs = (const struct hda_verb[]) {
8376 /* set 0x15 to HP-OUT ctrl */
8377 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8378 /* unmute the 0x15 amp */
8379 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8380 { }
8381 },
8382 .chained = true,
8383 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8384 },
8385 [ALC294_FIXUP_ASUS_GX502_HP] = {
8386 .type = HDA_FIXUP_FUNC,
8387 .v.func = alc294_fixup_gx502_hp,
8388 },
8389 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8390 .type = HDA_FIXUP_PINS,
8391 .v.pins = (const struct hda_pintbl[]) {
8392 { 0x19, 0x01a11050 }, /* rear HP mic */
8393 { 0x1a, 0x01a11830 }, /* rear external mic */
8394 { 0x21, 0x012110f0 }, /* rear HP out */
8395 { }
8396 },
8397 .chained = true,
8398 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8399 },
8400 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8401 .type = HDA_FIXUP_VERBS,
8402 .v.verbs = (const struct hda_verb[]) {
8403 /* set 0x15 to HP-OUT ctrl */
8404 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8405 /* unmute the 0x15 amp */
8406 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8407 /* set 0x1b to HP-OUT */
8408 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8409 { }
8410 },
8411 .chained = true,
8412 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8413 },
8414 [ALC294_FIXUP_ASUS_GU502_HP] = {
8415 .type = HDA_FIXUP_FUNC,
8416 .v.func = alc294_fixup_gu502_hp,
8417 },
8418 [ALC294_FIXUP_ASUS_G513_PINS] = {
8419 .type = HDA_FIXUP_PINS,
8420 .v.pins = (const struct hda_pintbl[]) {
8421 { 0x19, 0x03a11050 }, /* front HP mic */
8422 { 0x1a, 0x03a11c30 }, /* rear external mic */
8423 { 0x21, 0x03211420 }, /* front HP out */
8424 { }
8425 },
8426 },
8427 [ALC285_FIXUP_ASUS_G533Z_PINS] = {
8428 .type = HDA_FIXUP_PINS,
8429 .v.pins = (const struct hda_pintbl[]) {
8430 { 0x14, 0x90170120 },
8431 { }
8432 },
8433 .chained = true,
8434 .chain_id = ALC294_FIXUP_ASUS_G513_PINS,
8435 },
8436 [ALC294_FIXUP_ASUS_COEF_1B] = {
8437 .type = HDA_FIXUP_VERBS,
8438 .v.verbs = (const struct hda_verb[]) {
8439 /* Set bit 10 to correct noisy output after reboot from
8440 * Windows 10 (due to pop noise reduction?)
8441 */
8442 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8443 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8444 { }
8445 },
8446 .chained = true,
8447 .chain_id = ALC289_FIXUP_ASUS_GA401,
8448 },
8449 [ALC285_FIXUP_HP_GPIO_LED] = {
8450 .type = HDA_FIXUP_FUNC,
8451 .v.func = alc285_fixup_hp_gpio_led,
8452 },
8453 [ALC285_FIXUP_HP_MUTE_LED] = {
8454 .type = HDA_FIXUP_FUNC,
8455 .v.func = alc285_fixup_hp_mute_led,
8456 },
8457 [ALC236_FIXUP_HP_GPIO_LED] = {
8458 .type = HDA_FIXUP_FUNC,
8459 .v.func = alc236_fixup_hp_gpio_led,
8460 },
8461 [ALC236_FIXUP_HP_MUTE_LED] = {
8462 .type = HDA_FIXUP_FUNC,
8463 .v.func = alc236_fixup_hp_mute_led,
8464 },
8465 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8466 .type = HDA_FIXUP_FUNC,
8467 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8468 },
8469 [ALC298_FIXUP_SAMSUNG_AMP] = {
8470 .type = HDA_FIXUP_FUNC,
8471 .v.func = alc298_fixup_samsung_amp,
8472 .chained = true,
8473 .chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
8474 },
8475 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8476 .type = HDA_FIXUP_VERBS,
8477 .v.verbs = (const struct hda_verb[]) {
8478 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8479 { }
8480 },
8481 },
8482 [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8483 .type = HDA_FIXUP_VERBS,
8484 .v.verbs = (const struct hda_verb[]) {
8485 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8486 { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
8487 { }
8488 },
8489 },
8490 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8491 .type = HDA_FIXUP_PINS,
8492 .v.pins = (const struct hda_pintbl[]) {
8493 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8494 { }
8495 },
8496 .chained = true,
8497 .chain_id = ALC269_FIXUP_HEADSET_MODE
8498 },
8499 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8500 .type = HDA_FIXUP_PINS,
8501 .v.pins = (const struct hda_pintbl[]) {
8502 { 0x14, 0x90100120 }, /* use as internal speaker */
8503 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8504 { 0x1a, 0x01011020 }, /* use as line out */
8505 { },
8506 },
8507 .chained = true,
8508 .chain_id = ALC269_FIXUP_HEADSET_MIC
8509 },
8510 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8511 .type = HDA_FIXUP_PINS,
8512 .v.pins = (const struct hda_pintbl[]) {
8513 { 0x18, 0x02a11030 }, /* use as headset mic */
8514 { }
8515 },
8516 .chained = true,
8517 .chain_id = ALC269_FIXUP_HEADSET_MIC
8518 },
8519 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8520 .type = HDA_FIXUP_PINS,
8521 .v.pins = (const struct hda_pintbl[]) {
8522 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8523 { }
8524 },
8525 .chained = true,
8526 .chain_id = ALC269_FIXUP_HEADSET_MIC
8527 },
8528 [ALC289_FIXUP_ASUS_GA401] = {
8529 .type = HDA_FIXUP_FUNC,
8530 .v.func = alc289_fixup_asus_ga401,
8531 .chained = true,
8532 .chain_id = ALC289_FIXUP_ASUS_GA502,
8533 },
8534 [ALC289_FIXUP_ASUS_GA502] = {
8535 .type = HDA_FIXUP_PINS,
8536 .v.pins = (const struct hda_pintbl[]) {
8537 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8538 { }
8539 },
8540 },
8541 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8542 .type = HDA_FIXUP_PINS,
8543 .v.pins = (const struct hda_pintbl[]) {
8544 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8545 { }
8546 },
8547 .chained = true,
8548 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8549 },
8550 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8551 .type = HDA_FIXUP_FUNC,
8552 .v.func = alc285_fixup_hp_gpio_amp_init,
8553 .chained = true,
8554 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8555 },
8556 [ALC269_FIXUP_CZC_B20] = {
8557 .type = HDA_FIXUP_PINS,
8558 .v.pins = (const struct hda_pintbl[]) {
8559 { 0x12, 0x411111f0 },
8560 { 0x14, 0x90170110 }, /* speaker */
8561 { 0x15, 0x032f1020 }, /* HP out */
8562 { 0x17, 0x411111f0 },
8563 { 0x18, 0x03ab1040 }, /* mic */
8564 { 0x19, 0xb7a7013f },
8565 { 0x1a, 0x0181305f },
8566 { 0x1b, 0x411111f0 },
8567 { 0x1d, 0x411111f0 },
8568 { 0x1e, 0x411111f0 },
8569 { }
8570 },
8571 .chain_id = ALC269_FIXUP_DMIC,
8572 },
8573 [ALC269_FIXUP_CZC_TMI] = {
8574 .type = HDA_FIXUP_PINS,
8575 .v.pins = (const struct hda_pintbl[]) {
8576 { 0x12, 0x4000c000 },
8577 { 0x14, 0x90170110 }, /* speaker */
8578 { 0x15, 0x0421401f }, /* HP out */
8579 { 0x17, 0x411111f0 },
8580 { 0x18, 0x04a19020 }, /* mic */
8581 { 0x19, 0x411111f0 },
8582 { 0x1a, 0x411111f0 },
8583 { 0x1b, 0x411111f0 },
8584 { 0x1d, 0x40448505 },
8585 { 0x1e, 0x411111f0 },
8586 { 0x20, 0x8000ffff },
8587 { }
8588 },
8589 .chain_id = ALC269_FIXUP_DMIC,
8590 },
8591 [ALC269_FIXUP_CZC_L101] = {
8592 .type = HDA_FIXUP_PINS,
8593 .v.pins = (const struct hda_pintbl[]) {
8594 { 0x12, 0x40000000 },
8595 { 0x14, 0x01014010 }, /* speaker */
8596 { 0x15, 0x411111f0 }, /* HP out */
8597 { 0x16, 0x411111f0 },
8598 { 0x18, 0x01a19020 }, /* mic */
8599 { 0x19, 0x02a19021 },
8600 { 0x1a, 0x0181302f },
8601 { 0x1b, 0x0221401f },
8602 { 0x1c, 0x411111f0 },
8603 { 0x1d, 0x4044c601 },
8604 { 0x1e, 0x411111f0 },
8605 { }
8606 },
8607 .chain_id = ALC269_FIXUP_DMIC,
8608 },
8609 [ALC269_FIXUP_LEMOTE_A1802] = {
8610 .type = HDA_FIXUP_PINS,
8611 .v.pins = (const struct hda_pintbl[]) {
8612 { 0x12, 0x40000000 },
8613 { 0x14, 0x90170110 }, /* speaker */
8614 { 0x17, 0x411111f0 },
8615 { 0x18, 0x03a19040 }, /* mic1 */
8616 { 0x19, 0x90a70130 }, /* mic2 */
8617 { 0x1a, 0x411111f0 },
8618 { 0x1b, 0x411111f0 },
8619 { 0x1d, 0x40489d2d },
8620 { 0x1e, 0x411111f0 },
8621 { 0x20, 0x0003ffff },
8622 { 0x21, 0x03214020 },
8623 { }
8624 },
8625 .chain_id = ALC269_FIXUP_DMIC,
8626 },
8627 [ALC269_FIXUP_LEMOTE_A190X] = {
8628 .type = HDA_FIXUP_PINS,
8629 .v.pins = (const struct hda_pintbl[]) {
8630 { 0x14, 0x99130110 }, /* speaker */
8631 { 0x15, 0x0121401f }, /* HP out */
8632 { 0x18, 0x01a19c20 }, /* rear mic */
8633 { 0x19, 0x99a3092f }, /* front mic */
8634 { 0x1b, 0x0201401f }, /* front lineout */
8635 { }
8636 },
8637 .chain_id = ALC269_FIXUP_DMIC,
8638 },
8639 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8640 .type = HDA_FIXUP_PINS,
8641 .v.pins = (const struct hda_pintbl[]) {
8642 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8643 { }
8644 },
8645 .chained = true,
8646 .chain_id = ALC269_FIXUP_HEADSET_MODE
8647 },
8648 [ALC256_FIXUP_INTEL_NUC10] = {
8649 .type = HDA_FIXUP_PINS,
8650 .v.pins = (const struct hda_pintbl[]) {
8651 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8652 { }
8653 },
8654 .chained = true,
8655 .chain_id = ALC269_FIXUP_HEADSET_MODE
8656 },
8657 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8658 .type = HDA_FIXUP_VERBS,
8659 .v.verbs = (const struct hda_verb[]) {
8660 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8661 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8662 { }
8663 },
8664 .chained = true,
8665 .chain_id = ALC289_FIXUP_ASUS_GA502
8666 },
8667 [ALC274_FIXUP_HP_MIC] = {
8668 .type = HDA_FIXUP_VERBS,
8669 .v.verbs = (const struct hda_verb[]) {
8670 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8671 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8672 { }
8673 },
8674 },
8675 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8676 .type = HDA_FIXUP_FUNC,
8677 .v.func = alc274_fixup_hp_headset_mic,
8678 .chained = true,
8679 .chain_id = ALC274_FIXUP_HP_MIC
8680 },
8681 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8682 .type = HDA_FIXUP_FUNC,
8683 .v.func = alc274_fixup_hp_envy_gpio,
8684 },
8685 [ALC256_FIXUP_ASUS_HPE] = {
8686 .type = HDA_FIXUP_VERBS,
8687 .v.verbs = (const struct hda_verb[]) {
8688 /* Set EAPD high */
8689 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8690 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8691 { }
8692 },
8693 .chained = true,
8694 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8695 },
8696 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8697 .type = HDA_FIXUP_FUNC,
8698 .v.func = alc_fixup_headset_jack,
8699 .chained = true,
8700 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8701 },
8702 [ALC287_FIXUP_HP_GPIO_LED] = {
8703 .type = HDA_FIXUP_FUNC,
8704 .v.func = alc287_fixup_hp_gpio_led,
8705 },
8706 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8707 .type = HDA_FIXUP_FUNC,
8708 .v.func = alc274_fixup_hp_headset_mic,
8709 },
8710 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8711 .type = HDA_FIXUP_FUNC,
8712 .v.func = alc_fixup_no_int_mic,
8713 .chained = true,
8714 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8715 },
8716 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8717 .type = HDA_FIXUP_PINS,
8718 .v.pins = (const struct hda_pintbl[]) {
8719 { 0x1b, 0x411111f0 },
8720 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8721 { },
8722 },
8723 .chained = true,
8724 .chain_id = ALC269_FIXUP_HEADSET_MODE
8725 },
8726 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8727 .type = HDA_FIXUP_FUNC,
8728 .v.func = alc269_fixup_limit_int_mic_boost,
8729 .chained = true,
8730 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8731 },
8732 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8733 .type = HDA_FIXUP_PINS,
8734 .v.pins = (const struct hda_pintbl[]) {
8735 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8736 { 0x1a, 0x90a1092f }, /* use as internal mic */
8737 { }
8738 },
8739 .chained = true,
8740 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8741 },
8742 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8743 .type = HDA_FIXUP_FUNC,
8744 .v.func = alc285_fixup_ideapad_s740_coef,
8745 .chained = true,
8746 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8747 },
8748 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8749 .type = HDA_FIXUP_FUNC,
8750 .v.func = alc269_fixup_limit_int_mic_boost,
8751 .chained = true,
8752 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8753 },
8754 [ALC295_FIXUP_ASUS_DACS] = {
8755 .type = HDA_FIXUP_FUNC,
8756 .v.func = alc295_fixup_asus_dacs,
8757 },
8758 [ALC295_FIXUP_HP_OMEN] = {
8759 .type = HDA_FIXUP_PINS,
8760 .v.pins = (const struct hda_pintbl[]) {
8761 { 0x12, 0xb7a60130 },
8762 { 0x13, 0x40000000 },
8763 { 0x14, 0x411111f0 },
8764 { 0x16, 0x411111f0 },
8765 { 0x17, 0x90170110 },
8766 { 0x18, 0x411111f0 },
8767 { 0x19, 0x02a11030 },
8768 { 0x1a, 0x411111f0 },
8769 { 0x1b, 0x04a19030 },
8770 { 0x1d, 0x40600001 },
8771 { 0x1e, 0x411111f0 },
8772 { 0x21, 0x03211020 },
8773 {}
8774 },
8775 .chained = true,
8776 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8777 },
8778 [ALC285_FIXUP_HP_SPECTRE_X360] = {
8779 .type = HDA_FIXUP_FUNC,
8780 .v.func = alc285_fixup_hp_spectre_x360,
8781 },
8782 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8783 .type = HDA_FIXUP_FUNC,
8784 .v.func = alc285_fixup_hp_spectre_x360_eb1
8785 },
8786 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8787 .type = HDA_FIXUP_FUNC,
8788 .v.func = alc285_fixup_ideapad_s740_coef,
8789 .chained = true,
8790 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8791 },
8792 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8793 .type = HDA_FIXUP_FUNC,
8794 .v.func = alc_fixup_no_shutup,
8795 .chained = true,
8796 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8797 },
8798 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8799 .type = HDA_FIXUP_PINS,
8800 .v.pins = (const struct hda_pintbl[]) {
8801 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8802 { }
8803 },
8804 .chained = true,
8805 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8806 },
8807 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8808 .type = HDA_FIXUP_FUNC,
8809 .v.func = alc269_fixup_limit_int_mic_boost,
8810 .chained = true,
8811 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8812 },
8813 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8814 .type = HDA_FIXUP_FUNC,
8815 .v.func = alc285_fixup_ideapad_s740_coef,
8816 .chained = true,
8817 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8818 },
8819 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8820 .type = HDA_FIXUP_FUNC,
8821 .v.func = alc287_fixup_legion_15imhg05_speakers,
8822 .chained = true,
8823 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8824 },
8825 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8826 .type = HDA_FIXUP_VERBS,
8827 //.v.verbs = legion_15imhg05_coefs,
8828 .v.verbs = (const struct hda_verb[]) {
8829 // set left speaker Legion 7i.
8830 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8831 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8832
8833 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8834 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8835 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8836 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8837 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8838
8839 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8840 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8841 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8842 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8843 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8844
8845 // set right speaker Legion 7i.
8846 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8847 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8848
8849 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8850 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8851 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8852 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8853 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8854
8855 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8856 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8857 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8858 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8859 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8860 {}
8861 },
8862 .chained = true,
8863 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8864 },
8865 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8866 .type = HDA_FIXUP_FUNC,
8867 .v.func = alc287_fixup_legion_15imhg05_speakers,
8868 .chained = true,
8869 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8870 },
8871 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8872 .type = HDA_FIXUP_VERBS,
8873 .v.verbs = (const struct hda_verb[]) {
8874 // set left speaker Yoga 7i.
8875 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8876 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8877
8878 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8879 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8880 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8881 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8882 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8883
8884 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8885 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8886 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8887 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8888 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8889
8890 // set right speaker Yoga 7i.
8891 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8892 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8893
8894 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8895 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8896 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8897 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8898 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8899
8900 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8901 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8902 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8903 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8904 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8905 {}
8906 },
8907 .chained = true,
8908 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8909 },
8910 [ALC298_FIXUP_LENOVO_C940_DUET7] = {
8911 .type = HDA_FIXUP_FUNC,
8912 .v.func = alc298_fixup_lenovo_c940_duet7,
8913 },
8914 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8915 .type = HDA_FIXUP_VERBS,
8916 .v.verbs = (const struct hda_verb[]) {
8917 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8918 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8919 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8920 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8921 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8922 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8923 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8924 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8925 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8926 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8927 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8928 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8929 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8930 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8931 {}
8932 },
8933 .chained = true,
8934 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8935 },
8936 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
8937 .type = HDA_FIXUP_FUNC,
8938 .v.func = alc256_fixup_set_coef_defaults,
8939 },
8940 [ALC245_FIXUP_HP_GPIO_LED] = {
8941 .type = HDA_FIXUP_FUNC,
8942 .v.func = alc245_fixup_hp_gpio_led,
8943 },
8944 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8945 .type = HDA_FIXUP_PINS,
8946 .v.pins = (const struct hda_pintbl[]) {
8947 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8948 { }
8949 },
8950 .chained = true,
8951 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8952 },
8953 [ALC233_FIXUP_NO_AUDIO_JACK] = {
8954 .type = HDA_FIXUP_FUNC,
8955 .v.func = alc233_fixup_no_audio_jack,
8956 },
8957 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
8958 .type = HDA_FIXUP_FUNC,
8959 .v.func = alc256_fixup_mic_no_presence_and_resume,
8960 .chained = true,
8961 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8962 },
8963 [ALC287_FIXUP_LEGION_16ACHG6] = {
8964 .type = HDA_FIXUP_FUNC,
8965 .v.func = alc287_fixup_legion_16achg6_speakers,
8966 },
8967 [ALC287_FIXUP_CS35L41_I2C_2] = {
8968 .type = HDA_FIXUP_FUNC,
8969 .v.func = cs35l41_fixup_i2c_two,
8970 .chained = true,
8971 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8972 },
8973 [ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
8974 .type = HDA_FIXUP_FUNC,
8975 .v.func = cs35l41_fixup_i2c_two,
8976 .chained = true,
8977 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8978 },
8979 [ALC245_FIXUP_CS35L41_SPI_2] = {
8980 .type = HDA_FIXUP_FUNC,
8981 .v.func = cs35l41_fixup_spi_two,
8982 },
8983 [ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
8984 .type = HDA_FIXUP_FUNC,
8985 .v.func = cs35l41_fixup_spi_two,
8986 .chained = true,
8987 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
8988 },
8989 [ALC245_FIXUP_CS35L41_SPI1_2] = {
8990 .type = HDA_FIXUP_FUNC,
8991 .v.func = cs35l41_fixup_spi1_two,
8992 },
8993 [ALC245_FIXUP_CS35L41_SPI1_2_HP_GPIO_LED] = {
8994 .type = HDA_FIXUP_FUNC,
8995 .v.func = cs35l41_fixup_spi1_two,
8996 .chained = true,
8997 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
8998 },
8999 [ALC245_FIXUP_CS35L41_SPI_4] = {
9000 .type = HDA_FIXUP_FUNC,
9001 .v.func = cs35l41_fixup_spi_four,
9002 },
9003 [ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9004 .type = HDA_FIXUP_FUNC,
9005 .v.func = cs35l41_fixup_spi_four,
9006 .chained = true,
9007 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
9008 },
9009 [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9010 .type = HDA_FIXUP_VERBS,
9011 .v.verbs = (const struct hda_verb[]) {
9012 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9013 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9014 { }
9015 },
9016 .chained = true,
9017 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9018 },
9019 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9020 .type = HDA_FIXUP_FUNC,
9021 .v.func = alc_fixup_dell4_mic_no_presence_quiet,
9022 .chained = true,
9023 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9024 },
9025 [ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9026 .type = HDA_FIXUP_PINS,
9027 .v.pins = (const struct hda_pintbl[]) {
9028 { 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9029 { }
9030 },
9031 .chained = true,
9032 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9033 },
9034 [ALC287_FIXUP_LEGION_16ITHG6] = {
9035 .type = HDA_FIXUP_FUNC,
9036 .v.func = alc287_fixup_legion_16ithg6_speakers,
9037 },
9038 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9039 .type = HDA_FIXUP_VERBS,
9040 .v.verbs = (const struct hda_verb[]) {
9041 // enable left speaker
9042 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9043 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9044
9045 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9046 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9047 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9048 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9049 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9050
9051 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9052 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9053 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9054 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9055 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9056
9057 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9058 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9059 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9060 { 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9061 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9062
9063 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9064 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9065 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9066 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9067 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9068
9069 // enable right speaker
9070 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9071 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9072
9073 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9074 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9075 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9076 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9077 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9078
9079 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9080 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9081 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9082 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9083 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9084
9085 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9086 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9087 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9088 { 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9089 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9090
9091 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9092 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9093 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9094 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9095 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9096
9097 { },
9098 },
9099 },
9100 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9101 .type = HDA_FIXUP_FUNC,
9102 .v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9103 .chained = true,
9104 .chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9105 },
9106 };
9107
9108 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
9109 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
9110 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9111 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
9112 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
9113 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9114 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9115 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
9116 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9117 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9118 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
9119 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9120 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
9121 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
9122 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
9123 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
9124 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
9125 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9126 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9127 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9128 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9129 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
9130 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
9131 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
9132 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
9133 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9134 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9135 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9136 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9137 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
9138 SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9139 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9140 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9141 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
9142 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
9143 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9144 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9145 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9146 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
9147 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
9148 SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
9149 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
9150 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
9151 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
9152 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9153 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
9154 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
9155 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9156 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9157 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9158 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9159 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9160 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
9161 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
9162 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
9163 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9164 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9165 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
9166 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9167 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
9168 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9169 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9170 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9171 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9172 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9173 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9174 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9175 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9176 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9177 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
9178 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
9179 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
9180 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
9181 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9182 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
9183 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
9184 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9185 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9186 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9187 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9188 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9189 SND_PCI_QUIRK(0x1028, 0x087d, "Dell Precision 5530", ALC289_FIXUP_DUAL_SPK),
9190 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
9191 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
9192 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9193 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9194 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9195 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9196 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9197 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9198 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9199 SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
9200 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
9201 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
9202 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
9203 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9204 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9205 SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9206 SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
9207 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9208 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9209 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9210 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
9211 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
9212 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9213 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9214 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9215 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9216 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9217 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9218 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9219 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9220 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9221 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9222 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9223 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9224 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9225 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9226 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9227 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9228 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9229 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9230 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
9231 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
9232 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9233 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9234 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9235 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9236 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9237 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9238 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9239 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9240 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9241 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9242 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9243 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9244 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9245 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9246 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9247 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9248 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9249 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9250 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9251 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9252 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9253 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9254 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9255 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9256 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9257 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9258 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9259 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9260 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9261 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9262 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9263 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9264 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9265 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9266 SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
9267 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9268 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9269 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9270 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9271 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9272 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9273 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
9274 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9275 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9276 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9277 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9278 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9279 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9280 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
9281 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9282 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
9283 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9284 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9285 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9286 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
9287 SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9288 SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9289 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9290 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9291 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
9292 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
9293 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
9294 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9295 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9296 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9297 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
9298 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
9299 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9300 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
9301 ALC285_FIXUP_HP_GPIO_AMP_INIT),
9302 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
9303 ALC285_FIXUP_HP_GPIO_AMP_INIT),
9304 SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9305 SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9306 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9307 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
9308 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9309 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9310 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9311 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9312 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
9313 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
9314 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9315 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9316 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9317 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9318 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9319 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9320 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9321 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9322 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9323 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9324 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9325 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9326 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9327 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9328 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9329 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
9330 SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
9331 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
9332 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9333 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
9334 SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
9335 SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9336 SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9337 SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9338 SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9339 SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9340 SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9341 SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
9342 SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9343 SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9344 SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9345 SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
9346 SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9347 SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
9348 SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
9349 SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
9350 SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
9351 SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
9352 SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
9353 SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9354 SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9355 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9356 SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9357 SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
9358 SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
9359 SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
9360 SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
9361 SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI1_2_HP_GPIO_LED),
9362 SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9363 SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9364 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
9365 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
9366 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9367 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
9368 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
9369 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9370 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9371 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9372 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9373 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
9374 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
9375 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
9376 SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
9377 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
9378 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
9379 SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
9380 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
9381 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
9382 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
9383 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
9384 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
9385 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
9386 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
9387 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
9388 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
9389 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
9390 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
9391 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
9392 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
9393 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
9394 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
9395 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
9396 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
9397 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
9398 SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
9399 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
9400 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
9401 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9402 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9403 SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
9404 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
9405 SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
9406 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
9407 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
9408 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
9409 SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
9410 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
9411 SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
9412 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
9413 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
9414 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
9415 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
9416 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
9417 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
9418 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
9419 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
9420 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
9421 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
9422 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
9423 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
9424 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
9425 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
9426 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
9427 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
9428 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
9429 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
9430 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
9431 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
9432 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
9433 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9434 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9435 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9436 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
9437 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
9438 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
9439 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
9440 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
9441 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
9442 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
9443 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
9444 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
9445 SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
9446 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
9447 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
9448 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
9449 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
9450 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9451 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9452 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9453 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9454 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9455 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9456 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9457 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9458 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9459 SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9460 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9461 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9462 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9463 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9464 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9465 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9466 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9467 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9468 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9469 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9470 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9471 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9472 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9473 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9474 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9475 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9476 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9477 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9478 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9479 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9480 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9481 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9482 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9483 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9484 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9485 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9486 SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9487 SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9488 SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9489 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9490 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9491 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9492 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9493 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9494 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9495 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9496 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9497 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9498 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
9499 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9500 SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9501 SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9502 SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9503 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9504 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
9505 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9506 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9507 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9508 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9509 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9510 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9511 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9512 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9513 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9514 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9515 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9516 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9517 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9518 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9519 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9520 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
9521 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
9522 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
9523 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
9524 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
9525 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
9526 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
9527 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
9528 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
9529 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
9530 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
9531 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
9532 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9533 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
9534 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
9535 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
9536 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
9537 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
9538 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
9539 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9540 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
9541 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
9542 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
9543 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9544 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9545 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
9546 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
9547 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
9548 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9549 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9550 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
9551 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9552 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9553 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9554 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9555 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
9556 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
9557 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9558 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9559 SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9560 SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9561 SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9562 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
9563 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
9564 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9565 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9566 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9567 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9568 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9569 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9570 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9571 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9572 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
9573 SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
9574 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9575 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
9576 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
9577 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
9578 SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9579 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
9580 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
9581 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9582 SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
9583 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
9584 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
9585 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9586 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9587 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9588 SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
9589 SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
9590 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
9591 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
9592 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
9593 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
9594 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9595 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
9596 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
9597 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9598 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
9599 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
9600 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
9601 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
9602 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
9603 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9604 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
9605 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
9606 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9607 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9608 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9609 SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
9610 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9611 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9612 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9613 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
9614 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
9615 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
9616 SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
9617 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
9618 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
9619 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
9620 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
9621 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
9622 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
9623 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
9624 SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
9625 SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
9626 SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9627 SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9628 SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9629 SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
9630 SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
9631 SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
9632 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
9633 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
9634 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
9635 SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
9636 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
9637 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
9638 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
9639 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
9640 SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
9641
9642 #if 0
9643 /* Below is a quirk table taken from the old code.
9644 * Basically the device should work as is without the fixup table.
9645 * If BIOS doesn't give a proper info, enable the corresponding
9646 * fixup entry.
9647 */
9648 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
9649 ALC269_FIXUP_AMIC),
9650 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
9651 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
9652 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
9653 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
9654 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
9655 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
9656 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
9657 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
9658 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
9659 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
9660 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
9661 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
9662 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
9663 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
9664 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
9665 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
9666 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
9667 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
9668 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
9669 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
9670 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
9671 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
9672 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
9673 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
9674 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
9675 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
9676 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
9677 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
9678 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
9679 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
9680 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
9681 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
9682 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
9683 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
9684 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
9685 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
9686 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
9687 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
9688 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
9689 #endif
9690 {}
9691 };
9692
9693 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9694 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9695 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9696 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9697 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
9698 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
9699 {}
9700 };
9701
9702 static const struct hda_model_fixup alc269_fixup_models[] = {
9703 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9704 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
9705 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9706 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9707 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
9708 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
9709 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9710 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
9711 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
9712 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9713 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9714 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
9715 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9716 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
9717 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9718 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
9719 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
9720 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
9721 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9722 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
9723 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
9724 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
9725 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
9726 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
9727 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
9728 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9729 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9730 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9731 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9732 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9733 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9734 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9735 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9736 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9737 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9738 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9739 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9740 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9741 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9742 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9743 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9744 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9745 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9746 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9747 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9748 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9749 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9750 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9751 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9752 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9753 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9754 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9755 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9756 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9757 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9758 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9759 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9760 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9761 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9762 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9763 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9764 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9765 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9766 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9767 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
9768 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
9769 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
9770 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
9771 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9772 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9773 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9774 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9775 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9776 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9777 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9778 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9779 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9780 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9781 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9782 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9783 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9784 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
9785 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9786 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9787 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
9788 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
9789 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
9790 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
9791 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9792 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9793 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9794 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9795 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9796 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9797 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9798 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9799 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9800 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9801 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9802 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9803 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9804 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9805 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9806 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9807 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
9808 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9809 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
9810 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
9811 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
9812 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
9813 {.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
9814 {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
9815 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
9816 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
9817 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
9818 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
9819 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
9820 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
9821 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
9822 {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
9823 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
9824 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
9825 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
9826 {}
9827 };
9828 #define ALC225_STANDARD_PINS \
9829 {0x21, 0x04211020}
9830
9831 #define ALC256_STANDARD_PINS \
9832 {0x12, 0x90a60140}, \
9833 {0x14, 0x90170110}, \
9834 {0x21, 0x02211020}
9835
9836 #define ALC282_STANDARD_PINS \
9837 {0x14, 0x90170110}
9838
9839 #define ALC290_STANDARD_PINS \
9840 {0x12, 0x99a30130}
9841
9842 #define ALC292_STANDARD_PINS \
9843 {0x14, 0x90170110}, \
9844 {0x15, 0x0221401f}
9845
9846 #define ALC295_STANDARD_PINS \
9847 {0x12, 0xb7a60130}, \
9848 {0x14, 0x90170110}, \
9849 {0x21, 0x04211020}
9850
9851 #define ALC298_STANDARD_PINS \
9852 {0x12, 0x90a60130}, \
9853 {0x21, 0x03211020}
9854
9855 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
9856 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9857 {0x14, 0x01014020},
9858 {0x17, 0x90170110},
9859 {0x18, 0x02a11030},
9860 {0x19, 0x0181303F},
9861 {0x21, 0x0221102f}),
9862 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9863 {0x12, 0x90a601c0},
9864 {0x14, 0x90171120},
9865 {0x21, 0x02211030}),
9866 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9867 {0x14, 0x90170110},
9868 {0x1b, 0x90a70130},
9869 {0x21, 0x03211020}),
9870 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9871 {0x1a, 0x90a70130},
9872 {0x1b, 0x90170110},
9873 {0x21, 0x03211020}),
9874 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9875 ALC225_STANDARD_PINS,
9876 {0x12, 0xb7a60130},
9877 {0x14, 0x901701a0}),
9878 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9879 ALC225_STANDARD_PINS,
9880 {0x12, 0xb7a60130},
9881 {0x14, 0x901701b0}),
9882 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9883 ALC225_STANDARD_PINS,
9884 {0x12, 0xb7a60150},
9885 {0x14, 0x901701a0}),
9886 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9887 ALC225_STANDARD_PINS,
9888 {0x12, 0xb7a60150},
9889 {0x14, 0x901701b0}),
9890 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9891 ALC225_STANDARD_PINS,
9892 {0x12, 0xb7a60130},
9893 {0x1b, 0x90170110}),
9894 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9895 {0x1b, 0x01111010},
9896 {0x1e, 0x01451130},
9897 {0x21, 0x02211020}),
9898 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9899 {0x12, 0x90a60140},
9900 {0x14, 0x90170110},
9901 {0x19, 0x02a11030},
9902 {0x21, 0x02211020}),
9903 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9904 {0x14, 0x90170110},
9905 {0x19, 0x02a11030},
9906 {0x1a, 0x02a11040},
9907 {0x1b, 0x01014020},
9908 {0x21, 0x0221101f}),
9909 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9910 {0x14, 0x90170110},
9911 {0x19, 0x02a11030},
9912 {0x1a, 0x02a11040},
9913 {0x1b, 0x01011020},
9914 {0x21, 0x0221101f}),
9915 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9916 {0x14, 0x90170110},
9917 {0x19, 0x02a11020},
9918 {0x1a, 0x02a11030},
9919 {0x21, 0x0221101f}),
9920 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9921 {0x21, 0x02211010}),
9922 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9923 {0x14, 0x90170110},
9924 {0x19, 0x02a11020},
9925 {0x21, 0x02211030}),
9926 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9927 {0x14, 0x90170110},
9928 {0x21, 0x02211020}),
9929 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9930 {0x14, 0x90170130},
9931 {0x21, 0x02211040}),
9932 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9933 {0x12, 0x90a60140},
9934 {0x14, 0x90170110},
9935 {0x21, 0x02211020}),
9936 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9937 {0x12, 0x90a60160},
9938 {0x14, 0x90170120},
9939 {0x21, 0x02211030}),
9940 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9941 {0x14, 0x90170110},
9942 {0x1b, 0x02011020},
9943 {0x21, 0x0221101f}),
9944 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9945 {0x14, 0x90170110},
9946 {0x1b, 0x01011020},
9947 {0x21, 0x0221101f}),
9948 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9949 {0x14, 0x90170130},
9950 {0x1b, 0x01014020},
9951 {0x21, 0x0221103f}),
9952 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9953 {0x14, 0x90170130},
9954 {0x1b, 0x01011020},
9955 {0x21, 0x0221103f}),
9956 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9957 {0x14, 0x90170130},
9958 {0x1b, 0x02011020},
9959 {0x21, 0x0221103f}),
9960 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9961 {0x14, 0x90170150},
9962 {0x1b, 0x02011020},
9963 {0x21, 0x0221105f}),
9964 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9965 {0x14, 0x90170110},
9966 {0x1b, 0x01014020},
9967 {0x21, 0x0221101f}),
9968 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9969 {0x12, 0x90a60160},
9970 {0x14, 0x90170120},
9971 {0x17, 0x90170140},
9972 {0x21, 0x0321102f}),
9973 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9974 {0x12, 0x90a60160},
9975 {0x14, 0x90170130},
9976 {0x21, 0x02211040}),
9977 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9978 {0x12, 0x90a60160},
9979 {0x14, 0x90170140},
9980 {0x21, 0x02211050}),
9981 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9982 {0x12, 0x90a60170},
9983 {0x14, 0x90170120},
9984 {0x21, 0x02211030}),
9985 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9986 {0x12, 0x90a60170},
9987 {0x14, 0x90170130},
9988 {0x21, 0x02211040}),
9989 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9990 {0x12, 0x90a60170},
9991 {0x14, 0x90171130},
9992 {0x21, 0x02211040}),
9993 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9994 {0x12, 0x90a60170},
9995 {0x14, 0x90170140},
9996 {0x21, 0x02211050}),
9997 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9998 {0x12, 0x90a60180},
9999 {0x14, 0x90170130},
10000 {0x21, 0x02211040}),
10001 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10002 {0x12, 0x90a60180},
10003 {0x14, 0x90170120},
10004 {0x21, 0x02211030}),
10005 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10006 {0x1b, 0x01011020},
10007 {0x21, 0x02211010}),
10008 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10009 {0x14, 0x90170110},
10010 {0x1b, 0x90a70130},
10011 {0x21, 0x04211020}),
10012 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10013 {0x14, 0x90170110},
10014 {0x1b, 0x90a70130},
10015 {0x21, 0x03211020}),
10016 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10017 {0x12, 0x90a60130},
10018 {0x14, 0x90170110},
10019 {0x21, 0x03211020}),
10020 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10021 {0x12, 0x90a60130},
10022 {0x14, 0x90170110},
10023 {0x21, 0x04211020}),
10024 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10025 {0x1a, 0x90a70130},
10026 {0x1b, 0x90170110},
10027 {0x21, 0x03211020}),
10028 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10029 {0x14, 0x90170110},
10030 {0x19, 0x02a11020},
10031 {0x21, 0x0221101f}),
10032 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
10033 {0x17, 0x90170110},
10034 {0x19, 0x03a11030},
10035 {0x21, 0x03211020}),
10036 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10037 {0x12, 0x90a60130},
10038 {0x14, 0x90170110},
10039 {0x15, 0x0421101f},
10040 {0x1a, 0x04a11020}),
10041 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10042 {0x12, 0x90a60140},
10043 {0x14, 0x90170110},
10044 {0x15, 0x0421101f},
10045 {0x18, 0x02811030},
10046 {0x1a, 0x04a1103f},
10047 {0x1b, 0x02011020}),
10048 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10049 ALC282_STANDARD_PINS,
10050 {0x12, 0x99a30130},
10051 {0x19, 0x03a11020},
10052 {0x21, 0x0321101f}),
10053 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10054 ALC282_STANDARD_PINS,
10055 {0x12, 0x99a30130},
10056 {0x19, 0x03a11020},
10057 {0x21, 0x03211040}),
10058 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10059 ALC282_STANDARD_PINS,
10060 {0x12, 0x99a30130},
10061 {0x19, 0x03a11030},
10062 {0x21, 0x03211020}),
10063 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10064 ALC282_STANDARD_PINS,
10065 {0x12, 0x99a30130},
10066 {0x19, 0x04a11020},
10067 {0x21, 0x0421101f}),
10068 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
10069 ALC282_STANDARD_PINS,
10070 {0x12, 0x90a60140},
10071 {0x19, 0x04a11030},
10072 {0x21, 0x04211020}),
10073 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10074 ALC282_STANDARD_PINS,
10075 {0x12, 0x90a609c0},
10076 {0x18, 0x03a11830},
10077 {0x19, 0x04a19831},
10078 {0x1a, 0x0481303f},
10079 {0x1b, 0x04211020},
10080 {0x21, 0x0321101f}),
10081 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10082 ALC282_STANDARD_PINS,
10083 {0x12, 0x90a60940},
10084 {0x18, 0x03a11830},
10085 {0x19, 0x04a19831},
10086 {0x1a, 0x0481303f},
10087 {0x1b, 0x04211020},
10088 {0x21, 0x0321101f}),
10089 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10090 ALC282_STANDARD_PINS,
10091 {0x12, 0x90a60130},
10092 {0x21, 0x0321101f}),
10093 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10094 {0x12, 0x90a60160},
10095 {0x14, 0x90170120},
10096 {0x21, 0x02211030}),
10097 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10098 ALC282_STANDARD_PINS,
10099 {0x12, 0x90a60130},
10100 {0x19, 0x03a11020},
10101 {0x21, 0x0321101f}),
10102 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10103 {0x12, 0x90a60130},
10104 {0x14, 0x90170110},
10105 {0x19, 0x04a11040},
10106 {0x21, 0x04211020}),
10107 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10108 {0x14, 0x90170110},
10109 {0x19, 0x04a11040},
10110 {0x1d, 0x40600001},
10111 {0x21, 0x04211020}),
10112 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10113 {0x14, 0x90170110},
10114 {0x19, 0x04a11040},
10115 {0x21, 0x04211020}),
10116 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10117 {0x14, 0x90170110},
10118 {0x17, 0x90170111},
10119 {0x19, 0x03a11030},
10120 {0x21, 0x03211020}),
10121 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
10122 {0x12, 0x90a60130},
10123 {0x17, 0x90170110},
10124 {0x21, 0x02211020}),
10125 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
10126 {0x12, 0x90a60120},
10127 {0x14, 0x90170110},
10128 {0x21, 0x0321101f}),
10129 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10130 ALC290_STANDARD_PINS,
10131 {0x15, 0x04211040},
10132 {0x18, 0x90170112},
10133 {0x1a, 0x04a11020}),
10134 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10135 ALC290_STANDARD_PINS,
10136 {0x15, 0x04211040},
10137 {0x18, 0x90170110},
10138 {0x1a, 0x04a11020}),
10139 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10140 ALC290_STANDARD_PINS,
10141 {0x15, 0x0421101f},
10142 {0x1a, 0x04a11020}),
10143 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10144 ALC290_STANDARD_PINS,
10145 {0x15, 0x04211020},
10146 {0x1a, 0x04a11040}),
10147 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10148 ALC290_STANDARD_PINS,
10149 {0x14, 0x90170110},
10150 {0x15, 0x04211020},
10151 {0x1a, 0x04a11040}),
10152 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10153 ALC290_STANDARD_PINS,
10154 {0x14, 0x90170110},
10155 {0x15, 0x04211020},
10156 {0x1a, 0x04a11020}),
10157 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10158 ALC290_STANDARD_PINS,
10159 {0x14, 0x90170110},
10160 {0x15, 0x0421101f},
10161 {0x1a, 0x04a11020}),
10162 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10163 ALC292_STANDARD_PINS,
10164 {0x12, 0x90a60140},
10165 {0x16, 0x01014020},
10166 {0x19, 0x01a19030}),
10167 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10168 ALC292_STANDARD_PINS,
10169 {0x12, 0x90a60140},
10170 {0x16, 0x01014020},
10171 {0x18, 0x02a19031},
10172 {0x19, 0x01a1903e}),
10173 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
10174 ALC292_STANDARD_PINS,
10175 {0x12, 0x90a60140}),
10176 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10177 ALC292_STANDARD_PINS,
10178 {0x13, 0x90a60140},
10179 {0x16, 0x21014020},
10180 {0x19, 0x21a19030}),
10181 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10182 ALC292_STANDARD_PINS,
10183 {0x13, 0x90a60140}),
10184 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
10185 {0x17, 0x90170110},
10186 {0x21, 0x04211020}),
10187 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
10188 {0x14, 0x90170110},
10189 {0x1b, 0x90a70130},
10190 {0x21, 0x04211020}),
10191 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10192 {0x12, 0x90a60130},
10193 {0x17, 0x90170110},
10194 {0x21, 0x03211020}),
10195 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10196 {0x12, 0x90a60130},
10197 {0x17, 0x90170110},
10198 {0x21, 0x04211020}),
10199 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10200 {0x12, 0x90a60130},
10201 {0x17, 0x90170110},
10202 {0x21, 0x03211020}),
10203 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10204 {0x12, 0x90a60120},
10205 {0x17, 0x90170110},
10206 {0x21, 0x04211030}),
10207 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10208 {0x12, 0x90a60130},
10209 {0x17, 0x90170110},
10210 {0x21, 0x03211020}),
10211 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10212 {0x12, 0x90a60130},
10213 {0x17, 0x90170110},
10214 {0x21, 0x03211020}),
10215 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10216 {0x14, 0x90170110},
10217 {0x21, 0x04211020}),
10218 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10219 {0x14, 0x90170110},
10220 {0x21, 0x04211030}),
10221 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10222 ALC295_STANDARD_PINS,
10223 {0x17, 0x21014020},
10224 {0x18, 0x21a19030}),
10225 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10226 ALC295_STANDARD_PINS,
10227 {0x17, 0x21014040},
10228 {0x18, 0x21a19050}),
10229 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10230 ALC295_STANDARD_PINS),
10231 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10232 ALC298_STANDARD_PINS,
10233 {0x17, 0x90170110}),
10234 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10235 ALC298_STANDARD_PINS,
10236 {0x17, 0x90170140}),
10237 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10238 ALC298_STANDARD_PINS,
10239 {0x17, 0x90170150}),
10240 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
10241 {0x12, 0xb7a60140},
10242 {0x13, 0xb7a60150},
10243 {0x17, 0x90170110},
10244 {0x1a, 0x03011020},
10245 {0x21, 0x03211030}),
10246 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
10247 {0x12, 0xb7a60140},
10248 {0x17, 0x90170110},
10249 {0x1a, 0x03a11030},
10250 {0x21, 0x03211020}),
10251 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10252 ALC225_STANDARD_PINS,
10253 {0x12, 0xb7a60130},
10254 {0x17, 0x90170110}),
10255 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
10256 {0x14, 0x01014010},
10257 {0x17, 0x90170120},
10258 {0x18, 0x02a11030},
10259 {0x19, 0x02a1103f},
10260 {0x21, 0x0221101f}),
10261 {}
10262 };
10263
10264 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
10265 * more machines, don't need to match all valid pins, just need to match
10266 * all the pins defined in the tbl. Just because of this reason, it is possible
10267 * that a single machine matches multiple tbls, so there is one limitation:
10268 * at most one tbl is allowed to define for the same vendor and same codec
10269 */
10270 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
10271 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10272 {0x19, 0x40000000},
10273 {0x1b, 0x40000000}),
10274 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10275 {0x19, 0x40000000},
10276 {0x1a, 0x40000000}),
10277 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10278 {0x19, 0x40000000},
10279 {0x1a, 0x40000000}),
10280 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
10281 {0x19, 0x40000000},
10282 {0x1a, 0x40000000}),
10283 {}
10284 };
10285
10286 static void alc269_fill_coef(struct hda_codec *codec)
10287 {
10288 struct alc_spec *spec = codec->spec;
10289 int val;
10290
10291 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
10292 return;
10293
10294 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
10295 alc_write_coef_idx(codec, 0xf, 0x960b);
10296 alc_write_coef_idx(codec, 0xe, 0x8817);
10297 }
10298
10299 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
10300 alc_write_coef_idx(codec, 0xf, 0x960b);
10301 alc_write_coef_idx(codec, 0xe, 0x8814);
10302 }
10303
10304 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
10305 /* Power up output pin */
10306 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
10307 }
10308
10309 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
10310 val = alc_read_coef_idx(codec, 0xd);
10311 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
10312 /* Capless ramp up clock control */
10313 alc_write_coef_idx(codec, 0xd, val | (1<<10));
10314 }
10315 val = alc_read_coef_idx(codec, 0x17);
10316 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
10317 /* Class D power on reset */
10318 alc_write_coef_idx(codec, 0x17, val | (1<<7));
10319 }
10320 }
10321
10322 /* HP */
10323 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
10324 }
10325
10326 /*
10327 */
10328 static int patch_alc269(struct hda_codec *codec)
10329 {
10330 struct alc_spec *spec;
10331 int err;
10332
10333 err = alc_alloc_spec(codec, 0x0b);
10334 if (err < 0)
10335 return err;
10336
10337 spec = codec->spec;
10338 spec->gen.shared_mic_vref_pin = 0x18;
10339 codec->power_save_node = 0;
10340
10341 #ifdef CONFIG_PM
10342 codec->patch_ops.suspend = alc269_suspend;
10343 codec->patch_ops.resume = alc269_resume;
10344 #endif
10345 spec->shutup = alc_default_shutup;
10346 spec->init_hook = alc_default_init;
10347
10348 switch (codec->core.vendor_id) {
10349 case 0x10ec0269:
10350 spec->codec_variant = ALC269_TYPE_ALC269VA;
10351 switch (alc_get_coef0(codec) & 0x00f0) {
10352 case 0x0010:
10353 if (codec->bus->pci &&
10354 codec->bus->pci->subsystem_vendor == 0x1025 &&
10355 spec->cdefine.platform_type == 1)
10356 err = alc_codec_rename(codec, "ALC271X");
10357 spec->codec_variant = ALC269_TYPE_ALC269VB;
10358 break;
10359 case 0x0020:
10360 if (codec->bus->pci &&
10361 codec->bus->pci->subsystem_vendor == 0x17aa &&
10362 codec->bus->pci->subsystem_device == 0x21f3)
10363 err = alc_codec_rename(codec, "ALC3202");
10364 spec->codec_variant = ALC269_TYPE_ALC269VC;
10365 break;
10366 case 0x0030:
10367 spec->codec_variant = ALC269_TYPE_ALC269VD;
10368 break;
10369 default:
10370 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10371 }
10372 if (err < 0)
10373 goto error;
10374 spec->shutup = alc269_shutup;
10375 spec->init_hook = alc269_fill_coef;
10376 alc269_fill_coef(codec);
10377 break;
10378
10379 case 0x10ec0280:
10380 case 0x10ec0290:
10381 spec->codec_variant = ALC269_TYPE_ALC280;
10382 break;
10383 case 0x10ec0282:
10384 spec->codec_variant = ALC269_TYPE_ALC282;
10385 spec->shutup = alc282_shutup;
10386 spec->init_hook = alc282_init;
10387 break;
10388 case 0x10ec0233:
10389 case 0x10ec0283:
10390 spec->codec_variant = ALC269_TYPE_ALC283;
10391 spec->shutup = alc283_shutup;
10392 spec->init_hook = alc283_init;
10393 break;
10394 case 0x10ec0284:
10395 case 0x10ec0292:
10396 spec->codec_variant = ALC269_TYPE_ALC284;
10397 break;
10398 case 0x10ec0293:
10399 spec->codec_variant = ALC269_TYPE_ALC293;
10400 break;
10401 case 0x10ec0286:
10402 case 0x10ec0288:
10403 spec->codec_variant = ALC269_TYPE_ALC286;
10404 break;
10405 case 0x10ec0298:
10406 spec->codec_variant = ALC269_TYPE_ALC298;
10407 break;
10408 case 0x10ec0235:
10409 case 0x10ec0255:
10410 spec->codec_variant = ALC269_TYPE_ALC255;
10411 spec->shutup = alc256_shutup;
10412 spec->init_hook = alc256_init;
10413 break;
10414 case 0x10ec0230:
10415 case 0x10ec0236:
10416 case 0x10ec0256:
10417 case 0x19e58326:
10418 spec->codec_variant = ALC269_TYPE_ALC256;
10419 spec->shutup = alc256_shutup;
10420 spec->init_hook = alc256_init;
10421 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
10422 break;
10423 case 0x10ec0257:
10424 spec->codec_variant = ALC269_TYPE_ALC257;
10425 spec->shutup = alc256_shutup;
10426 spec->init_hook = alc256_init;
10427 spec->gen.mixer_nid = 0;
10428 break;
10429 case 0x10ec0215:
10430 case 0x10ec0245:
10431 case 0x10ec0285:
10432 case 0x10ec0289:
10433 if (alc_get_coef0(codec) & 0x0010)
10434 spec->codec_variant = ALC269_TYPE_ALC245;
10435 else
10436 spec->codec_variant = ALC269_TYPE_ALC215;
10437 spec->shutup = alc225_shutup;
10438 spec->init_hook = alc225_init;
10439 spec->gen.mixer_nid = 0;
10440 break;
10441 case 0x10ec0225:
10442 case 0x10ec0295:
10443 case 0x10ec0299:
10444 spec->codec_variant = ALC269_TYPE_ALC225;
10445 spec->shutup = alc225_shutup;
10446 spec->init_hook = alc225_init;
10447 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
10448 break;
10449 case 0x10ec0287:
10450 spec->codec_variant = ALC269_TYPE_ALC287;
10451 spec->shutup = alc225_shutup;
10452 spec->init_hook = alc225_init;
10453 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
10454 break;
10455 case 0x10ec0234:
10456 case 0x10ec0274:
10457 case 0x10ec0294:
10458 spec->codec_variant = ALC269_TYPE_ALC294;
10459 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
10460 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
10461 spec->init_hook = alc294_init;
10462 break;
10463 case 0x10ec0300:
10464 spec->codec_variant = ALC269_TYPE_ALC300;
10465 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
10466 break;
10467 case 0x10ec0623:
10468 spec->codec_variant = ALC269_TYPE_ALC623;
10469 break;
10470 case 0x10ec0700:
10471 case 0x10ec0701:
10472 case 0x10ec0703:
10473 case 0x10ec0711:
10474 spec->codec_variant = ALC269_TYPE_ALC700;
10475 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
10476 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
10477 spec->init_hook = alc294_init;
10478 break;
10479
10480 }
10481
10482 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
10483 spec->has_alc5505_dsp = 1;
10484 spec->init_hook = alc5505_dsp_init;
10485 }
10486
10487 alc_pre_init(codec);
10488
10489 snd_hda_pick_fixup(codec, alc269_fixup_models,
10490 alc269_fixup_tbl, alc269_fixups);
10491 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
10492 * the quirk breaks the latter (bko#214101).
10493 * Clear the wrong entry.
10494 */
10495 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
10496 codec->core.vendor_id == 0x10ec0294) {
10497 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
10498 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
10499 }
10500
10501 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
10502 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
10503 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
10504 alc269_fixups);
10505 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10506
10507 alc_auto_parse_customize_define(codec);
10508
10509 if (has_cdefine_beep(codec))
10510 spec->gen.beep_nid = 0x01;
10511
10512 /* automatic parse from the BIOS config */
10513 err = alc269_parse_auto_config(codec);
10514 if (err < 0)
10515 goto error;
10516
10517 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
10518 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
10519 if (err < 0)
10520 goto error;
10521 }
10522
10523 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10524
10525 return 0;
10526
10527 error:
10528 alc_free(codec);
10529 return err;
10530 }
10531
10532 /*
10533 * ALC861
10534 */
10535
10536 static int alc861_parse_auto_config(struct hda_codec *codec)
10537 {
10538 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
10539 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
10540 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
10541 }
10542
10543 /* Pin config fixes */
10544 enum {
10545 ALC861_FIXUP_FSC_AMILO_PI1505,
10546 ALC861_FIXUP_AMP_VREF_0F,
10547 ALC861_FIXUP_NO_JACK_DETECT,
10548 ALC861_FIXUP_ASUS_A6RP,
10549 ALC660_FIXUP_ASUS_W7J,
10550 };
10551
10552 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
10553 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
10554 const struct hda_fixup *fix, int action)
10555 {
10556 struct alc_spec *spec = codec->spec;
10557 unsigned int val;
10558
10559 if (action != HDA_FIXUP_ACT_INIT)
10560 return;
10561 val = snd_hda_codec_get_pin_target(codec, 0x0f);
10562 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
10563 val |= AC_PINCTL_IN_EN;
10564 val |= AC_PINCTL_VREF_50;
10565 snd_hda_set_pin_ctl(codec, 0x0f, val);
10566 spec->gen.keep_vref_in_automute = 1;
10567 }
10568
10569 /* suppress the jack-detection */
10570 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
10571 const struct hda_fixup *fix, int action)
10572 {
10573 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10574 codec->no_jack_detect = 1;
10575 }
10576
10577 static const struct hda_fixup alc861_fixups[] = {
10578 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
10579 .type = HDA_FIXUP_PINS,
10580 .v.pins = (const struct hda_pintbl[]) {
10581 { 0x0b, 0x0221101f }, /* HP */
10582 { 0x0f, 0x90170310 }, /* speaker */
10583 { }
10584 }
10585 },
10586 [ALC861_FIXUP_AMP_VREF_0F] = {
10587 .type = HDA_FIXUP_FUNC,
10588 .v.func = alc861_fixup_asus_amp_vref_0f,
10589 },
10590 [ALC861_FIXUP_NO_JACK_DETECT] = {
10591 .type = HDA_FIXUP_FUNC,
10592 .v.func = alc_fixup_no_jack_detect,
10593 },
10594 [ALC861_FIXUP_ASUS_A6RP] = {
10595 .type = HDA_FIXUP_FUNC,
10596 .v.func = alc861_fixup_asus_amp_vref_0f,
10597 .chained = true,
10598 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
10599 },
10600 [ALC660_FIXUP_ASUS_W7J] = {
10601 .type = HDA_FIXUP_VERBS,
10602 .v.verbs = (const struct hda_verb[]) {
10603 /* ASUS W7J needs a magic pin setup on unused NID 0x10
10604 * for enabling outputs
10605 */
10606 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10607 { }
10608 },
10609 }
10610 };
10611
10612 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
10613 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
10614 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
10615 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
10616 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
10617 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
10618 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
10619 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
10620 {}
10621 };
10622
10623 /*
10624 */
10625 static int patch_alc861(struct hda_codec *codec)
10626 {
10627 struct alc_spec *spec;
10628 int err;
10629
10630 err = alc_alloc_spec(codec, 0x15);
10631 if (err < 0)
10632 return err;
10633
10634 spec = codec->spec;
10635 if (has_cdefine_beep(codec))
10636 spec->gen.beep_nid = 0x23;
10637
10638 #ifdef CONFIG_PM
10639 spec->power_hook = alc_power_eapd;
10640 #endif
10641
10642 alc_pre_init(codec);
10643
10644 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10645 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10646
10647 /* automatic parse from the BIOS config */
10648 err = alc861_parse_auto_config(codec);
10649 if (err < 0)
10650 goto error;
10651
10652 if (!spec->gen.no_analog) {
10653 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
10654 if (err < 0)
10655 goto error;
10656 }
10657
10658 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10659
10660 return 0;
10661
10662 error:
10663 alc_free(codec);
10664 return err;
10665 }
10666
10667 /*
10668 * ALC861-VD support
10669 *
10670 * Based on ALC882
10671 *
10672 * In addition, an independent DAC
10673 */
10674 static int alc861vd_parse_auto_config(struct hda_codec *codec)
10675 {
10676 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
10677 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10678 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
10679 }
10680
10681 enum {
10682 ALC660VD_FIX_ASUS_GPIO1,
10683 ALC861VD_FIX_DALLAS,
10684 };
10685
10686 /* exclude VREF80 */
10687 static void alc861vd_fixup_dallas(struct hda_codec *codec,
10688 const struct hda_fixup *fix, int action)
10689 {
10690 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10691 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10692 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
10693 }
10694 }
10695
10696 /* reset GPIO1 */
10697 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10698 const struct hda_fixup *fix, int action)
10699 {
10700 struct alc_spec *spec = codec->spec;
10701
10702 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10703 spec->gpio_mask |= 0x02;
10704 alc_fixup_gpio(codec, action, 0x01);
10705 }
10706
10707 static const struct hda_fixup alc861vd_fixups[] = {
10708 [ALC660VD_FIX_ASUS_GPIO1] = {
10709 .type = HDA_FIXUP_FUNC,
10710 .v.func = alc660vd_fixup_asus_gpio1,
10711 },
10712 [ALC861VD_FIX_DALLAS] = {
10713 .type = HDA_FIXUP_FUNC,
10714 .v.func = alc861vd_fixup_dallas,
10715 },
10716 };
10717
10718 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
10719 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
10720 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
10721 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
10722 {}
10723 };
10724
10725 /*
10726 */
10727 static int patch_alc861vd(struct hda_codec *codec)
10728 {
10729 struct alc_spec *spec;
10730 int err;
10731
10732 err = alc_alloc_spec(codec, 0x0b);
10733 if (err < 0)
10734 return err;
10735
10736 spec = codec->spec;
10737 if (has_cdefine_beep(codec))
10738 spec->gen.beep_nid = 0x23;
10739
10740 spec->shutup = alc_eapd_shutup;
10741
10742 alc_pre_init(codec);
10743
10744 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10745 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10746
10747 /* automatic parse from the BIOS config */
10748 err = alc861vd_parse_auto_config(codec);
10749 if (err < 0)
10750 goto error;
10751
10752 if (!spec->gen.no_analog) {
10753 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10754 if (err < 0)
10755 goto error;
10756 }
10757
10758 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10759
10760 return 0;
10761
10762 error:
10763 alc_free(codec);
10764 return err;
10765 }
10766
10767 /*
10768 * ALC662 support
10769 *
10770 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10771 * configuration. Each pin widget can choose any input DACs and a mixer.
10772 * Each ADC is connected from a mixer of all inputs. This makes possible
10773 * 6-channel independent captures.
10774 *
10775 * In addition, an independent DAC for the multi-playback (not used in this
10776 * driver yet).
10777 */
10778
10779 /*
10780 * BIOS auto configuration
10781 */
10782
10783 static int alc662_parse_auto_config(struct hda_codec *codec)
10784 {
10785 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
10786 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10787 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10788 const hda_nid_t *ssids;
10789
10790 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10791 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10792 codec->core.vendor_id == 0x10ec0671)
10793 ssids = alc663_ssids;
10794 else
10795 ssids = alc662_ssids;
10796 return alc_parse_auto_config(codec, alc662_ignore, ssids);
10797 }
10798
10799 static void alc272_fixup_mario(struct hda_codec *codec,
10800 const struct hda_fixup *fix, int action)
10801 {
10802 if (action != HDA_FIXUP_ACT_PRE_PROBE)
10803 return;
10804 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10805 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10806 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10807 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10808 (0 << AC_AMPCAP_MUTE_SHIFT)))
10809 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
10810 }
10811
10812 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10813 { .channels = 2,
10814 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10815 { .channels = 4,
10816 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10817 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10818 { }
10819 };
10820
10821 /* override the 2.1 chmap */
10822 static void alc_fixup_bass_chmap(struct hda_codec *codec,
10823 const struct hda_fixup *fix, int action)
10824 {
10825 if (action == HDA_FIXUP_ACT_BUILD) {
10826 struct alc_spec *spec = codec->spec;
10827 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
10828 }
10829 }
10830
10831 /* avoid D3 for keeping GPIO up */
10832 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10833 hda_nid_t nid,
10834 unsigned int power_state)
10835 {
10836 struct alc_spec *spec = codec->spec;
10837 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
10838 return AC_PWRST_D0;
10839 return power_state;
10840 }
10841
10842 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10843 const struct hda_fixup *fix, int action)
10844 {
10845 struct alc_spec *spec = codec->spec;
10846
10847 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
10848 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10849 spec->mute_led_polarity = 1;
10850 codec->power_filter = gpio_led_power_filter;
10851 }
10852 }
10853
10854 static void alc662_usi_automute_hook(struct hda_codec *codec,
10855 struct hda_jack_callback *jack)
10856 {
10857 struct alc_spec *spec = codec->spec;
10858 int vref;
10859 msleep(200);
10860 snd_hda_gen_hp_automute(codec, jack);
10861
10862 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10863 msleep(100);
10864 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10865 vref);
10866 }
10867
10868 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10869 const struct hda_fixup *fix, int action)
10870 {
10871 struct alc_spec *spec = codec->spec;
10872 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10873 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10874 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10875 }
10876 }
10877
10878 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10879 struct hda_jack_callback *cb)
10880 {
10881 /* surround speakers at 0x1b already get muted automatically when
10882 * headphones are plugged in, but we have to mute/unmute the remaining
10883 * channels manually:
10884 * 0x15 - front left/front right
10885 * 0x18 - front center/ LFE
10886 */
10887 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10888 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10889 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10890 } else {
10891 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10892 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10893 }
10894 }
10895
10896 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10897 const struct hda_fixup *fix, int action)
10898 {
10899 /* Pin 0x1b: shared headphones jack and surround speakers */
10900 if (!is_jack_detectable(codec, 0x1b))
10901 return;
10902
10903 switch (action) {
10904 case HDA_FIXUP_ACT_PRE_PROBE:
10905 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10906 alc662_aspire_ethos_mute_speakers);
10907 /* subwoofer needs an extra GPIO setting to become audible */
10908 alc_setup_gpio(codec, 0x02);
10909 break;
10910 case HDA_FIXUP_ACT_INIT:
10911 /* Make sure to start in a correct state, i.e. if
10912 * headphones have been plugged in before powering up the system
10913 */
10914 alc662_aspire_ethos_mute_speakers(codec, NULL);
10915 break;
10916 }
10917 }
10918
10919 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10920 const struct hda_fixup *fix, int action)
10921 {
10922 struct alc_spec *spec = codec->spec;
10923
10924 static const struct hda_pintbl pincfgs[] = {
10925 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10926 { 0x1b, 0x0181304f },
10927 { }
10928 };
10929
10930 switch (action) {
10931 case HDA_FIXUP_ACT_PRE_PROBE:
10932 spec->gen.mixer_nid = 0;
10933 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10934 snd_hda_apply_pincfgs(codec, pincfgs);
10935 break;
10936 case HDA_FIXUP_ACT_INIT:
10937 alc_write_coef_idx(codec, 0x19, 0xa054);
10938 break;
10939 }
10940 }
10941
10942 static void alc897_hp_automute_hook(struct hda_codec *codec,
10943 struct hda_jack_callback *jack)
10944 {
10945 struct alc_spec *spec = codec->spec;
10946 int vref;
10947
10948 snd_hda_gen_hp_automute(codec, jack);
10949 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10950 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10951 vref);
10952 }
10953
10954 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10955 const struct hda_fixup *fix, int action)
10956 {
10957 struct alc_spec *spec = codec->spec;
10958 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10959 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10960 }
10961 }
10962
10963 static const struct coef_fw alc668_coefs[] = {
10964 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10965 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10966 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10967 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10968 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10969 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10970 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10971 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10972 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10973 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10974 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10975 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10976 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10977 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10978 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10979 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10980 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10981 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10982 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10983 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10984 {}
10985 };
10986
10987 static void alc668_restore_default_value(struct hda_codec *codec)
10988 {
10989 alc_process_coef_fw(codec, alc668_coefs);
10990 }
10991
10992 enum {
10993 ALC662_FIXUP_ASPIRE,
10994 ALC662_FIXUP_LED_GPIO1,
10995 ALC662_FIXUP_IDEAPAD,
10996 ALC272_FIXUP_MARIO,
10997 ALC662_FIXUP_CZC_ET26,
10998 ALC662_FIXUP_CZC_P10T,
10999 ALC662_FIXUP_SKU_IGNORE,
11000 ALC662_FIXUP_HP_RP5800,
11001 ALC662_FIXUP_ASUS_MODE1,
11002 ALC662_FIXUP_ASUS_MODE2,
11003 ALC662_FIXUP_ASUS_MODE3,
11004 ALC662_FIXUP_ASUS_MODE4,
11005 ALC662_FIXUP_ASUS_MODE5,
11006 ALC662_FIXUP_ASUS_MODE6,
11007 ALC662_FIXUP_ASUS_MODE7,
11008 ALC662_FIXUP_ASUS_MODE8,
11009 ALC662_FIXUP_NO_JACK_DETECT,
11010 ALC662_FIXUP_ZOTAC_Z68,
11011 ALC662_FIXUP_INV_DMIC,
11012 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11013 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
11014 ALC662_FIXUP_HEADSET_MODE,
11015 ALC668_FIXUP_HEADSET_MODE,
11016 ALC662_FIXUP_BASS_MODE4_CHMAP,
11017 ALC662_FIXUP_BASS_16,
11018 ALC662_FIXUP_BASS_1A,
11019 ALC662_FIXUP_BASS_CHMAP,
11020 ALC668_FIXUP_AUTO_MUTE,
11021 ALC668_FIXUP_DELL_DISABLE_AAMIX,
11022 ALC668_FIXUP_DELL_XPS13,
11023 ALC662_FIXUP_ASUS_Nx50,
11024 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11025 ALC668_FIXUP_ASUS_Nx51,
11026 ALC668_FIXUP_MIC_COEF,
11027 ALC668_FIXUP_ASUS_G751,
11028 ALC891_FIXUP_HEADSET_MODE,
11029 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11030 ALC662_FIXUP_ACER_VERITON,
11031 ALC892_FIXUP_ASROCK_MOBO,
11032 ALC662_FIXUP_USI_FUNC,
11033 ALC662_FIXUP_USI_HEADSET_MODE,
11034 ALC662_FIXUP_LENOVO_MULTI_CODECS,
11035 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
11036 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
11037 ALC671_FIXUP_HP_HEADSET_MIC2,
11038 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
11039 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
11040 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
11041 ALC668_FIXUP_HEADSET_MIC,
11042 ALC668_FIXUP_MIC_DET_COEF,
11043 ALC897_FIXUP_LENOVO_HEADSET_MIC,
11044 ALC897_FIXUP_HEADSET_MIC_PIN,
11045 ALC897_FIXUP_HP_HSMIC_VERB,
11046 };
11047
11048 static const struct hda_fixup alc662_fixups[] = {
11049 [ALC662_FIXUP_ASPIRE] = {
11050 .type = HDA_FIXUP_PINS,
11051 .v.pins = (const struct hda_pintbl[]) {
11052 { 0x15, 0x99130112 }, /* subwoofer */
11053 { }
11054 }
11055 },
11056 [ALC662_FIXUP_LED_GPIO1] = {
11057 .type = HDA_FIXUP_FUNC,
11058 .v.func = alc662_fixup_led_gpio1,
11059 },
11060 [ALC662_FIXUP_IDEAPAD] = {
11061 .type = HDA_FIXUP_PINS,
11062 .v.pins = (const struct hda_pintbl[]) {
11063 { 0x17, 0x99130112 }, /* subwoofer */
11064 { }
11065 },
11066 .chained = true,
11067 .chain_id = ALC662_FIXUP_LED_GPIO1,
11068 },
11069 [ALC272_FIXUP_MARIO] = {
11070 .type = HDA_FIXUP_FUNC,
11071 .v.func = alc272_fixup_mario,
11072 },
11073 [ALC662_FIXUP_CZC_ET26] = {
11074 .type = HDA_FIXUP_PINS,
11075 .v.pins = (const struct hda_pintbl[]) {
11076 {0x12, 0x403cc000},
11077 {0x14, 0x90170110}, /* speaker */
11078 {0x15, 0x411111f0},
11079 {0x16, 0x411111f0},
11080 {0x18, 0x01a19030}, /* mic */
11081 {0x19, 0x90a7013f}, /* int-mic */
11082 {0x1a, 0x01014020},
11083 {0x1b, 0x0121401f},
11084 {0x1c, 0x411111f0},
11085 {0x1d, 0x411111f0},
11086 {0x1e, 0x40478e35},
11087 {}
11088 },
11089 .chained = true,
11090 .chain_id = ALC662_FIXUP_SKU_IGNORE
11091 },
11092 [ALC662_FIXUP_CZC_P10T] = {
11093 .type = HDA_FIXUP_VERBS,
11094 .v.verbs = (const struct hda_verb[]) {
11095 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
11096 {}
11097 }
11098 },
11099 [ALC662_FIXUP_SKU_IGNORE] = {
11100 .type = HDA_FIXUP_FUNC,
11101 .v.func = alc_fixup_sku_ignore,
11102 },
11103 [ALC662_FIXUP_HP_RP5800] = {
11104 .type = HDA_FIXUP_PINS,
11105 .v.pins = (const struct hda_pintbl[]) {
11106 { 0x14, 0x0221201f }, /* HP out */
11107 { }
11108 },
11109 .chained = true,
11110 .chain_id = ALC662_FIXUP_SKU_IGNORE
11111 },
11112 [ALC662_FIXUP_ASUS_MODE1] = {
11113 .type = HDA_FIXUP_PINS,
11114 .v.pins = (const struct hda_pintbl[]) {
11115 { 0x14, 0x99130110 }, /* speaker */
11116 { 0x18, 0x01a19c20 }, /* mic */
11117 { 0x19, 0x99a3092f }, /* int-mic */
11118 { 0x21, 0x0121401f }, /* HP out */
11119 { }
11120 },
11121 .chained = true,
11122 .chain_id = ALC662_FIXUP_SKU_IGNORE
11123 },
11124 [ALC662_FIXUP_ASUS_MODE2] = {
11125 .type = HDA_FIXUP_PINS,
11126 .v.pins = (const struct hda_pintbl[]) {
11127 { 0x14, 0x99130110 }, /* speaker */
11128 { 0x18, 0x01a19820 }, /* mic */
11129 { 0x19, 0x99a3092f }, /* int-mic */
11130 { 0x1b, 0x0121401f }, /* HP out */
11131 { }
11132 },
11133 .chained = true,
11134 .chain_id = ALC662_FIXUP_SKU_IGNORE
11135 },
11136 [ALC662_FIXUP_ASUS_MODE3] = {
11137 .type = HDA_FIXUP_PINS,
11138 .v.pins = (const struct hda_pintbl[]) {
11139 { 0x14, 0x99130110 }, /* speaker */
11140 { 0x15, 0x0121441f }, /* HP */
11141 { 0x18, 0x01a19840 }, /* mic */
11142 { 0x19, 0x99a3094f }, /* int-mic */
11143 { 0x21, 0x01211420 }, /* HP2 */
11144 { }
11145 },
11146 .chained = true,
11147 .chain_id = ALC662_FIXUP_SKU_IGNORE
11148 },
11149 [ALC662_FIXUP_ASUS_MODE4] = {
11150 .type = HDA_FIXUP_PINS,
11151 .v.pins = (const struct hda_pintbl[]) {
11152 { 0x14, 0x99130110 }, /* speaker */
11153 { 0x16, 0x99130111 }, /* speaker */
11154 { 0x18, 0x01a19840 }, /* mic */
11155 { 0x19, 0x99a3094f }, /* int-mic */
11156 { 0x21, 0x0121441f }, /* HP */
11157 { }
11158 },
11159 .chained = true,
11160 .chain_id = ALC662_FIXUP_SKU_IGNORE
11161 },
11162 [ALC662_FIXUP_ASUS_MODE5] = {
11163 .type = HDA_FIXUP_PINS,
11164 .v.pins = (const struct hda_pintbl[]) {
11165 { 0x14, 0x99130110 }, /* speaker */
11166 { 0x15, 0x0121441f }, /* HP */
11167 { 0x16, 0x99130111 }, /* speaker */
11168 { 0x18, 0x01a19840 }, /* mic */
11169 { 0x19, 0x99a3094f }, /* int-mic */
11170 { }
11171 },
11172 .chained = true,
11173 .chain_id = ALC662_FIXUP_SKU_IGNORE
11174 },
11175 [ALC662_FIXUP_ASUS_MODE6] = {
11176 .type = HDA_FIXUP_PINS,
11177 .v.pins = (const struct hda_pintbl[]) {
11178 { 0x14, 0x99130110 }, /* speaker */
11179 { 0x15, 0x01211420 }, /* HP2 */
11180 { 0x18, 0x01a19840 }, /* mic */
11181 { 0x19, 0x99a3094f }, /* int-mic */
11182 { 0x1b, 0x0121441f }, /* HP */
11183 { }
11184 },
11185 .chained = true,
11186 .chain_id = ALC662_FIXUP_SKU_IGNORE
11187 },
11188 [ALC662_FIXUP_ASUS_MODE7] = {
11189 .type = HDA_FIXUP_PINS,
11190 .v.pins = (const struct hda_pintbl[]) {
11191 { 0x14, 0x99130110 }, /* speaker */
11192 { 0x17, 0x99130111 }, /* speaker */
11193 { 0x18, 0x01a19840 }, /* mic */
11194 { 0x19, 0x99a3094f }, /* int-mic */
11195 { 0x1b, 0x01214020 }, /* HP */
11196 { 0x21, 0x0121401f }, /* HP */
11197 { }
11198 },
11199 .chained = true,
11200 .chain_id = ALC662_FIXUP_SKU_IGNORE
11201 },
11202 [ALC662_FIXUP_ASUS_MODE8] = {
11203 .type = HDA_FIXUP_PINS,
11204 .v.pins = (const struct hda_pintbl[]) {
11205 { 0x14, 0x99130110 }, /* speaker */
11206 { 0x12, 0x99a30970 }, /* int-mic */
11207 { 0x15, 0x01214020 }, /* HP */
11208 { 0x17, 0x99130111 }, /* speaker */
11209 { 0x18, 0x01a19840 }, /* mic */
11210 { 0x21, 0x0121401f }, /* HP */
11211 { }
11212 },
11213 .chained = true,
11214 .chain_id = ALC662_FIXUP_SKU_IGNORE
11215 },
11216 [ALC662_FIXUP_NO_JACK_DETECT] = {
11217 .type = HDA_FIXUP_FUNC,
11218 .v.func = alc_fixup_no_jack_detect,
11219 },
11220 [ALC662_FIXUP_ZOTAC_Z68] = {
11221 .type = HDA_FIXUP_PINS,
11222 .v.pins = (const struct hda_pintbl[]) {
11223 { 0x1b, 0x02214020 }, /* Front HP */
11224 { }
11225 }
11226 },
11227 [ALC662_FIXUP_INV_DMIC] = {
11228 .type = HDA_FIXUP_FUNC,
11229 .v.func = alc_fixup_inv_dmic,
11230 },
11231 [ALC668_FIXUP_DELL_XPS13] = {
11232 .type = HDA_FIXUP_FUNC,
11233 .v.func = alc_fixup_dell_xps13,
11234 .chained = true,
11235 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
11236 },
11237 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
11238 .type = HDA_FIXUP_FUNC,
11239 .v.func = alc_fixup_disable_aamix,
11240 .chained = true,
11241 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
11242 },
11243 [ALC668_FIXUP_AUTO_MUTE] = {
11244 .type = HDA_FIXUP_FUNC,
11245 .v.func = alc_fixup_auto_mute_via_amp,
11246 .chained = true,
11247 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
11248 },
11249 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
11250 .type = HDA_FIXUP_PINS,
11251 .v.pins = (const struct hda_pintbl[]) {
11252 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11253 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
11254 { }
11255 },
11256 .chained = true,
11257 .chain_id = ALC662_FIXUP_HEADSET_MODE
11258 },
11259 [ALC662_FIXUP_HEADSET_MODE] = {
11260 .type = HDA_FIXUP_FUNC,
11261 .v.func = alc_fixup_headset_mode_alc662,
11262 },
11263 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
11264 .type = HDA_FIXUP_PINS,
11265 .v.pins = (const struct hda_pintbl[]) {
11266 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11267 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11268 { }
11269 },
11270 .chained = true,
11271 .chain_id = ALC668_FIXUP_HEADSET_MODE
11272 },
11273 [ALC668_FIXUP_HEADSET_MODE] = {
11274 .type = HDA_FIXUP_FUNC,
11275 .v.func = alc_fixup_headset_mode_alc668,
11276 },
11277 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
11278 .type = HDA_FIXUP_FUNC,
11279 .v.func = alc_fixup_bass_chmap,
11280 .chained = true,
11281 .chain_id = ALC662_FIXUP_ASUS_MODE4
11282 },
11283 [ALC662_FIXUP_BASS_16] = {
11284 .type = HDA_FIXUP_PINS,
11285 .v.pins = (const struct hda_pintbl[]) {
11286 {0x16, 0x80106111}, /* bass speaker */
11287 {}
11288 },
11289 .chained = true,
11290 .chain_id = ALC662_FIXUP_BASS_CHMAP,
11291 },
11292 [ALC662_FIXUP_BASS_1A] = {
11293 .type = HDA_FIXUP_PINS,
11294 .v.pins = (const struct hda_pintbl[]) {
11295 {0x1a, 0x80106111}, /* bass speaker */
11296 {}
11297 },
11298 .chained = true,
11299 .chain_id = ALC662_FIXUP_BASS_CHMAP,
11300 },
11301 [ALC662_FIXUP_BASS_CHMAP] = {
11302 .type = HDA_FIXUP_FUNC,
11303 .v.func = alc_fixup_bass_chmap,
11304 },
11305 [ALC662_FIXUP_ASUS_Nx50] = {
11306 .type = HDA_FIXUP_FUNC,
11307 .v.func = alc_fixup_auto_mute_via_amp,
11308 .chained = true,
11309 .chain_id = ALC662_FIXUP_BASS_1A
11310 },
11311 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
11312 .type = HDA_FIXUP_FUNC,
11313 .v.func = alc_fixup_headset_mode_alc668,
11314 .chain_id = ALC662_FIXUP_BASS_CHMAP
11315 },
11316 [ALC668_FIXUP_ASUS_Nx51] = {
11317 .type = HDA_FIXUP_PINS,
11318 .v.pins = (const struct hda_pintbl[]) {
11319 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11320 { 0x1a, 0x90170151 }, /* bass speaker */
11321 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11322 {}
11323 },
11324 .chained = true,
11325 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11326 },
11327 [ALC668_FIXUP_MIC_COEF] = {
11328 .type = HDA_FIXUP_VERBS,
11329 .v.verbs = (const struct hda_verb[]) {
11330 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
11331 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
11332 {}
11333 },
11334 },
11335 [ALC668_FIXUP_ASUS_G751] = {
11336 .type = HDA_FIXUP_PINS,
11337 .v.pins = (const struct hda_pintbl[]) {
11338 { 0x16, 0x0421101f }, /* HP */
11339 {}
11340 },
11341 .chained = true,
11342 .chain_id = ALC668_FIXUP_MIC_COEF
11343 },
11344 [ALC891_FIXUP_HEADSET_MODE] = {
11345 .type = HDA_FIXUP_FUNC,
11346 .v.func = alc_fixup_headset_mode,
11347 },
11348 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
11349 .type = HDA_FIXUP_PINS,
11350 .v.pins = (const struct hda_pintbl[]) {
11351 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11352 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11353 { }
11354 },
11355 .chained = true,
11356 .chain_id = ALC891_FIXUP_HEADSET_MODE
11357 },
11358 [ALC662_FIXUP_ACER_VERITON] = {
11359 .type = HDA_FIXUP_PINS,
11360 .v.pins = (const struct hda_pintbl[]) {
11361 { 0x15, 0x50170120 }, /* no internal speaker */
11362 { }
11363 }
11364 },
11365 [ALC892_FIXUP_ASROCK_MOBO] = {
11366 .type = HDA_FIXUP_PINS,
11367 .v.pins = (const struct hda_pintbl[]) {
11368 { 0x15, 0x40f000f0 }, /* disabled */
11369 { 0x16, 0x40f000f0 }, /* disabled */
11370 { }
11371 }
11372 },
11373 [ALC662_FIXUP_USI_FUNC] = {
11374 .type = HDA_FIXUP_FUNC,
11375 .v.func = alc662_fixup_usi_headset_mic,
11376 },
11377 [ALC662_FIXUP_USI_HEADSET_MODE] = {
11378 .type = HDA_FIXUP_PINS,
11379 .v.pins = (const struct hda_pintbl[]) {
11380 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
11381 { 0x18, 0x01a1903d },
11382 { }
11383 },
11384 .chained = true,
11385 .chain_id = ALC662_FIXUP_USI_FUNC
11386 },
11387 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
11388 .type = HDA_FIXUP_FUNC,
11389 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
11390 },
11391 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
11392 .type = HDA_FIXUP_FUNC,
11393 .v.func = alc662_fixup_aspire_ethos_hp,
11394 },
11395 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
11396 .type = HDA_FIXUP_PINS,
11397 .v.pins = (const struct hda_pintbl[]) {
11398 { 0x15, 0x92130110 }, /* front speakers */
11399 { 0x18, 0x99130111 }, /* center/subwoofer */
11400 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
11401 { }
11402 },
11403 .chained = true,
11404 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
11405 },
11406 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
11407 .type = HDA_FIXUP_FUNC,
11408 .v.func = alc671_fixup_hp_headset_mic2,
11409 },
11410 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
11411 .type = HDA_FIXUP_PINS,
11412 .v.pins = (const struct hda_pintbl[]) {
11413 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
11414 { }
11415 },
11416 .chained = true,
11417 .chain_id = ALC662_FIXUP_USI_FUNC
11418 },
11419 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
11420 .type = HDA_FIXUP_PINS,
11421 .v.pins = (const struct hda_pintbl[]) {
11422 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
11423 { 0x1b, 0x0221144f },
11424 { }
11425 },
11426 .chained = true,
11427 .chain_id = ALC662_FIXUP_USI_FUNC
11428 },
11429 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
11430 .type = HDA_FIXUP_PINS,
11431 .v.pins = (const struct hda_pintbl[]) {
11432 { 0x1b, 0x04a1112c },
11433 { }
11434 },
11435 .chained = true,
11436 .chain_id = ALC668_FIXUP_HEADSET_MIC
11437 },
11438 [ALC668_FIXUP_HEADSET_MIC] = {
11439 .type = HDA_FIXUP_FUNC,
11440 .v.func = alc269_fixup_headset_mic,
11441 .chained = true,
11442 .chain_id = ALC668_FIXUP_MIC_DET_COEF
11443 },
11444 [ALC668_FIXUP_MIC_DET_COEF] = {
11445 .type = HDA_FIXUP_VERBS,
11446 .v.verbs = (const struct hda_verb[]) {
11447 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
11448 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
11449 {}
11450 },
11451 },
11452 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
11453 .type = HDA_FIXUP_FUNC,
11454 .v.func = alc897_fixup_lenovo_headset_mic,
11455 },
11456 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
11457 .type = HDA_FIXUP_PINS,
11458 .v.pins = (const struct hda_pintbl[]) {
11459 { 0x1a, 0x03a11050 },
11460 { }
11461 },
11462 .chained = true,
11463 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
11464 },
11465 [ALC897_FIXUP_HP_HSMIC_VERB] = {
11466 .type = HDA_FIXUP_PINS,
11467 .v.pins = (const struct hda_pintbl[]) {
11468 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
11469 { }
11470 },
11471 },
11472 };
11473
11474 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
11475 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
11476 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
11477 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
11478 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
11479 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
11480 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
11481 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
11482 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
11483 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
11484 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
11485 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
11486 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11487 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11488 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
11489 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
11490 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
11491 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11492 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11493 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11494 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11495 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11496 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
11497 SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
11498 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
11499 SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
11500 SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
11501 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
11502 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
11503 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11504 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
11505 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
11506 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
11507 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
11508 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
11509 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
11510 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
11511 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
11512 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
11513 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
11514 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
11515 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
11516 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
11517 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
11518 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
11519 SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
11520 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
11521 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
11522 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
11523 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
11524 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
11525 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
11526 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
11527 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
11528 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
11529 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
11530 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
11531
11532 #if 0
11533 /* Below is a quirk table taken from the old code.
11534 * Basically the device should work as is without the fixup table.
11535 * If BIOS doesn't give a proper info, enable the corresponding
11536 * fixup entry.
11537 */
11538 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
11539 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
11540 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
11541 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
11542 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11543 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11544 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11545 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
11546 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
11547 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11548 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
11549 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
11550 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
11551 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
11552 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
11553 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11554 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
11555 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
11556 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11557 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11558 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11559 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11560 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
11561 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
11562 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
11563 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11564 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
11565 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11566 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11567 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
11568 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11569 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11570 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
11571 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
11572 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
11573 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
11574 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
11575 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
11576 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
11577 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11578 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
11579 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
11580 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11581 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
11582 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
11583 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
11584 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
11585 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
11586 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11587 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
11588 #endif
11589 {}
11590 };
11591
11592 static const struct hda_model_fixup alc662_fixup_models[] = {
11593 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
11594 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
11595 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
11596 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
11597 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
11598 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
11599 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
11600 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
11601 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
11602 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
11603 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
11604 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
11605 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
11606 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
11607 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
11608 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
11609 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
11610 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
11611 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
11612 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
11613 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
11614 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
11615 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
11616 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
11617 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
11618 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
11619 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
11620 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
11621 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
11622 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
11623 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
11624 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
11625 {}
11626 };
11627
11628 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
11629 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11630 {0x17, 0x02211010},
11631 {0x18, 0x01a19030},
11632 {0x1a, 0x01813040},
11633 {0x21, 0x01014020}),
11634 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11635 {0x16, 0x01813030},
11636 {0x17, 0x02211010},
11637 {0x18, 0x01a19040},
11638 {0x21, 0x01014020}),
11639 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11640 {0x14, 0x01014010},
11641 {0x18, 0x01a19020},
11642 {0x1a, 0x0181302f},
11643 {0x1b, 0x0221401f}),
11644 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11645 {0x12, 0x99a30130},
11646 {0x14, 0x90170110},
11647 {0x15, 0x0321101f},
11648 {0x16, 0x03011020}),
11649 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11650 {0x12, 0x99a30140},
11651 {0x14, 0x90170110},
11652 {0x15, 0x0321101f},
11653 {0x16, 0x03011020}),
11654 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11655 {0x12, 0x99a30150},
11656 {0x14, 0x90170110},
11657 {0x15, 0x0321101f},
11658 {0x16, 0x03011020}),
11659 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11660 {0x14, 0x90170110},
11661 {0x15, 0x0321101f},
11662 {0x16, 0x03011020}),
11663 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
11664 {0x12, 0x90a60130},
11665 {0x14, 0x90170110},
11666 {0x15, 0x0321101f}),
11667 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11668 {0x14, 0x01014010},
11669 {0x17, 0x90170150},
11670 {0x19, 0x02a11060},
11671 {0x1b, 0x01813030},
11672 {0x21, 0x02211020}),
11673 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11674 {0x14, 0x01014010},
11675 {0x18, 0x01a19040},
11676 {0x1b, 0x01813030},
11677 {0x21, 0x02211020}),
11678 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11679 {0x14, 0x01014020},
11680 {0x17, 0x90170110},
11681 {0x18, 0x01a19050},
11682 {0x1b, 0x01813040},
11683 {0x21, 0x02211030}),
11684 {}
11685 };
11686
11687 /*
11688 */
11689 static int patch_alc662(struct hda_codec *codec)
11690 {
11691 struct alc_spec *spec;
11692 int err;
11693
11694 err = alc_alloc_spec(codec, 0x0b);
11695 if (err < 0)
11696 return err;
11697
11698 spec = codec->spec;
11699
11700 spec->shutup = alc_eapd_shutup;
11701
11702 /* handle multiple HPs as is */
11703 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
11704
11705 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11706
11707 switch (codec->core.vendor_id) {
11708 case 0x10ec0668:
11709 spec->init_hook = alc668_restore_default_value;
11710 break;
11711 }
11712
11713 alc_pre_init(codec);
11714
11715 snd_hda_pick_fixup(codec, alc662_fixup_models,
11716 alc662_fixup_tbl, alc662_fixups);
11717 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
11718 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11719
11720 alc_auto_parse_customize_define(codec);
11721
11722 if (has_cdefine_beep(codec))
11723 spec->gen.beep_nid = 0x01;
11724
11725 if ((alc_get_coef0(codec) & (1 << 14)) &&
11726 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
11727 spec->cdefine.platform_type == 1) {
11728 err = alc_codec_rename(codec, "ALC272X");
11729 if (err < 0)
11730 goto error;
11731 }
11732
11733 /* automatic parse from the BIOS config */
11734 err = alc662_parse_auto_config(codec);
11735 if (err < 0)
11736 goto error;
11737
11738 if (!spec->gen.no_analog && spec->gen.beep_nid) {
11739 switch (codec->core.vendor_id) {
11740 case 0x10ec0662:
11741 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11742 break;
11743 case 0x10ec0272:
11744 case 0x10ec0663:
11745 case 0x10ec0665:
11746 case 0x10ec0668:
11747 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
11748 break;
11749 case 0x10ec0273:
11750 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
11751 break;
11752 }
11753 if (err < 0)
11754 goto error;
11755 }
11756
11757 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11758
11759 return 0;
11760
11761 error:
11762 alc_free(codec);
11763 return err;
11764 }
11765
11766 /*
11767 * ALC680 support
11768 */
11769
11770 static int alc680_parse_auto_config(struct hda_codec *codec)
11771 {
11772 return alc_parse_auto_config(codec, NULL, NULL);
11773 }
11774
11775 /*
11776 */
11777 static int patch_alc680(struct hda_codec *codec)
11778 {
11779 int err;
11780
11781 /* ALC680 has no aa-loopback mixer */
11782 err = alc_alloc_spec(codec, 0);
11783 if (err < 0)
11784 return err;
11785
11786 /* automatic parse from the BIOS config */
11787 err = alc680_parse_auto_config(codec);
11788 if (err < 0) {
11789 alc_free(codec);
11790 return err;
11791 }
11792
11793 return 0;
11794 }
11795
11796 /*
11797 * patch entries
11798 */
11799 static const struct hda_device_id snd_hda_id_realtek[] = {
11800 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
11801 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
11802 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
11803 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
11804 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
11805 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11806 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
11807 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
11808 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
11809 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
11810 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
11811 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11812 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
11813 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
11814 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11815 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11816 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11817 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11818 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11819 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11820 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
11821 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
11822 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11823 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11824 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11825 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11826 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11827 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
11828 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
11829 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
11830 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
11831 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
11832 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
11833 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11834 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11835 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
11836 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
11837 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
11838 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
11839 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
11840 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
11841 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
11842 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11843 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11844 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11845 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11846 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11847 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11848 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11849 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11850 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11851 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11852 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11853 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11854 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11855 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
11856 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11857 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11858 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
11859 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
11860 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
11861 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11862 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11863 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11864 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11865 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11866 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11867 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11868 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11869 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11870 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11871 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
11872 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
11873 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11874 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
11875 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
11876 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
11877 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
11878 HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
11879 {} /* terminator */
11880 };
11881 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
11882
11883 MODULE_LICENSE("GPL");
11884 MODULE_DESCRIPTION("Realtek HD-audio codec");
11885
11886 static struct hda_codec_driver realtek_driver = {
11887 .id = snd_hda_id_realtek,
11888 };
11889
11890 module_hda_codec_driver(realtek_driver);