]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - sound/pci/hda/patch_realtek.c
ALSA: hda: Fix UAF of leds class devs at unbinding
[mirror_ubuntu-jammy-kernel.git] / sound / pci / hda / patch_realtek.c
CommitLineData
d0fa1179 1// SPDX-License-Identifier: GPL-2.0-or-later
1da177e4
LT
2/*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
1d045db9 5 * HD audio interface patch for Realtek ALC codecs
1da177e4 6 *
df694daa
KY
7 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
1da177e4 9 * Takashi Iwai <tiwai@suse.de>
409a3e98 10 * Jonathan Woithe <jwoithe@just42.net>
1da177e4
LT
11 */
12
1da177e4
LT
13#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/slab.h>
16#include <linux/pci.h>
08fb0d0e 17#include <linux/dmi.h>
da155d5b 18#include <linux/module.h>
33f4acd3 19#include <linux/input.h>
87dc3648 20#include <linux/leds.h>
1da177e4 21#include <sound/core.h>
9ad0e496 22#include <sound/jack.h>
be57bfff 23#include <sound/hda_codec.h>
1da177e4 24#include "hda_local.h"
23d30f28 25#include "hda_auto_parser.h"
1835a0f9 26#include "hda_jack.h"
08c189f2 27#include "hda_generic.h"
1da177e4 28
cd63a5ff
TI
29/* keep halting ALC5505 DSP, for power saving */
30#define HALT_REALTEK_ALC5505
31
4a79ba34
TI
32/* extra amp-initialization sequence types */
33enum {
1c76aa5f 34 ALC_INIT_UNDEFINED,
4a79ba34
TI
35 ALC_INIT_NONE,
36 ALC_INIT_DEFAULT,
4a79ba34
TI
37};
38
73bdd597
DH
39enum {
40 ALC_HEADSET_MODE_UNKNOWN,
41 ALC_HEADSET_MODE_UNPLUGGED,
42 ALC_HEADSET_MODE_HEADSET,
43 ALC_HEADSET_MODE_MIC,
44 ALC_HEADSET_MODE_HEADPHONE,
45};
46
47enum {
48 ALC_HEADSET_TYPE_UNKNOWN,
49 ALC_HEADSET_TYPE_CTIA,
50 ALC_HEADSET_TYPE_OMTP,
51};
52
c7b60a89
HW
53enum {
54 ALC_KEY_MICMUTE_INDEX,
55};
56
da00c244
KY
57struct alc_customize_define {
58 unsigned int sku_cfg;
59 unsigned char port_connectivity;
60 unsigned char check_sum;
61 unsigned char customization;
62 unsigned char external_amp;
63 unsigned int enable_pcbeep:1;
64 unsigned int platform_type:1;
65 unsigned int swap:1;
66 unsigned int override:1;
90622917 67 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
da00c244
KY
68};
69
766538ac
TI
70struct alc_coef_led {
71 unsigned int idx;
72 unsigned int mask;
73 unsigned int on;
74 unsigned int off;
75};
76
1da177e4 77struct alc_spec {
08c189f2 78 struct hda_gen_spec gen; /* must be at head */
23d30f28 79
1da177e4 80 /* codec parameterization */
da00c244 81 struct alc_customize_define cdefine;
08c189f2 82 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
834be88d 83
5579cd6f
TI
84 /* GPIO bits */
85 unsigned int gpio_mask;
86 unsigned int gpio_dir;
87 unsigned int gpio_data;
215c850c 88 bool gpio_write_delay; /* add a delay before writing gpio_data */
5579cd6f 89
8d3d1ece 90 /* mute LED for HP laptops, see vref_mute_led_set() */
08fb0d0e 91 int mute_led_polarity;
dbd13179 92 int micmute_led_polarity;
08fb0d0e 93 hda_nid_t mute_led_nid;
9c5dc3bf 94 hda_nid_t cap_mute_led_nid;
08fb0d0e 95
0f32fd19
TI
96 unsigned int gpio_mute_led_mask;
97 unsigned int gpio_mic_led_mask;
766538ac
TI
98 struct alc_coef_led mute_led_coef;
99 struct alc_coef_led mic_led_coef;
9f5c6faf 100
73bdd597
DH
101 hda_nid_t headset_mic_pin;
102 hda_nid_t headphone_mic_pin;
103 int current_headset_mode;
104 int current_headset_type;
105
ae6b813a
TI
106 /* hooks */
107 void (*init_hook)(struct hda_codec *codec);
83012a7c 108#ifdef CONFIG_PM
c97259df 109 void (*power_hook)(struct hda_codec *codec);
f5de24b0 110#endif
1c716153 111 void (*shutup)(struct hda_codec *codec);
d922b51d 112
4a79ba34 113 int init_amp;
d433a678 114 int codec_variant; /* flag for other variants */
97a26570
KY
115 unsigned int has_alc5505_dsp:1;
116 unsigned int no_depop_delay:1;
693abe11 117 unsigned int done_hp_init:1;
c0ca5ece 118 unsigned int no_shutup_pins:1;
d3ba58bb 119 unsigned int ultra_low_power:1;
476c02e0 120 unsigned int has_hs_key:1;
92666d45 121 unsigned int no_internal_mic_pin:1;
e64f14f4 122
2c3bf9ab
TI
123 /* for PLL fix */
124 hda_nid_t pll_nid;
125 unsigned int pll_coef_idx, pll_coef_bit;
1bb7e43e 126 unsigned int coef0;
33f4acd3 127 struct input_dev *kb_dev;
c7b60a89 128 u8 alc_mute_keycode_map[1];
df694daa
KY
129};
130
f2a227cd
TI
131/*
132 * COEF access helper functions
133 */
134
135static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
136 unsigned int coef_idx)
137{
138 unsigned int val;
139
140 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
141 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
142 return val;
143}
144
145#define alc_read_coef_idx(codec, coef_idx) \
146 alc_read_coefex_idx(codec, 0x20, coef_idx)
147
148static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
149 unsigned int coef_idx, unsigned int coef_val)
150{
151 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
153}
154
155#define alc_write_coef_idx(codec, coef_idx, coef_val) \
156 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
157
98b24883
TI
158static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
159 unsigned int coef_idx, unsigned int mask,
160 unsigned int bits_set)
161{
162 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
163
164 if (val != -1)
165 alc_write_coefex_idx(codec, nid, coef_idx,
166 (val & ~mask) | bits_set);
167}
168
169#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
170 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
171
f2a227cd
TI
172/* a special bypass for COEF 0; read the cached value at the second time */
173static unsigned int alc_get_coef0(struct hda_codec *codec)
174{
175 struct alc_spec *spec = codec->spec;
176
177 if (!spec->coef0)
178 spec->coef0 = alc_read_coef_idx(codec, 0);
179 return spec->coef0;
180}
181
54db6c39
TI
182/* coef writes/updates batch */
183struct coef_fw {
184 unsigned char nid;
185 unsigned char idx;
186 unsigned short mask;
187 unsigned short val;
188};
189
190#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
191 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
192#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
193#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
194#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
195
196static void alc_process_coef_fw(struct hda_codec *codec,
197 const struct coef_fw *fw)
198{
199 for (; fw->nid; fw++) {
200 if (fw->mask == (unsigned short)-1)
201 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
202 else
203 alc_update_coefex_idx(codec, fw->nid, fw->idx,
204 fw->mask, fw->val);
205 }
206}
207
df694daa 208/*
1d045db9 209 * GPIO setup tables, used in initialization
df694daa 210 */
5579cd6f 211
bc9f98a9 212/* Enable GPIO mask and set output */
5579cd6f
TI
213static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
214{
215 struct alc_spec *spec = codec->spec;
bc9f98a9 216
5579cd6f
TI
217 spec->gpio_mask |= mask;
218 spec->gpio_dir |= mask;
219 spec->gpio_data |= mask;
220}
bc9f98a9 221
5579cd6f
TI
222static void alc_write_gpio_data(struct hda_codec *codec)
223{
224 struct alc_spec *spec = codec->spec;
225
226 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
227 spec->gpio_data);
228}
229
aaf312de
TI
230static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
231 bool on)
232{
233 struct alc_spec *spec = codec->spec;
234 unsigned int oldval = spec->gpio_data;
235
236 if (on)
237 spec->gpio_data |= mask;
238 else
239 spec->gpio_data &= ~mask;
240 if (oldval != spec->gpio_data)
241 alc_write_gpio_data(codec);
242}
243
5579cd6f
TI
244static void alc_write_gpio(struct hda_codec *codec)
245{
246 struct alc_spec *spec = codec->spec;
247
248 if (!spec->gpio_mask)
249 return;
250
251 snd_hda_codec_write(codec, codec->core.afg, 0,
252 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
253 snd_hda_codec_write(codec, codec->core.afg, 0,
254 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
215c850c
TI
255 if (spec->gpio_write_delay)
256 msleep(1);
5579cd6f
TI
257 alc_write_gpio_data(codec);
258}
259
260static void alc_fixup_gpio(struct hda_codec *codec, int action,
261 unsigned int mask)
262{
263 if (action == HDA_FIXUP_ACT_PRE_PROBE)
264 alc_setup_gpio(codec, mask);
265}
266
267static void alc_fixup_gpio1(struct hda_codec *codec,
268 const struct hda_fixup *fix, int action)
269{
270 alc_fixup_gpio(codec, action, 0x01);
271}
272
273static void alc_fixup_gpio2(struct hda_codec *codec,
274 const struct hda_fixup *fix, int action)
275{
276 alc_fixup_gpio(codec, action, 0x02);
277}
278
279static void alc_fixup_gpio3(struct hda_codec *codec,
280 const struct hda_fixup *fix, int action)
281{
282 alc_fixup_gpio(codec, action, 0x03);
283}
bdd148a3 284
ae065f1c
TI
285static void alc_fixup_gpio4(struct hda_codec *codec,
286 const struct hda_fixup *fix, int action)
287{
288 alc_fixup_gpio(codec, action, 0x04);
289}
290
8a503555
TI
291static void alc_fixup_micmute_led(struct hda_codec *codec,
292 const struct hda_fixup *fix, int action)
293{
e65bf997 294 if (action == HDA_FIXUP_ACT_PRE_PROBE)
8a503555
TI
295 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
296}
297
2c3bf9ab
TI
298/*
299 * Fix hardware PLL issue
300 * On some codecs, the analog PLL gating control must be off while
301 * the default value is 1.
302 */
303static void alc_fix_pll(struct hda_codec *codec)
304{
305 struct alc_spec *spec = codec->spec;
2c3bf9ab 306
98b24883
TI
307 if (spec->pll_nid)
308 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
309 1 << spec->pll_coef_bit, 0);
2c3bf9ab
TI
310}
311
312static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
313 unsigned int coef_idx, unsigned int coef_bit)
314{
315 struct alc_spec *spec = codec->spec;
316 spec->pll_nid = nid;
317 spec->pll_coef_idx = coef_idx;
318 spec->pll_coef_bit = coef_bit;
319 alc_fix_pll(codec);
320}
321
cf5a2279 322/* update the master volume per volume-knob's unsol event */
1a4f69d5
TI
323static void alc_update_knob_master(struct hda_codec *codec,
324 struct hda_jack_callback *jack)
cf5a2279
TI
325{
326 unsigned int val;
327 struct snd_kcontrol *kctl;
328 struct snd_ctl_elem_value *uctl;
329
330 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
331 if (!kctl)
332 return;
333 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
334 if (!uctl)
335 return;
2ebab40e 336 val = snd_hda_codec_read(codec, jack->nid, 0,
cf5a2279
TI
337 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
338 val &= HDA_AMP_VOLMASK;
339 uctl->value.integer.value[0] = val;
340 uctl->value.integer.value[1] = val;
341 kctl->put(kctl, uctl);
342 kfree(uctl);
343}
344
29adc4b9 345static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
f21d78e2 346{
29adc4b9
DH
347 /* For some reason, the res given from ALC880 is broken.
348 Here we adjust it properly. */
349 snd_hda_jack_unsol_event(codec, res >> 2);
f21d78e2
TI
350}
351
394c97f8
KY
352/* Change EAPD to verb control */
353static void alc_fill_eapd_coef(struct hda_codec *codec)
354{
355 int coef;
356
357 coef = alc_get_coef0(codec);
358
7639a06c 359 switch (codec->core.vendor_id) {
394c97f8
KY
360 case 0x10ec0262:
361 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
362 break;
363 case 0x10ec0267:
364 case 0x10ec0268:
365 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
366 break;
367 case 0x10ec0269:
368 if ((coef & 0x00f0) == 0x0010)
369 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
370 if ((coef & 0x00f0) == 0x0020)
371 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
372 if ((coef & 0x00f0) == 0x0030)
373 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
374 break;
375 case 0x10ec0280:
376 case 0x10ec0284:
377 case 0x10ec0290:
378 case 0x10ec0292:
379 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
380 break;
4231430d 381 case 0x10ec0225:
44be77c5
TI
382 case 0x10ec0295:
383 case 0x10ec0299:
384 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
c0dbbdad 385 fallthrough;
44be77c5 386 case 0x10ec0215:
1948fc06 387 case 0x10ec0230:
394c97f8 388 case 0x10ec0233:
ea04a1db 389 case 0x10ec0235:
c4473744 390 case 0x10ec0236:
7fbdcd83 391 case 0x10ec0245:
394c97f8 392 case 0x10ec0255:
c4473744 393 case 0x10ec0256:
f429e7e4 394 case 0x10ec0257:
394c97f8
KY
395 case 0x10ec0282:
396 case 0x10ec0283:
397 case 0x10ec0286:
398 case 0x10ec0288:
0a6f0600 399 case 0x10ec0285:
506b62c3 400 case 0x10ec0298:
0a6f0600 401 case 0x10ec0289:
1078bef0 402 case 0x10ec0300:
394c97f8
KY
403 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
404 break;
3aabf94c
KY
405 case 0x10ec0275:
406 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
407 break;
8822702f
HW
408 case 0x10ec0287:
409 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
410 alc_write_coef_idx(codec, 0x8, 0x4ab7);
411 break;
394c97f8
KY
412 case 0x10ec0293:
413 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
414 break;
dcd4f0db
KY
415 case 0x10ec0234:
416 case 0x10ec0274:
417 case 0x10ec0294:
6fbae35a
KY
418 case 0x10ec0700:
419 case 0x10ec0701:
420 case 0x10ec0703:
83629532 421 case 0x10ec0711:
dcd4f0db
KY
422 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
423 break;
394c97f8
KY
424 case 0x10ec0662:
425 if ((coef & 0x00f0) == 0x0030)
426 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
427 break;
428 case 0x10ec0272:
429 case 0x10ec0273:
430 case 0x10ec0663:
431 case 0x10ec0665:
432 case 0x10ec0670:
433 case 0x10ec0671:
434 case 0x10ec0672:
435 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
436 break;
9194a1eb 437 case 0x10ec0222:
f0778871
KY
438 case 0x10ec0623:
439 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
440 break;
394c97f8
KY
441 case 0x10ec0668:
442 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
443 break;
444 case 0x10ec0867:
445 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
446 break;
447 case 0x10ec0888:
448 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
449 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
450 break;
451 case 0x10ec0892:
e5782a5d 452 case 0x10ec0897:
394c97f8
KY
453 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
454 break;
455 case 0x10ec0899:
456 case 0x10ec0900:
6d9ffcff 457 case 0x10ec0b00:
65553b12 458 case 0x10ec1168:
a535ad57 459 case 0x10ec1220:
394c97f8
KY
460 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
461 break;
462 }
463}
464
f9423e7a
KY
465/* additional initialization for ALC888 variants */
466static void alc888_coef_init(struct hda_codec *codec)
467{
1df8874b
KY
468 switch (alc_get_coef0(codec) & 0x00f0) {
469 /* alc888-VA */
470 case 0x00:
471 /* alc888-VB */
472 case 0x10:
473 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
474 break;
475 }
87a8c370
JK
476}
477
3fb4a508
TI
478/* turn on/off EAPD control (only if available) */
479static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
480{
481 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
482 return;
483 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
484 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
485 on ? 2 : 0);
486}
487
691f1fcc
TI
488/* turn on/off EAPD controls of the codec */
489static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
490{
491 /* We currently only handle front, HP */
caf3c043 492 static const hda_nid_t pins[] = {
af95b414 493 0x0f, 0x10, 0x14, 0x15, 0x17, 0
39fa84e9 494 };
caf3c043 495 const hda_nid_t *p;
39fa84e9
TI
496 for (p = pins; *p; p++)
497 set_eapd(codec, *p, on);
691f1fcc
TI
498}
499
dad3197d
KY
500static int find_ext_mic_pin(struct hda_codec *codec);
501
502static void alc_headset_mic_no_shutup(struct hda_codec *codec)
503{
504 const struct hda_pincfg *pin;
505 int mic_pin = find_ext_mic_pin(codec);
506 int i;
507
508 /* don't shut up pins when unloading the driver; otherwise it breaks
509 * the default pin setup at the next load of the driver
510 */
511 if (codec->bus->shutdown)
512 return;
513
514 snd_array_for_each(&codec->init_pins, i, pin) {
515 /* use read here for syncing after issuing each verb */
516 if (pin->nid != mic_pin)
517 snd_hda_codec_read(codec, pin->nid, 0,
518 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
519 }
520
521 codec->pins_shutup = 1;
522}
523
c0ca5ece
TI
524static void alc_shutup_pins(struct hda_codec *codec)
525{
526 struct alc_spec *spec = codec->spec;
527
dad3197d 528 switch (codec->core.vendor_id) {
5aec9891
KY
529 case 0x10ec0236:
530 case 0x10ec0256:
66c5d718 531 case 0x10ec0283:
dad3197d
KY
532 case 0x10ec0286:
533 case 0x10ec0288:
534 case 0x10ec0298:
535 alc_headset_mic_no_shutup(codec);
536 break;
537 default:
538 if (!spec->no_shutup_pins)
539 snd_hda_shutup_pins(codec);
540 break;
541 }
c0ca5ece
TI
542}
543
1c716153 544/* generic shutup callback;
4ce8e6a5 545 * just turning off EAPD and a little pause for avoiding pop-noise
1c716153
TI
546 */
547static void alc_eapd_shutup(struct hda_codec *codec)
548{
97a26570
KY
549 struct alc_spec *spec = codec->spec;
550
1c716153 551 alc_auto_setup_eapd(codec, false);
97a26570
KY
552 if (!spec->no_depop_delay)
553 msleep(200);
c0ca5ece 554 alc_shutup_pins(codec);
1c716153
TI
555}
556
1d045db9 557/* generic EAPD initialization */
4a79ba34 558static void alc_auto_init_amp(struct hda_codec *codec, int type)
bc9f98a9 559{
39fa84e9 560 alc_auto_setup_eapd(codec, true);
5579cd6f 561 alc_write_gpio(codec);
4a79ba34 562 switch (type) {
4a79ba34 563 case ALC_INIT_DEFAULT:
7639a06c 564 switch (codec->core.vendor_id) {
c9b58006 565 case 0x10ec0260:
98b24883 566 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
c9b58006 567 break;
c9b58006
KY
568 case 0x10ec0880:
569 case 0x10ec0882:
570 case 0x10ec0883:
571 case 0x10ec0885:
1df8874b 572 alc_update_coef_idx(codec, 7, 0, 0x2030);
c9b58006 573 break;
f9423e7a 574 case 0x10ec0888:
4a79ba34 575 alc888_coef_init(codec);
f9423e7a 576 break;
bc9f98a9 577 }
4a79ba34
TI
578 break;
579 }
580}
581
35a39f98
TI
582/* get a primary headphone pin if available */
583static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
584{
585 if (spec->gen.autocfg.hp_pins[0])
586 return spec->gen.autocfg.hp_pins[0];
587 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
588 return spec->gen.autocfg.line_out_pins[0];
589 return 0;
590}
08c189f2 591
1d045db9 592/*
08c189f2 593 * Realtek SSID verification
1d045db9 594 */
42cf0d01 595
08c189f2
TI
596/* Could be any non-zero and even value. When used as fixup, tells
597 * the driver to ignore any present sku defines.
598 */
599#define ALC_FIXUP_SKU_IGNORE (2)
1a1455de 600
08c189f2
TI
601static void alc_fixup_sku_ignore(struct hda_codec *codec,
602 const struct hda_fixup *fix, int action)
1a1455de 603{
1a1455de 604 struct alc_spec *spec = codec->spec;
08c189f2
TI
605 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
606 spec->cdefine.fixup = 1;
607 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
1a1455de 608 }
1a1455de
TI
609}
610
b5c6611f
ML
611static void alc_fixup_no_depop_delay(struct hda_codec *codec,
612 const struct hda_fixup *fix, int action)
613{
614 struct alc_spec *spec = codec->spec;
615
84d2dc3e 616 if (action == HDA_FIXUP_ACT_PROBE) {
b5c6611f 617 spec->no_depop_delay = 1;
84d2dc3e
ML
618 codec->depop_delay = 0;
619 }
b5c6611f
ML
620}
621
08c189f2 622static int alc_auto_parse_customize_define(struct hda_codec *codec)
4a79ba34 623{
08c189f2
TI
624 unsigned int ass, tmp, i;
625 unsigned nid = 0;
4a79ba34
TI
626 struct alc_spec *spec = codec->spec;
627
08c189f2 628 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
4a79ba34 629
08c189f2
TI
630 if (spec->cdefine.fixup) {
631 ass = spec->cdefine.sku_cfg;
632 if (ass == ALC_FIXUP_SKU_IGNORE)
633 return -1;
634 goto do_sku;
bb35febd
TI
635 }
636
5100cd07
TI
637 if (!codec->bus->pci)
638 return -1;
7639a06c 639 ass = codec->core.subsystem_id & 0xffff;
08c189f2
TI
640 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
641 goto do_sku;
4a79ba34 642
08c189f2 643 nid = 0x1d;
7639a06c 644 if (codec->core.vendor_id == 0x10ec0260)
08c189f2
TI
645 nid = 0x17;
646 ass = snd_hda_codec_get_pincfg(codec, nid);
42cf0d01 647
08c189f2 648 if (!(ass & 1)) {
4e76a883 649 codec_info(codec, "%s: SKU not ready 0x%08x\n",
7639a06c 650 codec->core.chip_name, ass);
08c189f2 651 return -1;
42cf0d01
DH
652 }
653
08c189f2
TI
654 /* check sum */
655 tmp = 0;
656 for (i = 1; i < 16; i++) {
657 if ((ass >> i) & 1)
658 tmp++;
ae8a60a5 659 }
08c189f2
TI
660 if (((ass >> 16) & 0xf) != tmp)
661 return -1;
ae8a60a5 662
da00c244
KY
663 spec->cdefine.port_connectivity = ass >> 30;
664 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
665 spec->cdefine.check_sum = (ass >> 16) & 0xf;
666 spec->cdefine.customization = ass >> 8;
667do_sku:
668 spec->cdefine.sku_cfg = ass;
669 spec->cdefine.external_amp = (ass & 0x38) >> 3;
670 spec->cdefine.platform_type = (ass & 0x4) >> 2;
671 spec->cdefine.swap = (ass & 0x2) >> 1;
672 spec->cdefine.override = ass & 0x1;
673
4e76a883 674 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
da00c244 675 nid, spec->cdefine.sku_cfg);
4e76a883 676 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
da00c244 677 spec->cdefine.port_connectivity);
4e76a883
TI
678 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
679 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
680 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
681 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
682 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
683 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
684 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
da00c244
KY
685
686 return 0;
687}
688
08c189f2
TI
689/* return the position of NID in the list, or -1 if not found */
690static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
691{
692 int i;
693 for (i = 0; i < nums; i++)
694 if (list[i] == nid)
695 return i;
696 return -1;
697}
1d045db9 698/* return true if the given NID is found in the list */
3af9ee6b
TI
699static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
700{
21268961 701 return find_idx_in_nid_list(nid, list, nums) >= 0;
3af9ee6b
TI
702}
703
4a79ba34
TI
704/* check subsystem ID and set up device-specific initialization;
705 * return 1 if initialized, 0 if invalid SSID
706 */
707/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
708 * 31 ~ 16 : Manufacture ID
709 * 15 ~ 8 : SKU ID
710 * 7 ~ 0 : Assembly ID
711 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
712 */
58c57cfa 713static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34
TI
714{
715 unsigned int ass, tmp, i;
716 unsigned nid;
717 struct alc_spec *spec = codec->spec;
718
90622917
DH
719 if (spec->cdefine.fixup) {
720 ass = spec->cdefine.sku_cfg;
721 if (ass == ALC_FIXUP_SKU_IGNORE)
722 return 0;
723 goto do_sku;
724 }
725
7639a06c 726 ass = codec->core.subsystem_id & 0xffff;
5100cd07
TI
727 if (codec->bus->pci &&
728 ass != codec->bus->pci->subsystem_device && (ass & 1))
4a79ba34
TI
729 goto do_sku;
730
731 /* invalid SSID, check the special NID pin defcfg instead */
732 /*
def319f9 733 * 31~30 : port connectivity
4a79ba34
TI
734 * 29~21 : reserve
735 * 20 : PCBEEP input
736 * 19~16 : Check sum (15:1)
737 * 15~1 : Custom
738 * 0 : override
739 */
740 nid = 0x1d;
7639a06c 741 if (codec->core.vendor_id == 0x10ec0260)
4a79ba34
TI
742 nid = 0x17;
743 ass = snd_hda_codec_get_pincfg(codec, nid);
4e76a883
TI
744 codec_dbg(codec,
745 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
cb6605c1 746 ass, nid);
6227cdce 747 if (!(ass & 1))
4a79ba34
TI
748 return 0;
749 if ((ass >> 30) != 1) /* no physical connection */
750 return 0;
751
752 /* check sum */
753 tmp = 0;
754 for (i = 1; i < 16; i++) {
755 if ((ass >> i) & 1)
756 tmp++;
757 }
758 if (((ass >> 16) & 0xf) != tmp)
759 return 0;
760do_sku:
4e76a883 761 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
7639a06c 762 ass & 0xffff, codec->core.vendor_id);
4a79ba34
TI
763 /*
764 * 0 : override
765 * 1 : Swap Jack
766 * 2 : 0 --> Desktop, 1 --> Laptop
767 * 3~5 : External Amplifier control
768 * 7~6 : Reserved
769 */
770 tmp = (ass & 0x38) >> 3; /* external Amp control */
1c76aa5f
TI
771 if (spec->init_amp == ALC_INIT_UNDEFINED) {
772 switch (tmp) {
773 case 1:
5579cd6f 774 alc_setup_gpio(codec, 0x01);
1c76aa5f
TI
775 break;
776 case 3:
5579cd6f 777 alc_setup_gpio(codec, 0x02);
1c76aa5f
TI
778 break;
779 case 7:
5579cd6f 780 alc_setup_gpio(codec, 0x03);
1c76aa5f
TI
781 break;
782 case 5:
783 default:
784 spec->init_amp = ALC_INIT_DEFAULT;
785 break;
786 }
bc9f98a9 787 }
ea1fb29a 788
8c427226 789 /* is laptop or Desktop and enable the function "Mute internal speaker
c9b58006
KY
790 * when the external headphone out jack is plugged"
791 */
8c427226 792 if (!(ass & 0x8000))
4a79ba34 793 return 1;
c9b58006
KY
794 /*
795 * 10~8 : Jack location
796 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
797 * 14~13: Resvered
798 * 15 : 1 --> enable the function "Mute internal speaker
799 * when the external headphone out jack is plugged"
800 */
35a39f98 801 if (!alc_get_hp_pin(spec)) {
01d4825d 802 hda_nid_t nid;
c9b58006 803 tmp = (ass >> 11) & 0x3; /* HP to chassis */
58c57cfa 804 nid = ports[tmp];
08c189f2
TI
805 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
806 spec->gen.autocfg.line_outs))
3af9ee6b 807 return 1;
08c189f2 808 spec->gen.autocfg.hp_pins[0] = nid;
c9b58006 809 }
4a79ba34
TI
810 return 1;
811}
ea1fb29a 812
3e6179b8
TI
813/* Check the validity of ALC subsystem-id
814 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
815static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34 816{
58c57cfa 817 if (!alc_subsystem_id(codec, ports)) {
4a79ba34 818 struct alc_spec *spec = codec->spec;
67791202
TI
819 if (spec->init_amp == ALC_INIT_UNDEFINED) {
820 codec_dbg(codec,
821 "realtek: Enable default setup for auto mode as fallback\n");
822 spec->init_amp = ALC_INIT_DEFAULT;
823 }
4a79ba34 824 }
21268961 825}
1a1455de 826
1d045db9 827/*
ef8ef5fb 828 */
f9e336f6 829
9d36a7dc
DH
830static void alc_fixup_inv_dmic(struct hda_codec *codec,
831 const struct hda_fixup *fix, int action)
125821ae
TI
832{
833 struct alc_spec *spec = codec->spec;
668d1e96 834
9d36a7dc 835 spec->gen.inv_dmic_split = 1;
6e72aa5f
TI
836}
837
e9edcee0 838
08c189f2 839static int alc_build_controls(struct hda_codec *codec)
1d045db9 840{
a5cb463a 841 int err;
e9427969 842
08c189f2
TI
843 err = snd_hda_gen_build_controls(codec);
844 if (err < 0)
845 return err;
1da177e4 846
1727a771 847 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
1c4a54b4 848 return 0;
a361d84b
KY
849}
850
a361d84b 851
df694daa 852/*
08c189f2 853 * Common callbacks
df694daa 854 */
a361d84b 855
c9af753f
TI
856static void alc_pre_init(struct hda_codec *codec)
857{
858 alc_fill_eapd_coef(codec);
859}
860
aeac1a0d
KY
861#define is_s3_resume(codec) \
862 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
c9af753f
TI
863#define is_s4_resume(codec) \
864 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
865
08c189f2 866static int alc_init(struct hda_codec *codec)
1d045db9
TI
867{
868 struct alc_spec *spec = codec->spec;
a361d84b 869
c9af753f
TI
870 /* hibernation resume needs the full chip initialization */
871 if (is_s4_resume(codec))
872 alc_pre_init(codec);
873
08c189f2
TI
874 if (spec->init_hook)
875 spec->init_hook(codec);
a361d84b 876
89781d08 877 spec->gen.skip_verbs = 1; /* applied in below */
607ca3bd 878 snd_hda_gen_init(codec);
08c189f2
TI
879 alc_fix_pll(codec);
880 alc_auto_init_amp(codec, spec->init_amp);
89781d08 881 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
3abf2f36 882
1727a771 883 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
a361d84b 884
1d045db9
TI
885 return 0;
886}
a361d84b 887
08c189f2 888static inline void alc_shutup(struct hda_codec *codec)
1d045db9
TI
889{
890 struct alc_spec *spec = codec->spec;
a361d84b 891
c7273bd6
TI
892 if (!snd_hda_get_bool_hint(codec, "shutup"))
893 return; /* disabled explicitly by hints */
894
08c189f2
TI
895 if (spec && spec->shutup)
896 spec->shutup(codec);
9bfb2844 897 else
c0ca5ece 898 alc_shutup_pins(codec);
1d045db9
TI
899}
900
8a02c0cc 901#define alc_free snd_hda_gen_free
2134ea4f 902
08c189f2
TI
903#ifdef CONFIG_PM
904static void alc_power_eapd(struct hda_codec *codec)
1d045db9 905{
08c189f2 906 alc_auto_setup_eapd(codec, false);
1d045db9 907}
2134ea4f 908
08c189f2 909static int alc_suspend(struct hda_codec *codec)
1d045db9
TI
910{
911 struct alc_spec *spec = codec->spec;
08c189f2
TI
912 alc_shutup(codec);
913 if (spec && spec->power_hook)
914 spec->power_hook(codec);
a361d84b
KY
915 return 0;
916}
08c189f2 917#endif
a361d84b 918
08c189f2
TI
919#ifdef CONFIG_PM
920static int alc_resume(struct hda_codec *codec)
1d045db9 921{
97a26570
KY
922 struct alc_spec *spec = codec->spec;
923
924 if (!spec->no_depop_delay)
925 msleep(150); /* to avoid pop noise */
08c189f2 926 codec->patch_ops.init(codec);
1a462be5 927 snd_hda_regmap_sync(codec);
08c189f2
TI
928 hda_call_check_power_status(codec, 0x01);
929 return 0;
1d045db9 930}
08c189f2 931#endif
f6a92248 932
1d045db9 933/*
1d045db9 934 */
08c189f2
TI
935static const struct hda_codec_ops alc_patch_ops = {
936 .build_controls = alc_build_controls,
937 .build_pcms = snd_hda_gen_build_pcms,
938 .init = alc_init,
939 .free = alc_free,
940 .unsol_event = snd_hda_jack_unsol_event,
941#ifdef CONFIG_PM
942 .resume = alc_resume,
08c189f2 943 .suspend = alc_suspend,
fce52a3b 944 .check_power_status = snd_hda_gen_check_power_status,
08c189f2 945#endif
08c189f2 946};
f6a92248 947
f53281e6 948
ded255be 949#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
e01bf509 950
e4770629 951/*
4b016931 952 * Rename codecs appropriately from COEF value or subvendor id
e4770629 953 */
08c189f2
TI
954struct alc_codec_rename_table {
955 unsigned int vendor_id;
956 unsigned short coef_mask;
957 unsigned short coef_bits;
958 const char *name;
959};
84898e87 960
4b016931
KY
961struct alc_codec_rename_pci_table {
962 unsigned int codec_vendor_id;
963 unsigned short pci_subvendor;
964 unsigned short pci_subdevice;
965 const char *name;
966};
967
6b0f95c4 968static const struct alc_codec_rename_table rename_tbl[] = {
e6e5f7ad 969 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
08c189f2
TI
970 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
971 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
972 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
973 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
974 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
975 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
976 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
977 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
e6e5f7ad 978 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
08c189f2
TI
979 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
980 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
981 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
982 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
983 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
984 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
985 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
986 { } /* terminator */
987};
84898e87 988
6b0f95c4 989static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
4b016931
KY
990 { 0x10ec0280, 0x1028, 0, "ALC3220" },
991 { 0x10ec0282, 0x1028, 0, "ALC3221" },
992 { 0x10ec0283, 0x1028, 0, "ALC3223" },
193177de 993 { 0x10ec0288, 0x1028, 0, "ALC3263" },
4b016931 994 { 0x10ec0292, 0x1028, 0, "ALC3226" },
193177de 995 { 0x10ec0293, 0x1028, 0, "ALC3235" },
4b016931
KY
996 { 0x10ec0255, 0x1028, 0, "ALC3234" },
997 { 0x10ec0668, 0x1028, 0, "ALC3661" },
e6e5f7ad
KY
998 { 0x10ec0275, 0x1028, 0, "ALC3260" },
999 { 0x10ec0899, 0x1028, 0, "ALC3861" },
2c674fac 1000 { 0x10ec0298, 0x1028, 0, "ALC3266" },
736f20a7 1001 { 0x10ec0236, 0x1028, 0, "ALC3204" },
82324502 1002 { 0x10ec0256, 0x1028, 0, "ALC3246" },
4231430d 1003 { 0x10ec0225, 0x1028, 0, "ALC3253" },
7d727869 1004 { 0x10ec0295, 0x1028, 0, "ALC3254" },
28f1f9b2 1005 { 0x10ec0299, 0x1028, 0, "ALC3271" },
e6e5f7ad
KY
1006 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1007 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1008 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1009 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1010 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1011 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1012 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1013 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1014 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1015 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1016 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
4b016931
KY
1017 { } /* terminator */
1018};
1019
08c189f2 1020static int alc_codec_rename_from_preset(struct hda_codec *codec)
1d045db9 1021{
08c189f2 1022 const struct alc_codec_rename_table *p;
4b016931 1023 const struct alc_codec_rename_pci_table *q;
60db6b53 1024
08c189f2 1025 for (p = rename_tbl; p->vendor_id; p++) {
7639a06c 1026 if (p->vendor_id != codec->core.vendor_id)
08c189f2
TI
1027 continue;
1028 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1029 return alc_codec_rename(codec, p->name);
1d045db9 1030 }
4b016931 1031
5100cd07
TI
1032 if (!codec->bus->pci)
1033 return 0;
4b016931 1034 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
7639a06c 1035 if (q->codec_vendor_id != codec->core.vendor_id)
4b016931
KY
1036 continue;
1037 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1038 continue;
1039 if (!q->pci_subdevice ||
1040 q->pci_subdevice == codec->bus->pci->subsystem_device)
1041 return alc_codec_rename(codec, q->name);
1042 }
1043
08c189f2 1044 return 0;
1d045db9 1045}
f53281e6 1046
e4770629 1047
1d045db9
TI
1048/*
1049 * Digital-beep handlers
1050 */
1051#ifdef CONFIG_SND_HDA_INPUT_BEEP
fea80fae
TI
1052
1053/* additional beep mixers; private_value will be overwritten */
1054static const struct snd_kcontrol_new alc_beep_mixer[] = {
1055 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1056 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1057};
1058
1059/* set up and create beep controls */
1060static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1061 int idx, int dir)
1062{
1063 struct snd_kcontrol_new *knew;
1064 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1065 int i;
1066
1067 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1068 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1069 &alc_beep_mixer[i]);
1070 if (!knew)
1071 return -ENOMEM;
1072 knew->private_value = beep_amp;
1073 }
1074 return 0;
1075}
84898e87 1076
6317e5eb 1077static const struct snd_pci_quirk beep_allow_list[] = {
7110005e 1078 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
a4b7f21d 1079 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1d045db9 1080 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
8554ee40 1081 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1d045db9
TI
1082 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1083 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1084 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
78f8baf1 1085 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1d045db9 1086 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
6317e5eb 1087 /* denylist -- no beep available */
051c78af
TI
1088 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1089 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1d045db9 1090 {}
fe3eb0a7
KY
1091};
1092
1d045db9
TI
1093static inline int has_cdefine_beep(struct hda_codec *codec)
1094{
1095 struct alc_spec *spec = codec->spec;
1096 const struct snd_pci_quirk *q;
6317e5eb 1097 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1d045db9
TI
1098 if (q)
1099 return q->value;
1100 return spec->cdefine.enable_pcbeep;
1101}
1102#else
fea80fae 1103#define set_beep_amp(spec, nid, idx, dir) 0
1d045db9
TI
1104#define has_cdefine_beep(codec) 0
1105#endif
84898e87 1106
1d045db9
TI
1107/* parse the BIOS configuration and set up the alc_spec */
1108/* return 1 if successful, 0 if the proper config is not found,
1109 * or a negative error code
1110 */
3e6179b8
TI
1111static int alc_parse_auto_config(struct hda_codec *codec,
1112 const hda_nid_t *ignore_nids,
1113 const hda_nid_t *ssid_nids)
1d045db9
TI
1114{
1115 struct alc_spec *spec = codec->spec;
08c189f2 1116 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1d045db9 1117 int err;
26f5df26 1118
53c334ad
TI
1119 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1120 spec->parse_flags);
1d045db9
TI
1121 if (err < 0)
1122 return err;
3e6179b8
TI
1123
1124 if (ssid_nids)
1125 alc_ssid_check(codec, ssid_nids);
64154835 1126
08c189f2
TI
1127 err = snd_hda_gen_parse_auto_config(codec, cfg);
1128 if (err < 0)
1129 return err;
070cff4c 1130
1d045db9 1131 return 1;
60db6b53 1132}
f6a92248 1133
3de95173
TI
1134/* common preparation job for alc_spec */
1135static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1136{
1137 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1138 int err;
1139
1140 if (!spec)
1141 return -ENOMEM;
1142 codec->spec = spec;
08c189f2
TI
1143 snd_hda_gen_spec_init(&spec->gen);
1144 spec->gen.mixer_nid = mixer_nid;
1145 spec->gen.own_eapd_ctl = 1;
1098b7c2 1146 codec->single_adc_amp = 1;
08c189f2
TI
1147 /* FIXME: do we need this for all Realtek codec models? */
1148 codec->spdif_status_reset = 1;
a6e7d0a4 1149 codec->forced_resume = 1;
225068ab 1150 codec->patch_ops = alc_patch_ops;
3de95173
TI
1151
1152 err = alc_codec_rename_from_preset(codec);
1153 if (err < 0) {
1154 kfree(spec);
1155 return err;
1156 }
1157 return 0;
1158}
1159
3e6179b8
TI
1160static int alc880_parse_auto_config(struct hda_codec *codec)
1161{
1162 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
7d7eb9ea 1163 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3e6179b8
TI
1164 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1165}
1166
ee3b2969
TI
1167/*
1168 * ALC880 fix-ups
1169 */
1170enum {
411225a0 1171 ALC880_FIXUP_GPIO1,
ee3b2969
TI
1172 ALC880_FIXUP_GPIO2,
1173 ALC880_FIXUP_MEDION_RIM,
dc6af52d 1174 ALC880_FIXUP_LG,
db8a38e5 1175 ALC880_FIXUP_LG_LW25,
f02aab5d 1176 ALC880_FIXUP_W810,
27e917f8 1177 ALC880_FIXUP_EAPD_COEF,
b9368f5c 1178 ALC880_FIXUP_TCL_S700,
cf5a2279
TI
1179 ALC880_FIXUP_VOL_KNOB,
1180 ALC880_FIXUP_FUJITSU,
ba533818 1181 ALC880_FIXUP_F1734,
817de92f 1182 ALC880_FIXUP_UNIWILL,
967b88c4 1183 ALC880_FIXUP_UNIWILL_DIG,
96e225f6 1184 ALC880_FIXUP_Z71V,
487a588d 1185 ALC880_FIXUP_ASUS_W5A,
67b6ec31
TI
1186 ALC880_FIXUP_3ST_BASE,
1187 ALC880_FIXUP_3ST,
1188 ALC880_FIXUP_3ST_DIG,
1189 ALC880_FIXUP_5ST_BASE,
1190 ALC880_FIXUP_5ST,
1191 ALC880_FIXUP_5ST_DIG,
1192 ALC880_FIXUP_6ST_BASE,
1193 ALC880_FIXUP_6ST,
1194 ALC880_FIXUP_6ST_DIG,
5397145f 1195 ALC880_FIXUP_6ST_AUTOMUTE,
ee3b2969
TI
1196};
1197
cf5a2279
TI
1198/* enable the volume-knob widget support on NID 0x21 */
1199static void alc880_fixup_vol_knob(struct hda_codec *codec,
1727a771 1200 const struct hda_fixup *fix, int action)
cf5a2279 1201{
1727a771 1202 if (action == HDA_FIXUP_ACT_PROBE)
62f949bf
TI
1203 snd_hda_jack_detect_enable_callback(codec, 0x21,
1204 alc_update_knob_master);
cf5a2279
TI
1205}
1206
1727a771 1207static const struct hda_fixup alc880_fixups[] = {
411225a0 1208 [ALC880_FIXUP_GPIO1] = {
5579cd6f
TI
1209 .type = HDA_FIXUP_FUNC,
1210 .v.func = alc_fixup_gpio1,
411225a0 1211 },
ee3b2969 1212 [ALC880_FIXUP_GPIO2] = {
5579cd6f
TI
1213 .type = HDA_FIXUP_FUNC,
1214 .v.func = alc_fixup_gpio2,
ee3b2969
TI
1215 },
1216 [ALC880_FIXUP_MEDION_RIM] = {
1727a771 1217 .type = HDA_FIXUP_VERBS,
ee3b2969
TI
1218 .v.verbs = (const struct hda_verb[]) {
1219 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1220 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1221 { }
1222 },
1223 .chained = true,
1224 .chain_id = ALC880_FIXUP_GPIO2,
1225 },
dc6af52d 1226 [ALC880_FIXUP_LG] = {
1727a771
TI
1227 .type = HDA_FIXUP_PINS,
1228 .v.pins = (const struct hda_pintbl[]) {
dc6af52d
TI
1229 /* disable bogus unused pins */
1230 { 0x16, 0x411111f0 },
1231 { 0x18, 0x411111f0 },
1232 { 0x1a, 0x411111f0 },
1233 { }
1234 }
1235 },
db8a38e5
TI
1236 [ALC880_FIXUP_LG_LW25] = {
1237 .type = HDA_FIXUP_PINS,
1238 .v.pins = (const struct hda_pintbl[]) {
1239 { 0x1a, 0x0181344f }, /* line-in */
1240 { 0x1b, 0x0321403f }, /* headphone */
1241 { }
1242 }
1243 },
f02aab5d 1244 [ALC880_FIXUP_W810] = {
1727a771
TI
1245 .type = HDA_FIXUP_PINS,
1246 .v.pins = (const struct hda_pintbl[]) {
f02aab5d
TI
1247 /* disable bogus unused pins */
1248 { 0x17, 0x411111f0 },
1249 { }
1250 },
1251 .chained = true,
1252 .chain_id = ALC880_FIXUP_GPIO2,
1253 },
27e917f8 1254 [ALC880_FIXUP_EAPD_COEF] = {
1727a771 1255 .type = HDA_FIXUP_VERBS,
27e917f8
TI
1256 .v.verbs = (const struct hda_verb[]) {
1257 /* change to EAPD mode */
1258 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1259 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1260 {}
1261 },
1262 },
b9368f5c 1263 [ALC880_FIXUP_TCL_S700] = {
1727a771 1264 .type = HDA_FIXUP_VERBS,
b9368f5c
TI
1265 .v.verbs = (const struct hda_verb[]) {
1266 /* change to EAPD mode */
1267 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1268 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1269 {}
1270 },
1271 .chained = true,
1272 .chain_id = ALC880_FIXUP_GPIO2,
1273 },
cf5a2279 1274 [ALC880_FIXUP_VOL_KNOB] = {
1727a771 1275 .type = HDA_FIXUP_FUNC,
cf5a2279
TI
1276 .v.func = alc880_fixup_vol_knob,
1277 },
1278 [ALC880_FIXUP_FUJITSU] = {
1279 /* override all pins as BIOS on old Amilo is broken */
1727a771
TI
1280 .type = HDA_FIXUP_PINS,
1281 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1282 { 0x14, 0x0121401f }, /* HP */
cf5a2279
TI
1283 { 0x15, 0x99030120 }, /* speaker */
1284 { 0x16, 0x99030130 }, /* bass speaker */
1285 { 0x17, 0x411111f0 }, /* N/A */
1286 { 0x18, 0x411111f0 }, /* N/A */
1287 { 0x19, 0x01a19950 }, /* mic-in */
1288 { 0x1a, 0x411111f0 }, /* N/A */
1289 { 0x1b, 0x411111f0 }, /* N/A */
1290 { 0x1c, 0x411111f0 }, /* N/A */
1291 { 0x1d, 0x411111f0 }, /* N/A */
1292 { 0x1e, 0x01454140 }, /* SPDIF out */
1293 { }
1294 },
1295 .chained = true,
1296 .chain_id = ALC880_FIXUP_VOL_KNOB,
1297 },
ba533818
TI
1298 [ALC880_FIXUP_F1734] = {
1299 /* almost compatible with FUJITSU, but no bass and SPDIF */
1727a771
TI
1300 .type = HDA_FIXUP_PINS,
1301 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1302 { 0x14, 0x0121401f }, /* HP */
ba533818
TI
1303 { 0x15, 0x99030120 }, /* speaker */
1304 { 0x16, 0x411111f0 }, /* N/A */
1305 { 0x17, 0x411111f0 }, /* N/A */
1306 { 0x18, 0x411111f0 }, /* N/A */
1307 { 0x19, 0x01a19950 }, /* mic-in */
1308 { 0x1a, 0x411111f0 }, /* N/A */
1309 { 0x1b, 0x411111f0 }, /* N/A */
1310 { 0x1c, 0x411111f0 }, /* N/A */
1311 { 0x1d, 0x411111f0 }, /* N/A */
1312 { 0x1e, 0x411111f0 }, /* N/A */
1313 { }
1314 },
1315 .chained = true,
1316 .chain_id = ALC880_FIXUP_VOL_KNOB,
1317 },
817de92f
TI
1318 [ALC880_FIXUP_UNIWILL] = {
1319 /* need to fix HP and speaker pins to be parsed correctly */
1727a771
TI
1320 .type = HDA_FIXUP_PINS,
1321 .v.pins = (const struct hda_pintbl[]) {
817de92f
TI
1322 { 0x14, 0x0121411f }, /* HP */
1323 { 0x15, 0x99030120 }, /* speaker */
1324 { 0x16, 0x99030130 }, /* bass speaker */
1325 { }
1326 },
1327 },
967b88c4 1328 [ALC880_FIXUP_UNIWILL_DIG] = {
1727a771
TI
1329 .type = HDA_FIXUP_PINS,
1330 .v.pins = (const struct hda_pintbl[]) {
967b88c4
TI
1331 /* disable bogus unused pins */
1332 { 0x17, 0x411111f0 },
1333 { 0x19, 0x411111f0 },
1334 { 0x1b, 0x411111f0 },
1335 { 0x1f, 0x411111f0 },
1336 { }
1337 }
1338 },
96e225f6 1339 [ALC880_FIXUP_Z71V] = {
1727a771
TI
1340 .type = HDA_FIXUP_PINS,
1341 .v.pins = (const struct hda_pintbl[]) {
96e225f6
TI
1342 /* set up the whole pins as BIOS is utterly broken */
1343 { 0x14, 0x99030120 }, /* speaker */
1344 { 0x15, 0x0121411f }, /* HP */
1345 { 0x16, 0x411111f0 }, /* N/A */
1346 { 0x17, 0x411111f0 }, /* N/A */
1347 { 0x18, 0x01a19950 }, /* mic-in */
1348 { 0x19, 0x411111f0 }, /* N/A */
1349 { 0x1a, 0x01813031 }, /* line-in */
1350 { 0x1b, 0x411111f0 }, /* N/A */
1351 { 0x1c, 0x411111f0 }, /* N/A */
1352 { 0x1d, 0x411111f0 }, /* N/A */
1353 { 0x1e, 0x0144111e }, /* SPDIF */
1354 { }
1355 }
1356 },
487a588d
TI
1357 [ALC880_FIXUP_ASUS_W5A] = {
1358 .type = HDA_FIXUP_PINS,
1359 .v.pins = (const struct hda_pintbl[]) {
1360 /* set up the whole pins as BIOS is utterly broken */
1361 { 0x14, 0x0121411f }, /* HP */
1362 { 0x15, 0x411111f0 }, /* N/A */
1363 { 0x16, 0x411111f0 }, /* N/A */
1364 { 0x17, 0x411111f0 }, /* N/A */
1365 { 0x18, 0x90a60160 }, /* mic */
1366 { 0x19, 0x411111f0 }, /* N/A */
1367 { 0x1a, 0x411111f0 }, /* N/A */
1368 { 0x1b, 0x411111f0 }, /* N/A */
1369 { 0x1c, 0x411111f0 }, /* N/A */
1370 { 0x1d, 0x411111f0 }, /* N/A */
1371 { 0x1e, 0xb743111e }, /* SPDIF out */
1372 { }
1373 },
1374 .chained = true,
1375 .chain_id = ALC880_FIXUP_GPIO1,
1376 },
67b6ec31 1377 [ALC880_FIXUP_3ST_BASE] = {
1727a771
TI
1378 .type = HDA_FIXUP_PINS,
1379 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1380 { 0x14, 0x01014010 }, /* line-out */
1381 { 0x15, 0x411111f0 }, /* N/A */
1382 { 0x16, 0x411111f0 }, /* N/A */
1383 { 0x17, 0x411111f0 }, /* N/A */
1384 { 0x18, 0x01a19c30 }, /* mic-in */
1385 { 0x19, 0x0121411f }, /* HP */
1386 { 0x1a, 0x01813031 }, /* line-in */
1387 { 0x1b, 0x02a19c40 }, /* front-mic */
1388 { 0x1c, 0x411111f0 }, /* N/A */
1389 { 0x1d, 0x411111f0 }, /* N/A */
1390 /* 0x1e is filled in below */
1391 { 0x1f, 0x411111f0 }, /* N/A */
1392 { }
1393 }
1394 },
1395 [ALC880_FIXUP_3ST] = {
1727a771
TI
1396 .type = HDA_FIXUP_PINS,
1397 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1398 { 0x1e, 0x411111f0 }, /* N/A */
1399 { }
1400 },
1401 .chained = true,
1402 .chain_id = ALC880_FIXUP_3ST_BASE,
1403 },
1404 [ALC880_FIXUP_3ST_DIG] = {
1727a771
TI
1405 .type = HDA_FIXUP_PINS,
1406 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1407 { 0x1e, 0x0144111e }, /* SPDIF */
1408 { }
1409 },
1410 .chained = true,
1411 .chain_id = ALC880_FIXUP_3ST_BASE,
1412 },
1413 [ALC880_FIXUP_5ST_BASE] = {
1727a771
TI
1414 .type = HDA_FIXUP_PINS,
1415 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1416 { 0x14, 0x01014010 }, /* front */
1417 { 0x15, 0x411111f0 }, /* N/A */
1418 { 0x16, 0x01011411 }, /* CLFE */
1419 { 0x17, 0x01016412 }, /* surr */
1420 { 0x18, 0x01a19c30 }, /* mic-in */
1421 { 0x19, 0x0121411f }, /* HP */
1422 { 0x1a, 0x01813031 }, /* line-in */
1423 { 0x1b, 0x02a19c40 }, /* front-mic */
1424 { 0x1c, 0x411111f0 }, /* N/A */
1425 { 0x1d, 0x411111f0 }, /* N/A */
1426 /* 0x1e is filled in below */
1427 { 0x1f, 0x411111f0 }, /* N/A */
1428 { }
1429 }
1430 },
1431 [ALC880_FIXUP_5ST] = {
1727a771
TI
1432 .type = HDA_FIXUP_PINS,
1433 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1434 { 0x1e, 0x411111f0 }, /* N/A */
1435 { }
1436 },
1437 .chained = true,
1438 .chain_id = ALC880_FIXUP_5ST_BASE,
1439 },
1440 [ALC880_FIXUP_5ST_DIG] = {
1727a771
TI
1441 .type = HDA_FIXUP_PINS,
1442 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1443 { 0x1e, 0x0144111e }, /* SPDIF */
1444 { }
1445 },
1446 .chained = true,
1447 .chain_id = ALC880_FIXUP_5ST_BASE,
1448 },
1449 [ALC880_FIXUP_6ST_BASE] = {
1727a771
TI
1450 .type = HDA_FIXUP_PINS,
1451 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1452 { 0x14, 0x01014010 }, /* front */
1453 { 0x15, 0x01016412 }, /* surr */
1454 { 0x16, 0x01011411 }, /* CLFE */
1455 { 0x17, 0x01012414 }, /* side */
1456 { 0x18, 0x01a19c30 }, /* mic-in */
1457 { 0x19, 0x02a19c40 }, /* front-mic */
1458 { 0x1a, 0x01813031 }, /* line-in */
1459 { 0x1b, 0x0121411f }, /* HP */
1460 { 0x1c, 0x411111f0 }, /* N/A */
1461 { 0x1d, 0x411111f0 }, /* N/A */
1462 /* 0x1e is filled in below */
1463 { 0x1f, 0x411111f0 }, /* N/A */
1464 { }
1465 }
1466 },
1467 [ALC880_FIXUP_6ST] = {
1727a771
TI
1468 .type = HDA_FIXUP_PINS,
1469 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1470 { 0x1e, 0x411111f0 }, /* N/A */
1471 { }
1472 },
1473 .chained = true,
1474 .chain_id = ALC880_FIXUP_6ST_BASE,
1475 },
1476 [ALC880_FIXUP_6ST_DIG] = {
1727a771
TI
1477 .type = HDA_FIXUP_PINS,
1478 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1479 { 0x1e, 0x0144111e }, /* SPDIF */
1480 { }
1481 },
1482 .chained = true,
1483 .chain_id = ALC880_FIXUP_6ST_BASE,
1484 },
5397145f
TI
1485 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1486 .type = HDA_FIXUP_PINS,
1487 .v.pins = (const struct hda_pintbl[]) {
1488 { 0x1b, 0x0121401f }, /* HP with jack detect */
1489 { }
1490 },
1491 .chained_before = true,
1492 .chain_id = ALC880_FIXUP_6ST_BASE,
1493 },
ee3b2969
TI
1494};
1495
1496static const struct snd_pci_quirk alc880_fixup_tbl[] = {
f02aab5d 1497 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
487a588d 1498 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
96e225f6 1499 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
29e3fdcc 1500 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
6538de03 1501 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
29e3fdcc 1502 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
27e917f8 1503 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
967b88c4 1504 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
ba533818 1505 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
817de92f 1506 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
7833c7e8 1507 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
f02aab5d 1508 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
ee3b2969 1509 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
5397145f 1510 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
a161574e 1511 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
cf5a2279 1512 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
ba533818 1513 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
cf5a2279 1514 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
dc6af52d
TI
1515 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1516 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1517 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
db8a38e5 1518 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
b9368f5c 1519 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
67b6ec31
TI
1520
1521 /* Below is the copied entries from alc880_quirks.c.
1522 * It's not quite sure whether BIOS sets the correct pin-config table
1523 * on these machines, thus they are kept to be compatible with
1524 * the old static quirks. Once when it's confirmed to work without
1525 * these overrides, it'd be better to remove.
1526 */
1527 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1528 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1529 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1530 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1531 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1532 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1533 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1534 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1535 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1536 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1537 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1538 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1539 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1540 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1541 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1542 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1543 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1544 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1545 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1546 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1547 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1548 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1549 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1550 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1551 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1552 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1553 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1554 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1555 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1556 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1557 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1558 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1559 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1560 /* default Intel */
1561 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1562 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1563 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1564 {}
1565};
1566
1727a771 1567static const struct hda_model_fixup alc880_fixup_models[] = {
67b6ec31
TI
1568 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1569 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1570 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1571 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1572 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1573 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
5397145f 1574 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
ee3b2969
TI
1575 {}
1576};
1577
1578
1d045db9
TI
1579/*
1580 * OK, here we have finally the patch for ALC880
1581 */
1d045db9 1582static int patch_alc880(struct hda_codec *codec)
60db6b53 1583{
1d045db9 1584 struct alc_spec *spec;
1d045db9 1585 int err;
f6a92248 1586
3de95173
TI
1587 err = alc_alloc_spec(codec, 0x0b);
1588 if (err < 0)
1589 return err;
64154835 1590
3de95173 1591 spec = codec->spec;
08c189f2 1592 spec->gen.need_dac_fix = 1;
7504b6cd 1593 spec->gen.beep_nid = 0x01;
f53281e6 1594
225068ab
TI
1595 codec->patch_ops.unsol_event = alc880_unsol_event;
1596
c9af753f
TI
1597 alc_pre_init(codec);
1598
1727a771 1599 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
67b6ec31 1600 alc880_fixups);
1727a771 1601 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ee3b2969 1602
67b6ec31
TI
1603 /* automatic parse from the BIOS config */
1604 err = alc880_parse_auto_config(codec);
1605 if (err < 0)
1606 goto error;
fe3eb0a7 1607
fea80fae
TI
1608 if (!spec->gen.no_analog) {
1609 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1610 if (err < 0)
1611 goto error;
1612 }
f53281e6 1613
1727a771 1614 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1615
1d045db9 1616 return 0;
e16fb6d1
TI
1617
1618 error:
1619 alc_free(codec);
1620 return err;
226b1ec8
KY
1621}
1622
1d045db9 1623
60db6b53 1624/*
1d045db9 1625 * ALC260 support
60db6b53 1626 */
1d045db9 1627static int alc260_parse_auto_config(struct hda_codec *codec)
f6a92248 1628{
1d045db9 1629 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
3e6179b8
TI
1630 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1631 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
f6a92248
KY
1632}
1633
1d045db9
TI
1634/*
1635 * Pin config fixes
1636 */
1637enum {
ca8f0424
TI
1638 ALC260_FIXUP_HP_DC5750,
1639 ALC260_FIXUP_HP_PIN_0F,
1640 ALC260_FIXUP_COEF,
15317ab2 1641 ALC260_FIXUP_GPIO1,
20f7d928
TI
1642 ALC260_FIXUP_GPIO1_TOGGLE,
1643 ALC260_FIXUP_REPLACER,
0a1c4fa2 1644 ALC260_FIXUP_HP_B1900,
118cb4a4 1645 ALC260_FIXUP_KN1,
39aedee7 1646 ALC260_FIXUP_FSC_S7020,
5ebd3bbd 1647 ALC260_FIXUP_FSC_S7020_JWSE,
d08c5ef2 1648 ALC260_FIXUP_VAIO_PINS,
1d045db9
TI
1649};
1650
20f7d928
TI
1651static void alc260_gpio1_automute(struct hda_codec *codec)
1652{
1653 struct alc_spec *spec = codec->spec;
aaf312de
TI
1654
1655 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
20f7d928
TI
1656}
1657
1658static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1727a771 1659 const struct hda_fixup *fix, int action)
20f7d928
TI
1660{
1661 struct alc_spec *spec = codec->spec;
1727a771 1662 if (action == HDA_FIXUP_ACT_PROBE) {
20f7d928
TI
1663 /* although the machine has only one output pin, we need to
1664 * toggle GPIO1 according to the jack state
1665 */
08c189f2
TI
1666 spec->gen.automute_hook = alc260_gpio1_automute;
1667 spec->gen.detect_hp = 1;
1668 spec->gen.automute_speaker = 1;
1669 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
62f949bf 1670 snd_hda_jack_detect_enable_callback(codec, 0x0f,
08c189f2 1671 snd_hda_gen_hp_automute);
5579cd6f 1672 alc_setup_gpio(codec, 0x01);
20f7d928
TI
1673 }
1674}
1675
118cb4a4 1676static void alc260_fixup_kn1(struct hda_codec *codec,
1727a771 1677 const struct hda_fixup *fix, int action)
118cb4a4
TI
1678{
1679 struct alc_spec *spec = codec->spec;
1727a771 1680 static const struct hda_pintbl pincfgs[] = {
118cb4a4
TI
1681 { 0x0f, 0x02214000 }, /* HP/speaker */
1682 { 0x12, 0x90a60160 }, /* int mic */
1683 { 0x13, 0x02a19000 }, /* ext mic */
1684 { 0x18, 0x01446000 }, /* SPDIF out */
1685 /* disable bogus I/O pins */
1686 { 0x10, 0x411111f0 },
1687 { 0x11, 0x411111f0 },
1688 { 0x14, 0x411111f0 },
1689 { 0x15, 0x411111f0 },
1690 { 0x16, 0x411111f0 },
1691 { 0x17, 0x411111f0 },
1692 { 0x19, 0x411111f0 },
1693 { }
1694 };
1695
1696 switch (action) {
1727a771
TI
1697 case HDA_FIXUP_ACT_PRE_PROBE:
1698 snd_hda_apply_pincfgs(codec, pincfgs);
118cb4a4
TI
1699 spec->init_amp = ALC_INIT_NONE;
1700 break;
1701 }
1702}
1703
39aedee7
TI
1704static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1705 const struct hda_fixup *fix, int action)
1706{
1707 struct alc_spec *spec = codec->spec;
1c76aa5f 1708 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5ebd3bbd
TI
1709 spec->init_amp = ALC_INIT_NONE;
1710}
39aedee7 1711
5ebd3bbd
TI
1712static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1713 const struct hda_fixup *fix, int action)
1714{
1715 struct alc_spec *spec = codec->spec;
1716 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
f811c3cf 1717 spec->gen.add_jack_modes = 1;
5ebd3bbd 1718 spec->gen.hp_mic = 1;
e6e0ee50 1719 }
39aedee7
TI
1720}
1721
1727a771 1722static const struct hda_fixup alc260_fixups[] = {
ca8f0424 1723 [ALC260_FIXUP_HP_DC5750] = {
1727a771
TI
1724 .type = HDA_FIXUP_PINS,
1725 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
1726 { 0x11, 0x90130110 }, /* speaker */
1727 { }
1728 }
1729 },
ca8f0424 1730 [ALC260_FIXUP_HP_PIN_0F] = {
1727a771
TI
1731 .type = HDA_FIXUP_PINS,
1732 .v.pins = (const struct hda_pintbl[]) {
ca8f0424
TI
1733 { 0x0f, 0x01214000 }, /* HP */
1734 { }
1735 }
1736 },
1737 [ALC260_FIXUP_COEF] = {
1727a771 1738 .type = HDA_FIXUP_VERBS,
ca8f0424 1739 .v.verbs = (const struct hda_verb[]) {
e30cf2d2
RM
1740 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1741 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
ca8f0424
TI
1742 { }
1743 },
ca8f0424 1744 },
15317ab2 1745 [ALC260_FIXUP_GPIO1] = {
5579cd6f
TI
1746 .type = HDA_FIXUP_FUNC,
1747 .v.func = alc_fixup_gpio1,
15317ab2 1748 },
20f7d928 1749 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1727a771 1750 .type = HDA_FIXUP_FUNC,
20f7d928
TI
1751 .v.func = alc260_fixup_gpio1_toggle,
1752 .chained = true,
1753 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1754 },
1755 [ALC260_FIXUP_REPLACER] = {
1727a771 1756 .type = HDA_FIXUP_VERBS,
20f7d928 1757 .v.verbs = (const struct hda_verb[]) {
192a98e2
TI
1758 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1759 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
20f7d928
TI
1760 { }
1761 },
1762 .chained = true,
1763 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1764 },
0a1c4fa2 1765 [ALC260_FIXUP_HP_B1900] = {
1727a771 1766 .type = HDA_FIXUP_FUNC,
0a1c4fa2
TI
1767 .v.func = alc260_fixup_gpio1_toggle,
1768 .chained = true,
1769 .chain_id = ALC260_FIXUP_COEF,
118cb4a4
TI
1770 },
1771 [ALC260_FIXUP_KN1] = {
1727a771 1772 .type = HDA_FIXUP_FUNC,
118cb4a4
TI
1773 .v.func = alc260_fixup_kn1,
1774 },
39aedee7
TI
1775 [ALC260_FIXUP_FSC_S7020] = {
1776 .type = HDA_FIXUP_FUNC,
1777 .v.func = alc260_fixup_fsc_s7020,
1778 },
5ebd3bbd
TI
1779 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1780 .type = HDA_FIXUP_FUNC,
1781 .v.func = alc260_fixup_fsc_s7020_jwse,
1782 .chained = true,
1783 .chain_id = ALC260_FIXUP_FSC_S7020,
1784 },
d08c5ef2
TI
1785 [ALC260_FIXUP_VAIO_PINS] = {
1786 .type = HDA_FIXUP_PINS,
1787 .v.pins = (const struct hda_pintbl[]) {
1788 /* Pin configs are missing completely on some VAIOs */
1789 { 0x0f, 0x01211020 },
1790 { 0x10, 0x0001003f },
1791 { 0x11, 0x411111f0 },
1792 { 0x12, 0x01a15930 },
1793 { 0x13, 0x411111f0 },
1794 { 0x14, 0x411111f0 },
1795 { 0x15, 0x411111f0 },
1796 { 0x16, 0x411111f0 },
1797 { 0x17, 0x411111f0 },
1798 { 0x18, 0x411111f0 },
1799 { 0x19, 0x411111f0 },
1800 { }
1801 }
1802 },
1d045db9
TI
1803};
1804
1805static const struct snd_pci_quirk alc260_fixup_tbl[] = {
15317ab2 1806 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
ca8f0424 1807 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
15317ab2 1808 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
ca8f0424 1809 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
0a1c4fa2 1810 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
d08c5ef2 1811 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
0f5a5b85 1812 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
39aedee7 1813 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
b1f58085 1814 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
118cb4a4 1815 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
20f7d928 1816 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
ca8f0424 1817 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1d045db9
TI
1818 {}
1819};
1820
5ebd3bbd
TI
1821static const struct hda_model_fixup alc260_fixup_models[] = {
1822 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1823 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1824 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1825 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1826 {}
1827};
1828
1d045db9
TI
1829/*
1830 */
1d045db9 1831static int patch_alc260(struct hda_codec *codec)
977ddd6b 1832{
1d045db9 1833 struct alc_spec *spec;
c3c2c9e7 1834 int err;
1d045db9 1835
3de95173
TI
1836 err = alc_alloc_spec(codec, 0x07);
1837 if (err < 0)
1838 return err;
1d045db9 1839
3de95173 1840 spec = codec->spec;
ea46c3c8
TI
1841 /* as quite a few machines require HP amp for speaker outputs,
1842 * it's easier to enable it unconditionally; even if it's unneeded,
1843 * it's almost harmless.
1844 */
1845 spec->gen.prefer_hp_amp = 1;
7504b6cd 1846 spec->gen.beep_nid = 0x01;
1d045db9 1847
225068ab
TI
1848 spec->shutup = alc_eapd_shutup;
1849
c9af753f
TI
1850 alc_pre_init(codec);
1851
5ebd3bbd
TI
1852 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1853 alc260_fixups);
1727a771 1854 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
977ddd6b 1855
c3c2c9e7
TI
1856 /* automatic parse from the BIOS config */
1857 err = alc260_parse_auto_config(codec);
1858 if (err < 0)
1859 goto error;
977ddd6b 1860
fea80fae
TI
1861 if (!spec->gen.no_analog) {
1862 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1863 if (err < 0)
1864 goto error;
1865 }
977ddd6b 1866
1727a771 1867 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1868
1d045db9 1869 return 0;
e16fb6d1
TI
1870
1871 error:
1872 alc_free(codec);
1873 return err;
6981d184
TI
1874}
1875
1d045db9
TI
1876
1877/*
1878 * ALC882/883/885/888/889 support
1879 *
1880 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1881 * configuration. Each pin widget can choose any input DACs and a mixer.
1882 * Each ADC is connected from a mixer of all inputs. This makes possible
1883 * 6-channel independent captures.
1884 *
1885 * In addition, an independent DAC for the multi-playback (not used in this
1886 * driver yet).
1887 */
1d045db9
TI
1888
1889/*
1890 * Pin config fixes
1891 */
ff818c24 1892enum {
5c0ebfbe
TI
1893 ALC882_FIXUP_ABIT_AW9D_MAX,
1894 ALC882_FIXUP_LENOVO_Y530,
1895 ALC882_FIXUP_PB_M5210,
1896 ALC882_FIXUP_ACER_ASPIRE_7736,
1897 ALC882_FIXUP_ASUS_W90V,
8f239214 1898 ALC889_FIXUP_CD,
b2c53e20 1899 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
5c0ebfbe 1900 ALC889_FIXUP_VAIO_TT,
0e7cc2e7 1901 ALC888_FIXUP_EEE1601,
4841b8e6 1902 ALC886_FIXUP_EAPD,
177943a3 1903 ALC882_FIXUP_EAPD,
7a6069bf 1904 ALC883_FIXUP_EAPD,
8812c4f9 1905 ALC883_FIXUP_ACER_EAPD,
1a97b7f2
TI
1906 ALC882_FIXUP_GPIO1,
1907 ALC882_FIXUP_GPIO2,
eb844d51 1908 ALC882_FIXUP_GPIO3,
68ef0561
TI
1909 ALC889_FIXUP_COEF,
1910 ALC882_FIXUP_ASUS_W2JC,
c3e837bb
TI
1911 ALC882_FIXUP_ACER_ASPIRE_4930G,
1912 ALC882_FIXUP_ACER_ASPIRE_8930G,
1913 ALC882_FIXUP_ASPIRE_8930G_VERBS,
5671087f 1914 ALC885_FIXUP_MACPRO_GPIO,
02a237b2 1915 ALC889_FIXUP_DAC_ROUTE,
1a97b7f2
TI
1916 ALC889_FIXUP_MBP_VREF,
1917 ALC889_FIXUP_IMAC91_VREF,
e7729a41 1918 ALC889_FIXUP_MBA11_VREF,
0756f09c 1919 ALC889_FIXUP_MBA21_VREF,
c20f31ec 1920 ALC889_FIXUP_MP11_VREF,
9f660a1c 1921 ALC889_FIXUP_MP41_VREF,
6e72aa5f 1922 ALC882_FIXUP_INV_DMIC,
e427c237 1923 ALC882_FIXUP_NO_PRIMARY_HP,
1f0bbf03 1924 ALC887_FIXUP_ASUS_BASS,
eb9ca3ab 1925 ALC887_FIXUP_BASS_CHMAP,
7beb3a6e 1926 ALC1220_FIXUP_GB_DUAL_CODECS,
5853e364 1927 ALC1220_FIXUP_GB_X570,
0202f5cd 1928 ALC1220_FIXUP_CLEVO_P950,
80690a27
RS
1929 ALC1220_FIXUP_CLEVO_PB51ED,
1930 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
ca184355
JHP
1931 ALC887_FIXUP_ASUS_AUDIO,
1932 ALC887_FIXUP_ASUS_HMIC,
ff818c24
TI
1933};
1934
68ef0561 1935static void alc889_fixup_coef(struct hda_codec *codec,
1727a771 1936 const struct hda_fixup *fix, int action)
68ef0561 1937{
1727a771 1938 if (action != HDA_FIXUP_ACT_INIT)
68ef0561 1939 return;
1df8874b 1940 alc_update_coef_idx(codec, 7, 0, 0x2030);
68ef0561
TI
1941}
1942
5671087f
TI
1943/* set up GPIO at initialization */
1944static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1727a771 1945 const struct hda_fixup *fix, int action)
5671087f 1946{
215c850c
TI
1947 struct alc_spec *spec = codec->spec;
1948
1949 spec->gpio_write_delay = true;
1950 alc_fixup_gpio3(codec, fix, action);
5671087f
TI
1951}
1952
02a237b2
TI
1953/* Fix the connection of some pins for ALC889:
1954 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1955 * work correctly (bko#42740)
1956 */
1957static void alc889_fixup_dac_route(struct hda_codec *codec,
1727a771 1958 const struct hda_fixup *fix, int action)
02a237b2 1959{
1727a771 1960 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
ef8d60fb 1961 /* fake the connections during parsing the tree */
caf3c043
MM
1962 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1963 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1964 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1965 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1966 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1967 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
1727a771 1968 } else if (action == HDA_FIXUP_ACT_PROBE) {
ef8d60fb 1969 /* restore the connections */
caf3c043
MM
1970 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1971 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1972 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1973 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1974 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
02a237b2
TI
1975 }
1976}
1977
1a97b7f2
TI
1978/* Set VREF on HP pin */
1979static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1727a771 1980 const struct hda_fixup *fix, int action)
1a97b7f2 1981{
caf3c043 1982 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
1a97b7f2 1983 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
1984 int i;
1985
1727a771 1986 if (action != HDA_FIXUP_ACT_INIT)
1a97b7f2
TI
1987 return;
1988 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1989 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1990 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1991 continue;
d3f02d60 1992 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 1993 val |= AC_PINCTL_VREF_80;
cdd03ced 1994 snd_hda_set_pin_ctl(codec, nids[i], val);
08c189f2 1995 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
1996 break;
1997 }
1998}
1999
0756f09c
TI
2000static void alc889_fixup_mac_pins(struct hda_codec *codec,
2001 const hda_nid_t *nids, int num_nids)
1a97b7f2
TI
2002{
2003 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
2004 int i;
2005
0756f09c 2006 for (i = 0; i < num_nids; i++) {
1a97b7f2 2007 unsigned int val;
d3f02d60 2008 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 2009 val |= AC_PINCTL_VREF_50;
cdd03ced 2010 snd_hda_set_pin_ctl(codec, nids[i], val);
1a97b7f2 2011 }
08c189f2 2012 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2013}
2014
0756f09c
TI
2015/* Set VREF on speaker pins on imac91 */
2016static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2017 const struct hda_fixup *fix, int action)
2018{
caf3c043 2019 static const hda_nid_t nids[] = { 0x18, 0x1a };
0756f09c
TI
2020
2021 if (action == HDA_FIXUP_ACT_INIT)
2022 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2023}
2024
e7729a41
AV
2025/* Set VREF on speaker pins on mba11 */
2026static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2027 const struct hda_fixup *fix, int action)
2028{
caf3c043 2029 static const hda_nid_t nids[] = { 0x18 };
e7729a41
AV
2030
2031 if (action == HDA_FIXUP_ACT_INIT)
2032 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2033}
2034
0756f09c
TI
2035/* Set VREF on speaker pins on mba21 */
2036static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2037 const struct hda_fixup *fix, int action)
2038{
caf3c043 2039 static const hda_nid_t nids[] = { 0x18, 0x19 };
0756f09c
TI
2040
2041 if (action == HDA_FIXUP_ACT_INIT)
2042 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2043}
2044
e427c237 2045/* Don't take HP output as primary
d9111496
FLVC
2046 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2047 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
e427c237
TI
2048 */
2049static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1727a771 2050 const struct hda_fixup *fix, int action)
e427c237
TI
2051{
2052 struct alc_spec *spec = codec->spec;
da96fb5b 2053 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
08c189f2 2054 spec->gen.no_primary_hp = 1;
da96fb5b
TI
2055 spec->gen.no_multi_io = 1;
2056 }
e427c237
TI
2057}
2058
eb9ca3ab
TI
2059static void alc_fixup_bass_chmap(struct hda_codec *codec,
2060 const struct hda_fixup *fix, int action);
2061
7beb3a6e
TI
2062/* For dual-codec configuration, we need to disable some features to avoid
2063 * conflicts of kctls and PCM streams
2064 */
2065static void alc_fixup_dual_codecs(struct hda_codec *codec,
2066 const struct hda_fixup *fix, int action)
2067{
2068 struct alc_spec *spec = codec->spec;
2069
2070 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2071 return;
2072 /* disable vmaster */
2073 spec->gen.suppress_vmaster = 1;
2074 /* auto-mute and auto-mic switch don't work with multiple codecs */
2075 spec->gen.suppress_auto_mute = 1;
2076 spec->gen.suppress_auto_mic = 1;
2077 /* disable aamix as well */
2078 spec->gen.mixer_nid = 0;
2079 /* add location prefix to avoid conflicts */
2080 codec->force_pin_prefix = 1;
2081}
2082
2083static void rename_ctl(struct hda_codec *codec, const char *oldname,
2084 const char *newname)
2085{
2086 struct snd_kcontrol *kctl;
2087
2088 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2089 if (kctl)
2090 strcpy(kctl->id.name, newname);
2091}
2092
2093static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2094 const struct hda_fixup *fix,
2095 int action)
2096{
2097 alc_fixup_dual_codecs(codec, fix, action);
2098 switch (action) {
2099 case HDA_FIXUP_ACT_PRE_PROBE:
2100 /* override card longname to provide a unique UCM profile */
2101 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2102 break;
2103 case HDA_FIXUP_ACT_BUILD:
2104 /* rename Capture controls depending on the codec */
2105 rename_ctl(codec, "Capture Volume",
2106 codec->addr == 0 ?
2107 "Rear-Panel Capture Volume" :
2108 "Front-Panel Capture Volume");
2109 rename_ctl(codec, "Capture Switch",
2110 codec->addr == 0 ?
2111 "Rear-Panel Capture Switch" :
2112 "Front-Panel Capture Switch");
2113 break;
2114 }
2115}
2116
5853e364
CL
2117static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2118 const struct hda_fixup *fix,
2119 int action)
2120{
2121 static const hda_nid_t conn1[] = { 0x0c };
2122 static const struct coef_fw gb_x570_coefs[] = {
2123 WRITE_COEF(0x1a, 0x01c1),
2124 WRITE_COEF(0x1b, 0x0202),
2125 WRITE_COEF(0x43, 0x3005),
2126 {}
2127 };
2128
2129 switch (action) {
2130 case HDA_FIXUP_ACT_PRE_PROBE:
2131 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2132 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2133 break;
2134 case HDA_FIXUP_ACT_INIT:
2135 alc_process_coef_fw(codec, gb_x570_coefs);
2136 break;
2137 }
2138}
2139
0202f5cd
P
2140static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2141 const struct hda_fixup *fix,
2142 int action)
2143{
caf3c043 2144 static const hda_nid_t conn1[] = { 0x0c };
0202f5cd
P
2145
2146 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2147 return;
2148
2149 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2150 /* We therefore want to make sure 0x14 (front headphone) and
2151 * 0x1b (speakers) use the stereo DAC 0x02
2152 */
caf3c043
MM
2153 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2154 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
0202f5cd
P
2155}
2156
7f665b1c
JS
2157static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2158 const struct hda_fixup *fix, int action);
2159
80690a27 2160static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
7f665b1c
JS
2161 const struct hda_fixup *fix,
2162 int action)
2163{
2164 alc1220_fixup_clevo_p950(codec, fix, action);
2165 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2166}
2167
ca184355
JHP
2168static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2169 struct hda_jack_callback *jack)
2170{
2171 struct alc_spec *spec = codec->spec;
2172 unsigned int vref;
2173
2174 snd_hda_gen_hp_automute(codec, jack);
2175
2176 if (spec->gen.hp_jack_present)
2177 vref = AC_PINCTL_VREF_80;
2178 else
2179 vref = AC_PINCTL_VREF_HIZ;
2180 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2181}
2182
2183static void alc887_fixup_asus_jack(struct hda_codec *codec,
2184 const struct hda_fixup *fix, int action)
2185{
2186 struct alc_spec *spec = codec->spec;
2187 if (action != HDA_FIXUP_ACT_PROBE)
2188 return;
2189 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2190 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2191}
2192
1727a771 2193static const struct hda_fixup alc882_fixups[] = {
5c0ebfbe 2194 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1727a771
TI
2195 .type = HDA_FIXUP_PINS,
2196 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2197 { 0x15, 0x01080104 }, /* side */
2198 { 0x16, 0x01011012 }, /* rear */
2199 { 0x17, 0x01016011 }, /* clfe */
2785591a 2200 { }
145a902b
DH
2201 }
2202 },
5c0ebfbe 2203 [ALC882_FIXUP_LENOVO_Y530] = {
1727a771
TI
2204 .type = HDA_FIXUP_PINS,
2205 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2206 { 0x15, 0x99130112 }, /* rear int speakers */
2207 { 0x16, 0x99130111 }, /* subwoofer */
ac612407
DH
2208 { }
2209 }
2210 },
5c0ebfbe 2211 [ALC882_FIXUP_PB_M5210] = {
fd108215
TI
2212 .type = HDA_FIXUP_PINCTLS,
2213 .v.pins = (const struct hda_pintbl[]) {
2214 { 0x19, PIN_VREF50 },
357f915e
KY
2215 {}
2216 }
2217 },
5c0ebfbe 2218 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
1727a771 2219 .type = HDA_FIXUP_FUNC,
23d30f28 2220 .v.func = alc_fixup_sku_ignore,
6981d184 2221 },
5c0ebfbe 2222 [ALC882_FIXUP_ASUS_W90V] = {
1727a771
TI
2223 .type = HDA_FIXUP_PINS,
2224 .v.pins = (const struct hda_pintbl[]) {
5cdf745e
TI
2225 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2226 { }
2227 }
2228 },
8f239214 2229 [ALC889_FIXUP_CD] = {
1727a771
TI
2230 .type = HDA_FIXUP_PINS,
2231 .v.pins = (const struct hda_pintbl[]) {
8f239214
MB
2232 { 0x1c, 0x993301f0 }, /* CD */
2233 { }
2234 }
2235 },
b2c53e20
DH
2236 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2237 .type = HDA_FIXUP_PINS,
2238 .v.pins = (const struct hda_pintbl[]) {
2239 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2240 { }
2241 },
2242 .chained = true,
2243 .chain_id = ALC889_FIXUP_CD,
2244 },
5c0ebfbe 2245 [ALC889_FIXUP_VAIO_TT] = {
1727a771
TI
2246 .type = HDA_FIXUP_PINS,
2247 .v.pins = (const struct hda_pintbl[]) {
5c0ebfbe
TI
2248 { 0x17, 0x90170111 }, /* hidden surround speaker */
2249 { }
2250 }
2251 },
0e7cc2e7 2252 [ALC888_FIXUP_EEE1601] = {
1727a771 2253 .type = HDA_FIXUP_VERBS,
0e7cc2e7
TI
2254 .v.verbs = (const struct hda_verb[]) {
2255 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2256 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2257 { }
2258 }
177943a3 2259 },
4841b8e6
PH
2260 [ALC886_FIXUP_EAPD] = {
2261 .type = HDA_FIXUP_VERBS,
2262 .v.verbs = (const struct hda_verb[]) {
2263 /* change to EAPD mode */
2264 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2265 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2266 { }
2267 }
2268 },
177943a3 2269 [ALC882_FIXUP_EAPD] = {
1727a771 2270 .type = HDA_FIXUP_VERBS,
177943a3
TI
2271 .v.verbs = (const struct hda_verb[]) {
2272 /* change to EAPD mode */
2273 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2274 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2275 { }
2276 }
2277 },
7a6069bf 2278 [ALC883_FIXUP_EAPD] = {
1727a771 2279 .type = HDA_FIXUP_VERBS,
7a6069bf
TI
2280 .v.verbs = (const struct hda_verb[]) {
2281 /* change to EAPD mode */
2282 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2283 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2284 { }
2285 }
2286 },
8812c4f9 2287 [ALC883_FIXUP_ACER_EAPD] = {
1727a771 2288 .type = HDA_FIXUP_VERBS,
8812c4f9
TI
2289 .v.verbs = (const struct hda_verb[]) {
2290 /* eanable EAPD on Acer laptops */
2291 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2292 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2293 { }
2294 }
2295 },
1a97b7f2 2296 [ALC882_FIXUP_GPIO1] = {
5579cd6f
TI
2297 .type = HDA_FIXUP_FUNC,
2298 .v.func = alc_fixup_gpio1,
1a97b7f2
TI
2299 },
2300 [ALC882_FIXUP_GPIO2] = {
5579cd6f
TI
2301 .type = HDA_FIXUP_FUNC,
2302 .v.func = alc_fixup_gpio2,
1a97b7f2 2303 },
eb844d51 2304 [ALC882_FIXUP_GPIO3] = {
5579cd6f
TI
2305 .type = HDA_FIXUP_FUNC,
2306 .v.func = alc_fixup_gpio3,
eb844d51 2307 },
68ef0561 2308 [ALC882_FIXUP_ASUS_W2JC] = {
5579cd6f
TI
2309 .type = HDA_FIXUP_FUNC,
2310 .v.func = alc_fixup_gpio1,
68ef0561
TI
2311 .chained = true,
2312 .chain_id = ALC882_FIXUP_EAPD,
2313 },
2314 [ALC889_FIXUP_COEF] = {
1727a771 2315 .type = HDA_FIXUP_FUNC,
68ef0561
TI
2316 .v.func = alc889_fixup_coef,
2317 },
c3e837bb 2318 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
1727a771
TI
2319 .type = HDA_FIXUP_PINS,
2320 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2321 { 0x16, 0x99130111 }, /* CLFE speaker */
2322 { 0x17, 0x99130112 }, /* surround speaker */
2323 { }
038d4fef
TI
2324 },
2325 .chained = true,
2326 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb
TI
2327 },
2328 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
1727a771
TI
2329 .type = HDA_FIXUP_PINS,
2330 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2331 { 0x16, 0x99130111 }, /* CLFE speaker */
2332 { 0x1b, 0x99130112 }, /* surround speaker */
2333 { }
2334 },
2335 .chained = true,
2336 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2337 },
2338 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2339 /* additional init verbs for Acer Aspire 8930G */
1727a771 2340 .type = HDA_FIXUP_VERBS,
c3e837bb
TI
2341 .v.verbs = (const struct hda_verb[]) {
2342 /* Enable all DACs */
2343 /* DAC DISABLE/MUTE 1? */
2344 /* setting bits 1-5 disables DAC nids 0x02-0x06
2345 * apparently. Init=0x38 */
2346 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2347 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2348 /* DAC DISABLE/MUTE 2? */
2349 /* some bit here disables the other DACs.
2350 * Init=0x4900 */
2351 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2352 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2353 /* DMIC fix
2354 * This laptop has a stereo digital microphone.
2355 * The mics are only 1cm apart which makes the stereo
2356 * useless. However, either the mic or the ALC889
2357 * makes the signal become a difference/sum signal
2358 * instead of standard stereo, which is annoying.
2359 * So instead we flip this bit which makes the
2360 * codec replicate the sum signal to both channels,
2361 * turning it into a normal mono mic.
2362 */
2363 /* DMIC_CONTROL? Init value = 0x0001 */
2364 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2365 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2366 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2367 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2368 { }
038d4fef
TI
2369 },
2370 .chained = true,
2371 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb 2372 },
5671087f 2373 [ALC885_FIXUP_MACPRO_GPIO] = {
1727a771 2374 .type = HDA_FIXUP_FUNC,
5671087f
TI
2375 .v.func = alc885_fixup_macpro_gpio,
2376 },
02a237b2 2377 [ALC889_FIXUP_DAC_ROUTE] = {
1727a771 2378 .type = HDA_FIXUP_FUNC,
02a237b2
TI
2379 .v.func = alc889_fixup_dac_route,
2380 },
1a97b7f2 2381 [ALC889_FIXUP_MBP_VREF] = {
1727a771 2382 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2383 .v.func = alc889_fixup_mbp_vref,
2384 .chained = true,
2385 .chain_id = ALC882_FIXUP_GPIO1,
2386 },
2387 [ALC889_FIXUP_IMAC91_VREF] = {
1727a771 2388 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2389 .v.func = alc889_fixup_imac91_vref,
2390 .chained = true,
2391 .chain_id = ALC882_FIXUP_GPIO1,
2392 },
e7729a41
AV
2393 [ALC889_FIXUP_MBA11_VREF] = {
2394 .type = HDA_FIXUP_FUNC,
2395 .v.func = alc889_fixup_mba11_vref,
2396 .chained = true,
2397 .chain_id = ALC889_FIXUP_MBP_VREF,
2398 },
0756f09c
TI
2399 [ALC889_FIXUP_MBA21_VREF] = {
2400 .type = HDA_FIXUP_FUNC,
2401 .v.func = alc889_fixup_mba21_vref,
2402 .chained = true,
2403 .chain_id = ALC889_FIXUP_MBP_VREF,
2404 },
c20f31ec
TI
2405 [ALC889_FIXUP_MP11_VREF] = {
2406 .type = HDA_FIXUP_FUNC,
2407 .v.func = alc889_fixup_mba11_vref,
2408 .chained = true,
2409 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2410 },
9f660a1c
MK
2411 [ALC889_FIXUP_MP41_VREF] = {
2412 .type = HDA_FIXUP_FUNC,
2413 .v.func = alc889_fixup_mbp_vref,
2414 .chained = true,
2415 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2416 },
6e72aa5f 2417 [ALC882_FIXUP_INV_DMIC] = {
1727a771 2418 .type = HDA_FIXUP_FUNC,
9d36a7dc 2419 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2420 },
e427c237 2421 [ALC882_FIXUP_NO_PRIMARY_HP] = {
1727a771 2422 .type = HDA_FIXUP_FUNC,
e427c237
TI
2423 .v.func = alc882_fixup_no_primary_hp,
2424 },
1f0bbf03
TI
2425 [ALC887_FIXUP_ASUS_BASS] = {
2426 .type = HDA_FIXUP_PINS,
2427 .v.pins = (const struct hda_pintbl[]) {
2428 {0x16, 0x99130130}, /* bass speaker */
2429 {}
2430 },
eb9ca3ab
TI
2431 .chained = true,
2432 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2433 },
2434 [ALC887_FIXUP_BASS_CHMAP] = {
2435 .type = HDA_FIXUP_FUNC,
2436 .v.func = alc_fixup_bass_chmap,
1f0bbf03 2437 },
7beb3a6e
TI
2438 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2439 .type = HDA_FIXUP_FUNC,
2440 .v.func = alc1220_fixup_gb_dual_codecs,
2441 },
5853e364
CL
2442 [ALC1220_FIXUP_GB_X570] = {
2443 .type = HDA_FIXUP_FUNC,
2444 .v.func = alc1220_fixup_gb_x570,
2445 },
0202f5cd
P
2446 [ALC1220_FIXUP_CLEVO_P950] = {
2447 .type = HDA_FIXUP_FUNC,
2448 .v.func = alc1220_fixup_clevo_p950,
2449 },
80690a27 2450 [ALC1220_FIXUP_CLEVO_PB51ED] = {
7f665b1c 2451 .type = HDA_FIXUP_FUNC,
80690a27 2452 .v.func = alc1220_fixup_clevo_pb51ed,
7f665b1c 2453 },
80690a27 2454 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
7f665b1c
JS
2455 .type = HDA_FIXUP_PINS,
2456 .v.pins = (const struct hda_pintbl[]) {
2457 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2458 {}
2459 },
2460 .chained = true,
80690a27 2461 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
7f665b1c 2462 },
ca184355
JHP
2463 [ALC887_FIXUP_ASUS_AUDIO] = {
2464 .type = HDA_FIXUP_PINS,
2465 .v.pins = (const struct hda_pintbl[]) {
2466 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2467 { 0x19, 0x22219420 },
2468 {}
2469 },
2470 },
2471 [ALC887_FIXUP_ASUS_HMIC] = {
2472 .type = HDA_FIXUP_FUNC,
2473 .v.func = alc887_fixup_asus_jack,
2474 .chained = true,
2475 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2476 },
ff818c24
TI
2477};
2478
1d045db9 2479static const struct snd_pci_quirk alc882_fixup_tbl[] = {
8812c4f9
TI
2480 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2481 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
b5d724b1 2482 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
8812c4f9
TI
2483 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2484 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2485 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2486 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
c3e837bb
TI
2487 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2488 ALC882_FIXUP_ACER_ASPIRE_4930G),
2489 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2490 ALC882_FIXUP_ACER_ASPIRE_4930G),
2491 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2492 ALC882_FIXUP_ACER_ASPIRE_8930G),
2493 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2494 ALC882_FIXUP_ACER_ASPIRE_8930G),
b265047a
TI
2495 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2496 ALC882_FIXUP_ACER_ASPIRE_4930G),
2497 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
c3e837bb
TI
2498 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2499 ALC882_FIXUP_ACER_ASPIRE_4930G),
2500 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2501 ALC882_FIXUP_ACER_ASPIRE_4930G),
f5c53d89
TI
2502 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2503 ALC882_FIXUP_ACER_ASPIRE_4930G),
02a237b2 2504 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
fe97da1f 2505 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
ac9b1cdd 2506 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
177943a3 2507 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
5c0ebfbe 2508 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
68ef0561 2509 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
ca184355 2510 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
0e7cc2e7 2511 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
1f0bbf03 2512 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
85bcf96c 2513 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
b7529c18
TI
2514 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2515 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
ac9b1cdd 2516 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
e427c237 2517 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
3f3c3714 2518 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
5671087f
TI
2519
2520 /* All Apple entries are in codec SSIDs */
1a97b7f2
TI
2521 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2522 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2523 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
c20f31ec 2524 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
5671087f
TI
2525 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2526 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2527 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2528 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
5671087f 2529 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
e7729a41 2530 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
0756f09c 2531 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
1a97b7f2
TI
2532 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2533 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
5671087f 2534 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2535 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2536 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2537 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
9f660a1c 2538 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
05193639 2539 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
1a97b7f2
TI
2540 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2541 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
649ccd08 2542 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
5671087f 2543
7a6069bf 2544 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
4841b8e6 2545 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
b2c53e20 2546 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
7beb3a6e 2547 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
5853e364 2548 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
d9e8fe0c 2549 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
a0b03952 2550 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
a655e2b1 2551 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
09926202 2552 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
1d3aa4a5 2553 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
7dafba37 2554 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
cc5049ae 2555 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
d2c3b14e 2556 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
26af1772 2557 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
63691587 2558 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
d2c3b14e 2559 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
5c0ebfbe 2560 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
13e1a4cd
TI
2561 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2562 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2563 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2564 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2565 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
aef454b4 2566 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
13e1a4cd
TI
2567 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2568 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2569 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
a7182ce8 2570 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
13e1a4cd 2571 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
1f8d398e 2572 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
cc03069a 2573 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
0202f5cd 2574 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
b5acfe15 2575 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
13e1a4cd 2576 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
f3d737b6 2577 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2f0d520a 2578 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
b5acfe15
PH
2579 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2580 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2581 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2582 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
503d90b3
RS
2583 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2584 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
b5acfe15 2585 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
7a6069bf
TI
2586 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2587 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
ac9b1cdd 2588 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
68ef0561 2589 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
ff818c24
TI
2590 {}
2591};
2592
1727a771 2593static const struct hda_model_fixup alc882_fixup_models[] = {
772c2917
TI
2594 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2595 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2596 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2597 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2598 {.id = ALC889_FIXUP_CD, .name = "cd"},
2599 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2600 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2601 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2602 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2603 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2604 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2605 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2606 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2607 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2608 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
912093bc
TI
2609 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2610 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2611 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
772c2917
TI
2612 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2613 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2614 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2615 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2616 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2617 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2618 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2619 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
6e72aa5f 2620 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
e427c237 2621 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
772c2917 2622 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
ba90d6a6 2623 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
772c2917 2624 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
912093bc
TI
2625 {}
2626};
2627
119b75c1
HW
2628static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2629 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2630 {0x14, 0x01014010},
2631 {0x15, 0x01011012},
2632 {0x16, 0x01016011},
2633 {0x18, 0x01a19040},
2634 {0x19, 0x02a19050},
2635 {0x1a, 0x0181304f},
2636 {0x1b, 0x0221401f},
2637 {0x1e, 0x01456130}),
2638 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2639 {0x14, 0x01015010},
2640 {0x15, 0x01011012},
2641 {0x16, 0x01011011},
2642 {0x18, 0x01a11040},
2643 {0x19, 0x02a19050},
2644 {0x1a, 0x0181104f},
2645 {0x1b, 0x0221401f},
2646 {0x1e, 0x01451130}),
2647 {}
2648};
2649
f6a92248 2650/*
1d045db9 2651 * BIOS auto configuration
f6a92248 2652 */
1d045db9
TI
2653/* almost identical with ALC880 parser... */
2654static int alc882_parse_auto_config(struct hda_codec *codec)
2655{
1d045db9 2656 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2657 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2658 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
1d045db9 2659}
b896b4eb 2660
1d045db9
TI
2661/*
2662 */
1d045db9 2663static int patch_alc882(struct hda_codec *codec)
f6a92248
KY
2664{
2665 struct alc_spec *spec;
1a97b7f2 2666 int err;
f6a92248 2667
3de95173
TI
2668 err = alc_alloc_spec(codec, 0x0b);
2669 if (err < 0)
2670 return err;
f6a92248 2671
3de95173 2672 spec = codec->spec;
1f0f4b80 2673
7639a06c 2674 switch (codec->core.vendor_id) {
1d045db9
TI
2675 case 0x10ec0882:
2676 case 0x10ec0885:
acf08081 2677 case 0x10ec0900:
6d9ffcff 2678 case 0x10ec0b00:
a535ad57 2679 case 0x10ec1220:
1d045db9
TI
2680 break;
2681 default:
2682 /* ALC883 and variants */
2683 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2684 break;
c793bec5 2685 }
977ddd6b 2686
c9af753f
TI
2687 alc_pre_init(codec);
2688
1727a771 2689 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
912093bc 2690 alc882_fixups);
119b75c1 2691 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
1727a771 2692 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ff818c24 2693
1d045db9
TI
2694 alc_auto_parse_customize_define(codec);
2695
7504b6cd
TI
2696 if (has_cdefine_beep(codec))
2697 spec->gen.beep_nid = 0x01;
2698
1a97b7f2
TI
2699 /* automatic parse from the BIOS config */
2700 err = alc882_parse_auto_config(codec);
2701 if (err < 0)
2702 goto error;
f6a92248 2703
fea80fae
TI
2704 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2705 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2706 if (err < 0)
2707 goto error;
2708 }
f6a92248 2709
1727a771 2710 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2711
f6a92248 2712 return 0;
e16fb6d1
TI
2713
2714 error:
2715 alc_free(codec);
2716 return err;
f6a92248
KY
2717}
2718
df694daa 2719
df694daa 2720/*
1d045db9 2721 * ALC262 support
df694daa 2722 */
1d045db9 2723static int alc262_parse_auto_config(struct hda_codec *codec)
df694daa 2724{
1d045db9 2725 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2726 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2727 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
df694daa
KY
2728}
2729
df694daa 2730/*
1d045db9 2731 * Pin config fixes
df694daa 2732 */
cfc9b06f 2733enum {
ea4e7af1 2734 ALC262_FIXUP_FSC_H270,
7513e6da 2735 ALC262_FIXUP_FSC_S7110,
ea4e7af1
TI
2736 ALC262_FIXUP_HP_Z200,
2737 ALC262_FIXUP_TYAN,
c470150c 2738 ALC262_FIXUP_LENOVO_3000,
b42590b8
TI
2739 ALC262_FIXUP_BENQ,
2740 ALC262_FIXUP_BENQ_T31,
6e72aa5f 2741 ALC262_FIXUP_INV_DMIC,
b5c6611f 2742 ALC262_FIXUP_INTEL_BAYLEYBAY,
cfc9b06f
TI
2743};
2744
1727a771 2745static const struct hda_fixup alc262_fixups[] = {
ea4e7af1 2746 [ALC262_FIXUP_FSC_H270] = {
1727a771
TI
2747 .type = HDA_FIXUP_PINS,
2748 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2749 { 0x14, 0x99130110 }, /* speaker */
2750 { 0x15, 0x0221142f }, /* front HP */
2751 { 0x1b, 0x0121141f }, /* rear HP */
2752 { }
2753 }
2754 },
7513e6da
TI
2755 [ALC262_FIXUP_FSC_S7110] = {
2756 .type = HDA_FIXUP_PINS,
2757 .v.pins = (const struct hda_pintbl[]) {
2758 { 0x15, 0x90170110 }, /* speaker */
2759 { }
2760 },
2761 .chained = true,
2762 .chain_id = ALC262_FIXUP_BENQ,
2763 },
ea4e7af1 2764 [ALC262_FIXUP_HP_Z200] = {
1727a771
TI
2765 .type = HDA_FIXUP_PINS,
2766 .v.pins = (const struct hda_pintbl[]) {
1d045db9 2767 { 0x16, 0x99130120 }, /* internal speaker */
73413b12
TI
2768 { }
2769 }
cfc9b06f 2770 },
ea4e7af1 2771 [ALC262_FIXUP_TYAN] = {
1727a771
TI
2772 .type = HDA_FIXUP_PINS,
2773 .v.pins = (const struct hda_pintbl[]) {
ea4e7af1
TI
2774 { 0x14, 0x1993e1f0 }, /* int AUX */
2775 { }
2776 }
2777 },
c470150c 2778 [ALC262_FIXUP_LENOVO_3000] = {
fd108215
TI
2779 .type = HDA_FIXUP_PINCTLS,
2780 .v.pins = (const struct hda_pintbl[]) {
2781 { 0x19, PIN_VREF50 },
b42590b8
TI
2782 {}
2783 },
2784 .chained = true,
2785 .chain_id = ALC262_FIXUP_BENQ,
2786 },
2787 [ALC262_FIXUP_BENQ] = {
1727a771 2788 .type = HDA_FIXUP_VERBS,
b42590b8 2789 .v.verbs = (const struct hda_verb[]) {
c470150c
TI
2790 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2791 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2792 {}
2793 }
2794 },
b42590b8 2795 [ALC262_FIXUP_BENQ_T31] = {
1727a771 2796 .type = HDA_FIXUP_VERBS,
b42590b8
TI
2797 .v.verbs = (const struct hda_verb[]) {
2798 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2799 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2800 {}
2801 }
2802 },
6e72aa5f 2803 [ALC262_FIXUP_INV_DMIC] = {
1727a771 2804 .type = HDA_FIXUP_FUNC,
9d36a7dc 2805 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2806 },
b5c6611f
ML
2807 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2808 .type = HDA_FIXUP_FUNC,
2809 .v.func = alc_fixup_no_depop_delay,
2810 },
cfc9b06f
TI
2811};
2812
1d045db9 2813static const struct snd_pci_quirk alc262_fixup_tbl[] = {
ea4e7af1 2814 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
7513e6da 2815 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
3dcd3be3 2816 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
ea4e7af1 2817 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
275ec0cb 2818 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
ea4e7af1 2819 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
c470150c 2820 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
b42590b8
TI
2821 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2822 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
b5c6611f 2823 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
cfc9b06f
TI
2824 {}
2825};
df694daa 2826
1727a771 2827static const struct hda_model_fixup alc262_fixup_models[] = {
6e72aa5f 2828 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
e43c44d6
TI
2829 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2830 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2831 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2832 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2833 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2834 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2835 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2836 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
6e72aa5f
TI
2837 {}
2838};
1d045db9 2839
1d045db9
TI
2840/*
2841 */
1d045db9 2842static int patch_alc262(struct hda_codec *codec)
df694daa
KY
2843{
2844 struct alc_spec *spec;
df694daa
KY
2845 int err;
2846
3de95173
TI
2847 err = alc_alloc_spec(codec, 0x0b);
2848 if (err < 0)
2849 return err;
df694daa 2850
3de95173 2851 spec = codec->spec;
08c189f2 2852 spec->gen.shared_mic_vref_pin = 0x18;
1d045db9 2853
225068ab
TI
2854 spec->shutup = alc_eapd_shutup;
2855
1d045db9
TI
2856#if 0
2857 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2858 * under-run
2859 */
98b24883 2860 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
1d045db9 2861#endif
1d045db9
TI
2862 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2863
c9af753f
TI
2864 alc_pre_init(codec);
2865
1727a771 2866 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
6e72aa5f 2867 alc262_fixups);
1727a771 2868 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9c7f852e 2869
af741c15
TI
2870 alc_auto_parse_customize_define(codec);
2871
7504b6cd
TI
2872 if (has_cdefine_beep(codec))
2873 spec->gen.beep_nid = 0x01;
2874
42399f7a
TI
2875 /* automatic parse from the BIOS config */
2876 err = alc262_parse_auto_config(codec);
2877 if (err < 0)
2878 goto error;
df694daa 2879
fea80fae
TI
2880 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2881 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2882 if (err < 0)
2883 goto error;
2884 }
2134ea4f 2885
1727a771 2886 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2887
1da177e4 2888 return 0;
e16fb6d1
TI
2889
2890 error:
2891 alc_free(codec);
2892 return err;
1da177e4
LT
2893}
2894
f32610ed 2895/*
1d045db9 2896 * ALC268
f32610ed 2897 */
1d045db9 2898/* bind Beep switches of both NID 0x0f and 0x10 */
a717777d
TI
2899static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2900 struct snd_ctl_elem_value *ucontrol)
2901{
2902 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2903 unsigned long pval;
2904 int err;
2905
2906 mutex_lock(&codec->control_mutex);
2907 pval = kcontrol->private_value;
2908 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2909 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2910 if (err >= 0) {
2911 kcontrol->private_value = (pval & ~0xff) | 0x10;
2912 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2913 }
2914 kcontrol->private_value = pval;
2915 mutex_unlock(&codec->control_mutex);
2916 return err;
2917}
f32610ed 2918
1d045db9
TI
2919static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2920 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
a717777d
TI
2921 {
2922 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2923 .name = "Beep Playback Switch",
2924 .subdevice = HDA_SUBDEV_AMP_FLAG,
2925 .info = snd_hda_mixer_amp_switch_info,
2926 .get = snd_hda_mixer_amp_switch_get,
2927 .put = alc268_beep_switch_put,
2928 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2929 },
f32610ed
JS
2930};
2931
1d045db9
TI
2932/* set PCBEEP vol = 0, mute connections */
2933static const struct hda_verb alc268_beep_init_verbs[] = {
2934 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2935 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2936 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2937 { }
f32610ed
JS
2938};
2939
6e72aa5f
TI
2940enum {
2941 ALC268_FIXUP_INV_DMIC,
cb766404 2942 ALC268_FIXUP_HP_EAPD,
24eff328 2943 ALC268_FIXUP_SPDIF,
6e72aa5f
TI
2944};
2945
1727a771 2946static const struct hda_fixup alc268_fixups[] = {
6e72aa5f 2947 [ALC268_FIXUP_INV_DMIC] = {
1727a771 2948 .type = HDA_FIXUP_FUNC,
9d36a7dc 2949 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2950 },
cb766404 2951 [ALC268_FIXUP_HP_EAPD] = {
1727a771 2952 .type = HDA_FIXUP_VERBS,
cb766404
TI
2953 .v.verbs = (const struct hda_verb[]) {
2954 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2955 {}
2956 }
2957 },
24eff328
TI
2958 [ALC268_FIXUP_SPDIF] = {
2959 .type = HDA_FIXUP_PINS,
2960 .v.pins = (const struct hda_pintbl[]) {
2961 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2962 {}
2963 }
2964 },
6e72aa5f
TI
2965};
2966
1727a771 2967static const struct hda_model_fixup alc268_fixup_models[] = {
6e72aa5f 2968 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
cb766404 2969 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
03bf11c9 2970 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
cb766404
TI
2971 {}
2972};
2973
2974static const struct snd_pci_quirk alc268_fixup_tbl[] = {
24eff328 2975 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
fcd8f3b1 2976 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
cb766404
TI
2977 /* below is codec SSID since multiple Toshiba laptops have the
2978 * same PCI SSID 1179:ff00
2979 */
2980 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
6e72aa5f
TI
2981 {}
2982};
2983
f32610ed
JS
2984/*
2985 * BIOS auto configuration
2986 */
1d045db9 2987static int alc268_parse_auto_config(struct hda_codec *codec)
f32610ed 2988{
3e6179b8 2989 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7504b6cd 2990 return alc_parse_auto_config(codec, NULL, alc268_ssids);
f32610ed
JS
2991}
2992
1d045db9
TI
2993/*
2994 */
1d045db9 2995static int patch_alc268(struct hda_codec *codec)
f32610ed
JS
2996{
2997 struct alc_spec *spec;
a5cb463a 2998 int i, err;
f32610ed 2999
1d045db9 3000 /* ALC268 has no aa-loopback mixer */
3de95173
TI
3001 err = alc_alloc_spec(codec, 0);
3002 if (err < 0)
3003 return err;
3004
3005 spec = codec->spec;
2722b535
TI
3006 if (has_cdefine_beep(codec))
3007 spec->gen.beep_nid = 0x01;
1f0f4b80 3008
225068ab
TI
3009 spec->shutup = alc_eapd_shutup;
3010
c9af753f
TI
3011 alc_pre_init(codec);
3012
1727a771
TI
3013 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3014 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6e72aa5f 3015
6ebb8053
TI
3016 /* automatic parse from the BIOS config */
3017 err = alc268_parse_auto_config(codec);
e16fb6d1
TI
3018 if (err < 0)
3019 goto error;
f32610ed 3020
7504b6cd
TI
3021 if (err > 0 && !spec->gen.no_analog &&
3022 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
a5cb463a
TI
3023 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3024 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3025 &alc268_beep_mixer[i])) {
3026 err = -ENOMEM;
3027 goto error;
3028 }
3029 }
7504b6cd 3030 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
1d045db9
TI
3031 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3032 /* override the amp caps for beep generator */
3033 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3034 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3035 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3036 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3037 (0 << AC_AMPCAP_MUTE_SHIFT));
2f893286
KY
3038 }
3039
1727a771 3040 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6e72aa5f 3041
f32610ed 3042 return 0;
e16fb6d1
TI
3043
3044 error:
3045 alc_free(codec);
3046 return err;
f32610ed
JS
3047}
3048
bc9f98a9 3049/*
1d045db9 3050 * ALC269
bc9f98a9 3051 */
08c189f2 3052
1d045db9 3053static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
1d045db9 3054 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9
KY
3055};
3056
1d045db9 3057static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
1d045db9 3058 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9 3059};
291702f0 3060
1d045db9
TI
3061/* different alc269-variants */
3062enum {
3063 ALC269_TYPE_ALC269VA,
3064 ALC269_TYPE_ALC269VB,
3065 ALC269_TYPE_ALC269VC,
adcc70b2 3066 ALC269_TYPE_ALC269VD,
065380f0
KY
3067 ALC269_TYPE_ALC280,
3068 ALC269_TYPE_ALC282,
2af02be7 3069 ALC269_TYPE_ALC283,
065380f0 3070 ALC269_TYPE_ALC284,
4731d5de 3071 ALC269_TYPE_ALC293,
7fc7d047 3072 ALC269_TYPE_ALC286,
506b62c3 3073 ALC269_TYPE_ALC298,
1d04c9de 3074 ALC269_TYPE_ALC255,
4344aec8 3075 ALC269_TYPE_ALC256,
f429e7e4 3076 ALC269_TYPE_ALC257,
0a6f0600 3077 ALC269_TYPE_ALC215,
4231430d 3078 ALC269_TYPE_ALC225,
99cee034 3079 ALC269_TYPE_ALC287,
dcd4f0db 3080 ALC269_TYPE_ALC294,
1078bef0 3081 ALC269_TYPE_ALC300,
f0778871 3082 ALC269_TYPE_ALC623,
6fbae35a 3083 ALC269_TYPE_ALC700,
bc9f98a9
KY
3084};
3085
3086/*
1d045db9 3087 * BIOS auto configuration
bc9f98a9 3088 */
1d045db9
TI
3089static int alc269_parse_auto_config(struct hda_codec *codec)
3090{
1d045db9 3091 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3e6179b8
TI
3092 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3093 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3094 struct alc_spec *spec = codec->spec;
adcc70b2
KY
3095 const hda_nid_t *ssids;
3096
3097 switch (spec->codec_variant) {
3098 case ALC269_TYPE_ALC269VA:
3099 case ALC269_TYPE_ALC269VC:
065380f0
KY
3100 case ALC269_TYPE_ALC280:
3101 case ALC269_TYPE_ALC284:
4731d5de 3102 case ALC269_TYPE_ALC293:
adcc70b2
KY
3103 ssids = alc269va_ssids;
3104 break;
3105 case ALC269_TYPE_ALC269VB:
3106 case ALC269_TYPE_ALC269VD:
065380f0 3107 case ALC269_TYPE_ALC282:
2af02be7 3108 case ALC269_TYPE_ALC283:
7fc7d047 3109 case ALC269_TYPE_ALC286:
506b62c3 3110 case ALC269_TYPE_ALC298:
1d04c9de 3111 case ALC269_TYPE_ALC255:
4344aec8 3112 case ALC269_TYPE_ALC256:
f429e7e4 3113 case ALC269_TYPE_ALC257:
0a6f0600 3114 case ALC269_TYPE_ALC215:
4231430d 3115 case ALC269_TYPE_ALC225:
99cee034 3116 case ALC269_TYPE_ALC287:
dcd4f0db 3117 case ALC269_TYPE_ALC294:
1078bef0 3118 case ALC269_TYPE_ALC300:
f0778871 3119 case ALC269_TYPE_ALC623:
6fbae35a 3120 case ALC269_TYPE_ALC700:
adcc70b2
KY
3121 ssids = alc269_ssids;
3122 break;
3123 default:
3124 ssids = alc269_ssids;
3125 break;
3126 }
bc9f98a9 3127
3e6179b8 3128 return alc_parse_auto_config(codec, alc269_ignore, ssids);
1d045db9 3129}
bc9f98a9 3130
476c02e0
HW
3131static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3132 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3133 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3134 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3135 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3136 {}
3137};
3138
3139static void alc_headset_btn_callback(struct hda_codec *codec,
3140 struct hda_jack_callback *jack)
3141{
3142 int report = 0;
3143
3144 if (jack->unsol_res & (7 << 13))
3145 report |= SND_JACK_BTN_0;
3146
3147 if (jack->unsol_res & (1 << 16 | 3 << 8))
3148 report |= SND_JACK_BTN_1;
3149
3150 /* Volume up key */
3151 if (jack->unsol_res & (7 << 23))
3152 report |= SND_JACK_BTN_2;
3153
3154 /* Volume down key */
3155 if (jack->unsol_res & (7 << 10))
3156 report |= SND_JACK_BTN_3;
3157
04f7791b 3158 snd_hda_jack_set_button_state(codec, jack->nid, report);
476c02e0
HW
3159}
3160
3161static void alc_disable_headset_jack_key(struct hda_codec *codec)
3162{
3163 struct alc_spec *spec = codec->spec;
3164
3165 if (!spec->has_hs_key)
3166 return;
3167
3168 switch (codec->core.vendor_id) {
3169 case 0x10ec0215:
3170 case 0x10ec0225:
3171 case 0x10ec0285:
c72b9bfe 3172 case 0x10ec0287:
476c02e0
HW
3173 case 0x10ec0295:
3174 case 0x10ec0289:
3175 case 0x10ec0299:
3176 alc_write_coef_idx(codec, 0x48, 0x0);
3177 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3178 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3179 break;
1948fc06 3180 case 0x10ec0230:
476c02e0
HW
3181 case 0x10ec0236:
3182 case 0x10ec0256:
3183 alc_write_coef_idx(codec, 0x48, 0x0);
3184 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3185 break;
3186 }
3187}
3188
3189static void alc_enable_headset_jack_key(struct hda_codec *codec)
3190{
3191 struct alc_spec *spec = codec->spec;
3192
3193 if (!spec->has_hs_key)
3194 return;
3195
3196 switch (codec->core.vendor_id) {
3197 case 0x10ec0215:
3198 case 0x10ec0225:
3199 case 0x10ec0285:
c72b9bfe 3200 case 0x10ec0287:
476c02e0
HW
3201 case 0x10ec0295:
3202 case 0x10ec0289:
3203 case 0x10ec0299:
3204 alc_write_coef_idx(codec, 0x48, 0xd011);
3205 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3206 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3207 break;
1948fc06 3208 case 0x10ec0230:
476c02e0
HW
3209 case 0x10ec0236:
3210 case 0x10ec0256:
3211 alc_write_coef_idx(codec, 0x48, 0xd011);
3212 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3213 break;
3214 }
3215}
3216
3217static void alc_fixup_headset_jack(struct hda_codec *codec,
3218 const struct hda_fixup *fix, int action)
3219{
3220 struct alc_spec *spec = codec->spec;
04f7791b 3221 hda_nid_t hp_pin;
476c02e0
HW
3222
3223 switch (action) {
3224 case HDA_FIXUP_ACT_PRE_PROBE:
3225 spec->has_hs_key = 1;
3226 snd_hda_jack_detect_enable_callback(codec, 0x55,
3227 alc_headset_btn_callback);
476c02e0 3228 break;
04f7791b
HW
3229 case HDA_FIXUP_ACT_BUILD:
3230 hp_pin = alc_get_hp_pin(spec);
3231 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3232 alc_headset_btn_keymap,
3233 hp_pin))
3234 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3235 false, SND_JACK_HEADSET,
3236 alc_headset_btn_keymap);
3237
476c02e0
HW
3238 alc_enable_headset_jack_key(codec);
3239 break;
3240 }
3241}
3242
1387e2d1 3243static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
1d045db9 3244{
98b24883 3245 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
1d045db9 3246}
291702f0 3247
1d045db9
TI
3248static void alc269_shutup(struct hda_codec *codec)
3249{
adcc70b2
KY
3250 struct alc_spec *spec = codec->spec;
3251
1387e2d1
KY
3252 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3253 alc269vb_toggle_power_output(codec, 0);
3254 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3255 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3256 msleep(150);
3257 }
c0ca5ece 3258 alc_shutup_pins(codec);
1d045db9 3259}
291702f0 3260
6b0f95c4 3261static const struct coef_fw alc282_coefs[] = {
54db6c39 3262 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
32fa7e49 3263 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3264 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3265 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3266 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3267 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3268 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3269 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3270 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3271 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3272 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3273 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3274 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3275 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3276 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3277 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3278 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3279 WRITE_COEF(0x63, 0x2902), /* PLL */
3280 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3281 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3282 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3283 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3284 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3285 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3286 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3287 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3288 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3289 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3290 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3291 {}
3292};
3293
cb149cb3
KY
3294static void alc282_restore_default_value(struct hda_codec *codec)
3295{
54db6c39 3296 alc_process_coef_fw(codec, alc282_coefs);
cb149cb3
KY
3297}
3298
7b5c7a02
KY
3299static void alc282_init(struct hda_codec *codec)
3300{
3301 struct alc_spec *spec = codec->spec;
35a39f98 3302 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3303 bool hp_pin_sense;
3304 int coef78;
3305
cb149cb3
KY
3306 alc282_restore_default_value(codec);
3307
7b5c7a02
KY
3308 if (!hp_pin)
3309 return;
3310 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3311 coef78 = alc_read_coef_idx(codec, 0x78);
3312
3313 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3314 /* Headphone capless set to high power mode */
3315 alc_write_coef_idx(codec, 0x78, 0x9004);
3316
3317 if (hp_pin_sense)
3318 msleep(2);
3319
3320 snd_hda_codec_write(codec, hp_pin, 0,
3321 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3322
3323 if (hp_pin_sense)
3324 msleep(85);
3325
3326 snd_hda_codec_write(codec, hp_pin, 0,
3327 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3328
3329 if (hp_pin_sense)
3330 msleep(100);
3331
3332 /* Headphone capless set to normal mode */
3333 alc_write_coef_idx(codec, 0x78, coef78);
3334}
3335
3336static void alc282_shutup(struct hda_codec *codec)
3337{
3338 struct alc_spec *spec = codec->spec;
35a39f98 3339 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3340 bool hp_pin_sense;
3341 int coef78;
3342
3343 if (!hp_pin) {
3344 alc269_shutup(codec);
3345 return;
3346 }
3347
3348 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3349 coef78 = alc_read_coef_idx(codec, 0x78);
3350 alc_write_coef_idx(codec, 0x78, 0x9004);
3351
3352 if (hp_pin_sense)
3353 msleep(2);
3354
3355 snd_hda_codec_write(codec, hp_pin, 0,
3356 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3357
3358 if (hp_pin_sense)
3359 msleep(85);
3360
c0ca5ece
TI
3361 if (!spec->no_shutup_pins)
3362 snd_hda_codec_write(codec, hp_pin, 0,
3363 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
7b5c7a02
KY
3364
3365 if (hp_pin_sense)
3366 msleep(100);
3367
3368 alc_auto_setup_eapd(codec, false);
c0ca5ece 3369 alc_shutup_pins(codec);
7b5c7a02
KY
3370 alc_write_coef_idx(codec, 0x78, coef78);
3371}
3372
6b0f95c4 3373static const struct coef_fw alc283_coefs[] = {
54db6c39 3374 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
56779864 3375 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3376 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3377 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3378 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3379 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3380 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3381 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3382 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3383 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3384 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3385 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3386 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3387 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3388 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3389 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3390 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3391 WRITE_COEF(0x2e, 0x2902), /* PLL */
3392 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3393 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3394 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3395 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3396 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3397 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3398 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3399 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3400 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3401 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3402 WRITE_COEF(0x49, 0x0), /* test mode */
3403 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3404 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3405 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
56779864 3406 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
54db6c39
TI
3407 {}
3408};
3409
6bd55b04
KY
3410static void alc283_restore_default_value(struct hda_codec *codec)
3411{
54db6c39 3412 alc_process_coef_fw(codec, alc283_coefs);
6bd55b04
KY
3413}
3414
2af02be7
KY
3415static void alc283_init(struct hda_codec *codec)
3416{
3417 struct alc_spec *spec = codec->spec;
35a39f98 3418 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3419 bool hp_pin_sense;
2af02be7 3420
6bd55b04
KY
3421 alc283_restore_default_value(codec);
3422
2af02be7
KY
3423 if (!hp_pin)
3424 return;
a59d7199
KY
3425
3426 msleep(30);
2af02be7
KY
3427 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3428
3429 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3430 /* Headphone capless set to high power mode */
3431 alc_write_coef_idx(codec, 0x43, 0x9004);
3432
3433 snd_hda_codec_write(codec, hp_pin, 0,
3434 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3435
3436 if (hp_pin_sense)
3437 msleep(85);
3438
3439 snd_hda_codec_write(codec, hp_pin, 0,
3440 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3441
3442 if (hp_pin_sense)
3443 msleep(85);
3444 /* Index 0x46 Combo jack auto switch control 2 */
3445 /* 3k pull low control for Headset jack. */
98b24883 3446 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2af02be7
KY
3447 /* Headphone capless set to normal mode */
3448 alc_write_coef_idx(codec, 0x43, 0x9614);
3449}
3450
3451static void alc283_shutup(struct hda_codec *codec)
3452{
3453 struct alc_spec *spec = codec->spec;
35a39f98 3454 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3455 bool hp_pin_sense;
2af02be7
KY
3456
3457 if (!hp_pin) {
3458 alc269_shutup(codec);
3459 return;
3460 }
3461
3462 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3463
3464 alc_write_coef_idx(codec, 0x43, 0x9004);
3465
b450b17c
HP
3466 /*depop hp during suspend*/
3467 alc_write_coef_idx(codec, 0x06, 0x2100);
3468
2af02be7
KY
3469 snd_hda_codec_write(codec, hp_pin, 0,
3470 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3471
3472 if (hp_pin_sense)
88011c09 3473 msleep(100);
2af02be7 3474
c0ca5ece
TI
3475 if (!spec->no_shutup_pins)
3476 snd_hda_codec_write(codec, hp_pin, 0,
3477 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2af02be7 3478
98b24883 3479 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2af02be7
KY
3480
3481 if (hp_pin_sense)
88011c09 3482 msleep(100);
0435b3ff 3483 alc_auto_setup_eapd(codec, false);
c0ca5ece 3484 alc_shutup_pins(codec);
2af02be7
KY
3485 alc_write_coef_idx(codec, 0x43, 0x9614);
3486}
3487
4a219ef8
KY
3488static void alc256_init(struct hda_codec *codec)
3489{
3490 struct alc_spec *spec = codec->spec;
35a39f98 3491 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3492 bool hp_pin_sense;
3493
3494 if (!hp_pin)
6447c962 3495 hp_pin = 0x21;
4a219ef8
KY
3496
3497 msleep(30);
3498
3499 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3500
3501 if (hp_pin_sense)
3502 msleep(2);
3503
3504 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
6447c962
KY
3505 if (spec->ultra_low_power) {
3506 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3507 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3508 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3509 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3510 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3511 msleep(30);
3512 }
4a219ef8
KY
3513
3514 snd_hda_codec_write(codec, hp_pin, 0,
3515 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3516
6447c962 3517 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3518 msleep(85);
3519
3520 snd_hda_codec_write(codec, hp_pin, 0,
3521 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3522
6447c962 3523 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3524 msleep(100);
3525
3526 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3527 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
88d42b2b
KY
3528 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3529 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
c4473744
TH
3530 /*
3531 * Expose headphone mic (or possibly Line In on some machines) instead
3532 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3533 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3534 * this register.
3535 */
3536 alc_write_coef_idx(codec, 0x36, 0x5757);
4a219ef8
KY
3537}
3538
3539static void alc256_shutup(struct hda_codec *codec)
3540{
3541 struct alc_spec *spec = codec->spec;
35a39f98 3542 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3543 bool hp_pin_sense;
3544
6447c962
KY
3545 if (!hp_pin)
3546 hp_pin = 0x21;
4a219ef8
KY
3547
3548 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3549
3550 if (hp_pin_sense)
3551 msleep(2);
3552
3553 snd_hda_codec_write(codec, hp_pin, 0,
3554 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3555
6447c962 3556 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3557 msleep(85);
3558
1c9609e3
TI
3559 /* 3k pull low control for Headset jack. */
3560 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3f742490
HW
3561 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3562 * when booting with headset plugged. So skip setting it for the codec alc257
3563 */
5aec9891
KY
3564 if (spec->codec_variant != ALC269_TYPE_ALC257 &&
3565 spec->codec_variant != ALC269_TYPE_ALC256)
3f742490 3566 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
1c9609e3 3567
c0ca5ece
TI
3568 if (!spec->no_shutup_pins)
3569 snd_hda_codec_write(codec, hp_pin, 0,
3570 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4a219ef8 3571
6447c962 3572 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3573 msleep(100);
3574
3575 alc_auto_setup_eapd(codec, false);
c0ca5ece 3576 alc_shutup_pins(codec);
6447c962
KY
3577 if (spec->ultra_low_power) {
3578 msleep(50);
3579 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3580 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3581 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3582 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3583 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3584 msleep(30);
3585 }
4a219ef8
KY
3586}
3587
3c24e483
KY
3588static void alc285_hp_init(struct hda_codec *codec)
3589{
3590 struct alc_spec *spec = codec->spec;
3591 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3592 int i, val;
3593 int coef38, coef0d, coef36;
3594
3595 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3596 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3597 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3598 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3599 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3600 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3601
3602 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3603
3604 if (hp_pin)
3605 snd_hda_codec_write(codec, hp_pin, 0,
3606 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3607
3608 msleep(130);
3609 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3610 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3611
3612 if (hp_pin)
3613 snd_hda_codec_write(codec, hp_pin, 0,
3614 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3615 msleep(10);
3616 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3617 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3618 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3619 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3620
3621 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3622 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3623 for (i = 0; i < 20 && val & 0x8000; i++) {
3624 msleep(50);
3625 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3626 } /* Wait for depop procedure finish */
3627
3628 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3629 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3630 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3631 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3632
3633 msleep(50);
3634 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3635}
3636
da911b1f
KY
3637static void alc225_init(struct hda_codec *codec)
3638{
3639 struct alc_spec *spec = codec->spec;
35a39f98 3640 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3641 bool hp1_pin_sense, hp2_pin_sense;
3642
3c24e483
KY
3643 if (spec->codec_variant != ALC269_TYPE_ALC287)
3644 /* required only at boot or S3 and S4 resume time */
3645 if (!spec->done_hp_init ||
3646 is_s3_resume(codec) ||
3647 is_s4_resume(codec)) {
3648 alc285_hp_init(codec);
3649 spec->done_hp_init = true;
3650 }
3651
da911b1f 3652 if (!hp_pin)
d3ba58bb 3653 hp_pin = 0x21;
da911b1f
KY
3654 msleep(30);
3655
3656 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3657 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3658
3659 if (hp1_pin_sense || hp2_pin_sense)
3660 msleep(2);
3661
3662 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
d3ba58bb
KY
3663 if (spec->ultra_low_power) {
3664 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3665 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3666 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3667 msleep(30);
3668 }
da911b1f 3669
d3ba58bb 3670 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3671 snd_hda_codec_write(codec, hp_pin, 0,
3672 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3673 if (hp2_pin_sense)
3674 snd_hda_codec_write(codec, 0x16, 0,
3675 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3676
d3ba58bb 3677 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3678 msleep(85);
3679
d3ba58bb 3680 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3681 snd_hda_codec_write(codec, hp_pin, 0,
3682 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3683 if (hp2_pin_sense)
3684 snd_hda_codec_write(codec, 0x16, 0,
3685 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3686
d3ba58bb 3687 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3688 msleep(100);
3689
3690 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3691 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3692}
3693
3694static void alc225_shutup(struct hda_codec *codec)
3695{
3696 struct alc_spec *spec = codec->spec;
35a39f98 3697 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3698 bool hp1_pin_sense, hp2_pin_sense;
3699
d3ba58bb
KY
3700 if (!hp_pin)
3701 hp_pin = 0x21;
476c02e0
HW
3702
3703 alc_disable_headset_jack_key(codec);
da911b1f
KY
3704 /* 3k pull low control for Headset jack. */
3705 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3706
3707 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3708 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3709
3710 if (hp1_pin_sense || hp2_pin_sense)
3711 msleep(2);
3712
d3ba58bb 3713 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3714 snd_hda_codec_write(codec, hp_pin, 0,
3715 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3716 if (hp2_pin_sense)
3717 snd_hda_codec_write(codec, 0x16, 0,
3718 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3719
d3ba58bb 3720 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3721 msleep(85);
3722
d3ba58bb 3723 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3724 snd_hda_codec_write(codec, hp_pin, 0,
3725 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3726 if (hp2_pin_sense)
3727 snd_hda_codec_write(codec, 0x16, 0,
3728 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3729
d3ba58bb 3730 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3731 msleep(100);
3732
3733 alc_auto_setup_eapd(codec, false);
c0ca5ece 3734 alc_shutup_pins(codec);
d3ba58bb
KY
3735 if (spec->ultra_low_power) {
3736 msleep(50);
3737 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3738 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3739 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3740 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3741 msleep(30);
3742 }
476c02e0
HW
3743
3744 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3745 alc_enable_headset_jack_key(codec);
da911b1f
KY
3746}
3747
c2d6af53
KY
3748static void alc_default_init(struct hda_codec *codec)
3749{
3750 struct alc_spec *spec = codec->spec;
35a39f98 3751 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3752 bool hp_pin_sense;
3753
3754 if (!hp_pin)
3755 return;
3756
3757 msleep(30);
3758
3759 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3760
3761 if (hp_pin_sense)
3762 msleep(2);
3763
3764 snd_hda_codec_write(codec, hp_pin, 0,
3765 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3766
3767 if (hp_pin_sense)
3768 msleep(85);
3769
3770 snd_hda_codec_write(codec, hp_pin, 0,
3771 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3772
3773 if (hp_pin_sense)
3774 msleep(100);
3775}
3776
3777static void alc_default_shutup(struct hda_codec *codec)
3778{
3779 struct alc_spec *spec = codec->spec;
35a39f98 3780 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3781 bool hp_pin_sense;
3782
3783 if (!hp_pin) {
3784 alc269_shutup(codec);
3785 return;
3786 }
3787
3788 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3789
3790 if (hp_pin_sense)
3791 msleep(2);
3792
3793 snd_hda_codec_write(codec, hp_pin, 0,
3794 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3795
3796 if (hp_pin_sense)
3797 msleep(85);
3798
c0ca5ece
TI
3799 if (!spec->no_shutup_pins)
3800 snd_hda_codec_write(codec, hp_pin, 0,
3801 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
c2d6af53
KY
3802
3803 if (hp_pin_sense)
3804 msleep(100);
3805
3806 alc_auto_setup_eapd(codec, false);
c0ca5ece 3807 alc_shutup_pins(codec);
c2d6af53
KY
3808}
3809
693abe11
KY
3810static void alc294_hp_init(struct hda_codec *codec)
3811{
3812 struct alc_spec *spec = codec->spec;
35a39f98 3813 hda_nid_t hp_pin = alc_get_hp_pin(spec);
693abe11
KY
3814 int i, val;
3815
3816 if (!hp_pin)
3817 return;
3818
3819 snd_hda_codec_write(codec, hp_pin, 0,
3820 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3821
3822 msleep(100);
3823
c0ca5ece
TI
3824 if (!spec->no_shutup_pins)
3825 snd_hda_codec_write(codec, hp_pin, 0,
3826 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
693abe11
KY
3827
3828 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3829 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3830
3831 /* Wait for depop procedure finish */
3832 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3833 for (i = 0; i < 20 && val & 0x0080; i++) {
3834 msleep(50);
3835 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3836 }
3837 /* Set HP depop to auto mode */
3838 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3839 msleep(50);
3840}
3841
3842static void alc294_init(struct hda_codec *codec)
3843{
3844 struct alc_spec *spec = codec->spec;
3845
f6ef4e0e
TI
3846 /* required only at boot or S4 resume time */
3847 if (!spec->done_hp_init ||
3848 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
693abe11
KY
3849 alc294_hp_init(codec);
3850 spec->done_hp_init = true;
3851 }
3852 alc_default_init(codec);
3853}
3854
ad60d502
KY
3855static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3856 unsigned int val)
3857{
3858 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3859 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3860 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3861}
3862
3863static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3864{
3865 unsigned int val;
3866
3867 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3868 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3869 & 0xffff;
3870 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3871 << 16;
3872 return val;
3873}
3874
3875static void alc5505_dsp_halt(struct hda_codec *codec)
3876{
3877 unsigned int val;
3878
3879 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3880 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3881 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3882 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3883 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3884 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3885 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3886 val = alc5505_coef_get(codec, 0x6220);
3887 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3888}
3889
3890static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3891{
3892 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3893 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3894 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3895 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3896 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3897 alc5505_coef_set(codec, 0x880c, 0x00000004);
3898}
3899
3900static void alc5505_dsp_init(struct hda_codec *codec)
3901{
3902 unsigned int val;
3903
3904 alc5505_dsp_halt(codec);
3905 alc5505_dsp_back_from_halt(codec);
3906 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3907 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3908 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3909 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3910 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3911 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3912 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3913 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3914 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3915 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3916 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3917 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3918 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3919
3920 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3921 if (val <= 3)
3922 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3923 else
3924 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3925
3926 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3927 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3928 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3929 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3930 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3931 alc5505_coef_set(codec, 0x880c, 0x00000003);
3932 alc5505_coef_set(codec, 0x880c, 0x00000010);
cd63a5ff
TI
3933
3934#ifdef HALT_REALTEK_ALC5505
3935 alc5505_dsp_halt(codec);
3936#endif
ad60d502
KY
3937}
3938
cd63a5ff 3939#ifdef HALT_REALTEK_ALC5505
8a71821f
PLB
3940#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3941#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
cd63a5ff
TI
3942#else
3943#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3944#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3945#endif
3946
2a43952a 3947#ifdef CONFIG_PM
ad60d502
KY
3948static int alc269_suspend(struct hda_codec *codec)
3949{
3950 struct alc_spec *spec = codec->spec;
3951
3952 if (spec->has_alc5505_dsp)
cd63a5ff 3953 alc5505_dsp_suspend(codec);
ad60d502
KY
3954 return alc_suspend(codec);
3955}
3956
1d045db9
TI
3957static int alc269_resume(struct hda_codec *codec)
3958{
adcc70b2
KY
3959 struct alc_spec *spec = codec->spec;
3960
1387e2d1
KY
3961 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3962 alc269vb_toggle_power_output(codec, 0);
3963 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3964 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3965 msleep(150);
3966 }
8c427226 3967
1d045db9 3968 codec->patch_ops.init(codec);
f1d4e28b 3969
1387e2d1
KY
3970 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3971 alc269vb_toggle_power_output(codec, 1);
3972 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3973 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9
TI
3974 msleep(200);
3975 }
f1d4e28b 3976
1a462be5 3977 snd_hda_regmap_sync(codec);
1d045db9 3978 hda_call_check_power_status(codec, 0x01);
f475371a
HW
3979
3980 /* on some machine, the BIOS will clear the codec gpio data when enter
3981 * suspend, and won't restore the data after resume, so we restore it
3982 * in the driver.
3983 */
d261eec8
TI
3984 if (spec->gpio_data)
3985 alc_write_gpio_data(codec);
f475371a 3986
ad60d502 3987 if (spec->has_alc5505_dsp)
cd63a5ff 3988 alc5505_dsp_resume(codec);
c5177c86 3989
1d045db9
TI
3990 return 0;
3991}
2a43952a 3992#endif /* CONFIG_PM */
f1d4e28b 3993
108cc108 3994static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
1727a771 3995 const struct hda_fixup *fix, int action)
108cc108
DH
3996{
3997 struct alc_spec *spec = codec->spec;
3998
1727a771 3999 if (action == HDA_FIXUP_ACT_PRE_PROBE)
108cc108
DH
4000 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4001}
4002
fdcc968a
JMG
4003static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4004 const struct hda_fixup *fix,
4005 int action)
4006{
4007 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4008 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4009
4010 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4011 snd_hda_codec_set_pincfg(codec, 0x19,
4012 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4013 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4014}
4015
1d045db9 4016static void alc269_fixup_hweq(struct hda_codec *codec,
1727a771 4017 const struct hda_fixup *fix, int action)
1d045db9 4018{
98b24883
TI
4019 if (action == HDA_FIXUP_ACT_INIT)
4020 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
1d045db9 4021}
f1d4e28b 4022
7c478f03
DH
4023static void alc269_fixup_headset_mic(struct hda_codec *codec,
4024 const struct hda_fixup *fix, int action)
4025{
4026 struct alc_spec *spec = codec->spec;
4027
4028 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4029 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4030}
4031
1d045db9 4032static void alc271_fixup_dmic(struct hda_codec *codec,
1727a771 4033 const struct hda_fixup *fix, int action)
1d045db9
TI
4034{
4035 static const struct hda_verb verbs[] = {
4036 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4037 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4038 {}
4039 };
4040 unsigned int cfg;
f1d4e28b 4041
7639a06c
TI
4042 if (strcmp(codec->core.chip_name, "ALC271X") &&
4043 strcmp(codec->core.chip_name, "ALC269VB"))
1d045db9
TI
4044 return;
4045 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4046 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4047 snd_hda_sequence_write(codec, verbs);
4048}
f1d4e28b 4049
c8426b27
TI
4050/* Fix the speaker amp after resume, etc */
4051static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4052 const struct hda_fixup *fix,
4053 int action)
4054{
4055 if (action == HDA_FIXUP_ACT_INIT)
4056 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4057}
4058
017f2a10 4059static void alc269_fixup_pcm_44k(struct hda_codec *codec,
1727a771 4060 const struct hda_fixup *fix, int action)
017f2a10
TI
4061{
4062 struct alc_spec *spec = codec->spec;
4063
1727a771 4064 if (action != HDA_FIXUP_ACT_PROBE)
017f2a10
TI
4065 return;
4066
4067 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4068 * fix the sample rate of analog I/O to 44.1kHz
4069 */
08c189f2
TI
4070 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4071 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
017f2a10
TI
4072}
4073
adabb3ec 4074static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
1727a771 4075 const struct hda_fixup *fix, int action)
adabb3ec 4076{
adabb3ec
TI
4077 /* The digital-mic unit sends PDM (differential signal) instead of
4078 * the standard PCM, thus you can't record a valid mono stream as is.
4079 * Below is a workaround specific to ALC269 to control the dmic
4080 * signal source as mono.
4081 */
98b24883
TI
4082 if (action == HDA_FIXUP_ACT_INIT)
4083 alc_update_coef_idx(codec, 0x07, 0, 0x80);
adabb3ec
TI
4084}
4085
24519911
TI
4086static void alc269_quanta_automute(struct hda_codec *codec)
4087{
08c189f2 4088 snd_hda_gen_update_outputs(codec);
24519911 4089
1687ccc8
TI
4090 alc_write_coef_idx(codec, 0x0c, 0x680);
4091 alc_write_coef_idx(codec, 0x0c, 0x480);
24519911
TI
4092}
4093
4094static void alc269_fixup_quanta_mute(struct hda_codec *codec,
1727a771 4095 const struct hda_fixup *fix, int action)
24519911
TI
4096{
4097 struct alc_spec *spec = codec->spec;
1727a771 4098 if (action != HDA_FIXUP_ACT_PROBE)
24519911 4099 return;
08c189f2 4100 spec->gen.automute_hook = alc269_quanta_automute;
24519911
TI
4101}
4102
d240d1dc 4103static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 4104 struct hda_jack_callback *jack)
d240d1dc
DH
4105{
4106 struct alc_spec *spec = codec->spec;
4107 int vref;
4108 msleep(200);
4109 snd_hda_gen_hp_automute(codec, jack);
4110
4111 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4112 msleep(100);
4113 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4114 vref);
4115 msleep(500);
4116 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4117 vref);
4118}
4119
a2ef03fe
TE
4120/*
4121 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4122 */
4123struct hda_alc298_mbxinit {
4124 unsigned char value_0x23;
4125 unsigned char value_0x25;
4126};
4127
4128static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4129 const struct hda_alc298_mbxinit *initval,
4130 bool first)
4131{
4132 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4133 alc_write_coef_idx(codec, 0x26, 0xb000);
4134
4135 if (first)
4136 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4137
4138 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4139 alc_write_coef_idx(codec, 0x26, 0xf000);
4140 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4141
4142 if (initval->value_0x23 != 0x1e)
4143 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4144
4145 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4146 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4147}
4148
4149static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4150 const struct hda_fixup *fix,
4151 int action)
4152{
4153 /* Initialization magic */
4154 static const struct hda_alc298_mbxinit dac_init[] = {
4155 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4156 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4157 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4158 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4159 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4160 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4161 {0x2f, 0x00},
4162 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4163 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4164 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4165 {}
4166 };
4167 const struct hda_alc298_mbxinit *seq;
4168
4169 if (action != HDA_FIXUP_ACT_INIT)
4170 return;
4171
4172 /* Start */
4173 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4174 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4175 alc_write_coef_idx(codec, 0x26, 0xf000);
4176 alc_write_coef_idx(codec, 0x22, 0x31);
4177 alc_write_coef_idx(codec, 0x23, 0x0b);
4178 alc_write_coef_idx(codec, 0x25, 0x00);
4179 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4180 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4181
4182 for (seq = dac_init; seq->value_0x23; seq++)
4183 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4184}
4185
d240d1dc
DH
4186static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4187 const struct hda_fixup *fix, int action)
4188{
4189 struct alc_spec *spec = codec->spec;
4190 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4191 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4192 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4193 }
4194}
4195
766538ac
TI
4196static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4197 bool polarity, bool on)
4198{
4199 unsigned int pinval;
4200
4201 if (!pin)
4202 return;
4203 if (polarity)
4204 on = !on;
4205 pinval = snd_hda_codec_get_pin_target(codec, pin);
4206 pinval &= ~AC_PINCTL_VREFEN;
4207 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4208 /* temporarily power up/down for setting VREF */
4209 snd_hda_power_up_pm(codec);
4210 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4211 snd_hda_power_down_pm(codec);
4212}
d240d1dc 4213
08fb0d0e 4214/* update mute-LED according to the speaker mute state via mic VREF pin */
8d3d1ece
TI
4215static int vref_mute_led_set(struct led_classdev *led_cdev,
4216 enum led_brightness brightness)
6d3cd5d4 4217{
8d3d1ece 4218 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
08fb0d0e 4219 struct alc_spec *spec = codec->spec;
08fb0d0e 4220
766538ac
TI
4221 alc_update_vref_led(codec, spec->mute_led_nid,
4222 spec->mute_led_polarity, brightness);
8d3d1ece 4223 return 0;
6d3cd5d4
DH
4224}
4225
d5b6b65e
DH
4226/* Make sure the led works even in runtime suspend */
4227static unsigned int led_power_filter(struct hda_codec *codec,
4228 hda_nid_t nid,
4229 unsigned int power_state)
4230{
4231 struct alc_spec *spec = codec->spec;
4232
50dd9050
HW
4233 if (power_state != AC_PWRST_D3 || nid == 0 ||
4234 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
d5b6b65e
DH
4235 return power_state;
4236
4237 /* Set pin ctl again, it might have just been set to 0 */
4238 snd_hda_set_pin_ctl(codec, nid,
4239 snd_hda_codec_get_pin_target(codec, nid));
4240
cffd3966 4241 return snd_hda_gen_path_power_filter(codec, nid, power_state);
d5b6b65e
DH
4242}
4243
08fb0d0e
TI
4244static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4245 const struct hda_fixup *fix, int action)
6d3cd5d4
DH
4246{
4247 struct alc_spec *spec = codec->spec;
08fb0d0e
TI
4248 const struct dmi_device *dev = NULL;
4249
4250 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4251 return;
4252
4253 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4254 int pol, pin;
4255 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4256 continue;
4257 if (pin < 0x0a || pin >= 0x10)
4258 break;
4259 spec->mute_led_polarity = pol;
4260 spec->mute_led_nid = pin - 0x0a + 0x18;
8d3d1ece 4261 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4262 codec->power_filter = led_power_filter;
4e76a883
TI
4263 codec_dbg(codec,
4264 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
08fb0d0e 4265 spec->mute_led_polarity);
6d3cd5d4
DH
4266 break;
4267 }
4268}
4269
85c467dc
TI
4270static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4271 const struct hda_fixup *fix,
4272 int action, hda_nid_t pin)
d06ac143
DH
4273{
4274 struct alc_spec *spec = codec->spec;
85c467dc 4275
d06ac143
DH
4276 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4277 spec->mute_led_polarity = 0;
85c467dc 4278 spec->mute_led_nid = pin;
8d3d1ece 4279 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4280 codec->power_filter = led_power_filter;
d06ac143
DH
4281 }
4282}
4283
85c467dc
TI
4284static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4285 const struct hda_fixup *fix, int action)
4286{
4287 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4288}
4289
08fb0d0e
TI
4290static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4291 const struct hda_fixup *fix, int action)
420b0feb 4292{
85c467dc 4293 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
420b0feb
TI
4294}
4295
7f783bd5
TB
4296static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4297 const struct hda_fixup *fix, int action)
4298{
85c467dc 4299 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
7f783bd5
TB
4300}
4301
0f32fd19
TI
4302/* update LED status via GPIO */
4303static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
dbd13179 4304 int polarity, bool enabled)
9f5c6faf 4305{
dbd13179 4306 if (polarity)
0f32fd19 4307 enabled = !enabled;
d261eec8 4308 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
9f5c6faf
TI
4309}
4310
0f32fd19 4311/* turn on/off mute LED via GPIO per vmaster hook */
8d3d1ece
TI
4312static int gpio_mute_led_set(struct led_classdev *led_cdev,
4313 enum led_brightness brightness)
9f5c6faf 4314{
8d3d1ece 4315 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9f5c6faf 4316 struct alc_spec *spec = codec->spec;
9f5c6faf 4317
dbd13179 4318 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
8d3d1ece
TI
4319 spec->mute_led_polarity, !brightness);
4320 return 0;
0f32fd19 4321}
9f5c6faf 4322
0f32fd19 4323/* turn on/off mic-mute LED via GPIO per capture hook */
87dc3648
KHF
4324static int micmute_led_set(struct led_classdev *led_cdev,
4325 enum led_brightness brightness)
4326{
4327 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4328 struct alc_spec *spec = codec->spec;
4329
4330 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
40469064 4331 spec->micmute_led_polarity, !brightness);
87dc3648
KHF
4332 return 0;
4333}
4334
01e4a275
TI
4335/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4336static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4337 int action,
4338 unsigned int mute_mask,
4339 unsigned int micmute_mask)
9f5c6faf
TI
4340{
4341 struct alc_spec *spec = codec->spec;
9f5c6faf 4342
01e4a275
TI
4343 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4344
4345 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4346 return;
4347 if (mute_mask) {
4348 spec->gpio_mute_led_mask = mute_mask;
8d3d1ece 4349 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
01e4a275
TI
4350 }
4351 if (micmute_mask) {
4352 spec->gpio_mic_led_mask = micmute_mask;
7cdf8c49 4353 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
9f5c6faf
TI
4354 }
4355}
4356
e7d66cf7
JS
4357static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4358 const struct hda_fixup *fix, int action)
4359{
4360 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4361}
4362
01e4a275 4363static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
eaa8e5ef
KY
4364 const struct hda_fixup *fix, int action)
4365{
01e4a275
TI
4366 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4367}
eaa8e5ef 4368
f5a88b0a
KHF
4369static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4370 const struct hda_fixup *fix, int action)
4371{
3e0650ab 4372 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
f5a88b0a
KHF
4373}
4374
01e4a275
TI
4375static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4376 const struct hda_fixup *fix, int action)
4377{
4378 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
9f5c6faf
TI
4379}
4380
a0ccbc53
KY
4381static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4382 const struct hda_fixup *fix, int action)
4383{
4384 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4385}
4386
c47b3112
JC
4387static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4388 const struct hda_fixup *fix, int action)
4389{
4390 struct alc_spec *spec = codec->spec;
4391
4392 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4393 spec->micmute_led_polarity = 1;
4394 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4395}
4396
8a503555
TI
4397/* turn on/off mic-mute LED per capture hook via VREF change */
4398static int vref_micmute_led_set(struct led_classdev *led_cdev,
4399 enum led_brightness brightness)
9c5dc3bf 4400{
8a503555 4401 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9c5dc3bf 4402 struct alc_spec *spec = codec->spec;
9c5dc3bf 4403
766538ac
TI
4404 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4405 spec->micmute_led_polarity, brightness);
8a503555 4406 return 0;
9c5dc3bf
KY
4407}
4408
4409static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4410 const struct hda_fixup *fix, int action)
4411{
4412 struct alc_spec *spec = codec->spec;
9c5dc3bf 4413
01e4a275 4414 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
9c5dc3bf 4415 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
4416 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4417 * enable headphone amp
4418 */
4419 spec->gpio_mask |= 0x10;
4420 spec->gpio_dir |= 0x10;
9c5dc3bf 4421 spec->cap_mute_led_nid = 0x18;
8a503555 4422 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
50dd9050 4423 codec->power_filter = led_power_filter;
9c5dc3bf
KY
4424 }
4425}
4426
7a5255f1
DH
4427static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4428 const struct hda_fixup *fix, int action)
4429{
7a5255f1 4430 struct alc_spec *spec = codec->spec;
7a5255f1 4431
01e4a275 4432 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
7a5255f1 4433 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7a5255f1 4434 spec->cap_mute_led_nid = 0x18;
8a503555 4435 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
7a5255f1
DH
4436 codec->power_filter = led_power_filter;
4437 }
4438}
4439
c3bb2b52
TI
4440/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4441 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4442 */
4443static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4444 const struct hda_fixup *fix, int action)
4445{
4446 struct alc_spec *spec = codec->spec;
4447
4448 switch (action) {
4449 case HDA_FIXUP_ACT_PRE_PROBE:
4450 spec->gpio_mask |= 0x01;
4451 spec->gpio_dir |= 0x01;
4452 break;
4453 case HDA_FIXUP_ACT_INIT:
4454 /* need to toggle GPIO to enable the amp */
4455 alc_update_gpio_data(codec, 0x01, true);
4456 msleep(100);
4457 alc_update_gpio_data(codec, 0x01, false);
4458 break;
4459 }
4460}
4461
622464c8
TI
4462/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4463static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4464 struct hda_codec *codec,
4465 struct snd_pcm_substream *substream,
4466 int action)
4467{
4468 switch (action) {
4469 case HDA_GEN_PCM_ACT_PREPARE:
4470 alc_update_gpio_data(codec, 0x04, true);
4471 break;
4472 case HDA_GEN_PCM_ACT_CLEANUP:
4473 alc_update_gpio_data(codec, 0x04, false);
4474 break;
4475 }
4476}
4477
4478static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4479 const struct hda_fixup *fix,
4480 int action)
4481{
4482 struct alc_spec *spec = codec->spec;
4483
4484 if (action == HDA_FIXUP_ACT_PROBE) {
4485 spec->gpio_mask |= 0x04;
4486 spec->gpio_dir |= 0x04;
4487 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4488 }
4489}
4490
766538ac
TI
4491static void alc_update_coef_led(struct hda_codec *codec,
4492 struct alc_coef_led *led,
4493 bool polarity, bool on)
4494{
4495 if (polarity)
4496 on = !on;
4497 /* temporarily power up/down for setting COEF bit */
4498 alc_update_coef_idx(codec, led->idx, led->mask,
4499 on ? led->on : led->off);
4500}
4501
431e76c3 4502/* update mute-LED according to the speaker mute state via COEF bit */
8d3d1ece
TI
4503static int coef_mute_led_set(struct led_classdev *led_cdev,
4504 enum led_brightness brightness)
431e76c3 4505{
8d3d1ece 4506 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4507 struct alc_spec *spec = codec->spec;
4508
766538ac
TI
4509 alc_update_coef_led(codec, &spec->mute_led_coef,
4510 spec->mute_led_polarity, brightness);
8d3d1ece 4511 return 0;
431e76c3
KY
4512}
4513
4514static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4515 const struct hda_fixup *fix,
4516 int action)
4517{
4518 struct alc_spec *spec = codec->spec;
4519
4520 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4521 spec->mute_led_polarity = 0;
766538ac
TI
4522 spec->mute_led_coef.idx = 0x0b;
4523 spec->mute_led_coef.mask = 1 << 3;
4524 spec->mute_led_coef.on = 1 << 3;
4525 spec->mute_led_coef.off = 0;
8d3d1ece 4526 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
431e76c3
KY
4527 }
4528}
4529
24164f43
KY
4530static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4531 const struct hda_fixup *fix,
4532 int action)
4533{
4534 struct alc_spec *spec = codec->spec;
4535
4536 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4537 spec->mute_led_polarity = 0;
766538ac
TI
4538 spec->mute_led_coef.idx = 0x34;
4539 spec->mute_led_coef.mask = 1 << 5;
4540 spec->mute_led_coef.on = 0;
4541 spec->mute_led_coef.off = 1 << 5;
8d3d1ece 4542 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
24164f43
KY
4543 }
4544}
4545
431e76c3 4546/* turn on/off mic-mute LED per capture hook by coef bit */
8a503555
TI
4547static int coef_micmute_led_set(struct led_classdev *led_cdev,
4548 enum led_brightness brightness)
431e76c3 4549{
8a503555 4550 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4551 struct alc_spec *spec = codec->spec;
4552
766538ac
TI
4553 alc_update_coef_led(codec, &spec->mic_led_coef,
4554 spec->micmute_led_polarity, brightness);
8a503555 4555 return 0;
431e76c3
KY
4556}
4557
4558static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4559 const struct hda_fixup *fix, int action)
4560{
4561 struct alc_spec *spec = codec->spec;
4562
4563 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4564 spec->mic_led_coef.idx = 0x19;
4565 spec->mic_led_coef.mask = 1 << 13;
4566 spec->mic_led_coef.on = 1 << 13;
4567 spec->mic_led_coef.off = 0;
8a503555 4568 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
431e76c3
KY
4569 }
4570}
4571
24164f43
KY
4572static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4573 const struct hda_fixup *fix, int action)
4574{
4575 struct alc_spec *spec = codec->spec;
4576
4577 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4578 spec->mic_led_coef.idx = 0x35;
4579 spec->mic_led_coef.mask = 3 << 2;
4580 spec->mic_led_coef.on = 2 << 2;
4581 spec->mic_led_coef.off = 1 << 2;
8a503555 4582 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
24164f43
KY
4583 }
4584}
4585
431e76c3
KY
4586static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4587 const struct hda_fixup *fix, int action)
4588{
4589 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4590 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4591}
4592
24164f43
KY
4593static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4594 const struct hda_fixup *fix, int action)
4595{
4596 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4597 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4598}
4599
75b62ab6
JW
4600static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4601 const struct hda_fixup *fix, int action)
4602{
4603 struct alc_spec *spec = codec->spec;
4604
4605 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4606 spec->cap_mute_led_nid = 0x1a;
4607 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4608 codec->power_filter = led_power_filter;
4609 }
4610}
4611
4612static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4613 const struct hda_fixup *fix, int action)
4614{
4615 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4616 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4617}
4618
6a30abaa 4619#if IS_REACHABLE(CONFIG_INPUT)
33f4acd3
DH
4620static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4621 struct hda_jack_callback *event)
4622{
4623 struct alc_spec *spec = codec->spec;
4624
4625 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4626 send both key on and key off event for every interrupt. */
c7b60a89 4627 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
33f4acd3 4628 input_sync(spec->kb_dev);
c7b60a89 4629 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
33f4acd3
DH
4630 input_sync(spec->kb_dev);
4631}
33f4acd3 4632
3694cb29
K
4633static int alc_register_micmute_input_device(struct hda_codec *codec)
4634{
4635 struct alc_spec *spec = codec->spec;
c7b60a89 4636 int i;
3694cb29
K
4637
4638 spec->kb_dev = input_allocate_device();
4639 if (!spec->kb_dev) {
4640 codec_err(codec, "Out of memory (input_allocate_device)\n");
4641 return -ENOMEM;
4642 }
c7b60a89
HW
4643
4644 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4645
3694cb29
K
4646 spec->kb_dev->name = "Microphone Mute Button";
4647 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
c7b60a89
HW
4648 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4649 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4650 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4651 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4652 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3694cb29
K
4653
4654 if (input_register_device(spec->kb_dev)) {
4655 codec_err(codec, "input_register_device failed\n");
4656 input_free_device(spec->kb_dev);
4657 spec->kb_dev = NULL;
4658 return -ENOMEM;
4659 }
4660
4661 return 0;
4662}
4663
01e4a275
TI
4664/* GPIO1 = set according to SKU external amp
4665 * GPIO2 = mic mute hotkey
4666 * GPIO3 = mute LED
4667 * GPIO4 = mic mute LED
4668 */
33f4acd3
DH
4669static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4670 const struct hda_fixup *fix, int action)
4671{
33f4acd3
DH
4672 struct alc_spec *spec = codec->spec;
4673
01e4a275 4674 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
33f4acd3 4675 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4676 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29 4677 if (alc_register_micmute_input_device(codec) != 0)
33f4acd3 4678 return;
33f4acd3 4679
01e4a275
TI
4680 spec->gpio_mask |= 0x06;
4681 spec->gpio_dir |= 0x02;
4682 spec->gpio_data |= 0x02;
7639a06c 4683 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
33f4acd3 4684 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
7639a06c 4685 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
33f4acd3 4686 gpio2_mic_hotkey_event);
33f4acd3
DH
4687 return;
4688 }
4689
4690 if (!spec->kb_dev)
4691 return;
4692
4693 switch (action) {
33f4acd3
DH
4694 case HDA_FIXUP_ACT_FREE:
4695 input_unregister_device(spec->kb_dev);
33f4acd3
DH
4696 spec->kb_dev = NULL;
4697 }
33f4acd3
DH
4698}
4699
01e4a275
TI
4700/* Line2 = mic mute hotkey
4701 * GPIO2 = mic mute LED
4702 */
3694cb29
K
4703static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4704 const struct hda_fixup *fix, int action)
4705{
3694cb29
K
4706 struct alc_spec *spec = codec->spec;
4707
01e4a275 4708 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
3694cb29 4709 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4710 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29
K
4711 if (alc_register_micmute_input_device(codec) != 0)
4712 return;
4713
3694cb29
K
4714 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4715 gpio2_mic_hotkey_event);
3694cb29
K
4716 return;
4717 }
4718
4719 if (!spec->kb_dev)
4720 return;
4721
4722 switch (action) {
3694cb29
K
4723 case HDA_FIXUP_ACT_FREE:
4724 input_unregister_device(spec->kb_dev);
4725 spec->kb_dev = NULL;
4726 }
4727}
c469652b
TI
4728#else /* INPUT */
4729#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4730#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4731#endif /* INPUT */
3694cb29 4732
9c5dc3bf
KY
4733static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4734 const struct hda_fixup *fix, int action)
4735{
4736 struct alc_spec *spec = codec->spec;
4737
1bce62a6 4738 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
9c5dc3bf 4739 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9c5dc3bf 4740 spec->cap_mute_led_nid = 0x18;
8a503555 4741 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
9c5dc3bf
KY
4742 }
4743}
4744
6b0f95c4 4745static const struct coef_fw alc225_pre_hsmode[] = {
5a36767a
KY
4746 UPDATE_COEF(0x4a, 1<<8, 0),
4747 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4748 UPDATE_COEF(0x63, 3<<14, 3<<14),
4749 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4750 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4751 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4752 UPDATE_COEF(0x4a, 3<<10, 0),
4753 {}
4754};
4755
73bdd597
DH
4756static void alc_headset_mode_unplugged(struct hda_codec *codec)
4757{
92666d45 4758 struct alc_spec *spec = codec->spec;
6b0f95c4 4759 static const struct coef_fw coef0255[] = {
717f43d8 4760 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
54db6c39
TI
4761 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4762 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4763 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4764 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4765 {}
4766 };
6b0f95c4 4767 static const struct coef_fw coef0256[] = {
e69e7e03 4768 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
717f43d8
KY
4769 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4770 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4771 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4772 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
e69e7e03
KY
4773 {}
4774 };
6b0f95c4 4775 static const struct coef_fw coef0233[] = {
54db6c39
TI
4776 WRITE_COEF(0x1b, 0x0c0b),
4777 WRITE_COEF(0x45, 0xc429),
4778 UPDATE_COEF(0x35, 0x4000, 0),
4779 WRITE_COEF(0x06, 0x2104),
4780 WRITE_COEF(0x1a, 0x0001),
4781 WRITE_COEF(0x26, 0x0004),
4782 WRITE_COEF(0x32, 0x42a3),
4783 {}
4784 };
6b0f95c4 4785 static const struct coef_fw coef0288[] = {
f3b70332
KY
4786 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4787 UPDATE_COEF(0x50, 0x2000, 0x2000),
4788 UPDATE_COEF(0x56, 0x0006, 0x0006),
4789 UPDATE_COEF(0x66, 0x0008, 0),
4790 UPDATE_COEF(0x67, 0x2000, 0),
4791 {}
4792 };
6b0f95c4 4793 static const struct coef_fw coef0298[] = {
89542936
KY
4794 UPDATE_COEF(0x19, 0x1300, 0x0300),
4795 {}
4796 };
6b0f95c4 4797 static const struct coef_fw coef0292[] = {
54db6c39
TI
4798 WRITE_COEF(0x76, 0x000e),
4799 WRITE_COEF(0x6c, 0x2400),
4800 WRITE_COEF(0x18, 0x7308),
4801 WRITE_COEF(0x6b, 0xc429),
4802 {}
4803 };
6b0f95c4 4804 static const struct coef_fw coef0293[] = {
54db6c39
TI
4805 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4806 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4807 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4808 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4809 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4810 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4811 {}
4812 };
6b0f95c4 4813 static const struct coef_fw coef0668[] = {
54db6c39
TI
4814 WRITE_COEF(0x15, 0x0d40),
4815 WRITE_COEF(0xb7, 0x802b),
4816 {}
4817 };
6b0f95c4 4818 static const struct coef_fw coef0225[] = {
5a36767a 4819 UPDATE_COEF(0x63, 3<<14, 0),
4cc9b9d6
KY
4820 {}
4821 };
6b0f95c4 4822 static const struct coef_fw coef0274[] = {
71683c32
KY
4823 UPDATE_COEF(0x4a, 0x0100, 0),
4824 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4825 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4826 UPDATE_COEF(0x4a, 0x0010, 0),
4827 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4828 WRITE_COEF(0x45, 0x5289),
4829 UPDATE_COEF(0x4a, 0x0c00, 0),
4830 {}
4831 };
54db6c39 4832
92666d45
KY
4833 if (spec->no_internal_mic_pin) {
4834 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4835 return;
4836 }
4837
7639a06c 4838 switch (codec->core.vendor_id) {
9a22a8f5 4839 case 0x10ec0255:
e69e7e03
KY
4840 alc_process_coef_fw(codec, coef0255);
4841 break;
1948fc06 4842 case 0x10ec0230:
736f20a7 4843 case 0x10ec0236:
7081adf3 4844 case 0x10ec0256:
e69e7e03 4845 alc_process_coef_fw(codec, coef0256);
9a22a8f5 4846 break;
71683c32
KY
4847 case 0x10ec0234:
4848 case 0x10ec0274:
4849 case 0x10ec0294:
4850 alc_process_coef_fw(codec, coef0274);
4851 break;
13fd08a3 4852 case 0x10ec0233:
73bdd597 4853 case 0x10ec0283:
54db6c39 4854 alc_process_coef_fw(codec, coef0233);
73bdd597 4855 break;
f3b70332
KY
4856 case 0x10ec0286:
4857 case 0x10ec0288:
89542936
KY
4858 alc_process_coef_fw(codec, coef0288);
4859 break;
1a5bc8d9 4860 case 0x10ec0298:
89542936 4861 alc_process_coef_fw(codec, coef0298);
f3b70332
KY
4862 alc_process_coef_fw(codec, coef0288);
4863 break;
73bdd597 4864 case 0x10ec0292:
54db6c39 4865 alc_process_coef_fw(codec, coef0292);
73bdd597 4866 break;
a22aa26f 4867 case 0x10ec0293:
54db6c39 4868 alc_process_coef_fw(codec, coef0293);
a22aa26f 4869 break;
73bdd597 4870 case 0x10ec0668:
54db6c39 4871 alc_process_coef_fw(codec, coef0668);
73bdd597 4872 break;
c2b691ee 4873 case 0x10ec0215:
4cc9b9d6 4874 case 0x10ec0225:
c2b691ee 4875 case 0x10ec0285:
7d727869 4876 case 0x10ec0295:
c2b691ee 4877 case 0x10ec0289:
28f1f9b2 4878 case 0x10ec0299:
4d4b0c52 4879 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4880 alc_process_coef_fw(codec, coef0225);
4881 break;
78f4f7c2
KY
4882 case 0x10ec0867:
4883 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4884 break;
73bdd597 4885 }
4e76a883 4886 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
73bdd597
DH
4887}
4888
4889
4890static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4891 hda_nid_t mic_pin)
4892{
6b0f95c4 4893 static const struct coef_fw coef0255[] = {
54db6c39
TI
4894 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4895 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4896 {}
4897 };
6b0f95c4 4898 static const struct coef_fw coef0256[] = {
717f43d8
KY
4899 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4900 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4901 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4902 {}
4903 };
6b0f95c4 4904 static const struct coef_fw coef0233[] = {
54db6c39
TI
4905 UPDATE_COEF(0x35, 0, 1<<14),
4906 WRITE_COEF(0x06, 0x2100),
4907 WRITE_COEF(0x1a, 0x0021),
4908 WRITE_COEF(0x26, 0x008c),
4909 {}
4910 };
6b0f95c4 4911 static const struct coef_fw coef0288[] = {
89542936 4912 UPDATE_COEF(0x4f, 0x00c0, 0),
f3b70332
KY
4913 UPDATE_COEF(0x50, 0x2000, 0),
4914 UPDATE_COEF(0x56, 0x0006, 0),
4915 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4916 UPDATE_COEF(0x66, 0x0008, 0x0008),
4917 UPDATE_COEF(0x67, 0x2000, 0x2000),
4918 {}
4919 };
6b0f95c4 4920 static const struct coef_fw coef0292[] = {
54db6c39
TI
4921 WRITE_COEF(0x19, 0xa208),
4922 WRITE_COEF(0x2e, 0xacf0),
4923 {}
4924 };
6b0f95c4 4925 static const struct coef_fw coef0293[] = {
54db6c39
TI
4926 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4927 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4928 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4929 {}
4930 };
6b0f95c4 4931 static const struct coef_fw coef0688[] = {
54db6c39
TI
4932 WRITE_COEF(0xb7, 0x802b),
4933 WRITE_COEF(0xb5, 0x1040),
4934 UPDATE_COEF(0xc3, 0, 1<<12),
4935 {}
4936 };
6b0f95c4 4937 static const struct coef_fw coef0225[] = {
4cc9b9d6
KY
4938 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4939 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4940 UPDATE_COEF(0x63, 3<<14, 0),
4941 {}
4942 };
6b0f95c4 4943 static const struct coef_fw coef0274[] = {
71683c32
KY
4944 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4945 UPDATE_COEF(0x4a, 0x0010, 0),
4946 UPDATE_COEF(0x6b, 0xf000, 0),
4947 {}
4948 };
54db6c39 4949
7639a06c 4950 switch (codec->core.vendor_id) {
9a22a8f5
KY
4951 case 0x10ec0255:
4952 alc_write_coef_idx(codec, 0x45, 0xc489);
4953 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4954 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
4955 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4956 break;
1948fc06 4957 case 0x10ec0230:
717f43d8
KY
4958 case 0x10ec0236:
4959 case 0x10ec0256:
4960 alc_write_coef_idx(codec, 0x45, 0xc489);
4961 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4962 alc_process_coef_fw(codec, coef0256);
4963 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4964 break;
71683c32
KY
4965 case 0x10ec0234:
4966 case 0x10ec0274:
4967 case 0x10ec0294:
4968 alc_write_coef_idx(codec, 0x45, 0x4689);
4969 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4970 alc_process_coef_fw(codec, coef0274);
4971 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4972 break;
13fd08a3 4973 case 0x10ec0233:
73bdd597
DH
4974 case 0x10ec0283:
4975 alc_write_coef_idx(codec, 0x45, 0xc429);
4976 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4977 alc_process_coef_fw(codec, coef0233);
73bdd597
DH
4978 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4979 break;
f3b70332
KY
4980 case 0x10ec0286:
4981 case 0x10ec0288:
1a5bc8d9 4982 case 0x10ec0298:
f3b70332
KY
4983 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4984 alc_process_coef_fw(codec, coef0288);
4985 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4986 break;
73bdd597
DH
4987 case 0x10ec0292:
4988 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4989 alc_process_coef_fw(codec, coef0292);
73bdd597 4990 break;
a22aa26f
KY
4991 case 0x10ec0293:
4992 /* Set to TRS mode */
4993 alc_write_coef_idx(codec, 0x45, 0xc429);
4994 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4995 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
4996 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4997 break;
78f4f7c2
KY
4998 case 0x10ec0867:
4999 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
c0dbbdad 5000 fallthrough;
9eb5d0e6 5001 case 0x10ec0221:
1f8b46cd
DH
5002 case 0x10ec0662:
5003 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5004 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5005 break;
73bdd597
DH
5006 case 0x10ec0668:
5007 alc_write_coef_idx(codec, 0x11, 0x0001);
5008 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5009 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5010 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5011 break;
c2b691ee 5012 case 0x10ec0215:
4cc9b9d6 5013 case 0x10ec0225:
c2b691ee 5014 case 0x10ec0285:
7d727869 5015 case 0x10ec0295:
c2b691ee 5016 case 0x10ec0289:
28f1f9b2 5017 case 0x10ec0299:
5a36767a 5018 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
5019 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5020 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5021 alc_process_coef_fw(codec, coef0225);
5022 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5023 break;
73bdd597 5024 }
4e76a883 5025 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
73bdd597
DH
5026}
5027
5028static void alc_headset_mode_default(struct hda_codec *codec)
5029{
6b0f95c4 5030 static const struct coef_fw coef0225[] = {
5a36767a
KY
5031 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5032 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5033 UPDATE_COEF(0x49, 3<<8, 0<<8),
5034 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5035 UPDATE_COEF(0x63, 3<<14, 0),
5036 UPDATE_COEF(0x67, 0xf000, 0x3000),
2ae95577
DH
5037 {}
5038 };
6b0f95c4 5039 static const struct coef_fw coef0255[] = {
54db6c39
TI
5040 WRITE_COEF(0x45, 0xc089),
5041 WRITE_COEF(0x45, 0xc489),
5042 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5043 WRITE_COEF(0x49, 0x0049),
5044 {}
5045 };
6b0f95c4 5046 static const struct coef_fw coef0256[] = {
717f43d8
KY
5047 WRITE_COEF(0x45, 0xc489),
5048 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5049 WRITE_COEF(0x49, 0x0049),
5050 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5051 WRITE_COEF(0x06, 0x6100),
5052 {}
5053 };
6b0f95c4 5054 static const struct coef_fw coef0233[] = {
54db6c39
TI
5055 WRITE_COEF(0x06, 0x2100),
5056 WRITE_COEF(0x32, 0x4ea3),
5057 {}
5058 };
6b0f95c4 5059 static const struct coef_fw coef0288[] = {
f3b70332
KY
5060 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5061 UPDATE_COEF(0x50, 0x2000, 0x2000),
5062 UPDATE_COEF(0x56, 0x0006, 0x0006),
5063 UPDATE_COEF(0x66, 0x0008, 0),
5064 UPDATE_COEF(0x67, 0x2000, 0),
5065 {}
5066 };
6b0f95c4 5067 static const struct coef_fw coef0292[] = {
54db6c39
TI
5068 WRITE_COEF(0x76, 0x000e),
5069 WRITE_COEF(0x6c, 0x2400),
5070 WRITE_COEF(0x6b, 0xc429),
5071 WRITE_COEF(0x18, 0x7308),
5072 {}
5073 };
6b0f95c4 5074 static const struct coef_fw coef0293[] = {
54db6c39
TI
5075 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5076 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5077 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5078 {}
5079 };
6b0f95c4 5080 static const struct coef_fw coef0688[] = {
54db6c39
TI
5081 WRITE_COEF(0x11, 0x0041),
5082 WRITE_COEF(0x15, 0x0d40),
5083 WRITE_COEF(0xb7, 0x802b),
5084 {}
5085 };
6b0f95c4 5086 static const struct coef_fw coef0274[] = {
71683c32
KY
5087 WRITE_COEF(0x45, 0x4289),
5088 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5089 UPDATE_COEF(0x6b, 0x0f00, 0),
5090 UPDATE_COEF(0x49, 0x0300, 0x0300),
5091 {}
5092 };
54db6c39 5093
7639a06c 5094 switch (codec->core.vendor_id) {
c2b691ee 5095 case 0x10ec0215:
2ae95577 5096 case 0x10ec0225:
c2b691ee 5097 case 0x10ec0285:
7d727869 5098 case 0x10ec0295:
c2b691ee 5099 case 0x10ec0289:
28f1f9b2 5100 case 0x10ec0299:
5a36767a 5101 alc_process_coef_fw(codec, alc225_pre_hsmode);
2ae95577
DH
5102 alc_process_coef_fw(codec, coef0225);
5103 break;
9a22a8f5 5104 case 0x10ec0255:
54db6c39 5105 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5106 break;
1948fc06 5107 case 0x10ec0230:
717f43d8
KY
5108 case 0x10ec0236:
5109 case 0x10ec0256:
5110 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5111 alc_write_coef_idx(codec, 0x45, 0xc089);
5112 msleep(50);
5113 alc_process_coef_fw(codec, coef0256);
5114 break;
71683c32
KY
5115 case 0x10ec0234:
5116 case 0x10ec0274:
5117 case 0x10ec0294:
5118 alc_process_coef_fw(codec, coef0274);
5119 break;
13fd08a3 5120 case 0x10ec0233:
73bdd597 5121 case 0x10ec0283:
54db6c39 5122 alc_process_coef_fw(codec, coef0233);
73bdd597 5123 break;
f3b70332
KY
5124 case 0x10ec0286:
5125 case 0x10ec0288:
1a5bc8d9 5126 case 0x10ec0298:
f3b70332
KY
5127 alc_process_coef_fw(codec, coef0288);
5128 break;
73bdd597 5129 case 0x10ec0292:
54db6c39 5130 alc_process_coef_fw(codec, coef0292);
73bdd597 5131 break;
a22aa26f 5132 case 0x10ec0293:
54db6c39 5133 alc_process_coef_fw(codec, coef0293);
a22aa26f 5134 break;
73bdd597 5135 case 0x10ec0668:
54db6c39 5136 alc_process_coef_fw(codec, coef0688);
73bdd597 5137 break;
78f4f7c2
KY
5138 case 0x10ec0867:
5139 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5140 break;
73bdd597 5141 }
4e76a883 5142 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
73bdd597
DH
5143}
5144
5145/* Iphone type */
5146static void alc_headset_mode_ctia(struct hda_codec *codec)
5147{
89542936
KY
5148 int val;
5149
6b0f95c4 5150 static const struct coef_fw coef0255[] = {
54db6c39
TI
5151 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5152 WRITE_COEF(0x1b, 0x0c2b),
5153 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5154 {}
5155 };
6b0f95c4 5156 static const struct coef_fw coef0256[] = {
e69e7e03 5157 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
717f43d8 5158 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5159 {}
5160 };
6b0f95c4 5161 static const struct coef_fw coef0233[] = {
54db6c39
TI
5162 WRITE_COEF(0x45, 0xd429),
5163 WRITE_COEF(0x1b, 0x0c2b),
5164 WRITE_COEF(0x32, 0x4ea3),
5165 {}
5166 };
6b0f95c4 5167 static const struct coef_fw coef0288[] = {
f3b70332
KY
5168 UPDATE_COEF(0x50, 0x2000, 0x2000),
5169 UPDATE_COEF(0x56, 0x0006, 0x0006),
5170 UPDATE_COEF(0x66, 0x0008, 0),
5171 UPDATE_COEF(0x67, 0x2000, 0),
5172 {}
5173 };
6b0f95c4 5174 static const struct coef_fw coef0292[] = {
54db6c39
TI
5175 WRITE_COEF(0x6b, 0xd429),
5176 WRITE_COEF(0x76, 0x0008),
5177 WRITE_COEF(0x18, 0x7388),
5178 {}
5179 };
6b0f95c4 5180 static const struct coef_fw coef0293[] = {
54db6c39
TI
5181 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5182 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5183 {}
5184 };
6b0f95c4 5185 static const struct coef_fw coef0688[] = {
54db6c39
TI
5186 WRITE_COEF(0x11, 0x0001),
5187 WRITE_COEF(0x15, 0x0d60),
5188 WRITE_COEF(0xc3, 0x0000),
5189 {}
5190 };
6b0f95c4 5191 static const struct coef_fw coef0225_1[] = {
4cc9b9d6 5192 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5a36767a
KY
5193 UPDATE_COEF(0x63, 3<<14, 2<<14),
5194 {}
5195 };
6b0f95c4 5196 static const struct coef_fw coef0225_2[] = {
5a36767a
KY
5197 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5198 UPDATE_COEF(0x63, 3<<14, 1<<14),
4cc9b9d6
KY
5199 {}
5200 };
54db6c39 5201
7639a06c 5202 switch (codec->core.vendor_id) {
9a22a8f5 5203 case 0x10ec0255:
54db6c39 5204 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5205 break;
1948fc06 5206 case 0x10ec0230:
736f20a7 5207 case 0x10ec0236:
e69e7e03
KY
5208 case 0x10ec0256:
5209 alc_process_coef_fw(codec, coef0256);
5210 break;
71683c32
KY
5211 case 0x10ec0234:
5212 case 0x10ec0274:
5213 case 0x10ec0294:
5214 alc_write_coef_idx(codec, 0x45, 0xd689);
5215 break;
13fd08a3 5216 case 0x10ec0233:
73bdd597 5217 case 0x10ec0283:
54db6c39 5218 alc_process_coef_fw(codec, coef0233);
73bdd597 5219 break;
1a5bc8d9 5220 case 0x10ec0298:
89542936
KY
5221 val = alc_read_coef_idx(codec, 0x50);
5222 if (val & (1 << 12)) {
5223 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5224 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5225 msleep(300);
5226 } else {
5227 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5228 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5229 msleep(300);
5230 }
5231 break;
f3b70332
KY
5232 case 0x10ec0286:
5233 case 0x10ec0288:
5234 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5235 msleep(300);
5236 alc_process_coef_fw(codec, coef0288);
5237 break;
73bdd597 5238 case 0x10ec0292:
54db6c39 5239 alc_process_coef_fw(codec, coef0292);
73bdd597 5240 break;
a22aa26f 5241 case 0x10ec0293:
54db6c39 5242 alc_process_coef_fw(codec, coef0293);
a22aa26f 5243 break;
73bdd597 5244 case 0x10ec0668:
54db6c39 5245 alc_process_coef_fw(codec, coef0688);
73bdd597 5246 break;
c2b691ee 5247 case 0x10ec0215:
4cc9b9d6 5248 case 0x10ec0225:
c2b691ee 5249 case 0x10ec0285:
7d727869 5250 case 0x10ec0295:
c2b691ee 5251 case 0x10ec0289:
28f1f9b2 5252 case 0x10ec0299:
5a36767a
KY
5253 val = alc_read_coef_idx(codec, 0x45);
5254 if (val & (1 << 9))
5255 alc_process_coef_fw(codec, coef0225_2);
5256 else
5257 alc_process_coef_fw(codec, coef0225_1);
4cc9b9d6 5258 break;
78f4f7c2
KY
5259 case 0x10ec0867:
5260 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5261 break;
73bdd597 5262 }
4e76a883 5263 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
73bdd597
DH
5264}
5265
5266/* Nokia type */
5267static void alc_headset_mode_omtp(struct hda_codec *codec)
5268{
6b0f95c4 5269 static const struct coef_fw coef0255[] = {
54db6c39
TI
5270 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5271 WRITE_COEF(0x1b, 0x0c2b),
5272 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5273 {}
5274 };
6b0f95c4 5275 static const struct coef_fw coef0256[] = {
e69e7e03 5276 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
717f43d8 5277 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5278 {}
5279 };
6b0f95c4 5280 static const struct coef_fw coef0233[] = {
54db6c39
TI
5281 WRITE_COEF(0x45, 0xe429),
5282 WRITE_COEF(0x1b, 0x0c2b),
5283 WRITE_COEF(0x32, 0x4ea3),
5284 {}
5285 };
6b0f95c4 5286 static const struct coef_fw coef0288[] = {
f3b70332
KY
5287 UPDATE_COEF(0x50, 0x2000, 0x2000),
5288 UPDATE_COEF(0x56, 0x0006, 0x0006),
5289 UPDATE_COEF(0x66, 0x0008, 0),
5290 UPDATE_COEF(0x67, 0x2000, 0),
5291 {}
5292 };
6b0f95c4 5293 static const struct coef_fw coef0292[] = {
54db6c39
TI
5294 WRITE_COEF(0x6b, 0xe429),
5295 WRITE_COEF(0x76, 0x0008),
5296 WRITE_COEF(0x18, 0x7388),
5297 {}
5298 };
6b0f95c4 5299 static const struct coef_fw coef0293[] = {
54db6c39
TI
5300 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5301 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5302 {}
5303 };
6b0f95c4 5304 static const struct coef_fw coef0688[] = {
54db6c39
TI
5305 WRITE_COEF(0x11, 0x0001),
5306 WRITE_COEF(0x15, 0x0d50),
5307 WRITE_COEF(0xc3, 0x0000),
5308 {}
5309 };
6b0f95c4 5310 static const struct coef_fw coef0225[] = {
4cc9b9d6 5311 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5a36767a 5312 UPDATE_COEF(0x63, 3<<14, 2<<14),
4cc9b9d6
KY
5313 {}
5314 };
54db6c39 5315
7639a06c 5316 switch (codec->core.vendor_id) {
9a22a8f5 5317 case 0x10ec0255:
54db6c39 5318 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5319 break;
1948fc06 5320 case 0x10ec0230:
736f20a7 5321 case 0x10ec0236:
e69e7e03
KY
5322 case 0x10ec0256:
5323 alc_process_coef_fw(codec, coef0256);
5324 break;
71683c32
KY
5325 case 0x10ec0234:
5326 case 0x10ec0274:
5327 case 0x10ec0294:
5328 alc_write_coef_idx(codec, 0x45, 0xe689);
5329 break;
13fd08a3 5330 case 0x10ec0233:
73bdd597 5331 case 0x10ec0283:
54db6c39 5332 alc_process_coef_fw(codec, coef0233);
73bdd597 5333 break;
1a5bc8d9
KY
5334 case 0x10ec0298:
5335 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
89542936
KY
5336 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5337 msleep(300);
5338 break;
f3b70332
KY
5339 case 0x10ec0286:
5340 case 0x10ec0288:
5341 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5342 msleep(300);
5343 alc_process_coef_fw(codec, coef0288);
5344 break;
73bdd597 5345 case 0x10ec0292:
54db6c39 5346 alc_process_coef_fw(codec, coef0292);
73bdd597 5347 break;
a22aa26f 5348 case 0x10ec0293:
54db6c39 5349 alc_process_coef_fw(codec, coef0293);
a22aa26f 5350 break;
73bdd597 5351 case 0x10ec0668:
54db6c39 5352 alc_process_coef_fw(codec, coef0688);
73bdd597 5353 break;
c2b691ee 5354 case 0x10ec0215:
4cc9b9d6 5355 case 0x10ec0225:
c2b691ee 5356 case 0x10ec0285:
7d727869 5357 case 0x10ec0295:
c2b691ee 5358 case 0x10ec0289:
28f1f9b2 5359 case 0x10ec0299:
4cc9b9d6
KY
5360 alc_process_coef_fw(codec, coef0225);
5361 break;
73bdd597 5362 }
4e76a883 5363 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
73bdd597
DH
5364}
5365
5366static void alc_determine_headset_type(struct hda_codec *codec)
5367{
5368 int val;
5369 bool is_ctia = false;
5370 struct alc_spec *spec = codec->spec;
6b0f95c4 5371 static const struct coef_fw coef0255[] = {
54db6c39
TI
5372 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5373 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5374 conteol) */
5375 {}
5376 };
6b0f95c4 5377 static const struct coef_fw coef0288[] = {
f3b70332
KY
5378 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5379 {}
5380 };
6b0f95c4 5381 static const struct coef_fw coef0298[] = {
89542936
KY
5382 UPDATE_COEF(0x50, 0x2000, 0x2000),
5383 UPDATE_COEF(0x56, 0x0006, 0x0006),
5384 UPDATE_COEF(0x66, 0x0008, 0),
5385 UPDATE_COEF(0x67, 0x2000, 0),
5386 UPDATE_COEF(0x19, 0x1300, 0x1300),
5387 {}
5388 };
6b0f95c4 5389 static const struct coef_fw coef0293[] = {
54db6c39
TI
5390 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5391 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5392 {}
5393 };
6b0f95c4 5394 static const struct coef_fw coef0688[] = {
54db6c39
TI
5395 WRITE_COEF(0x11, 0x0001),
5396 WRITE_COEF(0xb7, 0x802b),
5397 WRITE_COEF(0x15, 0x0d60),
5398 WRITE_COEF(0xc3, 0x0c00),
5399 {}
5400 };
6b0f95c4 5401 static const struct coef_fw coef0274[] = {
71683c32
KY
5402 UPDATE_COEF(0x4a, 0x0010, 0),
5403 UPDATE_COEF(0x4a, 0x8000, 0),
5404 WRITE_COEF(0x45, 0xd289),
5405 UPDATE_COEF(0x49, 0x0300, 0x0300),
5406 {}
5407 };
73bdd597 5408
92666d45
KY
5409 if (spec->no_internal_mic_pin) {
5410 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5411 return;
5412 }
5413
7639a06c 5414 switch (codec->core.vendor_id) {
9a22a8f5 5415 case 0x10ec0255:
717f43d8
KY
5416 alc_process_coef_fw(codec, coef0255);
5417 msleep(300);
5418 val = alc_read_coef_idx(codec, 0x46);
5419 is_ctia = (val & 0x0070) == 0x0070;
5420 break;
1948fc06 5421 case 0x10ec0230:
717f43d8 5422 case 0x10ec0236:
7081adf3 5423 case 0x10ec0256:
717f43d8
KY
5424 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5425 alc_write_coef_idx(codec, 0x06, 0x6104);
5426 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5427
5428 snd_hda_codec_write(codec, 0x21, 0,
5429 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5430 msleep(80);
5431 snd_hda_codec_write(codec, 0x21, 0,
5432 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5433
54db6c39 5434 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
5435 msleep(300);
5436 val = alc_read_coef_idx(codec, 0x46);
5437 is_ctia = (val & 0x0070) == 0x0070;
717f43d8
KY
5438
5439 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5440 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5441
5442 snd_hda_codec_write(codec, 0x21, 0,
5443 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5444 msleep(80);
5445 snd_hda_codec_write(codec, 0x21, 0,
5446 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
9a22a8f5 5447 break;
71683c32
KY
5448 case 0x10ec0234:
5449 case 0x10ec0274:
5450 case 0x10ec0294:
5451 alc_process_coef_fw(codec, coef0274);
febf2256 5452 msleep(850);
71683c32
KY
5453 val = alc_read_coef_idx(codec, 0x46);
5454 is_ctia = (val & 0x00f0) == 0x00f0;
5455 break;
13fd08a3 5456 case 0x10ec0233:
73bdd597
DH
5457 case 0x10ec0283:
5458 alc_write_coef_idx(codec, 0x45, 0xd029);
5459 msleep(300);
5460 val = alc_read_coef_idx(codec, 0x46);
5461 is_ctia = (val & 0x0070) == 0x0070;
5462 break;
1a5bc8d9 5463 case 0x10ec0298:
89542936
KY
5464 snd_hda_codec_write(codec, 0x21, 0,
5465 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5466 msleep(100);
5467 snd_hda_codec_write(codec, 0x21, 0,
5468 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5469 msleep(200);
5470
5471 val = alc_read_coef_idx(codec, 0x50);
5472 if (val & (1 << 12)) {
5473 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5474 alc_process_coef_fw(codec, coef0288);
5475 msleep(350);
5476 val = alc_read_coef_idx(codec, 0x50);
5477 is_ctia = (val & 0x0070) == 0x0070;
5478 } else {
5479 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5480 alc_process_coef_fw(codec, coef0288);
5481 msleep(350);
5482 val = alc_read_coef_idx(codec, 0x50);
5483 is_ctia = (val & 0x0070) == 0x0070;
5484 }
5485 alc_process_coef_fw(codec, coef0298);
5486 snd_hda_codec_write(codec, 0x21, 0,
5487 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5488 msleep(75);
5489 snd_hda_codec_write(codec, 0x21, 0,
5490 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5491 break;
f3b70332
KY
5492 case 0x10ec0286:
5493 case 0x10ec0288:
5494 alc_process_coef_fw(codec, coef0288);
5495 msleep(350);
5496 val = alc_read_coef_idx(codec, 0x50);
5497 is_ctia = (val & 0x0070) == 0x0070;
5498 break;
73bdd597
DH
5499 case 0x10ec0292:
5500 alc_write_coef_idx(codec, 0x6b, 0xd429);
5501 msleep(300);
5502 val = alc_read_coef_idx(codec, 0x6c);
5503 is_ctia = (val & 0x001c) == 0x001c;
5504 break;
a22aa26f 5505 case 0x10ec0293:
54db6c39 5506 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5507 msleep(300);
5508 val = alc_read_coef_idx(codec, 0x46);
5509 is_ctia = (val & 0x0070) == 0x0070;
5510 break;
73bdd597 5511 case 0x10ec0668:
54db6c39 5512 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5513 msleep(300);
5514 val = alc_read_coef_idx(codec, 0xbe);
5515 is_ctia = (val & 0x1c02) == 0x1c02;
5516 break;
c2b691ee 5517 case 0x10ec0215:
4cc9b9d6 5518 case 0x10ec0225:
c2b691ee 5519 case 0x10ec0285:
7d727869 5520 case 0x10ec0295:
c2b691ee 5521 case 0x10ec0289:
28f1f9b2 5522 case 0x10ec0299:
da911b1f
KY
5523 snd_hda_codec_write(codec, 0x21, 0,
5524 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5525 msleep(80);
5526 snd_hda_codec_write(codec, 0x21, 0,
5527 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5528
5a36767a
KY
5529 alc_process_coef_fw(codec, alc225_pre_hsmode);
5530 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5531 val = alc_read_coef_idx(codec, 0x45);
5532 if (val & (1 << 9)) {
5533 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5534 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5535 msleep(800);
5536 val = alc_read_coef_idx(codec, 0x46);
5537 is_ctia = (val & 0x00f0) == 0x00f0;
5538 } else {
5539 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5540 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5541 msleep(800);
5542 val = alc_read_coef_idx(codec, 0x46);
5543 is_ctia = (val & 0x00f0) == 0x00f0;
5544 }
5545 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5546 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5547 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
da911b1f
KY
5548
5549 snd_hda_codec_write(codec, 0x21, 0,
5550 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5551 msleep(80);
5552 snd_hda_codec_write(codec, 0x21, 0,
5553 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4cc9b9d6 5554 break;
78f4f7c2
KY
5555 case 0x10ec0867:
5556 is_ctia = true;
5557 break;
73bdd597
DH
5558 }
5559
4e76a883 5560 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
73bdd597
DH
5561 is_ctia ? "yes" : "no");
5562 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5563}
5564
5565static void alc_update_headset_mode(struct hda_codec *codec)
5566{
5567 struct alc_spec *spec = codec->spec;
5568
5569 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
35a39f98 5570 hda_nid_t hp_pin = alc_get_hp_pin(spec);
73bdd597
DH
5571
5572 int new_headset_mode;
5573
5574 if (!snd_hda_jack_detect(codec, hp_pin))
5575 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5576 else if (mux_pin == spec->headset_mic_pin)
5577 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5578 else if (mux_pin == spec->headphone_mic_pin)
5579 new_headset_mode = ALC_HEADSET_MODE_MIC;
5580 else
5581 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5582
5959a6bc
DH
5583 if (new_headset_mode == spec->current_headset_mode) {
5584 snd_hda_gen_update_outputs(codec);
73bdd597 5585 return;
5959a6bc 5586 }
73bdd597
DH
5587
5588 switch (new_headset_mode) {
5589 case ALC_HEADSET_MODE_UNPLUGGED:
5590 alc_headset_mode_unplugged(codec);
aeac1a0d
KY
5591 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5592 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
73bdd597
DH
5593 spec->gen.hp_jack_present = false;
5594 break;
5595 case ALC_HEADSET_MODE_HEADSET:
5596 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5597 alc_determine_headset_type(codec);
5598 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5599 alc_headset_mode_ctia(codec);
5600 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5601 alc_headset_mode_omtp(codec);
5602 spec->gen.hp_jack_present = true;
5603 break;
5604 case ALC_HEADSET_MODE_MIC:
5605 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5606 spec->gen.hp_jack_present = false;
5607 break;
5608 case ALC_HEADSET_MODE_HEADPHONE:
5609 alc_headset_mode_default(codec);
5610 spec->gen.hp_jack_present = true;
5611 break;
5612 }
5613 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5614 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5615 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
1f8b46cd 5616 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
73bdd597
DH
5617 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5618 PIN_VREFHIZ);
5619 }
5620 spec->current_headset_mode = new_headset_mode;
5621
5622 snd_hda_gen_update_outputs(codec);
5623}
5624
5625static void alc_update_headset_mode_hook(struct hda_codec *codec,
7fe30711
TI
5626 struct snd_kcontrol *kcontrol,
5627 struct snd_ctl_elem_value *ucontrol)
73bdd597
DH
5628{
5629 alc_update_headset_mode(codec);
5630}
5631
1a4f69d5
TI
5632static void alc_update_headset_jack_cb(struct hda_codec *codec,
5633 struct hda_jack_callback *jack)
73bdd597 5634{
73bdd597 5635 snd_hda_gen_hp_automute(codec, jack);
e54f30be 5636 alc_update_headset_mode(codec);
73bdd597
DH
5637}
5638
5639static void alc_probe_headset_mode(struct hda_codec *codec)
5640{
5641 int i;
5642 struct alc_spec *spec = codec->spec;
5643 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5644
5645 /* Find mic pins */
5646 for (i = 0; i < cfg->num_inputs; i++) {
5647 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5648 spec->headset_mic_pin = cfg->inputs[i].pin;
5649 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5650 spec->headphone_mic_pin = cfg->inputs[i].pin;
5651 }
5652
0bed2aa3 5653 WARN_ON(spec->gen.cap_sync_hook);
73bdd597
DH
5654 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5655 spec->gen.automute_hook = alc_update_headset_mode;
5656 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5657}
5658
5659static void alc_fixup_headset_mode(struct hda_codec *codec,
5660 const struct hda_fixup *fix, int action)
5661{
5662 struct alc_spec *spec = codec->spec;
5663
5664 switch (action) {
5665 case HDA_FIXUP_ACT_PRE_PROBE:
5666 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5667 break;
5668 case HDA_FIXUP_ACT_PROBE:
5669 alc_probe_headset_mode(codec);
5670 break;
5671 case HDA_FIXUP_ACT_INIT:
aeac1a0d
KY
5672 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5673 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5674 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5675 }
73bdd597
DH
5676 alc_update_headset_mode(codec);
5677 break;
5678 }
5679}
5680
5681static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5682 const struct hda_fixup *fix, int action)
5683{
5684 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5685 struct alc_spec *spec = codec->spec;
5686 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5687 }
5688 else
5689 alc_fixup_headset_mode(codec, fix, action);
5690}
5691
31278997
KY
5692static void alc255_set_default_jack_type(struct hda_codec *codec)
5693{
5694 /* Set to iphone type */
6b0f95c4 5695 static const struct coef_fw alc255fw[] = {
54db6c39
TI
5696 WRITE_COEF(0x1b, 0x880b),
5697 WRITE_COEF(0x45, 0xd089),
5698 WRITE_COEF(0x1b, 0x080b),
5699 WRITE_COEF(0x46, 0x0004),
5700 WRITE_COEF(0x1b, 0x0c0b),
5701 {}
5702 };
6b0f95c4 5703 static const struct coef_fw alc256fw[] = {
e69e7e03
KY
5704 WRITE_COEF(0x1b, 0x884b),
5705 WRITE_COEF(0x45, 0xd089),
5706 WRITE_COEF(0x1b, 0x084b),
5707 WRITE_COEF(0x46, 0x0004),
5708 WRITE_COEF(0x1b, 0x0c4b),
5709 {}
5710 };
5711 switch (codec->core.vendor_id) {
5712 case 0x10ec0255:
5713 alc_process_coef_fw(codec, alc255fw);
5714 break;
1948fc06 5715 case 0x10ec0230:
736f20a7 5716 case 0x10ec0236:
e69e7e03
KY
5717 case 0x10ec0256:
5718 alc_process_coef_fw(codec, alc256fw);
5719 break;
5720 }
31278997
KY
5721 msleep(30);
5722}
5723
9a22a8f5
KY
5724static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5725 const struct hda_fixup *fix, int action)
5726{
5727 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
31278997 5728 alc255_set_default_jack_type(codec);
9a22a8f5
KY
5729 }
5730 alc_fixup_headset_mode(codec, fix, action);
5731}
5732
31278997
KY
5733static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5734 const struct hda_fixup *fix, int action)
5735{
5736 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5737 struct alc_spec *spec = codec->spec;
5738 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5739 alc255_set_default_jack_type(codec);
5740 }
5741 else
5742 alc_fixup_headset_mode(codec, fix, action);
5743}
5744
e1e62b98
KY
5745static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5746 struct hda_jack_callback *jack)
5747{
5748 struct alc_spec *spec = codec->spec;
e1e62b98
KY
5749
5750 alc_update_headset_jack_cb(codec, jack);
5751 /* Headset Mic enable or disable, only for Dell Dino */
d44a6864 5752 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
e1e62b98
KY
5753}
5754
5755static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5756 const struct hda_fixup *fix, int action)
5757{
5758 alc_fixup_headset_mode(codec, fix, action);
5759 if (action == HDA_FIXUP_ACT_PROBE) {
5760 struct alc_spec *spec = codec->spec;
d44a6864
TI
5761 /* toggled via hp_automute_hook */
5762 spec->gpio_mask |= 0x40;
5763 spec->gpio_dir |= 0x40;
e1e62b98
KY
5764 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5765 }
5766}
5767
493a52a9
HW
5768static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5769 const struct hda_fixup *fix, int action)
5770{
5771 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5772 struct alc_spec *spec = codec->spec;
5773 spec->gen.auto_mute_via_amp = 1;
5774 }
5775}
5776
9b745ab8
TI
5777static void alc_fixup_no_shutup(struct hda_codec *codec,
5778 const struct hda_fixup *fix, int action)
5779{
efe55732 5780 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9b745ab8 5781 struct alc_spec *spec = codec->spec;
c0ca5ece 5782 spec->no_shutup_pins = 1;
9b745ab8
TI
5783 }
5784}
5785
5e6db669
GM
5786static void alc_fixup_disable_aamix(struct hda_codec *codec,
5787 const struct hda_fixup *fix, int action)
5788{
5789 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5790 struct alc_spec *spec = codec->spec;
5791 /* Disable AA-loopback as it causes white noise */
5792 spec->gen.mixer_nid = 0;
5793 }
5794}
5795
7f57d803
TI
5796/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5797static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5798 const struct hda_fixup *fix, int action)
5799{
5800 static const struct hda_pintbl pincfgs[] = {
5801 { 0x16, 0x21211010 }, /* dock headphone */
5802 { 0x19, 0x21a11010 }, /* dock mic */
5803 { }
5804 };
5805 struct alc_spec *spec = codec->spec;
5806
5807 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5808 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5809 codec->power_save_node = 0; /* avoid click noises */
5810 snd_hda_apply_pincfgs(codec, pincfgs);
5811 }
5812}
5813
61fcf8ec
KY
5814static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5815 const struct hda_fixup *fix, int action)
5816{
5817 static const struct hda_pintbl pincfgs[] = {
5818 { 0x17, 0x21211010 }, /* dock headphone */
5819 { 0x19, 0x21a11010 }, /* dock mic */
5820 { }
5821 };
5822 struct alc_spec *spec = codec->spec;
5823
5824 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5825 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
71db96dd
TI
5826 snd_hda_apply_pincfgs(codec, pincfgs);
5827 } else if (action == HDA_FIXUP_ACT_INIT) {
61fcf8ec
KY
5828 /* Enable DOCK device */
5829 snd_hda_codec_write(codec, 0x17, 0,
5830 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5831 /* Enable DOCK device */
5832 snd_hda_codec_write(codec, 0x19, 0,
5833 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
61fcf8ec
KY
5834 }
5835}
5836
399c01aa
TI
5837static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5838 const struct hda_fixup *fix, int action)
5839{
5840 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5841 * the speaker output becomes too low by some reason on Thinkpads with
5842 * ALC298 codec
5843 */
5844 static const hda_nid_t preferred_pairs[] = {
5845 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5846 0
5847 };
5848 struct alc_spec *spec = codec->spec;
5849
5850 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5851 spec->gen.preferred_dacs = preferred_pairs;
5852}
5853
8eedd3a7
TI
5854static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5855 const struct hda_fixup *fix, int action)
5856{
5857 static const hda_nid_t preferred_pairs[] = {
5858 0x17, 0x02, 0x21, 0x03, 0
5859 };
5860 struct alc_spec *spec = codec->spec;
5861
5862 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5863 spec->gen.preferred_dacs = preferred_pairs;
5864}
5865
9476d369 5866static void alc_shutup_dell_xps13(struct hda_codec *codec)
033b0a7c
GM
5867{
5868 struct alc_spec *spec = codec->spec;
35a39f98 5869 int hp_pin = alc_get_hp_pin(spec);
033b0a7c 5870
9476d369
GM
5871 /* Prevent pop noises when headphones are plugged in */
5872 snd_hda_codec_write(codec, hp_pin, 0,
5873 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5874 msleep(20);
033b0a7c
GM
5875}
5876
5877static void alc_fixup_dell_xps13(struct hda_codec *codec,
5878 const struct hda_fixup *fix, int action)
5879{
3e1b0c4a
TI
5880 struct alc_spec *spec = codec->spec;
5881 struct hda_input_mux *imux = &spec->gen.input_mux;
5882 int i;
f38663ab 5883
3e1b0c4a
TI
5884 switch (action) {
5885 case HDA_FIXUP_ACT_PRE_PROBE:
5886 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5887 * it causes a click noise at start up
5888 */
5889 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
efe55732 5890 spec->shutup = alc_shutup_dell_xps13;
3e1b0c4a
TI
5891 break;
5892 case HDA_FIXUP_ACT_PROBE:
f38663ab
GM
5893 /* Make the internal mic the default input source. */
5894 for (i = 0; i < imux->num_items; i++) {
5895 if (spec->gen.imux_pins[i] == 0x12) {
5896 spec->gen.cur_mux[0] = i;
5897 break;
5898 }
5899 }
3e1b0c4a 5900 break;
033b0a7c
GM
5901 }
5902}
5903
1f8b46cd
DH
5904static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5905 const struct hda_fixup *fix, int action)
5906{
5907 struct alc_spec *spec = codec->spec;
5908
5909 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5910 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5911 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
b40eda64
DH
5912
5913 /* Disable boost for mic-in permanently. (This code is only called
5914 from quirks that guarantee that the headphone is at NID 0x1b.) */
5915 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5916 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
1f8b46cd
DH
5917 } else
5918 alc_fixup_headset_mode(codec, fix, action);
5919}
5920
73bdd597
DH
5921static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5922 const struct hda_fixup *fix, int action)
5923{
5924 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
73bdd597 5925 alc_write_coef_idx(codec, 0xc4, 0x8000);
98b24883 5926 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
73bdd597
DH
5927 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5928 }
5929 alc_fixup_headset_mode(codec, fix, action);
5930}
5931
bde7bc60
CCC
5932/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5933static int find_ext_mic_pin(struct hda_codec *codec)
5934{
5935 struct alc_spec *spec = codec->spec;
5936 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5937 hda_nid_t nid;
5938 unsigned int defcfg;
5939 int i;
5940
5941 for (i = 0; i < cfg->num_inputs; i++) {
5942 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5943 continue;
5944 nid = cfg->inputs[i].pin;
5945 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5946 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5947 continue;
5948 return nid;
5949 }
5950
5951 return 0;
5952}
5953
08a978db 5954static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
1727a771 5955 const struct hda_fixup *fix,
08a978db
DR
5956 int action)
5957{
5958 struct alc_spec *spec = codec->spec;
5959
0db75790 5960 if (action == HDA_FIXUP_ACT_PROBE) {
bde7bc60 5961 int mic_pin = find_ext_mic_pin(codec);
35a39f98 5962 int hp_pin = alc_get_hp_pin(spec);
bde7bc60
CCC
5963
5964 if (snd_BUG_ON(!mic_pin || !hp_pin))
0db75790 5965 return;
bde7bc60 5966 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
0db75790 5967 }
08a978db 5968}
693b613d 5969
3e0d611b
DH
5970static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5971 const struct hda_fixup *fix,
5972 int action)
5973{
5974 struct alc_spec *spec = codec->spec;
5975 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5976 int i;
5977
5978 /* The mic boosts on level 2 and 3 are too noisy
5979 on the internal mic input.
5980 Therefore limit the boost to 0 or 1. */
5981
5982 if (action != HDA_FIXUP_ACT_PROBE)
5983 return;
5984
5985 for (i = 0; i < cfg->num_inputs; i++) {
5986 hda_nid_t nid = cfg->inputs[i].pin;
5987 unsigned int defcfg;
5988 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5989 continue;
5990 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5991 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5992 continue;
5993
5994 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5995 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5996 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5997 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5998 (0 << AC_AMPCAP_MUTE_SHIFT));
5999 }
6000}
6001
cd217a63 6002static void alc283_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 6003 struct hda_jack_callback *jack)
cd217a63
KY
6004{
6005 struct alc_spec *spec = codec->spec;
6006 int vref;
6007
6008 msleep(200);
6009 snd_hda_gen_hp_automute(codec, jack);
6010
6011 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6012
6013 msleep(600);
6014 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6015 vref);
6016}
6017
cd217a63
KY
6018static void alc283_fixup_chromebook(struct hda_codec *codec,
6019 const struct hda_fixup *fix, int action)
6020{
6021 struct alc_spec *spec = codec->spec;
cd217a63
KY
6022
6023 switch (action) {
6024 case HDA_FIXUP_ACT_PRE_PROBE:
0202e99c 6025 snd_hda_override_wcaps(codec, 0x03, 0);
d2e92709
TI
6026 /* Disable AA-loopback as it causes white noise */
6027 spec->gen.mixer_nid = 0;
38070219 6028 break;
0202e99c 6029 case HDA_FIXUP_ACT_INIT:
de9481cb
KY
6030 /* MIC2-VREF control */
6031 /* Set to manual mode */
98b24883 6032 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
0202e99c 6033 /* Enable Line1 input control by verb */
98b24883 6034 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
0202e99c
KY
6035 break;
6036 }
6037}
6038
6039static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6040 const struct hda_fixup *fix, int action)
6041{
6042 struct alc_spec *spec = codec->spec;
0202e99c
KY
6043
6044 switch (action) {
6045 case HDA_FIXUP_ACT_PRE_PROBE:
cd217a63 6046 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
38070219
KY
6047 break;
6048 case HDA_FIXUP_ACT_INIT:
cd217a63
KY
6049 /* MIC2-VREF control */
6050 /* Set to manual mode */
98b24883 6051 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
cd217a63
KY
6052 break;
6053 }
6054}
6055
7bba2157
TI
6056/* mute tablet speaker pin (0x14) via dock plugging in addition */
6057static void asus_tx300_automute(struct hda_codec *codec)
6058{
6059 struct alc_spec *spec = codec->spec;
6060 snd_hda_gen_update_outputs(codec);
6061 if (snd_hda_jack_detect(codec, 0x1b))
6062 spec->gen.mute_bits |= (1ULL << 0x14);
6063}
6064
6065static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6066 const struct hda_fixup *fix, int action)
6067{
6068 struct alc_spec *spec = codec->spec;
7bba2157
TI
6069 static const struct hda_pintbl dock_pins[] = {
6070 { 0x1b, 0x21114000 }, /* dock speaker pin */
6071 {}
6072 };
7bba2157
TI
6073
6074 switch (action) {
6075 case HDA_FIXUP_ACT_PRE_PROBE:
1c76aa5f 6076 spec->init_amp = ALC_INIT_DEFAULT;
ae065f1c
TI
6077 /* TX300 needs to set up GPIO2 for the speaker amp */
6078 alc_setup_gpio(codec, 0x04);
7bba2157
TI
6079 snd_hda_apply_pincfgs(codec, dock_pins);
6080 spec->gen.auto_mute_via_amp = 1;
6081 spec->gen.automute_hook = asus_tx300_automute;
6082 snd_hda_jack_detect_enable_callback(codec, 0x1b,
7bba2157
TI
6083 snd_hda_gen_hp_automute);
6084 break;
5579cd6f
TI
6085 case HDA_FIXUP_ACT_PROBE:
6086 spec->init_amp = ALC_INIT_DEFAULT;
6087 break;
7bba2157
TI
6088 case HDA_FIXUP_ACT_BUILD:
6089 /* this is a bit tricky; give more sane names for the main
6090 * (tablet) speaker and the dock speaker, respectively
6091 */
56798e6b
TI
6092 rename_ctl(codec, "Speaker Playback Switch",
6093 "Dock Speaker Playback Switch");
6094 rename_ctl(codec, "Bass Speaker Playback Switch",
6095 "Speaker Playback Switch");
7bba2157
TI
6096 break;
6097 }
6098}
6099
338cae56
DH
6100static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6101 const struct hda_fixup *fix, int action)
6102{
0f4881dc
DH
6103 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6104 /* DAC node 0x03 is giving mono output. We therefore want to
6105 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6106 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
caf3c043
MM
6107 static const hda_nid_t conn1[] = { 0x0c };
6108 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6109 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
0f4881dc 6110 }
338cae56
DH
6111}
6112
dd9aa335
HW
6113static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6114 const struct hda_fixup *fix, int action)
6115{
6116 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6117 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6118 we can't adjust the speaker's volume since this node does not has
6119 Amp-out capability. we change the speaker's route to:
6120 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6121 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6122 speaker's volume now. */
6123
caf3c043
MM
6124 static const hda_nid_t conn1[] = { 0x0c };
6125 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
dd9aa335
HW
6126 }
6127}
6128
e312a869
TI
6129/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6130static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6131 const struct hda_fixup *fix, int action)
6132{
6133 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
6134 static const hda_nid_t conn[] = { 0x02, 0x03 };
6135 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
e312a869
TI
6136 }
6137}
6138
d2cd795c
JK
6139/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6140static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6141 const struct hda_fixup *fix, int action)
6142{
6143 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
6144 static const hda_nid_t conn[] = { 0x02 };
6145 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
d2cd795c
JK
6146 }
6147}
6148
98973f2f
KP
6149/* Hook to update amp GPIO4 for automute */
6150static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6151 struct hda_jack_callback *jack)
6152{
6153 struct alc_spec *spec = codec->spec;
6154
6155 snd_hda_gen_hp_automute(codec, jack);
6156 /* mute_led_polarity is set to 0, so we pass inverted value here */
dbd13179
KHF
6157 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6158 !spec->gen.hp_jack_present);
98973f2f
KP
6159}
6160
6161/* Manage GPIOs for HP EliteBook Folio 9480m.
6162 *
6163 * GPIO4 is the headphone amplifier power control
6164 * GPIO3 is the audio output mute indicator LED
6165 */
6166
6167static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6168 const struct hda_fixup *fix,
6169 int action)
6170{
6171 struct alc_spec *spec = codec->spec;
98973f2f 6172
01e4a275 6173 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
98973f2f 6174 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
6175 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6176 spec->gpio_mask |= 0x10;
6177 spec->gpio_dir |= 0x10;
98973f2f 6178 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
98973f2f
KP
6179 }
6180}
6181
ae065f1c
TI
6182static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6183 const struct hda_fixup *fix,
6184 int action)
6185{
6186 struct alc_spec *spec = codec->spec;
6187
6188 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6189 spec->gpio_mask |= 0x04;
6190 spec->gpio_dir |= 0x04;
6191 /* set data bit low */
6192 }
6193}
6194
6a6660d0
TI
6195/* Quirk for Thinkpad X1 7th and 8th Gen
6196 * The following fixed routing needed
6197 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6198 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6199 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6200 */
6201static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6202 const struct hda_fixup *fix, int action)
6203{
6204 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6205 static const hda_nid_t preferred_pairs[] = {
6206 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6207 };
6208 struct alc_spec *spec = codec->spec;
6209
6210 switch (action) {
6211 case HDA_FIXUP_ACT_PRE_PROBE:
6212 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6213 spec->gen.preferred_dacs = preferred_pairs;
6214 break;
6215 case HDA_FIXUP_ACT_BUILD:
6216 /* The generic parser creates somewhat unintuitive volume ctls
6217 * with the fixed routing above, and the shared DAC2 may be
6218 * confusing for PA.
6219 * Rename those to unique names so that PA doesn't touch them
6220 * and use only Master volume.
6221 */
6222 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6223 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6224 break;
6225 }
6226}
6227
ca169cc2
KY
6228static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6229 const struct hda_fixup *fix,
6230 int action)
6231{
6232 alc_fixup_dual_codecs(codec, fix, action);
6233 switch (action) {
6234 case HDA_FIXUP_ACT_PRE_PROBE:
6235 /* override card longname to provide a unique UCM profile */
6236 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6237 break;
6238 case HDA_FIXUP_ACT_BUILD:
6239 /* rename Capture controls depending on the codec */
6240 rename_ctl(codec, "Capture Volume",
6241 codec->addr == 0 ?
6242 "Rear-Panel Capture Volume" :
6243 "Front-Panel Capture Volume");
6244 rename_ctl(codec, "Capture Switch",
6245 codec->addr == 0 ?
6246 "Rear-Panel Capture Switch" :
6247 "Front-Panel Capture Switch");
6248 break;
6249 }
6250}
6251
52e4e368
KHF
6252static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6253 const struct hda_fixup *fix, int action)
6254{
6255 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6256 return;
6257
6258 codec->power_save_node = 1;
6259}
6260
92266651
KY
6261/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6262static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6263 const struct hda_fixup *fix, int action)
6264{
6265 struct alc_spec *spec = codec->spec;
caf3c043 6266 static const hda_nid_t preferred_pairs[] = {
92266651
KY
6267 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6268 0
6269 };
6270
6271 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6272 return;
6273
6274 spec->gen.preferred_dacs = preferred_pairs;
0700d3d1
KY
6275 spec->gen.auto_mute_via_amp = 1;
6276 codec->power_save_node = 0;
92266651
KY
6277}
6278
c84bfedc
TI
6279/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6280static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6281 const struct hda_fixup *fix, int action)
6282{
6283 static const hda_nid_t preferred_pairs[] = {
6284 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6285 };
6286 struct alc_spec *spec = codec->spec;
6287
6288 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6289 spec->gen.preferred_dacs = preferred_pairs;
6290 spec->gen.obey_preferred_dacs = 1;
6291 }
6292}
6293
c4cfcf6f
HW
6294/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6295static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6296 const struct hda_fixup *fix, int action)
6297{
6298 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6299 return;
6300
6301 snd_hda_override_wcaps(codec, 0x03, 0);
6302}
6303
8a8de09c
KY
6304static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6305{
6306 switch (codec->core.vendor_id) {
6307 case 0x10ec0274:
6308 case 0x10ec0294:
6309 case 0x10ec0225:
6310 case 0x10ec0295:
6311 case 0x10ec0299:
6312 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6313 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6314 break;
1948fc06 6315 case 0x10ec0230:
8a8de09c
KY
6316 case 0x10ec0235:
6317 case 0x10ec0236:
6318 case 0x10ec0255:
6319 case 0x10ec0256:
6320 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6321 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6322 break;
6323 }
6324}
6325
8983eb60
KY
6326static void alc295_fixup_chromebook(struct hda_codec *codec,
6327 const struct hda_fixup *fix, int action)
6328{
d3ba58bb
KY
6329 struct alc_spec *spec = codec->spec;
6330
8983eb60 6331 switch (action) {
d3ba58bb
KY
6332 case HDA_FIXUP_ACT_PRE_PROBE:
6333 spec->ultra_low_power = true;
6334 break;
8983eb60 6335 case HDA_FIXUP_ACT_INIT:
8a8de09c 6336 alc_combo_jack_hp_jd_restart(codec);
8983eb60
KY
6337 break;
6338 }
6339}
6340
d1dd4211
KY
6341static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6342 const struct hda_fixup *fix, int action)
6343{
6344 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6345 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6346}
6347
c3cdf189
LJ
6348
6349static void alc294_gx502_toggle_output(struct hda_codec *codec,
6350 struct hda_jack_callback *cb)
6351{
6352 /* The Windows driver sets the codec up in a very different way where
6353 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6354 */
6355 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6356 alc_write_coef_idx(codec, 0x10, 0x8a20);
6357 else
6358 alc_write_coef_idx(codec, 0x10, 0x0a20);
6359}
6360
6361static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6362 const struct hda_fixup *fix, int action)
6363{
6364 /* Pin 0x21: headphones/headset mic */
6365 if (!is_jack_detectable(codec, 0x21))
6366 return;
6367
6368 switch (action) {
6369 case HDA_FIXUP_ACT_PRE_PROBE:
6370 snd_hda_jack_detect_enable_callback(codec, 0x21,
6371 alc294_gx502_toggle_output);
6372 break;
6373 case HDA_FIXUP_ACT_INIT:
6374 /* Make sure to start in a correct state, i.e. if
6375 * headphones have been plugged in before powering up the system
6376 */
6377 alc294_gx502_toggle_output(codec, NULL);
6378 break;
6379 }
6380}
6381
c1b55029
DC
6382static void alc294_gu502_toggle_output(struct hda_codec *codec,
6383 struct hda_jack_callback *cb)
6384{
6385 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6386 * responsible from changes between speakers and headphones
6387 */
6388 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6389 alc_write_coef_idx(codec, 0x10, 0x8420);
6390 else
6391 alc_write_coef_idx(codec, 0x10, 0x0a20);
6392}
6393
6394static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6395 const struct hda_fixup *fix, int action)
6396{
6397 if (!is_jack_detectable(codec, 0x21))
6398 return;
6399
6400 switch (action) {
6401 case HDA_FIXUP_ACT_PRE_PROBE:
6402 snd_hda_jack_detect_enable_callback(codec, 0x21,
6403 alc294_gu502_toggle_output);
6404 break;
6405 case HDA_FIXUP_ACT_INIT:
6406 alc294_gu502_toggle_output(codec, NULL);
6407 break;
6408 }
6409}
6410
56496253
KY
6411static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6412 const struct hda_fixup *fix, int action)
6413{
6414 if (action != HDA_FIXUP_ACT_INIT)
6415 return;
6416
6417 msleep(100);
6418 alc_write_coef_idx(codec, 0x65, 0x0);
6419}
6420
8a8de09c
KY
6421static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6422 const struct hda_fixup *fix, int action)
6423{
6424 switch (action) {
6425 case HDA_FIXUP_ACT_INIT:
6426 alc_combo_jack_hp_jd_restart(codec);
6427 break;
6428 }
6429}
6430
92666d45
KY
6431static void alc_fixup_no_int_mic(struct hda_codec *codec,
6432 const struct hda_fixup *fix, int action)
6433{
6434 struct alc_spec *spec = codec->spec;
6435
6436 switch (action) {
6437 case HDA_FIXUP_ACT_PRE_PROBE:
6438 /* Mic RING SLEEVE swap for combo jack */
6439 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6440 spec->no_internal_mic_pin = true;
6441 break;
6442 case HDA_FIXUP_ACT_INIT:
6443 alc_combo_jack_hp_jd_restart(codec);
6444 break;
6445 }
6446}
6447
d94befbb
DB
6448/* GPIO1 = amplifier on/off
6449 * GPIO3 = mic mute LED
6450 */
6451static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6452 const struct hda_fixup *fix, int action)
6453{
6454 static const hda_nid_t conn[] = { 0x02 };
6455
6456 struct alc_spec *spec = codec->spec;
6457 static const struct hda_pintbl pincfgs[] = {
6458 { 0x14, 0x90170110 }, /* front/high speakers */
6459 { 0x17, 0x90170130 }, /* back/bass speakers */
6460 { }
6461 };
6462
6463 //enable micmute led
6464 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6465
6466 switch (action) {
6467 case HDA_FIXUP_ACT_PRE_PROBE:
6468 spec->micmute_led_polarity = 1;
6469 /* needed for amp of back speakers */
6470 spec->gpio_mask |= 0x01;
6471 spec->gpio_dir |= 0x01;
6472 snd_hda_apply_pincfgs(codec, pincfgs);
6473 /* share DAC to have unified volume control */
6474 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6475 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6476 break;
6477 case HDA_FIXUP_ACT_INIT:
6478 /* need to toggle GPIO to enable the amp of back speakers */
6479 alc_update_gpio_data(codec, 0x01, true);
6480 msleep(100);
6481 alc_update_gpio_data(codec, 0x01, false);
6482 break;
6483 }
6484}
6485
434591b2
ED
6486static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6487 const struct hda_fixup *fix, int action)
6488{
6489 static const hda_nid_t conn[] = { 0x02 };
6490 static const struct hda_pintbl pincfgs[] = {
6491 { 0x14, 0x90170110 }, /* rear speaker */
6492 { }
6493 };
6494
6495 switch (action) {
6496 case HDA_FIXUP_ACT_PRE_PROBE:
6497 snd_hda_apply_pincfgs(codec, pincfgs);
6498 /* force front speaker to DAC1 */
6499 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6500 break;
6501 }
6502}
6503
b317b032
TI
6504/* for hda_fixup_thinkpad_acpi() */
6505#include "thinkpad_helper.c"
b67ae3f1 6506
d5a6cabf
TI
6507static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6508 const struct hda_fixup *fix, int action)
6509{
6510 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6511 hda_fixup_thinkpad_acpi(codec, fix, action);
6512}
6513
ad7cc2d4
CB
6514/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6515static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6516 const struct hda_fixup *fix,
6517 int action)
6518{
6519 struct alc_spec *spec = codec->spec;
6520
6521 switch (action) {
6522 case HDA_FIXUP_ACT_PRE_PROBE:
6523 spec->gen.suppress_auto_mute = 1;
6524 break;
6525 }
6526}
6527
bbf8ff6b
TB
6528/* for alc295_fixup_hp_top_speakers */
6529#include "hp_x360_helper.c"
6530
26928ca1
TI
6531/* for alc285_fixup_ideapad_s740_coef() */
6532#include "ideapad_s740_helper.c"
6533
b9145ede
WS
6534static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6535 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6536 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6537 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6538 {}
6539};
6540
6541static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6542 const struct hda_fixup *fix,
6543 int action)
dd6dd6e3
WS
6544{
6545 /*
b9145ede
WS
6546 * A certain other OS sets these coeffs to different values. On at least
6547 * one TongFang barebone these settings might survive even a cold
6548 * reboot. So to restore a clean slate the values are explicitly reset
6549 * to default here. Without this, the external microphone is always in a
6550 * plugged-in state, while the internal microphone is always in an
6551 * unplugged state, breaking the ability to use the internal microphone.
6552 */
6553 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
dd6dd6e3
WS
6554}
6555
e1abacd3
WS
6556static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6557 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6558 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6559 WRITE_COEF(0x49, 0x0149),
6560 {}
6561};
6562
6563static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6564 const struct hda_fixup *fix,
6565 int action)
6566{
6567 /*
6568 * The audio jack input and output is not detected on the ASRock NUC Box
6569 * 1100 series when cold booting without this fix. Warm rebooting from a
6570 * certain other OS makes the audio functional, as COEF settings are
6571 * preserved in this case. This fix sets these altered COEF values as
6572 * the default.
6573 */
6574 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6575}
6576
f2ca7e35
WS
6577static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6578 const struct hda_fixup *fix,
6579 int action)
6580{
6581 /*
6582 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6583 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6584 * needs an additional quirk for sound working after suspend and resume.
6585 */
6586 if (codec->core.vendor_id == 0x10ec0256) {
6587 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6588 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6589 } else {
6590 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6591 }
6592}
6593
1d045db9 6594enum {
f73bbf63 6595 ALC269_FIXUP_GPIO2,
1d045db9
TI
6596 ALC269_FIXUP_SONY_VAIO,
6597 ALC275_FIXUP_SONY_VAIO_GPIO2,
6598 ALC269_FIXUP_DELL_M101Z,
6599 ALC269_FIXUP_SKU_IGNORE,
6600 ALC269_FIXUP_ASUS_G73JW,
6601 ALC269_FIXUP_LENOVO_EAPD,
6602 ALC275_FIXUP_SONY_HWEQ,
e9bd7d5c 6603 ALC275_FIXUP_SONY_DISABLE_AAMIX,
1d045db9 6604 ALC271_FIXUP_DMIC,
017f2a10 6605 ALC269_FIXUP_PCM_44K,
adabb3ec 6606 ALC269_FIXUP_STEREO_DMIC,
7c478f03 6607 ALC269_FIXUP_HEADSET_MIC,
24519911
TI
6608 ALC269_FIXUP_QUANTA_MUTE,
6609 ALC269_FIXUP_LIFEBOOK,
2041d564 6610 ALC269_FIXUP_LIFEBOOK_EXTMIC,
cc7016ab 6611 ALC269_FIXUP_LIFEBOOK_HP_PIN,
4df3fd17 6612 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
fdcc968a 6613 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
a4297b5d
TI
6614 ALC269_FIXUP_AMIC,
6615 ALC269_FIXUP_DMIC,
6616 ALC269VB_FIXUP_AMIC,
6617 ALC269VB_FIXUP_DMIC,
08fb0d0e 6618 ALC269_FIXUP_HP_MUTE_LED,
d06ac143 6619 ALC269_FIXUP_HP_MUTE_LED_MIC1,
08fb0d0e 6620 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7f783bd5 6621 ALC269_FIXUP_HP_MUTE_LED_MIC3,
9f5c6faf 6622 ALC269_FIXUP_HP_GPIO_LED,
9c5dc3bf
KY
6623 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6624 ALC269_FIXUP_HP_LINE1_MIC1_LED,
693b613d 6625 ALC269_FIXUP_INV_DMIC,
108cc108 6626 ALC269_FIXUP_LENOVO_DOCK,
b590b38c 6627 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
9b745ab8 6628 ALC269_FIXUP_NO_SHUTUP,
88cfcf86 6629 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
108cc108 6630 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
73bdd597
DH
6631 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6632 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
338cae56 6633 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
fcc6c877 6634 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
73bdd597
DH
6635 ALC269_FIXUP_HEADSET_MODE,
6636 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7819717b 6637 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
d240d1dc
DH
6638 ALC269_FIXUP_ASUS_X101_FUNC,
6639 ALC269_FIXUP_ASUS_X101_VERB,
6640 ALC269_FIXUP_ASUS_X101,
08a978db
DR
6641 ALC271_FIXUP_AMIC_MIC2,
6642 ALC271_FIXUP_HP_GATE_MIC_JACK,
b1e8972e 6643 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
42397004 6644 ALC269_FIXUP_ACER_AC700,
3e0d611b 6645 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
2cede303 6646 ALC269VB_FIXUP_ASUS_ZENBOOK,
23870831 6647 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
8e35cd4a 6648 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
02b504d9 6649 ALC269VB_FIXUP_ORDISSIMO_EVE2,
cd217a63 6650 ALC283_FIXUP_CHROME_BOOK,
0202e99c 6651 ALC283_FIXUP_SENSE_COMBO_JACK,
7bba2157 6652 ALC282_FIXUP_ASUS_TX300,
1bb3e062 6653 ALC283_FIXUP_INT_MIC,
338cae56 6654 ALC290_FIXUP_MONO_SPEAKERS,
0f4881dc
DH
6655 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6656 ALC290_FIXUP_SUBWOOFER,
6657 ALC290_FIXUP_SUBWOOFER_HSJACK,
b67ae3f1 6658 ALC269_FIXUP_THINKPAD_ACPI,
56f27013 6659 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5824ce8d 6660 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
615966ad 6661 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9a22a8f5 6662 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
31278997 6663 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9a22a8f5 6664 ALC255_FIXUP_HEADSET_MODE,
31278997 6665 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
a22aa26f 6666 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
1c37c223 6667 ALC292_FIXUP_TPT440_DOCK,
9a811230 6668 ALC292_FIXUP_TPT440,
abaa2274 6669 ALC283_FIXUP_HEADSET_MIC,
b3802783 6670 ALC255_FIXUP_MIC_MUTE_LED,
1a22e775 6671 ALC282_FIXUP_ASPIRE_V5_PINS,
c8426b27 6672 ALC269VB_FIXUP_ASPIRE_E1_COEF,
7a5255f1 6673 ALC280_FIXUP_HP_GPIO4,
eaa8e5ef 6674 ALC286_FIXUP_HP_GPIO_LED,
33f4acd3 6675 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
b4b33f9d 6676 ALC280_FIXUP_HP_DOCK_PINS,
04d5466a 6677 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
98973f2f 6678 ALC280_FIXUP_HP_9480M,
c3bb2b52 6679 ALC245_FIXUP_HP_X360_AMP,
d94befbb 6680 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
e1e62b98
KY
6681 ALC288_FIXUP_DELL_HEADSET_MODE,
6682 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
831bfdf9
HW
6683 ALC288_FIXUP_DELL_XPS_13,
6684 ALC288_FIXUP_DISABLE_AAMIX,
5fab5829 6685 ALC292_FIXUP_DELL_E7X_AAMIX,
8b99aba7
TI
6686 ALC292_FIXUP_DELL_E7X,
6687 ALC292_FIXUP_DISABLE_AAMIX,
c04017ea 6688 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
54324221 6689 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
977e6276 6690 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
2f726aec 6691 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6ed1131f 6692 ALC275_FIXUP_DELL_XPS,
23adc192 6693 ALC293_FIXUP_LENOVO_SPK_NOISE,
3694cb29 6694 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
3b43b71f 6695 ALC255_FIXUP_DELL_SPK_NOISE,
d1dd4211 6696 ALC225_FIXUP_DISABLE_MIC_VREF,
2ae95577 6697 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
e312a869 6698 ALC295_FIXUP_DISABLE_DAC3,
d2cd795c 6699 ALC285_FIXUP_SPEAKER2_TO_DAC1,
f883982d 6700 ALC280_FIXUP_HP_HEADSET_MIC,
e549d190 6701 ALC221_FIXUP_HP_FRONT_MIC,
c636b95e 6702 ALC292_FIXUP_TPT460,
dd9aa335 6703 ALC298_FIXUP_SPK_VOLUME,
f86de9b1 6704 ALC298_FIXUP_LENOVO_SPK_VOLUME,
fd06c77e 6705 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
823ff161 6706 ALC269_FIXUP_ATIV_BOOK_8,
9eb5d0e6 6707 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
c1732ede
CC
6708 ALC256_FIXUP_ASUS_HEADSET_MODE,
6709 ALC256_FIXUP_ASUS_MIC,
eeed4cd1 6710 ALC256_FIXUP_ASUS_AIO_GPIO2,
216d7aeb
CC
6711 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6712 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
ca169cc2 6713 ALC233_FIXUP_LENOVO_MULTI_CODECS,
ea5c7eba 6714 ALC233_FIXUP_ACER_HEADSET_MIC,
f33f79f3 6715 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5f364135 6716 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
52e4e368 6717 ALC225_FIXUP_S3_POP_NOISE,
b84e8436 6718 ALC700_FIXUP_INTEL_REFERENCE,
92266651
KY
6719 ALC274_FIXUP_DELL_BIND_DACS,
6720 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
399c01aa 6721 ALC298_FIXUP_TPT470_DOCK_FIX,
61fcf8ec 6722 ALC298_FIXUP_TPT470_DOCK,
ae104a21 6723 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
f0ba9d69 6724 ALC255_FIXUP_DELL_HEADSET_MIC,
0fbf21c3 6725 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
a2ef03fe 6726 ALC298_FIXUP_HUAWEI_MBX_STEREO,
bbf8ff6b 6727 ALC295_FIXUP_HP_X360,
8a328ac1 6728 ALC221_FIXUP_HP_HEADSET_MIC,
c4cfcf6f 6729 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
e8ed64b0 6730 ALC295_FIXUP_HP_AUTO_MUTE,
33aaebd4 6731 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
d8ae458e 6732 ALC294_FIXUP_ASUS_MIC,
4e051106
JHP
6733 ALC294_FIXUP_ASUS_HEADSET_MIC,
6734 ALC294_FIXUP_ASUS_SPK,
89e3a568 6735 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
c8c6ee61 6736 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
cbc05fd6 6737 ALC255_FIXUP_ACER_HEADSET_MIC,
10f5b1b8 6738 ALC295_FIXUP_CHROME_BOOK,
8983eb60 6739 ALC225_FIXUP_HEADSET_JACK,
136824ef
KY
6740 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6741 ALC225_FIXUP_WYSE_AUTO_MUTE,
6742 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
667a8f73 6743 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
8c8967a7 6744 ALC256_FIXUP_ASUS_HEADSET_MIC,
e1037354 6745 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
e2a829b3 6746 ALC299_FIXUP_PREDATOR_SPK,
bd9c10bc 6747 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
e79c2269
KY
6748 ALC289_FIXUP_DELL_SPK2,
6749 ALC289_FIXUP_DUAL_SPK,
48e01504
CC
6750 ALC294_FIXUP_SPK2_TO_DAC1,
6751 ALC294_FIXUP_ASUS_DUAL_SPK,
6a6660d0 6752 ALC285_FIXUP_THINKPAD_X1_GEN7,
76f7dec0 6753 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8b33a134 6754 ALC294_FIXUP_ASUS_HPE,
1b94e59d 6755 ALC294_FIXUP_ASUS_COEF_1B,
c3cdf189
LJ
6756 ALC294_FIXUP_ASUS_GX502_HP,
6757 ALC294_FIXUP_ASUS_GX502_PINS,
6758 ALC294_FIXUP_ASUS_GX502_VERBS,
c1b55029
DC
6759 ALC294_FIXUP_ASUS_GU502_HP,
6760 ALC294_FIXUP_ASUS_GU502_PINS,
6761 ALC294_FIXUP_ASUS_GU502_VERBS,
f5a88b0a 6762 ALC285_FIXUP_HP_GPIO_LED,
431e76c3 6763 ALC285_FIXUP_HP_MUTE_LED,
e7d66cf7 6764 ALC236_FIXUP_HP_GPIO_LED,
24164f43 6765 ALC236_FIXUP_HP_MUTE_LED,
75b62ab6 6766 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
14425f1f 6767 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
9e43342b 6768 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8eae7e9b 6769 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6e15d126 6770 ALC269VC_FIXUP_ACER_HEADSET_MIC,
781c90c0 6771 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
293a92c1 6772 ALC289_FIXUP_ASUS_GA401,
4b43d05a 6773 ALC289_FIXUP_ASUS_GA502,
f50a121d 6774 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
56496253 6775 ALC285_FIXUP_HP_GPIO_AMP_INIT,
f1ec5be1
HC
6776 ALC269_FIXUP_CZC_B20,
6777 ALC269_FIXUP_CZC_TMI,
6778 ALC269_FIXUP_CZC_L101,
6779 ALC269_FIXUP_LEMOTE_A1802,
6780 ALC269_FIXUP_LEMOTE_A190X,
e2d2fded 6781 ALC256_FIXUP_INTEL_NUC8_RUGGED,
d1ee66c5
PC
6782 ALC233_FIXUP_INTEL_NUC8_DMIC,
6783 ALC233_FIXUP_INTEL_NUC8_BOOST,
73e7161e 6784 ALC256_FIXUP_INTEL_NUC10,
fc19d559 6785 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
13468bfa 6786 ALC274_FIXUP_HP_MIC,
8a8de09c 6787 ALC274_FIXUP_HP_HEADSET_MIC,
622464c8 6788 ALC274_FIXUP_HP_ENVY_GPIO,
ef9ce66f 6789 ALC256_FIXUP_ASUS_HPE,
446b8185 6790 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
a0ccbc53 6791 ALC287_FIXUP_HP_GPIO_LED,
9e885770 6792 ALC256_FIXUP_HP_HEADSET_MIC,
c47b3112 6793 ALC245_FIXUP_HP_GPIO_LED,
92666d45 6794 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
34cdf405 6795 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
495dc763 6796 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
d0e18561 6797 ALC256_FIXUP_ACER_HEADSET_MIC,
26928ca1 6798 ALC285_FIXUP_IDEAPAD_S740_COEF,
bd15b155 6799 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
8eedd3a7 6800 ALC295_FIXUP_ASUS_DACS,
5d84b531 6801 ALC295_FIXUP_HP_OMEN,
f2be77fe 6802 ALC285_FIXUP_HP_SPECTRE_X360,
9ebaef05 6803 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
29c8f40b 6804 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
57c9e21a 6805 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
8903376d 6806 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
ad7cc2d4
CB
6807 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6808 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6809 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
dd6dd6e3 6810 ALC287_FIXUP_13S_GEN2_SPEAKERS,
b9145ede 6811 ALC256_FIXUP_SET_COEF_DEFAULTS,
4803b99a 6812 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
e1abacd3 6813 ALC233_FIXUP_NO_AUDIO_JACK,
f2ca7e35 6814 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
e7e2503a
BF
6815 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
6816 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
f1d4e28b
KY
6817};
6818
1727a771 6819static const struct hda_fixup alc269_fixups[] = {
f73bbf63
KHF
6820 [ALC269_FIXUP_GPIO2] = {
6821 .type = HDA_FIXUP_FUNC,
6822 .v.func = alc_fixup_gpio2,
6823 },
1d045db9 6824 [ALC269_FIXUP_SONY_VAIO] = {
fd108215
TI
6825 .type = HDA_FIXUP_PINCTLS,
6826 .v.pins = (const struct hda_pintbl[]) {
6827 {0x19, PIN_VREFGRD},
1d045db9
TI
6828 {}
6829 }
f1d4e28b 6830 },
1d045db9 6831 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
ae065f1c
TI
6832 .type = HDA_FIXUP_FUNC,
6833 .v.func = alc275_fixup_gpio4_off,
1d045db9
TI
6834 .chained = true,
6835 .chain_id = ALC269_FIXUP_SONY_VAIO
6836 },
6837 [ALC269_FIXUP_DELL_M101Z] = {
1727a771 6838 .type = HDA_FIXUP_VERBS,
1d045db9
TI
6839 .v.verbs = (const struct hda_verb[]) {
6840 /* Enables internal speaker */
6841 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6842 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6843 {}
6844 }
6845 },
6846 [ALC269_FIXUP_SKU_IGNORE] = {
1727a771 6847 .type = HDA_FIXUP_FUNC,
23d30f28 6848 .v.func = alc_fixup_sku_ignore,
1d045db9
TI
6849 },
6850 [ALC269_FIXUP_ASUS_G73JW] = {
1727a771
TI
6851 .type = HDA_FIXUP_PINS,
6852 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
6853 { 0x17, 0x99130111 }, /* subwoofer */
6854 { }
6855 }
6856 },
6857 [ALC269_FIXUP_LENOVO_EAPD] = {
1727a771 6858 .type = HDA_FIXUP_VERBS,
1d045db9
TI
6859 .v.verbs = (const struct hda_verb[]) {
6860 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6861 {}
6862 }
6863 },
6864 [ALC275_FIXUP_SONY_HWEQ] = {
1727a771 6865 .type = HDA_FIXUP_FUNC,
1d045db9
TI
6866 .v.func = alc269_fixup_hweq,
6867 .chained = true,
6868 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6869 },
e9bd7d5c
TI
6870 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6871 .type = HDA_FIXUP_FUNC,
6872 .v.func = alc_fixup_disable_aamix,
6873 .chained = true,
6874 .chain_id = ALC269_FIXUP_SONY_VAIO
6875 },
1d045db9 6876 [ALC271_FIXUP_DMIC] = {
1727a771 6877 .type = HDA_FIXUP_FUNC,
1d045db9 6878 .v.func = alc271_fixup_dmic,
f1d4e28b 6879 },
017f2a10 6880 [ALC269_FIXUP_PCM_44K] = {
1727a771 6881 .type = HDA_FIXUP_FUNC,
017f2a10 6882 .v.func = alc269_fixup_pcm_44k,
012e7eb1
DH
6883 .chained = true,
6884 .chain_id = ALC269_FIXUP_QUANTA_MUTE
017f2a10 6885 },
adabb3ec 6886 [ALC269_FIXUP_STEREO_DMIC] = {
1727a771 6887 .type = HDA_FIXUP_FUNC,
adabb3ec
TI
6888 .v.func = alc269_fixup_stereo_dmic,
6889 },
7c478f03
DH
6890 [ALC269_FIXUP_HEADSET_MIC] = {
6891 .type = HDA_FIXUP_FUNC,
6892 .v.func = alc269_fixup_headset_mic,
6893 },
24519911 6894 [ALC269_FIXUP_QUANTA_MUTE] = {
1727a771 6895 .type = HDA_FIXUP_FUNC,
24519911
TI
6896 .v.func = alc269_fixup_quanta_mute,
6897 },
6898 [ALC269_FIXUP_LIFEBOOK] = {
1727a771
TI
6899 .type = HDA_FIXUP_PINS,
6900 .v.pins = (const struct hda_pintbl[]) {
24519911
TI
6901 { 0x1a, 0x2101103f }, /* dock line-out */
6902 { 0x1b, 0x23a11040 }, /* dock mic-in */
6903 { }
6904 },
6905 .chained = true,
6906 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6907 },
2041d564
DH
6908 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6909 .type = HDA_FIXUP_PINS,
6910 .v.pins = (const struct hda_pintbl[]) {
6911 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6912 { }
6913 },
6914 },
cc7016ab
TI
6915 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6916 .type = HDA_FIXUP_PINS,
6917 .v.pins = (const struct hda_pintbl[]) {
6918 { 0x21, 0x0221102f }, /* HP out */
6919 { }
6920 },
6921 },
4df3fd17
TI
6922 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6923 .type = HDA_FIXUP_FUNC,
6924 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6925 },
fdcc968a
JMG
6926 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6927 .type = HDA_FIXUP_FUNC,
6928 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6929 },
a4297b5d 6930 [ALC269_FIXUP_AMIC] = {
1727a771
TI
6931 .type = HDA_FIXUP_PINS,
6932 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6933 { 0x14, 0x99130110 }, /* speaker */
6934 { 0x15, 0x0121401f }, /* HP out */
6935 { 0x18, 0x01a19c20 }, /* mic */
6936 { 0x19, 0x99a3092f }, /* int-mic */
6937 { }
6938 },
6939 },
6940 [ALC269_FIXUP_DMIC] = {
1727a771
TI
6941 .type = HDA_FIXUP_PINS,
6942 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6943 { 0x12, 0x99a3092f }, /* int-mic */
6944 { 0x14, 0x99130110 }, /* speaker */
6945 { 0x15, 0x0121401f }, /* HP out */
6946 { 0x18, 0x01a19c20 }, /* mic */
6947 { }
6948 },
6949 },
6950 [ALC269VB_FIXUP_AMIC] = {
1727a771
TI
6951 .type = HDA_FIXUP_PINS,
6952 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6953 { 0x14, 0x99130110 }, /* speaker */
6954 { 0x18, 0x01a19c20 }, /* mic */
6955 { 0x19, 0x99a3092f }, /* int-mic */
6956 { 0x21, 0x0121401f }, /* HP out */
6957 { }
6958 },
6959 },
2267ea97 6960 [ALC269VB_FIXUP_DMIC] = {
1727a771
TI
6961 .type = HDA_FIXUP_PINS,
6962 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6963 { 0x12, 0x99a3092f }, /* int-mic */
6964 { 0x14, 0x99130110 }, /* speaker */
6965 { 0x18, 0x01a19c20 }, /* mic */
6966 { 0x21, 0x0121401f }, /* HP out */
6967 { }
6968 },
6969 },
08fb0d0e 6970 [ALC269_FIXUP_HP_MUTE_LED] = {
1727a771 6971 .type = HDA_FIXUP_FUNC,
08fb0d0e 6972 .v.func = alc269_fixup_hp_mute_led,
6d3cd5d4 6973 },
d06ac143
DH
6974 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6975 .type = HDA_FIXUP_FUNC,
6976 .v.func = alc269_fixup_hp_mute_led_mic1,
6977 },
08fb0d0e 6978 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
1727a771 6979 .type = HDA_FIXUP_FUNC,
08fb0d0e 6980 .v.func = alc269_fixup_hp_mute_led_mic2,
420b0feb 6981 },
7f783bd5
TB
6982 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6983 .type = HDA_FIXUP_FUNC,
6984 .v.func = alc269_fixup_hp_mute_led_mic3,
e8ed64b0
GKK
6985 .chained = true,
6986 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7f783bd5 6987 },
9f5c6faf
TI
6988 [ALC269_FIXUP_HP_GPIO_LED] = {
6989 .type = HDA_FIXUP_FUNC,
6990 .v.func = alc269_fixup_hp_gpio_led,
6991 },
9c5dc3bf
KY
6992 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6993 .type = HDA_FIXUP_FUNC,
6994 .v.func = alc269_fixup_hp_gpio_mic1_led,
6995 },
6996 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6997 .type = HDA_FIXUP_FUNC,
6998 .v.func = alc269_fixup_hp_line1_mic1_led,
6999 },
693b613d 7000 [ALC269_FIXUP_INV_DMIC] = {
1727a771 7001 .type = HDA_FIXUP_FUNC,
9d36a7dc 7002 .v.func = alc_fixup_inv_dmic,
693b613d 7003 },
9b745ab8
TI
7004 [ALC269_FIXUP_NO_SHUTUP] = {
7005 .type = HDA_FIXUP_FUNC,
7006 .v.func = alc_fixup_no_shutup,
7007 },
108cc108 7008 [ALC269_FIXUP_LENOVO_DOCK] = {
1727a771
TI
7009 .type = HDA_FIXUP_PINS,
7010 .v.pins = (const struct hda_pintbl[]) {
108cc108
DH
7011 { 0x19, 0x23a11040 }, /* dock mic */
7012 { 0x1b, 0x2121103f }, /* dock headphone */
7013 { }
7014 },
7015 .chained = true,
7016 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7017 },
b590b38c
TI
7018 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7019 .type = HDA_FIXUP_FUNC,
7020 .v.func = alc269_fixup_limit_int_mic_boost,
7021 .chained = true,
7022 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7023 },
108cc108 7024 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
1727a771 7025 .type = HDA_FIXUP_FUNC,
108cc108 7026 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
52129000
DH
7027 .chained = true,
7028 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
108cc108 7029 },
73bdd597
DH
7030 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7031 .type = HDA_FIXUP_PINS,
7032 .v.pins = (const struct hda_pintbl[]) {
7033 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7034 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7035 { }
7036 },
7037 .chained = true,
7038 .chain_id = ALC269_FIXUP_HEADSET_MODE
7039 },
7040 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7041 .type = HDA_FIXUP_PINS,
7042 .v.pins = (const struct hda_pintbl[]) {
7043 { 0x16, 0x21014020 }, /* dock line out */
7044 { 0x19, 0x21a19030 }, /* dock mic */
7045 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7046 { }
7047 },
7048 .chained = true,
7049 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7050 },
338cae56
DH
7051 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7052 .type = HDA_FIXUP_PINS,
7053 .v.pins = (const struct hda_pintbl[]) {
7054 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7055 { }
7056 },
7057 .chained = true,
7058 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7059 },
fcc6c877
KY
7060 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7061 .type = HDA_FIXUP_PINS,
7062 .v.pins = (const struct hda_pintbl[]) {
7063 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7064 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7065 { }
7066 },
7067 .chained = true,
7068 .chain_id = ALC269_FIXUP_HEADSET_MODE
7069 },
73bdd597
DH
7070 [ALC269_FIXUP_HEADSET_MODE] = {
7071 .type = HDA_FIXUP_FUNC,
7072 .v.func = alc_fixup_headset_mode,
6676f308 7073 .chained = true,
b3802783 7074 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
73bdd597
DH
7075 },
7076 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7077 .type = HDA_FIXUP_FUNC,
7078 .v.func = alc_fixup_headset_mode_no_hp_mic,
7079 },
7819717b
TI
7080 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7081 .type = HDA_FIXUP_PINS,
7082 .v.pins = (const struct hda_pintbl[]) {
7083 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7084 { }
7085 },
7086 .chained = true,
7087 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7088 },
88cfcf86
DH
7089 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7090 .type = HDA_FIXUP_PINS,
7091 .v.pins = (const struct hda_pintbl[]) {
7092 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7093 { }
7094 },
fbc78ad6
DH
7095 .chained = true,
7096 .chain_id = ALC269_FIXUP_HEADSET_MIC
88cfcf86 7097 },
0fbf21c3 7098 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8ac51bbc
AB
7099 .type = HDA_FIXUP_PINS,
7100 .v.pins = (const struct hda_pintbl[]) {
7101 {0x12, 0x90a60130},
7102 {0x13, 0x40000000},
7103 {0x14, 0x90170110},
7104 {0x18, 0x411111f0},
7105 {0x19, 0x04a11040},
7106 {0x1a, 0x411111f0},
7107 {0x1b, 0x90170112},
7108 {0x1d, 0x40759a05},
7109 {0x1e, 0x411111f0},
7110 {0x21, 0x04211020},
7111 { }
7112 },
e2744fd7
AB
7113 .chained = true,
7114 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8ac51bbc 7115 },
a2ef03fe
TE
7116 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7117 .type = HDA_FIXUP_FUNC,
7118 .v.func = alc298_fixup_huawei_mbx_stereo,
7119 .chained = true,
7120 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7121 },
d240d1dc
DH
7122 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7123 .type = HDA_FIXUP_FUNC,
7124 .v.func = alc269_fixup_x101_headset_mic,
7125 },
7126 [ALC269_FIXUP_ASUS_X101_VERB] = {
7127 .type = HDA_FIXUP_VERBS,
7128 .v.verbs = (const struct hda_verb[]) {
7129 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7130 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7131 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7132 { }
7133 },
7134 .chained = true,
7135 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7136 },
7137 [ALC269_FIXUP_ASUS_X101] = {
7138 .type = HDA_FIXUP_PINS,
7139 .v.pins = (const struct hda_pintbl[]) {
7140 { 0x18, 0x04a1182c }, /* Headset mic */
7141 { }
7142 },
7143 .chained = true,
7144 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7145 },
08a978db 7146 [ALC271_FIXUP_AMIC_MIC2] = {
1727a771
TI
7147 .type = HDA_FIXUP_PINS,
7148 .v.pins = (const struct hda_pintbl[]) {
08a978db
DR
7149 { 0x14, 0x99130110 }, /* speaker */
7150 { 0x19, 0x01a19c20 }, /* mic */
7151 { 0x1b, 0x99a7012f }, /* int-mic */
7152 { 0x21, 0x0121401f }, /* HP out */
7153 { }
7154 },
7155 },
7156 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
1727a771 7157 .type = HDA_FIXUP_FUNC,
08a978db
DR
7158 .v.func = alc271_hp_gate_mic_jack,
7159 .chained = true,
7160 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7161 },
b1e8972e
OR
7162 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7163 .type = HDA_FIXUP_FUNC,
7164 .v.func = alc269_fixup_limit_int_mic_boost,
7165 .chained = true,
7166 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7167 },
42397004
DR
7168 [ALC269_FIXUP_ACER_AC700] = {
7169 .type = HDA_FIXUP_PINS,
7170 .v.pins = (const struct hda_pintbl[]) {
7171 { 0x12, 0x99a3092f }, /* int-mic */
7172 { 0x14, 0x99130110 }, /* speaker */
7173 { 0x18, 0x03a11c20 }, /* mic */
7174 { 0x1e, 0x0346101e }, /* SPDIF1 */
7175 { 0x21, 0x0321101f }, /* HP out */
7176 { }
7177 },
7178 .chained = true,
7179 .chain_id = ALC271_FIXUP_DMIC,
7180 },
3e0d611b
DH
7181 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7182 .type = HDA_FIXUP_FUNC,
7183 .v.func = alc269_fixup_limit_int_mic_boost,
2793769f
DH
7184 .chained = true,
7185 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
3e0d611b 7186 },
2cede303
OR
7187 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7188 .type = HDA_FIXUP_FUNC,
7189 .v.func = alc269_fixup_limit_int_mic_boost,
7190 .chained = true,
7191 .chain_id = ALC269VB_FIXUP_DMIC,
7192 },
23870831
TI
7193 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7194 .type = HDA_FIXUP_VERBS,
7195 .v.verbs = (const struct hda_verb[]) {
7196 /* class-D output amp +5dB */
7197 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7198 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7199 {}
7200 },
7201 .chained = true,
7202 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7203 },
8e35cd4a
DH
7204 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7205 .type = HDA_FIXUP_FUNC,
7206 .v.func = alc269_fixup_limit_int_mic_boost,
7207 .chained = true,
7208 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7209 },
02b504d9
AA
7210 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7211 .type = HDA_FIXUP_PINS,
7212 .v.pins = (const struct hda_pintbl[]) {
7213 { 0x12, 0x99a3092f }, /* int-mic */
7214 { 0x18, 0x03a11d20 }, /* mic */
7215 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7216 { }
7217 },
7218 },
cd217a63
KY
7219 [ALC283_FIXUP_CHROME_BOOK] = {
7220 .type = HDA_FIXUP_FUNC,
7221 .v.func = alc283_fixup_chromebook,
7222 },
0202e99c
KY
7223 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7224 .type = HDA_FIXUP_FUNC,
7225 .v.func = alc283_fixup_sense_combo_jack,
7226 .chained = true,
7227 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7228 },
7bba2157
TI
7229 [ALC282_FIXUP_ASUS_TX300] = {
7230 .type = HDA_FIXUP_FUNC,
7231 .v.func = alc282_fixup_asus_tx300,
7232 },
1bb3e062
KY
7233 [ALC283_FIXUP_INT_MIC] = {
7234 .type = HDA_FIXUP_VERBS,
7235 .v.verbs = (const struct hda_verb[]) {
7236 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7237 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7238 { }
7239 },
7240 .chained = true,
7241 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7242 },
0f4881dc
DH
7243 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7244 .type = HDA_FIXUP_PINS,
7245 .v.pins = (const struct hda_pintbl[]) {
7246 { 0x17, 0x90170112 }, /* subwoofer */
7247 { }
7248 },
7249 .chained = true,
7250 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7251 },
7252 [ALC290_FIXUP_SUBWOOFER] = {
7253 .type = HDA_FIXUP_PINS,
7254 .v.pins = (const struct hda_pintbl[]) {
7255 { 0x17, 0x90170112 }, /* subwoofer */
7256 { }
7257 },
7258 .chained = true,
7259 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7260 },
338cae56
DH
7261 [ALC290_FIXUP_MONO_SPEAKERS] = {
7262 .type = HDA_FIXUP_FUNC,
7263 .v.func = alc290_fixup_mono_speakers,
0f4881dc
DH
7264 },
7265 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7266 .type = HDA_FIXUP_FUNC,
7267 .v.func = alc290_fixup_mono_speakers,
338cae56
DH
7268 .chained = true,
7269 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7270 },
b67ae3f1
DH
7271 [ALC269_FIXUP_THINKPAD_ACPI] = {
7272 .type = HDA_FIXUP_FUNC,
d5a6cabf 7273 .v.func = alc_fixup_thinkpad_acpi,
09da111a
TI
7274 .chained = true,
7275 .chain_id = ALC269_FIXUP_SKU_IGNORE,
b67ae3f1 7276 },
56f27013
DH
7277 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7278 .type = HDA_FIXUP_FUNC,
7279 .v.func = alc_fixup_inv_dmic,
7280 .chained = true,
7281 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7282 },
5824ce8d 7283 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
17d30460
HW
7284 .type = HDA_FIXUP_PINS,
7285 .v.pins = (const struct hda_pintbl[]) {
7286 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7287 { }
5824ce8d
CC
7288 },
7289 .chained = true,
17d30460 7290 .chain_id = ALC255_FIXUP_HEADSET_MODE
5824ce8d 7291 },
615966ad
CC
7292 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7293 .type = HDA_FIXUP_PINS,
7294 .v.pins = (const struct hda_pintbl[]) {
7295 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7296 { }
7297 },
7298 .chained = true,
7299 .chain_id = ALC255_FIXUP_HEADSET_MODE
7300 },
9a22a8f5
KY
7301 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7302 .type = HDA_FIXUP_PINS,
7303 .v.pins = (const struct hda_pintbl[]) {
7304 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7305 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7306 { }
7307 },
7308 .chained = true,
7309 .chain_id = ALC255_FIXUP_HEADSET_MODE
7310 },
31278997
KY
7311 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7312 .type = HDA_FIXUP_PINS,
7313 .v.pins = (const struct hda_pintbl[]) {
7314 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7315 { }
7316 },
7317 .chained = true,
7318 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7319 },
9a22a8f5
KY
7320 [ALC255_FIXUP_HEADSET_MODE] = {
7321 .type = HDA_FIXUP_FUNC,
7322 .v.func = alc_fixup_headset_mode_alc255,
4a83d42a 7323 .chained = true,
b3802783 7324 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
9a22a8f5 7325 },
31278997
KY
7326 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7327 .type = HDA_FIXUP_FUNC,
7328 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7329 },
a22aa26f
KY
7330 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7331 .type = HDA_FIXUP_PINS,
7332 .v.pins = (const struct hda_pintbl[]) {
7333 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7334 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7335 { }
7336 },
7337 .chained = true,
7338 .chain_id = ALC269_FIXUP_HEADSET_MODE
7339 },
1c37c223 7340 [ALC292_FIXUP_TPT440_DOCK] = {
ec56af67 7341 .type = HDA_FIXUP_FUNC,
7f57d803 7342 .v.func = alc_fixup_tpt440_dock,
1c37c223
TI
7343 .chained = true,
7344 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7345 },
9a811230
TI
7346 [ALC292_FIXUP_TPT440] = {
7347 .type = HDA_FIXUP_FUNC,
157f0b7f 7348 .v.func = alc_fixup_disable_aamix,
9a811230
TI
7349 .chained = true,
7350 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7351 },
abaa2274 7352 [ALC283_FIXUP_HEADSET_MIC] = {
9dc12862
DD
7353 .type = HDA_FIXUP_PINS,
7354 .v.pins = (const struct hda_pintbl[]) {
7355 { 0x19, 0x04a110f0 },
7356 { },
7357 },
7358 },
b3802783 7359 [ALC255_FIXUP_MIC_MUTE_LED] = {
00ef9940 7360 .type = HDA_FIXUP_FUNC,
8a503555 7361 .v.func = alc_fixup_micmute_led,
00ef9940 7362 },
1a22e775
TI
7363 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7364 .type = HDA_FIXUP_PINS,
7365 .v.pins = (const struct hda_pintbl[]) {
7366 { 0x12, 0x90a60130 },
7367 { 0x14, 0x90170110 },
7368 { 0x17, 0x40000008 },
7369 { 0x18, 0x411111f0 },
0420694d 7370 { 0x19, 0x01a1913c },
1a22e775
TI
7371 { 0x1a, 0x411111f0 },
7372 { 0x1b, 0x411111f0 },
7373 { 0x1d, 0x40f89b2d },
7374 { 0x1e, 0x411111f0 },
7375 { 0x21, 0x0321101f },
7376 { },
7377 },
7378 },
c8426b27
TI
7379 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7380 .type = HDA_FIXUP_FUNC,
7381 .v.func = alc269vb_fixup_aspire_e1_coef,
7382 },
7a5255f1
DH
7383 [ALC280_FIXUP_HP_GPIO4] = {
7384 .type = HDA_FIXUP_FUNC,
7385 .v.func = alc280_fixup_hp_gpio4,
7386 },
eaa8e5ef
KY
7387 [ALC286_FIXUP_HP_GPIO_LED] = {
7388 .type = HDA_FIXUP_FUNC,
7389 .v.func = alc286_fixup_hp_gpio_led,
7390 },
33f4acd3
DH
7391 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7392 .type = HDA_FIXUP_FUNC,
7393 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7394 },
b4b33f9d
TC
7395 [ALC280_FIXUP_HP_DOCK_PINS] = {
7396 .type = HDA_FIXUP_PINS,
7397 .v.pins = (const struct hda_pintbl[]) {
7398 { 0x1b, 0x21011020 }, /* line-out */
7399 { 0x1a, 0x01a1903c }, /* headset mic */
7400 { 0x18, 0x2181103f }, /* line-in */
7401 { },
7402 },
7403 .chained = true,
7404 .chain_id = ALC280_FIXUP_HP_GPIO4
7405 },
04d5466a
JK
7406 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7407 .type = HDA_FIXUP_PINS,
7408 .v.pins = (const struct hda_pintbl[]) {
7409 { 0x1b, 0x21011020 }, /* line-out */
7410 { 0x18, 0x2181103f }, /* line-in */
7411 { },
7412 },
7413 .chained = true,
7414 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7415 },
98973f2f
KP
7416 [ALC280_FIXUP_HP_9480M] = {
7417 .type = HDA_FIXUP_FUNC,
7418 .v.func = alc280_fixup_hp_9480m,
7419 },
c3bb2b52
TI
7420 [ALC245_FIXUP_HP_X360_AMP] = {
7421 .type = HDA_FIXUP_FUNC,
7422 .v.func = alc245_fixup_hp_x360_amp,
c47b3112
JC
7423 .chained = true,
7424 .chain_id = ALC245_FIXUP_HP_GPIO_LED
c3bb2b52 7425 },
e1e62b98
KY
7426 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7427 .type = HDA_FIXUP_FUNC,
7428 .v.func = alc_fixup_headset_mode_dell_alc288,
7429 .chained = true,
b3802783 7430 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
e1e62b98
KY
7431 },
7432 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7433 .type = HDA_FIXUP_PINS,
7434 .v.pins = (const struct hda_pintbl[]) {
7435 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7436 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7437 { }
7438 },
7439 .chained = true,
7440 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7441 },
831bfdf9
HW
7442 [ALC288_FIXUP_DISABLE_AAMIX] = {
7443 .type = HDA_FIXUP_FUNC,
7444 .v.func = alc_fixup_disable_aamix,
7445 .chained = true,
d44a6864 7446 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
831bfdf9
HW
7447 },
7448 [ALC288_FIXUP_DELL_XPS_13] = {
7449 .type = HDA_FIXUP_FUNC,
7450 .v.func = alc_fixup_dell_xps13,
7451 .chained = true,
7452 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7453 },
8b99aba7
TI
7454 [ALC292_FIXUP_DISABLE_AAMIX] = {
7455 .type = HDA_FIXUP_FUNC,
7456 .v.func = alc_fixup_disable_aamix,
831bfdf9
HW
7457 .chained = true,
7458 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8b99aba7 7459 },
c04017ea
DH
7460 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7461 .type = HDA_FIXUP_FUNC,
7462 .v.func = alc_fixup_disable_aamix,
7463 .chained = true,
7464 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7465 },
5fab5829 7466 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8b99aba7
TI
7467 .type = HDA_FIXUP_FUNC,
7468 .v.func = alc_fixup_dell_xps13,
7469 .chained = true,
7470 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7471 },
5fab5829
TI
7472 [ALC292_FIXUP_DELL_E7X] = {
7473 .type = HDA_FIXUP_FUNC,
8a503555 7474 .v.func = alc_fixup_micmute_led,
5fab5829
TI
7475 /* micmute fixup must be applied at last */
7476 .chained_before = true,
7477 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7478 },
54324221
JM
7479 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7480 .type = HDA_FIXUP_PINS,
7481 .v.pins = (const struct hda_pintbl[]) {
7482 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7483 { }
7484 },
7485 .chained_before = true,
7486 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7487 },
977e6276
KY
7488 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7489 .type = HDA_FIXUP_PINS,
7490 .v.pins = (const struct hda_pintbl[]) {
7491 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7492 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7493 { }
7494 },
7495 .chained = true,
7496 .chain_id = ALC269_FIXUP_HEADSET_MODE
7497 },
2f726aec
HW
7498 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7499 .type = HDA_FIXUP_PINS,
7500 .v.pins = (const struct hda_pintbl[]) {
7501 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7502 { }
7503 },
7504 .chained = true,
7505 .chain_id = ALC269_FIXUP_HEADSET_MODE
7506 },
6ed1131f
KY
7507 [ALC275_FIXUP_DELL_XPS] = {
7508 .type = HDA_FIXUP_VERBS,
7509 .v.verbs = (const struct hda_verb[]) {
7510 /* Enables internal speaker */
7511 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7512 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7513 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7514 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7515 {}
7516 }
7517 },
23adc192
HW
7518 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7519 .type = HDA_FIXUP_FUNC,
7520 .v.func = alc_fixup_disable_aamix,
7521 .chained = true,
7522 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7523 },
3694cb29
K
7524 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7525 .type = HDA_FIXUP_FUNC,
7526 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7527 },
d1ee66c5
PC
7528 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7529 .type = HDA_FIXUP_FUNC,
7530 .v.func = alc_fixup_inv_dmic,
7531 .chained = true,
7532 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7533 },
7534 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7535 .type = HDA_FIXUP_FUNC,
7536 .v.func = alc269_fixup_limit_int_mic_boost
7537 },
3b43b71f
KHF
7538 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7539 .type = HDA_FIXUP_FUNC,
7540 .v.func = alc_fixup_disable_aamix,
7541 .chained = true,
7542 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7543 },
d1dd4211
KY
7544 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7545 .type = HDA_FIXUP_FUNC,
7546 .v.func = alc_fixup_disable_mic_vref,
7547 .chained = true,
7548 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7549 },
2ae95577
DH
7550 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7551 .type = HDA_FIXUP_VERBS,
7552 .v.verbs = (const struct hda_verb[]) {
7553 /* Disable pass-through path for FRONT 14h */
7554 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7555 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7556 {}
7557 },
7558 .chained = true,
d1dd4211 7559 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
2ae95577 7560 },
f883982d
TI
7561 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7562 .type = HDA_FIXUP_FUNC,
7563 .v.func = alc_fixup_disable_aamix,
7564 .chained = true,
7565 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7566 },
e549d190
HW
7567 [ALC221_FIXUP_HP_FRONT_MIC] = {
7568 .type = HDA_FIXUP_PINS,
7569 .v.pins = (const struct hda_pintbl[]) {
7570 { 0x19, 0x02a19020 }, /* Front Mic */
7571 { }
7572 },
7573 },
c636b95e
SE
7574 [ALC292_FIXUP_TPT460] = {
7575 .type = HDA_FIXUP_FUNC,
7576 .v.func = alc_fixup_tpt440_dock,
7577 .chained = true,
7578 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7579 },
dd9aa335
HW
7580 [ALC298_FIXUP_SPK_VOLUME] = {
7581 .type = HDA_FIXUP_FUNC,
7582 .v.func = alc298_fixup_speaker_volume,
59ec4b57 7583 .chained = true,
2f726aec 7584 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
dd9aa335 7585 },
f86de9b1
KY
7586 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7587 .type = HDA_FIXUP_FUNC,
7588 .v.func = alc298_fixup_speaker_volume,
7589 },
e312a869
TI
7590 [ALC295_FIXUP_DISABLE_DAC3] = {
7591 .type = HDA_FIXUP_FUNC,
7592 .v.func = alc295_fixup_disable_dac3,
7593 },
d2cd795c
JK
7594 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7595 .type = HDA_FIXUP_FUNC,
7596 .v.func = alc285_fixup_speaker2_to_dac1,
c37c0ab0
HW
7597 .chained = true,
7598 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
d2cd795c 7599 },
fd06c77e
KHF
7600 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7601 .type = HDA_FIXUP_PINS,
7602 .v.pins = (const struct hda_pintbl[]) {
7603 { 0x1b, 0x90170151 },
7604 { }
7605 },
7606 .chained = true,
7607 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7608 },
823ff161
GM
7609 [ALC269_FIXUP_ATIV_BOOK_8] = {
7610 .type = HDA_FIXUP_FUNC,
7611 .v.func = alc_fixup_auto_mute_via_amp,
7612 .chained = true,
7613 .chain_id = ALC269_FIXUP_NO_SHUTUP
7614 },
9eb5d0e6
KY
7615 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7616 .type = HDA_FIXUP_PINS,
7617 .v.pins = (const struct hda_pintbl[]) {
7618 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7619 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7620 { }
7621 },
7622 .chained = true,
7623 .chain_id = ALC269_FIXUP_HEADSET_MODE
7624 },
c1732ede
CC
7625 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7626 .type = HDA_FIXUP_FUNC,
7627 .v.func = alc_fixup_headset_mode,
7628 },
7629 [ALC256_FIXUP_ASUS_MIC] = {
7630 .type = HDA_FIXUP_PINS,
7631 .v.pins = (const struct hda_pintbl[]) {
7632 { 0x13, 0x90a60160 }, /* use as internal mic */
7633 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7634 { }
7635 },
7636 .chained = true,
7637 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7638 },
eeed4cd1 7639 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
ae065f1c
TI
7640 .type = HDA_FIXUP_FUNC,
7641 /* Set up GPIO2 for the speaker amp */
7642 .v.func = alc_fixup_gpio4,
eeed4cd1 7643 },
216d7aeb
CC
7644 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7645 .type = HDA_FIXUP_PINS,
7646 .v.pins = (const struct hda_pintbl[]) {
7647 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7648 { }
7649 },
7650 .chained = true,
7651 .chain_id = ALC269_FIXUP_HEADSET_MIC
7652 },
7653 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7654 .type = HDA_FIXUP_VERBS,
7655 .v.verbs = (const struct hda_verb[]) {
7656 /* Enables internal speaker */
7657 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7658 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7659 {}
7660 },
7661 .chained = true,
7662 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7663 },
ca169cc2
KY
7664 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7665 .type = HDA_FIXUP_FUNC,
7666 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
f73bbf63
KHF
7667 .chained = true,
7668 .chain_id = ALC269_FIXUP_GPIO2
ca169cc2 7669 },
ea5c7eba
JHP
7670 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7671 .type = HDA_FIXUP_VERBS,
7672 .v.verbs = (const struct hda_verb[]) {
7673 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7674 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7675 { }
7676 },
7677 .chained = true,
7678 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7679 },
f33f79f3
HW
7680 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7681 .type = HDA_FIXUP_PINS,
7682 .v.pins = (const struct hda_pintbl[]) {
7683 /* Change the mic location from front to right, otherwise there are
7684 two front mics with the same name, pulseaudio can't handle them.
7685 This is just a temporary workaround, after applying this fixup,
7686 there will be one "Front Mic" and one "Mic" in this machine.
7687 */
7688 { 0x1a, 0x04a19040 },
7689 { }
7690 },
7691 },
5f364135
KY
7692 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7693 .type = HDA_FIXUP_PINS,
7694 .v.pins = (const struct hda_pintbl[]) {
7695 { 0x16, 0x0101102f }, /* Rear Headset HP */
7696 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7697 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7698 { 0x1b, 0x02011020 },
7699 { }
7700 },
7701 .chained = true,
52e4e368
KHF
7702 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7703 },
7704 [ALC225_FIXUP_S3_POP_NOISE] = {
7705 .type = HDA_FIXUP_FUNC,
7706 .v.func = alc225_fixup_s3_pop_noise,
7707 .chained = true,
5f364135
KY
7708 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7709 },
b84e8436
PH
7710 [ALC700_FIXUP_INTEL_REFERENCE] = {
7711 .type = HDA_FIXUP_VERBS,
7712 .v.verbs = (const struct hda_verb[]) {
7713 /* Enables internal speaker */
7714 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7715 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7716 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7717 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7718 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7719 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7720 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7721 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7722 {}
7723 }
7724 },
92266651
KY
7725 [ALC274_FIXUP_DELL_BIND_DACS] = {
7726 .type = HDA_FIXUP_FUNC,
7727 .v.func = alc274_fixup_bind_dacs,
7728 .chained = true,
7729 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7730 },
7731 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7732 .type = HDA_FIXUP_PINS,
7733 .v.pins = (const struct hda_pintbl[]) {
7734 { 0x1b, 0x0401102f },
7735 { }
7736 },
7737 .chained = true,
7738 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7739 },
399c01aa 7740 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
61fcf8ec
KY
7741 .type = HDA_FIXUP_FUNC,
7742 .v.func = alc_fixup_tpt470_dock,
7743 .chained = true,
7744 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7745 },
399c01aa
TI
7746 [ALC298_FIXUP_TPT470_DOCK] = {
7747 .type = HDA_FIXUP_FUNC,
7748 .v.func = alc_fixup_tpt470_dacs,
7749 .chained = true,
7750 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7751 },
ae104a21
KY
7752 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7753 .type = HDA_FIXUP_PINS,
7754 .v.pins = (const struct hda_pintbl[]) {
7755 { 0x14, 0x0201101f },
7756 { }
7757 },
7758 .chained = true,
7759 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7760 },
f0ba9d69
KY
7761 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7762 .type = HDA_FIXUP_PINS,
7763 .v.pins = (const struct hda_pintbl[]) {
7764 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7765 { }
7766 },
3ce0d5aa
HW
7767 .chained = true,
7768 .chain_id = ALC269_FIXUP_HEADSET_MIC
f0ba9d69 7769 },
bbf8ff6b
TB
7770 [ALC295_FIXUP_HP_X360] = {
7771 .type = HDA_FIXUP_FUNC,
7772 .v.func = alc295_fixup_hp_top_speakers,
7773 .chained = true,
7774 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8a328ac1
KY
7775 },
7776 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7777 .type = HDA_FIXUP_PINS,
7778 .v.pins = (const struct hda_pintbl[]) {
7779 { 0x19, 0x0181313f},
7780 { }
7781 },
7782 .chained = true,
7783 .chain_id = ALC269_FIXUP_HEADSET_MIC
7784 },
c4cfcf6f
HW
7785 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7786 .type = HDA_FIXUP_FUNC,
7787 .v.func = alc285_fixup_invalidate_dacs,
6ba189c5
HW
7788 .chained = true,
7789 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
c4cfcf6f 7790 },
e8ed64b0
GKK
7791 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7792 .type = HDA_FIXUP_FUNC,
7793 .v.func = alc_fixup_auto_mute_via_amp,
7794 },
33aaebd4
CC
7795 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7796 .type = HDA_FIXUP_PINS,
7797 .v.pins = (const struct hda_pintbl[]) {
7798 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7799 { }
7800 },
7801 .chained = true,
7802 .chain_id = ALC269_FIXUP_HEADSET_MIC
7803 },
d8ae458e
CC
7804 [ALC294_FIXUP_ASUS_MIC] = {
7805 .type = HDA_FIXUP_PINS,
7806 .v.pins = (const struct hda_pintbl[]) {
7807 { 0x13, 0x90a60160 }, /* use as internal mic */
7808 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7809 { }
7810 },
7811 .chained = true,
ef9ddb9d 7812 .chain_id = ALC269_FIXUP_HEADSET_MIC
d8ae458e 7813 },
4e051106
JHP
7814 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7815 .type = HDA_FIXUP_PINS,
7816 .v.pins = (const struct hda_pintbl[]) {
82b01149 7817 { 0x19, 0x01a1103c }, /* use as headset mic */
4e051106
JHP
7818 { }
7819 },
7820 .chained = true,
ef9ddb9d 7821 .chain_id = ALC269_FIXUP_HEADSET_MIC
4e051106
JHP
7822 },
7823 [ALC294_FIXUP_ASUS_SPK] = {
7824 .type = HDA_FIXUP_VERBS,
7825 .v.verbs = (const struct hda_verb[]) {
7826 /* Set EAPD high */
7827 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7828 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
473fbe13
KY
7829 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7830 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
4e051106
JHP
7831 { }
7832 },
7833 .chained = true,
7834 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7835 },
c8a9afa6 7836 [ALC295_FIXUP_CHROME_BOOK] = {
e854747d 7837 .type = HDA_FIXUP_FUNC,
c8a9afa6 7838 .v.func = alc295_fixup_chromebook,
8983eb60
KY
7839 .chained = true,
7840 .chain_id = ALC225_FIXUP_HEADSET_JACK
7841 },
7842 [ALC225_FIXUP_HEADSET_JACK] = {
7843 .type = HDA_FIXUP_FUNC,
7844 .v.func = alc_fixup_headset_jack,
e854747d 7845 },
89e3a568
JS
7846 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7847 .type = HDA_FIXUP_PINS,
7848 .v.pins = (const struct hda_pintbl[]) {
7849 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7850 { }
7851 },
7852 .chained = true,
7853 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7854 },
c8c6ee61
HW
7855 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7856 .type = HDA_FIXUP_VERBS,
7857 .v.verbs = (const struct hda_verb[]) {
7858 /* Disable PCBEEP-IN passthrough */
7859 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7860 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7861 { }
7862 },
7863 .chained = true,
7864 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7865 },
cbc05fd6
JHP
7866 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7867 .type = HDA_FIXUP_PINS,
7868 .v.pins = (const struct hda_pintbl[]) {
7869 { 0x19, 0x03a11130 },
7870 { 0x1a, 0x90a60140 }, /* use as internal mic */
7871 { }
7872 },
7873 .chained = true,
7874 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7875 },
136824ef
KY
7876 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7877 .type = HDA_FIXUP_PINS,
7878 .v.pins = (const struct hda_pintbl[]) {
7879 { 0x16, 0x01011020 }, /* Rear Line out */
7880 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7881 { }
7882 },
7883 .chained = true,
7884 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7885 },
7886 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7887 .type = HDA_FIXUP_FUNC,
7888 .v.func = alc_fixup_auto_mute_via_amp,
7889 .chained = true,
7890 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7891 },
7892 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7893 .type = HDA_FIXUP_FUNC,
7894 .v.func = alc_fixup_disable_mic_vref,
7895 .chained = true,
7896 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7897 },
667a8f73
JHP
7898 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7899 .type = HDA_FIXUP_VERBS,
7900 .v.verbs = (const struct hda_verb[]) {
7901 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7902 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7903 { }
7904 },
7905 .chained = true,
7906 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7907 },
8c8967a7
DD
7908 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7909 .type = HDA_FIXUP_PINS,
7910 .v.pins = (const struct hda_pintbl[]) {
7911 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7912 { }
7913 },
7914 .chained = true,
7915 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7916 },
e1037354
JHP
7917 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7918 .type = HDA_FIXUP_PINS,
7919 .v.pins = (const struct hda_pintbl[]) {
7920 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7921 { }
7922 },
7923 .chained = true,
7924 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7925 },
e2a829b3
BR
7926 [ALC299_FIXUP_PREDATOR_SPK] = {
7927 .type = HDA_FIXUP_PINS,
7928 .v.pins = (const struct hda_pintbl[]) {
7929 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7930 { }
7931 }
7932 },
bd9c10bc 7933 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
60083f9e
JHP
7934 .type = HDA_FIXUP_PINS,
7935 .v.pins = (const struct hda_pintbl[]) {
bd9c10bc
JMG
7936 { 0x19, 0x04a11040 },
7937 { 0x21, 0x04211020 },
60083f9e
JHP
7938 { }
7939 },
7940 .chained = true,
bd9c10bc 7941 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
60083f9e 7942 },
e79c2269 7943 [ALC289_FIXUP_DELL_SPK2] = {
bd9c10bc
JMG
7944 .type = HDA_FIXUP_PINS,
7945 .v.pins = (const struct hda_pintbl[]) {
e79c2269 7946 { 0x17, 0x90170130 }, /* bass spk */
bd9c10bc
JMG
7947 { }
7948 },
7949 .chained = true,
e79c2269 7950 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
bd9c10bc 7951 },
e79c2269
KY
7952 [ALC289_FIXUP_DUAL_SPK] = {
7953 .type = HDA_FIXUP_FUNC,
7954 .v.func = alc285_fixup_speaker2_to_dac1,
7955 .chained = true,
7956 .chain_id = ALC289_FIXUP_DELL_SPK2
7957 },
48e01504
CC
7958 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7959 .type = HDA_FIXUP_FUNC,
7960 .v.func = alc285_fixup_speaker2_to_dac1,
7961 .chained = true,
7962 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7963 },
7964 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
436e2550
JHP
7965 .type = HDA_FIXUP_FUNC,
7966 /* The GPIO must be pulled to initialize the AMP */
7967 .v.func = alc_fixup_gpio4,
7968 .chained = true,
48e01504 7969 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
436e2550 7970 },
6a6660d0
TI
7971 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7972 .type = HDA_FIXUP_FUNC,
7973 .v.func = alc285_fixup_thinkpad_x1_gen7,
7974 .chained = true,
7975 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7976 },
76f7dec0
KY
7977 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7978 .type = HDA_FIXUP_FUNC,
7979 .v.func = alc_fixup_headset_jack,
7980 .chained = true,
6a6660d0 7981 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
76f7dec0 7982 },
8b33a134
JHP
7983 [ALC294_FIXUP_ASUS_HPE] = {
7984 .type = HDA_FIXUP_VERBS,
7985 .v.verbs = (const struct hda_verb[]) {
7986 /* Set EAPD high */
7987 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7988 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7989 { }
7990 },
7991 .chained = true,
7992 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7993 },
c3cdf189
LJ
7994 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7995 .type = HDA_FIXUP_PINS,
7996 .v.pins = (const struct hda_pintbl[]) {
7997 { 0x19, 0x03a11050 }, /* front HP mic */
7998 { 0x1a, 0x01a11830 }, /* rear external mic */
7999 { 0x21, 0x03211020 }, /* front HP out */
8000 { }
8001 },
8002 .chained = true,
8003 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8004 },
8005 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8006 .type = HDA_FIXUP_VERBS,
8007 .v.verbs = (const struct hda_verb[]) {
8008 /* set 0x15 to HP-OUT ctrl */
8009 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8010 /* unmute the 0x15 amp */
8011 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8012 { }
8013 },
8014 .chained = true,
8015 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8016 },
8017 [ALC294_FIXUP_ASUS_GX502_HP] = {
8018 .type = HDA_FIXUP_FUNC,
8019 .v.func = alc294_fixup_gx502_hp,
8020 },
c1b55029
DC
8021 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8022 .type = HDA_FIXUP_PINS,
8023 .v.pins = (const struct hda_pintbl[]) {
8024 { 0x19, 0x01a11050 }, /* rear HP mic */
8025 { 0x1a, 0x01a11830 }, /* rear external mic */
8026 { 0x21, 0x012110f0 }, /* rear HP out */
8027 { }
8028 },
8029 .chained = true,
8030 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8031 },
8032 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8033 .type = HDA_FIXUP_VERBS,
8034 .v.verbs = (const struct hda_verb[]) {
8035 /* set 0x15 to HP-OUT ctrl */
8036 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8037 /* unmute the 0x15 amp */
8038 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8039 /* set 0x1b to HP-OUT */
8040 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8041 { }
8042 },
8043 .chained = true,
8044 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8045 },
8046 [ALC294_FIXUP_ASUS_GU502_HP] = {
8047 .type = HDA_FIXUP_FUNC,
8048 .v.func = alc294_fixup_gu502_hp,
8049 },
1b94e59d
TI
8050 [ALC294_FIXUP_ASUS_COEF_1B] = {
8051 .type = HDA_FIXUP_VERBS,
8052 .v.verbs = (const struct hda_verb[]) {
8053 /* Set bit 10 to correct noisy output after reboot from
8054 * Windows 10 (due to pop noise reduction?)
8055 */
8056 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8057 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8058 { }
8059 },
f8fbcdfb
TI
8060 .chained = true,
8061 .chain_id = ALC289_FIXUP_ASUS_GA401,
1b94e59d 8062 },
f5a88b0a
KHF
8063 [ALC285_FIXUP_HP_GPIO_LED] = {
8064 .type = HDA_FIXUP_FUNC,
8065 .v.func = alc285_fixup_hp_gpio_led,
8066 },
431e76c3
KY
8067 [ALC285_FIXUP_HP_MUTE_LED] = {
8068 .type = HDA_FIXUP_FUNC,
8069 .v.func = alc285_fixup_hp_mute_led,
8070 },
e7d66cf7
JS
8071 [ALC236_FIXUP_HP_GPIO_LED] = {
8072 .type = HDA_FIXUP_FUNC,
8073 .v.func = alc236_fixup_hp_gpio_led,
8074 },
24164f43
KY
8075 [ALC236_FIXUP_HP_MUTE_LED] = {
8076 .type = HDA_FIXUP_FUNC,
8077 .v.func = alc236_fixup_hp_mute_led,
8078 },
75b62ab6
JW
8079 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8080 .type = HDA_FIXUP_FUNC,
8081 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8082 },
14425f1f
MP
8083 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8084 .type = HDA_FIXUP_VERBS,
8085 .v.verbs = (const struct hda_verb[]) {
8086 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8087 { }
8088 },
8089 },
9e43342b
CC
8090 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8091 .type = HDA_FIXUP_PINS,
8092 .v.pins = (const struct hda_pintbl[]) {
8093 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8094 { }
8095 },
8096 .chained = true,
8097 .chain_id = ALC269_FIXUP_HEADSET_MODE
8098 },
8eae7e9b
JHP
8099 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8100 .type = HDA_FIXUP_PINS,
8101 .v.pins = (const struct hda_pintbl[]) {
8102 { 0x14, 0x90100120 }, /* use as internal speaker */
8103 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8104 { 0x1a, 0x01011020 }, /* use as line out */
8105 { },
8106 },
8107 .chained = true,
8108 .chain_id = ALC269_FIXUP_HEADSET_MIC
8109 },
6e15d126
JHP
8110 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8111 .type = HDA_FIXUP_PINS,
8112 .v.pins = (const struct hda_pintbl[]) {
8113 { 0x18, 0x02a11030 }, /* use as headset mic */
8114 { }
8115 },
8116 .chained = true,
8117 .chain_id = ALC269_FIXUP_HEADSET_MIC
8118 },
781c90c0
JHP
8119 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8120 .type = HDA_FIXUP_PINS,
8121 .v.pins = (const struct hda_pintbl[]) {
8122 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8123 { }
8124 },
8125 .chained = true,
8126 .chain_id = ALC269_FIXUP_HEADSET_MIC
8127 },
293a92c1 8128 [ALC289_FIXUP_ASUS_GA401] = {
c84bfedc
TI
8129 .type = HDA_FIXUP_FUNC,
8130 .v.func = alc289_fixup_asus_ga401,
8131 .chained = true,
8132 .chain_id = ALC289_FIXUP_ASUS_GA502,
ff53664d 8133 },
4b43d05a
AS
8134 [ALC289_FIXUP_ASUS_GA502] = {
8135 .type = HDA_FIXUP_PINS,
8136 .v.pins = (const struct hda_pintbl[]) {
8137 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8138 { }
8139 },
8140 },
f50a121d
JHP
8141 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8142 .type = HDA_FIXUP_PINS,
8143 .v.pins = (const struct hda_pintbl[]) {
8144 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8145 { }
8146 },
8147 .chained = true,
8148 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8149 },
56496253
KY
8150 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8151 .type = HDA_FIXUP_FUNC,
8152 .v.func = alc285_fixup_hp_gpio_amp_init,
8153 .chained = true,
8154 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8155 },
f1ec5be1
HC
8156 [ALC269_FIXUP_CZC_B20] = {
8157 .type = HDA_FIXUP_PINS,
8158 .v.pins = (const struct hda_pintbl[]) {
8159 { 0x12, 0x411111f0 },
8160 { 0x14, 0x90170110 }, /* speaker */
8161 { 0x15, 0x032f1020 }, /* HP out */
8162 { 0x17, 0x411111f0 },
8163 { 0x18, 0x03ab1040 }, /* mic */
8164 { 0x19, 0xb7a7013f },
8165 { 0x1a, 0x0181305f },
8166 { 0x1b, 0x411111f0 },
8167 { 0x1d, 0x411111f0 },
8168 { 0x1e, 0x411111f0 },
8169 { }
8170 },
8171 .chain_id = ALC269_FIXUP_DMIC,
8172 },
8173 [ALC269_FIXUP_CZC_TMI] = {
8174 .type = HDA_FIXUP_PINS,
8175 .v.pins = (const struct hda_pintbl[]) {
8176 { 0x12, 0x4000c000 },
8177 { 0x14, 0x90170110 }, /* speaker */
8178 { 0x15, 0x0421401f }, /* HP out */
8179 { 0x17, 0x411111f0 },
8180 { 0x18, 0x04a19020 }, /* mic */
8181 { 0x19, 0x411111f0 },
8182 { 0x1a, 0x411111f0 },
8183 { 0x1b, 0x411111f0 },
8184 { 0x1d, 0x40448505 },
8185 { 0x1e, 0x411111f0 },
8186 { 0x20, 0x8000ffff },
8187 { }
8188 },
8189 .chain_id = ALC269_FIXUP_DMIC,
8190 },
8191 [ALC269_FIXUP_CZC_L101] = {
8192 .type = HDA_FIXUP_PINS,
8193 .v.pins = (const struct hda_pintbl[]) {
8194 { 0x12, 0x40000000 },
8195 { 0x14, 0x01014010 }, /* speaker */
8196 { 0x15, 0x411111f0 }, /* HP out */
8197 { 0x16, 0x411111f0 },
8198 { 0x18, 0x01a19020 }, /* mic */
8199 { 0x19, 0x02a19021 },
8200 { 0x1a, 0x0181302f },
8201 { 0x1b, 0x0221401f },
8202 { 0x1c, 0x411111f0 },
8203 { 0x1d, 0x4044c601 },
8204 { 0x1e, 0x411111f0 },
8205 { }
8206 },
8207 .chain_id = ALC269_FIXUP_DMIC,
8208 },
8209 [ALC269_FIXUP_LEMOTE_A1802] = {
8210 .type = HDA_FIXUP_PINS,
8211 .v.pins = (const struct hda_pintbl[]) {
8212 { 0x12, 0x40000000 },
8213 { 0x14, 0x90170110 }, /* speaker */
8214 { 0x17, 0x411111f0 },
8215 { 0x18, 0x03a19040 }, /* mic1 */
8216 { 0x19, 0x90a70130 }, /* mic2 */
8217 { 0x1a, 0x411111f0 },
8218 { 0x1b, 0x411111f0 },
8219 { 0x1d, 0x40489d2d },
8220 { 0x1e, 0x411111f0 },
8221 { 0x20, 0x0003ffff },
8222 { 0x21, 0x03214020 },
8223 { }
8224 },
8225 .chain_id = ALC269_FIXUP_DMIC,
8226 },
8227 [ALC269_FIXUP_LEMOTE_A190X] = {
8228 .type = HDA_FIXUP_PINS,
8229 .v.pins = (const struct hda_pintbl[]) {
8230 { 0x14, 0x99130110 }, /* speaker */
8231 { 0x15, 0x0121401f }, /* HP out */
8232 { 0x18, 0x01a19c20 }, /* rear mic */
8233 { 0x19, 0x99a3092f }, /* front mic */
8234 { 0x1b, 0x0201401f }, /* front lineout */
8235 { }
8236 },
8237 .chain_id = ALC269_FIXUP_DMIC,
8238 },
e2d2fded
KHF
8239 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8240 .type = HDA_FIXUP_PINS,
8241 .v.pins = (const struct hda_pintbl[]) {
8242 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8243 { }
8244 },
8245 .chained = true,
8246 .chain_id = ALC269_FIXUP_HEADSET_MODE
8247 },
73e7161e
WS
8248 [ALC256_FIXUP_INTEL_NUC10] = {
8249 .type = HDA_FIXUP_PINS,
8250 .v.pins = (const struct hda_pintbl[]) {
8251 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8252 { }
8253 },
8254 .chained = true,
8255 .chain_id = ALC269_FIXUP_HEADSET_MODE
8256 },
fc19d559
HW
8257 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8258 .type = HDA_FIXUP_VERBS,
8259 .v.verbs = (const struct hda_verb[]) {
8260 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8261 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8262 { }
8263 },
8264 .chained = true,
c84bfedc 8265 .chain_id = ALC289_FIXUP_ASUS_GA502
fc19d559 8266 },
13468bfa
HW
8267 [ALC274_FIXUP_HP_MIC] = {
8268 .type = HDA_FIXUP_VERBS,
8269 .v.verbs = (const struct hda_verb[]) {
8270 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8271 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8272 { }
8273 },
8274 },
8a8de09c
KY
8275 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8276 .type = HDA_FIXUP_FUNC,
8277 .v.func = alc274_fixup_hp_headset_mic,
8278 .chained = true,
8279 .chain_id = ALC274_FIXUP_HP_MIC
8280 },
622464c8
TI
8281 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8282 .type = HDA_FIXUP_FUNC,
8283 .v.func = alc274_fixup_hp_envy_gpio,
8284 },
ef9ce66f
KY
8285 [ALC256_FIXUP_ASUS_HPE] = {
8286 .type = HDA_FIXUP_VERBS,
8287 .v.verbs = (const struct hda_verb[]) {
8288 /* Set EAPD high */
8289 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8290 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8291 { }
8292 },
8293 .chained = true,
8294 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8295 },
446b8185
KY
8296 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8297 .type = HDA_FIXUP_FUNC,
8298 .v.func = alc_fixup_headset_jack,
8299 .chained = true,
8300 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8301 },
a0ccbc53
KY
8302 [ALC287_FIXUP_HP_GPIO_LED] = {
8303 .type = HDA_FIXUP_FUNC,
8304 .v.func = alc287_fixup_hp_gpio_led,
8305 },
9e885770
KY
8306 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8307 .type = HDA_FIXUP_FUNC,
8308 .v.func = alc274_fixup_hp_headset_mic,
8309 },
92666d45
KY
8310 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8311 .type = HDA_FIXUP_FUNC,
8312 .v.func = alc_fixup_no_int_mic,
8313 .chained = true,
8314 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8315 },
34cdf405
CC
8316 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8317 .type = HDA_FIXUP_PINS,
8318 .v.pins = (const struct hda_pintbl[]) {
8319 { 0x1b, 0x411111f0 },
8320 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8321 { },
8322 },
8323 .chained = true,
8324 .chain_id = ALC269_FIXUP_HEADSET_MODE
8325 },
495dc763
CC
8326 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8327 .type = HDA_FIXUP_FUNC,
8328 .v.func = alc269_fixup_limit_int_mic_boost,
8329 .chained = true,
8330 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8331 },
d0e18561
CC
8332 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8333 .type = HDA_FIXUP_PINS,
8334 .v.pins = (const struct hda_pintbl[]) {
8335 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8336 { 0x1a, 0x90a1092f }, /* use as internal mic */
8337 { }
8338 },
8339 .chained = true,
8340 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8341 },
26928ca1
TI
8342 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8343 .type = HDA_FIXUP_FUNC,
8344 .v.func = alc285_fixup_ideapad_s740_coef,
8345 .chained = true,
8346 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8347 },
bd15b155
KHF
8348 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8349 .type = HDA_FIXUP_FUNC,
8350 .v.func = alc269_fixup_limit_int_mic_boost,
8351 .chained = true,
8352 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8353 },
8eedd3a7
TI
8354 [ALC295_FIXUP_ASUS_DACS] = {
8355 .type = HDA_FIXUP_FUNC,
8356 .v.func = alc295_fixup_asus_dacs,
8357 },
5d84b531
TI
8358 [ALC295_FIXUP_HP_OMEN] = {
8359 .type = HDA_FIXUP_PINS,
8360 .v.pins = (const struct hda_pintbl[]) {
8361 { 0x12, 0xb7a60130 },
8362 { 0x13, 0x40000000 },
8363 { 0x14, 0x411111f0 },
8364 { 0x16, 0x411111f0 },
8365 { 0x17, 0x90170110 },
8366 { 0x18, 0x411111f0 },
8367 { 0x19, 0x02a11030 },
8368 { 0x1a, 0x411111f0 },
8369 { 0x1b, 0x04a19030 },
8370 { 0x1d, 0x40600001 },
8371 { 0x1e, 0x411111f0 },
8372 { 0x21, 0x03211020 },
8373 {}
8374 },
8375 .chained = true,
8376 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8377 },
f2be77fe 8378 [ALC285_FIXUP_HP_SPECTRE_X360] = {
434591b2
ED
8379 .type = HDA_FIXUP_FUNC,
8380 .v.func = alc285_fixup_hp_spectre_x360,
f2be77fe 8381 },
d94befbb
DB
8382 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8383 .type = HDA_FIXUP_FUNC,
8384 .v.func = alc285_fixup_hp_spectre_x360_eb1
8385 },
9ebaef05
HW
8386 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8387 .type = HDA_FIXUP_FUNC,
8388 .v.func = alc285_fixup_ideapad_s740_coef,
8389 .chained = true,
8390 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8391 },
29c8f40b
PU
8392 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8393 .type = HDA_FIXUP_FUNC,
8394 .v.func = alc_fixup_no_shutup,
8395 .chained = true,
8396 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8397 },
57c9e21a
HW
8398 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8399 .type = HDA_FIXUP_PINS,
8400 .v.pins = (const struct hda_pintbl[]) {
8401 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8402 { }
8403 },
8404 .chained = true,
8405 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8406 },
8903376d
KHF
8407 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8408 .type = HDA_FIXUP_FUNC,
8409 .v.func = alc269_fixup_limit_int_mic_boost,
8410 .chained = true,
8411 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8412 },
e7e2503a
BF
8413 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8414 .type = HDA_FIXUP_FUNC,
8415 .v.func = alc285_fixup_ideapad_s740_coef,
8416 .chained = true,
8417 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8418 },
8419 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8420 .type = HDA_FIXUP_FUNC,
8421 .v.func = alc287_fixup_legion_15imhg05_speakers,
8422 .chained = true,
8423 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8424 },
ad7cc2d4
CB
8425 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8426 .type = HDA_FIXUP_VERBS,
8427 //.v.verbs = legion_15imhg05_coefs,
8428 .v.verbs = (const struct hda_verb[]) {
8429 // set left speaker Legion 7i.
8430 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8431 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8432
8433 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8434 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8435 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8436 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8437 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8438
8439 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8440 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8441 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8442 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8443 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8444
8445 // set right speaker Legion 7i.
8446 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8447 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8448
8449 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8450 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8451 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8452 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8453 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8454
8455 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8456 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8457 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8458 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8459 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8460 {}
8461 },
8462 .chained = true,
8463 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8464 },
8465 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8466 .type = HDA_FIXUP_FUNC,
8467 .v.func = alc287_fixup_legion_15imhg05_speakers,
8468 .chained = true,
8469 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8470 },
8471 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8472 .type = HDA_FIXUP_VERBS,
8473 .v.verbs = (const struct hda_verb[]) {
8474 // set left speaker Yoga 7i.
8475 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8476 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8477
8478 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8479 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8480 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8481 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8482 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8483
8484 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8485 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8486 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8487 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8488 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8489
8490 // set right speaker Yoga 7i.
8491 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8492 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8493
8494 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8495 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8496 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8497 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8498 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8499
8500 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8501 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8502 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8503 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8504 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8505 {}
8506 },
8507 .chained = true,
8508 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8509 },
8510 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8511 .type = HDA_FIXUP_VERBS,
8512 .v.verbs = (const struct hda_verb[]) {
8513 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8514 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
023a062f 8515 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
ad7cc2d4
CB
8516 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8517 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8518 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8519 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8520 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8521 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8522 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8523 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8524 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8525 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8526 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8527 {}
8528 },
8529 .chained = true,
8530 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8531 },
b9145ede 8532 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
dd6dd6e3 8533 .type = HDA_FIXUP_FUNC,
b9145ede 8534 .v.func = alc256_fixup_set_coef_defaults,
dd6dd6e3 8535 },
c47b3112
JC
8536 [ALC245_FIXUP_HP_GPIO_LED] = {
8537 .type = HDA_FIXUP_FUNC,
8538 .v.func = alc245_fixup_hp_gpio_led,
8539 },
4803b99a
JS
8540 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8541 .type = HDA_FIXUP_PINS,
8542 .v.pins = (const struct hda_pintbl[]) {
8543 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8544 { }
8545 },
8546 .chained = true,
8547 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8548 },
e1abacd3
WS
8549 [ALC233_FIXUP_NO_AUDIO_JACK] = {
8550 .type = HDA_FIXUP_FUNC,
8551 .v.func = alc233_fixup_no_audio_jack,
8552 },
f2ca7e35
WS
8553 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
8554 .type = HDA_FIXUP_FUNC,
8555 .v.func = alc256_fixup_mic_no_presence_and_resume,
8556 .chained = true,
8557 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8558 },
f1d4e28b
KY
8559};
8560
1d045db9 8561static const struct snd_pci_quirk alc269_fixup_tbl[] = {
a6b92b66 8562 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
693b613d
DH
8563 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8564 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
aaedfb47 8565 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
7819717b 8566 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
aaedfb47
DH
8567 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8568 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
02322ac9 8569 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
b1e8972e 8570 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
1a22e775 8571 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
433f894e 8572 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
c8426b27 8573 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
13be30f1 8574 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
705b65f1 8575 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6e15d126 8576 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
b9c2fa52 8577 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
495dc763 8578 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
c7531e31
CC
8579 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8580 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
13be30f1
CC
8581 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8582 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
e2a829b3 8583 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
8eae7e9b 8584 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
781c90c0 8585 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
d0e18561 8586 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
667a8f73
JHP
8587 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8588 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8589 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
d0e18561 8590 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
35171fbf 8591 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
2733cceb 8592 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
ea5c7eba 8593 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
cbc05fd6 8594 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
204a71b0 8595 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
0d4867a1 8596 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
f50a121d 8597 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
57c9e21a 8598 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
aaedfb47 8599 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6ed1131f 8600 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
86f799b8 8601 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
cf52103a 8602 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8b99aba7
TI
8603 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8604 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
0f4881dc 8605 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
73bdd597
DH
8606 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8607 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8608 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
0f4881dc
DH
8609 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8610 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
98070576 8611 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
4275554d 8612 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
0f4881dc 8613 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
a22aa26f
KY
8614 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8615 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
831bfdf9 8616 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
afecb146 8617 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
3a05d12f 8618 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8b72415d 8619 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
b734304f
KY
8620 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8621 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
c04017ea
DH
8622 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8623 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8624 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8625 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8626 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
fd06c77e 8627 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
3b43b71f 8628 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
c0ca5ece 8629 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
709ae62e 8630 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
dd9aa335 8631 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
493de342 8632 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
aa143ad3 8633 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
5f364135 8634 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
40e2c4e5
KY
8635 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8636 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
f0ba9d69
KY
8637 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8638 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
ae104a21 8639 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
136824ef 8640 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
da484d00 8641 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
c2a7c55a 8642 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
e79c2269 8643 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
aa143ad3 8644 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
78def224
KY
8645 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8646 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
92666d45
KY
8647 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8648 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
c1e89523 8649 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
da946920 8650 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
eb676622 8651 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
2b987fe8
CC
8652 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8653 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
a22aa26f
KY
8654 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8655 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
08fb0d0e 8656 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9f5c6faf 8657 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8e35cd4a 8658 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
7976eb49 8659 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 8660 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 8661 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8662 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8663 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8664 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8665 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf
KY
8666 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8667 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8668 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8669 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf 8670 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf
KY
8671 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8672 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8673 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8674 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8675 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 8676 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
04d5466a 8677 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
45461e3b 8678 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
c60666bd 8679 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
8680 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8681 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8682 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8683 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8684 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8685 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8686 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8687 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9c5dc3bf 8688 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
45461e3b 8689 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9c5dc3bf 8690 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
45461e3b 8691 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9c5dc3bf 8692 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 8693 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8694 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8695 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8696 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8697 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8698 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8699 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8700 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8701 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8702 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
8703 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8704 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8705 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8706 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8707 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8708 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8a02b164
KY
8709 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8710 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8711 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8712 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
167897f4
JK
8713 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8714 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
1c9d9dfd
KY
8715 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8716 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
563785ed 8717 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
e549d190 8718 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
bbf8ff6b 8719 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
aeedad25 8720 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
167897f4
JK
8721 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8722 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
56e40eb6 8723 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
901be145 8724 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
190d0381 8725 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
5d84b531 8726 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
d33cd42d 8727 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
f2be77fe 8728 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
a94c91b4 8729 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
0ac05b25 8730 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
b2c22910 8731 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
622464c8 8732 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
15d295b5 8733 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
61d3e874 8734 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
a598098c 8735 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
afbac2a3 8736 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
b2c22910 8737 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
75b62ab6 8738 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
de1c4c2b 8739 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
56496253 8740 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
08befca4 8741 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
431e76c3 8742 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
24164f43 8743 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
91bc1568
JS
8744 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8745 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8746 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8747 ALC285_FIXUP_HP_GPIO_AMP_INIT),
ba28051e 8748 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
48422958 8749 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
e7d66cf7 8750 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
2b70b264 8751 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
fb3acdb2 8752 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
417eadfd 8753 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
a0ccbc53
KY
8754 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8755 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
93ab3eaf 8756 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
c3bb2b52 8757 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
d07149ab 8758 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
dfc2e8ae 8759 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
d94befbb
DB
8760 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8761 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
53b861be 8762 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
c3d2c882 8763 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
dfb06401 8764 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
ca688339 8765 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8903376d
KHF
8766 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8767 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
50dbfae9 8768 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
e650c1a9 8769 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
bbe183e0 8770 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
600dd2a7 8771 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
0e68c4b1 8772 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
bd15b155 8773 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
42334fbc 8774 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
0aa32e54 8775 SND_PCI_QUIRK(0x103c, 0x89c3, "HP", ALC285_FIXUP_HP_GPIO_LED),
1e30191c 8776 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
c1732ede 8777 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
7bba2157 8778 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
3e0d611b 8779 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9cf6533e 8780 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
c1732ede 8781 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
4eab0ea1 8782 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3e0d611b 8783 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4eab0ea1 8784 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3cd0ed63 8785 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
5cfca596 8786 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1
TI
8787 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8788 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
c1732ede 8789 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
3cd0ed63 8790 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
c1732ede 8791 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
2cede303 8792 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
23870831 8793 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
3e0d611b 8794 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
8eedd3a7 8795 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
48e01504 8796 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
739d0959 8797 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
3cd0ed63 8798 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
8c8967a7 8799 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
4963d66b 8800 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
158ae2f5 8801 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
d3a9b1ce 8802 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
5de3b943 8803 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
8b33a134 8804 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
7900e817 8805 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
017f2a10 8806 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
28e8af8a 8807 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
1b94e59d 8808 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
693b613d 8809 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
615966ad 8810 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1 8811 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
c1732ede 8812 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
ef9ce66f 8813 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
4b43d05a 8814 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
c1b55029 8815 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
76fae618 8816 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
293a92c1 8817 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
eeed4cd1 8818 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
adabb3ec
TI
8819 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8820 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8821 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8822 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
d240d1dc 8823 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
1d045db9
TI
8824 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8825 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8826 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
e9bd7d5c 8827 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
cab561f8
TI
8828 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8829 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
24519911 8830 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4df3fd17 8831 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
cc7016ab 8832 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
fdcc968a 8833 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
c656f747 8834 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
2041d564 8835 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
b84e8436 8836 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
c656f747 8837 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
6fa38ef1 8838 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
ce2e79b2
PH
8839 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8840 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
0fca97a2 8841 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
a33cc48d 8842 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
14425f1f
MP
8843 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8844 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
f70fff83 8845 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8bcea6cb 8846 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
823ff161 8847 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
568e4e82 8848 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
c656f747 8849 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
abaa2274
AA
8850 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8851 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8cd65271 8852 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
6ca653e3 8853 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
b5acfe15 8854 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b 8855 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8856 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8857 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8858 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8859 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8860 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8861 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8862 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8863 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8864 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8865 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4803b99a
JS
8866 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8867 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8868 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8869 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8870 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8871 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8872 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4803b99a
JS
8873 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8874 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 8875 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2 8876 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 8877 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
8878 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8879 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8880 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8881 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8882 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8883 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8884 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
8885 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8886 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8887 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8888 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8889 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8890 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8891 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8892 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8893 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b
WS
8894 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8895 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8896 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
8897 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
8898 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
b5acfe15
PH
8899 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8900 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
f2ca7e35 8901 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
b5acfe15
PH
8902 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8903 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8904 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8905 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2 8906 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8907 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8908 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b
WS
8909 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8910 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
8911 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8912 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8913 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8914 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8915 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8916 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
ca169cc2 8917 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
29c8f40b 8918 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
1d045db9
TI
8919 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8920 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8921 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8922 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8923 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
f552ff54 8924 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
b590b38c 8925 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
c8415a48 8926 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
4407be6b 8927 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
108cc108 8928 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
aaedfb47 8929 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9a811230 8930 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
1c37c223 8931 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
a12137e7 8932 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
59a51a6b 8933 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
6d16941a 8934 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7c21539c 8935 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
a4a9e082 8936 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
b6903c0e 8937 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
d05ea7da 8938 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
c0278669 8939 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
61fcf8ec
KY
8940 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8941 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
dab38e43 8942 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
c636b95e 8943 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
8944 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8945 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8946 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
e4c07b3b 8947 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
8948 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8949 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8950 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
85981dfd 8951 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9774dc21 8952 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
ca707b3f 8953 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
446b8185
KY
8954 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8955 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
3694cb29 8956 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6ef2f68f 8957 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
f33f79f3 8958 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
bef33e19 8959 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
e41fc8c5 8960 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
65811834 8961 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8da5bbfc 8962 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
2a36c16e 8963 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8a6c55d0
AM
8964 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8965 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
e4efa826 8966 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
c6e388f4 8967 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
f86de9b1 8968 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
c6e388f4 8969 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
e7e2503a 8970 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
c6e388f4 8971 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
b67ef1ff 8972 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9ebaef05 8973 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
c6e388f4 8974 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
ad7cc2d4
CB
8975 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8976 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
56f27013 8977 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
fedb2245 8978 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
56df90b6 8979 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
f552ff54 8980 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
a4a9e082 8981 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
1bb3e062 8982 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
c497d9f9 8983 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
cd5302c0 8984 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
f2aa1110 8985 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
80b311d3 8986 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
09ea9976 8987 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
037e1197 8988 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
23adc192 8989 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
0f087ee3 8990 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9cd25743 8991 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
0f087ee3 8992 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
61fcf8ec
KY
8993 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8994 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8995 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
cd5302c0 8996 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
61fcf8ec
KY
8997 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8998 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
1d045db9 8999 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
e1abacd3 9000 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
0fbf21c3 9001 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
f1ec5be1
HC
9002 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
9003 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
9004 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
02b504d9 9005 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
c656f747
TI
9006 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
9007 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
b9145ede 9008 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
fc19d559 9009 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
b95bc12e 9010 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
695d1ec3 9011 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
e1c86210 9012 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
d1ee66c5 9013 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
e2d2fded 9014 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
73e7161e 9015 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
a4297b5d 9016
a7f3eedc 9017#if 0
a4297b5d
TI
9018 /* Below is a quirk table taken from the old code.
9019 * Basically the device should work as is without the fixup table.
9020 * If BIOS doesn't give a proper info, enable the corresponding
9021 * fixup entry.
7d7eb9ea 9022 */
a4297b5d
TI
9023 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
9024 ALC269_FIXUP_AMIC),
9025 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
a4297b5d
TI
9026 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
9027 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
9028 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
9029 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
9030 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
9031 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
9032 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
9033 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
9034 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
9035 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
9036 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
9037 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
9038 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
9039 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
9040 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
9041 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
9042 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
9043 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
9044 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
9045 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
9046 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
9047 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
9048 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
9049 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
9050 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
9051 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
9052 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
9053 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
9054 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
9055 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
9056 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
9057 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
9058 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
9059 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
9060 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
9061 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
9062 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
9063 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
9064#endif
9065 {}
9066};
9067
214eef76
DH
9068static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9069 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9070 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9071 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9072 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
0fbf21c3 9073 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
214eef76
DH
9074 {}
9075};
9076
1727a771 9077static const struct hda_model_fixup alc269_fixup_models[] = {
a4297b5d
TI
9078 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9079 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
6e72aa5f
TI
9080 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9081 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9082 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7c478f03 9083 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
b016951e
TI
9084 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9085 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
108cc108 9086 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
b590b38c 9087 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9f5c6faf 9088 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
04d5466a 9089 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
e32aa85a
DH
9090 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9091 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
a26d96c7
TI
9092 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9093 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
be8ef16a 9094 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
0202e99c 9095 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
1c37c223 9096 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9a811230 9097 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
c636b95e 9098 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
399c01aa 9099 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
a26d96c7 9100 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
ba90d6a6 9101 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
28d1d6d2 9102 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
a26d96c7
TI
9103 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9104 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9105 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9106 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9107 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9108 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9109 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9110 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9111 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9112 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9113 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9114 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9115 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9116 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9117 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9118 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9119 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9120 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9121 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9122 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9123 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9124 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9125 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9126 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9127 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9128 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9129 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9130 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9131 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9132 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9133 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9134 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9135 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9136 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9137 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9138 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9139 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9140 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9141 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9142 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
b3802783 9143 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
a26d96c7 9144 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
c8426b27 9145 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
a26d96c7
TI
9146 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9147 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9148 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9149 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9150 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9151 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9152 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9153 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9154 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9155 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9156 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9157 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9158 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9159 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
a26d96c7
TI
9160 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9161 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9162 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
82aa0d7e 9163 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
a26d96c7 9164 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
d2cd795c 9165 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
a26d96c7
TI
9166 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9167 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9168 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9169 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9170 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9171 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9172 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9173 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9174 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9175 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9176 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9177 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9178 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9179 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9180 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9181 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9182 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
8983eb60
KY
9183 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9184 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
e2a829b3 9185 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
a2ef03fe 9186 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
bd9c10bc 9187 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
23dc9586 9188 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
fc19d559 9189 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
13468bfa 9190 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
c3bb2b52 9191 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
5d84b531 9192 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
f2be77fe 9193 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
d94befbb 9194 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
9ebaef05 9195 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
29c8f40b 9196 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
57c9e21a 9197 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
657da58e 9198 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
1d045db9 9199 {}
6dda9f4a 9200};
cfc5a845 9201#define ALC225_STANDARD_PINS \
cfc5a845 9202 {0x21, 0x04211020}
6dda9f4a 9203
e8191a8e
HW
9204#define ALC256_STANDARD_PINS \
9205 {0x12, 0x90a60140}, \
9206 {0x14, 0x90170110}, \
e8191a8e
HW
9207 {0x21, 0x02211020}
9208
fea185e2 9209#define ALC282_STANDARD_PINS \
11580297 9210 {0x14, 0x90170110}
e1e62b98 9211
fea185e2 9212#define ALC290_STANDARD_PINS \
11580297 9213 {0x12, 0x99a30130}
fea185e2
DH
9214
9215#define ALC292_STANDARD_PINS \
9216 {0x14, 0x90170110}, \
11580297 9217 {0x15, 0x0221401f}
977e6276 9218
3f640970
HW
9219#define ALC295_STANDARD_PINS \
9220 {0x12, 0xb7a60130}, \
9221 {0x14, 0x90170110}, \
3f640970
HW
9222 {0x21, 0x04211020}
9223
703867e2
WS
9224#define ALC298_STANDARD_PINS \
9225 {0x12, 0x90a60130}, \
9226 {0x21, 0x03211020}
9227
e1918938 9228static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
8a328ac1
KY
9229 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9230 {0x14, 0x01014020},
9231 {0x17, 0x90170110},
9232 {0x18, 0x02a11030},
9233 {0x19, 0x0181303F},
9234 {0x21, 0x0221102f}),
5824ce8d
CC
9235 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9236 {0x12, 0x90a601c0},
9237 {0x14, 0x90171120},
9238 {0x21, 0x02211030}),
615966ad
CC
9239 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9240 {0x14, 0x90170110},
9241 {0x1b, 0x90a70130},
9242 {0x21, 0x03211020}),
9243 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9244 {0x1a, 0x90a70130},
9245 {0x1b, 0x90170110},
9246 {0x21, 0x03211020}),
2ae95577 9247 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 9248 ALC225_STANDARD_PINS,
8a132099 9249 {0x12, 0xb7a60130},
cfc5a845 9250 {0x14, 0x901701a0}),
2ae95577 9251 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 9252 ALC225_STANDARD_PINS,
8a132099 9253 {0x12, 0xb7a60130},
cfc5a845 9254 {0x14, 0x901701b0}),
8a132099
HW
9255 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9256 ALC225_STANDARD_PINS,
9257 {0x12, 0xb7a60150},
9258 {0x14, 0x901701a0}),
9259 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9260 ALC225_STANDARD_PINS,
9261 {0x12, 0xb7a60150},
9262 {0x14, 0x901701b0}),
9263 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9264 ALC225_STANDARD_PINS,
9265 {0x12, 0xb7a60130},
9266 {0x1b, 0x90170110}),
0ce48e17
KHF
9267 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9268 {0x1b, 0x01111010},
9269 {0x1e, 0x01451130},
9270 {0x21, 0x02211020}),
986376b6
HW
9271 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9272 {0x12, 0x90a60140},
9273 {0x14, 0x90170110},
9274 {0x19, 0x02a11030},
9275 {0x21, 0x02211020}),
e41fc8c5
HW
9276 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9277 {0x14, 0x90170110},
9278 {0x19, 0x02a11030},
9279 {0x1a, 0x02a11040},
9280 {0x1b, 0x01014020},
9281 {0x21, 0x0221101f}),
d06fb562
HW
9282 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9283 {0x14, 0x90170110},
9284 {0x19, 0x02a11030},
9285 {0x1a, 0x02a11040},
9286 {0x1b, 0x01011020},
9287 {0x21, 0x0221101f}),
c6b17f10
HW
9288 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9289 {0x14, 0x90170110},
9290 {0x19, 0x02a11020},
9291 {0x1a, 0x02a11030},
9292 {0x21, 0x0221101f}),
92666d45
KY
9293 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9294 {0x21, 0x02211010}),
9e885770
KY
9295 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9296 {0x14, 0x90170110},
9297 {0x19, 0x02a11020},
9298 {0x21, 0x02211030}),
c77900e6 9299 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
c77900e6 9300 {0x14, 0x90170110},
c77900e6 9301 {0x21, 0x02211020}),
86c72d1c
HW
9302 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9303 {0x14, 0x90170130},
9304 {0x21, 0x02211040}),
76c2132e
DH
9305 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9306 {0x12, 0x90a60140},
9307 {0x14, 0x90170110},
76c2132e
DH
9308 {0x21, 0x02211020}),
9309 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9310 {0x12, 0x90a60160},
9311 {0x14, 0x90170120},
76c2132e 9312 {0x21, 0x02211030}),
392c9da2
HW
9313 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9314 {0x14, 0x90170110},
9315 {0x1b, 0x02011020},
9316 {0x21, 0x0221101f}),
6aecd871
HW
9317 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9318 {0x14, 0x90170110},
9319 {0x1b, 0x01011020},
9320 {0x21, 0x0221101f}),
cba59972 9321 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
cba59972 9322 {0x14, 0x90170130},
cba59972 9323 {0x1b, 0x01014020},
cba59972 9324 {0x21, 0x0221103f}),
6aecd871
HW
9325 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9326 {0x14, 0x90170130},
9327 {0x1b, 0x01011020},
9328 {0x21, 0x0221103f}),
59ec4b57
HW
9329 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9330 {0x14, 0x90170130},
9331 {0x1b, 0x02011020},
9332 {0x21, 0x0221103f}),
e9c28e16 9333 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 9334 {0x14, 0x90170150},
e9c28e16 9335 {0x1b, 0x02011020},
e9c28e16
WS
9336 {0x21, 0x0221105f}),
9337 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 9338 {0x14, 0x90170110},
e9c28e16 9339 {0x1b, 0x01014020},
e9c28e16 9340 {0x21, 0x0221101f}),
76c2132e
DH
9341 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9342 {0x12, 0x90a60160},
9343 {0x14, 0x90170120},
9344 {0x17, 0x90170140},
76c2132e
DH
9345 {0x21, 0x0321102f}),
9346 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9347 {0x12, 0x90a60160},
9348 {0x14, 0x90170130},
76c2132e
DH
9349 {0x21, 0x02211040}),
9350 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9351 {0x12, 0x90a60160},
9352 {0x14, 0x90170140},
76c2132e
DH
9353 {0x21, 0x02211050}),
9354 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9355 {0x12, 0x90a60170},
9356 {0x14, 0x90170120},
76c2132e
DH
9357 {0x21, 0x02211030}),
9358 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9359 {0x12, 0x90a60170},
9360 {0x14, 0x90170130},
76c2132e 9361 {0x21, 0x02211040}),
0a1f90a9
HW
9362 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9363 {0x12, 0x90a60170},
9364 {0x14, 0x90171130},
9365 {0x21, 0x02211040}),
70658b99 9366 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
70658b99
HW
9367 {0x12, 0x90a60170},
9368 {0x14, 0x90170140},
70658b99 9369 {0x21, 0x02211050}),
9b5a4e39 9370 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9b5a4e39
DH
9371 {0x12, 0x90a60180},
9372 {0x14, 0x90170130},
9b5a4e39 9373 {0x21, 0x02211040}),
f90d83b3
AK
9374 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9375 {0x12, 0x90a60180},
9376 {0x14, 0x90170120},
9377 {0x21, 0x02211030}),
989dbe4a
HW
9378 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9379 {0x1b, 0x01011020},
9380 {0x21, 0x02211010}),
c1732ede
CC
9381 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9382 {0x14, 0x90170110},
9383 {0x1b, 0x90a70130},
9384 {0x21, 0x04211020}),
9385 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9386 {0x14, 0x90170110},
9387 {0x1b, 0x90a70130},
9388 {0x21, 0x03211020}),
a806ef1c
CC
9389 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9390 {0x12, 0x90a60130},
9391 {0x14, 0x90170110},
9392 {0x21, 0x03211020}),
6ac371aa
JHP
9393 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9394 {0x12, 0x90a60130},
9395 {0x14, 0x90170110},
9396 {0x21, 0x04211020}),
e1037354
JHP
9397 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9398 {0x1a, 0x90a70130},
9399 {0x1b, 0x90170110},
9400 {0x21, 0x03211020}),
9e885770
KY
9401 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9402 {0x14, 0x90170110},
9403 {0x19, 0x02a11020},
9404 {0x21, 0x0221101f}),
8a8de09c
KY
9405 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9406 {0x17, 0x90170110},
9407 {0x19, 0x03a11030},
9408 {0x21, 0x03211020}),
cf51eb9d
DH
9409 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9410 {0x12, 0x90a60130},
cf51eb9d
DH
9411 {0x14, 0x90170110},
9412 {0x15, 0x0421101f},
11580297 9413 {0x1a, 0x04a11020}),
0279661b
HW
9414 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9415 {0x12, 0x90a60140},
0279661b
HW
9416 {0x14, 0x90170110},
9417 {0x15, 0x0421101f},
0279661b 9418 {0x18, 0x02811030},
0279661b 9419 {0x1a, 0x04a1103f},
11580297 9420 {0x1b, 0x02011020}),
42304474 9421 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9422 ALC282_STANDARD_PINS,
42304474 9423 {0x12, 0x99a30130},
42304474 9424 {0x19, 0x03a11020},
42304474 9425 {0x21, 0x0321101f}),
2c609999 9426 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9427 ALC282_STANDARD_PINS,
2c609999 9428 {0x12, 0x99a30130},
2c609999 9429 {0x19, 0x03a11020},
2c609999
HW
9430 {0x21, 0x03211040}),
9431 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9432 ALC282_STANDARD_PINS,
2c609999 9433 {0x12, 0x99a30130},
2c609999 9434 {0x19, 0x03a11030},
2c609999
HW
9435 {0x21, 0x03211020}),
9436 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9437 ALC282_STANDARD_PINS,
2c609999 9438 {0x12, 0x99a30130},
2c609999 9439 {0x19, 0x04a11020},
2c609999 9440 {0x21, 0x0421101f}),
200afc09 9441 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
aec856d0 9442 ALC282_STANDARD_PINS,
200afc09 9443 {0x12, 0x90a60140},
200afc09 9444 {0x19, 0x04a11030},
200afc09 9445 {0x21, 0x04211020}),
34cdf405
CC
9446 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9447 ALC282_STANDARD_PINS,
9448 {0x12, 0x90a609c0},
9449 {0x18, 0x03a11830},
9450 {0x19, 0x04a19831},
9451 {0x1a, 0x0481303f},
9452 {0x1b, 0x04211020},
9453 {0x21, 0x0321101f}),
9454 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9455 ALC282_STANDARD_PINS,
9456 {0x12, 0x90a60940},
9457 {0x18, 0x03a11830},
9458 {0x19, 0x04a19831},
9459 {0x1a, 0x0481303f},
9460 {0x1b, 0x04211020},
9461 {0x21, 0x0321101f}),
76c2132e 9462 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9463 ALC282_STANDARD_PINS,
76c2132e 9464 {0x12, 0x90a60130},
76c2132e
DH
9465 {0x21, 0x0321101f}),
9466 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9467 {0x12, 0x90a60160},
9468 {0x14, 0x90170120},
76c2132e 9469 {0x21, 0x02211030}),
bc262179 9470 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9471 ALC282_STANDARD_PINS,
bc262179 9472 {0x12, 0x90a60130},
bc262179 9473 {0x19, 0x03a11020},
bc262179 9474 {0x21, 0x0321101f}),
c8c6ee61 9475 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
266fd994
SL
9476 {0x12, 0x90a60130},
9477 {0x14, 0x90170110},
9478 {0x19, 0x04a11040},
9479 {0x21, 0x04211020}),
9480 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9481 {0x14, 0x90170110},
9482 {0x19, 0x04a11040},
9483 {0x1d, 0x40600001},
9484 {0x21, 0x04211020}),
9485 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
c4cfcf6f
HW
9486 {0x14, 0x90170110},
9487 {0x19, 0x04a11040},
9488 {0x21, 0x04211020}),
c72b9bfe
HW
9489 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9490 {0x14, 0x90170110},
9491 {0x17, 0x90170111},
9492 {0x19, 0x03a11030},
9493 {0x21, 0x03211020}),
33aaebd4
CC
9494 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9495 {0x12, 0x90a60130},
9496 {0x17, 0x90170110},
9497 {0x21, 0x02211020}),
d44a6864 9498 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
e1e62b98 9499 {0x12, 0x90a60120},
e1e62b98 9500 {0x14, 0x90170110},
e1e62b98 9501 {0x21, 0x0321101f}),
e4442bcf 9502 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9503 ALC290_STANDARD_PINS,
e4442bcf 9504 {0x15, 0x04211040},
e4442bcf 9505 {0x18, 0x90170112},
11580297 9506 {0x1a, 0x04a11020}),
e4442bcf 9507 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9508 ALC290_STANDARD_PINS,
e4442bcf 9509 {0x15, 0x04211040},
e4442bcf 9510 {0x18, 0x90170110},
11580297 9511 {0x1a, 0x04a11020}),
e4442bcf 9512 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9513 ALC290_STANDARD_PINS,
e4442bcf 9514 {0x15, 0x0421101f},
11580297 9515 {0x1a, 0x04a11020}),
e4442bcf 9516 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9517 ALC290_STANDARD_PINS,
e4442bcf 9518 {0x15, 0x04211020},
11580297 9519 {0x1a, 0x04a11040}),
e4442bcf 9520 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9521 ALC290_STANDARD_PINS,
e4442bcf
HW
9522 {0x14, 0x90170110},
9523 {0x15, 0x04211020},
11580297 9524 {0x1a, 0x04a11040}),
e4442bcf 9525 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9526 ALC290_STANDARD_PINS,
e4442bcf
HW
9527 {0x14, 0x90170110},
9528 {0x15, 0x04211020},
11580297 9529 {0x1a, 0x04a11020}),
e4442bcf 9530 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9531 ALC290_STANDARD_PINS,
e4442bcf
HW
9532 {0x14, 0x90170110},
9533 {0x15, 0x0421101f},
11580297 9534 {0x1a, 0x04a11020}),
e8818fa8 9535 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 9536 ALC292_STANDARD_PINS,
e8818fa8 9537 {0x12, 0x90a60140},
e8818fa8 9538 {0x16, 0x01014020},
11580297 9539 {0x19, 0x01a19030}),
e8818fa8 9540 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 9541 ALC292_STANDARD_PINS,
e8818fa8 9542 {0x12, 0x90a60140},
e8818fa8
HW
9543 {0x16, 0x01014020},
9544 {0x18, 0x02a19031},
11580297 9545 {0x19, 0x01a1903e}),
76c2132e 9546 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
aec856d0 9547 ALC292_STANDARD_PINS,
11580297 9548 {0x12, 0x90a60140}),
76c2132e 9549 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9550 ALC292_STANDARD_PINS,
76c2132e 9551 {0x13, 0x90a60140},
76c2132e 9552 {0x16, 0x21014020},
11580297 9553 {0x19, 0x21a19030}),
e03fdbde 9554 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9555 ALC292_STANDARD_PINS,
11580297 9556 {0x13, 0x90a60140}),
eeacd80f
JHP
9557 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9558 {0x17, 0x90170110},
9559 {0x21, 0x04211020}),
d8ae458e
CC
9560 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9561 {0x14, 0x90170110},
9562 {0x1b, 0x90a70130},
9563 {0x21, 0x04211020}),
8bb37a2a
JHP
9564 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9565 {0x12, 0x90a60130},
9566 {0x17, 0x90170110},
9567 {0x21, 0x03211020}),
0bea4cc8
JHP
9568 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9569 {0x12, 0x90a60130},
9570 {0x17, 0x90170110},
9571 {0x21, 0x04211020}),
3887c26c
TI
9572 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9573 {0x12, 0x90a60130},
9574 {0x17, 0x90170110},
9575 {0x21, 0x03211020}),
9e43342b 9576 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
ad97d667
JHP
9577 {0x12, 0x90a60120},
9578 {0x17, 0x90170110},
9579 {0x21, 0x04211030}),
9580 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9e43342b
CC
9581 {0x12, 0x90a60130},
9582 {0x17, 0x90170110},
9583 {0x21, 0x03211020}),
9584 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9585 {0x12, 0x90a60130},
9586 {0x17, 0x90170110},
9587 {0x21, 0x03211020}),
fbc57129 9588 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
0a29c57b
KY
9589 {0x14, 0x90170110},
9590 {0x21, 0x04211020}),
fbc57129
KY
9591 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9592 {0x14, 0x90170110},
9593 {0x21, 0x04211030}),
3f640970 9594 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
f771d5bb
HW
9595 ALC295_STANDARD_PINS,
9596 {0x17, 0x21014020},
9597 {0x18, 0x21a19030}),
9598 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9599 ALC295_STANDARD_PINS,
9600 {0x17, 0x21014040},
9601 {0x18, 0x21a19050}),
3f307834
HW
9602 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9603 ALC295_STANDARD_PINS),
9f502ff5
TI
9604 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9605 ALC298_STANDARD_PINS,
9606 {0x17, 0x90170110}),
977e6276 9607 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
703867e2
WS
9608 ALC298_STANDARD_PINS,
9609 {0x17, 0x90170140}),
9610 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9611 ALC298_STANDARD_PINS,
9f502ff5 9612 {0x17, 0x90170150}),
9f1bc2c4
KHF
9613 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9614 {0x12, 0xb7a60140},
9615 {0x13, 0xb7a60150},
9616 {0x17, 0x90170110},
9617 {0x1a, 0x03011020},
9618 {0x21, 0x03211030}),
54324221
JM
9619 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9620 {0x12, 0xb7a60140},
9621 {0x17, 0x90170110},
9622 {0x1a, 0x03a11030},
9623 {0x21, 0x03211020}),
fcc6c877
KY
9624 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9625 ALC225_STANDARD_PINS,
9626 {0x12, 0xb7a60130},
fcc6c877 9627 {0x17, 0x90170110}),
573fcbfd
HW
9628 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9629 {0x14, 0x01014010},
9630 {0x17, 0x90170120},
9631 {0x18, 0x02a11030},
9632 {0x19, 0x02a1103f},
9633 {0x21, 0x0221101f}),
e1918938
HW
9634 {}
9635};
6dda9f4a 9636
7c0a6939
HW
9637/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9638 * more machines, don't need to match all valid pins, just need to match
9639 * all the pins defined in the tbl. Just because of this reason, it is possible
9640 * that a single machine matches multiple tbls, so there is one limitation:
9641 * at most one tbl is allowed to define for the same vendor and same codec
9642 */
9643static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9644 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9645 {0x19, 0x40000000},
9646 {0x1b, 0x40000000}),
aed8c7f4
HW
9647 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9648 {0x19, 0x40000000},
9649 {0x1a, 0x40000000}),
d64ebdbf
HW
9650 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9651 {0x19, 0x40000000},
9652 {0x1a, 0x40000000}),
5815bdfd
HW
9653 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9654 {0x19, 0x40000000},
9655 {0x1a, 0x40000000}),
7c0a6939
HW
9656 {}
9657};
9658
546bb678 9659static void alc269_fill_coef(struct hda_codec *codec)
1d045db9 9660{
526af6eb 9661 struct alc_spec *spec = codec->spec;
1d045db9 9662 int val;
ebb83eeb 9663
526af6eb 9664 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
546bb678 9665 return;
526af6eb 9666
1bb7e43e 9667 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
1d045db9
TI
9668 alc_write_coef_idx(codec, 0xf, 0x960b);
9669 alc_write_coef_idx(codec, 0xe, 0x8817);
9670 }
ebb83eeb 9671
1bb7e43e 9672 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
1d045db9
TI
9673 alc_write_coef_idx(codec, 0xf, 0x960b);
9674 alc_write_coef_idx(codec, 0xe, 0x8814);
9675 }
ebb83eeb 9676
1bb7e43e 9677 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9 9678 /* Power up output pin */
98b24883 9679 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
1d045db9 9680 }
ebb83eeb 9681
1bb7e43e 9682 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9 9683 val = alc_read_coef_idx(codec, 0xd);
f3ee07d8 9684 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
1d045db9
TI
9685 /* Capless ramp up clock control */
9686 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9687 }
9688 val = alc_read_coef_idx(codec, 0x17);
f3ee07d8 9689 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
1d045db9
TI
9690 /* Class D power on reset */
9691 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9692 }
9693 }
ebb83eeb 9694
98b24883
TI
9695 /* HP */
9696 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
1d045db9 9697}
a7f2371f 9698
1d045db9
TI
9699/*
9700 */
1d045db9
TI
9701static int patch_alc269(struct hda_codec *codec)
9702{
9703 struct alc_spec *spec;
3de95173 9704 int err;
f1d4e28b 9705
3de95173 9706 err = alc_alloc_spec(codec, 0x0b);
e16fb6d1 9707 if (err < 0)
3de95173
TI
9708 return err;
9709
9710 spec = codec->spec;
08c189f2 9711 spec->gen.shared_mic_vref_pin = 0x18;
317d9313 9712 codec->power_save_node = 0;
e16fb6d1 9713
225068ab
TI
9714#ifdef CONFIG_PM
9715 codec->patch_ops.suspend = alc269_suspend;
9716 codec->patch_ops.resume = alc269_resume;
9717#endif
c2d6af53
KY
9718 spec->shutup = alc_default_shutup;
9719 spec->init_hook = alc_default_init;
225068ab 9720
7639a06c 9721 switch (codec->core.vendor_id) {
065380f0 9722 case 0x10ec0269:
1d045db9 9723 spec->codec_variant = ALC269_TYPE_ALC269VA;
1bb7e43e
TI
9724 switch (alc_get_coef0(codec) & 0x00f0) {
9725 case 0x0010:
5100cd07
TI
9726 if (codec->bus->pci &&
9727 codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 9728 spec->cdefine.platform_type == 1)
20ca0c35 9729 err = alc_codec_rename(codec, "ALC271X");
1d045db9 9730 spec->codec_variant = ALC269_TYPE_ALC269VB;
1bb7e43e
TI
9731 break;
9732 case 0x0020:
5100cd07
TI
9733 if (codec->bus->pci &&
9734 codec->bus->pci->subsystem_vendor == 0x17aa &&
e16fb6d1 9735 codec->bus->pci->subsystem_device == 0x21f3)
20ca0c35 9736 err = alc_codec_rename(codec, "ALC3202");
1d045db9 9737 spec->codec_variant = ALC269_TYPE_ALC269VC;
1bb7e43e 9738 break;
adcc70b2
KY
9739 case 0x0030:
9740 spec->codec_variant = ALC269_TYPE_ALC269VD;
9741 break;
1bb7e43e 9742 default:
1d045db9 9743 alc_fix_pll_init(codec, 0x20, 0x04, 15);
1bb7e43e 9744 }
e16fb6d1
TI
9745 if (err < 0)
9746 goto error;
c2d6af53 9747 spec->shutup = alc269_shutup;
546bb678 9748 spec->init_hook = alc269_fill_coef;
1d045db9 9749 alc269_fill_coef(codec);
065380f0
KY
9750 break;
9751
9752 case 0x10ec0280:
9753 case 0x10ec0290:
9754 spec->codec_variant = ALC269_TYPE_ALC280;
9755 break;
9756 case 0x10ec0282:
065380f0 9757 spec->codec_variant = ALC269_TYPE_ALC282;
7b5c7a02
KY
9758 spec->shutup = alc282_shutup;
9759 spec->init_hook = alc282_init;
065380f0 9760 break;
2af02be7
KY
9761 case 0x10ec0233:
9762 case 0x10ec0283:
9763 spec->codec_variant = ALC269_TYPE_ALC283;
9764 spec->shutup = alc283_shutup;
9765 spec->init_hook = alc283_init;
9766 break;
065380f0
KY
9767 case 0x10ec0284:
9768 case 0x10ec0292:
9769 spec->codec_variant = ALC269_TYPE_ALC284;
9770 break;
161ebf29 9771 case 0x10ec0293:
4731d5de 9772 spec->codec_variant = ALC269_TYPE_ALC293;
161ebf29 9773 break;
7fc7d047 9774 case 0x10ec0286:
7c665932 9775 case 0x10ec0288:
7fc7d047
KY
9776 spec->codec_variant = ALC269_TYPE_ALC286;
9777 break;
506b62c3
KY
9778 case 0x10ec0298:
9779 spec->codec_variant = ALC269_TYPE_ALC298;
9780 break;
ea04a1db 9781 case 0x10ec0235:
1d04c9de
KY
9782 case 0x10ec0255:
9783 spec->codec_variant = ALC269_TYPE_ALC255;
ab3b8e51
KY
9784 spec->shutup = alc256_shutup;
9785 spec->init_hook = alc256_init;
1d04c9de 9786 break;
1948fc06 9787 case 0x10ec0230:
736f20a7 9788 case 0x10ec0236:
4344aec8
KY
9789 case 0x10ec0256:
9790 spec->codec_variant = ALC269_TYPE_ALC256;
4a219ef8
KY
9791 spec->shutup = alc256_shutup;
9792 spec->init_hook = alc256_init;
7d1b6e29 9793 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
4344aec8 9794 break;
f429e7e4
KY
9795 case 0x10ec0257:
9796 spec->codec_variant = ALC269_TYPE_ALC257;
88d42b2b
KY
9797 spec->shutup = alc256_shutup;
9798 spec->init_hook = alc256_init;
f429e7e4
KY
9799 spec->gen.mixer_nid = 0;
9800 break;
0a6f0600 9801 case 0x10ec0215:
7fbdcd83 9802 case 0x10ec0245:
0a6f0600
KY
9803 case 0x10ec0285:
9804 case 0x10ec0289:
9805 spec->codec_variant = ALC269_TYPE_ALC215;
1b6832be
KY
9806 spec->shutup = alc225_shutup;
9807 spec->init_hook = alc225_init;
0a6f0600
KY
9808 spec->gen.mixer_nid = 0;
9809 break;
4231430d 9810 case 0x10ec0225:
7d727869 9811 case 0x10ec0295:
28f1f9b2 9812 case 0x10ec0299:
4231430d 9813 spec->codec_variant = ALC269_TYPE_ALC225;
da911b1f
KY
9814 spec->shutup = alc225_shutup;
9815 spec->init_hook = alc225_init;
c1350bff 9816 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
4231430d 9817 break;
99cee034
KY
9818 case 0x10ec0287:
9819 spec->codec_variant = ALC269_TYPE_ALC287;
9820 spec->shutup = alc225_shutup;
9821 spec->init_hook = alc225_init;
9822 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
9823 break;
dcd4f0db
KY
9824 case 0x10ec0234:
9825 case 0x10ec0274:
9826 case 0x10ec0294:
9827 spec->codec_variant = ALC269_TYPE_ALC294;
532a7784 9828 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
71683c32 9829 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
693abe11 9830 spec->init_hook = alc294_init;
dcd4f0db 9831 break;
1078bef0
KY
9832 case 0x10ec0300:
9833 spec->codec_variant = ALC269_TYPE_ALC300;
9834 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
dcd4f0db 9835 break;
f0778871
KY
9836 case 0x10ec0623:
9837 spec->codec_variant = ALC269_TYPE_ALC623;
9838 break;
6fbae35a
KY
9839 case 0x10ec0700:
9840 case 0x10ec0701:
9841 case 0x10ec0703:
83629532 9842 case 0x10ec0711:
6fbae35a
KY
9843 spec->codec_variant = ALC269_TYPE_ALC700;
9844 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
2d7fe618 9845 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
693abe11 9846 spec->init_hook = alc294_init;
6fbae35a
KY
9847 break;
9848
1d045db9 9849 }
6dda9f4a 9850
ad60d502 9851 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
97a26570 9852 spec->has_alc5505_dsp = 1;
ad60d502
KY
9853 spec->init_hook = alc5505_dsp_init;
9854 }
9855
c9af753f
TI
9856 alc_pre_init(codec);
9857
efe55732
TI
9858 snd_hda_pick_fixup(codec, alc269_fixup_models,
9859 alc269_fixup_tbl, alc269_fixups);
13d9c6b9
TI
9860 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
9861 * the quirk breaks the latter (bko#214101).
9862 * Clear the wrong entry.
9863 */
9864 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
9865 codec->core.vendor_id == 0x10ec0294) {
9866 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
9867 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
9868 }
9869
0fc1e447 9870 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
7c0a6939 9871 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
efe55732
TI
9872 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
9873 alc269_fixups);
9874 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9875
9876 alc_auto_parse_customize_define(codec);
9877
9878 if (has_cdefine_beep(codec))
9879 spec->gen.beep_nid = 0x01;
9880
a4297b5d
TI
9881 /* automatic parse from the BIOS config */
9882 err = alc269_parse_auto_config(codec);
e16fb6d1
TI
9883 if (err < 0)
9884 goto error;
6dda9f4a 9885
fea80fae
TI
9886 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
9887 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
9888 if (err < 0)
9889 goto error;
9890 }
f1d4e28b 9891
1727a771 9892 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 9893
1d045db9 9894 return 0;
e16fb6d1
TI
9895
9896 error:
9897 alc_free(codec);
9898 return err;
1d045db9 9899}
f1d4e28b 9900
1d045db9
TI
9901/*
9902 * ALC861
9903 */
622e84cd 9904
1d045db9 9905static int alc861_parse_auto_config(struct hda_codec *codec)
6dda9f4a 9906{
1d045db9 9907 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
3e6179b8
TI
9908 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
9909 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
604401a9
TI
9910}
9911
1d045db9
TI
9912/* Pin config fixes */
9913enum {
e652f4c8
TI
9914 ALC861_FIXUP_FSC_AMILO_PI1505,
9915 ALC861_FIXUP_AMP_VREF_0F,
9916 ALC861_FIXUP_NO_JACK_DETECT,
9917 ALC861_FIXUP_ASUS_A6RP,
6ddf0fd1 9918 ALC660_FIXUP_ASUS_W7J,
1d045db9 9919};
7085ec12 9920
31150f23
TI
9921/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
9922static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
1727a771 9923 const struct hda_fixup *fix, int action)
31150f23
TI
9924{
9925 struct alc_spec *spec = codec->spec;
9926 unsigned int val;
9927
1727a771 9928 if (action != HDA_FIXUP_ACT_INIT)
31150f23 9929 return;
d3f02d60 9930 val = snd_hda_codec_get_pin_target(codec, 0x0f);
31150f23
TI
9931 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
9932 val |= AC_PINCTL_IN_EN;
9933 val |= AC_PINCTL_VREF_50;
cdd03ced 9934 snd_hda_set_pin_ctl(codec, 0x0f, val);
08c189f2 9935 spec->gen.keep_vref_in_automute = 1;
31150f23
TI
9936}
9937
e652f4c8
TI
9938/* suppress the jack-detection */
9939static void alc_fixup_no_jack_detect(struct hda_codec *codec,
1727a771 9940 const struct hda_fixup *fix, int action)
e652f4c8 9941{
1727a771 9942 if (action == HDA_FIXUP_ACT_PRE_PROBE)
e652f4c8 9943 codec->no_jack_detect = 1;
7d7eb9ea 9944}
e652f4c8 9945
1727a771 9946static const struct hda_fixup alc861_fixups[] = {
e652f4c8 9947 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
1727a771
TI
9948 .type = HDA_FIXUP_PINS,
9949 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
9950 { 0x0b, 0x0221101f }, /* HP */
9951 { 0x0f, 0x90170310 }, /* speaker */
9952 { }
9953 }
9954 },
e652f4c8 9955 [ALC861_FIXUP_AMP_VREF_0F] = {
1727a771 9956 .type = HDA_FIXUP_FUNC,
31150f23 9957 .v.func = alc861_fixup_asus_amp_vref_0f,
3b25eb69 9958 },
e652f4c8 9959 [ALC861_FIXUP_NO_JACK_DETECT] = {
1727a771 9960 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
9961 .v.func = alc_fixup_no_jack_detect,
9962 },
9963 [ALC861_FIXUP_ASUS_A6RP] = {
1727a771 9964 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
9965 .v.func = alc861_fixup_asus_amp_vref_0f,
9966 .chained = true,
9967 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
6ddf0fd1
TI
9968 },
9969 [ALC660_FIXUP_ASUS_W7J] = {
9970 .type = HDA_FIXUP_VERBS,
9971 .v.verbs = (const struct hda_verb[]) {
9972 /* ASUS W7J needs a magic pin setup on unused NID 0x10
9973 * for enabling outputs
9974 */
9975 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9976 { }
9977 },
e652f4c8 9978 }
1d045db9 9979};
7085ec12 9980
1d045db9 9981static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6ddf0fd1 9982 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
e7ca237b 9983 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
e652f4c8
TI
9984 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
9985 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
9986 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
defce244 9987 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
e652f4c8 9988 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
1d045db9
TI
9989 {}
9990};
3af9ee6b 9991
1d045db9
TI
9992/*
9993 */
1d045db9 9994static int patch_alc861(struct hda_codec *codec)
7085ec12 9995{
1d045db9 9996 struct alc_spec *spec;
1d045db9 9997 int err;
7085ec12 9998
3de95173
TI
9999 err = alc_alloc_spec(codec, 0x15);
10000 if (err < 0)
10001 return err;
1d045db9 10002
3de95173 10003 spec = codec->spec;
2722b535
TI
10004 if (has_cdefine_beep(codec))
10005 spec->gen.beep_nid = 0x23;
1d045db9 10006
225068ab
TI
10007#ifdef CONFIG_PM
10008 spec->power_hook = alc_power_eapd;
10009#endif
10010
c9af753f
TI
10011 alc_pre_init(codec);
10012
1727a771
TI
10013 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10014 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3af9ee6b 10015
cb4e4824
TI
10016 /* automatic parse from the BIOS config */
10017 err = alc861_parse_auto_config(codec);
e16fb6d1
TI
10018 if (err < 0)
10019 goto error;
3af9ee6b 10020
fea80fae
TI
10021 if (!spec->gen.no_analog) {
10022 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
10023 if (err < 0)
10024 goto error;
10025 }
7085ec12 10026
1727a771 10027 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10028
1d045db9 10029 return 0;
e16fb6d1
TI
10030
10031 error:
10032 alc_free(codec);
10033 return err;
7085ec12
TI
10034}
10035
1d045db9
TI
10036/*
10037 * ALC861-VD support
10038 *
10039 * Based on ALC882
10040 *
10041 * In addition, an independent DAC
10042 */
1d045db9 10043static int alc861vd_parse_auto_config(struct hda_codec *codec)
bc9f98a9 10044{
1d045db9 10045 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10046 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10047 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
ce764ab2
TI
10048}
10049
1d045db9 10050enum {
8fdcb6fe
TI
10051 ALC660VD_FIX_ASUS_GPIO1,
10052 ALC861VD_FIX_DALLAS,
1d045db9 10053};
ce764ab2 10054
8fdcb6fe
TI
10055/* exclude VREF80 */
10056static void alc861vd_fixup_dallas(struct hda_codec *codec,
1727a771 10057 const struct hda_fixup *fix, int action)
8fdcb6fe 10058{
1727a771 10059 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
b78562b1
TI
10060 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10061 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
8fdcb6fe
TI
10062 }
10063}
10064
df73d83f
TI
10065/* reset GPIO1 */
10066static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10067 const struct hda_fixup *fix, int action)
10068{
10069 struct alc_spec *spec = codec->spec;
10070
10071 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10072 spec->gpio_mask |= 0x02;
10073 alc_fixup_gpio(codec, action, 0x01);
10074}
10075
1727a771 10076static const struct hda_fixup alc861vd_fixups[] = {
1d045db9 10077 [ALC660VD_FIX_ASUS_GPIO1] = {
df73d83f
TI
10078 .type = HDA_FIXUP_FUNC,
10079 .v.func = alc660vd_fixup_asus_gpio1,
1d045db9 10080 },
8fdcb6fe 10081 [ALC861VD_FIX_DALLAS] = {
1727a771 10082 .type = HDA_FIXUP_FUNC,
8fdcb6fe
TI
10083 .v.func = alc861vd_fixup_dallas,
10084 },
1d045db9 10085};
ce764ab2 10086
1d045db9 10087static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
8fdcb6fe 10088 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
1d045db9 10089 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
8fdcb6fe 10090 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
1d045db9
TI
10091 {}
10092};
ce764ab2 10093
1d045db9
TI
10094/*
10095 */
1d045db9 10096static int patch_alc861vd(struct hda_codec *codec)
ce764ab2 10097{
1d045db9 10098 struct alc_spec *spec;
cb4e4824 10099 int err;
ce764ab2 10100
3de95173
TI
10101 err = alc_alloc_spec(codec, 0x0b);
10102 if (err < 0)
10103 return err;
1d045db9 10104
3de95173 10105 spec = codec->spec;
2722b535
TI
10106 if (has_cdefine_beep(codec))
10107 spec->gen.beep_nid = 0x23;
1d045db9 10108
225068ab
TI
10109 spec->shutup = alc_eapd_shutup;
10110
c9af753f
TI
10111 alc_pre_init(codec);
10112
1727a771
TI
10113 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10114 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1d045db9 10115
cb4e4824
TI
10116 /* automatic parse from the BIOS config */
10117 err = alc861vd_parse_auto_config(codec);
e16fb6d1
TI
10118 if (err < 0)
10119 goto error;
ce764ab2 10120
fea80fae
TI
10121 if (!spec->gen.no_analog) {
10122 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10123 if (err < 0)
10124 goto error;
10125 }
1d045db9 10126
1727a771 10127 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10128
ce764ab2 10129 return 0;
e16fb6d1
TI
10130
10131 error:
10132 alc_free(codec);
10133 return err;
ce764ab2
TI
10134}
10135
1d045db9
TI
10136/*
10137 * ALC662 support
10138 *
10139 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10140 * configuration. Each pin widget can choose any input DACs and a mixer.
10141 * Each ADC is connected from a mixer of all inputs. This makes possible
10142 * 6-channel independent captures.
10143 *
10144 * In addition, an independent DAC for the multi-playback (not used in this
10145 * driver yet).
10146 */
1d045db9
TI
10147
10148/*
10149 * BIOS auto configuration
10150 */
10151
bc9f98a9
KY
10152static int alc662_parse_auto_config(struct hda_codec *codec)
10153{
4c6d72d1 10154 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10155 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10156 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10157 const hda_nid_t *ssids;
ee979a14 10158
7639a06c
TI
10159 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10160 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10161 codec->core.vendor_id == 0x10ec0671)
3e6179b8 10162 ssids = alc663_ssids;
6227cdce 10163 else
3e6179b8
TI
10164 ssids = alc662_ssids;
10165 return alc_parse_auto_config(codec, alc662_ignore, ssids);
bc9f98a9
KY
10166}
10167
6be7948f 10168static void alc272_fixup_mario(struct hda_codec *codec,
1727a771 10169 const struct hda_fixup *fix, int action)
6fc398cb 10170{
9bb1f06f 10171 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6fc398cb 10172 return;
6be7948f
TB
10173 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10174 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10175 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10176 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10177 (0 << AC_AMPCAP_MUTE_SHIFT)))
4e76a883 10178 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
6be7948f
TB
10179}
10180
8e383953
TI
10181static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10182 { .channels = 2,
10183 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10184 { .channels = 4,
10185 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10186 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10187 { }
10188};
10189
10190/* override the 2.1 chmap */
eb9ca3ab 10191static void alc_fixup_bass_chmap(struct hda_codec *codec,
8e383953
TI
10192 const struct hda_fixup *fix, int action)
10193{
10194 if (action == HDA_FIXUP_ACT_BUILD) {
10195 struct alc_spec *spec = codec->spec;
bbbc7e85 10196 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8e383953
TI
10197 }
10198}
10199
bf68665d
TI
10200/* avoid D3 for keeping GPIO up */
10201static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10202 hda_nid_t nid,
10203 unsigned int power_state)
10204{
10205 struct alc_spec *spec = codec->spec;
d261eec8 10206 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
bf68665d
TI
10207 return AC_PWRST_D0;
10208 return power_state;
10209}
10210
3e887f37
TI
10211static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10212 const struct hda_fixup *fix, int action)
10213{
10214 struct alc_spec *spec = codec->spec;
3e887f37 10215
01e4a275 10216 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
3e887f37 10217 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19 10218 spec->mute_led_polarity = 1;
bf68665d 10219 codec->power_filter = gpio_led_power_filter;
3e887f37
TI
10220 }
10221}
10222
c6790c8e
KY
10223static void alc662_usi_automute_hook(struct hda_codec *codec,
10224 struct hda_jack_callback *jack)
10225{
10226 struct alc_spec *spec = codec->spec;
10227 int vref;
10228 msleep(200);
10229 snd_hda_gen_hp_automute(codec, jack);
10230
10231 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10232 msleep(100);
10233 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10234 vref);
10235}
10236
10237static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10238 const struct hda_fixup *fix, int action)
10239{
10240 struct alc_spec *spec = codec->spec;
10241 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10242 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10243 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10244 }
10245}
10246
00066e97
SB
10247static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10248 struct hda_jack_callback *cb)
10249{
10250 /* surround speakers at 0x1b already get muted automatically when
10251 * headphones are plugged in, but we have to mute/unmute the remaining
10252 * channels manually:
10253 * 0x15 - front left/front right
10254 * 0x18 - front center/ LFE
10255 */
10256 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10257 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10258 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10259 } else {
10260 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10261 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10262 }
10263}
10264
10265static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10266 const struct hda_fixup *fix, int action)
10267{
10268 /* Pin 0x1b: shared headphones jack and surround speakers */
10269 if (!is_jack_detectable(codec, 0x1b))
10270 return;
10271
10272 switch (action) {
10273 case HDA_FIXUP_ACT_PRE_PROBE:
10274 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10275 alc662_aspire_ethos_mute_speakers);
336820c4
TI
10276 /* subwoofer needs an extra GPIO setting to become audible */
10277 alc_setup_gpio(codec, 0x02);
00066e97
SB
10278 break;
10279 case HDA_FIXUP_ACT_INIT:
10280 /* Make sure to start in a correct state, i.e. if
10281 * headphones have been plugged in before powering up the system
10282 */
10283 alc662_aspire_ethos_mute_speakers(codec, NULL);
10284 break;
10285 }
10286}
10287
5af29028
KY
10288static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10289 const struct hda_fixup *fix, int action)
10290{
10291 struct alc_spec *spec = codec->spec;
10292
10293 static const struct hda_pintbl pincfgs[] = {
10294 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10295 { 0x1b, 0x0181304f },
10296 { }
10297 };
10298
10299 switch (action) {
10300 case HDA_FIXUP_ACT_PRE_PROBE:
10301 spec->gen.mixer_nid = 0;
10302 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10303 snd_hda_apply_pincfgs(codec, pincfgs);
10304 break;
10305 case HDA_FIXUP_ACT_INIT:
10306 alc_write_coef_idx(codec, 0x19, 0xa054);
10307 break;
10308 }
10309}
10310
09ad269c
KY
10311static void alc897_hp_automute_hook(struct hda_codec *codec,
10312 struct hda_jack_callback *jack)
10313{
10314 struct alc_spec *spec = codec->spec;
10315 int vref;
10316
10317 snd_hda_gen_hp_automute(codec, jack);
10318 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10319 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10320 vref);
10321}
10322
10323static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10324 const struct hda_fixup *fix, int action)
10325{
10326 struct alc_spec *spec = codec->spec;
10327 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10328 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10329 }
10330}
10331
6b0f95c4 10332static const struct coef_fw alc668_coefs[] = {
f3f9185f
KY
10333 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10334 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10335 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10336 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10337 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10338 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10339 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10340 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10341 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10342 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10343 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10344 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10345 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10346 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10347 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10348 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10349 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10350 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10351 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10352 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10353 {}
10354};
10355
10356static void alc668_restore_default_value(struct hda_codec *codec)
10357{
10358 alc_process_coef_fw(codec, alc668_coefs);
10359}
10360
6cb3b707 10361enum {
2df03514 10362 ALC662_FIXUP_ASPIRE,
3e887f37 10363 ALC662_FIXUP_LED_GPIO1,
6cb3b707 10364 ALC662_FIXUP_IDEAPAD,
6be7948f 10365 ALC272_FIXUP_MARIO,
f1ec5be1 10366 ALC662_FIXUP_CZC_ET26,
d2ebd479 10367 ALC662_FIXUP_CZC_P10T,
94024cd1 10368 ALC662_FIXUP_SKU_IGNORE,
e59ea3ed 10369 ALC662_FIXUP_HP_RP5800,
53c334ad
TI
10370 ALC662_FIXUP_ASUS_MODE1,
10371 ALC662_FIXUP_ASUS_MODE2,
10372 ALC662_FIXUP_ASUS_MODE3,
10373 ALC662_FIXUP_ASUS_MODE4,
10374 ALC662_FIXUP_ASUS_MODE5,
10375 ALC662_FIXUP_ASUS_MODE6,
10376 ALC662_FIXUP_ASUS_MODE7,
10377 ALC662_FIXUP_ASUS_MODE8,
1565cc35 10378 ALC662_FIXUP_NO_JACK_DETECT,
edfe3bfc 10379 ALC662_FIXUP_ZOTAC_Z68,
125821ae 10380 ALC662_FIXUP_INV_DMIC,
1f8b46cd 10381 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
73bdd597 10382 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 10383 ALC662_FIXUP_HEADSET_MODE,
73bdd597 10384 ALC668_FIXUP_HEADSET_MODE,
8e54b4ac 10385 ALC662_FIXUP_BASS_MODE4_CHMAP,
61a75f13 10386 ALC662_FIXUP_BASS_16,
a30c9aaa 10387 ALC662_FIXUP_BASS_1A,
8e54b4ac 10388 ALC662_FIXUP_BASS_CHMAP,
493a52a9 10389 ALC668_FIXUP_AUTO_MUTE,
5e6db669 10390 ALC668_FIXUP_DELL_DISABLE_AAMIX,
033b0a7c 10391 ALC668_FIXUP_DELL_XPS13,
9d4dc584 10392 ALC662_FIXUP_ASUS_Nx50,
fc7438b1 10393 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 10394 ALC668_FIXUP_ASUS_Nx51,
5b7c5e1f 10395 ALC668_FIXUP_MIC_COEF,
11ba6111 10396 ALC668_FIXUP_ASUS_G751,
78f4f7c2
KY
10397 ALC891_FIXUP_HEADSET_MODE,
10398 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9b51fe3e 10399 ALC662_FIXUP_ACER_VERITON,
1a3f0991 10400 ALC892_FIXUP_ASROCK_MOBO,
c6790c8e
KY
10401 ALC662_FIXUP_USI_FUNC,
10402 ALC662_FIXUP_USI_HEADSET_MODE,
ca169cc2 10403 ALC662_FIXUP_LENOVO_MULTI_CODECS,
00066e97 10404 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
00066e97 10405 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
5af29028 10406 ALC671_FIXUP_HP_HEADSET_MIC2,
d858c706 10407 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
a124458a 10408 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
a3fd1a98
HW
10409 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10410 ALC668_FIXUP_HEADSET_MIC,
10411 ALC668_FIXUP_MIC_DET_COEF,
09ad269c
KY
10412 ALC897_FIXUP_LENOVO_HEADSET_MIC,
10413 ALC897_FIXUP_HEADSET_MIC_PIN,
6cb3b707
DH
10414};
10415
1727a771 10416static const struct hda_fixup alc662_fixups[] = {
2df03514 10417 [ALC662_FIXUP_ASPIRE] = {
1727a771
TI
10418 .type = HDA_FIXUP_PINS,
10419 .v.pins = (const struct hda_pintbl[]) {
2df03514
DC
10420 { 0x15, 0x99130112 }, /* subwoofer */
10421 { }
10422 }
10423 },
3e887f37
TI
10424 [ALC662_FIXUP_LED_GPIO1] = {
10425 .type = HDA_FIXUP_FUNC,
10426 .v.func = alc662_fixup_led_gpio1,
10427 },
6cb3b707 10428 [ALC662_FIXUP_IDEAPAD] = {
1727a771
TI
10429 .type = HDA_FIXUP_PINS,
10430 .v.pins = (const struct hda_pintbl[]) {
6cb3b707
DH
10431 { 0x17, 0x99130112 }, /* subwoofer */
10432 { }
3e887f37
TI
10433 },
10434 .chained = true,
10435 .chain_id = ALC662_FIXUP_LED_GPIO1,
6cb3b707 10436 },
6be7948f 10437 [ALC272_FIXUP_MARIO] = {
1727a771 10438 .type = HDA_FIXUP_FUNC,
b5bfbc67 10439 .v.func = alc272_fixup_mario,
d2ebd479 10440 },
f1ec5be1
HC
10441 [ALC662_FIXUP_CZC_ET26] = {
10442 .type = HDA_FIXUP_PINS,
10443 .v.pins = (const struct hda_pintbl[]) {
10444 {0x12, 0x403cc000},
10445 {0x14, 0x90170110}, /* speaker */
10446 {0x15, 0x411111f0},
10447 {0x16, 0x411111f0},
10448 {0x18, 0x01a19030}, /* mic */
10449 {0x19, 0x90a7013f}, /* int-mic */
10450 {0x1a, 0x01014020},
10451 {0x1b, 0x0121401f},
10452 {0x1c, 0x411111f0},
10453 {0x1d, 0x411111f0},
10454 {0x1e, 0x40478e35},
10455 {}
10456 },
10457 .chained = true,
10458 .chain_id = ALC662_FIXUP_SKU_IGNORE
10459 },
d2ebd479 10460 [ALC662_FIXUP_CZC_P10T] = {
1727a771 10461 .type = HDA_FIXUP_VERBS,
d2ebd479
AA
10462 .v.verbs = (const struct hda_verb[]) {
10463 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10464 {}
10465 }
10466 },
94024cd1 10467 [ALC662_FIXUP_SKU_IGNORE] = {
1727a771 10468 .type = HDA_FIXUP_FUNC,
23d30f28 10469 .v.func = alc_fixup_sku_ignore,
c6b35874 10470 },
e59ea3ed 10471 [ALC662_FIXUP_HP_RP5800] = {
1727a771
TI
10472 .type = HDA_FIXUP_PINS,
10473 .v.pins = (const struct hda_pintbl[]) {
e59ea3ed
TI
10474 { 0x14, 0x0221201f }, /* HP out */
10475 { }
10476 },
10477 .chained = true,
10478 .chain_id = ALC662_FIXUP_SKU_IGNORE
10479 },
53c334ad 10480 [ALC662_FIXUP_ASUS_MODE1] = {
1727a771
TI
10481 .type = HDA_FIXUP_PINS,
10482 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10483 { 0x14, 0x99130110 }, /* speaker */
10484 { 0x18, 0x01a19c20 }, /* mic */
10485 { 0x19, 0x99a3092f }, /* int-mic */
10486 { 0x21, 0x0121401f }, /* HP out */
10487 { }
10488 },
10489 .chained = true,
10490 .chain_id = ALC662_FIXUP_SKU_IGNORE
10491 },
10492 [ALC662_FIXUP_ASUS_MODE2] = {
1727a771
TI
10493 .type = HDA_FIXUP_PINS,
10494 .v.pins = (const struct hda_pintbl[]) {
2996bdba
TI
10495 { 0x14, 0x99130110 }, /* speaker */
10496 { 0x18, 0x01a19820 }, /* mic */
10497 { 0x19, 0x99a3092f }, /* int-mic */
10498 { 0x1b, 0x0121401f }, /* HP out */
10499 { }
10500 },
53c334ad
TI
10501 .chained = true,
10502 .chain_id = ALC662_FIXUP_SKU_IGNORE
10503 },
10504 [ALC662_FIXUP_ASUS_MODE3] = {
1727a771
TI
10505 .type = HDA_FIXUP_PINS,
10506 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10507 { 0x14, 0x99130110 }, /* speaker */
10508 { 0x15, 0x0121441f }, /* HP */
10509 { 0x18, 0x01a19840 }, /* mic */
10510 { 0x19, 0x99a3094f }, /* int-mic */
10511 { 0x21, 0x01211420 }, /* HP2 */
10512 { }
10513 },
10514 .chained = true,
10515 .chain_id = ALC662_FIXUP_SKU_IGNORE
10516 },
10517 [ALC662_FIXUP_ASUS_MODE4] = {
1727a771
TI
10518 .type = HDA_FIXUP_PINS,
10519 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10520 { 0x14, 0x99130110 }, /* speaker */
10521 { 0x16, 0x99130111 }, /* speaker */
10522 { 0x18, 0x01a19840 }, /* mic */
10523 { 0x19, 0x99a3094f }, /* int-mic */
10524 { 0x21, 0x0121441f }, /* HP */
10525 { }
10526 },
10527 .chained = true,
10528 .chain_id = ALC662_FIXUP_SKU_IGNORE
10529 },
10530 [ALC662_FIXUP_ASUS_MODE5] = {
1727a771
TI
10531 .type = HDA_FIXUP_PINS,
10532 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10533 { 0x14, 0x99130110 }, /* speaker */
10534 { 0x15, 0x0121441f }, /* HP */
10535 { 0x16, 0x99130111 }, /* speaker */
10536 { 0x18, 0x01a19840 }, /* mic */
10537 { 0x19, 0x99a3094f }, /* int-mic */
10538 { }
10539 },
10540 .chained = true,
10541 .chain_id = ALC662_FIXUP_SKU_IGNORE
10542 },
10543 [ALC662_FIXUP_ASUS_MODE6] = {
1727a771
TI
10544 .type = HDA_FIXUP_PINS,
10545 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10546 { 0x14, 0x99130110 }, /* speaker */
10547 { 0x15, 0x01211420 }, /* HP2 */
10548 { 0x18, 0x01a19840 }, /* mic */
10549 { 0x19, 0x99a3094f }, /* int-mic */
10550 { 0x1b, 0x0121441f }, /* HP */
10551 { }
10552 },
10553 .chained = true,
10554 .chain_id = ALC662_FIXUP_SKU_IGNORE
10555 },
10556 [ALC662_FIXUP_ASUS_MODE7] = {
1727a771
TI
10557 .type = HDA_FIXUP_PINS,
10558 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10559 { 0x14, 0x99130110 }, /* speaker */
10560 { 0x17, 0x99130111 }, /* speaker */
10561 { 0x18, 0x01a19840 }, /* mic */
10562 { 0x19, 0x99a3094f }, /* int-mic */
10563 { 0x1b, 0x01214020 }, /* HP */
10564 { 0x21, 0x0121401f }, /* HP */
10565 { }
10566 },
10567 .chained = true,
10568 .chain_id = ALC662_FIXUP_SKU_IGNORE
10569 },
10570 [ALC662_FIXUP_ASUS_MODE8] = {
1727a771
TI
10571 .type = HDA_FIXUP_PINS,
10572 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10573 { 0x14, 0x99130110 }, /* speaker */
10574 { 0x12, 0x99a30970 }, /* int-mic */
10575 { 0x15, 0x01214020 }, /* HP */
10576 { 0x17, 0x99130111 }, /* speaker */
10577 { 0x18, 0x01a19840 }, /* mic */
10578 { 0x21, 0x0121401f }, /* HP */
10579 { }
10580 },
10581 .chained = true,
10582 .chain_id = ALC662_FIXUP_SKU_IGNORE
2996bdba 10583 },
1565cc35 10584 [ALC662_FIXUP_NO_JACK_DETECT] = {
1727a771 10585 .type = HDA_FIXUP_FUNC,
1565cc35
TI
10586 .v.func = alc_fixup_no_jack_detect,
10587 },
edfe3bfc 10588 [ALC662_FIXUP_ZOTAC_Z68] = {
1727a771
TI
10589 .type = HDA_FIXUP_PINS,
10590 .v.pins = (const struct hda_pintbl[]) {
edfe3bfc
DH
10591 { 0x1b, 0x02214020 }, /* Front HP */
10592 { }
10593 }
10594 },
125821ae 10595 [ALC662_FIXUP_INV_DMIC] = {
1727a771 10596 .type = HDA_FIXUP_FUNC,
9d36a7dc 10597 .v.func = alc_fixup_inv_dmic,
125821ae 10598 },
033b0a7c
GM
10599 [ALC668_FIXUP_DELL_XPS13] = {
10600 .type = HDA_FIXUP_FUNC,
10601 .v.func = alc_fixup_dell_xps13,
10602 .chained = true,
10603 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10604 },
5e6db669
GM
10605 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10606 .type = HDA_FIXUP_FUNC,
10607 .v.func = alc_fixup_disable_aamix,
10608 .chained = true,
10609 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10610 },
493a52a9
HW
10611 [ALC668_FIXUP_AUTO_MUTE] = {
10612 .type = HDA_FIXUP_FUNC,
10613 .v.func = alc_fixup_auto_mute_via_amp,
10614 .chained = true,
10615 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10616 },
1f8b46cd
DH
10617 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10618 .type = HDA_FIXUP_PINS,
10619 .v.pins = (const struct hda_pintbl[]) {
10620 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10621 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10622 { }
10623 },
10624 .chained = true,
10625 .chain_id = ALC662_FIXUP_HEADSET_MODE
10626 },
10627 [ALC662_FIXUP_HEADSET_MODE] = {
10628 .type = HDA_FIXUP_FUNC,
10629 .v.func = alc_fixup_headset_mode_alc662,
10630 },
73bdd597
DH
10631 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10632 .type = HDA_FIXUP_PINS,
10633 .v.pins = (const struct hda_pintbl[]) {
10634 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10635 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10636 { }
10637 },
10638 .chained = true,
10639 .chain_id = ALC668_FIXUP_HEADSET_MODE
10640 },
10641 [ALC668_FIXUP_HEADSET_MODE] = {
10642 .type = HDA_FIXUP_FUNC,
10643 .v.func = alc_fixup_headset_mode_alc668,
10644 },
8e54b4ac 10645 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8e383953 10646 .type = HDA_FIXUP_FUNC,
eb9ca3ab 10647 .v.func = alc_fixup_bass_chmap,
8e383953
TI
10648 .chained = true,
10649 .chain_id = ALC662_FIXUP_ASUS_MODE4
10650 },
61a75f13
DH
10651 [ALC662_FIXUP_BASS_16] = {
10652 .type = HDA_FIXUP_PINS,
10653 .v.pins = (const struct hda_pintbl[]) {
10654 {0x16, 0x80106111}, /* bass speaker */
10655 {}
10656 },
10657 .chained = true,
10658 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10659 },
a30c9aaa
TI
10660 [ALC662_FIXUP_BASS_1A] = {
10661 .type = HDA_FIXUP_PINS,
10662 .v.pins = (const struct hda_pintbl[]) {
10663 {0x1a, 0x80106111}, /* bass speaker */
10664 {}
10665 },
8e54b4ac
DH
10666 .chained = true,
10667 .chain_id = ALC662_FIXUP_BASS_CHMAP,
a30c9aaa 10668 },
8e54b4ac 10669 [ALC662_FIXUP_BASS_CHMAP] = {
a30c9aaa 10670 .type = HDA_FIXUP_FUNC,
eb9ca3ab 10671 .v.func = alc_fixup_bass_chmap,
a30c9aaa 10672 },
9d4dc584
BM
10673 [ALC662_FIXUP_ASUS_Nx50] = {
10674 .type = HDA_FIXUP_FUNC,
10675 .v.func = alc_fixup_auto_mute_via_amp,
10676 .chained = true,
10677 .chain_id = ALC662_FIXUP_BASS_1A
10678 },
fc7438b1
MP
10679 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10680 .type = HDA_FIXUP_FUNC,
10681 .v.func = alc_fixup_headset_mode_alc668,
10682 .chain_id = ALC662_FIXUP_BASS_CHMAP
10683 },
3231e205
YP
10684 [ALC668_FIXUP_ASUS_Nx51] = {
10685 .type = HDA_FIXUP_PINS,
10686 .v.pins = (const struct hda_pintbl[]) {
fc7438b1
MP
10687 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10688 { 0x1a, 0x90170151 }, /* bass speaker */
10689 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
3231e205
YP
10690 {}
10691 },
10692 .chained = true,
fc7438b1 10693 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 10694 },
5b7c5e1f 10695 [ALC668_FIXUP_MIC_COEF] = {
11ba6111
TI
10696 .type = HDA_FIXUP_VERBS,
10697 .v.verbs = (const struct hda_verb[]) {
10698 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10699 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10700 {}
10701 },
10702 },
5b7c5e1f
TI
10703 [ALC668_FIXUP_ASUS_G751] = {
10704 .type = HDA_FIXUP_PINS,
10705 .v.pins = (const struct hda_pintbl[]) {
10706 { 0x16, 0x0421101f }, /* HP */
10707 {}
10708 },
10709 .chained = true,
10710 .chain_id = ALC668_FIXUP_MIC_COEF
10711 },
78f4f7c2
KY
10712 [ALC891_FIXUP_HEADSET_MODE] = {
10713 .type = HDA_FIXUP_FUNC,
10714 .v.func = alc_fixup_headset_mode,
10715 },
10716 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10717 .type = HDA_FIXUP_PINS,
10718 .v.pins = (const struct hda_pintbl[]) {
10719 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10720 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10721 { }
10722 },
10723 .chained = true,
10724 .chain_id = ALC891_FIXUP_HEADSET_MODE
10725 },
9b51fe3e
SB
10726 [ALC662_FIXUP_ACER_VERITON] = {
10727 .type = HDA_FIXUP_PINS,
10728 .v.pins = (const struct hda_pintbl[]) {
10729 { 0x15, 0x50170120 }, /* no internal speaker */
10730 { }
10731 }
10732 },
1a3f0991
TI
10733 [ALC892_FIXUP_ASROCK_MOBO] = {
10734 .type = HDA_FIXUP_PINS,
10735 .v.pins = (const struct hda_pintbl[]) {
10736 { 0x15, 0x40f000f0 }, /* disabled */
10737 { 0x16, 0x40f000f0 }, /* disabled */
1a3f0991
TI
10738 { }
10739 }
10740 },
c6790c8e
KY
10741 [ALC662_FIXUP_USI_FUNC] = {
10742 .type = HDA_FIXUP_FUNC,
10743 .v.func = alc662_fixup_usi_headset_mic,
10744 },
10745 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10746 .type = HDA_FIXUP_PINS,
10747 .v.pins = (const struct hda_pintbl[]) {
10748 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10749 { 0x18, 0x01a1903d },
10750 { }
10751 },
10752 .chained = true,
10753 .chain_id = ALC662_FIXUP_USI_FUNC
10754 },
ca169cc2
KY
10755 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10756 .type = HDA_FIXUP_FUNC,
10757 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10758 },
00066e97
SB
10759 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10760 .type = HDA_FIXUP_FUNC,
10761 .v.func = alc662_fixup_aspire_ethos_hp,
10762 },
00066e97
SB
10763 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10764 .type = HDA_FIXUP_PINS,
10765 .v.pins = (const struct hda_pintbl[]) {
10766 { 0x15, 0x92130110 }, /* front speakers */
10767 { 0x18, 0x99130111 }, /* center/subwoofer */
10768 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10769 { }
10770 },
10771 .chained = true,
336820c4 10772 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
00066e97 10773 },
5af29028
KY
10774 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10775 .type = HDA_FIXUP_FUNC,
10776 .v.func = alc671_fixup_hp_headset_mic2,
10777 },
d858c706
JHP
10778 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10779 .type = HDA_FIXUP_PINS,
10780 .v.pins = (const struct hda_pintbl[]) {
10781 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10782 { }
10783 },
10784 .chained = true,
10785 .chain_id = ALC662_FIXUP_USI_FUNC
10786 },
a124458a
JHP
10787 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10788 .type = HDA_FIXUP_PINS,
10789 .v.pins = (const struct hda_pintbl[]) {
10790 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10791 { 0x1b, 0x0221144f },
10792 { }
10793 },
10794 .chained = true,
10795 .chain_id = ALC662_FIXUP_USI_FUNC
10796 },
a3fd1a98
HW
10797 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
10798 .type = HDA_FIXUP_PINS,
10799 .v.pins = (const struct hda_pintbl[]) {
10800 { 0x1b, 0x04a1112c },
10801 { }
10802 },
10803 .chained = true,
10804 .chain_id = ALC668_FIXUP_HEADSET_MIC
10805 },
10806 [ALC668_FIXUP_HEADSET_MIC] = {
10807 .type = HDA_FIXUP_FUNC,
10808 .v.func = alc269_fixup_headset_mic,
10809 .chained = true,
10810 .chain_id = ALC668_FIXUP_MIC_DET_COEF
10811 },
10812 [ALC668_FIXUP_MIC_DET_COEF] = {
10813 .type = HDA_FIXUP_VERBS,
10814 .v.verbs = (const struct hda_verb[]) {
10815 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
10816 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
10817 {}
10818 },
10819 },
09ad269c
KY
10820 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
10821 .type = HDA_FIXUP_FUNC,
10822 .v.func = alc897_fixup_lenovo_headset_mic,
10823 },
10824 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
10825 .type = HDA_FIXUP_PINS,
10826 .v.pins = (const struct hda_pintbl[]) {
10827 { 0x1a, 0x03a11050 },
10828 { }
10829 },
10830 .chained = true,
10831 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
10832 },
6cb3b707
DH
10833};
10834
a9111321 10835static const struct snd_pci_quirk alc662_fixup_tbl[] = {
53c334ad 10836 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
d3d3835c 10837 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
02f6ff90 10838 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
a6c47a85 10839 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
94024cd1 10840 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
125821ae 10841 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
1801928e 10842 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
2df03514 10843 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
9edeb110 10844 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
a124458a 10845 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
d858c706 10846 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
73bdd597
DH
10847 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10848 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
c5d019c3 10849 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
033b0a7c 10850 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
467e1436 10851 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
09d2014f 10852 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
ad8ff99e 10853 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8dc9abb9
KY
10854 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10855 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6a98e34b 10856 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
e59ea3ed 10857 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
148ebf54 10858 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
2da2dc9e 10859 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
83a9efb5 10860 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
9d4dc584 10861 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11ba6111 10862 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
9edeb110 10863 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
8e54b4ac 10864 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
61a75f13 10865 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
3231e205
YP
10866 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
10867 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
a3fd1a98 10868 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
c7efff92 10869 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
61a75f13 10870 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8e54b4ac 10871 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
1565cc35 10872 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
53c334ad 10873 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
a0e90acc 10874 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
c6790c8e 10875 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
ca169cc2 10876 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
09ad269c
KY
10877 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
10878 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
10879 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
10880 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
d4118588 10881 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6cb3b707 10882 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1a3f0991 10883 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
edfe3bfc 10884 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
9b51fe3e 10885 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
f1ec5be1 10886 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
d2ebd479 10887 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
53c334ad
TI
10888
10889#if 0
10890 /* Below is a quirk table taken from the old code.
10891 * Basically the device should work as is without the fixup table.
10892 * If BIOS doesn't give a proper info, enable the corresponding
10893 * fixup entry.
7d7eb9ea 10894 */
53c334ad
TI
10895 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
10896 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
10897 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
10898 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
10899 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10900 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10901 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10902 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
10903 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
10904 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10905 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
10906 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
10907 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
10908 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
10909 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
10910 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10911 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
10912 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
10913 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10914 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10915 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10916 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10917 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
10918 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
10919 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
10920 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10921 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
10922 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10923 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10924 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
10925 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10926 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10927 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
10928 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
10929 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
10930 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
10931 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
10932 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
10933 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
10934 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10935 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
10936 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
10937 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10938 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
10939 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
10940 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
10941 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
10942 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
10943 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10944 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
10945#endif
6cb3b707
DH
10946 {}
10947};
10948
1727a771 10949static const struct hda_model_fixup alc662_fixup_models[] = {
aa3841b5
TI
10950 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
10951 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
6be7948f 10952 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
aa3841b5 10953 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
53c334ad
TI
10954 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
10955 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
10956 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
10957 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
10958 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
10959 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
10960 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
10961 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
aa3841b5 10962 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
6e72aa5f 10963 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
aa3841b5 10964 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
e32aa85a 10965 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
aa3841b5
TI
10966 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
10967 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
10968 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
10969 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
10970 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
10971 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
10972 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
10973 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
40c51675 10974 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
aa3841b5
TI
10975 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
10976 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
10977 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
10978 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
10979 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
ba90d6a6 10980 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
00066e97 10981 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
6be7948f
TB
10982 {}
10983};
6cb3b707 10984
532895c5 10985static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
78f4f7c2
KY
10986 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10987 {0x17, 0x02211010},
10988 {0x18, 0x01a19030},
10989 {0x1a, 0x01813040},
10990 {0x21, 0x01014020}),
4b4e0e32
HW
10991 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10992 {0x16, 0x01813030},
10993 {0x17, 0x02211010},
10994 {0x18, 0x01a19040},
10995 {0x21, 0x01014020}),
1f8b46cd 10996 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 10997 {0x14, 0x01014010},
1f8b46cd 10998 {0x18, 0x01a19020},
1f8b46cd 10999 {0x1a, 0x0181302f},
11580297 11000 {0x1b, 0x0221401f}),
76c2132e
DH
11001 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11002 {0x12, 0x99a30130},
11003 {0x14, 0x90170110},
11004 {0x15, 0x0321101f},
11580297 11005 {0x16, 0x03011020}),
76c2132e
DH
11006 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11007 {0x12, 0x99a30140},
11008 {0x14, 0x90170110},
11009 {0x15, 0x0321101f},
11580297 11010 {0x16, 0x03011020}),
76c2132e
DH
11011 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11012 {0x12, 0x99a30150},
11013 {0x14, 0x90170110},
11014 {0x15, 0x0321101f},
11580297 11015 {0x16, 0x03011020}),
76c2132e 11016 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
76c2132e
DH
11017 {0x14, 0x90170110},
11018 {0x15, 0x0321101f},
11580297 11019 {0x16, 0x03011020}),
76c2132e
DH
11020 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
11021 {0x12, 0x90a60130},
11022 {0x14, 0x90170110},
11580297 11023 {0x15, 0x0321101f}),
5af29028
KY
11024 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11025 {0x14, 0x01014010},
11026 {0x17, 0x90170150},
f2adbae0 11027 {0x19, 0x02a11060},
5af29028
KY
11028 {0x1b, 0x01813030},
11029 {0x21, 0x02211020}),
11030 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11031 {0x14, 0x01014010},
11032 {0x18, 0x01a19040},
11033 {0x1b, 0x01813030},
11034 {0x21, 0x02211020}),
11035 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11036 {0x14, 0x01014020},
11037 {0x17, 0x90170110},
11038 {0x18, 0x01a19050},
11039 {0x1b, 0x01813040},
11040 {0x21, 0x02211030}),
532895c5
HW
11041 {}
11042};
11043
1d045db9
TI
11044/*
11045 */
bc9f98a9
KY
11046static int patch_alc662(struct hda_codec *codec)
11047{
11048 struct alc_spec *spec;
3de95173 11049 int err;
bc9f98a9 11050
3de95173
TI
11051 err = alc_alloc_spec(codec, 0x0b);
11052 if (err < 0)
11053 return err;
bc9f98a9 11054
3de95173 11055 spec = codec->spec;
1f0f4b80 11056
225068ab
TI
11057 spec->shutup = alc_eapd_shutup;
11058
53c334ad
TI
11059 /* handle multiple HPs as is */
11060 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
11061
2c3bf9ab
TI
11062 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11063
7639a06c 11064 switch (codec->core.vendor_id) {
f3f9185f
KY
11065 case 0x10ec0668:
11066 spec->init_hook = alc668_restore_default_value;
11067 break;
f3f9185f 11068 }
8663ff75 11069
c9af753f
TI
11070 alc_pre_init(codec);
11071
1727a771 11072 snd_hda_pick_fixup(codec, alc662_fixup_models,
8e5a0509 11073 alc662_fixup_tbl, alc662_fixups);
0fc1e447 11074 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
1727a771 11075 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8e5a0509
TI
11076
11077 alc_auto_parse_customize_define(codec);
11078
7504b6cd
TI
11079 if (has_cdefine_beep(codec))
11080 spec->gen.beep_nid = 0x01;
11081
1bb7e43e 11082 if ((alc_get_coef0(codec) & (1 << 14)) &&
5100cd07 11083 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 11084 spec->cdefine.platform_type == 1) {
6134b1a2
WY
11085 err = alc_codec_rename(codec, "ALC272X");
11086 if (err < 0)
e16fb6d1 11087 goto error;
20ca0c35 11088 }
274693f3 11089
b9c5106c
TI
11090 /* automatic parse from the BIOS config */
11091 err = alc662_parse_auto_config(codec);
e16fb6d1
TI
11092 if (err < 0)
11093 goto error;
bc9f98a9 11094
7504b6cd 11095 if (!spec->gen.no_analog && spec->gen.beep_nid) {
7639a06c 11096 switch (codec->core.vendor_id) {
da00c244 11097 case 0x10ec0662:
fea80fae 11098 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
da00c244
KY
11099 break;
11100 case 0x10ec0272:
11101 case 0x10ec0663:
11102 case 0x10ec0665:
9ad54547 11103 case 0x10ec0668:
fea80fae 11104 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
da00c244
KY
11105 break;
11106 case 0x10ec0273:
fea80fae 11107 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
da00c244
KY
11108 break;
11109 }
fea80fae
TI
11110 if (err < 0)
11111 goto error;
cec27c89 11112 }
2134ea4f 11113
1727a771 11114 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 11115
bc9f98a9 11116 return 0;
801f49d3 11117
e16fb6d1
TI
11118 error:
11119 alc_free(codec);
11120 return err;
b478b998
KY
11121}
11122
d1eb57f4
KY
11123/*
11124 * ALC680 support
11125 */
d1eb57f4 11126
d1eb57f4
KY
11127static int alc680_parse_auto_config(struct hda_codec *codec)
11128{
3e6179b8 11129 return alc_parse_auto_config(codec, NULL, NULL);
d1eb57f4
KY
11130}
11131
d1eb57f4 11132/*
d1eb57f4 11133 */
d1eb57f4
KY
11134static int patch_alc680(struct hda_codec *codec)
11135{
d1eb57f4
KY
11136 int err;
11137
1f0f4b80 11138 /* ALC680 has no aa-loopback mixer */
3de95173
TI
11139 err = alc_alloc_spec(codec, 0);
11140 if (err < 0)
11141 return err;
1f0f4b80 11142
1ebec5f2
TI
11143 /* automatic parse from the BIOS config */
11144 err = alc680_parse_auto_config(codec);
11145 if (err < 0) {
11146 alc_free(codec);
11147 return err;
d1eb57f4
KY
11148 }
11149
d1eb57f4
KY
11150 return 0;
11151}
11152
1da177e4
LT
11153/*
11154 * patch entries
11155 */
b9a94a9c 11156static const struct hda_device_id snd_hda_id_realtek[] = {
0a6f0600 11157 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
b9a94a9c 11158 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
2a36c16e 11159 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
4231430d 11160 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
1948fc06 11161 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
b9a94a9c
TI
11162 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11163 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
dcd4f0db 11164 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
b9a94a9c 11165 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
736f20a7 11166 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
7fbdcd83 11167 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
b9a94a9c
TI
11168 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11169 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
f429e7e4 11170 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
b9a94a9c
TI
11171 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11172 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11173 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11174 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11175 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11176 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11177 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
dcd4f0db 11178 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
b9a94a9c
TI
11179 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11180 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11181 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11182 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11183 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11184 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
0a6f0600 11185 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
b9a94a9c 11186 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
630e3612 11187 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
b9a94a9c 11188 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
0a6f0600 11189 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
b9a94a9c
TI
11190 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11191 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11192 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
dcd4f0db 11193 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
7d727869 11194 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
b9a94a9c 11195 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
28f1f9b2 11196 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
1078bef0 11197 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
f0778871 11198 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
b9a94a9c
TI
11199 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11200 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11201 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11202 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11203 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11204 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11205 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11206 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11207 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11208 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11209 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11210 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11211 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11212 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
6fbae35a
KY
11213 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11214 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11215 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
83629532 11216 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
78f4f7c2 11217 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
b9a94a9c
TI
11218 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11219 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11220 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11221 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11222 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11223 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11224 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11225 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11226 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11227 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11228 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
e5782a5d 11229 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
b9a94a9c
TI
11230 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11231 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
6d9ffcff 11232 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
65553b12 11233 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
a535ad57 11234 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
1da177e4
LT
11235 {} /* terminator */
11236};
b9a94a9c 11237MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
1289e9e8
TI
11238
11239MODULE_LICENSE("GPL");
11240MODULE_DESCRIPTION("Realtek HD-audio codec");
11241
d8a766a1 11242static struct hda_codec_driver realtek_driver = {
b9a94a9c 11243 .id = snd_hda_id_realtek,
1289e9e8
TI
11244};
11245
d8a766a1 11246module_hda_codec_driver(realtek_driver);