]> git.ipfire.org Git - thirdparty/linux.git/blame - sound/pci/hda/patch_realtek.c
Merge tag 'asoc-fix-v5.10-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git...
[thirdparty/linux.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);
70a0976b 112 void (*reboot_notify)(struct hda_codec *codec);
d922b51d 113
4a79ba34 114 int init_amp;
d433a678 115 int codec_variant; /* flag for other variants */
97a26570
KY
116 unsigned int has_alc5505_dsp:1;
117 unsigned int no_depop_delay:1;
693abe11 118 unsigned int done_hp_init:1;
c0ca5ece 119 unsigned int no_shutup_pins:1;
d3ba58bb 120 unsigned int ultra_low_power:1;
476c02e0 121 unsigned int has_hs_key: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{
294 if (action == HDA_FIXUP_ACT_PROBE)
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:
394c97f8 387 case 0x10ec0233:
ea04a1db 388 case 0x10ec0235:
c4473744 389 case 0x10ec0236:
7fbdcd83 390 case 0x10ec0245:
394c97f8 391 case 0x10ec0255:
c4473744 392 case 0x10ec0256:
f429e7e4 393 case 0x10ec0257:
394c97f8
KY
394 case 0x10ec0282:
395 case 0x10ec0283:
396 case 0x10ec0286:
630e3612 397 case 0x10ec0287:
394c97f8 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;
394c97f8
KY
408 case 0x10ec0293:
409 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
410 break;
dcd4f0db
KY
411 case 0x10ec0234:
412 case 0x10ec0274:
413 case 0x10ec0294:
6fbae35a
KY
414 case 0x10ec0700:
415 case 0x10ec0701:
416 case 0x10ec0703:
83629532 417 case 0x10ec0711:
dcd4f0db
KY
418 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
419 break;
394c97f8
KY
420 case 0x10ec0662:
421 if ((coef & 0x00f0) == 0x0030)
422 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
423 break;
424 case 0x10ec0272:
425 case 0x10ec0273:
426 case 0x10ec0663:
427 case 0x10ec0665:
428 case 0x10ec0670:
429 case 0x10ec0671:
430 case 0x10ec0672:
431 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
432 break;
9194a1eb 433 case 0x10ec0222:
f0778871
KY
434 case 0x10ec0623:
435 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
436 break;
394c97f8
KY
437 case 0x10ec0668:
438 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
439 break;
440 case 0x10ec0867:
441 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
442 break;
443 case 0x10ec0888:
444 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
445 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
446 break;
447 case 0x10ec0892:
448 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
449 break;
450 case 0x10ec0899:
451 case 0x10ec0900:
6d9ffcff 452 case 0x10ec0b00:
65553b12 453 case 0x10ec1168:
a535ad57 454 case 0x10ec1220:
394c97f8
KY
455 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
456 break;
457 }
458}
459
f9423e7a
KY
460/* additional initialization for ALC888 variants */
461static void alc888_coef_init(struct hda_codec *codec)
462{
1df8874b
KY
463 switch (alc_get_coef0(codec) & 0x00f0) {
464 /* alc888-VA */
465 case 0x00:
466 /* alc888-VB */
467 case 0x10:
468 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
469 break;
470 }
87a8c370
JK
471}
472
3fb4a508
TI
473/* turn on/off EAPD control (only if available) */
474static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
475{
476 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
477 return;
478 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
479 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
480 on ? 2 : 0);
481}
482
691f1fcc
TI
483/* turn on/off EAPD controls of the codec */
484static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
485{
486 /* We currently only handle front, HP */
caf3c043 487 static const hda_nid_t pins[] = {
af95b414 488 0x0f, 0x10, 0x14, 0x15, 0x17, 0
39fa84e9 489 };
caf3c043 490 const hda_nid_t *p;
39fa84e9
TI
491 for (p = pins; *p; p++)
492 set_eapd(codec, *p, on);
691f1fcc
TI
493}
494
dad3197d
KY
495static int find_ext_mic_pin(struct hda_codec *codec);
496
497static void alc_headset_mic_no_shutup(struct hda_codec *codec)
498{
499 const struct hda_pincfg *pin;
500 int mic_pin = find_ext_mic_pin(codec);
501 int i;
502
503 /* don't shut up pins when unloading the driver; otherwise it breaks
504 * the default pin setup at the next load of the driver
505 */
506 if (codec->bus->shutdown)
507 return;
508
509 snd_array_for_each(&codec->init_pins, i, pin) {
510 /* use read here for syncing after issuing each verb */
511 if (pin->nid != mic_pin)
512 snd_hda_codec_read(codec, pin->nid, 0,
513 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
514 }
515
516 codec->pins_shutup = 1;
517}
518
c0ca5ece
TI
519static void alc_shutup_pins(struct hda_codec *codec)
520{
521 struct alc_spec *spec = codec->spec;
522
dad3197d 523 switch (codec->core.vendor_id) {
66c5d718 524 case 0x10ec0283:
dad3197d
KY
525 case 0x10ec0286:
526 case 0x10ec0288:
527 case 0x10ec0298:
528 alc_headset_mic_no_shutup(codec);
529 break;
530 default:
531 if (!spec->no_shutup_pins)
532 snd_hda_shutup_pins(codec);
533 break;
534 }
c0ca5ece
TI
535}
536
1c716153 537/* generic shutup callback;
4ce8e6a5 538 * just turning off EAPD and a little pause for avoiding pop-noise
1c716153
TI
539 */
540static void alc_eapd_shutup(struct hda_codec *codec)
541{
97a26570
KY
542 struct alc_spec *spec = codec->spec;
543
1c716153 544 alc_auto_setup_eapd(codec, false);
97a26570
KY
545 if (!spec->no_depop_delay)
546 msleep(200);
c0ca5ece 547 alc_shutup_pins(codec);
1c716153
TI
548}
549
1d045db9 550/* generic EAPD initialization */
4a79ba34 551static void alc_auto_init_amp(struct hda_codec *codec, int type)
bc9f98a9 552{
39fa84e9 553 alc_auto_setup_eapd(codec, true);
5579cd6f 554 alc_write_gpio(codec);
4a79ba34 555 switch (type) {
4a79ba34 556 case ALC_INIT_DEFAULT:
7639a06c 557 switch (codec->core.vendor_id) {
c9b58006 558 case 0x10ec0260:
98b24883 559 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
c9b58006 560 break;
c9b58006
KY
561 case 0x10ec0880:
562 case 0x10ec0882:
563 case 0x10ec0883:
564 case 0x10ec0885:
1df8874b 565 alc_update_coef_idx(codec, 7, 0, 0x2030);
c9b58006 566 break;
f9423e7a 567 case 0x10ec0888:
4a79ba34 568 alc888_coef_init(codec);
f9423e7a 569 break;
bc9f98a9 570 }
4a79ba34
TI
571 break;
572 }
573}
574
35a39f98
TI
575/* get a primary headphone pin if available */
576static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
577{
578 if (spec->gen.autocfg.hp_pins[0])
579 return spec->gen.autocfg.hp_pins[0];
580 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
581 return spec->gen.autocfg.line_out_pins[0];
582 return 0;
583}
08c189f2 584
1d045db9 585/*
08c189f2 586 * Realtek SSID verification
1d045db9 587 */
42cf0d01 588
08c189f2
TI
589/* Could be any non-zero and even value. When used as fixup, tells
590 * the driver to ignore any present sku defines.
591 */
592#define ALC_FIXUP_SKU_IGNORE (2)
1a1455de 593
08c189f2
TI
594static void alc_fixup_sku_ignore(struct hda_codec *codec,
595 const struct hda_fixup *fix, int action)
1a1455de 596{
1a1455de 597 struct alc_spec *spec = codec->spec;
08c189f2
TI
598 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
599 spec->cdefine.fixup = 1;
600 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
1a1455de 601 }
1a1455de
TI
602}
603
b5c6611f
ML
604static void alc_fixup_no_depop_delay(struct hda_codec *codec,
605 const struct hda_fixup *fix, int action)
606{
607 struct alc_spec *spec = codec->spec;
608
84d2dc3e 609 if (action == HDA_FIXUP_ACT_PROBE) {
b5c6611f 610 spec->no_depop_delay = 1;
84d2dc3e
ML
611 codec->depop_delay = 0;
612 }
b5c6611f
ML
613}
614
08c189f2 615static int alc_auto_parse_customize_define(struct hda_codec *codec)
4a79ba34 616{
08c189f2
TI
617 unsigned int ass, tmp, i;
618 unsigned nid = 0;
4a79ba34
TI
619 struct alc_spec *spec = codec->spec;
620
08c189f2 621 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
4a79ba34 622
08c189f2
TI
623 if (spec->cdefine.fixup) {
624 ass = spec->cdefine.sku_cfg;
625 if (ass == ALC_FIXUP_SKU_IGNORE)
626 return -1;
627 goto do_sku;
bb35febd
TI
628 }
629
5100cd07
TI
630 if (!codec->bus->pci)
631 return -1;
7639a06c 632 ass = codec->core.subsystem_id & 0xffff;
08c189f2
TI
633 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
634 goto do_sku;
4a79ba34 635
08c189f2 636 nid = 0x1d;
7639a06c 637 if (codec->core.vendor_id == 0x10ec0260)
08c189f2
TI
638 nid = 0x17;
639 ass = snd_hda_codec_get_pincfg(codec, nid);
42cf0d01 640
08c189f2 641 if (!(ass & 1)) {
4e76a883 642 codec_info(codec, "%s: SKU not ready 0x%08x\n",
7639a06c 643 codec->core.chip_name, ass);
08c189f2 644 return -1;
42cf0d01
DH
645 }
646
08c189f2
TI
647 /* check sum */
648 tmp = 0;
649 for (i = 1; i < 16; i++) {
650 if ((ass >> i) & 1)
651 tmp++;
ae8a60a5 652 }
08c189f2
TI
653 if (((ass >> 16) & 0xf) != tmp)
654 return -1;
ae8a60a5 655
da00c244
KY
656 spec->cdefine.port_connectivity = ass >> 30;
657 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
658 spec->cdefine.check_sum = (ass >> 16) & 0xf;
659 spec->cdefine.customization = ass >> 8;
660do_sku:
661 spec->cdefine.sku_cfg = ass;
662 spec->cdefine.external_amp = (ass & 0x38) >> 3;
663 spec->cdefine.platform_type = (ass & 0x4) >> 2;
664 spec->cdefine.swap = (ass & 0x2) >> 1;
665 spec->cdefine.override = ass & 0x1;
666
4e76a883 667 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
da00c244 668 nid, spec->cdefine.sku_cfg);
4e76a883 669 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
da00c244 670 spec->cdefine.port_connectivity);
4e76a883
TI
671 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
672 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
673 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
674 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
675 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
676 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
677 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
da00c244
KY
678
679 return 0;
680}
681
08c189f2
TI
682/* return the position of NID in the list, or -1 if not found */
683static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
684{
685 int i;
686 for (i = 0; i < nums; i++)
687 if (list[i] == nid)
688 return i;
689 return -1;
690}
1d045db9 691/* return true if the given NID is found in the list */
3af9ee6b
TI
692static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
693{
21268961 694 return find_idx_in_nid_list(nid, list, nums) >= 0;
3af9ee6b
TI
695}
696
4a79ba34
TI
697/* check subsystem ID and set up device-specific initialization;
698 * return 1 if initialized, 0 if invalid SSID
699 */
700/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
701 * 31 ~ 16 : Manufacture ID
702 * 15 ~ 8 : SKU ID
703 * 7 ~ 0 : Assembly ID
704 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
705 */
58c57cfa 706static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34
TI
707{
708 unsigned int ass, tmp, i;
709 unsigned nid;
710 struct alc_spec *spec = codec->spec;
711
90622917
DH
712 if (spec->cdefine.fixup) {
713 ass = spec->cdefine.sku_cfg;
714 if (ass == ALC_FIXUP_SKU_IGNORE)
715 return 0;
716 goto do_sku;
717 }
718
7639a06c 719 ass = codec->core.subsystem_id & 0xffff;
5100cd07
TI
720 if (codec->bus->pci &&
721 ass != codec->bus->pci->subsystem_device && (ass & 1))
4a79ba34
TI
722 goto do_sku;
723
724 /* invalid SSID, check the special NID pin defcfg instead */
725 /*
def319f9 726 * 31~30 : port connectivity
4a79ba34
TI
727 * 29~21 : reserve
728 * 20 : PCBEEP input
729 * 19~16 : Check sum (15:1)
730 * 15~1 : Custom
731 * 0 : override
732 */
733 nid = 0x1d;
7639a06c 734 if (codec->core.vendor_id == 0x10ec0260)
4a79ba34
TI
735 nid = 0x17;
736 ass = snd_hda_codec_get_pincfg(codec, nid);
4e76a883
TI
737 codec_dbg(codec,
738 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
cb6605c1 739 ass, nid);
6227cdce 740 if (!(ass & 1))
4a79ba34
TI
741 return 0;
742 if ((ass >> 30) != 1) /* no physical connection */
743 return 0;
744
745 /* check sum */
746 tmp = 0;
747 for (i = 1; i < 16; i++) {
748 if ((ass >> i) & 1)
749 tmp++;
750 }
751 if (((ass >> 16) & 0xf) != tmp)
752 return 0;
753do_sku:
4e76a883 754 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
7639a06c 755 ass & 0xffff, codec->core.vendor_id);
4a79ba34
TI
756 /*
757 * 0 : override
758 * 1 : Swap Jack
759 * 2 : 0 --> Desktop, 1 --> Laptop
760 * 3~5 : External Amplifier control
761 * 7~6 : Reserved
762 */
763 tmp = (ass & 0x38) >> 3; /* external Amp control */
1c76aa5f
TI
764 if (spec->init_amp == ALC_INIT_UNDEFINED) {
765 switch (tmp) {
766 case 1:
5579cd6f 767 alc_setup_gpio(codec, 0x01);
1c76aa5f
TI
768 break;
769 case 3:
5579cd6f 770 alc_setup_gpio(codec, 0x02);
1c76aa5f
TI
771 break;
772 case 7:
5579cd6f 773 alc_setup_gpio(codec, 0x03);
1c76aa5f
TI
774 break;
775 case 5:
776 default:
777 spec->init_amp = ALC_INIT_DEFAULT;
778 break;
779 }
bc9f98a9 780 }
ea1fb29a 781
8c427226 782 /* is laptop or Desktop and enable the function "Mute internal speaker
c9b58006
KY
783 * when the external headphone out jack is plugged"
784 */
8c427226 785 if (!(ass & 0x8000))
4a79ba34 786 return 1;
c9b58006
KY
787 /*
788 * 10~8 : Jack location
789 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
790 * 14~13: Resvered
791 * 15 : 1 --> enable the function "Mute internal speaker
792 * when the external headphone out jack is plugged"
793 */
35a39f98 794 if (!alc_get_hp_pin(spec)) {
01d4825d 795 hda_nid_t nid;
c9b58006 796 tmp = (ass >> 11) & 0x3; /* HP to chassis */
58c57cfa 797 nid = ports[tmp];
08c189f2
TI
798 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
799 spec->gen.autocfg.line_outs))
3af9ee6b 800 return 1;
08c189f2 801 spec->gen.autocfg.hp_pins[0] = nid;
c9b58006 802 }
4a79ba34
TI
803 return 1;
804}
ea1fb29a 805
3e6179b8
TI
806/* Check the validity of ALC subsystem-id
807 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
808static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34 809{
58c57cfa 810 if (!alc_subsystem_id(codec, ports)) {
4a79ba34 811 struct alc_spec *spec = codec->spec;
67791202
TI
812 if (spec->init_amp == ALC_INIT_UNDEFINED) {
813 codec_dbg(codec,
814 "realtek: Enable default setup for auto mode as fallback\n");
815 spec->init_amp = ALC_INIT_DEFAULT;
816 }
4a79ba34 817 }
21268961 818}
1a1455de 819
1d045db9 820/*
ef8ef5fb 821 */
f9e336f6 822
9d36a7dc
DH
823static void alc_fixup_inv_dmic(struct hda_codec *codec,
824 const struct hda_fixup *fix, int action)
125821ae
TI
825{
826 struct alc_spec *spec = codec->spec;
668d1e96 827
9d36a7dc 828 spec->gen.inv_dmic_split = 1;
6e72aa5f
TI
829}
830
e9edcee0 831
08c189f2 832static int alc_build_controls(struct hda_codec *codec)
1d045db9 833{
a5cb463a 834 int err;
e9427969 835
08c189f2
TI
836 err = snd_hda_gen_build_controls(codec);
837 if (err < 0)
838 return err;
1da177e4 839
1727a771 840 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
1c4a54b4 841 return 0;
a361d84b
KY
842}
843
a361d84b 844
df694daa 845/*
08c189f2 846 * Common callbacks
df694daa 847 */
a361d84b 848
c9af753f
TI
849static void alc_pre_init(struct hda_codec *codec)
850{
851 alc_fill_eapd_coef(codec);
852}
853
aeac1a0d
KY
854#define is_s3_resume(codec) \
855 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
c9af753f
TI
856#define is_s4_resume(codec) \
857 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
858
08c189f2 859static int alc_init(struct hda_codec *codec)
1d045db9
TI
860{
861 struct alc_spec *spec = codec->spec;
a361d84b 862
c9af753f
TI
863 /* hibernation resume needs the full chip initialization */
864 if (is_s4_resume(codec))
865 alc_pre_init(codec);
866
08c189f2
TI
867 if (spec->init_hook)
868 spec->init_hook(codec);
a361d84b 869
89781d08 870 spec->gen.skip_verbs = 1; /* applied in below */
607ca3bd 871 snd_hda_gen_init(codec);
08c189f2
TI
872 alc_fix_pll(codec);
873 alc_auto_init_amp(codec, spec->init_amp);
89781d08 874 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
3abf2f36 875
1727a771 876 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
a361d84b 877
1d045db9
TI
878 return 0;
879}
a361d84b 880
08c189f2 881static inline void alc_shutup(struct hda_codec *codec)
1d045db9
TI
882{
883 struct alc_spec *spec = codec->spec;
a361d84b 884
c7273bd6
TI
885 if (!snd_hda_get_bool_hint(codec, "shutup"))
886 return; /* disabled explicitly by hints */
887
08c189f2
TI
888 if (spec && spec->shutup)
889 spec->shutup(codec);
9bfb2844 890 else
c0ca5ece 891 alc_shutup_pins(codec);
1d045db9
TI
892}
893
70a0976b
TI
894static void alc_reboot_notify(struct hda_codec *codec)
895{
896 struct alc_spec *spec = codec->spec;
897
898 if (spec && spec->reboot_notify)
899 spec->reboot_notify(codec);
900 else
901 alc_shutup(codec);
902}
903
8a02c0cc 904#define alc_free snd_hda_gen_free
2134ea4f 905
08c189f2
TI
906#ifdef CONFIG_PM
907static void alc_power_eapd(struct hda_codec *codec)
1d045db9 908{
08c189f2 909 alc_auto_setup_eapd(codec, false);
1d045db9 910}
2134ea4f 911
08c189f2 912static int alc_suspend(struct hda_codec *codec)
1d045db9
TI
913{
914 struct alc_spec *spec = codec->spec;
08c189f2
TI
915 alc_shutup(codec);
916 if (spec && spec->power_hook)
917 spec->power_hook(codec);
a361d84b
KY
918 return 0;
919}
08c189f2 920#endif
a361d84b 921
08c189f2
TI
922#ifdef CONFIG_PM
923static int alc_resume(struct hda_codec *codec)
1d045db9 924{
97a26570
KY
925 struct alc_spec *spec = codec->spec;
926
927 if (!spec->no_depop_delay)
928 msleep(150); /* to avoid pop noise */
08c189f2 929 codec->patch_ops.init(codec);
1a462be5 930 snd_hda_regmap_sync(codec);
08c189f2
TI
931 hda_call_check_power_status(codec, 0x01);
932 return 0;
1d045db9 933}
08c189f2 934#endif
f6a92248 935
1d045db9 936/*
1d045db9 937 */
08c189f2
TI
938static const struct hda_codec_ops alc_patch_ops = {
939 .build_controls = alc_build_controls,
940 .build_pcms = snd_hda_gen_build_pcms,
941 .init = alc_init,
942 .free = alc_free,
943 .unsol_event = snd_hda_jack_unsol_event,
944#ifdef CONFIG_PM
945 .resume = alc_resume,
08c189f2 946 .suspend = alc_suspend,
fce52a3b 947 .check_power_status = snd_hda_gen_check_power_status,
08c189f2 948#endif
70a0976b 949 .reboot_notify = alc_reboot_notify,
08c189f2 950};
f6a92248 951
f53281e6 952
ded255be 953#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
e01bf509 954
e4770629 955/*
4b016931 956 * Rename codecs appropriately from COEF value or subvendor id
e4770629 957 */
08c189f2
TI
958struct alc_codec_rename_table {
959 unsigned int vendor_id;
960 unsigned short coef_mask;
961 unsigned short coef_bits;
962 const char *name;
963};
84898e87 964
4b016931
KY
965struct alc_codec_rename_pci_table {
966 unsigned int codec_vendor_id;
967 unsigned short pci_subvendor;
968 unsigned short pci_subdevice;
969 const char *name;
970};
971
6b0f95c4 972static const struct alc_codec_rename_table rename_tbl[] = {
e6e5f7ad 973 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
08c189f2
TI
974 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
975 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
976 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
977 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
978 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
979 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
980 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
981 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
e6e5f7ad 982 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
08c189f2
TI
983 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
984 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
985 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
986 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
987 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
988 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
989 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
990 { } /* terminator */
991};
84898e87 992
6b0f95c4 993static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
4b016931
KY
994 { 0x10ec0280, 0x1028, 0, "ALC3220" },
995 { 0x10ec0282, 0x1028, 0, "ALC3221" },
996 { 0x10ec0283, 0x1028, 0, "ALC3223" },
193177de 997 { 0x10ec0288, 0x1028, 0, "ALC3263" },
4b016931 998 { 0x10ec0292, 0x1028, 0, "ALC3226" },
193177de 999 { 0x10ec0293, 0x1028, 0, "ALC3235" },
4b016931
KY
1000 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1001 { 0x10ec0668, 0x1028, 0, "ALC3661" },
e6e5f7ad
KY
1002 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1003 { 0x10ec0899, 0x1028, 0, "ALC3861" },
2c674fac 1004 { 0x10ec0298, 0x1028, 0, "ALC3266" },
736f20a7 1005 { 0x10ec0236, 0x1028, 0, "ALC3204" },
82324502 1006 { 0x10ec0256, 0x1028, 0, "ALC3246" },
4231430d 1007 { 0x10ec0225, 0x1028, 0, "ALC3253" },
7d727869 1008 { 0x10ec0295, 0x1028, 0, "ALC3254" },
28f1f9b2 1009 { 0x10ec0299, 0x1028, 0, "ALC3271" },
e6e5f7ad
KY
1010 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1011 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1012 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1013 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1014 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1015 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1016 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1017 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1018 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1019 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1020 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
4b016931
KY
1021 { } /* terminator */
1022};
1023
08c189f2 1024static int alc_codec_rename_from_preset(struct hda_codec *codec)
1d045db9 1025{
08c189f2 1026 const struct alc_codec_rename_table *p;
4b016931 1027 const struct alc_codec_rename_pci_table *q;
60db6b53 1028
08c189f2 1029 for (p = rename_tbl; p->vendor_id; p++) {
7639a06c 1030 if (p->vendor_id != codec->core.vendor_id)
08c189f2
TI
1031 continue;
1032 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1033 return alc_codec_rename(codec, p->name);
1d045db9 1034 }
4b016931 1035
5100cd07
TI
1036 if (!codec->bus->pci)
1037 return 0;
4b016931 1038 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
7639a06c 1039 if (q->codec_vendor_id != codec->core.vendor_id)
4b016931
KY
1040 continue;
1041 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1042 continue;
1043 if (!q->pci_subdevice ||
1044 q->pci_subdevice == codec->bus->pci->subsystem_device)
1045 return alc_codec_rename(codec, q->name);
1046 }
1047
08c189f2 1048 return 0;
1d045db9 1049}
f53281e6 1050
e4770629 1051
1d045db9
TI
1052/*
1053 * Digital-beep handlers
1054 */
1055#ifdef CONFIG_SND_HDA_INPUT_BEEP
fea80fae
TI
1056
1057/* additional beep mixers; private_value will be overwritten */
1058static const struct snd_kcontrol_new alc_beep_mixer[] = {
1059 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1060 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1061};
1062
1063/* set up and create beep controls */
1064static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1065 int idx, int dir)
1066{
1067 struct snd_kcontrol_new *knew;
1068 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1069 int i;
1070
1071 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1072 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1073 &alc_beep_mixer[i]);
1074 if (!knew)
1075 return -ENOMEM;
1076 knew->private_value = beep_amp;
1077 }
1078 return 0;
1079}
84898e87 1080
6317e5eb 1081static const struct snd_pci_quirk beep_allow_list[] = {
7110005e 1082 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
a4b7f21d 1083 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1d045db9 1084 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
8554ee40 1085 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1d045db9
TI
1086 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1087 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1088 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
78f8baf1 1089 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1d045db9 1090 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
6317e5eb 1091 /* denylist -- no beep available */
051c78af
TI
1092 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1093 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1d045db9 1094 {}
fe3eb0a7
KY
1095};
1096
1d045db9
TI
1097static inline int has_cdefine_beep(struct hda_codec *codec)
1098{
1099 struct alc_spec *spec = codec->spec;
1100 const struct snd_pci_quirk *q;
6317e5eb 1101 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1d045db9
TI
1102 if (q)
1103 return q->value;
1104 return spec->cdefine.enable_pcbeep;
1105}
1106#else
fea80fae 1107#define set_beep_amp(spec, nid, idx, dir) 0
1d045db9
TI
1108#define has_cdefine_beep(codec) 0
1109#endif
84898e87 1110
1d045db9
TI
1111/* parse the BIOS configuration and set up the alc_spec */
1112/* return 1 if successful, 0 if the proper config is not found,
1113 * or a negative error code
1114 */
3e6179b8
TI
1115static int alc_parse_auto_config(struct hda_codec *codec,
1116 const hda_nid_t *ignore_nids,
1117 const hda_nid_t *ssid_nids)
1d045db9
TI
1118{
1119 struct alc_spec *spec = codec->spec;
08c189f2 1120 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1d045db9 1121 int err;
26f5df26 1122
53c334ad
TI
1123 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1124 spec->parse_flags);
1d045db9
TI
1125 if (err < 0)
1126 return err;
3e6179b8
TI
1127
1128 if (ssid_nids)
1129 alc_ssid_check(codec, ssid_nids);
64154835 1130
08c189f2
TI
1131 err = snd_hda_gen_parse_auto_config(codec, cfg);
1132 if (err < 0)
1133 return err;
070cff4c 1134
1d045db9 1135 return 1;
60db6b53 1136}
f6a92248 1137
3de95173
TI
1138/* common preparation job for alc_spec */
1139static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1140{
1141 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1142 int err;
1143
1144 if (!spec)
1145 return -ENOMEM;
1146 codec->spec = spec;
08c189f2
TI
1147 snd_hda_gen_spec_init(&spec->gen);
1148 spec->gen.mixer_nid = mixer_nid;
1149 spec->gen.own_eapd_ctl = 1;
1098b7c2 1150 codec->single_adc_amp = 1;
08c189f2
TI
1151 /* FIXME: do we need this for all Realtek codec models? */
1152 codec->spdif_status_reset = 1;
a6e7d0a4 1153 codec->forced_resume = 1;
225068ab 1154 codec->patch_ops = alc_patch_ops;
3de95173
TI
1155
1156 err = alc_codec_rename_from_preset(codec);
1157 if (err < 0) {
1158 kfree(spec);
1159 return err;
1160 }
1161 return 0;
1162}
1163
3e6179b8
TI
1164static int alc880_parse_auto_config(struct hda_codec *codec)
1165{
1166 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
7d7eb9ea 1167 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3e6179b8
TI
1168 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1169}
1170
ee3b2969
TI
1171/*
1172 * ALC880 fix-ups
1173 */
1174enum {
411225a0 1175 ALC880_FIXUP_GPIO1,
ee3b2969
TI
1176 ALC880_FIXUP_GPIO2,
1177 ALC880_FIXUP_MEDION_RIM,
dc6af52d 1178 ALC880_FIXUP_LG,
db8a38e5 1179 ALC880_FIXUP_LG_LW25,
f02aab5d 1180 ALC880_FIXUP_W810,
27e917f8 1181 ALC880_FIXUP_EAPD_COEF,
b9368f5c 1182 ALC880_FIXUP_TCL_S700,
cf5a2279
TI
1183 ALC880_FIXUP_VOL_KNOB,
1184 ALC880_FIXUP_FUJITSU,
ba533818 1185 ALC880_FIXUP_F1734,
817de92f 1186 ALC880_FIXUP_UNIWILL,
967b88c4 1187 ALC880_FIXUP_UNIWILL_DIG,
96e225f6 1188 ALC880_FIXUP_Z71V,
487a588d 1189 ALC880_FIXUP_ASUS_W5A,
67b6ec31
TI
1190 ALC880_FIXUP_3ST_BASE,
1191 ALC880_FIXUP_3ST,
1192 ALC880_FIXUP_3ST_DIG,
1193 ALC880_FIXUP_5ST_BASE,
1194 ALC880_FIXUP_5ST,
1195 ALC880_FIXUP_5ST_DIG,
1196 ALC880_FIXUP_6ST_BASE,
1197 ALC880_FIXUP_6ST,
1198 ALC880_FIXUP_6ST_DIG,
5397145f 1199 ALC880_FIXUP_6ST_AUTOMUTE,
ee3b2969
TI
1200};
1201
cf5a2279
TI
1202/* enable the volume-knob widget support on NID 0x21 */
1203static void alc880_fixup_vol_knob(struct hda_codec *codec,
1727a771 1204 const struct hda_fixup *fix, int action)
cf5a2279 1205{
1727a771 1206 if (action == HDA_FIXUP_ACT_PROBE)
62f949bf
TI
1207 snd_hda_jack_detect_enable_callback(codec, 0x21,
1208 alc_update_knob_master);
cf5a2279
TI
1209}
1210
1727a771 1211static const struct hda_fixup alc880_fixups[] = {
411225a0 1212 [ALC880_FIXUP_GPIO1] = {
5579cd6f
TI
1213 .type = HDA_FIXUP_FUNC,
1214 .v.func = alc_fixup_gpio1,
411225a0 1215 },
ee3b2969 1216 [ALC880_FIXUP_GPIO2] = {
5579cd6f
TI
1217 .type = HDA_FIXUP_FUNC,
1218 .v.func = alc_fixup_gpio2,
ee3b2969
TI
1219 },
1220 [ALC880_FIXUP_MEDION_RIM] = {
1727a771 1221 .type = HDA_FIXUP_VERBS,
ee3b2969
TI
1222 .v.verbs = (const struct hda_verb[]) {
1223 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1224 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1225 { }
1226 },
1227 .chained = true,
1228 .chain_id = ALC880_FIXUP_GPIO2,
1229 },
dc6af52d 1230 [ALC880_FIXUP_LG] = {
1727a771
TI
1231 .type = HDA_FIXUP_PINS,
1232 .v.pins = (const struct hda_pintbl[]) {
dc6af52d
TI
1233 /* disable bogus unused pins */
1234 { 0x16, 0x411111f0 },
1235 { 0x18, 0x411111f0 },
1236 { 0x1a, 0x411111f0 },
1237 { }
1238 }
1239 },
db8a38e5
TI
1240 [ALC880_FIXUP_LG_LW25] = {
1241 .type = HDA_FIXUP_PINS,
1242 .v.pins = (const struct hda_pintbl[]) {
1243 { 0x1a, 0x0181344f }, /* line-in */
1244 { 0x1b, 0x0321403f }, /* headphone */
1245 { }
1246 }
1247 },
f02aab5d 1248 [ALC880_FIXUP_W810] = {
1727a771
TI
1249 .type = HDA_FIXUP_PINS,
1250 .v.pins = (const struct hda_pintbl[]) {
f02aab5d
TI
1251 /* disable bogus unused pins */
1252 { 0x17, 0x411111f0 },
1253 { }
1254 },
1255 .chained = true,
1256 .chain_id = ALC880_FIXUP_GPIO2,
1257 },
27e917f8 1258 [ALC880_FIXUP_EAPD_COEF] = {
1727a771 1259 .type = HDA_FIXUP_VERBS,
27e917f8
TI
1260 .v.verbs = (const struct hda_verb[]) {
1261 /* change to EAPD mode */
1262 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1263 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1264 {}
1265 },
1266 },
b9368f5c 1267 [ALC880_FIXUP_TCL_S700] = {
1727a771 1268 .type = HDA_FIXUP_VERBS,
b9368f5c
TI
1269 .v.verbs = (const struct hda_verb[]) {
1270 /* change to EAPD mode */
1271 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1272 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1273 {}
1274 },
1275 .chained = true,
1276 .chain_id = ALC880_FIXUP_GPIO2,
1277 },
cf5a2279 1278 [ALC880_FIXUP_VOL_KNOB] = {
1727a771 1279 .type = HDA_FIXUP_FUNC,
cf5a2279
TI
1280 .v.func = alc880_fixup_vol_knob,
1281 },
1282 [ALC880_FIXUP_FUJITSU] = {
1283 /* override all pins as BIOS on old Amilo is broken */
1727a771
TI
1284 .type = HDA_FIXUP_PINS,
1285 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1286 { 0x14, 0x0121401f }, /* HP */
cf5a2279
TI
1287 { 0x15, 0x99030120 }, /* speaker */
1288 { 0x16, 0x99030130 }, /* bass speaker */
1289 { 0x17, 0x411111f0 }, /* N/A */
1290 { 0x18, 0x411111f0 }, /* N/A */
1291 { 0x19, 0x01a19950 }, /* mic-in */
1292 { 0x1a, 0x411111f0 }, /* N/A */
1293 { 0x1b, 0x411111f0 }, /* N/A */
1294 { 0x1c, 0x411111f0 }, /* N/A */
1295 { 0x1d, 0x411111f0 }, /* N/A */
1296 { 0x1e, 0x01454140 }, /* SPDIF out */
1297 { }
1298 },
1299 .chained = true,
1300 .chain_id = ALC880_FIXUP_VOL_KNOB,
1301 },
ba533818
TI
1302 [ALC880_FIXUP_F1734] = {
1303 /* almost compatible with FUJITSU, but no bass and SPDIF */
1727a771
TI
1304 .type = HDA_FIXUP_PINS,
1305 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1306 { 0x14, 0x0121401f }, /* HP */
ba533818
TI
1307 { 0x15, 0x99030120 }, /* speaker */
1308 { 0x16, 0x411111f0 }, /* N/A */
1309 { 0x17, 0x411111f0 }, /* N/A */
1310 { 0x18, 0x411111f0 }, /* N/A */
1311 { 0x19, 0x01a19950 }, /* mic-in */
1312 { 0x1a, 0x411111f0 }, /* N/A */
1313 { 0x1b, 0x411111f0 }, /* N/A */
1314 { 0x1c, 0x411111f0 }, /* N/A */
1315 { 0x1d, 0x411111f0 }, /* N/A */
1316 { 0x1e, 0x411111f0 }, /* N/A */
1317 { }
1318 },
1319 .chained = true,
1320 .chain_id = ALC880_FIXUP_VOL_KNOB,
1321 },
817de92f
TI
1322 [ALC880_FIXUP_UNIWILL] = {
1323 /* need to fix HP and speaker pins to be parsed correctly */
1727a771
TI
1324 .type = HDA_FIXUP_PINS,
1325 .v.pins = (const struct hda_pintbl[]) {
817de92f
TI
1326 { 0x14, 0x0121411f }, /* HP */
1327 { 0x15, 0x99030120 }, /* speaker */
1328 { 0x16, 0x99030130 }, /* bass speaker */
1329 { }
1330 },
1331 },
967b88c4 1332 [ALC880_FIXUP_UNIWILL_DIG] = {
1727a771
TI
1333 .type = HDA_FIXUP_PINS,
1334 .v.pins = (const struct hda_pintbl[]) {
967b88c4
TI
1335 /* disable bogus unused pins */
1336 { 0x17, 0x411111f0 },
1337 { 0x19, 0x411111f0 },
1338 { 0x1b, 0x411111f0 },
1339 { 0x1f, 0x411111f0 },
1340 { }
1341 }
1342 },
96e225f6 1343 [ALC880_FIXUP_Z71V] = {
1727a771
TI
1344 .type = HDA_FIXUP_PINS,
1345 .v.pins = (const struct hda_pintbl[]) {
96e225f6
TI
1346 /* set up the whole pins as BIOS is utterly broken */
1347 { 0x14, 0x99030120 }, /* speaker */
1348 { 0x15, 0x0121411f }, /* HP */
1349 { 0x16, 0x411111f0 }, /* N/A */
1350 { 0x17, 0x411111f0 }, /* N/A */
1351 { 0x18, 0x01a19950 }, /* mic-in */
1352 { 0x19, 0x411111f0 }, /* N/A */
1353 { 0x1a, 0x01813031 }, /* line-in */
1354 { 0x1b, 0x411111f0 }, /* N/A */
1355 { 0x1c, 0x411111f0 }, /* N/A */
1356 { 0x1d, 0x411111f0 }, /* N/A */
1357 { 0x1e, 0x0144111e }, /* SPDIF */
1358 { }
1359 }
1360 },
487a588d
TI
1361 [ALC880_FIXUP_ASUS_W5A] = {
1362 .type = HDA_FIXUP_PINS,
1363 .v.pins = (const struct hda_pintbl[]) {
1364 /* set up the whole pins as BIOS is utterly broken */
1365 { 0x14, 0x0121411f }, /* HP */
1366 { 0x15, 0x411111f0 }, /* N/A */
1367 { 0x16, 0x411111f0 }, /* N/A */
1368 { 0x17, 0x411111f0 }, /* N/A */
1369 { 0x18, 0x90a60160 }, /* mic */
1370 { 0x19, 0x411111f0 }, /* N/A */
1371 { 0x1a, 0x411111f0 }, /* N/A */
1372 { 0x1b, 0x411111f0 }, /* N/A */
1373 { 0x1c, 0x411111f0 }, /* N/A */
1374 { 0x1d, 0x411111f0 }, /* N/A */
1375 { 0x1e, 0xb743111e }, /* SPDIF out */
1376 { }
1377 },
1378 .chained = true,
1379 .chain_id = ALC880_FIXUP_GPIO1,
1380 },
67b6ec31 1381 [ALC880_FIXUP_3ST_BASE] = {
1727a771
TI
1382 .type = HDA_FIXUP_PINS,
1383 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1384 { 0x14, 0x01014010 }, /* line-out */
1385 { 0x15, 0x411111f0 }, /* N/A */
1386 { 0x16, 0x411111f0 }, /* N/A */
1387 { 0x17, 0x411111f0 }, /* N/A */
1388 { 0x18, 0x01a19c30 }, /* mic-in */
1389 { 0x19, 0x0121411f }, /* HP */
1390 { 0x1a, 0x01813031 }, /* line-in */
1391 { 0x1b, 0x02a19c40 }, /* front-mic */
1392 { 0x1c, 0x411111f0 }, /* N/A */
1393 { 0x1d, 0x411111f0 }, /* N/A */
1394 /* 0x1e is filled in below */
1395 { 0x1f, 0x411111f0 }, /* N/A */
1396 { }
1397 }
1398 },
1399 [ALC880_FIXUP_3ST] = {
1727a771
TI
1400 .type = HDA_FIXUP_PINS,
1401 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1402 { 0x1e, 0x411111f0 }, /* N/A */
1403 { }
1404 },
1405 .chained = true,
1406 .chain_id = ALC880_FIXUP_3ST_BASE,
1407 },
1408 [ALC880_FIXUP_3ST_DIG] = {
1727a771
TI
1409 .type = HDA_FIXUP_PINS,
1410 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1411 { 0x1e, 0x0144111e }, /* SPDIF */
1412 { }
1413 },
1414 .chained = true,
1415 .chain_id = ALC880_FIXUP_3ST_BASE,
1416 },
1417 [ALC880_FIXUP_5ST_BASE] = {
1727a771
TI
1418 .type = HDA_FIXUP_PINS,
1419 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1420 { 0x14, 0x01014010 }, /* front */
1421 { 0x15, 0x411111f0 }, /* N/A */
1422 { 0x16, 0x01011411 }, /* CLFE */
1423 { 0x17, 0x01016412 }, /* surr */
1424 { 0x18, 0x01a19c30 }, /* mic-in */
1425 { 0x19, 0x0121411f }, /* HP */
1426 { 0x1a, 0x01813031 }, /* line-in */
1427 { 0x1b, 0x02a19c40 }, /* front-mic */
1428 { 0x1c, 0x411111f0 }, /* N/A */
1429 { 0x1d, 0x411111f0 }, /* N/A */
1430 /* 0x1e is filled in below */
1431 { 0x1f, 0x411111f0 }, /* N/A */
1432 { }
1433 }
1434 },
1435 [ALC880_FIXUP_5ST] = {
1727a771
TI
1436 .type = HDA_FIXUP_PINS,
1437 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1438 { 0x1e, 0x411111f0 }, /* N/A */
1439 { }
1440 },
1441 .chained = true,
1442 .chain_id = ALC880_FIXUP_5ST_BASE,
1443 },
1444 [ALC880_FIXUP_5ST_DIG] = {
1727a771
TI
1445 .type = HDA_FIXUP_PINS,
1446 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1447 { 0x1e, 0x0144111e }, /* SPDIF */
1448 { }
1449 },
1450 .chained = true,
1451 .chain_id = ALC880_FIXUP_5ST_BASE,
1452 },
1453 [ALC880_FIXUP_6ST_BASE] = {
1727a771
TI
1454 .type = HDA_FIXUP_PINS,
1455 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1456 { 0x14, 0x01014010 }, /* front */
1457 { 0x15, 0x01016412 }, /* surr */
1458 { 0x16, 0x01011411 }, /* CLFE */
1459 { 0x17, 0x01012414 }, /* side */
1460 { 0x18, 0x01a19c30 }, /* mic-in */
1461 { 0x19, 0x02a19c40 }, /* front-mic */
1462 { 0x1a, 0x01813031 }, /* line-in */
1463 { 0x1b, 0x0121411f }, /* HP */
1464 { 0x1c, 0x411111f0 }, /* N/A */
1465 { 0x1d, 0x411111f0 }, /* N/A */
1466 /* 0x1e is filled in below */
1467 { 0x1f, 0x411111f0 }, /* N/A */
1468 { }
1469 }
1470 },
1471 [ALC880_FIXUP_6ST] = {
1727a771
TI
1472 .type = HDA_FIXUP_PINS,
1473 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1474 { 0x1e, 0x411111f0 }, /* N/A */
1475 { }
1476 },
1477 .chained = true,
1478 .chain_id = ALC880_FIXUP_6ST_BASE,
1479 },
1480 [ALC880_FIXUP_6ST_DIG] = {
1727a771
TI
1481 .type = HDA_FIXUP_PINS,
1482 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1483 { 0x1e, 0x0144111e }, /* SPDIF */
1484 { }
1485 },
1486 .chained = true,
1487 .chain_id = ALC880_FIXUP_6ST_BASE,
1488 },
5397145f
TI
1489 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1490 .type = HDA_FIXUP_PINS,
1491 .v.pins = (const struct hda_pintbl[]) {
1492 { 0x1b, 0x0121401f }, /* HP with jack detect */
1493 { }
1494 },
1495 .chained_before = true,
1496 .chain_id = ALC880_FIXUP_6ST_BASE,
1497 },
ee3b2969
TI
1498};
1499
1500static const struct snd_pci_quirk alc880_fixup_tbl[] = {
f02aab5d 1501 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
487a588d 1502 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
96e225f6 1503 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
29e3fdcc 1504 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
6538de03 1505 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
29e3fdcc 1506 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
27e917f8 1507 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
967b88c4 1508 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
ba533818 1509 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
817de92f 1510 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
7833c7e8 1511 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
f02aab5d 1512 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
ee3b2969 1513 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
5397145f 1514 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
a161574e 1515 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
cf5a2279 1516 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
ba533818 1517 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
cf5a2279 1518 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
dc6af52d
TI
1519 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1520 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1521 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
db8a38e5 1522 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
b9368f5c 1523 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
67b6ec31
TI
1524
1525 /* Below is the copied entries from alc880_quirks.c.
1526 * It's not quite sure whether BIOS sets the correct pin-config table
1527 * on these machines, thus they are kept to be compatible with
1528 * the old static quirks. Once when it's confirmed to work without
1529 * these overrides, it'd be better to remove.
1530 */
1531 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1532 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1533 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1534 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1535 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1536 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1537 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1538 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1539 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1540 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1541 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1542 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1543 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1544 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1545 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1546 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1547 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1548 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1549 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1550 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1551 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1552 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1553 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1554 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1555 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1556 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1557 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1558 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1559 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1560 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1561 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1562 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1563 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1564 /* default Intel */
1565 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1566 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1567 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1568 {}
1569};
1570
1727a771 1571static const struct hda_model_fixup alc880_fixup_models[] = {
67b6ec31
TI
1572 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1573 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1574 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1575 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1576 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1577 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
5397145f 1578 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
ee3b2969
TI
1579 {}
1580};
1581
1582
1d045db9
TI
1583/*
1584 * OK, here we have finally the patch for ALC880
1585 */
1d045db9 1586static int patch_alc880(struct hda_codec *codec)
60db6b53 1587{
1d045db9 1588 struct alc_spec *spec;
1d045db9 1589 int err;
f6a92248 1590
3de95173
TI
1591 err = alc_alloc_spec(codec, 0x0b);
1592 if (err < 0)
1593 return err;
64154835 1594
3de95173 1595 spec = codec->spec;
08c189f2 1596 spec->gen.need_dac_fix = 1;
7504b6cd 1597 spec->gen.beep_nid = 0x01;
f53281e6 1598
225068ab
TI
1599 codec->patch_ops.unsol_event = alc880_unsol_event;
1600
c9af753f
TI
1601 alc_pre_init(codec);
1602
1727a771 1603 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
67b6ec31 1604 alc880_fixups);
1727a771 1605 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ee3b2969 1606
67b6ec31
TI
1607 /* automatic parse from the BIOS config */
1608 err = alc880_parse_auto_config(codec);
1609 if (err < 0)
1610 goto error;
fe3eb0a7 1611
fea80fae
TI
1612 if (!spec->gen.no_analog) {
1613 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1614 if (err < 0)
1615 goto error;
1616 }
f53281e6 1617
1727a771 1618 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1619
1d045db9 1620 return 0;
e16fb6d1
TI
1621
1622 error:
1623 alc_free(codec);
1624 return err;
226b1ec8
KY
1625}
1626
1d045db9 1627
60db6b53 1628/*
1d045db9 1629 * ALC260 support
60db6b53 1630 */
1d045db9 1631static int alc260_parse_auto_config(struct hda_codec *codec)
f6a92248 1632{
1d045db9 1633 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
3e6179b8
TI
1634 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1635 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
f6a92248
KY
1636}
1637
1d045db9
TI
1638/*
1639 * Pin config fixes
1640 */
1641enum {
ca8f0424
TI
1642 ALC260_FIXUP_HP_DC5750,
1643 ALC260_FIXUP_HP_PIN_0F,
1644 ALC260_FIXUP_COEF,
15317ab2 1645 ALC260_FIXUP_GPIO1,
20f7d928
TI
1646 ALC260_FIXUP_GPIO1_TOGGLE,
1647 ALC260_FIXUP_REPLACER,
0a1c4fa2 1648 ALC260_FIXUP_HP_B1900,
118cb4a4 1649 ALC260_FIXUP_KN1,
39aedee7 1650 ALC260_FIXUP_FSC_S7020,
5ebd3bbd 1651 ALC260_FIXUP_FSC_S7020_JWSE,
d08c5ef2 1652 ALC260_FIXUP_VAIO_PINS,
1d045db9
TI
1653};
1654
20f7d928
TI
1655static void alc260_gpio1_automute(struct hda_codec *codec)
1656{
1657 struct alc_spec *spec = codec->spec;
aaf312de
TI
1658
1659 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
20f7d928
TI
1660}
1661
1662static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1727a771 1663 const struct hda_fixup *fix, int action)
20f7d928
TI
1664{
1665 struct alc_spec *spec = codec->spec;
1727a771 1666 if (action == HDA_FIXUP_ACT_PROBE) {
20f7d928
TI
1667 /* although the machine has only one output pin, we need to
1668 * toggle GPIO1 according to the jack state
1669 */
08c189f2
TI
1670 spec->gen.automute_hook = alc260_gpio1_automute;
1671 spec->gen.detect_hp = 1;
1672 spec->gen.automute_speaker = 1;
1673 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
62f949bf 1674 snd_hda_jack_detect_enable_callback(codec, 0x0f,
08c189f2 1675 snd_hda_gen_hp_automute);
5579cd6f 1676 alc_setup_gpio(codec, 0x01);
20f7d928
TI
1677 }
1678}
1679
118cb4a4 1680static void alc260_fixup_kn1(struct hda_codec *codec,
1727a771 1681 const struct hda_fixup *fix, int action)
118cb4a4
TI
1682{
1683 struct alc_spec *spec = codec->spec;
1727a771 1684 static const struct hda_pintbl pincfgs[] = {
118cb4a4
TI
1685 { 0x0f, 0x02214000 }, /* HP/speaker */
1686 { 0x12, 0x90a60160 }, /* int mic */
1687 { 0x13, 0x02a19000 }, /* ext mic */
1688 { 0x18, 0x01446000 }, /* SPDIF out */
1689 /* disable bogus I/O pins */
1690 { 0x10, 0x411111f0 },
1691 { 0x11, 0x411111f0 },
1692 { 0x14, 0x411111f0 },
1693 { 0x15, 0x411111f0 },
1694 { 0x16, 0x411111f0 },
1695 { 0x17, 0x411111f0 },
1696 { 0x19, 0x411111f0 },
1697 { }
1698 };
1699
1700 switch (action) {
1727a771
TI
1701 case HDA_FIXUP_ACT_PRE_PROBE:
1702 snd_hda_apply_pincfgs(codec, pincfgs);
118cb4a4
TI
1703 spec->init_amp = ALC_INIT_NONE;
1704 break;
1705 }
1706}
1707
39aedee7
TI
1708static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1709 const struct hda_fixup *fix, int action)
1710{
1711 struct alc_spec *spec = codec->spec;
1c76aa5f 1712 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5ebd3bbd
TI
1713 spec->init_amp = ALC_INIT_NONE;
1714}
39aedee7 1715
5ebd3bbd
TI
1716static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1717 const struct hda_fixup *fix, int action)
1718{
1719 struct alc_spec *spec = codec->spec;
1720 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
f811c3cf 1721 spec->gen.add_jack_modes = 1;
5ebd3bbd 1722 spec->gen.hp_mic = 1;
e6e0ee50 1723 }
39aedee7
TI
1724}
1725
1727a771 1726static const struct hda_fixup alc260_fixups[] = {
ca8f0424 1727 [ALC260_FIXUP_HP_DC5750] = {
1727a771
TI
1728 .type = HDA_FIXUP_PINS,
1729 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
1730 { 0x11, 0x90130110 }, /* speaker */
1731 { }
1732 }
1733 },
ca8f0424 1734 [ALC260_FIXUP_HP_PIN_0F] = {
1727a771
TI
1735 .type = HDA_FIXUP_PINS,
1736 .v.pins = (const struct hda_pintbl[]) {
ca8f0424
TI
1737 { 0x0f, 0x01214000 }, /* HP */
1738 { }
1739 }
1740 },
1741 [ALC260_FIXUP_COEF] = {
1727a771 1742 .type = HDA_FIXUP_VERBS,
ca8f0424 1743 .v.verbs = (const struct hda_verb[]) {
e30cf2d2
RM
1744 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1745 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
ca8f0424
TI
1746 { }
1747 },
ca8f0424 1748 },
15317ab2 1749 [ALC260_FIXUP_GPIO1] = {
5579cd6f
TI
1750 .type = HDA_FIXUP_FUNC,
1751 .v.func = alc_fixup_gpio1,
15317ab2 1752 },
20f7d928 1753 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1727a771 1754 .type = HDA_FIXUP_FUNC,
20f7d928
TI
1755 .v.func = alc260_fixup_gpio1_toggle,
1756 .chained = true,
1757 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1758 },
1759 [ALC260_FIXUP_REPLACER] = {
1727a771 1760 .type = HDA_FIXUP_VERBS,
20f7d928 1761 .v.verbs = (const struct hda_verb[]) {
192a98e2
TI
1762 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1763 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
20f7d928
TI
1764 { }
1765 },
1766 .chained = true,
1767 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1768 },
0a1c4fa2 1769 [ALC260_FIXUP_HP_B1900] = {
1727a771 1770 .type = HDA_FIXUP_FUNC,
0a1c4fa2
TI
1771 .v.func = alc260_fixup_gpio1_toggle,
1772 .chained = true,
1773 .chain_id = ALC260_FIXUP_COEF,
118cb4a4
TI
1774 },
1775 [ALC260_FIXUP_KN1] = {
1727a771 1776 .type = HDA_FIXUP_FUNC,
118cb4a4
TI
1777 .v.func = alc260_fixup_kn1,
1778 },
39aedee7
TI
1779 [ALC260_FIXUP_FSC_S7020] = {
1780 .type = HDA_FIXUP_FUNC,
1781 .v.func = alc260_fixup_fsc_s7020,
1782 },
5ebd3bbd
TI
1783 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1784 .type = HDA_FIXUP_FUNC,
1785 .v.func = alc260_fixup_fsc_s7020_jwse,
1786 .chained = true,
1787 .chain_id = ALC260_FIXUP_FSC_S7020,
1788 },
d08c5ef2
TI
1789 [ALC260_FIXUP_VAIO_PINS] = {
1790 .type = HDA_FIXUP_PINS,
1791 .v.pins = (const struct hda_pintbl[]) {
1792 /* Pin configs are missing completely on some VAIOs */
1793 { 0x0f, 0x01211020 },
1794 { 0x10, 0x0001003f },
1795 { 0x11, 0x411111f0 },
1796 { 0x12, 0x01a15930 },
1797 { 0x13, 0x411111f0 },
1798 { 0x14, 0x411111f0 },
1799 { 0x15, 0x411111f0 },
1800 { 0x16, 0x411111f0 },
1801 { 0x17, 0x411111f0 },
1802 { 0x18, 0x411111f0 },
1803 { 0x19, 0x411111f0 },
1804 { }
1805 }
1806 },
1d045db9
TI
1807};
1808
1809static const struct snd_pci_quirk alc260_fixup_tbl[] = {
15317ab2 1810 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
ca8f0424 1811 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
15317ab2 1812 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
ca8f0424 1813 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
0a1c4fa2 1814 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
d08c5ef2 1815 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
0f5a5b85 1816 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
39aedee7 1817 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
b1f58085 1818 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
118cb4a4 1819 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
20f7d928 1820 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
ca8f0424 1821 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1d045db9
TI
1822 {}
1823};
1824
5ebd3bbd
TI
1825static const struct hda_model_fixup alc260_fixup_models[] = {
1826 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1827 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1828 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1829 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1830 {}
1831};
1832
1d045db9
TI
1833/*
1834 */
1d045db9 1835static int patch_alc260(struct hda_codec *codec)
977ddd6b 1836{
1d045db9 1837 struct alc_spec *spec;
c3c2c9e7 1838 int err;
1d045db9 1839
3de95173
TI
1840 err = alc_alloc_spec(codec, 0x07);
1841 if (err < 0)
1842 return err;
1d045db9 1843
3de95173 1844 spec = codec->spec;
ea46c3c8
TI
1845 /* as quite a few machines require HP amp for speaker outputs,
1846 * it's easier to enable it unconditionally; even if it's unneeded,
1847 * it's almost harmless.
1848 */
1849 spec->gen.prefer_hp_amp = 1;
7504b6cd 1850 spec->gen.beep_nid = 0x01;
1d045db9 1851
225068ab
TI
1852 spec->shutup = alc_eapd_shutup;
1853
c9af753f
TI
1854 alc_pre_init(codec);
1855
5ebd3bbd
TI
1856 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1857 alc260_fixups);
1727a771 1858 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
977ddd6b 1859
c3c2c9e7
TI
1860 /* automatic parse from the BIOS config */
1861 err = alc260_parse_auto_config(codec);
1862 if (err < 0)
1863 goto error;
977ddd6b 1864
fea80fae
TI
1865 if (!spec->gen.no_analog) {
1866 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1867 if (err < 0)
1868 goto error;
1869 }
977ddd6b 1870
1727a771 1871 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1872
1d045db9 1873 return 0;
e16fb6d1
TI
1874
1875 error:
1876 alc_free(codec);
1877 return err;
6981d184
TI
1878}
1879
1d045db9
TI
1880
1881/*
1882 * ALC882/883/885/888/889 support
1883 *
1884 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1885 * configuration. Each pin widget can choose any input DACs and a mixer.
1886 * Each ADC is connected from a mixer of all inputs. This makes possible
1887 * 6-channel independent captures.
1888 *
1889 * In addition, an independent DAC for the multi-playback (not used in this
1890 * driver yet).
1891 */
1d045db9
TI
1892
1893/*
1894 * Pin config fixes
1895 */
ff818c24 1896enum {
5c0ebfbe
TI
1897 ALC882_FIXUP_ABIT_AW9D_MAX,
1898 ALC882_FIXUP_LENOVO_Y530,
1899 ALC882_FIXUP_PB_M5210,
1900 ALC882_FIXUP_ACER_ASPIRE_7736,
1901 ALC882_FIXUP_ASUS_W90V,
8f239214 1902 ALC889_FIXUP_CD,
b2c53e20 1903 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
5c0ebfbe 1904 ALC889_FIXUP_VAIO_TT,
0e7cc2e7 1905 ALC888_FIXUP_EEE1601,
177943a3 1906 ALC882_FIXUP_EAPD,
7a6069bf 1907 ALC883_FIXUP_EAPD,
8812c4f9 1908 ALC883_FIXUP_ACER_EAPD,
1a97b7f2
TI
1909 ALC882_FIXUP_GPIO1,
1910 ALC882_FIXUP_GPIO2,
eb844d51 1911 ALC882_FIXUP_GPIO3,
68ef0561
TI
1912 ALC889_FIXUP_COEF,
1913 ALC882_FIXUP_ASUS_W2JC,
c3e837bb
TI
1914 ALC882_FIXUP_ACER_ASPIRE_4930G,
1915 ALC882_FIXUP_ACER_ASPIRE_8930G,
1916 ALC882_FIXUP_ASPIRE_8930G_VERBS,
5671087f 1917 ALC885_FIXUP_MACPRO_GPIO,
02a237b2 1918 ALC889_FIXUP_DAC_ROUTE,
1a97b7f2
TI
1919 ALC889_FIXUP_MBP_VREF,
1920 ALC889_FIXUP_IMAC91_VREF,
e7729a41 1921 ALC889_FIXUP_MBA11_VREF,
0756f09c 1922 ALC889_FIXUP_MBA21_VREF,
c20f31ec 1923 ALC889_FIXUP_MP11_VREF,
9f660a1c 1924 ALC889_FIXUP_MP41_VREF,
6e72aa5f 1925 ALC882_FIXUP_INV_DMIC,
e427c237 1926 ALC882_FIXUP_NO_PRIMARY_HP,
1f0bbf03 1927 ALC887_FIXUP_ASUS_BASS,
eb9ca3ab 1928 ALC887_FIXUP_BASS_CHMAP,
7beb3a6e 1929 ALC1220_FIXUP_GB_DUAL_CODECS,
0202f5cd 1930 ALC1220_FIXUP_CLEVO_P950,
80690a27
RS
1931 ALC1220_FIXUP_CLEVO_PB51ED,
1932 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
ca184355
JHP
1933 ALC887_FIXUP_ASUS_AUDIO,
1934 ALC887_FIXUP_ASUS_HMIC,
ff818c24
TI
1935};
1936
68ef0561 1937static void alc889_fixup_coef(struct hda_codec *codec,
1727a771 1938 const struct hda_fixup *fix, int action)
68ef0561 1939{
1727a771 1940 if (action != HDA_FIXUP_ACT_INIT)
68ef0561 1941 return;
1df8874b 1942 alc_update_coef_idx(codec, 7, 0, 0x2030);
68ef0561
TI
1943}
1944
5671087f
TI
1945/* set up GPIO at initialization */
1946static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1727a771 1947 const struct hda_fixup *fix, int action)
5671087f 1948{
215c850c
TI
1949 struct alc_spec *spec = codec->spec;
1950
1951 spec->gpio_write_delay = true;
1952 alc_fixup_gpio3(codec, fix, action);
5671087f
TI
1953}
1954
02a237b2
TI
1955/* Fix the connection of some pins for ALC889:
1956 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1957 * work correctly (bko#42740)
1958 */
1959static void alc889_fixup_dac_route(struct hda_codec *codec,
1727a771 1960 const struct hda_fixup *fix, int action)
02a237b2 1961{
1727a771 1962 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
ef8d60fb 1963 /* fake the connections during parsing the tree */
caf3c043
MM
1964 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1965 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1966 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1967 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1968 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1969 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
1727a771 1970 } else if (action == HDA_FIXUP_ACT_PROBE) {
ef8d60fb 1971 /* restore the connections */
caf3c043
MM
1972 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1973 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1974 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1975 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1976 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
02a237b2
TI
1977 }
1978}
1979
1a97b7f2
TI
1980/* Set VREF on HP pin */
1981static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1727a771 1982 const struct hda_fixup *fix, int action)
1a97b7f2 1983{
caf3c043 1984 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
1a97b7f2 1985 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
1986 int i;
1987
1727a771 1988 if (action != HDA_FIXUP_ACT_INIT)
1a97b7f2
TI
1989 return;
1990 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1991 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1992 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1993 continue;
d3f02d60 1994 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 1995 val |= AC_PINCTL_VREF_80;
cdd03ced 1996 snd_hda_set_pin_ctl(codec, nids[i], val);
08c189f2 1997 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
1998 break;
1999 }
2000}
2001
0756f09c
TI
2002static void alc889_fixup_mac_pins(struct hda_codec *codec,
2003 const hda_nid_t *nids, int num_nids)
1a97b7f2
TI
2004{
2005 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
2006 int i;
2007
0756f09c 2008 for (i = 0; i < num_nids; i++) {
1a97b7f2 2009 unsigned int val;
d3f02d60 2010 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 2011 val |= AC_PINCTL_VREF_50;
cdd03ced 2012 snd_hda_set_pin_ctl(codec, nids[i], val);
1a97b7f2 2013 }
08c189f2 2014 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2015}
2016
0756f09c
TI
2017/* Set VREF on speaker pins on imac91 */
2018static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2019 const struct hda_fixup *fix, int action)
2020{
caf3c043 2021 static const hda_nid_t nids[] = { 0x18, 0x1a };
0756f09c
TI
2022
2023 if (action == HDA_FIXUP_ACT_INIT)
2024 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2025}
2026
e7729a41
AV
2027/* Set VREF on speaker pins on mba11 */
2028static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2029 const struct hda_fixup *fix, int action)
2030{
caf3c043 2031 static const hda_nid_t nids[] = { 0x18 };
e7729a41
AV
2032
2033 if (action == HDA_FIXUP_ACT_INIT)
2034 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2035}
2036
0756f09c
TI
2037/* Set VREF on speaker pins on mba21 */
2038static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2039 const struct hda_fixup *fix, int action)
2040{
caf3c043 2041 static const hda_nid_t nids[] = { 0x18, 0x19 };
0756f09c
TI
2042
2043 if (action == HDA_FIXUP_ACT_INIT)
2044 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2045}
2046
e427c237 2047/* Don't take HP output as primary
d9111496
FLVC
2048 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2049 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
e427c237
TI
2050 */
2051static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1727a771 2052 const struct hda_fixup *fix, int action)
e427c237
TI
2053{
2054 struct alc_spec *spec = codec->spec;
da96fb5b 2055 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
08c189f2 2056 spec->gen.no_primary_hp = 1;
da96fb5b
TI
2057 spec->gen.no_multi_io = 1;
2058 }
e427c237
TI
2059}
2060
eb9ca3ab
TI
2061static void alc_fixup_bass_chmap(struct hda_codec *codec,
2062 const struct hda_fixup *fix, int action);
2063
7beb3a6e
TI
2064/* For dual-codec configuration, we need to disable some features to avoid
2065 * conflicts of kctls and PCM streams
2066 */
2067static void alc_fixup_dual_codecs(struct hda_codec *codec,
2068 const struct hda_fixup *fix, int action)
2069{
2070 struct alc_spec *spec = codec->spec;
2071
2072 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2073 return;
2074 /* disable vmaster */
2075 spec->gen.suppress_vmaster = 1;
2076 /* auto-mute and auto-mic switch don't work with multiple codecs */
2077 spec->gen.suppress_auto_mute = 1;
2078 spec->gen.suppress_auto_mic = 1;
2079 /* disable aamix as well */
2080 spec->gen.mixer_nid = 0;
2081 /* add location prefix to avoid conflicts */
2082 codec->force_pin_prefix = 1;
2083}
2084
2085static void rename_ctl(struct hda_codec *codec, const char *oldname,
2086 const char *newname)
2087{
2088 struct snd_kcontrol *kctl;
2089
2090 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2091 if (kctl)
2092 strcpy(kctl->id.name, newname);
2093}
2094
2095static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2096 const struct hda_fixup *fix,
2097 int action)
2098{
2099 alc_fixup_dual_codecs(codec, fix, action);
2100 switch (action) {
2101 case HDA_FIXUP_ACT_PRE_PROBE:
2102 /* override card longname to provide a unique UCM profile */
2103 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2104 break;
2105 case HDA_FIXUP_ACT_BUILD:
2106 /* rename Capture controls depending on the codec */
2107 rename_ctl(codec, "Capture Volume",
2108 codec->addr == 0 ?
2109 "Rear-Panel Capture Volume" :
2110 "Front-Panel Capture Volume");
2111 rename_ctl(codec, "Capture Switch",
2112 codec->addr == 0 ?
2113 "Rear-Panel Capture Switch" :
2114 "Front-Panel Capture Switch");
2115 break;
2116 }
2117}
2118
0202f5cd
P
2119static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2120 const struct hda_fixup *fix,
2121 int action)
2122{
caf3c043 2123 static const hda_nid_t conn1[] = { 0x0c };
0202f5cd
P
2124
2125 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2126 return;
2127
2128 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2129 /* We therefore want to make sure 0x14 (front headphone) and
2130 * 0x1b (speakers) use the stereo DAC 0x02
2131 */
caf3c043
MM
2132 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2133 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
0202f5cd
P
2134}
2135
7f665b1c
JS
2136static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2137 const struct hda_fixup *fix, int action);
2138
80690a27 2139static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
7f665b1c
JS
2140 const struct hda_fixup *fix,
2141 int action)
2142{
2143 alc1220_fixup_clevo_p950(codec, fix, action);
2144 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2145}
2146
ca184355
JHP
2147static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2148 struct hda_jack_callback *jack)
2149{
2150 struct alc_spec *spec = codec->spec;
2151 unsigned int vref;
2152
2153 snd_hda_gen_hp_automute(codec, jack);
2154
2155 if (spec->gen.hp_jack_present)
2156 vref = AC_PINCTL_VREF_80;
2157 else
2158 vref = AC_PINCTL_VREF_HIZ;
2159 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2160}
2161
2162static void alc887_fixup_asus_jack(struct hda_codec *codec,
2163 const struct hda_fixup *fix, int action)
2164{
2165 struct alc_spec *spec = codec->spec;
2166 if (action != HDA_FIXUP_ACT_PROBE)
2167 return;
2168 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2169 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2170}
2171
1727a771 2172static const struct hda_fixup alc882_fixups[] = {
5c0ebfbe 2173 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1727a771
TI
2174 .type = HDA_FIXUP_PINS,
2175 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2176 { 0x15, 0x01080104 }, /* side */
2177 { 0x16, 0x01011012 }, /* rear */
2178 { 0x17, 0x01016011 }, /* clfe */
2785591a 2179 { }
145a902b
DH
2180 }
2181 },
5c0ebfbe 2182 [ALC882_FIXUP_LENOVO_Y530] = {
1727a771
TI
2183 .type = HDA_FIXUP_PINS,
2184 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2185 { 0x15, 0x99130112 }, /* rear int speakers */
2186 { 0x16, 0x99130111 }, /* subwoofer */
ac612407
DH
2187 { }
2188 }
2189 },
5c0ebfbe 2190 [ALC882_FIXUP_PB_M5210] = {
fd108215
TI
2191 .type = HDA_FIXUP_PINCTLS,
2192 .v.pins = (const struct hda_pintbl[]) {
2193 { 0x19, PIN_VREF50 },
357f915e
KY
2194 {}
2195 }
2196 },
5c0ebfbe 2197 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
1727a771 2198 .type = HDA_FIXUP_FUNC,
23d30f28 2199 .v.func = alc_fixup_sku_ignore,
6981d184 2200 },
5c0ebfbe 2201 [ALC882_FIXUP_ASUS_W90V] = {
1727a771
TI
2202 .type = HDA_FIXUP_PINS,
2203 .v.pins = (const struct hda_pintbl[]) {
5cdf745e
TI
2204 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2205 { }
2206 }
2207 },
8f239214 2208 [ALC889_FIXUP_CD] = {
1727a771
TI
2209 .type = HDA_FIXUP_PINS,
2210 .v.pins = (const struct hda_pintbl[]) {
8f239214
MB
2211 { 0x1c, 0x993301f0 }, /* CD */
2212 { }
2213 }
2214 },
b2c53e20
DH
2215 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2216 .type = HDA_FIXUP_PINS,
2217 .v.pins = (const struct hda_pintbl[]) {
2218 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2219 { }
2220 },
2221 .chained = true,
2222 .chain_id = ALC889_FIXUP_CD,
2223 },
5c0ebfbe 2224 [ALC889_FIXUP_VAIO_TT] = {
1727a771
TI
2225 .type = HDA_FIXUP_PINS,
2226 .v.pins = (const struct hda_pintbl[]) {
5c0ebfbe
TI
2227 { 0x17, 0x90170111 }, /* hidden surround speaker */
2228 { }
2229 }
2230 },
0e7cc2e7 2231 [ALC888_FIXUP_EEE1601] = {
1727a771 2232 .type = HDA_FIXUP_VERBS,
0e7cc2e7
TI
2233 .v.verbs = (const struct hda_verb[]) {
2234 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2235 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2236 { }
2237 }
177943a3
TI
2238 },
2239 [ALC882_FIXUP_EAPD] = {
1727a771 2240 .type = HDA_FIXUP_VERBS,
177943a3
TI
2241 .v.verbs = (const struct hda_verb[]) {
2242 /* change to EAPD mode */
2243 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2244 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2245 { }
2246 }
2247 },
7a6069bf 2248 [ALC883_FIXUP_EAPD] = {
1727a771 2249 .type = HDA_FIXUP_VERBS,
7a6069bf
TI
2250 .v.verbs = (const struct hda_verb[]) {
2251 /* change to EAPD mode */
2252 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2253 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2254 { }
2255 }
2256 },
8812c4f9 2257 [ALC883_FIXUP_ACER_EAPD] = {
1727a771 2258 .type = HDA_FIXUP_VERBS,
8812c4f9
TI
2259 .v.verbs = (const struct hda_verb[]) {
2260 /* eanable EAPD on Acer laptops */
2261 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2262 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2263 { }
2264 }
2265 },
1a97b7f2 2266 [ALC882_FIXUP_GPIO1] = {
5579cd6f
TI
2267 .type = HDA_FIXUP_FUNC,
2268 .v.func = alc_fixup_gpio1,
1a97b7f2
TI
2269 },
2270 [ALC882_FIXUP_GPIO2] = {
5579cd6f
TI
2271 .type = HDA_FIXUP_FUNC,
2272 .v.func = alc_fixup_gpio2,
1a97b7f2 2273 },
eb844d51 2274 [ALC882_FIXUP_GPIO3] = {
5579cd6f
TI
2275 .type = HDA_FIXUP_FUNC,
2276 .v.func = alc_fixup_gpio3,
eb844d51 2277 },
68ef0561 2278 [ALC882_FIXUP_ASUS_W2JC] = {
5579cd6f
TI
2279 .type = HDA_FIXUP_FUNC,
2280 .v.func = alc_fixup_gpio1,
68ef0561
TI
2281 .chained = true,
2282 .chain_id = ALC882_FIXUP_EAPD,
2283 },
2284 [ALC889_FIXUP_COEF] = {
1727a771 2285 .type = HDA_FIXUP_FUNC,
68ef0561
TI
2286 .v.func = alc889_fixup_coef,
2287 },
c3e837bb 2288 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
1727a771
TI
2289 .type = HDA_FIXUP_PINS,
2290 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2291 { 0x16, 0x99130111 }, /* CLFE speaker */
2292 { 0x17, 0x99130112 }, /* surround speaker */
2293 { }
038d4fef
TI
2294 },
2295 .chained = true,
2296 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb
TI
2297 },
2298 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
1727a771
TI
2299 .type = HDA_FIXUP_PINS,
2300 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2301 { 0x16, 0x99130111 }, /* CLFE speaker */
2302 { 0x1b, 0x99130112 }, /* surround speaker */
2303 { }
2304 },
2305 .chained = true,
2306 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2307 },
2308 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2309 /* additional init verbs for Acer Aspire 8930G */
1727a771 2310 .type = HDA_FIXUP_VERBS,
c3e837bb
TI
2311 .v.verbs = (const struct hda_verb[]) {
2312 /* Enable all DACs */
2313 /* DAC DISABLE/MUTE 1? */
2314 /* setting bits 1-5 disables DAC nids 0x02-0x06
2315 * apparently. Init=0x38 */
2316 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2317 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2318 /* DAC DISABLE/MUTE 2? */
2319 /* some bit here disables the other DACs.
2320 * Init=0x4900 */
2321 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2322 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2323 /* DMIC fix
2324 * This laptop has a stereo digital microphone.
2325 * The mics are only 1cm apart which makes the stereo
2326 * useless. However, either the mic or the ALC889
2327 * makes the signal become a difference/sum signal
2328 * instead of standard stereo, which is annoying.
2329 * So instead we flip this bit which makes the
2330 * codec replicate the sum signal to both channels,
2331 * turning it into a normal mono mic.
2332 */
2333 /* DMIC_CONTROL? Init value = 0x0001 */
2334 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2335 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2336 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2337 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2338 { }
038d4fef
TI
2339 },
2340 .chained = true,
2341 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb 2342 },
5671087f 2343 [ALC885_FIXUP_MACPRO_GPIO] = {
1727a771 2344 .type = HDA_FIXUP_FUNC,
5671087f
TI
2345 .v.func = alc885_fixup_macpro_gpio,
2346 },
02a237b2 2347 [ALC889_FIXUP_DAC_ROUTE] = {
1727a771 2348 .type = HDA_FIXUP_FUNC,
02a237b2
TI
2349 .v.func = alc889_fixup_dac_route,
2350 },
1a97b7f2 2351 [ALC889_FIXUP_MBP_VREF] = {
1727a771 2352 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2353 .v.func = alc889_fixup_mbp_vref,
2354 .chained = true,
2355 .chain_id = ALC882_FIXUP_GPIO1,
2356 },
2357 [ALC889_FIXUP_IMAC91_VREF] = {
1727a771 2358 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2359 .v.func = alc889_fixup_imac91_vref,
2360 .chained = true,
2361 .chain_id = ALC882_FIXUP_GPIO1,
2362 },
e7729a41
AV
2363 [ALC889_FIXUP_MBA11_VREF] = {
2364 .type = HDA_FIXUP_FUNC,
2365 .v.func = alc889_fixup_mba11_vref,
2366 .chained = true,
2367 .chain_id = ALC889_FIXUP_MBP_VREF,
2368 },
0756f09c
TI
2369 [ALC889_FIXUP_MBA21_VREF] = {
2370 .type = HDA_FIXUP_FUNC,
2371 .v.func = alc889_fixup_mba21_vref,
2372 .chained = true,
2373 .chain_id = ALC889_FIXUP_MBP_VREF,
2374 },
c20f31ec
TI
2375 [ALC889_FIXUP_MP11_VREF] = {
2376 .type = HDA_FIXUP_FUNC,
2377 .v.func = alc889_fixup_mba11_vref,
2378 .chained = true,
2379 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2380 },
9f660a1c
MK
2381 [ALC889_FIXUP_MP41_VREF] = {
2382 .type = HDA_FIXUP_FUNC,
2383 .v.func = alc889_fixup_mbp_vref,
2384 .chained = true,
2385 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2386 },
6e72aa5f 2387 [ALC882_FIXUP_INV_DMIC] = {
1727a771 2388 .type = HDA_FIXUP_FUNC,
9d36a7dc 2389 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2390 },
e427c237 2391 [ALC882_FIXUP_NO_PRIMARY_HP] = {
1727a771 2392 .type = HDA_FIXUP_FUNC,
e427c237
TI
2393 .v.func = alc882_fixup_no_primary_hp,
2394 },
1f0bbf03
TI
2395 [ALC887_FIXUP_ASUS_BASS] = {
2396 .type = HDA_FIXUP_PINS,
2397 .v.pins = (const struct hda_pintbl[]) {
2398 {0x16, 0x99130130}, /* bass speaker */
2399 {}
2400 },
eb9ca3ab
TI
2401 .chained = true,
2402 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2403 },
2404 [ALC887_FIXUP_BASS_CHMAP] = {
2405 .type = HDA_FIXUP_FUNC,
2406 .v.func = alc_fixup_bass_chmap,
1f0bbf03 2407 },
7beb3a6e
TI
2408 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2409 .type = HDA_FIXUP_FUNC,
2410 .v.func = alc1220_fixup_gb_dual_codecs,
2411 },
0202f5cd
P
2412 [ALC1220_FIXUP_CLEVO_P950] = {
2413 .type = HDA_FIXUP_FUNC,
2414 .v.func = alc1220_fixup_clevo_p950,
2415 },
80690a27 2416 [ALC1220_FIXUP_CLEVO_PB51ED] = {
7f665b1c 2417 .type = HDA_FIXUP_FUNC,
80690a27 2418 .v.func = alc1220_fixup_clevo_pb51ed,
7f665b1c 2419 },
80690a27 2420 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
7f665b1c
JS
2421 .type = HDA_FIXUP_PINS,
2422 .v.pins = (const struct hda_pintbl[]) {
2423 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2424 {}
2425 },
2426 .chained = true,
80690a27 2427 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
7f665b1c 2428 },
ca184355
JHP
2429 [ALC887_FIXUP_ASUS_AUDIO] = {
2430 .type = HDA_FIXUP_PINS,
2431 .v.pins = (const struct hda_pintbl[]) {
2432 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2433 { 0x19, 0x22219420 },
2434 {}
2435 },
2436 },
2437 [ALC887_FIXUP_ASUS_HMIC] = {
2438 .type = HDA_FIXUP_FUNC,
2439 .v.func = alc887_fixup_asus_jack,
2440 .chained = true,
2441 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2442 },
ff818c24
TI
2443};
2444
1d045db9 2445static const struct snd_pci_quirk alc882_fixup_tbl[] = {
8812c4f9
TI
2446 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2447 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
b5d724b1 2448 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
8812c4f9
TI
2449 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2450 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2451 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2452 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
c3e837bb
TI
2453 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2454 ALC882_FIXUP_ACER_ASPIRE_4930G),
2455 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2456 ALC882_FIXUP_ACER_ASPIRE_4930G),
2457 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2458 ALC882_FIXUP_ACER_ASPIRE_8930G),
2459 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2460 ALC882_FIXUP_ACER_ASPIRE_8930G),
2461 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2462 ALC882_FIXUP_ACER_ASPIRE_4930G),
2463 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2464 ALC882_FIXUP_ACER_ASPIRE_4930G),
2465 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2466 ALC882_FIXUP_ACER_ASPIRE_4930G),
5c0ebfbe 2467 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
f5c53d89
TI
2468 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2469 ALC882_FIXUP_ACER_ASPIRE_4930G),
02a237b2 2470 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
fe97da1f 2471 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
ac9b1cdd 2472 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
177943a3 2473 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
5c0ebfbe 2474 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
68ef0561 2475 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
ca184355 2476 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
0e7cc2e7 2477 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
1f0bbf03 2478 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
85bcf96c 2479 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
ac9b1cdd 2480 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
e427c237 2481 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
3f3c3714 2482 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
12e31a78 2483 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
c44d9b11 2484 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
5671087f
TI
2485
2486 /* All Apple entries are in codec SSIDs */
1a97b7f2
TI
2487 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2488 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2489 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
c20f31ec 2490 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
5671087f
TI
2491 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2492 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2493 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2494 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
5671087f 2495 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
e7729a41 2496 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
0756f09c 2497 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
1a97b7f2
TI
2498 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2499 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
5671087f 2500 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2501 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2502 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2503 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
9f660a1c 2504 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
05193639 2505 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
1a97b7f2
TI
2506 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2507 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
649ccd08 2508 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
5671087f 2509
7a6069bf 2510 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
b2c53e20 2511 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
7beb3a6e 2512 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
0d45e86d 2513 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
d9e8fe0c 2514 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
a0b03952 2515 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
a655e2b1 2516 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
1d3aa4a5 2517 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
7dafba37 2518 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
cc5049ae 2519 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
d2c3b14e 2520 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
63691587 2521 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
d2c3b14e 2522 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
5c0ebfbe 2523 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
0202f5cd 2524 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
b5acfe15
PH
2525 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2526 SND_PCI_QUIRK(0x1558, 0x950A, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
f3d737b6 2527 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2f0d520a 2528 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
b5acfe15
PH
2529 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2530 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2531 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2532 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
503d90b3
RS
2533 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2534 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
b5acfe15
PH
2535 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2536 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
503d90b3 2537 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
b5acfe15
PH
2538 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2539 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
503d90b3 2540 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
b5acfe15 2541 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
259eb824
PH
2542 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2543 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7a6069bf
TI
2544 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2545 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
ac9b1cdd 2546 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
68ef0561 2547 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
ff818c24
TI
2548 {}
2549};
2550
1727a771 2551static const struct hda_model_fixup alc882_fixup_models[] = {
772c2917
TI
2552 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2553 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2554 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2555 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2556 {.id = ALC889_FIXUP_CD, .name = "cd"},
2557 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2558 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2559 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2560 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2561 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2562 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2563 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2564 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2565 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2566 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
912093bc
TI
2567 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2568 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2569 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
772c2917
TI
2570 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2571 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2572 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2573 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2574 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2575 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2576 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2577 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
6e72aa5f 2578 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
e427c237 2579 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
772c2917 2580 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
ba90d6a6 2581 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
772c2917 2582 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
912093bc
TI
2583 {}
2584};
2585
f6a92248 2586/*
1d045db9 2587 * BIOS auto configuration
f6a92248 2588 */
1d045db9
TI
2589/* almost identical with ALC880 parser... */
2590static int alc882_parse_auto_config(struct hda_codec *codec)
2591{
1d045db9 2592 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2593 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2594 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
1d045db9 2595}
b896b4eb 2596
1d045db9
TI
2597/*
2598 */
1d045db9 2599static int patch_alc882(struct hda_codec *codec)
f6a92248
KY
2600{
2601 struct alc_spec *spec;
1a97b7f2 2602 int err;
f6a92248 2603
3de95173
TI
2604 err = alc_alloc_spec(codec, 0x0b);
2605 if (err < 0)
2606 return err;
f6a92248 2607
3de95173 2608 spec = codec->spec;
1f0f4b80 2609
7639a06c 2610 switch (codec->core.vendor_id) {
1d045db9
TI
2611 case 0x10ec0882:
2612 case 0x10ec0885:
acf08081 2613 case 0x10ec0900:
6d9ffcff 2614 case 0x10ec0b00:
a535ad57 2615 case 0x10ec1220:
1d045db9
TI
2616 break;
2617 default:
2618 /* ALC883 and variants */
2619 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2620 break;
c793bec5 2621 }
977ddd6b 2622
c9af753f
TI
2623 alc_pre_init(codec);
2624
1727a771 2625 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
912093bc 2626 alc882_fixups);
1727a771 2627 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ff818c24 2628
1d045db9
TI
2629 alc_auto_parse_customize_define(codec);
2630
7504b6cd
TI
2631 if (has_cdefine_beep(codec))
2632 spec->gen.beep_nid = 0x01;
2633
1a97b7f2
TI
2634 /* automatic parse from the BIOS config */
2635 err = alc882_parse_auto_config(codec);
2636 if (err < 0)
2637 goto error;
f6a92248 2638
fea80fae
TI
2639 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2640 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2641 if (err < 0)
2642 goto error;
2643 }
f6a92248 2644
1727a771 2645 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2646
f6a92248 2647 return 0;
e16fb6d1
TI
2648
2649 error:
2650 alc_free(codec);
2651 return err;
f6a92248
KY
2652}
2653
df694daa 2654
df694daa 2655/*
1d045db9 2656 * ALC262 support
df694daa 2657 */
1d045db9 2658static int alc262_parse_auto_config(struct hda_codec *codec)
df694daa 2659{
1d045db9 2660 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2661 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2662 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
df694daa
KY
2663}
2664
df694daa 2665/*
1d045db9 2666 * Pin config fixes
df694daa 2667 */
cfc9b06f 2668enum {
ea4e7af1 2669 ALC262_FIXUP_FSC_H270,
7513e6da 2670 ALC262_FIXUP_FSC_S7110,
ea4e7af1
TI
2671 ALC262_FIXUP_HP_Z200,
2672 ALC262_FIXUP_TYAN,
c470150c 2673 ALC262_FIXUP_LENOVO_3000,
b42590b8
TI
2674 ALC262_FIXUP_BENQ,
2675 ALC262_FIXUP_BENQ_T31,
6e72aa5f 2676 ALC262_FIXUP_INV_DMIC,
b5c6611f 2677 ALC262_FIXUP_INTEL_BAYLEYBAY,
cfc9b06f
TI
2678};
2679
1727a771 2680static const struct hda_fixup alc262_fixups[] = {
ea4e7af1 2681 [ALC262_FIXUP_FSC_H270] = {
1727a771
TI
2682 .type = HDA_FIXUP_PINS,
2683 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2684 { 0x14, 0x99130110 }, /* speaker */
2685 { 0x15, 0x0221142f }, /* front HP */
2686 { 0x1b, 0x0121141f }, /* rear HP */
2687 { }
2688 }
2689 },
7513e6da
TI
2690 [ALC262_FIXUP_FSC_S7110] = {
2691 .type = HDA_FIXUP_PINS,
2692 .v.pins = (const struct hda_pintbl[]) {
2693 { 0x15, 0x90170110 }, /* speaker */
2694 { }
2695 },
2696 .chained = true,
2697 .chain_id = ALC262_FIXUP_BENQ,
2698 },
ea4e7af1 2699 [ALC262_FIXUP_HP_Z200] = {
1727a771
TI
2700 .type = HDA_FIXUP_PINS,
2701 .v.pins = (const struct hda_pintbl[]) {
1d045db9 2702 { 0x16, 0x99130120 }, /* internal speaker */
73413b12
TI
2703 { }
2704 }
cfc9b06f 2705 },
ea4e7af1 2706 [ALC262_FIXUP_TYAN] = {
1727a771
TI
2707 .type = HDA_FIXUP_PINS,
2708 .v.pins = (const struct hda_pintbl[]) {
ea4e7af1
TI
2709 { 0x14, 0x1993e1f0 }, /* int AUX */
2710 { }
2711 }
2712 },
c470150c 2713 [ALC262_FIXUP_LENOVO_3000] = {
fd108215
TI
2714 .type = HDA_FIXUP_PINCTLS,
2715 .v.pins = (const struct hda_pintbl[]) {
2716 { 0x19, PIN_VREF50 },
b42590b8
TI
2717 {}
2718 },
2719 .chained = true,
2720 .chain_id = ALC262_FIXUP_BENQ,
2721 },
2722 [ALC262_FIXUP_BENQ] = {
1727a771 2723 .type = HDA_FIXUP_VERBS,
b42590b8 2724 .v.verbs = (const struct hda_verb[]) {
c470150c
TI
2725 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2726 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2727 {}
2728 }
2729 },
b42590b8 2730 [ALC262_FIXUP_BENQ_T31] = {
1727a771 2731 .type = HDA_FIXUP_VERBS,
b42590b8
TI
2732 .v.verbs = (const struct hda_verb[]) {
2733 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2734 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2735 {}
2736 }
2737 },
6e72aa5f 2738 [ALC262_FIXUP_INV_DMIC] = {
1727a771 2739 .type = HDA_FIXUP_FUNC,
9d36a7dc 2740 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2741 },
b5c6611f
ML
2742 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2743 .type = HDA_FIXUP_FUNC,
2744 .v.func = alc_fixup_no_depop_delay,
2745 },
cfc9b06f
TI
2746};
2747
1d045db9 2748static const struct snd_pci_quirk alc262_fixup_tbl[] = {
ea4e7af1 2749 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
7513e6da 2750 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
3dcd3be3 2751 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
ea4e7af1 2752 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
275ec0cb 2753 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
ea4e7af1 2754 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
c470150c 2755 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
b42590b8
TI
2756 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2757 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
b5c6611f 2758 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
cfc9b06f
TI
2759 {}
2760};
df694daa 2761
1727a771 2762static const struct hda_model_fixup alc262_fixup_models[] = {
6e72aa5f 2763 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
e43c44d6
TI
2764 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2765 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2766 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2767 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2768 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2769 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2770 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2771 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
6e72aa5f
TI
2772 {}
2773};
1d045db9 2774
1d045db9
TI
2775/*
2776 */
1d045db9 2777static int patch_alc262(struct hda_codec *codec)
df694daa
KY
2778{
2779 struct alc_spec *spec;
df694daa
KY
2780 int err;
2781
3de95173
TI
2782 err = alc_alloc_spec(codec, 0x0b);
2783 if (err < 0)
2784 return err;
df694daa 2785
3de95173 2786 spec = codec->spec;
08c189f2 2787 spec->gen.shared_mic_vref_pin = 0x18;
1d045db9 2788
225068ab
TI
2789 spec->shutup = alc_eapd_shutup;
2790
1d045db9
TI
2791#if 0
2792 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2793 * under-run
2794 */
98b24883 2795 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
1d045db9 2796#endif
1d045db9
TI
2797 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2798
c9af753f
TI
2799 alc_pre_init(codec);
2800
1727a771 2801 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
6e72aa5f 2802 alc262_fixups);
1727a771 2803 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9c7f852e 2804
af741c15
TI
2805 alc_auto_parse_customize_define(codec);
2806
7504b6cd
TI
2807 if (has_cdefine_beep(codec))
2808 spec->gen.beep_nid = 0x01;
2809
42399f7a
TI
2810 /* automatic parse from the BIOS config */
2811 err = alc262_parse_auto_config(codec);
2812 if (err < 0)
2813 goto error;
df694daa 2814
fea80fae
TI
2815 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2816 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2817 if (err < 0)
2818 goto error;
2819 }
2134ea4f 2820
1727a771 2821 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2822
1da177e4 2823 return 0;
e16fb6d1
TI
2824
2825 error:
2826 alc_free(codec);
2827 return err;
1da177e4
LT
2828}
2829
f32610ed 2830/*
1d045db9 2831 * ALC268
f32610ed 2832 */
1d045db9 2833/* bind Beep switches of both NID 0x0f and 0x10 */
a717777d
TI
2834static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2835 struct snd_ctl_elem_value *ucontrol)
2836{
2837 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2838 unsigned long pval;
2839 int err;
2840
2841 mutex_lock(&codec->control_mutex);
2842 pval = kcontrol->private_value;
2843 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2844 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2845 if (err >= 0) {
2846 kcontrol->private_value = (pval & ~0xff) | 0x10;
2847 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2848 }
2849 kcontrol->private_value = pval;
2850 mutex_unlock(&codec->control_mutex);
2851 return err;
2852}
f32610ed 2853
1d045db9
TI
2854static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2855 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
a717777d
TI
2856 {
2857 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2858 .name = "Beep Playback Switch",
2859 .subdevice = HDA_SUBDEV_AMP_FLAG,
2860 .info = snd_hda_mixer_amp_switch_info,
2861 .get = snd_hda_mixer_amp_switch_get,
2862 .put = alc268_beep_switch_put,
2863 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2864 },
f32610ed
JS
2865};
2866
1d045db9
TI
2867/* set PCBEEP vol = 0, mute connections */
2868static const struct hda_verb alc268_beep_init_verbs[] = {
2869 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2870 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2871 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2872 { }
f32610ed
JS
2873};
2874
6e72aa5f
TI
2875enum {
2876 ALC268_FIXUP_INV_DMIC,
cb766404 2877 ALC268_FIXUP_HP_EAPD,
24eff328 2878 ALC268_FIXUP_SPDIF,
6e72aa5f
TI
2879};
2880
1727a771 2881static const struct hda_fixup alc268_fixups[] = {
6e72aa5f 2882 [ALC268_FIXUP_INV_DMIC] = {
1727a771 2883 .type = HDA_FIXUP_FUNC,
9d36a7dc 2884 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2885 },
cb766404 2886 [ALC268_FIXUP_HP_EAPD] = {
1727a771 2887 .type = HDA_FIXUP_VERBS,
cb766404
TI
2888 .v.verbs = (const struct hda_verb[]) {
2889 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2890 {}
2891 }
2892 },
24eff328
TI
2893 [ALC268_FIXUP_SPDIF] = {
2894 .type = HDA_FIXUP_PINS,
2895 .v.pins = (const struct hda_pintbl[]) {
2896 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2897 {}
2898 }
2899 },
6e72aa5f
TI
2900};
2901
1727a771 2902static const struct hda_model_fixup alc268_fixup_models[] = {
6e72aa5f 2903 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
cb766404 2904 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
03bf11c9 2905 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
cb766404
TI
2906 {}
2907};
2908
2909static const struct snd_pci_quirk alc268_fixup_tbl[] = {
24eff328 2910 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
fcd8f3b1 2911 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
cb766404
TI
2912 /* below is codec SSID since multiple Toshiba laptops have the
2913 * same PCI SSID 1179:ff00
2914 */
2915 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
6e72aa5f
TI
2916 {}
2917};
2918
f32610ed
JS
2919/*
2920 * BIOS auto configuration
2921 */
1d045db9 2922static int alc268_parse_auto_config(struct hda_codec *codec)
f32610ed 2923{
3e6179b8 2924 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7504b6cd 2925 return alc_parse_auto_config(codec, NULL, alc268_ssids);
f32610ed
JS
2926}
2927
1d045db9
TI
2928/*
2929 */
1d045db9 2930static int patch_alc268(struct hda_codec *codec)
f32610ed
JS
2931{
2932 struct alc_spec *spec;
a5cb463a 2933 int i, err;
f32610ed 2934
1d045db9 2935 /* ALC268 has no aa-loopback mixer */
3de95173
TI
2936 err = alc_alloc_spec(codec, 0);
2937 if (err < 0)
2938 return err;
2939
2940 spec = codec->spec;
2722b535
TI
2941 if (has_cdefine_beep(codec))
2942 spec->gen.beep_nid = 0x01;
1f0f4b80 2943
225068ab
TI
2944 spec->shutup = alc_eapd_shutup;
2945
c9af753f
TI
2946 alc_pre_init(codec);
2947
1727a771
TI
2948 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2949 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6e72aa5f 2950
6ebb8053
TI
2951 /* automatic parse from the BIOS config */
2952 err = alc268_parse_auto_config(codec);
e16fb6d1
TI
2953 if (err < 0)
2954 goto error;
f32610ed 2955
7504b6cd
TI
2956 if (err > 0 && !spec->gen.no_analog &&
2957 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
a5cb463a
TI
2958 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2959 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2960 &alc268_beep_mixer[i])) {
2961 err = -ENOMEM;
2962 goto error;
2963 }
2964 }
7504b6cd 2965 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
1d045db9
TI
2966 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2967 /* override the amp caps for beep generator */
2968 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2969 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2970 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2971 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2972 (0 << AC_AMPCAP_MUTE_SHIFT));
2f893286
KY
2973 }
2974
1727a771 2975 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6e72aa5f 2976
f32610ed 2977 return 0;
e16fb6d1
TI
2978
2979 error:
2980 alc_free(codec);
2981 return err;
f32610ed
JS
2982}
2983
bc9f98a9 2984/*
1d045db9 2985 * ALC269
bc9f98a9 2986 */
08c189f2 2987
1d045db9 2988static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
1d045db9 2989 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9
KY
2990};
2991
1d045db9 2992static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
1d045db9 2993 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9 2994};
291702f0 2995
1d045db9
TI
2996/* different alc269-variants */
2997enum {
2998 ALC269_TYPE_ALC269VA,
2999 ALC269_TYPE_ALC269VB,
3000 ALC269_TYPE_ALC269VC,
adcc70b2 3001 ALC269_TYPE_ALC269VD,
065380f0
KY
3002 ALC269_TYPE_ALC280,
3003 ALC269_TYPE_ALC282,
2af02be7 3004 ALC269_TYPE_ALC283,
065380f0 3005 ALC269_TYPE_ALC284,
4731d5de 3006 ALC269_TYPE_ALC293,
7fc7d047 3007 ALC269_TYPE_ALC286,
506b62c3 3008 ALC269_TYPE_ALC298,
1d04c9de 3009 ALC269_TYPE_ALC255,
4344aec8 3010 ALC269_TYPE_ALC256,
f429e7e4 3011 ALC269_TYPE_ALC257,
0a6f0600 3012 ALC269_TYPE_ALC215,
4231430d 3013 ALC269_TYPE_ALC225,
dcd4f0db 3014 ALC269_TYPE_ALC294,
1078bef0 3015 ALC269_TYPE_ALC300,
f0778871 3016 ALC269_TYPE_ALC623,
6fbae35a 3017 ALC269_TYPE_ALC700,
bc9f98a9
KY
3018};
3019
3020/*
1d045db9 3021 * BIOS auto configuration
bc9f98a9 3022 */
1d045db9
TI
3023static int alc269_parse_auto_config(struct hda_codec *codec)
3024{
1d045db9 3025 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3e6179b8
TI
3026 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3027 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3028 struct alc_spec *spec = codec->spec;
adcc70b2
KY
3029 const hda_nid_t *ssids;
3030
3031 switch (spec->codec_variant) {
3032 case ALC269_TYPE_ALC269VA:
3033 case ALC269_TYPE_ALC269VC:
065380f0
KY
3034 case ALC269_TYPE_ALC280:
3035 case ALC269_TYPE_ALC284:
4731d5de 3036 case ALC269_TYPE_ALC293:
adcc70b2
KY
3037 ssids = alc269va_ssids;
3038 break;
3039 case ALC269_TYPE_ALC269VB:
3040 case ALC269_TYPE_ALC269VD:
065380f0 3041 case ALC269_TYPE_ALC282:
2af02be7 3042 case ALC269_TYPE_ALC283:
7fc7d047 3043 case ALC269_TYPE_ALC286:
506b62c3 3044 case ALC269_TYPE_ALC298:
1d04c9de 3045 case ALC269_TYPE_ALC255:
4344aec8 3046 case ALC269_TYPE_ALC256:
f429e7e4 3047 case ALC269_TYPE_ALC257:
0a6f0600 3048 case ALC269_TYPE_ALC215:
4231430d 3049 case ALC269_TYPE_ALC225:
dcd4f0db 3050 case ALC269_TYPE_ALC294:
1078bef0 3051 case ALC269_TYPE_ALC300:
f0778871 3052 case ALC269_TYPE_ALC623:
6fbae35a 3053 case ALC269_TYPE_ALC700:
adcc70b2
KY
3054 ssids = alc269_ssids;
3055 break;
3056 default:
3057 ssids = alc269_ssids;
3058 break;
3059 }
bc9f98a9 3060
3e6179b8 3061 return alc_parse_auto_config(codec, alc269_ignore, ssids);
1d045db9 3062}
bc9f98a9 3063
476c02e0
HW
3064static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3065 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3066 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3067 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3068 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3069 {}
3070};
3071
3072static void alc_headset_btn_callback(struct hda_codec *codec,
3073 struct hda_jack_callback *jack)
3074{
3075 int report = 0;
3076
3077 if (jack->unsol_res & (7 << 13))
3078 report |= SND_JACK_BTN_0;
3079
3080 if (jack->unsol_res & (1 << 16 | 3 << 8))
3081 report |= SND_JACK_BTN_1;
3082
3083 /* Volume up key */
3084 if (jack->unsol_res & (7 << 23))
3085 report |= SND_JACK_BTN_2;
3086
3087 /* Volume down key */
3088 if (jack->unsol_res & (7 << 10))
3089 report |= SND_JACK_BTN_3;
3090
3091 jack->jack->button_state = report;
3092}
3093
3094static void alc_disable_headset_jack_key(struct hda_codec *codec)
3095{
3096 struct alc_spec *spec = codec->spec;
3097
3098 if (!spec->has_hs_key)
3099 return;
3100
3101 switch (codec->core.vendor_id) {
3102 case 0x10ec0215:
3103 case 0x10ec0225:
3104 case 0x10ec0285:
3105 case 0x10ec0295:
3106 case 0x10ec0289:
3107 case 0x10ec0299:
3108 alc_write_coef_idx(codec, 0x48, 0x0);
3109 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3110 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3111 break;
3112 case 0x10ec0236:
3113 case 0x10ec0256:
3114 alc_write_coef_idx(codec, 0x48, 0x0);
3115 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3116 break;
3117 }
3118}
3119
3120static void alc_enable_headset_jack_key(struct hda_codec *codec)
3121{
3122 struct alc_spec *spec = codec->spec;
3123
3124 if (!spec->has_hs_key)
3125 return;
3126
3127 switch (codec->core.vendor_id) {
3128 case 0x10ec0215:
3129 case 0x10ec0225:
3130 case 0x10ec0285:
3131 case 0x10ec0295:
3132 case 0x10ec0289:
3133 case 0x10ec0299:
3134 alc_write_coef_idx(codec, 0x48, 0xd011);
3135 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3136 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3137 break;
3138 case 0x10ec0236:
3139 case 0x10ec0256:
3140 alc_write_coef_idx(codec, 0x48, 0xd011);
3141 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3142 break;
3143 }
3144}
3145
3146static void alc_fixup_headset_jack(struct hda_codec *codec,
3147 const struct hda_fixup *fix, int action)
3148{
3149 struct alc_spec *spec = codec->spec;
3150
3151 switch (action) {
3152 case HDA_FIXUP_ACT_PRE_PROBE:
3153 spec->has_hs_key = 1;
3154 snd_hda_jack_detect_enable_callback(codec, 0x55,
3155 alc_headset_btn_callback);
3156 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
3157 SND_JACK_HEADSET, alc_headset_btn_keymap);
3158 break;
3159 case HDA_FIXUP_ACT_INIT:
3160 alc_enable_headset_jack_key(codec);
3161 break;
3162 }
3163}
3164
1387e2d1 3165static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
1d045db9 3166{
98b24883 3167 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
1d045db9 3168}
291702f0 3169
1d045db9
TI
3170static void alc269_shutup(struct hda_codec *codec)
3171{
adcc70b2
KY
3172 struct alc_spec *spec = codec->spec;
3173
1387e2d1
KY
3174 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3175 alc269vb_toggle_power_output(codec, 0);
3176 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3177 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3178 msleep(150);
3179 }
c0ca5ece 3180 alc_shutup_pins(codec);
1d045db9 3181}
291702f0 3182
6b0f95c4 3183static const struct coef_fw alc282_coefs[] = {
54db6c39 3184 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
32fa7e49 3185 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3186 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3187 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3188 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3189 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3190 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3191 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3192 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3193 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3194 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3195 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3196 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3197 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3198 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3199 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3200 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3201 WRITE_COEF(0x63, 0x2902), /* PLL */
3202 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3203 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3204 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3205 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3206 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3207 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3208 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3209 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3210 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3211 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3212 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3213 {}
3214};
3215
cb149cb3
KY
3216static void alc282_restore_default_value(struct hda_codec *codec)
3217{
54db6c39 3218 alc_process_coef_fw(codec, alc282_coefs);
cb149cb3
KY
3219}
3220
7b5c7a02
KY
3221static void alc282_init(struct hda_codec *codec)
3222{
3223 struct alc_spec *spec = codec->spec;
35a39f98 3224 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3225 bool hp_pin_sense;
3226 int coef78;
3227
cb149cb3
KY
3228 alc282_restore_default_value(codec);
3229
7b5c7a02
KY
3230 if (!hp_pin)
3231 return;
3232 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3233 coef78 = alc_read_coef_idx(codec, 0x78);
3234
3235 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3236 /* Headphone capless set to high power mode */
3237 alc_write_coef_idx(codec, 0x78, 0x9004);
3238
3239 if (hp_pin_sense)
3240 msleep(2);
3241
3242 snd_hda_codec_write(codec, hp_pin, 0,
3243 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3244
3245 if (hp_pin_sense)
3246 msleep(85);
3247
3248 snd_hda_codec_write(codec, hp_pin, 0,
3249 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3250
3251 if (hp_pin_sense)
3252 msleep(100);
3253
3254 /* Headphone capless set to normal mode */
3255 alc_write_coef_idx(codec, 0x78, coef78);
3256}
3257
3258static void alc282_shutup(struct hda_codec *codec)
3259{
3260 struct alc_spec *spec = codec->spec;
35a39f98 3261 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3262 bool hp_pin_sense;
3263 int coef78;
3264
3265 if (!hp_pin) {
3266 alc269_shutup(codec);
3267 return;
3268 }
3269
3270 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3271 coef78 = alc_read_coef_idx(codec, 0x78);
3272 alc_write_coef_idx(codec, 0x78, 0x9004);
3273
3274 if (hp_pin_sense)
3275 msleep(2);
3276
3277 snd_hda_codec_write(codec, hp_pin, 0,
3278 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3279
3280 if (hp_pin_sense)
3281 msleep(85);
3282
c0ca5ece
TI
3283 if (!spec->no_shutup_pins)
3284 snd_hda_codec_write(codec, hp_pin, 0,
3285 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
7b5c7a02
KY
3286
3287 if (hp_pin_sense)
3288 msleep(100);
3289
3290 alc_auto_setup_eapd(codec, false);
c0ca5ece 3291 alc_shutup_pins(codec);
7b5c7a02
KY
3292 alc_write_coef_idx(codec, 0x78, coef78);
3293}
3294
6b0f95c4 3295static const struct coef_fw alc283_coefs[] = {
54db6c39 3296 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
56779864 3297 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3298 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3299 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3300 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3301 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3302 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3303 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3304 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3305 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3306 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3307 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3308 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3309 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3310 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3311 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3312 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3313 WRITE_COEF(0x2e, 0x2902), /* PLL */
3314 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3315 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3316 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3317 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3318 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3319 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3320 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3321 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3322 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3323 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3324 WRITE_COEF(0x49, 0x0), /* test mode */
3325 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3326 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3327 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
56779864 3328 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
54db6c39
TI
3329 {}
3330};
3331
6bd55b04
KY
3332static void alc283_restore_default_value(struct hda_codec *codec)
3333{
54db6c39 3334 alc_process_coef_fw(codec, alc283_coefs);
6bd55b04
KY
3335}
3336
2af02be7
KY
3337static void alc283_init(struct hda_codec *codec)
3338{
3339 struct alc_spec *spec = codec->spec;
35a39f98 3340 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3341 bool hp_pin_sense;
2af02be7 3342
6bd55b04
KY
3343 alc283_restore_default_value(codec);
3344
2af02be7
KY
3345 if (!hp_pin)
3346 return;
a59d7199
KY
3347
3348 msleep(30);
2af02be7
KY
3349 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3350
3351 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3352 /* Headphone capless set to high power mode */
3353 alc_write_coef_idx(codec, 0x43, 0x9004);
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
3361 snd_hda_codec_write(codec, hp_pin, 0,
3362 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3363
3364 if (hp_pin_sense)
3365 msleep(85);
3366 /* Index 0x46 Combo jack auto switch control 2 */
3367 /* 3k pull low control for Headset jack. */
98b24883 3368 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2af02be7
KY
3369 /* Headphone capless set to normal mode */
3370 alc_write_coef_idx(codec, 0x43, 0x9614);
3371}
3372
3373static void alc283_shutup(struct hda_codec *codec)
3374{
3375 struct alc_spec *spec = codec->spec;
35a39f98 3376 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3377 bool hp_pin_sense;
2af02be7
KY
3378
3379 if (!hp_pin) {
3380 alc269_shutup(codec);
3381 return;
3382 }
3383
3384 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3385
3386 alc_write_coef_idx(codec, 0x43, 0x9004);
3387
b450b17c
HP
3388 /*depop hp during suspend*/
3389 alc_write_coef_idx(codec, 0x06, 0x2100);
3390
2af02be7
KY
3391 snd_hda_codec_write(codec, hp_pin, 0,
3392 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3393
3394 if (hp_pin_sense)
88011c09 3395 msleep(100);
2af02be7 3396
c0ca5ece
TI
3397 if (!spec->no_shutup_pins)
3398 snd_hda_codec_write(codec, hp_pin, 0,
3399 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2af02be7 3400
98b24883 3401 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2af02be7
KY
3402
3403 if (hp_pin_sense)
88011c09 3404 msleep(100);
0435b3ff 3405 alc_auto_setup_eapd(codec, false);
c0ca5ece 3406 alc_shutup_pins(codec);
2af02be7
KY
3407 alc_write_coef_idx(codec, 0x43, 0x9614);
3408}
3409
4a219ef8
KY
3410static void alc256_init(struct hda_codec *codec)
3411{
3412 struct alc_spec *spec = codec->spec;
35a39f98 3413 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3414 bool hp_pin_sense;
3415
3416 if (!hp_pin)
6447c962 3417 hp_pin = 0x21;
4a219ef8
KY
3418
3419 msleep(30);
3420
3421 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3422
3423 if (hp_pin_sense)
3424 msleep(2);
3425
3426 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
6447c962
KY
3427 if (spec->ultra_low_power) {
3428 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3429 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3430 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3431 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3432 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3433 msleep(30);
3434 }
4a219ef8
KY
3435
3436 snd_hda_codec_write(codec, hp_pin, 0,
3437 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3438
6447c962 3439 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3440 msleep(85);
3441
3442 snd_hda_codec_write(codec, hp_pin, 0,
3443 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3444
6447c962 3445 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3446 msleep(100);
3447
3448 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3449 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
88d42b2b
KY
3450 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3451 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
c4473744
TH
3452 /*
3453 * Expose headphone mic (or possibly Line In on some machines) instead
3454 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3455 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3456 * this register.
3457 */
3458 alc_write_coef_idx(codec, 0x36, 0x5757);
4a219ef8
KY
3459}
3460
3461static void alc256_shutup(struct hda_codec *codec)
3462{
3463 struct alc_spec *spec = codec->spec;
35a39f98 3464 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3465 bool hp_pin_sense;
3466
6447c962
KY
3467 if (!hp_pin)
3468 hp_pin = 0x21;
4a219ef8
KY
3469
3470 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3471
3472 if (hp_pin_sense)
3473 msleep(2);
3474
3475 snd_hda_codec_write(codec, hp_pin, 0,
3476 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3477
6447c962 3478 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3479 msleep(85);
3480
1c9609e3
TI
3481 /* 3k pull low control for Headset jack. */
3482 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3f742490
HW
3483 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3484 * when booting with headset plugged. So skip setting it for the codec alc257
3485 */
3486 if (codec->core.vendor_id != 0x10ec0257)
3487 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
1c9609e3 3488
c0ca5ece
TI
3489 if (!spec->no_shutup_pins)
3490 snd_hda_codec_write(codec, hp_pin, 0,
3491 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4a219ef8 3492
6447c962 3493 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3494 msleep(100);
3495
3496 alc_auto_setup_eapd(codec, false);
c0ca5ece 3497 alc_shutup_pins(codec);
6447c962
KY
3498 if (spec->ultra_low_power) {
3499 msleep(50);
3500 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3501 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3502 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3503 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3504 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3505 msleep(30);
3506 }
4a219ef8
KY
3507}
3508
da911b1f
KY
3509static void alc225_init(struct hda_codec *codec)
3510{
3511 struct alc_spec *spec = codec->spec;
35a39f98 3512 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3513 bool hp1_pin_sense, hp2_pin_sense;
3514
3515 if (!hp_pin)
d3ba58bb 3516 hp_pin = 0x21;
da911b1f
KY
3517 msleep(30);
3518
3519 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3520 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3521
3522 if (hp1_pin_sense || hp2_pin_sense)
3523 msleep(2);
3524
3525 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
d3ba58bb
KY
3526 if (spec->ultra_low_power) {
3527 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3528 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3529 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3530 msleep(30);
3531 }
da911b1f 3532
d3ba58bb 3533 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3534 snd_hda_codec_write(codec, hp_pin, 0,
3535 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3536 if (hp2_pin_sense)
3537 snd_hda_codec_write(codec, 0x16, 0,
3538 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3539
d3ba58bb 3540 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3541 msleep(85);
3542
d3ba58bb 3543 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3544 snd_hda_codec_write(codec, hp_pin, 0,
3545 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3546 if (hp2_pin_sense)
3547 snd_hda_codec_write(codec, 0x16, 0,
3548 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3549
d3ba58bb 3550 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3551 msleep(100);
3552
3553 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3554 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3555}
3556
3557static void alc225_shutup(struct hda_codec *codec)
3558{
3559 struct alc_spec *spec = codec->spec;
35a39f98 3560 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3561 bool hp1_pin_sense, hp2_pin_sense;
3562
d3ba58bb
KY
3563 if (!hp_pin)
3564 hp_pin = 0x21;
476c02e0
HW
3565
3566 alc_disable_headset_jack_key(codec);
da911b1f
KY
3567 /* 3k pull low control for Headset jack. */
3568 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3569
3570 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3571 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3572
3573 if (hp1_pin_sense || hp2_pin_sense)
3574 msleep(2);
3575
d3ba58bb 3576 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3577 snd_hda_codec_write(codec, hp_pin, 0,
3578 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3579 if (hp2_pin_sense)
3580 snd_hda_codec_write(codec, 0x16, 0,
3581 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3582
d3ba58bb 3583 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3584 msleep(85);
3585
d3ba58bb 3586 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3587 snd_hda_codec_write(codec, hp_pin, 0,
3588 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3589 if (hp2_pin_sense)
3590 snd_hda_codec_write(codec, 0x16, 0,
3591 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3592
d3ba58bb 3593 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3594 msleep(100);
3595
3596 alc_auto_setup_eapd(codec, false);
c0ca5ece 3597 alc_shutup_pins(codec);
d3ba58bb
KY
3598 if (spec->ultra_low_power) {
3599 msleep(50);
3600 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3601 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3602 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3603 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3604 msleep(30);
3605 }
476c02e0
HW
3606
3607 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3608 alc_enable_headset_jack_key(codec);
da911b1f
KY
3609}
3610
c2d6af53
KY
3611static void alc_default_init(struct hda_codec *codec)
3612{
3613 struct alc_spec *spec = codec->spec;
35a39f98 3614 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3615 bool hp_pin_sense;
3616
3617 if (!hp_pin)
3618 return;
3619
3620 msleep(30);
3621
3622 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3623
3624 if (hp_pin_sense)
3625 msleep(2);
3626
3627 snd_hda_codec_write(codec, hp_pin, 0,
3628 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3629
3630 if (hp_pin_sense)
3631 msleep(85);
3632
3633 snd_hda_codec_write(codec, hp_pin, 0,
3634 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3635
3636 if (hp_pin_sense)
3637 msleep(100);
3638}
3639
3640static void alc_default_shutup(struct hda_codec *codec)
3641{
3642 struct alc_spec *spec = codec->spec;
35a39f98 3643 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3644 bool hp_pin_sense;
3645
3646 if (!hp_pin) {
3647 alc269_shutup(codec);
3648 return;
3649 }
3650
3651 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3652
3653 if (hp_pin_sense)
3654 msleep(2);
3655
3656 snd_hda_codec_write(codec, hp_pin, 0,
3657 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3658
3659 if (hp_pin_sense)
3660 msleep(85);
3661
c0ca5ece
TI
3662 if (!spec->no_shutup_pins)
3663 snd_hda_codec_write(codec, hp_pin, 0,
3664 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
c2d6af53
KY
3665
3666 if (hp_pin_sense)
3667 msleep(100);
3668
3669 alc_auto_setup_eapd(codec, false);
c0ca5ece 3670 alc_shutup_pins(codec);
c2d6af53
KY
3671}
3672
693abe11
KY
3673static void alc294_hp_init(struct hda_codec *codec)
3674{
3675 struct alc_spec *spec = codec->spec;
35a39f98 3676 hda_nid_t hp_pin = alc_get_hp_pin(spec);
693abe11
KY
3677 int i, val;
3678
3679 if (!hp_pin)
3680 return;
3681
3682 snd_hda_codec_write(codec, hp_pin, 0,
3683 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3684
3685 msleep(100);
3686
c0ca5ece
TI
3687 if (!spec->no_shutup_pins)
3688 snd_hda_codec_write(codec, hp_pin, 0,
3689 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
693abe11
KY
3690
3691 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3692 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3693
3694 /* Wait for depop procedure finish */
3695 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3696 for (i = 0; i < 20 && val & 0x0080; i++) {
3697 msleep(50);
3698 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3699 }
3700 /* Set HP depop to auto mode */
3701 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3702 msleep(50);
3703}
3704
3705static void alc294_init(struct hda_codec *codec)
3706{
3707 struct alc_spec *spec = codec->spec;
3708
f6ef4e0e
TI
3709 /* required only at boot or S4 resume time */
3710 if (!spec->done_hp_init ||
3711 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
693abe11
KY
3712 alc294_hp_init(codec);
3713 spec->done_hp_init = true;
3714 }
3715 alc_default_init(codec);
3716}
3717
ad60d502
KY
3718static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3719 unsigned int val)
3720{
3721 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3722 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3723 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3724}
3725
3726static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3727{
3728 unsigned int val;
3729
3730 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3731 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3732 & 0xffff;
3733 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3734 << 16;
3735 return val;
3736}
3737
3738static void alc5505_dsp_halt(struct hda_codec *codec)
3739{
3740 unsigned int val;
3741
3742 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3743 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3744 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3745 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3746 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3747 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3748 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3749 val = alc5505_coef_get(codec, 0x6220);
3750 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3751}
3752
3753static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3754{
3755 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3756 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3757 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3758 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3759 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3760 alc5505_coef_set(codec, 0x880c, 0x00000004);
3761}
3762
3763static void alc5505_dsp_init(struct hda_codec *codec)
3764{
3765 unsigned int val;
3766
3767 alc5505_dsp_halt(codec);
3768 alc5505_dsp_back_from_halt(codec);
3769 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3770 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3771 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3772 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3773 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3774 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3775 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3776 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3777 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3778 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3779 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3780 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3781 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3782
3783 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3784 if (val <= 3)
3785 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3786 else
3787 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3788
3789 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3790 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3791 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3792 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3793 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3794 alc5505_coef_set(codec, 0x880c, 0x00000003);
3795 alc5505_coef_set(codec, 0x880c, 0x00000010);
cd63a5ff
TI
3796
3797#ifdef HALT_REALTEK_ALC5505
3798 alc5505_dsp_halt(codec);
3799#endif
ad60d502
KY
3800}
3801
cd63a5ff 3802#ifdef HALT_REALTEK_ALC5505
8a71821f
PLB
3803#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3804#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
cd63a5ff
TI
3805#else
3806#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3807#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3808#endif
3809
2a43952a 3810#ifdef CONFIG_PM
ad60d502
KY
3811static int alc269_suspend(struct hda_codec *codec)
3812{
3813 struct alc_spec *spec = codec->spec;
3814
3815 if (spec->has_alc5505_dsp)
cd63a5ff 3816 alc5505_dsp_suspend(codec);
ad60d502
KY
3817 return alc_suspend(codec);
3818}
3819
1d045db9
TI
3820static int alc269_resume(struct hda_codec *codec)
3821{
adcc70b2
KY
3822 struct alc_spec *spec = codec->spec;
3823
1387e2d1
KY
3824 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3825 alc269vb_toggle_power_output(codec, 0);
3826 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3827 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3828 msleep(150);
3829 }
8c427226 3830
1d045db9 3831 codec->patch_ops.init(codec);
f1d4e28b 3832
1387e2d1
KY
3833 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3834 alc269vb_toggle_power_output(codec, 1);
3835 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3836 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9
TI
3837 msleep(200);
3838 }
f1d4e28b 3839
1a462be5 3840 snd_hda_regmap_sync(codec);
1d045db9 3841 hda_call_check_power_status(codec, 0x01);
f475371a
HW
3842
3843 /* on some machine, the BIOS will clear the codec gpio data when enter
3844 * suspend, and won't restore the data after resume, so we restore it
3845 * in the driver.
3846 */
d261eec8
TI
3847 if (spec->gpio_data)
3848 alc_write_gpio_data(codec);
f475371a 3849
ad60d502 3850 if (spec->has_alc5505_dsp)
cd63a5ff 3851 alc5505_dsp_resume(codec);
c5177c86 3852
1d045db9
TI
3853 return 0;
3854}
2a43952a 3855#endif /* CONFIG_PM */
f1d4e28b 3856
108cc108 3857static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
1727a771 3858 const struct hda_fixup *fix, int action)
108cc108
DH
3859{
3860 struct alc_spec *spec = codec->spec;
3861
1727a771 3862 if (action == HDA_FIXUP_ACT_PRE_PROBE)
108cc108
DH
3863 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3864}
3865
fdcc968a
JMG
3866static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3867 const struct hda_fixup *fix,
3868 int action)
3869{
3870 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3871 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3872
3873 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3874 snd_hda_codec_set_pincfg(codec, 0x19,
3875 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3876 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3877}
3878
1d045db9 3879static void alc269_fixup_hweq(struct hda_codec *codec,
1727a771 3880 const struct hda_fixup *fix, int action)
1d045db9 3881{
98b24883
TI
3882 if (action == HDA_FIXUP_ACT_INIT)
3883 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
1d045db9 3884}
f1d4e28b 3885
7c478f03
DH
3886static void alc269_fixup_headset_mic(struct hda_codec *codec,
3887 const struct hda_fixup *fix, int action)
3888{
3889 struct alc_spec *spec = codec->spec;
3890
3891 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3892 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3893}
3894
1d045db9 3895static void alc271_fixup_dmic(struct hda_codec *codec,
1727a771 3896 const struct hda_fixup *fix, int action)
1d045db9
TI
3897{
3898 static const struct hda_verb verbs[] = {
3899 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3900 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3901 {}
3902 };
3903 unsigned int cfg;
f1d4e28b 3904
7639a06c
TI
3905 if (strcmp(codec->core.chip_name, "ALC271X") &&
3906 strcmp(codec->core.chip_name, "ALC269VB"))
1d045db9
TI
3907 return;
3908 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3909 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3910 snd_hda_sequence_write(codec, verbs);
3911}
f1d4e28b 3912
017f2a10 3913static void alc269_fixup_pcm_44k(struct hda_codec *codec,
1727a771 3914 const struct hda_fixup *fix, int action)
017f2a10
TI
3915{
3916 struct alc_spec *spec = codec->spec;
3917
1727a771 3918 if (action != HDA_FIXUP_ACT_PROBE)
017f2a10
TI
3919 return;
3920
3921 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3922 * fix the sample rate of analog I/O to 44.1kHz
3923 */
08c189f2
TI
3924 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3925 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
017f2a10
TI
3926}
3927
adabb3ec 3928static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
1727a771 3929 const struct hda_fixup *fix, int action)
adabb3ec 3930{
adabb3ec
TI
3931 /* The digital-mic unit sends PDM (differential signal) instead of
3932 * the standard PCM, thus you can't record a valid mono stream as is.
3933 * Below is a workaround specific to ALC269 to control the dmic
3934 * signal source as mono.
3935 */
98b24883
TI
3936 if (action == HDA_FIXUP_ACT_INIT)
3937 alc_update_coef_idx(codec, 0x07, 0, 0x80);
adabb3ec
TI
3938}
3939
24519911
TI
3940static void alc269_quanta_automute(struct hda_codec *codec)
3941{
08c189f2 3942 snd_hda_gen_update_outputs(codec);
24519911 3943
1687ccc8
TI
3944 alc_write_coef_idx(codec, 0x0c, 0x680);
3945 alc_write_coef_idx(codec, 0x0c, 0x480);
24519911
TI
3946}
3947
3948static void alc269_fixup_quanta_mute(struct hda_codec *codec,
1727a771 3949 const struct hda_fixup *fix, int action)
24519911
TI
3950{
3951 struct alc_spec *spec = codec->spec;
1727a771 3952 if (action != HDA_FIXUP_ACT_PROBE)
24519911 3953 return;
08c189f2 3954 spec->gen.automute_hook = alc269_quanta_automute;
24519911
TI
3955}
3956
d240d1dc 3957static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 3958 struct hda_jack_callback *jack)
d240d1dc
DH
3959{
3960 struct alc_spec *spec = codec->spec;
3961 int vref;
3962 msleep(200);
3963 snd_hda_gen_hp_automute(codec, jack);
3964
3965 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3966 msleep(100);
3967 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3968 vref);
3969 msleep(500);
3970 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3971 vref);
3972}
3973
a2ef03fe
TE
3974/*
3975 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
3976 */
3977struct hda_alc298_mbxinit {
3978 unsigned char value_0x23;
3979 unsigned char value_0x25;
3980};
3981
3982static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
3983 const struct hda_alc298_mbxinit *initval,
3984 bool first)
3985{
3986 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
3987 alc_write_coef_idx(codec, 0x26, 0xb000);
3988
3989 if (first)
3990 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
3991
3992 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
3993 alc_write_coef_idx(codec, 0x26, 0xf000);
3994 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
3995
3996 if (initval->value_0x23 != 0x1e)
3997 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
3998
3999 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4000 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4001}
4002
4003static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4004 const struct hda_fixup *fix,
4005 int action)
4006{
4007 /* Initialization magic */
4008 static const struct hda_alc298_mbxinit dac_init[] = {
4009 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4010 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4011 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4012 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4013 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4014 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4015 {0x2f, 0x00},
4016 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4017 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4018 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4019 {}
4020 };
4021 const struct hda_alc298_mbxinit *seq;
4022
4023 if (action != HDA_FIXUP_ACT_INIT)
4024 return;
4025
4026 /* Start */
4027 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4028 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4029 alc_write_coef_idx(codec, 0x26, 0xf000);
4030 alc_write_coef_idx(codec, 0x22, 0x31);
4031 alc_write_coef_idx(codec, 0x23, 0x0b);
4032 alc_write_coef_idx(codec, 0x25, 0x00);
4033 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4034 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4035
4036 for (seq = dac_init; seq->value_0x23; seq++)
4037 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4038}
4039
d240d1dc
DH
4040static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4041 const struct hda_fixup *fix, int action)
4042{
4043 struct alc_spec *spec = codec->spec;
4044 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4045 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4046 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4047 }
4048}
4049
766538ac
TI
4050static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4051 bool polarity, bool on)
4052{
4053 unsigned int pinval;
4054
4055 if (!pin)
4056 return;
4057 if (polarity)
4058 on = !on;
4059 pinval = snd_hda_codec_get_pin_target(codec, pin);
4060 pinval &= ~AC_PINCTL_VREFEN;
4061 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4062 /* temporarily power up/down for setting VREF */
4063 snd_hda_power_up_pm(codec);
4064 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4065 snd_hda_power_down_pm(codec);
4066}
d240d1dc 4067
08fb0d0e 4068/* update mute-LED according to the speaker mute state via mic VREF pin */
8d3d1ece
TI
4069static int vref_mute_led_set(struct led_classdev *led_cdev,
4070 enum led_brightness brightness)
6d3cd5d4 4071{
8d3d1ece 4072 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
08fb0d0e 4073 struct alc_spec *spec = codec->spec;
08fb0d0e 4074
766538ac
TI
4075 alc_update_vref_led(codec, spec->mute_led_nid,
4076 spec->mute_led_polarity, brightness);
8d3d1ece 4077 return 0;
6d3cd5d4
DH
4078}
4079
d5b6b65e
DH
4080/* Make sure the led works even in runtime suspend */
4081static unsigned int led_power_filter(struct hda_codec *codec,
4082 hda_nid_t nid,
4083 unsigned int power_state)
4084{
4085 struct alc_spec *spec = codec->spec;
4086
50dd9050
HW
4087 if (power_state != AC_PWRST_D3 || nid == 0 ||
4088 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
d5b6b65e
DH
4089 return power_state;
4090
4091 /* Set pin ctl again, it might have just been set to 0 */
4092 snd_hda_set_pin_ctl(codec, nid,
4093 snd_hda_codec_get_pin_target(codec, nid));
4094
cffd3966 4095 return snd_hda_gen_path_power_filter(codec, nid, power_state);
d5b6b65e
DH
4096}
4097
08fb0d0e
TI
4098static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4099 const struct hda_fixup *fix, int action)
6d3cd5d4
DH
4100{
4101 struct alc_spec *spec = codec->spec;
08fb0d0e
TI
4102 const struct dmi_device *dev = NULL;
4103
4104 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4105 return;
4106
4107 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4108 int pol, pin;
4109 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4110 continue;
4111 if (pin < 0x0a || pin >= 0x10)
4112 break;
4113 spec->mute_led_polarity = pol;
4114 spec->mute_led_nid = pin - 0x0a + 0x18;
8d3d1ece 4115 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4116 codec->power_filter = led_power_filter;
4e76a883
TI
4117 codec_dbg(codec,
4118 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
08fb0d0e 4119 spec->mute_led_polarity);
6d3cd5d4
DH
4120 break;
4121 }
4122}
4123
85c467dc
TI
4124static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4125 const struct hda_fixup *fix,
4126 int action, hda_nid_t pin)
d06ac143
DH
4127{
4128 struct alc_spec *spec = codec->spec;
85c467dc 4129
d06ac143
DH
4130 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4131 spec->mute_led_polarity = 0;
85c467dc 4132 spec->mute_led_nid = pin;
8d3d1ece 4133 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4134 codec->power_filter = led_power_filter;
d06ac143
DH
4135 }
4136}
4137
85c467dc
TI
4138static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4139 const struct hda_fixup *fix, int action)
4140{
4141 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4142}
4143
08fb0d0e
TI
4144static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4145 const struct hda_fixup *fix, int action)
420b0feb 4146{
85c467dc 4147 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
420b0feb
TI
4148}
4149
7f783bd5
TB
4150static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4151 const struct hda_fixup *fix, int action)
4152{
85c467dc 4153 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
7f783bd5
TB
4154}
4155
0f32fd19
TI
4156/* update LED status via GPIO */
4157static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
dbd13179 4158 int polarity, bool enabled)
9f5c6faf 4159{
dbd13179 4160 if (polarity)
0f32fd19 4161 enabled = !enabled;
d261eec8 4162 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
9f5c6faf
TI
4163}
4164
0f32fd19 4165/* turn on/off mute LED via GPIO per vmaster hook */
8d3d1ece
TI
4166static int gpio_mute_led_set(struct led_classdev *led_cdev,
4167 enum led_brightness brightness)
9f5c6faf 4168{
8d3d1ece 4169 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9f5c6faf 4170 struct alc_spec *spec = codec->spec;
9f5c6faf 4171
dbd13179 4172 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
8d3d1ece
TI
4173 spec->mute_led_polarity, !brightness);
4174 return 0;
0f32fd19 4175}
9f5c6faf 4176
0f32fd19 4177/* turn on/off mic-mute LED via GPIO per capture hook */
87dc3648
KHF
4178static int micmute_led_set(struct led_classdev *led_cdev,
4179 enum led_brightness brightness)
4180{
4181 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4182 struct alc_spec *spec = codec->spec;
4183
4184 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
40469064 4185 spec->micmute_led_polarity, !brightness);
87dc3648
KHF
4186 return 0;
4187}
4188
01e4a275
TI
4189/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4190static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4191 int action,
4192 unsigned int mute_mask,
4193 unsigned int micmute_mask)
9f5c6faf
TI
4194{
4195 struct alc_spec *spec = codec->spec;
9f5c6faf 4196
01e4a275
TI
4197 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4198
4199 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4200 return;
4201 if (mute_mask) {
4202 spec->gpio_mute_led_mask = mute_mask;
8d3d1ece 4203 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
01e4a275
TI
4204 }
4205 if (micmute_mask) {
4206 spec->gpio_mic_led_mask = micmute_mask;
7cdf8c49 4207 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
9f5c6faf
TI
4208 }
4209}
4210
01e4a275 4211static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
eaa8e5ef
KY
4212 const struct hda_fixup *fix, int action)
4213{
01e4a275
TI
4214 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4215}
eaa8e5ef 4216
f5a88b0a
KHF
4217static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4218 const struct hda_fixup *fix, int action)
4219{
3e0650ab 4220 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
f5a88b0a
KHF
4221}
4222
01e4a275
TI
4223static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4224 const struct hda_fixup *fix, int action)
4225{
4226 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
9f5c6faf
TI
4227}
4228
a0ccbc53
KY
4229static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4230 const struct hda_fixup *fix, int action)
4231{
4232 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4233}
4234
8a503555
TI
4235/* turn on/off mic-mute LED per capture hook via VREF change */
4236static int vref_micmute_led_set(struct led_classdev *led_cdev,
4237 enum led_brightness brightness)
9c5dc3bf 4238{
8a503555 4239 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9c5dc3bf 4240 struct alc_spec *spec = codec->spec;
9c5dc3bf 4241
766538ac
TI
4242 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4243 spec->micmute_led_polarity, brightness);
8a503555 4244 return 0;
9c5dc3bf
KY
4245}
4246
4247static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4248 const struct hda_fixup *fix, int action)
4249{
4250 struct alc_spec *spec = codec->spec;
9c5dc3bf 4251
01e4a275 4252 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
9c5dc3bf 4253 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
4254 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4255 * enable headphone amp
4256 */
4257 spec->gpio_mask |= 0x10;
4258 spec->gpio_dir |= 0x10;
9c5dc3bf 4259 spec->cap_mute_led_nid = 0x18;
8a503555 4260 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
50dd9050 4261 codec->power_filter = led_power_filter;
9c5dc3bf
KY
4262 }
4263}
4264
7a5255f1
DH
4265static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4266 const struct hda_fixup *fix, int action)
4267{
7a5255f1 4268 struct alc_spec *spec = codec->spec;
7a5255f1 4269
01e4a275 4270 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
7a5255f1 4271 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7a5255f1 4272 spec->cap_mute_led_nid = 0x18;
8a503555 4273 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
7a5255f1
DH
4274 codec->power_filter = led_power_filter;
4275 }
4276}
4277
766538ac
TI
4278static void alc_update_coef_led(struct hda_codec *codec,
4279 struct alc_coef_led *led,
4280 bool polarity, bool on)
4281{
4282 if (polarity)
4283 on = !on;
4284 /* temporarily power up/down for setting COEF bit */
4285 alc_update_coef_idx(codec, led->idx, led->mask,
4286 on ? led->on : led->off);
4287}
4288
431e76c3 4289/* update mute-LED according to the speaker mute state via COEF bit */
8d3d1ece
TI
4290static int coef_mute_led_set(struct led_classdev *led_cdev,
4291 enum led_brightness brightness)
431e76c3 4292{
8d3d1ece 4293 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4294 struct alc_spec *spec = codec->spec;
4295
766538ac
TI
4296 alc_update_coef_led(codec, &spec->mute_led_coef,
4297 spec->mute_led_polarity, brightness);
8d3d1ece 4298 return 0;
431e76c3
KY
4299}
4300
4301static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4302 const struct hda_fixup *fix,
4303 int action)
4304{
4305 struct alc_spec *spec = codec->spec;
4306
4307 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4308 spec->mute_led_polarity = 0;
766538ac
TI
4309 spec->mute_led_coef.idx = 0x0b;
4310 spec->mute_led_coef.mask = 1 << 3;
4311 spec->mute_led_coef.on = 1 << 3;
4312 spec->mute_led_coef.off = 0;
8d3d1ece 4313 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
431e76c3
KY
4314 }
4315}
4316
24164f43
KY
4317static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4318 const struct hda_fixup *fix,
4319 int action)
4320{
4321 struct alc_spec *spec = codec->spec;
4322
4323 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4324 spec->mute_led_polarity = 0;
766538ac
TI
4325 spec->mute_led_coef.idx = 0x34;
4326 spec->mute_led_coef.mask = 1 << 5;
4327 spec->mute_led_coef.on = 0;
4328 spec->mute_led_coef.off = 1 << 5;
8d3d1ece 4329 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
24164f43
KY
4330 }
4331}
4332
431e76c3 4333/* turn on/off mic-mute LED per capture hook by coef bit */
8a503555
TI
4334static int coef_micmute_led_set(struct led_classdev *led_cdev,
4335 enum led_brightness brightness)
431e76c3 4336{
8a503555 4337 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4338 struct alc_spec *spec = codec->spec;
4339
766538ac
TI
4340 alc_update_coef_led(codec, &spec->mic_led_coef,
4341 spec->micmute_led_polarity, brightness);
8a503555 4342 return 0;
431e76c3
KY
4343}
4344
4345static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4346 const struct hda_fixup *fix, int action)
4347{
4348 struct alc_spec *spec = codec->spec;
4349
4350 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4351 spec->mic_led_coef.idx = 0x19;
4352 spec->mic_led_coef.mask = 1 << 13;
4353 spec->mic_led_coef.on = 1 << 13;
4354 spec->mic_led_coef.off = 0;
8a503555 4355 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
431e76c3
KY
4356 }
4357}
4358
24164f43
KY
4359static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4360 const struct hda_fixup *fix, int action)
4361{
4362 struct alc_spec *spec = codec->spec;
4363
4364 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4365 spec->mic_led_coef.idx = 0x35;
4366 spec->mic_led_coef.mask = 3 << 2;
4367 spec->mic_led_coef.on = 2 << 2;
4368 spec->mic_led_coef.off = 1 << 2;
8a503555 4369 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
24164f43
KY
4370 }
4371}
4372
431e76c3
KY
4373static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4374 const struct hda_fixup *fix, int action)
4375{
4376 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4377 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4378}
4379
24164f43
KY
4380static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4381 const struct hda_fixup *fix, int action)
4382{
4383 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4384 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4385}
4386
6a30abaa 4387#if IS_REACHABLE(CONFIG_INPUT)
33f4acd3
DH
4388static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4389 struct hda_jack_callback *event)
4390{
4391 struct alc_spec *spec = codec->spec;
4392
4393 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4394 send both key on and key off event for every interrupt. */
c7b60a89 4395 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
33f4acd3 4396 input_sync(spec->kb_dev);
c7b60a89 4397 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
33f4acd3
DH
4398 input_sync(spec->kb_dev);
4399}
33f4acd3 4400
3694cb29
K
4401static int alc_register_micmute_input_device(struct hda_codec *codec)
4402{
4403 struct alc_spec *spec = codec->spec;
c7b60a89 4404 int i;
3694cb29
K
4405
4406 spec->kb_dev = input_allocate_device();
4407 if (!spec->kb_dev) {
4408 codec_err(codec, "Out of memory (input_allocate_device)\n");
4409 return -ENOMEM;
4410 }
c7b60a89
HW
4411
4412 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4413
3694cb29
K
4414 spec->kb_dev->name = "Microphone Mute Button";
4415 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
c7b60a89
HW
4416 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4417 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4418 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4419 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4420 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3694cb29
K
4421
4422 if (input_register_device(spec->kb_dev)) {
4423 codec_err(codec, "input_register_device failed\n");
4424 input_free_device(spec->kb_dev);
4425 spec->kb_dev = NULL;
4426 return -ENOMEM;
4427 }
4428
4429 return 0;
4430}
4431
01e4a275
TI
4432/* GPIO1 = set according to SKU external amp
4433 * GPIO2 = mic mute hotkey
4434 * GPIO3 = mute LED
4435 * GPIO4 = mic mute LED
4436 */
33f4acd3
DH
4437static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4438 const struct hda_fixup *fix, int action)
4439{
33f4acd3
DH
4440 struct alc_spec *spec = codec->spec;
4441
01e4a275 4442 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
33f4acd3 4443 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4444 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29 4445 if (alc_register_micmute_input_device(codec) != 0)
33f4acd3 4446 return;
33f4acd3 4447
01e4a275
TI
4448 spec->gpio_mask |= 0x06;
4449 spec->gpio_dir |= 0x02;
4450 spec->gpio_data |= 0x02;
7639a06c 4451 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
33f4acd3 4452 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
7639a06c 4453 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
33f4acd3 4454 gpio2_mic_hotkey_event);
33f4acd3
DH
4455 return;
4456 }
4457
4458 if (!spec->kb_dev)
4459 return;
4460
4461 switch (action) {
33f4acd3
DH
4462 case HDA_FIXUP_ACT_FREE:
4463 input_unregister_device(spec->kb_dev);
33f4acd3
DH
4464 spec->kb_dev = NULL;
4465 }
33f4acd3
DH
4466}
4467
01e4a275
TI
4468/* Line2 = mic mute hotkey
4469 * GPIO2 = mic mute LED
4470 */
3694cb29
K
4471static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4472 const struct hda_fixup *fix, int action)
4473{
3694cb29
K
4474 struct alc_spec *spec = codec->spec;
4475
01e4a275 4476 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
3694cb29 4477 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4478 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29
K
4479 if (alc_register_micmute_input_device(codec) != 0)
4480 return;
4481
3694cb29
K
4482 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4483 gpio2_mic_hotkey_event);
3694cb29
K
4484 return;
4485 }
4486
4487 if (!spec->kb_dev)
4488 return;
4489
4490 switch (action) {
3694cb29
K
4491 case HDA_FIXUP_ACT_FREE:
4492 input_unregister_device(spec->kb_dev);
4493 spec->kb_dev = NULL;
4494 }
4495}
c469652b
TI
4496#else /* INPUT */
4497#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4498#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4499#endif /* INPUT */
3694cb29 4500
9c5dc3bf
KY
4501static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4502 const struct hda_fixup *fix, int action)
4503{
4504 struct alc_spec *spec = codec->spec;
4505
1bce62a6 4506 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
9c5dc3bf 4507 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9c5dc3bf 4508 spec->cap_mute_led_nid = 0x18;
8a503555 4509 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
9c5dc3bf
KY
4510 }
4511}
4512
6b0f95c4 4513static const struct coef_fw alc225_pre_hsmode[] = {
5a36767a
KY
4514 UPDATE_COEF(0x4a, 1<<8, 0),
4515 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4516 UPDATE_COEF(0x63, 3<<14, 3<<14),
4517 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4518 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4519 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4520 UPDATE_COEF(0x4a, 3<<10, 0),
4521 {}
4522};
4523
73bdd597
DH
4524static void alc_headset_mode_unplugged(struct hda_codec *codec)
4525{
6b0f95c4 4526 static const struct coef_fw coef0255[] = {
717f43d8 4527 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
54db6c39
TI
4528 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4529 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4530 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4531 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4532 {}
4533 };
6b0f95c4 4534 static const struct coef_fw coef0256[] = {
e69e7e03 4535 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
717f43d8
KY
4536 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4537 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4538 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4539 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
e69e7e03
KY
4540 {}
4541 };
6b0f95c4 4542 static const struct coef_fw coef0233[] = {
54db6c39
TI
4543 WRITE_COEF(0x1b, 0x0c0b),
4544 WRITE_COEF(0x45, 0xc429),
4545 UPDATE_COEF(0x35, 0x4000, 0),
4546 WRITE_COEF(0x06, 0x2104),
4547 WRITE_COEF(0x1a, 0x0001),
4548 WRITE_COEF(0x26, 0x0004),
4549 WRITE_COEF(0x32, 0x42a3),
4550 {}
4551 };
6b0f95c4 4552 static const struct coef_fw coef0288[] = {
f3b70332
KY
4553 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4554 UPDATE_COEF(0x50, 0x2000, 0x2000),
4555 UPDATE_COEF(0x56, 0x0006, 0x0006),
4556 UPDATE_COEF(0x66, 0x0008, 0),
4557 UPDATE_COEF(0x67, 0x2000, 0),
4558 {}
4559 };
6b0f95c4 4560 static const struct coef_fw coef0298[] = {
89542936
KY
4561 UPDATE_COEF(0x19, 0x1300, 0x0300),
4562 {}
4563 };
6b0f95c4 4564 static const struct coef_fw coef0292[] = {
54db6c39
TI
4565 WRITE_COEF(0x76, 0x000e),
4566 WRITE_COEF(0x6c, 0x2400),
4567 WRITE_COEF(0x18, 0x7308),
4568 WRITE_COEF(0x6b, 0xc429),
4569 {}
4570 };
6b0f95c4 4571 static const struct coef_fw coef0293[] = {
54db6c39
TI
4572 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4573 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4574 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4575 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4576 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4577 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4578 {}
4579 };
6b0f95c4 4580 static const struct coef_fw coef0668[] = {
54db6c39
TI
4581 WRITE_COEF(0x15, 0x0d40),
4582 WRITE_COEF(0xb7, 0x802b),
4583 {}
4584 };
6b0f95c4 4585 static const struct coef_fw coef0225[] = {
5a36767a 4586 UPDATE_COEF(0x63, 3<<14, 0),
4cc9b9d6
KY
4587 {}
4588 };
6b0f95c4 4589 static const struct coef_fw coef0274[] = {
71683c32
KY
4590 UPDATE_COEF(0x4a, 0x0100, 0),
4591 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4592 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4593 UPDATE_COEF(0x4a, 0x0010, 0),
4594 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4595 WRITE_COEF(0x45, 0x5289),
4596 UPDATE_COEF(0x4a, 0x0c00, 0),
4597 {}
4598 };
54db6c39 4599
7639a06c 4600 switch (codec->core.vendor_id) {
9a22a8f5 4601 case 0x10ec0255:
e69e7e03
KY
4602 alc_process_coef_fw(codec, coef0255);
4603 break;
736f20a7 4604 case 0x10ec0236:
7081adf3 4605 case 0x10ec0256:
e69e7e03 4606 alc_process_coef_fw(codec, coef0256);
9a22a8f5 4607 break;
71683c32
KY
4608 case 0x10ec0234:
4609 case 0x10ec0274:
4610 case 0x10ec0294:
4611 alc_process_coef_fw(codec, coef0274);
4612 break;
13fd08a3 4613 case 0x10ec0233:
73bdd597 4614 case 0x10ec0283:
54db6c39 4615 alc_process_coef_fw(codec, coef0233);
73bdd597 4616 break;
f3b70332
KY
4617 case 0x10ec0286:
4618 case 0x10ec0288:
89542936
KY
4619 alc_process_coef_fw(codec, coef0288);
4620 break;
1a5bc8d9 4621 case 0x10ec0298:
89542936 4622 alc_process_coef_fw(codec, coef0298);
f3b70332
KY
4623 alc_process_coef_fw(codec, coef0288);
4624 break;
73bdd597 4625 case 0x10ec0292:
54db6c39 4626 alc_process_coef_fw(codec, coef0292);
73bdd597 4627 break;
a22aa26f 4628 case 0x10ec0293:
54db6c39 4629 alc_process_coef_fw(codec, coef0293);
a22aa26f 4630 break;
73bdd597 4631 case 0x10ec0668:
54db6c39 4632 alc_process_coef_fw(codec, coef0668);
73bdd597 4633 break;
c2b691ee 4634 case 0x10ec0215:
4cc9b9d6 4635 case 0x10ec0225:
c2b691ee 4636 case 0x10ec0285:
7d727869 4637 case 0x10ec0295:
c2b691ee 4638 case 0x10ec0289:
28f1f9b2 4639 case 0x10ec0299:
4d4b0c52 4640 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4641 alc_process_coef_fw(codec, coef0225);
4642 break;
78f4f7c2
KY
4643 case 0x10ec0867:
4644 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4645 break;
73bdd597 4646 }
4e76a883 4647 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
73bdd597
DH
4648}
4649
4650
4651static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4652 hda_nid_t mic_pin)
4653{
6b0f95c4 4654 static const struct coef_fw coef0255[] = {
54db6c39
TI
4655 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4656 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4657 {}
4658 };
6b0f95c4 4659 static const struct coef_fw coef0256[] = {
717f43d8
KY
4660 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4661 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4662 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4663 {}
4664 };
6b0f95c4 4665 static const struct coef_fw coef0233[] = {
54db6c39
TI
4666 UPDATE_COEF(0x35, 0, 1<<14),
4667 WRITE_COEF(0x06, 0x2100),
4668 WRITE_COEF(0x1a, 0x0021),
4669 WRITE_COEF(0x26, 0x008c),
4670 {}
4671 };
6b0f95c4 4672 static const struct coef_fw coef0288[] = {
89542936 4673 UPDATE_COEF(0x4f, 0x00c0, 0),
f3b70332
KY
4674 UPDATE_COEF(0x50, 0x2000, 0),
4675 UPDATE_COEF(0x56, 0x0006, 0),
4676 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4677 UPDATE_COEF(0x66, 0x0008, 0x0008),
4678 UPDATE_COEF(0x67, 0x2000, 0x2000),
4679 {}
4680 };
6b0f95c4 4681 static const struct coef_fw coef0292[] = {
54db6c39
TI
4682 WRITE_COEF(0x19, 0xa208),
4683 WRITE_COEF(0x2e, 0xacf0),
4684 {}
4685 };
6b0f95c4 4686 static const struct coef_fw coef0293[] = {
54db6c39
TI
4687 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4688 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4689 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4690 {}
4691 };
6b0f95c4 4692 static const struct coef_fw coef0688[] = {
54db6c39
TI
4693 WRITE_COEF(0xb7, 0x802b),
4694 WRITE_COEF(0xb5, 0x1040),
4695 UPDATE_COEF(0xc3, 0, 1<<12),
4696 {}
4697 };
6b0f95c4 4698 static const struct coef_fw coef0225[] = {
4cc9b9d6
KY
4699 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4700 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4701 UPDATE_COEF(0x63, 3<<14, 0),
4702 {}
4703 };
6b0f95c4 4704 static const struct coef_fw coef0274[] = {
71683c32
KY
4705 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4706 UPDATE_COEF(0x4a, 0x0010, 0),
4707 UPDATE_COEF(0x6b, 0xf000, 0),
4708 {}
4709 };
54db6c39 4710
7639a06c 4711 switch (codec->core.vendor_id) {
9a22a8f5
KY
4712 case 0x10ec0255:
4713 alc_write_coef_idx(codec, 0x45, 0xc489);
4714 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4715 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
4716 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4717 break;
717f43d8
KY
4718 case 0x10ec0236:
4719 case 0x10ec0256:
4720 alc_write_coef_idx(codec, 0x45, 0xc489);
4721 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4722 alc_process_coef_fw(codec, coef0256);
4723 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4724 break;
71683c32
KY
4725 case 0x10ec0234:
4726 case 0x10ec0274:
4727 case 0x10ec0294:
4728 alc_write_coef_idx(codec, 0x45, 0x4689);
4729 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4730 alc_process_coef_fw(codec, coef0274);
4731 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4732 break;
13fd08a3 4733 case 0x10ec0233:
73bdd597
DH
4734 case 0x10ec0283:
4735 alc_write_coef_idx(codec, 0x45, 0xc429);
4736 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4737 alc_process_coef_fw(codec, coef0233);
73bdd597
DH
4738 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4739 break;
f3b70332
KY
4740 case 0x10ec0286:
4741 case 0x10ec0288:
1a5bc8d9 4742 case 0x10ec0298:
f3b70332
KY
4743 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4744 alc_process_coef_fw(codec, coef0288);
4745 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4746 break;
73bdd597
DH
4747 case 0x10ec0292:
4748 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4749 alc_process_coef_fw(codec, coef0292);
73bdd597 4750 break;
a22aa26f
KY
4751 case 0x10ec0293:
4752 /* Set to TRS mode */
4753 alc_write_coef_idx(codec, 0x45, 0xc429);
4754 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4755 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
4756 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4757 break;
78f4f7c2
KY
4758 case 0x10ec0867:
4759 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
c0dbbdad 4760 fallthrough;
9eb5d0e6 4761 case 0x10ec0221:
1f8b46cd
DH
4762 case 0x10ec0662:
4763 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4764 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4765 break;
73bdd597
DH
4766 case 0x10ec0668:
4767 alc_write_coef_idx(codec, 0x11, 0x0001);
4768 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4769 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
4770 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4771 break;
c2b691ee 4772 case 0x10ec0215:
4cc9b9d6 4773 case 0x10ec0225:
c2b691ee 4774 case 0x10ec0285:
7d727869 4775 case 0x10ec0295:
c2b691ee 4776 case 0x10ec0289:
28f1f9b2 4777 case 0x10ec0299:
5a36767a 4778 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4779 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4780 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4781 alc_process_coef_fw(codec, coef0225);
4782 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4783 break;
73bdd597 4784 }
4e76a883 4785 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
73bdd597
DH
4786}
4787
4788static void alc_headset_mode_default(struct hda_codec *codec)
4789{
6b0f95c4 4790 static const struct coef_fw coef0225[] = {
5a36767a
KY
4791 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4792 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4793 UPDATE_COEF(0x49, 3<<8, 0<<8),
4794 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4795 UPDATE_COEF(0x63, 3<<14, 0),
4796 UPDATE_COEF(0x67, 0xf000, 0x3000),
2ae95577
DH
4797 {}
4798 };
6b0f95c4 4799 static const struct coef_fw coef0255[] = {
54db6c39
TI
4800 WRITE_COEF(0x45, 0xc089),
4801 WRITE_COEF(0x45, 0xc489),
4802 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4803 WRITE_COEF(0x49, 0x0049),
4804 {}
4805 };
6b0f95c4 4806 static const struct coef_fw coef0256[] = {
717f43d8
KY
4807 WRITE_COEF(0x45, 0xc489),
4808 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4809 WRITE_COEF(0x49, 0x0049),
4810 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4811 WRITE_COEF(0x06, 0x6100),
4812 {}
4813 };
6b0f95c4 4814 static const struct coef_fw coef0233[] = {
54db6c39
TI
4815 WRITE_COEF(0x06, 0x2100),
4816 WRITE_COEF(0x32, 0x4ea3),
4817 {}
4818 };
6b0f95c4 4819 static const struct coef_fw coef0288[] = {
f3b70332
KY
4820 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4821 UPDATE_COEF(0x50, 0x2000, 0x2000),
4822 UPDATE_COEF(0x56, 0x0006, 0x0006),
4823 UPDATE_COEF(0x66, 0x0008, 0),
4824 UPDATE_COEF(0x67, 0x2000, 0),
4825 {}
4826 };
6b0f95c4 4827 static const struct coef_fw coef0292[] = {
54db6c39
TI
4828 WRITE_COEF(0x76, 0x000e),
4829 WRITE_COEF(0x6c, 0x2400),
4830 WRITE_COEF(0x6b, 0xc429),
4831 WRITE_COEF(0x18, 0x7308),
4832 {}
4833 };
6b0f95c4 4834 static const struct coef_fw coef0293[] = {
54db6c39
TI
4835 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4836 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4837 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4838 {}
4839 };
6b0f95c4 4840 static const struct coef_fw coef0688[] = {
54db6c39
TI
4841 WRITE_COEF(0x11, 0x0041),
4842 WRITE_COEF(0x15, 0x0d40),
4843 WRITE_COEF(0xb7, 0x802b),
4844 {}
4845 };
6b0f95c4 4846 static const struct coef_fw coef0274[] = {
71683c32
KY
4847 WRITE_COEF(0x45, 0x4289),
4848 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4849 UPDATE_COEF(0x6b, 0x0f00, 0),
4850 UPDATE_COEF(0x49, 0x0300, 0x0300),
4851 {}
4852 };
54db6c39 4853
7639a06c 4854 switch (codec->core.vendor_id) {
c2b691ee 4855 case 0x10ec0215:
2ae95577 4856 case 0x10ec0225:
c2b691ee 4857 case 0x10ec0285:
7d727869 4858 case 0x10ec0295:
c2b691ee 4859 case 0x10ec0289:
28f1f9b2 4860 case 0x10ec0299:
5a36767a 4861 alc_process_coef_fw(codec, alc225_pre_hsmode);
2ae95577
DH
4862 alc_process_coef_fw(codec, coef0225);
4863 break;
9a22a8f5 4864 case 0x10ec0255:
54db6c39 4865 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4866 break;
717f43d8
KY
4867 case 0x10ec0236:
4868 case 0x10ec0256:
4869 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4870 alc_write_coef_idx(codec, 0x45, 0xc089);
4871 msleep(50);
4872 alc_process_coef_fw(codec, coef0256);
4873 break;
71683c32
KY
4874 case 0x10ec0234:
4875 case 0x10ec0274:
4876 case 0x10ec0294:
4877 alc_process_coef_fw(codec, coef0274);
4878 break;
13fd08a3 4879 case 0x10ec0233:
73bdd597 4880 case 0x10ec0283:
54db6c39 4881 alc_process_coef_fw(codec, coef0233);
73bdd597 4882 break;
f3b70332
KY
4883 case 0x10ec0286:
4884 case 0x10ec0288:
1a5bc8d9 4885 case 0x10ec0298:
f3b70332
KY
4886 alc_process_coef_fw(codec, coef0288);
4887 break;
73bdd597 4888 case 0x10ec0292:
54db6c39 4889 alc_process_coef_fw(codec, coef0292);
73bdd597 4890 break;
a22aa26f 4891 case 0x10ec0293:
54db6c39 4892 alc_process_coef_fw(codec, coef0293);
a22aa26f 4893 break;
73bdd597 4894 case 0x10ec0668:
54db6c39 4895 alc_process_coef_fw(codec, coef0688);
73bdd597 4896 break;
78f4f7c2
KY
4897 case 0x10ec0867:
4898 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4899 break;
73bdd597 4900 }
4e76a883 4901 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
73bdd597
DH
4902}
4903
4904/* Iphone type */
4905static void alc_headset_mode_ctia(struct hda_codec *codec)
4906{
89542936
KY
4907 int val;
4908
6b0f95c4 4909 static const struct coef_fw coef0255[] = {
54db6c39
TI
4910 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4911 WRITE_COEF(0x1b, 0x0c2b),
4912 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4913 {}
4914 };
6b0f95c4 4915 static const struct coef_fw coef0256[] = {
e69e7e03 4916 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
717f43d8 4917 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
4918 {}
4919 };
6b0f95c4 4920 static const struct coef_fw coef0233[] = {
54db6c39
TI
4921 WRITE_COEF(0x45, 0xd429),
4922 WRITE_COEF(0x1b, 0x0c2b),
4923 WRITE_COEF(0x32, 0x4ea3),
4924 {}
4925 };
6b0f95c4 4926 static const struct coef_fw coef0288[] = {
f3b70332
KY
4927 UPDATE_COEF(0x50, 0x2000, 0x2000),
4928 UPDATE_COEF(0x56, 0x0006, 0x0006),
4929 UPDATE_COEF(0x66, 0x0008, 0),
4930 UPDATE_COEF(0x67, 0x2000, 0),
4931 {}
4932 };
6b0f95c4 4933 static const struct coef_fw coef0292[] = {
54db6c39
TI
4934 WRITE_COEF(0x6b, 0xd429),
4935 WRITE_COEF(0x76, 0x0008),
4936 WRITE_COEF(0x18, 0x7388),
4937 {}
4938 };
6b0f95c4 4939 static const struct coef_fw coef0293[] = {
54db6c39
TI
4940 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4941 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4942 {}
4943 };
6b0f95c4 4944 static const struct coef_fw coef0688[] = {
54db6c39
TI
4945 WRITE_COEF(0x11, 0x0001),
4946 WRITE_COEF(0x15, 0x0d60),
4947 WRITE_COEF(0xc3, 0x0000),
4948 {}
4949 };
6b0f95c4 4950 static const struct coef_fw coef0225_1[] = {
4cc9b9d6 4951 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5a36767a
KY
4952 UPDATE_COEF(0x63, 3<<14, 2<<14),
4953 {}
4954 };
6b0f95c4 4955 static const struct coef_fw coef0225_2[] = {
5a36767a
KY
4956 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4957 UPDATE_COEF(0x63, 3<<14, 1<<14),
4cc9b9d6
KY
4958 {}
4959 };
54db6c39 4960
7639a06c 4961 switch (codec->core.vendor_id) {
9a22a8f5 4962 case 0x10ec0255:
54db6c39 4963 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4964 break;
736f20a7 4965 case 0x10ec0236:
e69e7e03
KY
4966 case 0x10ec0256:
4967 alc_process_coef_fw(codec, coef0256);
4968 break;
71683c32
KY
4969 case 0x10ec0234:
4970 case 0x10ec0274:
4971 case 0x10ec0294:
4972 alc_write_coef_idx(codec, 0x45, 0xd689);
4973 break;
13fd08a3 4974 case 0x10ec0233:
73bdd597 4975 case 0x10ec0283:
54db6c39 4976 alc_process_coef_fw(codec, coef0233);
73bdd597 4977 break;
1a5bc8d9 4978 case 0x10ec0298:
89542936
KY
4979 val = alc_read_coef_idx(codec, 0x50);
4980 if (val & (1 << 12)) {
4981 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4982 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4983 msleep(300);
4984 } else {
4985 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4986 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4987 msleep(300);
4988 }
4989 break;
f3b70332
KY
4990 case 0x10ec0286:
4991 case 0x10ec0288:
4992 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4993 msleep(300);
4994 alc_process_coef_fw(codec, coef0288);
4995 break;
73bdd597 4996 case 0x10ec0292:
54db6c39 4997 alc_process_coef_fw(codec, coef0292);
73bdd597 4998 break;
a22aa26f 4999 case 0x10ec0293:
54db6c39 5000 alc_process_coef_fw(codec, coef0293);
a22aa26f 5001 break;
73bdd597 5002 case 0x10ec0668:
54db6c39 5003 alc_process_coef_fw(codec, coef0688);
73bdd597 5004 break;
c2b691ee 5005 case 0x10ec0215:
4cc9b9d6 5006 case 0x10ec0225:
c2b691ee 5007 case 0x10ec0285:
7d727869 5008 case 0x10ec0295:
c2b691ee 5009 case 0x10ec0289:
28f1f9b2 5010 case 0x10ec0299:
5a36767a
KY
5011 val = alc_read_coef_idx(codec, 0x45);
5012 if (val & (1 << 9))
5013 alc_process_coef_fw(codec, coef0225_2);
5014 else
5015 alc_process_coef_fw(codec, coef0225_1);
4cc9b9d6 5016 break;
78f4f7c2
KY
5017 case 0x10ec0867:
5018 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5019 break;
73bdd597 5020 }
4e76a883 5021 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
73bdd597
DH
5022}
5023
5024/* Nokia type */
5025static void alc_headset_mode_omtp(struct hda_codec *codec)
5026{
6b0f95c4 5027 static const struct coef_fw coef0255[] = {
54db6c39
TI
5028 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5029 WRITE_COEF(0x1b, 0x0c2b),
5030 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5031 {}
5032 };
6b0f95c4 5033 static const struct coef_fw coef0256[] = {
e69e7e03 5034 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
717f43d8 5035 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5036 {}
5037 };
6b0f95c4 5038 static const struct coef_fw coef0233[] = {
54db6c39
TI
5039 WRITE_COEF(0x45, 0xe429),
5040 WRITE_COEF(0x1b, 0x0c2b),
5041 WRITE_COEF(0x32, 0x4ea3),
5042 {}
5043 };
6b0f95c4 5044 static const struct coef_fw coef0288[] = {
f3b70332
KY
5045 UPDATE_COEF(0x50, 0x2000, 0x2000),
5046 UPDATE_COEF(0x56, 0x0006, 0x0006),
5047 UPDATE_COEF(0x66, 0x0008, 0),
5048 UPDATE_COEF(0x67, 0x2000, 0),
5049 {}
5050 };
6b0f95c4 5051 static const struct coef_fw coef0292[] = {
54db6c39
TI
5052 WRITE_COEF(0x6b, 0xe429),
5053 WRITE_COEF(0x76, 0x0008),
5054 WRITE_COEF(0x18, 0x7388),
5055 {}
5056 };
6b0f95c4 5057 static const struct coef_fw coef0293[] = {
54db6c39
TI
5058 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5059 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5060 {}
5061 };
6b0f95c4 5062 static const struct coef_fw coef0688[] = {
54db6c39
TI
5063 WRITE_COEF(0x11, 0x0001),
5064 WRITE_COEF(0x15, 0x0d50),
5065 WRITE_COEF(0xc3, 0x0000),
5066 {}
5067 };
6b0f95c4 5068 static const struct coef_fw coef0225[] = {
4cc9b9d6 5069 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5a36767a 5070 UPDATE_COEF(0x63, 3<<14, 2<<14),
4cc9b9d6
KY
5071 {}
5072 };
54db6c39 5073
7639a06c 5074 switch (codec->core.vendor_id) {
9a22a8f5 5075 case 0x10ec0255:
54db6c39 5076 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5077 break;
736f20a7 5078 case 0x10ec0236:
e69e7e03
KY
5079 case 0x10ec0256:
5080 alc_process_coef_fw(codec, coef0256);
5081 break;
71683c32
KY
5082 case 0x10ec0234:
5083 case 0x10ec0274:
5084 case 0x10ec0294:
5085 alc_write_coef_idx(codec, 0x45, 0xe689);
5086 break;
13fd08a3 5087 case 0x10ec0233:
73bdd597 5088 case 0x10ec0283:
54db6c39 5089 alc_process_coef_fw(codec, coef0233);
73bdd597 5090 break;
1a5bc8d9
KY
5091 case 0x10ec0298:
5092 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
89542936
KY
5093 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5094 msleep(300);
5095 break;
f3b70332
KY
5096 case 0x10ec0286:
5097 case 0x10ec0288:
5098 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5099 msleep(300);
5100 alc_process_coef_fw(codec, coef0288);
5101 break;
73bdd597 5102 case 0x10ec0292:
54db6c39 5103 alc_process_coef_fw(codec, coef0292);
73bdd597 5104 break;
a22aa26f 5105 case 0x10ec0293:
54db6c39 5106 alc_process_coef_fw(codec, coef0293);
a22aa26f 5107 break;
73bdd597 5108 case 0x10ec0668:
54db6c39 5109 alc_process_coef_fw(codec, coef0688);
73bdd597 5110 break;
c2b691ee 5111 case 0x10ec0215:
4cc9b9d6 5112 case 0x10ec0225:
c2b691ee 5113 case 0x10ec0285:
7d727869 5114 case 0x10ec0295:
c2b691ee 5115 case 0x10ec0289:
28f1f9b2 5116 case 0x10ec0299:
4cc9b9d6
KY
5117 alc_process_coef_fw(codec, coef0225);
5118 break;
73bdd597 5119 }
4e76a883 5120 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
73bdd597
DH
5121}
5122
5123static void alc_determine_headset_type(struct hda_codec *codec)
5124{
5125 int val;
5126 bool is_ctia = false;
5127 struct alc_spec *spec = codec->spec;
6b0f95c4 5128 static const struct coef_fw coef0255[] = {
54db6c39
TI
5129 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5130 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5131 conteol) */
5132 {}
5133 };
6b0f95c4 5134 static const struct coef_fw coef0288[] = {
f3b70332
KY
5135 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5136 {}
5137 };
6b0f95c4 5138 static const struct coef_fw coef0298[] = {
89542936
KY
5139 UPDATE_COEF(0x50, 0x2000, 0x2000),
5140 UPDATE_COEF(0x56, 0x0006, 0x0006),
5141 UPDATE_COEF(0x66, 0x0008, 0),
5142 UPDATE_COEF(0x67, 0x2000, 0),
5143 UPDATE_COEF(0x19, 0x1300, 0x1300),
5144 {}
5145 };
6b0f95c4 5146 static const struct coef_fw coef0293[] = {
54db6c39
TI
5147 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5148 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5149 {}
5150 };
6b0f95c4 5151 static const struct coef_fw coef0688[] = {
54db6c39
TI
5152 WRITE_COEF(0x11, 0x0001),
5153 WRITE_COEF(0xb7, 0x802b),
5154 WRITE_COEF(0x15, 0x0d60),
5155 WRITE_COEF(0xc3, 0x0c00),
5156 {}
5157 };
6b0f95c4 5158 static const struct coef_fw coef0274[] = {
71683c32
KY
5159 UPDATE_COEF(0x4a, 0x0010, 0),
5160 UPDATE_COEF(0x4a, 0x8000, 0),
5161 WRITE_COEF(0x45, 0xd289),
5162 UPDATE_COEF(0x49, 0x0300, 0x0300),
5163 {}
5164 };
73bdd597 5165
7639a06c 5166 switch (codec->core.vendor_id) {
9a22a8f5 5167 case 0x10ec0255:
717f43d8
KY
5168 alc_process_coef_fw(codec, coef0255);
5169 msleep(300);
5170 val = alc_read_coef_idx(codec, 0x46);
5171 is_ctia = (val & 0x0070) == 0x0070;
5172 break;
5173 case 0x10ec0236:
7081adf3 5174 case 0x10ec0256:
717f43d8
KY
5175 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5176 alc_write_coef_idx(codec, 0x06, 0x6104);
5177 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5178
5179 snd_hda_codec_write(codec, 0x21, 0,
5180 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5181 msleep(80);
5182 snd_hda_codec_write(codec, 0x21, 0,
5183 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5184
54db6c39 5185 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
5186 msleep(300);
5187 val = alc_read_coef_idx(codec, 0x46);
5188 is_ctia = (val & 0x0070) == 0x0070;
717f43d8
KY
5189
5190 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5191 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5192
5193 snd_hda_codec_write(codec, 0x21, 0,
5194 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5195 msleep(80);
5196 snd_hda_codec_write(codec, 0x21, 0,
5197 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
9a22a8f5 5198 break;
71683c32
KY
5199 case 0x10ec0234:
5200 case 0x10ec0274:
5201 case 0x10ec0294:
5202 alc_process_coef_fw(codec, coef0274);
5203 msleep(80);
5204 val = alc_read_coef_idx(codec, 0x46);
5205 is_ctia = (val & 0x00f0) == 0x00f0;
5206 break;
13fd08a3 5207 case 0x10ec0233:
73bdd597
DH
5208 case 0x10ec0283:
5209 alc_write_coef_idx(codec, 0x45, 0xd029);
5210 msleep(300);
5211 val = alc_read_coef_idx(codec, 0x46);
5212 is_ctia = (val & 0x0070) == 0x0070;
5213 break;
1a5bc8d9 5214 case 0x10ec0298:
89542936
KY
5215 snd_hda_codec_write(codec, 0x21, 0,
5216 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5217 msleep(100);
5218 snd_hda_codec_write(codec, 0x21, 0,
5219 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5220 msleep(200);
5221
5222 val = alc_read_coef_idx(codec, 0x50);
5223 if (val & (1 << 12)) {
5224 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5225 alc_process_coef_fw(codec, coef0288);
5226 msleep(350);
5227 val = alc_read_coef_idx(codec, 0x50);
5228 is_ctia = (val & 0x0070) == 0x0070;
5229 } else {
5230 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5231 alc_process_coef_fw(codec, coef0288);
5232 msleep(350);
5233 val = alc_read_coef_idx(codec, 0x50);
5234 is_ctia = (val & 0x0070) == 0x0070;
5235 }
5236 alc_process_coef_fw(codec, coef0298);
5237 snd_hda_codec_write(codec, 0x21, 0,
5238 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5239 msleep(75);
5240 snd_hda_codec_write(codec, 0x21, 0,
5241 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5242 break;
f3b70332
KY
5243 case 0x10ec0286:
5244 case 0x10ec0288:
5245 alc_process_coef_fw(codec, coef0288);
5246 msleep(350);
5247 val = alc_read_coef_idx(codec, 0x50);
5248 is_ctia = (val & 0x0070) == 0x0070;
5249 break;
73bdd597
DH
5250 case 0x10ec0292:
5251 alc_write_coef_idx(codec, 0x6b, 0xd429);
5252 msleep(300);
5253 val = alc_read_coef_idx(codec, 0x6c);
5254 is_ctia = (val & 0x001c) == 0x001c;
5255 break;
a22aa26f 5256 case 0x10ec0293:
54db6c39 5257 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5258 msleep(300);
5259 val = alc_read_coef_idx(codec, 0x46);
5260 is_ctia = (val & 0x0070) == 0x0070;
5261 break;
73bdd597 5262 case 0x10ec0668:
54db6c39 5263 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5264 msleep(300);
5265 val = alc_read_coef_idx(codec, 0xbe);
5266 is_ctia = (val & 0x1c02) == 0x1c02;
5267 break;
c2b691ee 5268 case 0x10ec0215:
4cc9b9d6 5269 case 0x10ec0225:
c2b691ee 5270 case 0x10ec0285:
7d727869 5271 case 0x10ec0295:
c2b691ee 5272 case 0x10ec0289:
28f1f9b2 5273 case 0x10ec0299:
da911b1f
KY
5274 snd_hda_codec_write(codec, 0x21, 0,
5275 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5276 msleep(80);
5277 snd_hda_codec_write(codec, 0x21, 0,
5278 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5279
5a36767a
KY
5280 alc_process_coef_fw(codec, alc225_pre_hsmode);
5281 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5282 val = alc_read_coef_idx(codec, 0x45);
5283 if (val & (1 << 9)) {
5284 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5285 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5286 msleep(800);
5287 val = alc_read_coef_idx(codec, 0x46);
5288 is_ctia = (val & 0x00f0) == 0x00f0;
5289 } else {
5290 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5291 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5292 msleep(800);
5293 val = alc_read_coef_idx(codec, 0x46);
5294 is_ctia = (val & 0x00f0) == 0x00f0;
5295 }
5296 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5297 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5298 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
da911b1f
KY
5299
5300 snd_hda_codec_write(codec, 0x21, 0,
5301 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5302 msleep(80);
5303 snd_hda_codec_write(codec, 0x21, 0,
5304 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4cc9b9d6 5305 break;
78f4f7c2
KY
5306 case 0x10ec0867:
5307 is_ctia = true;
5308 break;
73bdd597
DH
5309 }
5310
4e76a883 5311 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
73bdd597
DH
5312 is_ctia ? "yes" : "no");
5313 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5314}
5315
5316static void alc_update_headset_mode(struct hda_codec *codec)
5317{
5318 struct alc_spec *spec = codec->spec;
5319
5320 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
35a39f98 5321 hda_nid_t hp_pin = alc_get_hp_pin(spec);
73bdd597
DH
5322
5323 int new_headset_mode;
5324
5325 if (!snd_hda_jack_detect(codec, hp_pin))
5326 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5327 else if (mux_pin == spec->headset_mic_pin)
5328 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5329 else if (mux_pin == spec->headphone_mic_pin)
5330 new_headset_mode = ALC_HEADSET_MODE_MIC;
5331 else
5332 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5333
5959a6bc
DH
5334 if (new_headset_mode == spec->current_headset_mode) {
5335 snd_hda_gen_update_outputs(codec);
73bdd597 5336 return;
5959a6bc 5337 }
73bdd597
DH
5338
5339 switch (new_headset_mode) {
5340 case ALC_HEADSET_MODE_UNPLUGGED:
5341 alc_headset_mode_unplugged(codec);
aeac1a0d
KY
5342 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5343 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
73bdd597
DH
5344 spec->gen.hp_jack_present = false;
5345 break;
5346 case ALC_HEADSET_MODE_HEADSET:
5347 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5348 alc_determine_headset_type(codec);
5349 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5350 alc_headset_mode_ctia(codec);
5351 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5352 alc_headset_mode_omtp(codec);
5353 spec->gen.hp_jack_present = true;
5354 break;
5355 case ALC_HEADSET_MODE_MIC:
5356 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5357 spec->gen.hp_jack_present = false;
5358 break;
5359 case ALC_HEADSET_MODE_HEADPHONE:
5360 alc_headset_mode_default(codec);
5361 spec->gen.hp_jack_present = true;
5362 break;
5363 }
5364 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5365 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5366 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
1f8b46cd 5367 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
73bdd597
DH
5368 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5369 PIN_VREFHIZ);
5370 }
5371 spec->current_headset_mode = new_headset_mode;
5372
5373 snd_hda_gen_update_outputs(codec);
5374}
5375
5376static void alc_update_headset_mode_hook(struct hda_codec *codec,
7fe30711
TI
5377 struct snd_kcontrol *kcontrol,
5378 struct snd_ctl_elem_value *ucontrol)
73bdd597
DH
5379{
5380 alc_update_headset_mode(codec);
5381}
5382
1a4f69d5
TI
5383static void alc_update_headset_jack_cb(struct hda_codec *codec,
5384 struct hda_jack_callback *jack)
73bdd597 5385{
73bdd597
DH
5386 snd_hda_gen_hp_automute(codec, jack);
5387}
5388
5389static void alc_probe_headset_mode(struct hda_codec *codec)
5390{
5391 int i;
5392 struct alc_spec *spec = codec->spec;
5393 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5394
5395 /* Find mic pins */
5396 for (i = 0; i < cfg->num_inputs; i++) {
5397 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5398 spec->headset_mic_pin = cfg->inputs[i].pin;
5399 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5400 spec->headphone_mic_pin = cfg->inputs[i].pin;
5401 }
5402
0bed2aa3 5403 WARN_ON(spec->gen.cap_sync_hook);
73bdd597
DH
5404 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5405 spec->gen.automute_hook = alc_update_headset_mode;
5406 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5407}
5408
5409static void alc_fixup_headset_mode(struct hda_codec *codec,
5410 const struct hda_fixup *fix, int action)
5411{
5412 struct alc_spec *spec = codec->spec;
5413
5414 switch (action) {
5415 case HDA_FIXUP_ACT_PRE_PROBE:
5416 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5417 break;
5418 case HDA_FIXUP_ACT_PROBE:
5419 alc_probe_headset_mode(codec);
5420 break;
5421 case HDA_FIXUP_ACT_INIT:
aeac1a0d
KY
5422 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5423 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5424 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5425 }
73bdd597
DH
5426 alc_update_headset_mode(codec);
5427 break;
5428 }
5429}
5430
5431static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5432 const struct hda_fixup *fix, int action)
5433{
5434 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5435 struct alc_spec *spec = codec->spec;
5436 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5437 }
5438 else
5439 alc_fixup_headset_mode(codec, fix, action);
5440}
5441
31278997
KY
5442static void alc255_set_default_jack_type(struct hda_codec *codec)
5443{
5444 /* Set to iphone type */
6b0f95c4 5445 static const struct coef_fw alc255fw[] = {
54db6c39
TI
5446 WRITE_COEF(0x1b, 0x880b),
5447 WRITE_COEF(0x45, 0xd089),
5448 WRITE_COEF(0x1b, 0x080b),
5449 WRITE_COEF(0x46, 0x0004),
5450 WRITE_COEF(0x1b, 0x0c0b),
5451 {}
5452 };
6b0f95c4 5453 static const struct coef_fw alc256fw[] = {
e69e7e03
KY
5454 WRITE_COEF(0x1b, 0x884b),
5455 WRITE_COEF(0x45, 0xd089),
5456 WRITE_COEF(0x1b, 0x084b),
5457 WRITE_COEF(0x46, 0x0004),
5458 WRITE_COEF(0x1b, 0x0c4b),
5459 {}
5460 };
5461 switch (codec->core.vendor_id) {
5462 case 0x10ec0255:
5463 alc_process_coef_fw(codec, alc255fw);
5464 break;
736f20a7 5465 case 0x10ec0236:
e69e7e03
KY
5466 case 0x10ec0256:
5467 alc_process_coef_fw(codec, alc256fw);
5468 break;
5469 }
31278997
KY
5470 msleep(30);
5471}
5472
9a22a8f5
KY
5473static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5474 const struct hda_fixup *fix, int action)
5475{
5476 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
31278997 5477 alc255_set_default_jack_type(codec);
9a22a8f5
KY
5478 }
5479 alc_fixup_headset_mode(codec, fix, action);
5480}
5481
31278997
KY
5482static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5483 const struct hda_fixup *fix, int action)
5484{
5485 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5486 struct alc_spec *spec = codec->spec;
5487 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5488 alc255_set_default_jack_type(codec);
5489 }
5490 else
5491 alc_fixup_headset_mode(codec, fix, action);
5492}
5493
e1e62b98
KY
5494static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5495 struct hda_jack_callback *jack)
5496{
5497 struct alc_spec *spec = codec->spec;
e1e62b98
KY
5498
5499 alc_update_headset_jack_cb(codec, jack);
5500 /* Headset Mic enable or disable, only for Dell Dino */
d44a6864 5501 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
e1e62b98
KY
5502}
5503
5504static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5505 const struct hda_fixup *fix, int action)
5506{
5507 alc_fixup_headset_mode(codec, fix, action);
5508 if (action == HDA_FIXUP_ACT_PROBE) {
5509 struct alc_spec *spec = codec->spec;
d44a6864
TI
5510 /* toggled via hp_automute_hook */
5511 spec->gpio_mask |= 0x40;
5512 spec->gpio_dir |= 0x40;
e1e62b98
KY
5513 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5514 }
5515}
5516
493a52a9
HW
5517static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5518 const struct hda_fixup *fix, int action)
5519{
5520 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5521 struct alc_spec *spec = codec->spec;
5522 spec->gen.auto_mute_via_amp = 1;
5523 }
5524}
5525
9b745ab8
TI
5526static void alc_fixup_no_shutup(struct hda_codec *codec,
5527 const struct hda_fixup *fix, int action)
5528{
efe55732 5529 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9b745ab8 5530 struct alc_spec *spec = codec->spec;
c0ca5ece 5531 spec->no_shutup_pins = 1;
9b745ab8
TI
5532 }
5533}
5534
5e6db669
GM
5535static void alc_fixup_disable_aamix(struct hda_codec *codec,
5536 const struct hda_fixup *fix, int action)
5537{
5538 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5539 struct alc_spec *spec = codec->spec;
5540 /* Disable AA-loopback as it causes white noise */
5541 spec->gen.mixer_nid = 0;
5542 }
5543}
5544
7f57d803
TI
5545/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5546static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5547 const struct hda_fixup *fix, int action)
5548{
5549 static const struct hda_pintbl pincfgs[] = {
5550 { 0x16, 0x21211010 }, /* dock headphone */
5551 { 0x19, 0x21a11010 }, /* dock mic */
5552 { }
5553 };
5554 struct alc_spec *spec = codec->spec;
5555
5556 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
871b9066 5557 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
7f57d803
TI
5558 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5559 codec->power_save_node = 0; /* avoid click noises */
5560 snd_hda_apply_pincfgs(codec, pincfgs);
5561 }
5562}
5563
61fcf8ec
KY
5564static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5565 const struct hda_fixup *fix, int action)
5566{
5567 static const struct hda_pintbl pincfgs[] = {
5568 { 0x17, 0x21211010 }, /* dock headphone */
5569 { 0x19, 0x21a11010 }, /* dock mic */
5570 { }
5571 };
5572 struct alc_spec *spec = codec->spec;
5573
5574 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5575 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
71db96dd
TI
5576 snd_hda_apply_pincfgs(codec, pincfgs);
5577 } else if (action == HDA_FIXUP_ACT_INIT) {
61fcf8ec
KY
5578 /* Enable DOCK device */
5579 snd_hda_codec_write(codec, 0x17, 0,
5580 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5581 /* Enable DOCK device */
5582 snd_hda_codec_write(codec, 0x19, 0,
5583 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
61fcf8ec
KY
5584 }
5585}
5586
399c01aa
TI
5587static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5588 const struct hda_fixup *fix, int action)
5589{
5590 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5591 * the speaker output becomes too low by some reason on Thinkpads with
5592 * ALC298 codec
5593 */
5594 static const hda_nid_t preferred_pairs[] = {
5595 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5596 0
5597 };
5598 struct alc_spec *spec = codec->spec;
5599
5600 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5601 spec->gen.preferred_dacs = preferred_pairs;
5602}
5603
9476d369 5604static void alc_shutup_dell_xps13(struct hda_codec *codec)
033b0a7c
GM
5605{
5606 struct alc_spec *spec = codec->spec;
35a39f98 5607 int hp_pin = alc_get_hp_pin(spec);
033b0a7c 5608
9476d369
GM
5609 /* Prevent pop noises when headphones are plugged in */
5610 snd_hda_codec_write(codec, hp_pin, 0,
5611 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5612 msleep(20);
033b0a7c
GM
5613}
5614
5615static void alc_fixup_dell_xps13(struct hda_codec *codec,
5616 const struct hda_fixup *fix, int action)
5617{
3e1b0c4a
TI
5618 struct alc_spec *spec = codec->spec;
5619 struct hda_input_mux *imux = &spec->gen.input_mux;
5620 int i;
f38663ab 5621
3e1b0c4a
TI
5622 switch (action) {
5623 case HDA_FIXUP_ACT_PRE_PROBE:
5624 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5625 * it causes a click noise at start up
5626 */
5627 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
efe55732 5628 spec->shutup = alc_shutup_dell_xps13;
3e1b0c4a
TI
5629 break;
5630 case HDA_FIXUP_ACT_PROBE:
f38663ab
GM
5631 /* Make the internal mic the default input source. */
5632 for (i = 0; i < imux->num_items; i++) {
5633 if (spec->gen.imux_pins[i] == 0x12) {
5634 spec->gen.cur_mux[0] = i;
5635 break;
5636 }
5637 }
3e1b0c4a 5638 break;
033b0a7c
GM
5639 }
5640}
5641
1f8b46cd
DH
5642static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5643 const struct hda_fixup *fix, int action)
5644{
5645 struct alc_spec *spec = codec->spec;
5646
5647 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5648 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5649 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
b40eda64
DH
5650
5651 /* Disable boost for mic-in permanently. (This code is only called
5652 from quirks that guarantee that the headphone is at NID 0x1b.) */
5653 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5654 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
1f8b46cd
DH
5655 } else
5656 alc_fixup_headset_mode(codec, fix, action);
5657}
5658
73bdd597
DH
5659static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5660 const struct hda_fixup *fix, int action)
5661{
5662 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
73bdd597 5663 alc_write_coef_idx(codec, 0xc4, 0x8000);
98b24883 5664 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
73bdd597
DH
5665 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5666 }
5667 alc_fixup_headset_mode(codec, fix, action);
5668}
5669
bde7bc60
CCC
5670/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5671static int find_ext_mic_pin(struct hda_codec *codec)
5672{
5673 struct alc_spec *spec = codec->spec;
5674 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5675 hda_nid_t nid;
5676 unsigned int defcfg;
5677 int i;
5678
5679 for (i = 0; i < cfg->num_inputs; i++) {
5680 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5681 continue;
5682 nid = cfg->inputs[i].pin;
5683 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5684 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5685 continue;
5686 return nid;
5687 }
5688
5689 return 0;
5690}
5691
08a978db 5692static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
1727a771 5693 const struct hda_fixup *fix,
08a978db
DR
5694 int action)
5695{
5696 struct alc_spec *spec = codec->spec;
5697
0db75790 5698 if (action == HDA_FIXUP_ACT_PROBE) {
bde7bc60 5699 int mic_pin = find_ext_mic_pin(codec);
35a39f98 5700 int hp_pin = alc_get_hp_pin(spec);
bde7bc60
CCC
5701
5702 if (snd_BUG_ON(!mic_pin || !hp_pin))
0db75790 5703 return;
bde7bc60 5704 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
0db75790 5705 }
08a978db 5706}
693b613d 5707
3e0d611b
DH
5708static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5709 const struct hda_fixup *fix,
5710 int action)
5711{
5712 struct alc_spec *spec = codec->spec;
5713 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5714 int i;
5715
5716 /* The mic boosts on level 2 and 3 are too noisy
5717 on the internal mic input.
5718 Therefore limit the boost to 0 or 1. */
5719
5720 if (action != HDA_FIXUP_ACT_PROBE)
5721 return;
5722
5723 for (i = 0; i < cfg->num_inputs; i++) {
5724 hda_nid_t nid = cfg->inputs[i].pin;
5725 unsigned int defcfg;
5726 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5727 continue;
5728 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5729 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5730 continue;
5731
5732 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5733 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5734 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5735 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5736 (0 << AC_AMPCAP_MUTE_SHIFT));
5737 }
5738}
5739
cd217a63 5740static void alc283_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 5741 struct hda_jack_callback *jack)
cd217a63
KY
5742{
5743 struct alc_spec *spec = codec->spec;
5744 int vref;
5745
5746 msleep(200);
5747 snd_hda_gen_hp_automute(codec, jack);
5748
5749 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5750
5751 msleep(600);
5752 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5753 vref);
5754}
5755
cd217a63
KY
5756static void alc283_fixup_chromebook(struct hda_codec *codec,
5757 const struct hda_fixup *fix, int action)
5758{
5759 struct alc_spec *spec = codec->spec;
cd217a63
KY
5760
5761 switch (action) {
5762 case HDA_FIXUP_ACT_PRE_PROBE:
0202e99c 5763 snd_hda_override_wcaps(codec, 0x03, 0);
d2e92709
TI
5764 /* Disable AA-loopback as it causes white noise */
5765 spec->gen.mixer_nid = 0;
38070219 5766 break;
0202e99c 5767 case HDA_FIXUP_ACT_INIT:
de9481cb
KY
5768 /* MIC2-VREF control */
5769 /* Set to manual mode */
98b24883 5770 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
0202e99c 5771 /* Enable Line1 input control by verb */
98b24883 5772 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
0202e99c
KY
5773 break;
5774 }
5775}
5776
5777static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5778 const struct hda_fixup *fix, int action)
5779{
5780 struct alc_spec *spec = codec->spec;
0202e99c
KY
5781
5782 switch (action) {
5783 case HDA_FIXUP_ACT_PRE_PROBE:
cd217a63 5784 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
38070219
KY
5785 break;
5786 case HDA_FIXUP_ACT_INIT:
cd217a63
KY
5787 /* MIC2-VREF control */
5788 /* Set to manual mode */
98b24883 5789 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
cd217a63
KY
5790 break;
5791 }
5792}
5793
7bba2157
TI
5794/* mute tablet speaker pin (0x14) via dock plugging in addition */
5795static void asus_tx300_automute(struct hda_codec *codec)
5796{
5797 struct alc_spec *spec = codec->spec;
5798 snd_hda_gen_update_outputs(codec);
5799 if (snd_hda_jack_detect(codec, 0x1b))
5800 spec->gen.mute_bits |= (1ULL << 0x14);
5801}
5802
5803static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5804 const struct hda_fixup *fix, int action)
5805{
5806 struct alc_spec *spec = codec->spec;
7bba2157
TI
5807 static const struct hda_pintbl dock_pins[] = {
5808 { 0x1b, 0x21114000 }, /* dock speaker pin */
5809 {}
5810 };
7bba2157
TI
5811
5812 switch (action) {
5813 case HDA_FIXUP_ACT_PRE_PROBE:
1c76aa5f 5814 spec->init_amp = ALC_INIT_DEFAULT;
ae065f1c
TI
5815 /* TX300 needs to set up GPIO2 for the speaker amp */
5816 alc_setup_gpio(codec, 0x04);
7bba2157
TI
5817 snd_hda_apply_pincfgs(codec, dock_pins);
5818 spec->gen.auto_mute_via_amp = 1;
5819 spec->gen.automute_hook = asus_tx300_automute;
5820 snd_hda_jack_detect_enable_callback(codec, 0x1b,
7bba2157
TI
5821 snd_hda_gen_hp_automute);
5822 break;
5579cd6f
TI
5823 case HDA_FIXUP_ACT_PROBE:
5824 spec->init_amp = ALC_INIT_DEFAULT;
5825 break;
7bba2157
TI
5826 case HDA_FIXUP_ACT_BUILD:
5827 /* this is a bit tricky; give more sane names for the main
5828 * (tablet) speaker and the dock speaker, respectively
5829 */
56798e6b
TI
5830 rename_ctl(codec, "Speaker Playback Switch",
5831 "Dock Speaker Playback Switch");
5832 rename_ctl(codec, "Bass Speaker Playback Switch",
5833 "Speaker Playback Switch");
7bba2157
TI
5834 break;
5835 }
5836}
5837
338cae56
DH
5838static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5839 const struct hda_fixup *fix, int action)
5840{
0f4881dc
DH
5841 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5842 /* DAC node 0x03 is giving mono output. We therefore want to
5843 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5844 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
caf3c043
MM
5845 static const hda_nid_t conn1[] = { 0x0c };
5846 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
5847 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
0f4881dc 5848 }
338cae56
DH
5849}
5850
dd9aa335
HW
5851static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5852 const struct hda_fixup *fix, int action)
5853{
5854 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5855 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5856 we can't adjust the speaker's volume since this node does not has
5857 Amp-out capability. we change the speaker's route to:
5858 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5859 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5860 speaker's volume now. */
5861
caf3c043
MM
5862 static const hda_nid_t conn1[] = { 0x0c };
5863 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
dd9aa335
HW
5864 }
5865}
5866
e312a869
TI
5867/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5868static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5869 const struct hda_fixup *fix, int action)
5870{
5871 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
5872 static const hda_nid_t conn[] = { 0x02, 0x03 };
5873 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
e312a869
TI
5874 }
5875}
5876
d2cd795c
JK
5877/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
5878static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
5879 const struct hda_fixup *fix, int action)
5880{
5881 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
5882 static const hda_nid_t conn[] = { 0x02 };
5883 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
d2cd795c
JK
5884 }
5885}
5886
98973f2f
KP
5887/* Hook to update amp GPIO4 for automute */
5888static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5889 struct hda_jack_callback *jack)
5890{
5891 struct alc_spec *spec = codec->spec;
5892
5893 snd_hda_gen_hp_automute(codec, jack);
5894 /* mute_led_polarity is set to 0, so we pass inverted value here */
dbd13179
KHF
5895 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
5896 !spec->gen.hp_jack_present);
98973f2f
KP
5897}
5898
5899/* Manage GPIOs for HP EliteBook Folio 9480m.
5900 *
5901 * GPIO4 is the headphone amplifier power control
5902 * GPIO3 is the audio output mute indicator LED
5903 */
5904
5905static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5906 const struct hda_fixup *fix,
5907 int action)
5908{
5909 struct alc_spec *spec = codec->spec;
98973f2f 5910
01e4a275 5911 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
98973f2f 5912 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
5913 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5914 spec->gpio_mask |= 0x10;
5915 spec->gpio_dir |= 0x10;
98973f2f 5916 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
98973f2f
KP
5917 }
5918}
5919
ae065f1c
TI
5920static void alc275_fixup_gpio4_off(struct hda_codec *codec,
5921 const struct hda_fixup *fix,
5922 int action)
5923{
5924 struct alc_spec *spec = codec->spec;
5925
5926 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5927 spec->gpio_mask |= 0x04;
5928 spec->gpio_dir |= 0x04;
5929 /* set data bit low */
5930 }
5931}
5932
6a6660d0
TI
5933/* Quirk for Thinkpad X1 7th and 8th Gen
5934 * The following fixed routing needed
5935 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
5936 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
5937 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
5938 */
5939static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
5940 const struct hda_fixup *fix, int action)
5941{
5942 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
5943 static const hda_nid_t preferred_pairs[] = {
5944 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
5945 };
5946 struct alc_spec *spec = codec->spec;
5947
5948 switch (action) {
5949 case HDA_FIXUP_ACT_PRE_PROBE:
5950 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
5951 spec->gen.preferred_dacs = preferred_pairs;
5952 break;
5953 case HDA_FIXUP_ACT_BUILD:
5954 /* The generic parser creates somewhat unintuitive volume ctls
5955 * with the fixed routing above, and the shared DAC2 may be
5956 * confusing for PA.
5957 * Rename those to unique names so that PA doesn't touch them
5958 * and use only Master volume.
5959 */
5960 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
5961 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
5962 break;
5963 }
5964}
5965
ca169cc2
KY
5966static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5967 const struct hda_fixup *fix,
5968 int action)
5969{
5970 alc_fixup_dual_codecs(codec, fix, action);
5971 switch (action) {
5972 case HDA_FIXUP_ACT_PRE_PROBE:
5973 /* override card longname to provide a unique UCM profile */
5974 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5975 break;
5976 case HDA_FIXUP_ACT_BUILD:
5977 /* rename Capture controls depending on the codec */
5978 rename_ctl(codec, "Capture Volume",
5979 codec->addr == 0 ?
5980 "Rear-Panel Capture Volume" :
5981 "Front-Panel Capture Volume");
5982 rename_ctl(codec, "Capture Switch",
5983 codec->addr == 0 ?
5984 "Rear-Panel Capture Switch" :
5985 "Front-Panel Capture Switch");
5986 break;
5987 }
5988}
5989
52e4e368
KHF
5990static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
5991 const struct hda_fixup *fix, int action)
5992{
5993 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5994 return;
5995
5996 codec->power_save_node = 1;
5997}
5998
92266651
KY
5999/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6000static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6001 const struct hda_fixup *fix, int action)
6002{
6003 struct alc_spec *spec = codec->spec;
caf3c043 6004 static const hda_nid_t preferred_pairs[] = {
92266651
KY
6005 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6006 0
6007 };
6008
6009 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6010 return;
6011
6012 spec->gen.preferred_dacs = preferred_pairs;
0700d3d1
KY
6013 spec->gen.auto_mute_via_amp = 1;
6014 codec->power_save_node = 0;
92266651
KY
6015}
6016
c4cfcf6f
HW
6017/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6018static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6019 const struct hda_fixup *fix, int action)
6020{
6021 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6022 return;
6023
6024 snd_hda_override_wcaps(codec, 0x03, 0);
6025}
6026
8a8de09c
KY
6027static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6028{
6029 switch (codec->core.vendor_id) {
6030 case 0x10ec0274:
6031 case 0x10ec0294:
6032 case 0x10ec0225:
6033 case 0x10ec0295:
6034 case 0x10ec0299:
6035 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6036 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6037 break;
6038 case 0x10ec0235:
6039 case 0x10ec0236:
6040 case 0x10ec0255:
6041 case 0x10ec0256:
6042 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6043 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6044 break;
6045 }
6046}
6047
8983eb60
KY
6048static void alc295_fixup_chromebook(struct hda_codec *codec,
6049 const struct hda_fixup *fix, int action)
6050{
d3ba58bb
KY
6051 struct alc_spec *spec = codec->spec;
6052
8983eb60 6053 switch (action) {
d3ba58bb
KY
6054 case HDA_FIXUP_ACT_PRE_PROBE:
6055 spec->ultra_low_power = true;
6056 break;
8983eb60 6057 case HDA_FIXUP_ACT_INIT:
8a8de09c 6058 alc_combo_jack_hp_jd_restart(codec);
8983eb60
KY
6059 break;
6060 }
6061}
6062
d1dd4211
KY
6063static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6064 const struct hda_fixup *fix, int action)
6065{
6066 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6067 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6068}
6069
c3cdf189
LJ
6070
6071static void alc294_gx502_toggle_output(struct hda_codec *codec,
6072 struct hda_jack_callback *cb)
6073{
6074 /* The Windows driver sets the codec up in a very different way where
6075 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6076 */
6077 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6078 alc_write_coef_idx(codec, 0x10, 0x8a20);
6079 else
6080 alc_write_coef_idx(codec, 0x10, 0x0a20);
6081}
6082
6083static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6084 const struct hda_fixup *fix, int action)
6085{
6086 /* Pin 0x21: headphones/headset mic */
6087 if (!is_jack_detectable(codec, 0x21))
6088 return;
6089
6090 switch (action) {
6091 case HDA_FIXUP_ACT_PRE_PROBE:
6092 snd_hda_jack_detect_enable_callback(codec, 0x21,
6093 alc294_gx502_toggle_output);
6094 break;
6095 case HDA_FIXUP_ACT_INIT:
6096 /* Make sure to start in a correct state, i.e. if
6097 * headphones have been plugged in before powering up the system
6098 */
6099 alc294_gx502_toggle_output(codec, NULL);
6100 break;
6101 }
6102}
6103
56496253
KY
6104static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6105 const struct hda_fixup *fix, int action)
6106{
6107 if (action != HDA_FIXUP_ACT_INIT)
6108 return;
6109
6110 msleep(100);
6111 alc_write_coef_idx(codec, 0x65, 0x0);
6112}
6113
8a8de09c
KY
6114static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6115 const struct hda_fixup *fix, int action)
6116{
6117 switch (action) {
6118 case HDA_FIXUP_ACT_INIT:
6119 alc_combo_jack_hp_jd_restart(codec);
6120 break;
6121 }
6122}
6123
b317b032
TI
6124/* for hda_fixup_thinkpad_acpi() */
6125#include "thinkpad_helper.c"
b67ae3f1 6126
d5a6cabf
TI
6127static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6128 const struct hda_fixup *fix, int action)
6129{
6130 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6131 hda_fixup_thinkpad_acpi(codec, fix, action);
6132}
6133
bbf8ff6b
TB
6134/* for alc295_fixup_hp_top_speakers */
6135#include "hp_x360_helper.c"
6136
1d045db9 6137enum {
f73bbf63 6138 ALC269_FIXUP_GPIO2,
1d045db9
TI
6139 ALC269_FIXUP_SONY_VAIO,
6140 ALC275_FIXUP_SONY_VAIO_GPIO2,
6141 ALC269_FIXUP_DELL_M101Z,
6142 ALC269_FIXUP_SKU_IGNORE,
6143 ALC269_FIXUP_ASUS_G73JW,
6144 ALC269_FIXUP_LENOVO_EAPD,
6145 ALC275_FIXUP_SONY_HWEQ,
e9bd7d5c 6146 ALC275_FIXUP_SONY_DISABLE_AAMIX,
1d045db9 6147 ALC271_FIXUP_DMIC,
017f2a10 6148 ALC269_FIXUP_PCM_44K,
adabb3ec 6149 ALC269_FIXUP_STEREO_DMIC,
7c478f03 6150 ALC269_FIXUP_HEADSET_MIC,
24519911
TI
6151 ALC269_FIXUP_QUANTA_MUTE,
6152 ALC269_FIXUP_LIFEBOOK,
2041d564 6153 ALC269_FIXUP_LIFEBOOK_EXTMIC,
cc7016ab 6154 ALC269_FIXUP_LIFEBOOK_HP_PIN,
4df3fd17 6155 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
fdcc968a 6156 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
a4297b5d
TI
6157 ALC269_FIXUP_AMIC,
6158 ALC269_FIXUP_DMIC,
6159 ALC269VB_FIXUP_AMIC,
6160 ALC269VB_FIXUP_DMIC,
08fb0d0e 6161 ALC269_FIXUP_HP_MUTE_LED,
d06ac143 6162 ALC269_FIXUP_HP_MUTE_LED_MIC1,
08fb0d0e 6163 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7f783bd5 6164 ALC269_FIXUP_HP_MUTE_LED_MIC3,
9f5c6faf 6165 ALC269_FIXUP_HP_GPIO_LED,
9c5dc3bf
KY
6166 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6167 ALC269_FIXUP_HP_LINE1_MIC1_LED,
693b613d 6168 ALC269_FIXUP_INV_DMIC,
108cc108 6169 ALC269_FIXUP_LENOVO_DOCK,
b590b38c 6170 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
9b745ab8 6171 ALC269_FIXUP_NO_SHUTUP,
88cfcf86 6172 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
108cc108 6173 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
73bdd597
DH
6174 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6175 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
338cae56 6176 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
fcc6c877 6177 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
73bdd597
DH
6178 ALC269_FIXUP_HEADSET_MODE,
6179 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7819717b 6180 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
d240d1dc
DH
6181 ALC269_FIXUP_ASUS_X101_FUNC,
6182 ALC269_FIXUP_ASUS_X101_VERB,
6183 ALC269_FIXUP_ASUS_X101,
08a978db
DR
6184 ALC271_FIXUP_AMIC_MIC2,
6185 ALC271_FIXUP_HP_GATE_MIC_JACK,
b1e8972e 6186 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
42397004 6187 ALC269_FIXUP_ACER_AC700,
3e0d611b 6188 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
2cede303 6189 ALC269VB_FIXUP_ASUS_ZENBOOK,
23870831 6190 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
8e35cd4a 6191 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
02b504d9 6192 ALC269VB_FIXUP_ORDISSIMO_EVE2,
cd217a63 6193 ALC283_FIXUP_CHROME_BOOK,
0202e99c 6194 ALC283_FIXUP_SENSE_COMBO_JACK,
7bba2157 6195 ALC282_FIXUP_ASUS_TX300,
1bb3e062 6196 ALC283_FIXUP_INT_MIC,
338cae56 6197 ALC290_FIXUP_MONO_SPEAKERS,
0f4881dc
DH
6198 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6199 ALC290_FIXUP_SUBWOOFER,
6200 ALC290_FIXUP_SUBWOOFER_HSJACK,
b67ae3f1 6201 ALC269_FIXUP_THINKPAD_ACPI,
56f27013 6202 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5824ce8d 6203 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
615966ad 6204 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9a22a8f5 6205 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
31278997 6206 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9a22a8f5 6207 ALC255_FIXUP_HEADSET_MODE,
31278997 6208 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
a22aa26f 6209 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
1c37c223 6210 ALC292_FIXUP_TPT440_DOCK,
9a811230 6211 ALC292_FIXUP_TPT440,
abaa2274 6212 ALC283_FIXUP_HEADSET_MIC,
b3802783 6213 ALC255_FIXUP_MIC_MUTE_LED,
1a22e775 6214 ALC282_FIXUP_ASPIRE_V5_PINS,
7a5255f1 6215 ALC280_FIXUP_HP_GPIO4,
eaa8e5ef 6216 ALC286_FIXUP_HP_GPIO_LED,
33f4acd3 6217 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
b4b33f9d 6218 ALC280_FIXUP_HP_DOCK_PINS,
04d5466a 6219 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
98973f2f 6220 ALC280_FIXUP_HP_9480M,
e1e62b98
KY
6221 ALC288_FIXUP_DELL_HEADSET_MODE,
6222 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
831bfdf9
HW
6223 ALC288_FIXUP_DELL_XPS_13,
6224 ALC288_FIXUP_DISABLE_AAMIX,
5fab5829 6225 ALC292_FIXUP_DELL_E7X_AAMIX,
8b99aba7
TI
6226 ALC292_FIXUP_DELL_E7X,
6227 ALC292_FIXUP_DISABLE_AAMIX,
c04017ea 6228 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
54324221 6229 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
977e6276 6230 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
2f726aec 6231 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6ed1131f 6232 ALC275_FIXUP_DELL_XPS,
23adc192 6233 ALC293_FIXUP_LENOVO_SPK_NOISE,
3694cb29 6234 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
3b43b71f 6235 ALC255_FIXUP_DELL_SPK_NOISE,
d1dd4211 6236 ALC225_FIXUP_DISABLE_MIC_VREF,
2ae95577 6237 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
e312a869 6238 ALC295_FIXUP_DISABLE_DAC3,
d2cd795c 6239 ALC285_FIXUP_SPEAKER2_TO_DAC1,
f883982d 6240 ALC280_FIXUP_HP_HEADSET_MIC,
e549d190 6241 ALC221_FIXUP_HP_FRONT_MIC,
c636b95e 6242 ALC292_FIXUP_TPT460,
dd9aa335 6243 ALC298_FIXUP_SPK_VOLUME,
fd06c77e 6244 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
823ff161 6245 ALC269_FIXUP_ATIV_BOOK_8,
9eb5d0e6 6246 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
c1732ede
CC
6247 ALC256_FIXUP_ASUS_HEADSET_MODE,
6248 ALC256_FIXUP_ASUS_MIC,
eeed4cd1 6249 ALC256_FIXUP_ASUS_AIO_GPIO2,
216d7aeb
CC
6250 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6251 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
ca169cc2 6252 ALC233_FIXUP_LENOVO_MULTI_CODECS,
ea5c7eba 6253 ALC233_FIXUP_ACER_HEADSET_MIC,
f33f79f3 6254 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5f364135 6255 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
52e4e368 6256 ALC225_FIXUP_S3_POP_NOISE,
b84e8436 6257 ALC700_FIXUP_INTEL_REFERENCE,
92266651
KY
6258 ALC274_FIXUP_DELL_BIND_DACS,
6259 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
399c01aa 6260 ALC298_FIXUP_TPT470_DOCK_FIX,
61fcf8ec 6261 ALC298_FIXUP_TPT470_DOCK,
ae104a21 6262 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
f0ba9d69 6263 ALC255_FIXUP_DELL_HEADSET_MIC,
0fbf21c3 6264 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
a2ef03fe 6265 ALC298_FIXUP_HUAWEI_MBX_STEREO,
bbf8ff6b 6266 ALC295_FIXUP_HP_X360,
8a328ac1 6267 ALC221_FIXUP_HP_HEADSET_MIC,
c4cfcf6f 6268 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
e8ed64b0 6269 ALC295_FIXUP_HP_AUTO_MUTE,
33aaebd4 6270 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
d8ae458e 6271 ALC294_FIXUP_ASUS_MIC,
4e051106
JHP
6272 ALC294_FIXUP_ASUS_HEADSET_MIC,
6273 ALC294_FIXUP_ASUS_SPK,
89e3a568 6274 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
c8c6ee61 6275 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
cbc05fd6 6276 ALC255_FIXUP_ACER_HEADSET_MIC,
10f5b1b8 6277 ALC295_FIXUP_CHROME_BOOK,
8983eb60 6278 ALC225_FIXUP_HEADSET_JACK,
136824ef
KY
6279 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6280 ALC225_FIXUP_WYSE_AUTO_MUTE,
6281 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
667a8f73 6282 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
8c8967a7 6283 ALC256_FIXUP_ASUS_HEADSET_MIC,
e1037354 6284 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
e2a829b3 6285 ALC299_FIXUP_PREDATOR_SPK,
bd9c10bc 6286 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
e79c2269
KY
6287 ALC289_FIXUP_DELL_SPK2,
6288 ALC289_FIXUP_DUAL_SPK,
48e01504
CC
6289 ALC294_FIXUP_SPK2_TO_DAC1,
6290 ALC294_FIXUP_ASUS_DUAL_SPK,
6a6660d0 6291 ALC285_FIXUP_THINKPAD_X1_GEN7,
76f7dec0 6292 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8b33a134 6293 ALC294_FIXUP_ASUS_HPE,
1b94e59d 6294 ALC294_FIXUP_ASUS_COEF_1B,
c3cdf189
LJ
6295 ALC294_FIXUP_ASUS_GX502_HP,
6296 ALC294_FIXUP_ASUS_GX502_PINS,
6297 ALC294_FIXUP_ASUS_GX502_VERBS,
f5a88b0a 6298 ALC285_FIXUP_HP_GPIO_LED,
431e76c3 6299 ALC285_FIXUP_HP_MUTE_LED,
24164f43 6300 ALC236_FIXUP_HP_MUTE_LED,
14425f1f 6301 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
9e43342b 6302 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8eae7e9b 6303 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6e15d126 6304 ALC269VC_FIXUP_ACER_HEADSET_MIC,
781c90c0 6305 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
293a92c1 6306 ALC289_FIXUP_ASUS_GA401,
4b43d05a 6307 ALC289_FIXUP_ASUS_GA502,
f50a121d 6308 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
56496253 6309 ALC285_FIXUP_HP_GPIO_AMP_INIT,
f1ec5be1
HC
6310 ALC269_FIXUP_CZC_B20,
6311 ALC269_FIXUP_CZC_TMI,
6312 ALC269_FIXUP_CZC_L101,
6313 ALC269_FIXUP_LEMOTE_A1802,
6314 ALC269_FIXUP_LEMOTE_A190X,
e2d2fded 6315 ALC256_FIXUP_INTEL_NUC8_RUGGED,
fc19d559 6316 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
13468bfa 6317 ALC274_FIXUP_HP_MIC,
8a8de09c 6318 ALC274_FIXUP_HP_HEADSET_MIC,
ef9ce66f 6319 ALC256_FIXUP_ASUS_HPE,
446b8185 6320 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
a0ccbc53 6321 ALC287_FIXUP_HP_GPIO_LED,
9e885770 6322 ALC256_FIXUP_HP_HEADSET_MIC,
f1d4e28b
KY
6323};
6324
1727a771 6325static const struct hda_fixup alc269_fixups[] = {
f73bbf63
KHF
6326 [ALC269_FIXUP_GPIO2] = {
6327 .type = HDA_FIXUP_FUNC,
6328 .v.func = alc_fixup_gpio2,
6329 },
1d045db9 6330 [ALC269_FIXUP_SONY_VAIO] = {
fd108215
TI
6331 .type = HDA_FIXUP_PINCTLS,
6332 .v.pins = (const struct hda_pintbl[]) {
6333 {0x19, PIN_VREFGRD},
1d045db9
TI
6334 {}
6335 }
f1d4e28b 6336 },
1d045db9 6337 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
ae065f1c
TI
6338 .type = HDA_FIXUP_FUNC,
6339 .v.func = alc275_fixup_gpio4_off,
1d045db9
TI
6340 .chained = true,
6341 .chain_id = ALC269_FIXUP_SONY_VAIO
6342 },
6343 [ALC269_FIXUP_DELL_M101Z] = {
1727a771 6344 .type = HDA_FIXUP_VERBS,
1d045db9
TI
6345 .v.verbs = (const struct hda_verb[]) {
6346 /* Enables internal speaker */
6347 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6348 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6349 {}
6350 }
6351 },
6352 [ALC269_FIXUP_SKU_IGNORE] = {
1727a771 6353 .type = HDA_FIXUP_FUNC,
23d30f28 6354 .v.func = alc_fixup_sku_ignore,
1d045db9
TI
6355 },
6356 [ALC269_FIXUP_ASUS_G73JW] = {
1727a771
TI
6357 .type = HDA_FIXUP_PINS,
6358 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
6359 { 0x17, 0x99130111 }, /* subwoofer */
6360 { }
6361 }
6362 },
6363 [ALC269_FIXUP_LENOVO_EAPD] = {
1727a771 6364 .type = HDA_FIXUP_VERBS,
1d045db9
TI
6365 .v.verbs = (const struct hda_verb[]) {
6366 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6367 {}
6368 }
6369 },
6370 [ALC275_FIXUP_SONY_HWEQ] = {
1727a771 6371 .type = HDA_FIXUP_FUNC,
1d045db9
TI
6372 .v.func = alc269_fixup_hweq,
6373 .chained = true,
6374 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6375 },
e9bd7d5c
TI
6376 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6377 .type = HDA_FIXUP_FUNC,
6378 .v.func = alc_fixup_disable_aamix,
6379 .chained = true,
6380 .chain_id = ALC269_FIXUP_SONY_VAIO
6381 },
1d045db9 6382 [ALC271_FIXUP_DMIC] = {
1727a771 6383 .type = HDA_FIXUP_FUNC,
1d045db9 6384 .v.func = alc271_fixup_dmic,
f1d4e28b 6385 },
017f2a10 6386 [ALC269_FIXUP_PCM_44K] = {
1727a771 6387 .type = HDA_FIXUP_FUNC,
017f2a10 6388 .v.func = alc269_fixup_pcm_44k,
012e7eb1
DH
6389 .chained = true,
6390 .chain_id = ALC269_FIXUP_QUANTA_MUTE
017f2a10 6391 },
adabb3ec 6392 [ALC269_FIXUP_STEREO_DMIC] = {
1727a771 6393 .type = HDA_FIXUP_FUNC,
adabb3ec
TI
6394 .v.func = alc269_fixup_stereo_dmic,
6395 },
7c478f03
DH
6396 [ALC269_FIXUP_HEADSET_MIC] = {
6397 .type = HDA_FIXUP_FUNC,
6398 .v.func = alc269_fixup_headset_mic,
6399 },
24519911 6400 [ALC269_FIXUP_QUANTA_MUTE] = {
1727a771 6401 .type = HDA_FIXUP_FUNC,
24519911
TI
6402 .v.func = alc269_fixup_quanta_mute,
6403 },
6404 [ALC269_FIXUP_LIFEBOOK] = {
1727a771
TI
6405 .type = HDA_FIXUP_PINS,
6406 .v.pins = (const struct hda_pintbl[]) {
24519911
TI
6407 { 0x1a, 0x2101103f }, /* dock line-out */
6408 { 0x1b, 0x23a11040 }, /* dock mic-in */
6409 { }
6410 },
6411 .chained = true,
6412 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6413 },
2041d564
DH
6414 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6415 .type = HDA_FIXUP_PINS,
6416 .v.pins = (const struct hda_pintbl[]) {
6417 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6418 { }
6419 },
6420 },
cc7016ab
TI
6421 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6422 .type = HDA_FIXUP_PINS,
6423 .v.pins = (const struct hda_pintbl[]) {
6424 { 0x21, 0x0221102f }, /* HP out */
6425 { }
6426 },
6427 },
4df3fd17
TI
6428 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6429 .type = HDA_FIXUP_FUNC,
6430 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6431 },
fdcc968a
JMG
6432 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6433 .type = HDA_FIXUP_FUNC,
6434 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6435 },
a4297b5d 6436 [ALC269_FIXUP_AMIC] = {
1727a771
TI
6437 .type = HDA_FIXUP_PINS,
6438 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6439 { 0x14, 0x99130110 }, /* speaker */
6440 { 0x15, 0x0121401f }, /* HP out */
6441 { 0x18, 0x01a19c20 }, /* mic */
6442 { 0x19, 0x99a3092f }, /* int-mic */
6443 { }
6444 },
6445 },
6446 [ALC269_FIXUP_DMIC] = {
1727a771
TI
6447 .type = HDA_FIXUP_PINS,
6448 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6449 { 0x12, 0x99a3092f }, /* int-mic */
6450 { 0x14, 0x99130110 }, /* speaker */
6451 { 0x15, 0x0121401f }, /* HP out */
6452 { 0x18, 0x01a19c20 }, /* mic */
6453 { }
6454 },
6455 },
6456 [ALC269VB_FIXUP_AMIC] = {
1727a771
TI
6457 .type = HDA_FIXUP_PINS,
6458 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6459 { 0x14, 0x99130110 }, /* speaker */
6460 { 0x18, 0x01a19c20 }, /* mic */
6461 { 0x19, 0x99a3092f }, /* int-mic */
6462 { 0x21, 0x0121401f }, /* HP out */
6463 { }
6464 },
6465 },
2267ea97 6466 [ALC269VB_FIXUP_DMIC] = {
1727a771
TI
6467 .type = HDA_FIXUP_PINS,
6468 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6469 { 0x12, 0x99a3092f }, /* int-mic */
6470 { 0x14, 0x99130110 }, /* speaker */
6471 { 0x18, 0x01a19c20 }, /* mic */
6472 { 0x21, 0x0121401f }, /* HP out */
6473 { }
6474 },
6475 },
08fb0d0e 6476 [ALC269_FIXUP_HP_MUTE_LED] = {
1727a771 6477 .type = HDA_FIXUP_FUNC,
08fb0d0e 6478 .v.func = alc269_fixup_hp_mute_led,
6d3cd5d4 6479 },
d06ac143
DH
6480 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6481 .type = HDA_FIXUP_FUNC,
6482 .v.func = alc269_fixup_hp_mute_led_mic1,
6483 },
08fb0d0e 6484 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
1727a771 6485 .type = HDA_FIXUP_FUNC,
08fb0d0e 6486 .v.func = alc269_fixup_hp_mute_led_mic2,
420b0feb 6487 },
7f783bd5
TB
6488 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6489 .type = HDA_FIXUP_FUNC,
6490 .v.func = alc269_fixup_hp_mute_led_mic3,
e8ed64b0
GKK
6491 .chained = true,
6492 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7f783bd5 6493 },
9f5c6faf
TI
6494 [ALC269_FIXUP_HP_GPIO_LED] = {
6495 .type = HDA_FIXUP_FUNC,
6496 .v.func = alc269_fixup_hp_gpio_led,
6497 },
9c5dc3bf
KY
6498 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6499 .type = HDA_FIXUP_FUNC,
6500 .v.func = alc269_fixup_hp_gpio_mic1_led,
6501 },
6502 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6503 .type = HDA_FIXUP_FUNC,
6504 .v.func = alc269_fixup_hp_line1_mic1_led,
6505 },
693b613d 6506 [ALC269_FIXUP_INV_DMIC] = {
1727a771 6507 .type = HDA_FIXUP_FUNC,
9d36a7dc 6508 .v.func = alc_fixup_inv_dmic,
693b613d 6509 },
9b745ab8
TI
6510 [ALC269_FIXUP_NO_SHUTUP] = {
6511 .type = HDA_FIXUP_FUNC,
6512 .v.func = alc_fixup_no_shutup,
6513 },
108cc108 6514 [ALC269_FIXUP_LENOVO_DOCK] = {
1727a771
TI
6515 .type = HDA_FIXUP_PINS,
6516 .v.pins = (const struct hda_pintbl[]) {
108cc108
DH
6517 { 0x19, 0x23a11040 }, /* dock mic */
6518 { 0x1b, 0x2121103f }, /* dock headphone */
6519 { }
6520 },
6521 .chained = true,
6522 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6523 },
b590b38c
TI
6524 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6525 .type = HDA_FIXUP_FUNC,
6526 .v.func = alc269_fixup_limit_int_mic_boost,
6527 .chained = true,
6528 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6529 },
108cc108 6530 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
1727a771 6531 .type = HDA_FIXUP_FUNC,
108cc108 6532 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
52129000
DH
6533 .chained = true,
6534 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
108cc108 6535 },
73bdd597
DH
6536 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6537 .type = HDA_FIXUP_PINS,
6538 .v.pins = (const struct hda_pintbl[]) {
6539 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6540 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6541 { }
6542 },
6543 .chained = true,
6544 .chain_id = ALC269_FIXUP_HEADSET_MODE
6545 },
6546 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6547 .type = HDA_FIXUP_PINS,
6548 .v.pins = (const struct hda_pintbl[]) {
6549 { 0x16, 0x21014020 }, /* dock line out */
6550 { 0x19, 0x21a19030 }, /* dock mic */
6551 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6552 { }
6553 },
6554 .chained = true,
6555 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6556 },
338cae56
DH
6557 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
6558 .type = HDA_FIXUP_PINS,
6559 .v.pins = (const struct hda_pintbl[]) {
6560 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6561 { }
6562 },
6563 .chained = true,
6564 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6565 },
fcc6c877
KY
6566 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6567 .type = HDA_FIXUP_PINS,
6568 .v.pins = (const struct hda_pintbl[]) {
6569 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6570 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6571 { }
6572 },
6573 .chained = true,
6574 .chain_id = ALC269_FIXUP_HEADSET_MODE
6575 },
73bdd597
DH
6576 [ALC269_FIXUP_HEADSET_MODE] = {
6577 .type = HDA_FIXUP_FUNC,
6578 .v.func = alc_fixup_headset_mode,
6676f308 6579 .chained = true,
b3802783 6580 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
73bdd597
DH
6581 },
6582 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6583 .type = HDA_FIXUP_FUNC,
6584 .v.func = alc_fixup_headset_mode_no_hp_mic,
6585 },
7819717b
TI
6586 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6587 .type = HDA_FIXUP_PINS,
6588 .v.pins = (const struct hda_pintbl[]) {
6589 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6590 { }
6591 },
6592 .chained = true,
6593 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6594 },
88cfcf86
DH
6595 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6596 .type = HDA_FIXUP_PINS,
6597 .v.pins = (const struct hda_pintbl[]) {
6598 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6599 { }
6600 },
fbc78ad6
DH
6601 .chained = true,
6602 .chain_id = ALC269_FIXUP_HEADSET_MIC
88cfcf86 6603 },
0fbf21c3 6604 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8ac51bbc
AB
6605 .type = HDA_FIXUP_PINS,
6606 .v.pins = (const struct hda_pintbl[]) {
6607 {0x12, 0x90a60130},
6608 {0x13, 0x40000000},
6609 {0x14, 0x90170110},
6610 {0x18, 0x411111f0},
6611 {0x19, 0x04a11040},
6612 {0x1a, 0x411111f0},
6613 {0x1b, 0x90170112},
6614 {0x1d, 0x40759a05},
6615 {0x1e, 0x411111f0},
6616 {0x21, 0x04211020},
6617 { }
6618 },
e2744fd7
AB
6619 .chained = true,
6620 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8ac51bbc 6621 },
a2ef03fe
TE
6622 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
6623 .type = HDA_FIXUP_FUNC,
6624 .v.func = alc298_fixup_huawei_mbx_stereo,
6625 .chained = true,
6626 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
6627 },
d240d1dc
DH
6628 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6629 .type = HDA_FIXUP_FUNC,
6630 .v.func = alc269_fixup_x101_headset_mic,
6631 },
6632 [ALC269_FIXUP_ASUS_X101_VERB] = {
6633 .type = HDA_FIXUP_VERBS,
6634 .v.verbs = (const struct hda_verb[]) {
6635 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6636 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6637 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6638 { }
6639 },
6640 .chained = true,
6641 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6642 },
6643 [ALC269_FIXUP_ASUS_X101] = {
6644 .type = HDA_FIXUP_PINS,
6645 .v.pins = (const struct hda_pintbl[]) {
6646 { 0x18, 0x04a1182c }, /* Headset mic */
6647 { }
6648 },
6649 .chained = true,
6650 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6651 },
08a978db 6652 [ALC271_FIXUP_AMIC_MIC2] = {
1727a771
TI
6653 .type = HDA_FIXUP_PINS,
6654 .v.pins = (const struct hda_pintbl[]) {
08a978db
DR
6655 { 0x14, 0x99130110 }, /* speaker */
6656 { 0x19, 0x01a19c20 }, /* mic */
6657 { 0x1b, 0x99a7012f }, /* int-mic */
6658 { 0x21, 0x0121401f }, /* HP out */
6659 { }
6660 },
6661 },
6662 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
1727a771 6663 .type = HDA_FIXUP_FUNC,
08a978db
DR
6664 .v.func = alc271_hp_gate_mic_jack,
6665 .chained = true,
6666 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6667 },
b1e8972e
OR
6668 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6669 .type = HDA_FIXUP_FUNC,
6670 .v.func = alc269_fixup_limit_int_mic_boost,
6671 .chained = true,
6672 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6673 },
42397004
DR
6674 [ALC269_FIXUP_ACER_AC700] = {
6675 .type = HDA_FIXUP_PINS,
6676 .v.pins = (const struct hda_pintbl[]) {
6677 { 0x12, 0x99a3092f }, /* int-mic */
6678 { 0x14, 0x99130110 }, /* speaker */
6679 { 0x18, 0x03a11c20 }, /* mic */
6680 { 0x1e, 0x0346101e }, /* SPDIF1 */
6681 { 0x21, 0x0321101f }, /* HP out */
6682 { }
6683 },
6684 .chained = true,
6685 .chain_id = ALC271_FIXUP_DMIC,
6686 },
3e0d611b
DH
6687 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6688 .type = HDA_FIXUP_FUNC,
6689 .v.func = alc269_fixup_limit_int_mic_boost,
2793769f
DH
6690 .chained = true,
6691 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
3e0d611b 6692 },
2cede303
OR
6693 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6694 .type = HDA_FIXUP_FUNC,
6695 .v.func = alc269_fixup_limit_int_mic_boost,
6696 .chained = true,
6697 .chain_id = ALC269VB_FIXUP_DMIC,
6698 },
23870831
TI
6699 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6700 .type = HDA_FIXUP_VERBS,
6701 .v.verbs = (const struct hda_verb[]) {
6702 /* class-D output amp +5dB */
6703 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6704 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6705 {}
6706 },
6707 .chained = true,
6708 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6709 },
8e35cd4a
DH
6710 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6711 .type = HDA_FIXUP_FUNC,
6712 .v.func = alc269_fixup_limit_int_mic_boost,
6713 .chained = true,
6714 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6715 },
02b504d9
AA
6716 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6717 .type = HDA_FIXUP_PINS,
6718 .v.pins = (const struct hda_pintbl[]) {
6719 { 0x12, 0x99a3092f }, /* int-mic */
6720 { 0x18, 0x03a11d20 }, /* mic */
6721 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6722 { }
6723 },
6724 },
cd217a63
KY
6725 [ALC283_FIXUP_CHROME_BOOK] = {
6726 .type = HDA_FIXUP_FUNC,
6727 .v.func = alc283_fixup_chromebook,
6728 },
0202e99c
KY
6729 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6730 .type = HDA_FIXUP_FUNC,
6731 .v.func = alc283_fixup_sense_combo_jack,
6732 .chained = true,
6733 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6734 },
7bba2157
TI
6735 [ALC282_FIXUP_ASUS_TX300] = {
6736 .type = HDA_FIXUP_FUNC,
6737 .v.func = alc282_fixup_asus_tx300,
6738 },
1bb3e062
KY
6739 [ALC283_FIXUP_INT_MIC] = {
6740 .type = HDA_FIXUP_VERBS,
6741 .v.verbs = (const struct hda_verb[]) {
6742 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6743 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6744 { }
6745 },
6746 .chained = true,
6747 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6748 },
0f4881dc
DH
6749 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6750 .type = HDA_FIXUP_PINS,
6751 .v.pins = (const struct hda_pintbl[]) {
6752 { 0x17, 0x90170112 }, /* subwoofer */
6753 { }
6754 },
6755 .chained = true,
6756 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6757 },
6758 [ALC290_FIXUP_SUBWOOFER] = {
6759 .type = HDA_FIXUP_PINS,
6760 .v.pins = (const struct hda_pintbl[]) {
6761 { 0x17, 0x90170112 }, /* subwoofer */
6762 { }
6763 },
6764 .chained = true,
6765 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6766 },
338cae56
DH
6767 [ALC290_FIXUP_MONO_SPEAKERS] = {
6768 .type = HDA_FIXUP_FUNC,
6769 .v.func = alc290_fixup_mono_speakers,
0f4881dc
DH
6770 },
6771 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6772 .type = HDA_FIXUP_FUNC,
6773 .v.func = alc290_fixup_mono_speakers,
338cae56
DH
6774 .chained = true,
6775 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6776 },
b67ae3f1
DH
6777 [ALC269_FIXUP_THINKPAD_ACPI] = {
6778 .type = HDA_FIXUP_FUNC,
d5a6cabf 6779 .v.func = alc_fixup_thinkpad_acpi,
09da111a
TI
6780 .chained = true,
6781 .chain_id = ALC269_FIXUP_SKU_IGNORE,
b67ae3f1 6782 },
56f27013
DH
6783 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6784 .type = HDA_FIXUP_FUNC,
6785 .v.func = alc_fixup_inv_dmic,
6786 .chained = true,
6787 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6788 },
5824ce8d 6789 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
17d30460
HW
6790 .type = HDA_FIXUP_PINS,
6791 .v.pins = (const struct hda_pintbl[]) {
6792 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6793 { }
5824ce8d
CC
6794 },
6795 .chained = true,
17d30460 6796 .chain_id = ALC255_FIXUP_HEADSET_MODE
5824ce8d 6797 },
615966ad
CC
6798 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6799 .type = HDA_FIXUP_PINS,
6800 .v.pins = (const struct hda_pintbl[]) {
6801 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6802 { }
6803 },
6804 .chained = true,
6805 .chain_id = ALC255_FIXUP_HEADSET_MODE
6806 },
9a22a8f5
KY
6807 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6808 .type = HDA_FIXUP_PINS,
6809 .v.pins = (const struct hda_pintbl[]) {
6810 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6811 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6812 { }
6813 },
6814 .chained = true,
6815 .chain_id = ALC255_FIXUP_HEADSET_MODE
6816 },
31278997
KY
6817 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6818 .type = HDA_FIXUP_PINS,
6819 .v.pins = (const struct hda_pintbl[]) {
6820 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6821 { }
6822 },
6823 .chained = true,
6824 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6825 },
9a22a8f5
KY
6826 [ALC255_FIXUP_HEADSET_MODE] = {
6827 .type = HDA_FIXUP_FUNC,
6828 .v.func = alc_fixup_headset_mode_alc255,
4a83d42a 6829 .chained = true,
b3802783 6830 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
9a22a8f5 6831 },
31278997
KY
6832 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6833 .type = HDA_FIXUP_FUNC,
6834 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6835 },
a22aa26f
KY
6836 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6837 .type = HDA_FIXUP_PINS,
6838 .v.pins = (const struct hda_pintbl[]) {
6839 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6840 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6841 { }
6842 },
6843 .chained = true,
6844 .chain_id = ALC269_FIXUP_HEADSET_MODE
6845 },
1c37c223 6846 [ALC292_FIXUP_TPT440_DOCK] = {
ec56af67 6847 .type = HDA_FIXUP_FUNC,
7f57d803 6848 .v.func = alc_fixup_tpt440_dock,
1c37c223
TI
6849 .chained = true,
6850 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6851 },
9a811230
TI
6852 [ALC292_FIXUP_TPT440] = {
6853 .type = HDA_FIXUP_FUNC,
157f0b7f 6854 .v.func = alc_fixup_disable_aamix,
9a811230
TI
6855 .chained = true,
6856 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6857 },
abaa2274 6858 [ALC283_FIXUP_HEADSET_MIC] = {
9dc12862
DD
6859 .type = HDA_FIXUP_PINS,
6860 .v.pins = (const struct hda_pintbl[]) {
6861 { 0x19, 0x04a110f0 },
6862 { },
6863 },
6864 },
b3802783 6865 [ALC255_FIXUP_MIC_MUTE_LED] = {
00ef9940 6866 .type = HDA_FIXUP_FUNC,
8a503555 6867 .v.func = alc_fixup_micmute_led,
00ef9940 6868 },
1a22e775
TI
6869 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6870 .type = HDA_FIXUP_PINS,
6871 .v.pins = (const struct hda_pintbl[]) {
6872 { 0x12, 0x90a60130 },
6873 { 0x14, 0x90170110 },
6874 { 0x17, 0x40000008 },
6875 { 0x18, 0x411111f0 },
0420694d 6876 { 0x19, 0x01a1913c },
1a22e775
TI
6877 { 0x1a, 0x411111f0 },
6878 { 0x1b, 0x411111f0 },
6879 { 0x1d, 0x40f89b2d },
6880 { 0x1e, 0x411111f0 },
6881 { 0x21, 0x0321101f },
6882 { },
6883 },
6884 },
7a5255f1
DH
6885 [ALC280_FIXUP_HP_GPIO4] = {
6886 .type = HDA_FIXUP_FUNC,
6887 .v.func = alc280_fixup_hp_gpio4,
6888 },
eaa8e5ef
KY
6889 [ALC286_FIXUP_HP_GPIO_LED] = {
6890 .type = HDA_FIXUP_FUNC,
6891 .v.func = alc286_fixup_hp_gpio_led,
6892 },
33f4acd3
DH
6893 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6894 .type = HDA_FIXUP_FUNC,
6895 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6896 },
b4b33f9d
TC
6897 [ALC280_FIXUP_HP_DOCK_PINS] = {
6898 .type = HDA_FIXUP_PINS,
6899 .v.pins = (const struct hda_pintbl[]) {
6900 { 0x1b, 0x21011020 }, /* line-out */
6901 { 0x1a, 0x01a1903c }, /* headset mic */
6902 { 0x18, 0x2181103f }, /* line-in */
6903 { },
6904 },
6905 .chained = true,
6906 .chain_id = ALC280_FIXUP_HP_GPIO4
6907 },
04d5466a
JK
6908 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6909 .type = HDA_FIXUP_PINS,
6910 .v.pins = (const struct hda_pintbl[]) {
6911 { 0x1b, 0x21011020 }, /* line-out */
6912 { 0x18, 0x2181103f }, /* line-in */
6913 { },
6914 },
6915 .chained = true,
6916 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6917 },
98973f2f
KP
6918 [ALC280_FIXUP_HP_9480M] = {
6919 .type = HDA_FIXUP_FUNC,
6920 .v.func = alc280_fixup_hp_9480m,
6921 },
e1e62b98
KY
6922 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6923 .type = HDA_FIXUP_FUNC,
6924 .v.func = alc_fixup_headset_mode_dell_alc288,
6925 .chained = true,
b3802783 6926 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
e1e62b98
KY
6927 },
6928 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6929 .type = HDA_FIXUP_PINS,
6930 .v.pins = (const struct hda_pintbl[]) {
6931 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6932 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6933 { }
6934 },
6935 .chained = true,
6936 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6937 },
831bfdf9
HW
6938 [ALC288_FIXUP_DISABLE_AAMIX] = {
6939 .type = HDA_FIXUP_FUNC,
6940 .v.func = alc_fixup_disable_aamix,
6941 .chained = true,
d44a6864 6942 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
831bfdf9
HW
6943 },
6944 [ALC288_FIXUP_DELL_XPS_13] = {
6945 .type = HDA_FIXUP_FUNC,
6946 .v.func = alc_fixup_dell_xps13,
6947 .chained = true,
6948 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6949 },
8b99aba7
TI
6950 [ALC292_FIXUP_DISABLE_AAMIX] = {
6951 .type = HDA_FIXUP_FUNC,
6952 .v.func = alc_fixup_disable_aamix,
831bfdf9
HW
6953 .chained = true,
6954 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8b99aba7 6955 },
c04017ea
DH
6956 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6957 .type = HDA_FIXUP_FUNC,
6958 .v.func = alc_fixup_disable_aamix,
6959 .chained = true,
6960 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6961 },
5fab5829 6962 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8b99aba7
TI
6963 .type = HDA_FIXUP_FUNC,
6964 .v.func = alc_fixup_dell_xps13,
6965 .chained = true,
6966 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6967 },
5fab5829
TI
6968 [ALC292_FIXUP_DELL_E7X] = {
6969 .type = HDA_FIXUP_FUNC,
8a503555 6970 .v.func = alc_fixup_micmute_led,
5fab5829
TI
6971 /* micmute fixup must be applied at last */
6972 .chained_before = true,
6973 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
6974 },
54324221
JM
6975 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
6976 .type = HDA_FIXUP_PINS,
6977 .v.pins = (const struct hda_pintbl[]) {
6978 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
6979 { }
6980 },
6981 .chained_before = true,
6982 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6983 },
977e6276
KY
6984 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6985 .type = HDA_FIXUP_PINS,
6986 .v.pins = (const struct hda_pintbl[]) {
6987 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6988 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6989 { }
6990 },
6991 .chained = true,
6992 .chain_id = ALC269_FIXUP_HEADSET_MODE
6993 },
2f726aec
HW
6994 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6995 .type = HDA_FIXUP_PINS,
6996 .v.pins = (const struct hda_pintbl[]) {
6997 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6998 { }
6999 },
7000 .chained = true,
7001 .chain_id = ALC269_FIXUP_HEADSET_MODE
7002 },
6ed1131f
KY
7003 [ALC275_FIXUP_DELL_XPS] = {
7004 .type = HDA_FIXUP_VERBS,
7005 .v.verbs = (const struct hda_verb[]) {
7006 /* Enables internal speaker */
7007 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7008 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7009 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7010 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7011 {}
7012 }
7013 },
23adc192
HW
7014 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7015 .type = HDA_FIXUP_FUNC,
7016 .v.func = alc_fixup_disable_aamix,
7017 .chained = true,
7018 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7019 },
3694cb29
K
7020 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7021 .type = HDA_FIXUP_FUNC,
7022 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7023 },
3b43b71f
KHF
7024 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7025 .type = HDA_FIXUP_FUNC,
7026 .v.func = alc_fixup_disable_aamix,
7027 .chained = true,
7028 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7029 },
d1dd4211
KY
7030 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7031 .type = HDA_FIXUP_FUNC,
7032 .v.func = alc_fixup_disable_mic_vref,
7033 .chained = true,
7034 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7035 },
2ae95577
DH
7036 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7037 .type = HDA_FIXUP_VERBS,
7038 .v.verbs = (const struct hda_verb[]) {
7039 /* Disable pass-through path for FRONT 14h */
7040 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7041 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7042 {}
7043 },
7044 .chained = true,
d1dd4211 7045 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
2ae95577 7046 },
f883982d
TI
7047 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7048 .type = HDA_FIXUP_FUNC,
7049 .v.func = alc_fixup_disable_aamix,
7050 .chained = true,
7051 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7052 },
e549d190
HW
7053 [ALC221_FIXUP_HP_FRONT_MIC] = {
7054 .type = HDA_FIXUP_PINS,
7055 .v.pins = (const struct hda_pintbl[]) {
7056 { 0x19, 0x02a19020 }, /* Front Mic */
7057 { }
7058 },
7059 },
c636b95e
SE
7060 [ALC292_FIXUP_TPT460] = {
7061 .type = HDA_FIXUP_FUNC,
7062 .v.func = alc_fixup_tpt440_dock,
7063 .chained = true,
7064 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7065 },
dd9aa335
HW
7066 [ALC298_FIXUP_SPK_VOLUME] = {
7067 .type = HDA_FIXUP_FUNC,
7068 .v.func = alc298_fixup_speaker_volume,
59ec4b57 7069 .chained = true,
2f726aec 7070 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
dd9aa335 7071 },
e312a869
TI
7072 [ALC295_FIXUP_DISABLE_DAC3] = {
7073 .type = HDA_FIXUP_FUNC,
7074 .v.func = alc295_fixup_disable_dac3,
7075 },
d2cd795c
JK
7076 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7077 .type = HDA_FIXUP_FUNC,
7078 .v.func = alc285_fixup_speaker2_to_dac1,
c37c0ab0
HW
7079 .chained = true,
7080 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
d2cd795c 7081 },
fd06c77e
KHF
7082 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7083 .type = HDA_FIXUP_PINS,
7084 .v.pins = (const struct hda_pintbl[]) {
7085 { 0x1b, 0x90170151 },
7086 { }
7087 },
7088 .chained = true,
7089 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7090 },
823ff161
GM
7091 [ALC269_FIXUP_ATIV_BOOK_8] = {
7092 .type = HDA_FIXUP_FUNC,
7093 .v.func = alc_fixup_auto_mute_via_amp,
7094 .chained = true,
7095 .chain_id = ALC269_FIXUP_NO_SHUTUP
7096 },
9eb5d0e6
KY
7097 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7098 .type = HDA_FIXUP_PINS,
7099 .v.pins = (const struct hda_pintbl[]) {
7100 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7101 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7102 { }
7103 },
7104 .chained = true,
7105 .chain_id = ALC269_FIXUP_HEADSET_MODE
7106 },
c1732ede
CC
7107 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7108 .type = HDA_FIXUP_FUNC,
7109 .v.func = alc_fixup_headset_mode,
7110 },
7111 [ALC256_FIXUP_ASUS_MIC] = {
7112 .type = HDA_FIXUP_PINS,
7113 .v.pins = (const struct hda_pintbl[]) {
7114 { 0x13, 0x90a60160 }, /* use as internal mic */
7115 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7116 { }
7117 },
7118 .chained = true,
7119 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7120 },
eeed4cd1 7121 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
ae065f1c
TI
7122 .type = HDA_FIXUP_FUNC,
7123 /* Set up GPIO2 for the speaker amp */
7124 .v.func = alc_fixup_gpio4,
eeed4cd1 7125 },
216d7aeb
CC
7126 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7127 .type = HDA_FIXUP_PINS,
7128 .v.pins = (const struct hda_pintbl[]) {
7129 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7130 { }
7131 },
7132 .chained = true,
7133 .chain_id = ALC269_FIXUP_HEADSET_MIC
7134 },
7135 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7136 .type = HDA_FIXUP_VERBS,
7137 .v.verbs = (const struct hda_verb[]) {
7138 /* Enables internal speaker */
7139 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7140 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7141 {}
7142 },
7143 .chained = true,
7144 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7145 },
ca169cc2
KY
7146 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7147 .type = HDA_FIXUP_FUNC,
7148 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
f73bbf63
KHF
7149 .chained = true,
7150 .chain_id = ALC269_FIXUP_GPIO2
ca169cc2 7151 },
ea5c7eba
JHP
7152 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7153 .type = HDA_FIXUP_VERBS,
7154 .v.verbs = (const struct hda_verb[]) {
7155 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7156 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7157 { }
7158 },
7159 .chained = true,
7160 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7161 },
f33f79f3
HW
7162 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7163 .type = HDA_FIXUP_PINS,
7164 .v.pins = (const struct hda_pintbl[]) {
7165 /* Change the mic location from front to right, otherwise there are
7166 two front mics with the same name, pulseaudio can't handle them.
7167 This is just a temporary workaround, after applying this fixup,
7168 there will be one "Front Mic" and one "Mic" in this machine.
7169 */
7170 { 0x1a, 0x04a19040 },
7171 { }
7172 },
7173 },
5f364135
KY
7174 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7175 .type = HDA_FIXUP_PINS,
7176 .v.pins = (const struct hda_pintbl[]) {
7177 { 0x16, 0x0101102f }, /* Rear Headset HP */
7178 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7179 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7180 { 0x1b, 0x02011020 },
7181 { }
7182 },
7183 .chained = true,
52e4e368
KHF
7184 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7185 },
7186 [ALC225_FIXUP_S3_POP_NOISE] = {
7187 .type = HDA_FIXUP_FUNC,
7188 .v.func = alc225_fixup_s3_pop_noise,
7189 .chained = true,
5f364135
KY
7190 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7191 },
b84e8436
PH
7192 [ALC700_FIXUP_INTEL_REFERENCE] = {
7193 .type = HDA_FIXUP_VERBS,
7194 .v.verbs = (const struct hda_verb[]) {
7195 /* Enables internal speaker */
7196 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7197 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7198 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7199 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7200 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7201 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7202 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7203 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7204 {}
7205 }
7206 },
92266651
KY
7207 [ALC274_FIXUP_DELL_BIND_DACS] = {
7208 .type = HDA_FIXUP_FUNC,
7209 .v.func = alc274_fixup_bind_dacs,
7210 .chained = true,
7211 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7212 },
7213 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7214 .type = HDA_FIXUP_PINS,
7215 .v.pins = (const struct hda_pintbl[]) {
7216 { 0x1b, 0x0401102f },
7217 { }
7218 },
7219 .chained = true,
7220 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7221 },
399c01aa 7222 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
61fcf8ec
KY
7223 .type = HDA_FIXUP_FUNC,
7224 .v.func = alc_fixup_tpt470_dock,
7225 .chained = true,
7226 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7227 },
399c01aa
TI
7228 [ALC298_FIXUP_TPT470_DOCK] = {
7229 .type = HDA_FIXUP_FUNC,
7230 .v.func = alc_fixup_tpt470_dacs,
7231 .chained = true,
7232 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7233 },
ae104a21
KY
7234 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7235 .type = HDA_FIXUP_PINS,
7236 .v.pins = (const struct hda_pintbl[]) {
7237 { 0x14, 0x0201101f },
7238 { }
7239 },
7240 .chained = true,
7241 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7242 },
f0ba9d69
KY
7243 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7244 .type = HDA_FIXUP_PINS,
7245 .v.pins = (const struct hda_pintbl[]) {
7246 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7247 { }
7248 },
3ce0d5aa
HW
7249 .chained = true,
7250 .chain_id = ALC269_FIXUP_HEADSET_MIC
f0ba9d69 7251 },
bbf8ff6b
TB
7252 [ALC295_FIXUP_HP_X360] = {
7253 .type = HDA_FIXUP_FUNC,
7254 .v.func = alc295_fixup_hp_top_speakers,
7255 .chained = true,
7256 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8a328ac1
KY
7257 },
7258 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7259 .type = HDA_FIXUP_PINS,
7260 .v.pins = (const struct hda_pintbl[]) {
7261 { 0x19, 0x0181313f},
7262 { }
7263 },
7264 .chained = true,
7265 .chain_id = ALC269_FIXUP_HEADSET_MIC
7266 },
c4cfcf6f
HW
7267 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7268 .type = HDA_FIXUP_FUNC,
7269 .v.func = alc285_fixup_invalidate_dacs,
6ba189c5
HW
7270 .chained = true,
7271 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
c4cfcf6f 7272 },
e8ed64b0
GKK
7273 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7274 .type = HDA_FIXUP_FUNC,
7275 .v.func = alc_fixup_auto_mute_via_amp,
7276 },
33aaebd4
CC
7277 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7278 .type = HDA_FIXUP_PINS,
7279 .v.pins = (const struct hda_pintbl[]) {
7280 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7281 { }
7282 },
7283 .chained = true,
7284 .chain_id = ALC269_FIXUP_HEADSET_MIC
7285 },
d8ae458e
CC
7286 [ALC294_FIXUP_ASUS_MIC] = {
7287 .type = HDA_FIXUP_PINS,
7288 .v.pins = (const struct hda_pintbl[]) {
7289 { 0x13, 0x90a60160 }, /* use as internal mic */
7290 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7291 { }
7292 },
7293 .chained = true,
ef9ddb9d 7294 .chain_id = ALC269_FIXUP_HEADSET_MIC
d8ae458e 7295 },
4e051106
JHP
7296 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7297 .type = HDA_FIXUP_PINS,
7298 .v.pins = (const struct hda_pintbl[]) {
82b01149 7299 { 0x19, 0x01a1103c }, /* use as headset mic */
4e051106
JHP
7300 { }
7301 },
7302 .chained = true,
ef9ddb9d 7303 .chain_id = ALC269_FIXUP_HEADSET_MIC
4e051106
JHP
7304 },
7305 [ALC294_FIXUP_ASUS_SPK] = {
7306 .type = HDA_FIXUP_VERBS,
7307 .v.verbs = (const struct hda_verb[]) {
7308 /* Set EAPD high */
7309 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7310 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
473fbe13
KY
7311 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7312 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
4e051106
JHP
7313 { }
7314 },
7315 .chained = true,
7316 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7317 },
c8a9afa6 7318 [ALC295_FIXUP_CHROME_BOOK] = {
e854747d 7319 .type = HDA_FIXUP_FUNC,
c8a9afa6 7320 .v.func = alc295_fixup_chromebook,
8983eb60
KY
7321 .chained = true,
7322 .chain_id = ALC225_FIXUP_HEADSET_JACK
7323 },
7324 [ALC225_FIXUP_HEADSET_JACK] = {
7325 .type = HDA_FIXUP_FUNC,
7326 .v.func = alc_fixup_headset_jack,
e854747d 7327 },
89e3a568
JS
7328 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7329 .type = HDA_FIXUP_PINS,
7330 .v.pins = (const struct hda_pintbl[]) {
7331 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7332 { }
7333 },
7334 .chained = true,
7335 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7336 },
c8c6ee61
HW
7337 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7338 .type = HDA_FIXUP_VERBS,
7339 .v.verbs = (const struct hda_verb[]) {
7340 /* Disable PCBEEP-IN passthrough */
7341 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7342 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7343 { }
7344 },
7345 .chained = true,
7346 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7347 },
cbc05fd6
JHP
7348 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7349 .type = HDA_FIXUP_PINS,
7350 .v.pins = (const struct hda_pintbl[]) {
7351 { 0x19, 0x03a11130 },
7352 { 0x1a, 0x90a60140 }, /* use as internal mic */
7353 { }
7354 },
7355 .chained = true,
7356 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7357 },
136824ef
KY
7358 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7359 .type = HDA_FIXUP_PINS,
7360 .v.pins = (const struct hda_pintbl[]) {
7361 { 0x16, 0x01011020 }, /* Rear Line out */
7362 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7363 { }
7364 },
7365 .chained = true,
7366 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7367 },
7368 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7369 .type = HDA_FIXUP_FUNC,
7370 .v.func = alc_fixup_auto_mute_via_amp,
7371 .chained = true,
7372 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7373 },
7374 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7375 .type = HDA_FIXUP_FUNC,
7376 .v.func = alc_fixup_disable_mic_vref,
7377 .chained = true,
7378 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7379 },
667a8f73
JHP
7380 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7381 .type = HDA_FIXUP_VERBS,
7382 .v.verbs = (const struct hda_verb[]) {
7383 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7384 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7385 { }
7386 },
7387 .chained = true,
7388 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7389 },
8c8967a7
DD
7390 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7391 .type = HDA_FIXUP_PINS,
7392 .v.pins = (const struct hda_pintbl[]) {
7393 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7394 { }
7395 },
7396 .chained = true,
7397 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7398 },
e1037354
JHP
7399 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7400 .type = HDA_FIXUP_PINS,
7401 .v.pins = (const struct hda_pintbl[]) {
7402 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7403 { }
7404 },
7405 .chained = true,
7406 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7407 },
e2a829b3
BR
7408 [ALC299_FIXUP_PREDATOR_SPK] = {
7409 .type = HDA_FIXUP_PINS,
7410 .v.pins = (const struct hda_pintbl[]) {
7411 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7412 { }
7413 }
7414 },
bd9c10bc 7415 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
60083f9e
JHP
7416 .type = HDA_FIXUP_PINS,
7417 .v.pins = (const struct hda_pintbl[]) {
bd9c10bc
JMG
7418 { 0x19, 0x04a11040 },
7419 { 0x21, 0x04211020 },
60083f9e
JHP
7420 { }
7421 },
7422 .chained = true,
bd9c10bc 7423 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
60083f9e 7424 },
e79c2269 7425 [ALC289_FIXUP_DELL_SPK2] = {
bd9c10bc
JMG
7426 .type = HDA_FIXUP_PINS,
7427 .v.pins = (const struct hda_pintbl[]) {
e79c2269 7428 { 0x17, 0x90170130 }, /* bass spk */
bd9c10bc
JMG
7429 { }
7430 },
7431 .chained = true,
e79c2269 7432 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
bd9c10bc 7433 },
e79c2269
KY
7434 [ALC289_FIXUP_DUAL_SPK] = {
7435 .type = HDA_FIXUP_FUNC,
7436 .v.func = alc285_fixup_speaker2_to_dac1,
7437 .chained = true,
7438 .chain_id = ALC289_FIXUP_DELL_SPK2
7439 },
48e01504
CC
7440 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7441 .type = HDA_FIXUP_FUNC,
7442 .v.func = alc285_fixup_speaker2_to_dac1,
7443 .chained = true,
7444 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7445 },
7446 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
436e2550
JHP
7447 .type = HDA_FIXUP_FUNC,
7448 /* The GPIO must be pulled to initialize the AMP */
7449 .v.func = alc_fixup_gpio4,
7450 .chained = true,
48e01504 7451 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
436e2550 7452 },
6a6660d0
TI
7453 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7454 .type = HDA_FIXUP_FUNC,
7455 .v.func = alc285_fixup_thinkpad_x1_gen7,
7456 .chained = true,
7457 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7458 },
76f7dec0
KY
7459 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7460 .type = HDA_FIXUP_FUNC,
7461 .v.func = alc_fixup_headset_jack,
7462 .chained = true,
6a6660d0 7463 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
76f7dec0 7464 },
8b33a134
JHP
7465 [ALC294_FIXUP_ASUS_HPE] = {
7466 .type = HDA_FIXUP_VERBS,
7467 .v.verbs = (const struct hda_verb[]) {
7468 /* Set EAPD high */
7469 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7470 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7471 { }
7472 },
7473 .chained = true,
7474 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7475 },
c3cdf189
LJ
7476 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7477 .type = HDA_FIXUP_PINS,
7478 .v.pins = (const struct hda_pintbl[]) {
7479 { 0x19, 0x03a11050 }, /* front HP mic */
7480 { 0x1a, 0x01a11830 }, /* rear external mic */
7481 { 0x21, 0x03211020 }, /* front HP out */
7482 { }
7483 },
7484 .chained = true,
7485 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7486 },
7487 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
7488 .type = HDA_FIXUP_VERBS,
7489 .v.verbs = (const struct hda_verb[]) {
7490 /* set 0x15 to HP-OUT ctrl */
7491 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7492 /* unmute the 0x15 amp */
7493 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7494 { }
7495 },
7496 .chained = true,
7497 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
7498 },
7499 [ALC294_FIXUP_ASUS_GX502_HP] = {
7500 .type = HDA_FIXUP_FUNC,
7501 .v.func = alc294_fixup_gx502_hp,
7502 },
1b94e59d
TI
7503 [ALC294_FIXUP_ASUS_COEF_1B] = {
7504 .type = HDA_FIXUP_VERBS,
7505 .v.verbs = (const struct hda_verb[]) {
7506 /* Set bit 10 to correct noisy output after reboot from
7507 * Windows 10 (due to pop noise reduction?)
7508 */
7509 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
7510 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
7511 { }
7512 },
7513 },
f5a88b0a
KHF
7514 [ALC285_FIXUP_HP_GPIO_LED] = {
7515 .type = HDA_FIXUP_FUNC,
7516 .v.func = alc285_fixup_hp_gpio_led,
7517 },
431e76c3
KY
7518 [ALC285_FIXUP_HP_MUTE_LED] = {
7519 .type = HDA_FIXUP_FUNC,
7520 .v.func = alc285_fixup_hp_mute_led,
7521 },
24164f43
KY
7522 [ALC236_FIXUP_HP_MUTE_LED] = {
7523 .type = HDA_FIXUP_FUNC,
7524 .v.func = alc236_fixup_hp_mute_led,
7525 },
14425f1f
MP
7526 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
7527 .type = HDA_FIXUP_VERBS,
7528 .v.verbs = (const struct hda_verb[]) {
7529 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
7530 { }
7531 },
7532 },
9e43342b
CC
7533 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7534 .type = HDA_FIXUP_PINS,
7535 .v.pins = (const struct hda_pintbl[]) {
7536 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7537 { }
7538 },
7539 .chained = true,
7540 .chain_id = ALC269_FIXUP_HEADSET_MODE
7541 },
8eae7e9b
JHP
7542 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
7543 .type = HDA_FIXUP_PINS,
7544 .v.pins = (const struct hda_pintbl[]) {
7545 { 0x14, 0x90100120 }, /* use as internal speaker */
7546 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
7547 { 0x1a, 0x01011020 }, /* use as line out */
7548 { },
7549 },
7550 .chained = true,
7551 .chain_id = ALC269_FIXUP_HEADSET_MIC
7552 },
6e15d126
JHP
7553 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
7554 .type = HDA_FIXUP_PINS,
7555 .v.pins = (const struct hda_pintbl[]) {
7556 { 0x18, 0x02a11030 }, /* use as headset mic */
7557 { }
7558 },
7559 .chained = true,
7560 .chain_id = ALC269_FIXUP_HEADSET_MIC
7561 },
781c90c0
JHP
7562 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
7563 .type = HDA_FIXUP_PINS,
7564 .v.pins = (const struct hda_pintbl[]) {
7565 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
7566 { }
7567 },
7568 .chained = true,
7569 .chain_id = ALC269_FIXUP_HEADSET_MIC
7570 },
293a92c1 7571 [ALC289_FIXUP_ASUS_GA401] = {
ff53664d
AS
7572 .type = HDA_FIXUP_PINS,
7573 .v.pins = (const struct hda_pintbl[]) {
7574 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7575 { }
7576 },
7577 },
4b43d05a
AS
7578 [ALC289_FIXUP_ASUS_GA502] = {
7579 .type = HDA_FIXUP_PINS,
7580 .v.pins = (const struct hda_pintbl[]) {
7581 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7582 { }
7583 },
7584 },
f50a121d
JHP
7585 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
7586 .type = HDA_FIXUP_PINS,
7587 .v.pins = (const struct hda_pintbl[]) {
7588 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
7589 { }
7590 },
7591 .chained = true,
7592 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7593 },
56496253
KY
7594 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
7595 .type = HDA_FIXUP_FUNC,
7596 .v.func = alc285_fixup_hp_gpio_amp_init,
7597 .chained = true,
7598 .chain_id = ALC285_FIXUP_HP_GPIO_LED
7599 },
f1ec5be1
HC
7600 [ALC269_FIXUP_CZC_B20] = {
7601 .type = HDA_FIXUP_PINS,
7602 .v.pins = (const struct hda_pintbl[]) {
7603 { 0x12, 0x411111f0 },
7604 { 0x14, 0x90170110 }, /* speaker */
7605 { 0x15, 0x032f1020 }, /* HP out */
7606 { 0x17, 0x411111f0 },
7607 { 0x18, 0x03ab1040 }, /* mic */
7608 { 0x19, 0xb7a7013f },
7609 { 0x1a, 0x0181305f },
7610 { 0x1b, 0x411111f0 },
7611 { 0x1d, 0x411111f0 },
7612 { 0x1e, 0x411111f0 },
7613 { }
7614 },
7615 .chain_id = ALC269_FIXUP_DMIC,
7616 },
7617 [ALC269_FIXUP_CZC_TMI] = {
7618 .type = HDA_FIXUP_PINS,
7619 .v.pins = (const struct hda_pintbl[]) {
7620 { 0x12, 0x4000c000 },
7621 { 0x14, 0x90170110 }, /* speaker */
7622 { 0x15, 0x0421401f }, /* HP out */
7623 { 0x17, 0x411111f0 },
7624 { 0x18, 0x04a19020 }, /* mic */
7625 { 0x19, 0x411111f0 },
7626 { 0x1a, 0x411111f0 },
7627 { 0x1b, 0x411111f0 },
7628 { 0x1d, 0x40448505 },
7629 { 0x1e, 0x411111f0 },
7630 { 0x20, 0x8000ffff },
7631 { }
7632 },
7633 .chain_id = ALC269_FIXUP_DMIC,
7634 },
7635 [ALC269_FIXUP_CZC_L101] = {
7636 .type = HDA_FIXUP_PINS,
7637 .v.pins = (const struct hda_pintbl[]) {
7638 { 0x12, 0x40000000 },
7639 { 0x14, 0x01014010 }, /* speaker */
7640 { 0x15, 0x411111f0 }, /* HP out */
7641 { 0x16, 0x411111f0 },
7642 { 0x18, 0x01a19020 }, /* mic */
7643 { 0x19, 0x02a19021 },
7644 { 0x1a, 0x0181302f },
7645 { 0x1b, 0x0221401f },
7646 { 0x1c, 0x411111f0 },
7647 { 0x1d, 0x4044c601 },
7648 { 0x1e, 0x411111f0 },
7649 { }
7650 },
7651 .chain_id = ALC269_FIXUP_DMIC,
7652 },
7653 [ALC269_FIXUP_LEMOTE_A1802] = {
7654 .type = HDA_FIXUP_PINS,
7655 .v.pins = (const struct hda_pintbl[]) {
7656 { 0x12, 0x40000000 },
7657 { 0x14, 0x90170110 }, /* speaker */
7658 { 0x17, 0x411111f0 },
7659 { 0x18, 0x03a19040 }, /* mic1 */
7660 { 0x19, 0x90a70130 }, /* mic2 */
7661 { 0x1a, 0x411111f0 },
7662 { 0x1b, 0x411111f0 },
7663 { 0x1d, 0x40489d2d },
7664 { 0x1e, 0x411111f0 },
7665 { 0x20, 0x0003ffff },
7666 { 0x21, 0x03214020 },
7667 { }
7668 },
7669 .chain_id = ALC269_FIXUP_DMIC,
7670 },
7671 [ALC269_FIXUP_LEMOTE_A190X] = {
7672 .type = HDA_FIXUP_PINS,
7673 .v.pins = (const struct hda_pintbl[]) {
7674 { 0x14, 0x99130110 }, /* speaker */
7675 { 0x15, 0x0121401f }, /* HP out */
7676 { 0x18, 0x01a19c20 }, /* rear mic */
7677 { 0x19, 0x99a3092f }, /* front mic */
7678 { 0x1b, 0x0201401f }, /* front lineout */
7679 { }
7680 },
7681 .chain_id = ALC269_FIXUP_DMIC,
7682 },
e2d2fded
KHF
7683 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
7684 .type = HDA_FIXUP_PINS,
7685 .v.pins = (const struct hda_pintbl[]) {
7686 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7687 { }
7688 },
7689 .chained = true,
7690 .chain_id = ALC269_FIXUP_HEADSET_MODE
7691 },
fc19d559
HW
7692 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
7693 .type = HDA_FIXUP_VERBS,
7694 .v.verbs = (const struct hda_verb[]) {
7695 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7696 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7697 { }
7698 },
7699 .chained = true,
7700 .chain_id = ALC289_FIXUP_ASUS_GA401
7701 },
13468bfa
HW
7702 [ALC274_FIXUP_HP_MIC] = {
7703 .type = HDA_FIXUP_VERBS,
7704 .v.verbs = (const struct hda_verb[]) {
7705 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7706 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7707 { }
7708 },
7709 },
8a8de09c
KY
7710 [ALC274_FIXUP_HP_HEADSET_MIC] = {
7711 .type = HDA_FIXUP_FUNC,
7712 .v.func = alc274_fixup_hp_headset_mic,
7713 .chained = true,
7714 .chain_id = ALC274_FIXUP_HP_MIC
7715 },
ef9ce66f
KY
7716 [ALC256_FIXUP_ASUS_HPE] = {
7717 .type = HDA_FIXUP_VERBS,
7718 .v.verbs = (const struct hda_verb[]) {
7719 /* Set EAPD high */
7720 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7721 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
7722 { }
7723 },
7724 .chained = true,
7725 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7726 },
446b8185
KY
7727 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
7728 .type = HDA_FIXUP_FUNC,
7729 .v.func = alc_fixup_headset_jack,
7730 .chained = true,
7731 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7732 },
a0ccbc53
KY
7733 [ALC287_FIXUP_HP_GPIO_LED] = {
7734 .type = HDA_FIXUP_FUNC,
7735 .v.func = alc287_fixup_hp_gpio_led,
7736 },
9e885770
KY
7737 [ALC256_FIXUP_HP_HEADSET_MIC] = {
7738 .type = HDA_FIXUP_FUNC,
7739 .v.func = alc274_fixup_hp_headset_mic,
7740 },
f1d4e28b
KY
7741};
7742
1d045db9 7743static const struct snd_pci_quirk alc269_fixup_tbl[] = {
a6b92b66 7744 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
693b613d
DH
7745 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
7746 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
aaedfb47 7747 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
7819717b
TI
7748 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
7749 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
aaedfb47
DH
7750 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
7751 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
02322ac9 7752 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
b1e8972e 7753 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
1a22e775 7754 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
705b65f1 7755 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6e15d126 7756 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
b9c2fa52 7757 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
c7531e31
CC
7758 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
7759 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
e2a829b3 7760 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
8eae7e9b 7761 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
781c90c0 7762 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
667a8f73
JHP
7763 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7764 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7765 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
2733cceb 7766 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
ea5c7eba 7767 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
cbc05fd6 7768 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
f50a121d 7769 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
aaedfb47 7770 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6ed1131f 7771 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
86f799b8 7772 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
cf52103a 7773 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8b99aba7
TI
7774 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
7775 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
0f4881dc 7776 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
73bdd597
DH
7777 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7778 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7779 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
0f4881dc
DH
7780 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
7781 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
98070576 7782 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
4275554d 7783 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
0f4881dc 7784 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
a22aa26f
KY
7785 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7786 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
831bfdf9 7787 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
afecb146 7788 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
3a05d12f 7789 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8b72415d 7790 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
b734304f
KY
7791 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7792 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
c04017ea
DH
7793 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7794 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7795 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7796 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7797 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
fd06c77e 7798 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
3b43b71f 7799 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
c0ca5ece 7800 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
709ae62e 7801 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
dd9aa335 7802 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
e312a869 7803 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
493de342 7804 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
5f364135 7805 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
40e2c4e5
KY
7806 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
7807 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
f0ba9d69
KY
7808 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
7809 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
ae104a21 7810 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
136824ef 7811 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
da484d00 7812 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
c2a7c55a 7813 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
e79c2269
KY
7814 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
7815 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
78def224
KY
7816 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
7817 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
a22aa26f
KY
7818 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7819 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
08fb0d0e 7820 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9f5c6faf 7821 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8e35cd4a 7822 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
33f4acd3 7823 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
c60666bd 7824 /* ALC282 */
7976eb49 7825 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 7826 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 7827 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9c5dc3bf
KY
7828 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7829 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7830 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7831 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf 7832 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
c60666bd 7833 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7834 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7835 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 7836 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
eaa8e5ef 7837 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
b4b33f9d 7838 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
3271cb22 7839 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
c60666bd 7840 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7841 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7842 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7843 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 7844 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
98973f2f 7845 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9c5dc3bf
KY
7846 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7847 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 7848 /* ALC290 */
9c5dc3bf 7849 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 7850 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 7851 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf
KY
7852 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7853 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7854 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7855 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7856 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 7857 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
04d5466a 7858 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
c60666bd 7859 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7860 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7861 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7862 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9c5dc3bf
KY
7863 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7864 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 7865 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 7866 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 7867 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 7868 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7869 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7870 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7871 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7872 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 7873 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164
KY
7874 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7875 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7876 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7877 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
f883982d 7878 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
167897f4
JK
7879 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7880 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
563785ed 7881 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
e549d190 7882 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
bbf8ff6b 7883 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
167897f4
JK
7884 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7885 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
56e40eb6 7886 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
190d0381 7887 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
d33cd42d 7888 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
b2c22910
KHF
7889 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
7890 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
56496253 7891 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
08befca4 7892 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
431e76c3 7893 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
24164f43 7894 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
a0ccbc53
KY
7895 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
7896 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
c1732ede 7897 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
7bba2157 7898 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
3e0d611b 7899 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9cf6533e 7900 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
c1732ede 7901 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
4eab0ea1 7902 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3e0d611b 7903 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4eab0ea1
TI
7904 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7905 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
7906 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
c1732ede
CC
7907 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
7908 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
7909 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
2cede303 7910 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
23870831 7911 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
3e0d611b 7912 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
48e01504 7913 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
8c8967a7 7914 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
4963d66b 7915 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
158ae2f5 7916 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
8b33a134 7917 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
7900e817 7918 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
017f2a10 7919 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
28e8af8a 7920 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
1b94e59d 7921 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
693b613d 7922 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
615966ad 7923 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1 7924 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
c1732ede 7925 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
ef9ce66f 7926 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
4b43d05a 7927 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
293a92c1 7928 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
c3cdf189 7929 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
eeed4cd1 7930 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
adabb3ec
TI
7931 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
7932 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
7933 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
7934 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
d240d1dc 7935 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
f88abaa0 7936 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
88cfcf86 7937 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
1d045db9
TI
7938 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
7939 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
7940 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
e9bd7d5c 7941 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
24519911 7942 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4df3fd17 7943 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
cc7016ab 7944 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
88776f36 7945 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
fdcc968a 7946 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
2041d564 7947 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
b84e8436 7948 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
6fa38ef1 7949 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
0fca97a2 7950 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
a33cc48d 7951 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
14425f1f
MP
7952 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7953 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
f70fff83 7954 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8bcea6cb
AC
7955 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7956 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
823ff161 7957 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
568e4e82 7958 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
abaa2274
AA
7959 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
7960 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8cd65271 7961 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
b5acfe15 7962 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
89e3a568 7963 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
7964 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7965 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7966 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7967 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7968 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7969 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7970 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7971 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7972 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7973 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7974 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7975 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7976 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7977 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7978 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7979 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7980 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7981 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7982 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7983 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7984 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7985 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7986 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7987 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7988 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7989 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7990 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
80a5052d 7991 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
891afcf2
JS
7992 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7993 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
7994 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
b5acfe15
PH
7995 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7996 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7997 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7998 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7999 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8000 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8001 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8002 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8003 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8004 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
ca169cc2 8005 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
ef0b3203 8006 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
1d045db9
TI
8007 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8008 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8009 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8010 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8011 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
b590b38c 8012 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
c8415a48 8013 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
84f98fdf 8014 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
4407be6b 8015 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
108cc108 8016 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
aaedfb47 8017 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9a811230 8018 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
1c37c223 8019 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
a12137e7 8020 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
59a51a6b 8021 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
6d16941a 8022 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7c21539c 8023 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
a4a9e082 8024 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
b6903c0e 8025 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
d05ea7da 8026 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
c0278669 8027 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
61fcf8ec
KY
8028 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8029 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
dab38e43 8030 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
c636b95e 8031 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
8032 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8033 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8034 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
e4c07b3b 8035 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
8036 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8037 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8038 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
85981dfd 8039 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9774dc21 8040 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
ca707b3f 8041 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
446b8185
KY
8042 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8043 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
3694cb29 8044 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6ef2f68f 8045 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
f33f79f3 8046 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
bef33e19 8047 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
e41fc8c5 8048 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
65811834 8049 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8da5bbfc 8050 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
2a36c16e 8051 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8a6c55d0
AM
8052 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8053 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
56f27013 8054 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
fedb2245 8055 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
56df90b6 8056 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
a4a9e082 8057 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
1bb3e062 8058 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
c497d9f9 8059 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
cd5302c0 8060 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
f2aa1110 8061 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
80b311d3 8062 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
09ea9976 8063 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
037e1197 8064 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
23adc192 8065 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
0f087ee3 8066 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9cd25743 8067 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
0f087ee3 8068 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
61fcf8ec
KY
8069 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8070 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8071 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
cd5302c0 8072 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
61fcf8ec
KY
8073 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8074 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
012e7eb1 8075 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
1d045db9 8076 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
0fbf21c3 8077 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
f1ec5be1
HC
8078 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8079 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8080 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
02b504d9 8081 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
fc19d559 8082 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
695d1ec3 8083 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
bd9c10bc 8084 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
f1ec5be1
HC
8085 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8086 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
e2d2fded 8087 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
a4297b5d 8088
a7f3eedc 8089#if 0
a4297b5d
TI
8090 /* Below is a quirk table taken from the old code.
8091 * Basically the device should work as is without the fixup table.
8092 * If BIOS doesn't give a proper info, enable the corresponding
8093 * fixup entry.
7d7eb9ea 8094 */
a4297b5d
TI
8095 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
8096 ALC269_FIXUP_AMIC),
8097 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
a4297b5d
TI
8098 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
8099 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
8100 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
8101 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
8102 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
8103 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
8104 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
8105 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
8106 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
8107 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
8108 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
8109 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
8110 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
8111 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
8112 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
8113 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
8114 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
8115 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
8116 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8117 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8118 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8119 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8120 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8121 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8122 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8123 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8124 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8125 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8126 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8127 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8128 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8129 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8130 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8131 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8132 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8133 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8134 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8135 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8136#endif
8137 {}
8138};
8139
214eef76
DH
8140static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
8141 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
8142 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
8143 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
8144 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
0fbf21c3 8145 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
214eef76
DH
8146 {}
8147};
8148
1727a771 8149static const struct hda_model_fixup alc269_fixup_models[] = {
a4297b5d
TI
8150 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
8151 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
6e72aa5f
TI
8152 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
8153 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
8154 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7c478f03 8155 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
b016951e
TI
8156 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
8157 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
108cc108 8158 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
b590b38c 8159 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9f5c6faf 8160 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
04d5466a 8161 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
e32aa85a
DH
8162 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8163 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
a26d96c7
TI
8164 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
8165 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
be8ef16a 8166 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
0202e99c 8167 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
1c37c223 8168 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9a811230 8169 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
c636b95e 8170 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
399c01aa 8171 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
a26d96c7 8172 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
ba90d6a6 8173 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
28d1d6d2 8174 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
a26d96c7
TI
8175 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
8176 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
8177 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
8178 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
8179 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
8180 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
8181 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
8182 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
8183 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
8184 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
8185 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
8186 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
8187 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
8188 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
8189 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
8190 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
8191 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
8192 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
8193 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
8194 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
8195 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
8196 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
8197 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
8198 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
8199 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
8200 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
8201 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
8202 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
8203 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
8204 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
8205 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
8206 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
8207 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
8208 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
8209 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
8210 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
8211 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
8212 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
8213 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
8214 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
b3802783 8215 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
a26d96c7
TI
8216 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
8217 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
8218 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
8219 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
8220 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
8221 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
8222 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
8223 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
8224 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
8225 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
8226 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
8227 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
8228 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
8229 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
8230 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
a26d96c7
TI
8231 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
8232 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
8233 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
82aa0d7e 8234 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
a26d96c7 8235 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
d2cd795c 8236 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
a26d96c7
TI
8237 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
8238 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
8239 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
8240 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
8241 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
8242 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
8243 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
8244 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
8245 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
8246 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
8247 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
8248 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
8249 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
8250 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
8251 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
8252 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
8253 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
8983eb60
KY
8254 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
8255 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
e2a829b3 8256 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
a2ef03fe 8257 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
bd9c10bc 8258 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
23dc9586 8259 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
fc19d559 8260 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
13468bfa 8261 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
1d045db9 8262 {}
6dda9f4a 8263};
cfc5a845 8264#define ALC225_STANDARD_PINS \
cfc5a845 8265 {0x21, 0x04211020}
6dda9f4a 8266
e8191a8e
HW
8267#define ALC256_STANDARD_PINS \
8268 {0x12, 0x90a60140}, \
8269 {0x14, 0x90170110}, \
e8191a8e
HW
8270 {0x21, 0x02211020}
8271
fea185e2 8272#define ALC282_STANDARD_PINS \
11580297 8273 {0x14, 0x90170110}
e1e62b98 8274
fea185e2 8275#define ALC290_STANDARD_PINS \
11580297 8276 {0x12, 0x99a30130}
fea185e2
DH
8277
8278#define ALC292_STANDARD_PINS \
8279 {0x14, 0x90170110}, \
11580297 8280 {0x15, 0x0221401f}
977e6276 8281
3f640970
HW
8282#define ALC295_STANDARD_PINS \
8283 {0x12, 0xb7a60130}, \
8284 {0x14, 0x90170110}, \
3f640970
HW
8285 {0x21, 0x04211020}
8286
703867e2
WS
8287#define ALC298_STANDARD_PINS \
8288 {0x12, 0x90a60130}, \
8289 {0x21, 0x03211020}
8290
e1918938 8291static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
8a328ac1
KY
8292 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
8293 {0x14, 0x01014020},
8294 {0x17, 0x90170110},
8295 {0x18, 0x02a11030},
8296 {0x19, 0x0181303F},
8297 {0x21, 0x0221102f}),
5824ce8d
CC
8298 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8299 {0x12, 0x90a601c0},
8300 {0x14, 0x90171120},
8301 {0x21, 0x02211030}),
615966ad
CC
8302 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8303 {0x14, 0x90170110},
8304 {0x1b, 0x90a70130},
8305 {0x21, 0x03211020}),
8306 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8307 {0x1a, 0x90a70130},
8308 {0x1b, 0x90170110},
8309 {0x21, 0x03211020}),
2ae95577 8310 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 8311 ALC225_STANDARD_PINS,
8a132099 8312 {0x12, 0xb7a60130},
cfc5a845 8313 {0x14, 0x901701a0}),
2ae95577 8314 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 8315 ALC225_STANDARD_PINS,
8a132099 8316 {0x12, 0xb7a60130},
cfc5a845 8317 {0x14, 0x901701b0}),
8a132099
HW
8318 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8319 ALC225_STANDARD_PINS,
8320 {0x12, 0xb7a60150},
8321 {0x14, 0x901701a0}),
8322 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8323 ALC225_STANDARD_PINS,
8324 {0x12, 0xb7a60150},
8325 {0x14, 0x901701b0}),
8326 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8327 ALC225_STANDARD_PINS,
8328 {0x12, 0xb7a60130},
8329 {0x1b, 0x90170110}),
0ce48e17
KHF
8330 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8331 {0x1b, 0x01111010},
8332 {0x1e, 0x01451130},
8333 {0x21, 0x02211020}),
986376b6
HW
8334 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
8335 {0x12, 0x90a60140},
8336 {0x14, 0x90170110},
8337 {0x19, 0x02a11030},
8338 {0x21, 0x02211020}),
e41fc8c5
HW
8339 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8340 {0x14, 0x90170110},
8341 {0x19, 0x02a11030},
8342 {0x1a, 0x02a11040},
8343 {0x1b, 0x01014020},
8344 {0x21, 0x0221101f}),
d06fb562
HW
8345 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8346 {0x14, 0x90170110},
8347 {0x19, 0x02a11030},
8348 {0x1a, 0x02a11040},
8349 {0x1b, 0x01011020},
8350 {0x21, 0x0221101f}),
c6b17f10
HW
8351 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8352 {0x14, 0x90170110},
8353 {0x19, 0x02a11020},
8354 {0x1a, 0x02a11030},
8355 {0x21, 0x0221101f}),
9e885770
KY
8356 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8357 {0x14, 0x90170110},
8358 {0x19, 0x02a11020},
8359 {0x21, 0x02211030}),
c77900e6 8360 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
c77900e6 8361 {0x14, 0x90170110},
c77900e6 8362 {0x21, 0x02211020}),
86c72d1c
HW
8363 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8364 {0x14, 0x90170130},
8365 {0x21, 0x02211040}),
76c2132e
DH
8366 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8367 {0x12, 0x90a60140},
8368 {0x14, 0x90170110},
76c2132e
DH
8369 {0x21, 0x02211020}),
8370 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8371 {0x12, 0x90a60160},
8372 {0x14, 0x90170120},
76c2132e 8373 {0x21, 0x02211030}),
392c9da2
HW
8374 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8375 {0x14, 0x90170110},
8376 {0x1b, 0x02011020},
8377 {0x21, 0x0221101f}),
6aecd871
HW
8378 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8379 {0x14, 0x90170110},
8380 {0x1b, 0x01011020},
8381 {0x21, 0x0221101f}),
cba59972 8382 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
cba59972 8383 {0x14, 0x90170130},
cba59972 8384 {0x1b, 0x01014020},
cba59972 8385 {0x21, 0x0221103f}),
6aecd871
HW
8386 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8387 {0x14, 0x90170130},
8388 {0x1b, 0x01011020},
8389 {0x21, 0x0221103f}),
59ec4b57
HW
8390 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8391 {0x14, 0x90170130},
8392 {0x1b, 0x02011020},
8393 {0x21, 0x0221103f}),
e9c28e16 8394 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 8395 {0x14, 0x90170150},
e9c28e16 8396 {0x1b, 0x02011020},
e9c28e16
WS
8397 {0x21, 0x0221105f}),
8398 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 8399 {0x14, 0x90170110},
e9c28e16 8400 {0x1b, 0x01014020},
e9c28e16 8401 {0x21, 0x0221101f}),
76c2132e
DH
8402 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8403 {0x12, 0x90a60160},
8404 {0x14, 0x90170120},
8405 {0x17, 0x90170140},
76c2132e
DH
8406 {0x21, 0x0321102f}),
8407 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8408 {0x12, 0x90a60160},
8409 {0x14, 0x90170130},
76c2132e
DH
8410 {0x21, 0x02211040}),
8411 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8412 {0x12, 0x90a60160},
8413 {0x14, 0x90170140},
76c2132e
DH
8414 {0x21, 0x02211050}),
8415 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8416 {0x12, 0x90a60170},
8417 {0x14, 0x90170120},
76c2132e
DH
8418 {0x21, 0x02211030}),
8419 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8420 {0x12, 0x90a60170},
8421 {0x14, 0x90170130},
76c2132e 8422 {0x21, 0x02211040}),
0a1f90a9
HW
8423 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8424 {0x12, 0x90a60170},
8425 {0x14, 0x90171130},
8426 {0x21, 0x02211040}),
70658b99 8427 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
70658b99
HW
8428 {0x12, 0x90a60170},
8429 {0x14, 0x90170140},
70658b99 8430 {0x21, 0x02211050}),
9b5a4e39 8431 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9b5a4e39
DH
8432 {0x12, 0x90a60180},
8433 {0x14, 0x90170130},
9b5a4e39 8434 {0x21, 0x02211040}),
f90d83b3
AK
8435 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8436 {0x12, 0x90a60180},
8437 {0x14, 0x90170120},
8438 {0x21, 0x02211030}),
989dbe4a
HW
8439 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8440 {0x1b, 0x01011020},
8441 {0x21, 0x02211010}),
c1732ede
CC
8442 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8443 {0x14, 0x90170110},
8444 {0x1b, 0x90a70130},
8445 {0x21, 0x04211020}),
8446 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8447 {0x14, 0x90170110},
8448 {0x1b, 0x90a70130},
8449 {0x21, 0x03211020}),
a806ef1c
CC
8450 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
8451 {0x12, 0x90a60130},
8452 {0x14, 0x90170110},
8453 {0x21, 0x03211020}),
6ac371aa
JHP
8454 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
8455 {0x12, 0x90a60130},
8456 {0x14, 0x90170110},
8457 {0x21, 0x04211020}),
e1037354
JHP
8458 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
8459 {0x1a, 0x90a70130},
8460 {0x1b, 0x90170110},
8461 {0x21, 0x03211020}),
9e885770
KY
8462 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8463 {0x14, 0x90170110},
8464 {0x19, 0x02a11020},
8465 {0x21, 0x0221101f}),
8a8de09c
KY
8466 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
8467 {0x17, 0x90170110},
8468 {0x19, 0x03a11030},
8469 {0x21, 0x03211020}),
cf51eb9d
DH
8470 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
8471 {0x12, 0x90a60130},
cf51eb9d
DH
8472 {0x14, 0x90170110},
8473 {0x15, 0x0421101f},
11580297 8474 {0x1a, 0x04a11020}),
0279661b
HW
8475 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
8476 {0x12, 0x90a60140},
0279661b
HW
8477 {0x14, 0x90170110},
8478 {0x15, 0x0421101f},
0279661b 8479 {0x18, 0x02811030},
0279661b 8480 {0x1a, 0x04a1103f},
11580297 8481 {0x1b, 0x02011020}),
42304474 8482 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8483 ALC282_STANDARD_PINS,
42304474 8484 {0x12, 0x99a30130},
42304474 8485 {0x19, 0x03a11020},
42304474 8486 {0x21, 0x0321101f}),
2c609999 8487 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8488 ALC282_STANDARD_PINS,
2c609999 8489 {0x12, 0x99a30130},
2c609999 8490 {0x19, 0x03a11020},
2c609999
HW
8491 {0x21, 0x03211040}),
8492 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8493 ALC282_STANDARD_PINS,
2c609999 8494 {0x12, 0x99a30130},
2c609999 8495 {0x19, 0x03a11030},
2c609999
HW
8496 {0x21, 0x03211020}),
8497 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8498 ALC282_STANDARD_PINS,
2c609999 8499 {0x12, 0x99a30130},
2c609999 8500 {0x19, 0x04a11020},
2c609999 8501 {0x21, 0x0421101f}),
200afc09 8502 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
aec856d0 8503 ALC282_STANDARD_PINS,
200afc09 8504 {0x12, 0x90a60140},
200afc09 8505 {0x19, 0x04a11030},
200afc09 8506 {0x21, 0x04211020}),
76c2132e 8507 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 8508 ALC282_STANDARD_PINS,
76c2132e 8509 {0x12, 0x90a60130},
76c2132e
DH
8510 {0x21, 0x0321101f}),
8511 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8512 {0x12, 0x90a60160},
8513 {0x14, 0x90170120},
76c2132e 8514 {0x21, 0x02211030}),
bc262179 8515 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 8516 ALC282_STANDARD_PINS,
bc262179 8517 {0x12, 0x90a60130},
bc262179 8518 {0x19, 0x03a11020},
bc262179 8519 {0x21, 0x0321101f}),
c8c6ee61 8520 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
c4cfcf6f
HW
8521 {0x12, 0x90a60130},
8522 {0x14, 0x90170110},
8523 {0x19, 0x04a11040},
8524 {0x21, 0x04211020}),
33aaebd4
CC
8525 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
8526 {0x12, 0x90a60130},
8527 {0x17, 0x90170110},
8528 {0x21, 0x02211020}),
d44a6864 8529 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
e1e62b98 8530 {0x12, 0x90a60120},
e1e62b98 8531 {0x14, 0x90170110},
e1e62b98 8532 {0x21, 0x0321101f}),
e4442bcf 8533 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8534 ALC290_STANDARD_PINS,
e4442bcf 8535 {0x15, 0x04211040},
e4442bcf 8536 {0x18, 0x90170112},
11580297 8537 {0x1a, 0x04a11020}),
e4442bcf 8538 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8539 ALC290_STANDARD_PINS,
e4442bcf 8540 {0x15, 0x04211040},
e4442bcf 8541 {0x18, 0x90170110},
11580297 8542 {0x1a, 0x04a11020}),
e4442bcf 8543 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8544 ALC290_STANDARD_PINS,
e4442bcf 8545 {0x15, 0x0421101f},
11580297 8546 {0x1a, 0x04a11020}),
e4442bcf 8547 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8548 ALC290_STANDARD_PINS,
e4442bcf 8549 {0x15, 0x04211020},
11580297 8550 {0x1a, 0x04a11040}),
e4442bcf 8551 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8552 ALC290_STANDARD_PINS,
e4442bcf
HW
8553 {0x14, 0x90170110},
8554 {0x15, 0x04211020},
11580297 8555 {0x1a, 0x04a11040}),
e4442bcf 8556 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8557 ALC290_STANDARD_PINS,
e4442bcf
HW
8558 {0x14, 0x90170110},
8559 {0x15, 0x04211020},
11580297 8560 {0x1a, 0x04a11020}),
e4442bcf 8561 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8562 ALC290_STANDARD_PINS,
e4442bcf
HW
8563 {0x14, 0x90170110},
8564 {0x15, 0x0421101f},
11580297 8565 {0x1a, 0x04a11020}),
e8818fa8 8566 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 8567 ALC292_STANDARD_PINS,
e8818fa8 8568 {0x12, 0x90a60140},
e8818fa8 8569 {0x16, 0x01014020},
11580297 8570 {0x19, 0x01a19030}),
e8818fa8 8571 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 8572 ALC292_STANDARD_PINS,
e8818fa8 8573 {0x12, 0x90a60140},
e8818fa8
HW
8574 {0x16, 0x01014020},
8575 {0x18, 0x02a19031},
11580297 8576 {0x19, 0x01a1903e}),
76c2132e 8577 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
aec856d0 8578 ALC292_STANDARD_PINS,
11580297 8579 {0x12, 0x90a60140}),
76c2132e 8580 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 8581 ALC292_STANDARD_PINS,
76c2132e 8582 {0x13, 0x90a60140},
76c2132e 8583 {0x16, 0x21014020},
11580297 8584 {0x19, 0x21a19030}),
e03fdbde 8585 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 8586 ALC292_STANDARD_PINS,
11580297 8587 {0x13, 0x90a60140}),
d8ae458e
CC
8588 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
8589 {0x14, 0x90170110},
8590 {0x1b, 0x90a70130},
8591 {0x21, 0x04211020}),
8bb37a2a
JHP
8592 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8593 {0x12, 0x90a60130},
8594 {0x17, 0x90170110},
8595 {0x21, 0x03211020}),
0bea4cc8
JHP
8596 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8597 {0x12, 0x90a60130},
8598 {0x17, 0x90170110},
8599 {0x21, 0x04211020}),
3887c26c
TI
8600 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8601 {0x12, 0x90a60130},
8602 {0x17, 0x90170110},
8603 {0x21, 0x03211020}),
9e43342b 8604 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
ad97d667
JHP
8605 {0x12, 0x90a60120},
8606 {0x17, 0x90170110},
8607 {0x21, 0x04211030}),
8608 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9e43342b
CC
8609 {0x12, 0x90a60130},
8610 {0x17, 0x90170110},
8611 {0x21, 0x03211020}),
8612 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8613 {0x12, 0x90a60130},
8614 {0x17, 0x90170110},
8615 {0x21, 0x03211020}),
fbc57129 8616 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
0a29c57b
KY
8617 {0x14, 0x90170110},
8618 {0x21, 0x04211020}),
fbc57129
KY
8619 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8620 {0x14, 0x90170110},
8621 {0x21, 0x04211030}),
3f640970 8622 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
f771d5bb
HW
8623 ALC295_STANDARD_PINS,
8624 {0x17, 0x21014020},
8625 {0x18, 0x21a19030}),
8626 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8627 ALC295_STANDARD_PINS,
8628 {0x17, 0x21014040},
8629 {0x18, 0x21a19050}),
3f307834
HW
8630 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8631 ALC295_STANDARD_PINS),
9f502ff5
TI
8632 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8633 ALC298_STANDARD_PINS,
8634 {0x17, 0x90170110}),
977e6276 8635 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
703867e2
WS
8636 ALC298_STANDARD_PINS,
8637 {0x17, 0x90170140}),
8638 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8639 ALC298_STANDARD_PINS,
9f502ff5 8640 {0x17, 0x90170150}),
9f1bc2c4
KHF
8641 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
8642 {0x12, 0xb7a60140},
8643 {0x13, 0xb7a60150},
8644 {0x17, 0x90170110},
8645 {0x1a, 0x03011020},
8646 {0x21, 0x03211030}),
54324221
JM
8647 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
8648 {0x12, 0xb7a60140},
8649 {0x17, 0x90170110},
8650 {0x1a, 0x03a11030},
8651 {0x21, 0x03211020}),
fcc6c877
KY
8652 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8653 ALC225_STANDARD_PINS,
8654 {0x12, 0xb7a60130},
fcc6c877 8655 {0x17, 0x90170110}),
573fcbfd
HW
8656 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
8657 {0x14, 0x01014010},
8658 {0x17, 0x90170120},
8659 {0x18, 0x02a11030},
8660 {0x19, 0x02a1103f},
8661 {0x21, 0x0221101f}),
e1918938
HW
8662 {}
8663};
6dda9f4a 8664
7c0a6939
HW
8665/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
8666 * more machines, don't need to match all valid pins, just need to match
8667 * all the pins defined in the tbl. Just because of this reason, it is possible
8668 * that a single machine matches multiple tbls, so there is one limitation:
8669 * at most one tbl is allowed to define for the same vendor and same codec
8670 */
8671static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
8672 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8673 {0x19, 0x40000000},
8674 {0x1b, 0x40000000}),
aed8c7f4
HW
8675 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8676 {0x19, 0x40000000},
8677 {0x1a, 0x40000000}),
d64ebdbf
HW
8678 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8679 {0x19, 0x40000000},
8680 {0x1a, 0x40000000}),
5815bdfd
HW
8681 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
8682 {0x19, 0x40000000},
8683 {0x1a, 0x40000000}),
7c0a6939
HW
8684 {}
8685};
8686
546bb678 8687static void alc269_fill_coef(struct hda_codec *codec)
1d045db9 8688{
526af6eb 8689 struct alc_spec *spec = codec->spec;
1d045db9 8690 int val;
ebb83eeb 8691
526af6eb 8692 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
546bb678 8693 return;
526af6eb 8694
1bb7e43e 8695 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
1d045db9
TI
8696 alc_write_coef_idx(codec, 0xf, 0x960b);
8697 alc_write_coef_idx(codec, 0xe, 0x8817);
8698 }
ebb83eeb 8699
1bb7e43e 8700 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
1d045db9
TI
8701 alc_write_coef_idx(codec, 0xf, 0x960b);
8702 alc_write_coef_idx(codec, 0xe, 0x8814);
8703 }
ebb83eeb 8704
1bb7e43e 8705 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9 8706 /* Power up output pin */
98b24883 8707 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
1d045db9 8708 }
ebb83eeb 8709
1bb7e43e 8710 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9 8711 val = alc_read_coef_idx(codec, 0xd);
f3ee07d8 8712 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
1d045db9
TI
8713 /* Capless ramp up clock control */
8714 alc_write_coef_idx(codec, 0xd, val | (1<<10));
8715 }
8716 val = alc_read_coef_idx(codec, 0x17);
f3ee07d8 8717 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
1d045db9
TI
8718 /* Class D power on reset */
8719 alc_write_coef_idx(codec, 0x17, val | (1<<7));
8720 }
8721 }
ebb83eeb 8722
98b24883
TI
8723 /* HP */
8724 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
1d045db9 8725}
a7f2371f 8726
1d045db9
TI
8727/*
8728 */
1d045db9
TI
8729static int patch_alc269(struct hda_codec *codec)
8730{
8731 struct alc_spec *spec;
3de95173 8732 int err;
f1d4e28b 8733
3de95173 8734 err = alc_alloc_spec(codec, 0x0b);
e16fb6d1 8735 if (err < 0)
3de95173
TI
8736 return err;
8737
8738 spec = codec->spec;
08c189f2 8739 spec->gen.shared_mic_vref_pin = 0x18;
317d9313 8740 codec->power_save_node = 0;
e16fb6d1 8741
225068ab
TI
8742#ifdef CONFIG_PM
8743 codec->patch_ops.suspend = alc269_suspend;
8744 codec->patch_ops.resume = alc269_resume;
8745#endif
c2d6af53
KY
8746 spec->shutup = alc_default_shutup;
8747 spec->init_hook = alc_default_init;
225068ab 8748
7639a06c 8749 switch (codec->core.vendor_id) {
065380f0 8750 case 0x10ec0269:
1d045db9 8751 spec->codec_variant = ALC269_TYPE_ALC269VA;
1bb7e43e
TI
8752 switch (alc_get_coef0(codec) & 0x00f0) {
8753 case 0x0010:
5100cd07
TI
8754 if (codec->bus->pci &&
8755 codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 8756 spec->cdefine.platform_type == 1)
20ca0c35 8757 err = alc_codec_rename(codec, "ALC271X");
1d045db9 8758 spec->codec_variant = ALC269_TYPE_ALC269VB;
1bb7e43e
TI
8759 break;
8760 case 0x0020:
5100cd07
TI
8761 if (codec->bus->pci &&
8762 codec->bus->pci->subsystem_vendor == 0x17aa &&
e16fb6d1 8763 codec->bus->pci->subsystem_device == 0x21f3)
20ca0c35 8764 err = alc_codec_rename(codec, "ALC3202");
1d045db9 8765 spec->codec_variant = ALC269_TYPE_ALC269VC;
1bb7e43e 8766 break;
adcc70b2
KY
8767 case 0x0030:
8768 spec->codec_variant = ALC269_TYPE_ALC269VD;
8769 break;
1bb7e43e 8770 default:
1d045db9 8771 alc_fix_pll_init(codec, 0x20, 0x04, 15);
1bb7e43e 8772 }
e16fb6d1
TI
8773 if (err < 0)
8774 goto error;
c2d6af53 8775 spec->shutup = alc269_shutup;
546bb678 8776 spec->init_hook = alc269_fill_coef;
1d045db9 8777 alc269_fill_coef(codec);
065380f0
KY
8778 break;
8779
8780 case 0x10ec0280:
8781 case 0x10ec0290:
8782 spec->codec_variant = ALC269_TYPE_ALC280;
8783 break;
8784 case 0x10ec0282:
065380f0 8785 spec->codec_variant = ALC269_TYPE_ALC282;
7b5c7a02
KY
8786 spec->shutup = alc282_shutup;
8787 spec->init_hook = alc282_init;
065380f0 8788 break;
2af02be7
KY
8789 case 0x10ec0233:
8790 case 0x10ec0283:
8791 spec->codec_variant = ALC269_TYPE_ALC283;
8792 spec->shutup = alc283_shutup;
8793 spec->init_hook = alc283_init;
8794 break;
065380f0
KY
8795 case 0x10ec0284:
8796 case 0x10ec0292:
8797 spec->codec_variant = ALC269_TYPE_ALC284;
8798 break;
161ebf29 8799 case 0x10ec0293:
4731d5de 8800 spec->codec_variant = ALC269_TYPE_ALC293;
161ebf29 8801 break;
7fc7d047 8802 case 0x10ec0286:
7c665932 8803 case 0x10ec0288:
7fc7d047
KY
8804 spec->codec_variant = ALC269_TYPE_ALC286;
8805 break;
506b62c3
KY
8806 case 0x10ec0298:
8807 spec->codec_variant = ALC269_TYPE_ALC298;
8808 break;
ea04a1db 8809 case 0x10ec0235:
1d04c9de
KY
8810 case 0x10ec0255:
8811 spec->codec_variant = ALC269_TYPE_ALC255;
ab3b8e51
KY
8812 spec->shutup = alc256_shutup;
8813 spec->init_hook = alc256_init;
1d04c9de 8814 break;
736f20a7 8815 case 0x10ec0236:
4344aec8
KY
8816 case 0x10ec0256:
8817 spec->codec_variant = ALC269_TYPE_ALC256;
4a219ef8
KY
8818 spec->shutup = alc256_shutup;
8819 spec->init_hook = alc256_init;
7d1b6e29 8820 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
4344aec8 8821 break;
f429e7e4
KY
8822 case 0x10ec0257:
8823 spec->codec_variant = ALC269_TYPE_ALC257;
88d42b2b
KY
8824 spec->shutup = alc256_shutup;
8825 spec->init_hook = alc256_init;
f429e7e4
KY
8826 spec->gen.mixer_nid = 0;
8827 break;
0a6f0600 8828 case 0x10ec0215:
7fbdcd83 8829 case 0x10ec0245:
0a6f0600 8830 case 0x10ec0285:
630e3612 8831 case 0x10ec0287:
0a6f0600
KY
8832 case 0x10ec0289:
8833 spec->codec_variant = ALC269_TYPE_ALC215;
1b6832be
KY
8834 spec->shutup = alc225_shutup;
8835 spec->init_hook = alc225_init;
0a6f0600
KY
8836 spec->gen.mixer_nid = 0;
8837 break;
4231430d 8838 case 0x10ec0225:
7d727869 8839 case 0x10ec0295:
28f1f9b2 8840 case 0x10ec0299:
4231430d 8841 spec->codec_variant = ALC269_TYPE_ALC225;
da911b1f
KY
8842 spec->shutup = alc225_shutup;
8843 spec->init_hook = alc225_init;
c1350bff 8844 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
4231430d 8845 break;
dcd4f0db
KY
8846 case 0x10ec0234:
8847 case 0x10ec0274:
8848 case 0x10ec0294:
8849 spec->codec_variant = ALC269_TYPE_ALC294;
532a7784 8850 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
71683c32 8851 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
693abe11 8852 spec->init_hook = alc294_init;
dcd4f0db 8853 break;
1078bef0
KY
8854 case 0x10ec0300:
8855 spec->codec_variant = ALC269_TYPE_ALC300;
8856 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
dcd4f0db 8857 break;
f0778871
KY
8858 case 0x10ec0623:
8859 spec->codec_variant = ALC269_TYPE_ALC623;
8860 break;
6fbae35a
KY
8861 case 0x10ec0700:
8862 case 0x10ec0701:
8863 case 0x10ec0703:
83629532 8864 case 0x10ec0711:
6fbae35a
KY
8865 spec->codec_variant = ALC269_TYPE_ALC700;
8866 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
2d7fe618 8867 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
693abe11 8868 spec->init_hook = alc294_init;
6fbae35a
KY
8869 break;
8870
1d045db9 8871 }
6dda9f4a 8872
ad60d502 8873 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
97a26570 8874 spec->has_alc5505_dsp = 1;
ad60d502
KY
8875 spec->init_hook = alc5505_dsp_init;
8876 }
8877
c9af753f
TI
8878 alc_pre_init(codec);
8879
efe55732
TI
8880 snd_hda_pick_fixup(codec, alc269_fixup_models,
8881 alc269_fixup_tbl, alc269_fixups);
0fc1e447 8882 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
7c0a6939 8883 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
efe55732
TI
8884 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
8885 alc269_fixups);
8886 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8887
8888 alc_auto_parse_customize_define(codec);
8889
8890 if (has_cdefine_beep(codec))
8891 spec->gen.beep_nid = 0x01;
8892
a4297b5d
TI
8893 /* automatic parse from the BIOS config */
8894 err = alc269_parse_auto_config(codec);
e16fb6d1
TI
8895 if (err < 0)
8896 goto error;
6dda9f4a 8897
fea80fae
TI
8898 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
8899 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
8900 if (err < 0)
8901 goto error;
8902 }
f1d4e28b 8903
1727a771 8904 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 8905
1d045db9 8906 return 0;
e16fb6d1
TI
8907
8908 error:
8909 alc_free(codec);
8910 return err;
1d045db9 8911}
f1d4e28b 8912
1d045db9
TI
8913/*
8914 * ALC861
8915 */
622e84cd 8916
1d045db9 8917static int alc861_parse_auto_config(struct hda_codec *codec)
6dda9f4a 8918{
1d045db9 8919 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
3e6179b8
TI
8920 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
8921 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
604401a9
TI
8922}
8923
1d045db9
TI
8924/* Pin config fixes */
8925enum {
e652f4c8
TI
8926 ALC861_FIXUP_FSC_AMILO_PI1505,
8927 ALC861_FIXUP_AMP_VREF_0F,
8928 ALC861_FIXUP_NO_JACK_DETECT,
8929 ALC861_FIXUP_ASUS_A6RP,
6ddf0fd1 8930 ALC660_FIXUP_ASUS_W7J,
1d045db9 8931};
7085ec12 8932
31150f23
TI
8933/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
8934static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
1727a771 8935 const struct hda_fixup *fix, int action)
31150f23
TI
8936{
8937 struct alc_spec *spec = codec->spec;
8938 unsigned int val;
8939
1727a771 8940 if (action != HDA_FIXUP_ACT_INIT)
31150f23 8941 return;
d3f02d60 8942 val = snd_hda_codec_get_pin_target(codec, 0x0f);
31150f23
TI
8943 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
8944 val |= AC_PINCTL_IN_EN;
8945 val |= AC_PINCTL_VREF_50;
cdd03ced 8946 snd_hda_set_pin_ctl(codec, 0x0f, val);
08c189f2 8947 spec->gen.keep_vref_in_automute = 1;
31150f23
TI
8948}
8949
e652f4c8
TI
8950/* suppress the jack-detection */
8951static void alc_fixup_no_jack_detect(struct hda_codec *codec,
1727a771 8952 const struct hda_fixup *fix, int action)
e652f4c8 8953{
1727a771 8954 if (action == HDA_FIXUP_ACT_PRE_PROBE)
e652f4c8 8955 codec->no_jack_detect = 1;
7d7eb9ea 8956}
e652f4c8 8957
1727a771 8958static const struct hda_fixup alc861_fixups[] = {
e652f4c8 8959 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
1727a771
TI
8960 .type = HDA_FIXUP_PINS,
8961 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
8962 { 0x0b, 0x0221101f }, /* HP */
8963 { 0x0f, 0x90170310 }, /* speaker */
8964 { }
8965 }
8966 },
e652f4c8 8967 [ALC861_FIXUP_AMP_VREF_0F] = {
1727a771 8968 .type = HDA_FIXUP_FUNC,
31150f23 8969 .v.func = alc861_fixup_asus_amp_vref_0f,
3b25eb69 8970 },
e652f4c8 8971 [ALC861_FIXUP_NO_JACK_DETECT] = {
1727a771 8972 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
8973 .v.func = alc_fixup_no_jack_detect,
8974 },
8975 [ALC861_FIXUP_ASUS_A6RP] = {
1727a771 8976 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
8977 .v.func = alc861_fixup_asus_amp_vref_0f,
8978 .chained = true,
8979 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
6ddf0fd1
TI
8980 },
8981 [ALC660_FIXUP_ASUS_W7J] = {
8982 .type = HDA_FIXUP_VERBS,
8983 .v.verbs = (const struct hda_verb[]) {
8984 /* ASUS W7J needs a magic pin setup on unused NID 0x10
8985 * for enabling outputs
8986 */
8987 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8988 { }
8989 },
e652f4c8 8990 }
1d045db9 8991};
7085ec12 8992
1d045db9 8993static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6ddf0fd1 8994 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
e7ca237b 8995 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
e652f4c8
TI
8996 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
8997 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
8998 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
8999 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
9000 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
9001 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
1d045db9
TI
9002 {}
9003};
3af9ee6b 9004
1d045db9
TI
9005/*
9006 */
1d045db9 9007static int patch_alc861(struct hda_codec *codec)
7085ec12 9008{
1d045db9 9009 struct alc_spec *spec;
1d045db9 9010 int err;
7085ec12 9011
3de95173
TI
9012 err = alc_alloc_spec(codec, 0x15);
9013 if (err < 0)
9014 return err;
1d045db9 9015
3de95173 9016 spec = codec->spec;
2722b535
TI
9017 if (has_cdefine_beep(codec))
9018 spec->gen.beep_nid = 0x23;
1d045db9 9019
225068ab
TI
9020#ifdef CONFIG_PM
9021 spec->power_hook = alc_power_eapd;
9022#endif
9023
c9af753f
TI
9024 alc_pre_init(codec);
9025
1727a771
TI
9026 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
9027 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3af9ee6b 9028
cb4e4824
TI
9029 /* automatic parse from the BIOS config */
9030 err = alc861_parse_auto_config(codec);
e16fb6d1
TI
9031 if (err < 0)
9032 goto error;
3af9ee6b 9033
fea80fae
TI
9034 if (!spec->gen.no_analog) {
9035 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
9036 if (err < 0)
9037 goto error;
9038 }
7085ec12 9039
1727a771 9040 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 9041
1d045db9 9042 return 0;
e16fb6d1
TI
9043
9044 error:
9045 alc_free(codec);
9046 return err;
7085ec12
TI
9047}
9048
1d045db9
TI
9049/*
9050 * ALC861-VD support
9051 *
9052 * Based on ALC882
9053 *
9054 * In addition, an independent DAC
9055 */
1d045db9 9056static int alc861vd_parse_auto_config(struct hda_codec *codec)
bc9f98a9 9057{
1d045db9 9058 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
3e6179b8
TI
9059 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9060 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
ce764ab2
TI
9061}
9062
1d045db9 9063enum {
8fdcb6fe
TI
9064 ALC660VD_FIX_ASUS_GPIO1,
9065 ALC861VD_FIX_DALLAS,
1d045db9 9066};
ce764ab2 9067
8fdcb6fe
TI
9068/* exclude VREF80 */
9069static void alc861vd_fixup_dallas(struct hda_codec *codec,
1727a771 9070 const struct hda_fixup *fix, int action)
8fdcb6fe 9071{
1727a771 9072 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
b78562b1
TI
9073 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
9074 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
8fdcb6fe
TI
9075 }
9076}
9077
df73d83f
TI
9078/* reset GPIO1 */
9079static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
9080 const struct hda_fixup *fix, int action)
9081{
9082 struct alc_spec *spec = codec->spec;
9083
9084 if (action == HDA_FIXUP_ACT_PRE_PROBE)
9085 spec->gpio_mask |= 0x02;
9086 alc_fixup_gpio(codec, action, 0x01);
9087}
9088
1727a771 9089static const struct hda_fixup alc861vd_fixups[] = {
1d045db9 9090 [ALC660VD_FIX_ASUS_GPIO1] = {
df73d83f
TI
9091 .type = HDA_FIXUP_FUNC,
9092 .v.func = alc660vd_fixup_asus_gpio1,
1d045db9 9093 },
8fdcb6fe 9094 [ALC861VD_FIX_DALLAS] = {
1727a771 9095 .type = HDA_FIXUP_FUNC,
8fdcb6fe
TI
9096 .v.func = alc861vd_fixup_dallas,
9097 },
1d045db9 9098};
ce764ab2 9099
1d045db9 9100static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
8fdcb6fe 9101 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
1d045db9 9102 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
8fdcb6fe 9103 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
1d045db9
TI
9104 {}
9105};
ce764ab2 9106
1d045db9
TI
9107/*
9108 */
1d045db9 9109static int patch_alc861vd(struct hda_codec *codec)
ce764ab2 9110{
1d045db9 9111 struct alc_spec *spec;
cb4e4824 9112 int err;
ce764ab2 9113
3de95173
TI
9114 err = alc_alloc_spec(codec, 0x0b);
9115 if (err < 0)
9116 return err;
1d045db9 9117
3de95173 9118 spec = codec->spec;
2722b535
TI
9119 if (has_cdefine_beep(codec))
9120 spec->gen.beep_nid = 0x23;
1d045db9 9121
225068ab
TI
9122 spec->shutup = alc_eapd_shutup;
9123
c9af753f
TI
9124 alc_pre_init(codec);
9125
1727a771
TI
9126 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
9127 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1d045db9 9128
cb4e4824
TI
9129 /* automatic parse from the BIOS config */
9130 err = alc861vd_parse_auto_config(codec);
e16fb6d1
TI
9131 if (err < 0)
9132 goto error;
ce764ab2 9133
fea80fae
TI
9134 if (!spec->gen.no_analog) {
9135 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9136 if (err < 0)
9137 goto error;
9138 }
1d045db9 9139
1727a771 9140 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 9141
ce764ab2 9142 return 0;
e16fb6d1
TI
9143
9144 error:
9145 alc_free(codec);
9146 return err;
ce764ab2
TI
9147}
9148
1d045db9
TI
9149/*
9150 * ALC662 support
9151 *
9152 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
9153 * configuration. Each pin widget can choose any input DACs and a mixer.
9154 * Each ADC is connected from a mixer of all inputs. This makes possible
9155 * 6-channel independent captures.
9156 *
9157 * In addition, an independent DAC for the multi-playback (not used in this
9158 * driver yet).
9159 */
1d045db9
TI
9160
9161/*
9162 * BIOS auto configuration
9163 */
9164
bc9f98a9
KY
9165static int alc662_parse_auto_config(struct hda_codec *codec)
9166{
4c6d72d1 9167 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
3e6179b8
TI
9168 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
9169 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9170 const hda_nid_t *ssids;
ee979a14 9171
7639a06c
TI
9172 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
9173 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
9174 codec->core.vendor_id == 0x10ec0671)
3e6179b8 9175 ssids = alc663_ssids;
6227cdce 9176 else
3e6179b8
TI
9177 ssids = alc662_ssids;
9178 return alc_parse_auto_config(codec, alc662_ignore, ssids);
bc9f98a9
KY
9179}
9180
6be7948f 9181static void alc272_fixup_mario(struct hda_codec *codec,
1727a771 9182 const struct hda_fixup *fix, int action)
6fc398cb 9183{
9bb1f06f 9184 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6fc398cb 9185 return;
6be7948f
TB
9186 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
9187 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
9188 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
9189 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
9190 (0 << AC_AMPCAP_MUTE_SHIFT)))
4e76a883 9191 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
6be7948f
TB
9192}
9193
8e383953
TI
9194static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
9195 { .channels = 2,
9196 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
9197 { .channels = 4,
9198 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
9199 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
9200 { }
9201};
9202
9203/* override the 2.1 chmap */
eb9ca3ab 9204static void alc_fixup_bass_chmap(struct hda_codec *codec,
8e383953
TI
9205 const struct hda_fixup *fix, int action)
9206{
9207 if (action == HDA_FIXUP_ACT_BUILD) {
9208 struct alc_spec *spec = codec->spec;
bbbc7e85 9209 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8e383953
TI
9210 }
9211}
9212
bf68665d
TI
9213/* avoid D3 for keeping GPIO up */
9214static unsigned int gpio_led_power_filter(struct hda_codec *codec,
9215 hda_nid_t nid,
9216 unsigned int power_state)
9217{
9218 struct alc_spec *spec = codec->spec;
d261eec8 9219 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
bf68665d
TI
9220 return AC_PWRST_D0;
9221 return power_state;
9222}
9223
3e887f37
TI
9224static void alc662_fixup_led_gpio1(struct hda_codec *codec,
9225 const struct hda_fixup *fix, int action)
9226{
9227 struct alc_spec *spec = codec->spec;
3e887f37 9228
01e4a275 9229 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
3e887f37 9230 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19 9231 spec->mute_led_polarity = 1;
bf68665d 9232 codec->power_filter = gpio_led_power_filter;
3e887f37
TI
9233 }
9234}
9235
c6790c8e
KY
9236static void alc662_usi_automute_hook(struct hda_codec *codec,
9237 struct hda_jack_callback *jack)
9238{
9239 struct alc_spec *spec = codec->spec;
9240 int vref;
9241 msleep(200);
9242 snd_hda_gen_hp_automute(codec, jack);
9243
9244 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
9245 msleep(100);
9246 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9247 vref);
9248}
9249
9250static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
9251 const struct hda_fixup *fix, int action)
9252{
9253 struct alc_spec *spec = codec->spec;
9254 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9255 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9256 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
9257 }
9258}
9259
00066e97
SB
9260static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
9261 struct hda_jack_callback *cb)
9262{
9263 /* surround speakers at 0x1b already get muted automatically when
9264 * headphones are plugged in, but we have to mute/unmute the remaining
9265 * channels manually:
9266 * 0x15 - front left/front right
9267 * 0x18 - front center/ LFE
9268 */
9269 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
9270 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
9271 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
9272 } else {
9273 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
9274 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
9275 }
9276}
9277
9278static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
9279 const struct hda_fixup *fix, int action)
9280{
9281 /* Pin 0x1b: shared headphones jack and surround speakers */
9282 if (!is_jack_detectable(codec, 0x1b))
9283 return;
9284
9285 switch (action) {
9286 case HDA_FIXUP_ACT_PRE_PROBE:
9287 snd_hda_jack_detect_enable_callback(codec, 0x1b,
9288 alc662_aspire_ethos_mute_speakers);
336820c4
TI
9289 /* subwoofer needs an extra GPIO setting to become audible */
9290 alc_setup_gpio(codec, 0x02);
00066e97
SB
9291 break;
9292 case HDA_FIXUP_ACT_INIT:
9293 /* Make sure to start in a correct state, i.e. if
9294 * headphones have been plugged in before powering up the system
9295 */
9296 alc662_aspire_ethos_mute_speakers(codec, NULL);
9297 break;
9298 }
9299}
9300
5af29028
KY
9301static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
9302 const struct hda_fixup *fix, int action)
9303{
9304 struct alc_spec *spec = codec->spec;
9305
9306 static const struct hda_pintbl pincfgs[] = {
9307 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
9308 { 0x1b, 0x0181304f },
9309 { }
9310 };
9311
9312 switch (action) {
9313 case HDA_FIXUP_ACT_PRE_PROBE:
9314 spec->gen.mixer_nid = 0;
9315 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9316 snd_hda_apply_pincfgs(codec, pincfgs);
9317 break;
9318 case HDA_FIXUP_ACT_INIT:
9319 alc_write_coef_idx(codec, 0x19, 0xa054);
9320 break;
9321 }
9322}
9323
6b0f95c4 9324static const struct coef_fw alc668_coefs[] = {
f3f9185f
KY
9325 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
9326 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
9327 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
9328 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
9329 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
9330 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
9331 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
9332 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
9333 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
9334 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
9335 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
9336 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
9337 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
9338 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
9339 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
9340 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
9341 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
9342 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
9343 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
9344 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
9345 {}
9346};
9347
9348static void alc668_restore_default_value(struct hda_codec *codec)
9349{
9350 alc_process_coef_fw(codec, alc668_coefs);
9351}
9352
6cb3b707 9353enum {
2df03514 9354 ALC662_FIXUP_ASPIRE,
3e887f37 9355 ALC662_FIXUP_LED_GPIO1,
6cb3b707 9356 ALC662_FIXUP_IDEAPAD,
6be7948f 9357 ALC272_FIXUP_MARIO,
f1ec5be1 9358 ALC662_FIXUP_CZC_ET26,
d2ebd479 9359 ALC662_FIXUP_CZC_P10T,
94024cd1 9360 ALC662_FIXUP_SKU_IGNORE,
e59ea3ed 9361 ALC662_FIXUP_HP_RP5800,
53c334ad
TI
9362 ALC662_FIXUP_ASUS_MODE1,
9363 ALC662_FIXUP_ASUS_MODE2,
9364 ALC662_FIXUP_ASUS_MODE3,
9365 ALC662_FIXUP_ASUS_MODE4,
9366 ALC662_FIXUP_ASUS_MODE5,
9367 ALC662_FIXUP_ASUS_MODE6,
9368 ALC662_FIXUP_ASUS_MODE7,
9369 ALC662_FIXUP_ASUS_MODE8,
1565cc35 9370 ALC662_FIXUP_NO_JACK_DETECT,
edfe3bfc 9371 ALC662_FIXUP_ZOTAC_Z68,
125821ae 9372 ALC662_FIXUP_INV_DMIC,
1f8b46cd 9373 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
73bdd597 9374 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 9375 ALC662_FIXUP_HEADSET_MODE,
73bdd597 9376 ALC668_FIXUP_HEADSET_MODE,
8e54b4ac 9377 ALC662_FIXUP_BASS_MODE4_CHMAP,
61a75f13 9378 ALC662_FIXUP_BASS_16,
a30c9aaa 9379 ALC662_FIXUP_BASS_1A,
8e54b4ac 9380 ALC662_FIXUP_BASS_CHMAP,
493a52a9 9381 ALC668_FIXUP_AUTO_MUTE,
5e6db669 9382 ALC668_FIXUP_DELL_DISABLE_AAMIX,
033b0a7c 9383 ALC668_FIXUP_DELL_XPS13,
9d4dc584 9384 ALC662_FIXUP_ASUS_Nx50,
fc7438b1 9385 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 9386 ALC668_FIXUP_ASUS_Nx51,
5b7c5e1f 9387 ALC668_FIXUP_MIC_COEF,
11ba6111 9388 ALC668_FIXUP_ASUS_G751,
78f4f7c2
KY
9389 ALC891_FIXUP_HEADSET_MODE,
9390 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9b51fe3e 9391 ALC662_FIXUP_ACER_VERITON,
1a3f0991 9392 ALC892_FIXUP_ASROCK_MOBO,
c6790c8e
KY
9393 ALC662_FIXUP_USI_FUNC,
9394 ALC662_FIXUP_USI_HEADSET_MODE,
ca169cc2 9395 ALC662_FIXUP_LENOVO_MULTI_CODECS,
00066e97 9396 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
00066e97 9397 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
5af29028 9398 ALC671_FIXUP_HP_HEADSET_MIC2,
d858c706 9399 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
a124458a 9400 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
6cb3b707
DH
9401};
9402
1727a771 9403static const struct hda_fixup alc662_fixups[] = {
2df03514 9404 [ALC662_FIXUP_ASPIRE] = {
1727a771
TI
9405 .type = HDA_FIXUP_PINS,
9406 .v.pins = (const struct hda_pintbl[]) {
2df03514
DC
9407 { 0x15, 0x99130112 }, /* subwoofer */
9408 { }
9409 }
9410 },
3e887f37
TI
9411 [ALC662_FIXUP_LED_GPIO1] = {
9412 .type = HDA_FIXUP_FUNC,
9413 .v.func = alc662_fixup_led_gpio1,
9414 },
6cb3b707 9415 [ALC662_FIXUP_IDEAPAD] = {
1727a771
TI
9416 .type = HDA_FIXUP_PINS,
9417 .v.pins = (const struct hda_pintbl[]) {
6cb3b707
DH
9418 { 0x17, 0x99130112 }, /* subwoofer */
9419 { }
3e887f37
TI
9420 },
9421 .chained = true,
9422 .chain_id = ALC662_FIXUP_LED_GPIO1,
6cb3b707 9423 },
6be7948f 9424 [ALC272_FIXUP_MARIO] = {
1727a771 9425 .type = HDA_FIXUP_FUNC,
b5bfbc67 9426 .v.func = alc272_fixup_mario,
d2ebd479 9427 },
f1ec5be1
HC
9428 [ALC662_FIXUP_CZC_ET26] = {
9429 .type = HDA_FIXUP_PINS,
9430 .v.pins = (const struct hda_pintbl[]) {
9431 {0x12, 0x403cc000},
9432 {0x14, 0x90170110}, /* speaker */
9433 {0x15, 0x411111f0},
9434 {0x16, 0x411111f0},
9435 {0x18, 0x01a19030}, /* mic */
9436 {0x19, 0x90a7013f}, /* int-mic */
9437 {0x1a, 0x01014020},
9438 {0x1b, 0x0121401f},
9439 {0x1c, 0x411111f0},
9440 {0x1d, 0x411111f0},
9441 {0x1e, 0x40478e35},
9442 {}
9443 },
9444 .chained = true,
9445 .chain_id = ALC662_FIXUP_SKU_IGNORE
9446 },
d2ebd479 9447 [ALC662_FIXUP_CZC_P10T] = {
1727a771 9448 .type = HDA_FIXUP_VERBS,
d2ebd479
AA
9449 .v.verbs = (const struct hda_verb[]) {
9450 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
9451 {}
9452 }
9453 },
94024cd1 9454 [ALC662_FIXUP_SKU_IGNORE] = {
1727a771 9455 .type = HDA_FIXUP_FUNC,
23d30f28 9456 .v.func = alc_fixup_sku_ignore,
c6b35874 9457 },
e59ea3ed 9458 [ALC662_FIXUP_HP_RP5800] = {
1727a771
TI
9459 .type = HDA_FIXUP_PINS,
9460 .v.pins = (const struct hda_pintbl[]) {
e59ea3ed
TI
9461 { 0x14, 0x0221201f }, /* HP out */
9462 { }
9463 },
9464 .chained = true,
9465 .chain_id = ALC662_FIXUP_SKU_IGNORE
9466 },
53c334ad 9467 [ALC662_FIXUP_ASUS_MODE1] = {
1727a771
TI
9468 .type = HDA_FIXUP_PINS,
9469 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9470 { 0x14, 0x99130110 }, /* speaker */
9471 { 0x18, 0x01a19c20 }, /* mic */
9472 { 0x19, 0x99a3092f }, /* int-mic */
9473 { 0x21, 0x0121401f }, /* HP out */
9474 { }
9475 },
9476 .chained = true,
9477 .chain_id = ALC662_FIXUP_SKU_IGNORE
9478 },
9479 [ALC662_FIXUP_ASUS_MODE2] = {
1727a771
TI
9480 .type = HDA_FIXUP_PINS,
9481 .v.pins = (const struct hda_pintbl[]) {
2996bdba
TI
9482 { 0x14, 0x99130110 }, /* speaker */
9483 { 0x18, 0x01a19820 }, /* mic */
9484 { 0x19, 0x99a3092f }, /* int-mic */
9485 { 0x1b, 0x0121401f }, /* HP out */
9486 { }
9487 },
53c334ad
TI
9488 .chained = true,
9489 .chain_id = ALC662_FIXUP_SKU_IGNORE
9490 },
9491 [ALC662_FIXUP_ASUS_MODE3] = {
1727a771
TI
9492 .type = HDA_FIXUP_PINS,
9493 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9494 { 0x14, 0x99130110 }, /* speaker */
9495 { 0x15, 0x0121441f }, /* HP */
9496 { 0x18, 0x01a19840 }, /* mic */
9497 { 0x19, 0x99a3094f }, /* int-mic */
9498 { 0x21, 0x01211420 }, /* HP2 */
9499 { }
9500 },
9501 .chained = true,
9502 .chain_id = ALC662_FIXUP_SKU_IGNORE
9503 },
9504 [ALC662_FIXUP_ASUS_MODE4] = {
1727a771
TI
9505 .type = HDA_FIXUP_PINS,
9506 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9507 { 0x14, 0x99130110 }, /* speaker */
9508 { 0x16, 0x99130111 }, /* speaker */
9509 { 0x18, 0x01a19840 }, /* mic */
9510 { 0x19, 0x99a3094f }, /* int-mic */
9511 { 0x21, 0x0121441f }, /* HP */
9512 { }
9513 },
9514 .chained = true,
9515 .chain_id = ALC662_FIXUP_SKU_IGNORE
9516 },
9517 [ALC662_FIXUP_ASUS_MODE5] = {
1727a771
TI
9518 .type = HDA_FIXUP_PINS,
9519 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9520 { 0x14, 0x99130110 }, /* speaker */
9521 { 0x15, 0x0121441f }, /* HP */
9522 { 0x16, 0x99130111 }, /* speaker */
9523 { 0x18, 0x01a19840 }, /* mic */
9524 { 0x19, 0x99a3094f }, /* int-mic */
9525 { }
9526 },
9527 .chained = true,
9528 .chain_id = ALC662_FIXUP_SKU_IGNORE
9529 },
9530 [ALC662_FIXUP_ASUS_MODE6] = {
1727a771
TI
9531 .type = HDA_FIXUP_PINS,
9532 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9533 { 0x14, 0x99130110 }, /* speaker */
9534 { 0x15, 0x01211420 }, /* HP2 */
9535 { 0x18, 0x01a19840 }, /* mic */
9536 { 0x19, 0x99a3094f }, /* int-mic */
9537 { 0x1b, 0x0121441f }, /* HP */
9538 { }
9539 },
9540 .chained = true,
9541 .chain_id = ALC662_FIXUP_SKU_IGNORE
9542 },
9543 [ALC662_FIXUP_ASUS_MODE7] = {
1727a771
TI
9544 .type = HDA_FIXUP_PINS,
9545 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9546 { 0x14, 0x99130110 }, /* speaker */
9547 { 0x17, 0x99130111 }, /* speaker */
9548 { 0x18, 0x01a19840 }, /* mic */
9549 { 0x19, 0x99a3094f }, /* int-mic */
9550 { 0x1b, 0x01214020 }, /* HP */
9551 { 0x21, 0x0121401f }, /* HP */
9552 { }
9553 },
9554 .chained = true,
9555 .chain_id = ALC662_FIXUP_SKU_IGNORE
9556 },
9557 [ALC662_FIXUP_ASUS_MODE8] = {
1727a771
TI
9558 .type = HDA_FIXUP_PINS,
9559 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9560 { 0x14, 0x99130110 }, /* speaker */
9561 { 0x12, 0x99a30970 }, /* int-mic */
9562 { 0x15, 0x01214020 }, /* HP */
9563 { 0x17, 0x99130111 }, /* speaker */
9564 { 0x18, 0x01a19840 }, /* mic */
9565 { 0x21, 0x0121401f }, /* HP */
9566 { }
9567 },
9568 .chained = true,
9569 .chain_id = ALC662_FIXUP_SKU_IGNORE
2996bdba 9570 },
1565cc35 9571 [ALC662_FIXUP_NO_JACK_DETECT] = {
1727a771 9572 .type = HDA_FIXUP_FUNC,
1565cc35
TI
9573 .v.func = alc_fixup_no_jack_detect,
9574 },
edfe3bfc 9575 [ALC662_FIXUP_ZOTAC_Z68] = {
1727a771
TI
9576 .type = HDA_FIXUP_PINS,
9577 .v.pins = (const struct hda_pintbl[]) {
edfe3bfc
DH
9578 { 0x1b, 0x02214020 }, /* Front HP */
9579 { }
9580 }
9581 },
125821ae 9582 [ALC662_FIXUP_INV_DMIC] = {
1727a771 9583 .type = HDA_FIXUP_FUNC,
9d36a7dc 9584 .v.func = alc_fixup_inv_dmic,
125821ae 9585 },
033b0a7c
GM
9586 [ALC668_FIXUP_DELL_XPS13] = {
9587 .type = HDA_FIXUP_FUNC,
9588 .v.func = alc_fixup_dell_xps13,
9589 .chained = true,
9590 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
9591 },
5e6db669
GM
9592 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
9593 .type = HDA_FIXUP_FUNC,
9594 .v.func = alc_fixup_disable_aamix,
9595 .chained = true,
9596 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9597 },
493a52a9
HW
9598 [ALC668_FIXUP_AUTO_MUTE] = {
9599 .type = HDA_FIXUP_FUNC,
9600 .v.func = alc_fixup_auto_mute_via_amp,
9601 .chained = true,
9602 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9603 },
1f8b46cd
DH
9604 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
9605 .type = HDA_FIXUP_PINS,
9606 .v.pins = (const struct hda_pintbl[]) {
9607 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9608 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
9609 { }
9610 },
9611 .chained = true,
9612 .chain_id = ALC662_FIXUP_HEADSET_MODE
9613 },
9614 [ALC662_FIXUP_HEADSET_MODE] = {
9615 .type = HDA_FIXUP_FUNC,
9616 .v.func = alc_fixup_headset_mode_alc662,
9617 },
73bdd597
DH
9618 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
9619 .type = HDA_FIXUP_PINS,
9620 .v.pins = (const struct hda_pintbl[]) {
9621 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9622 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9623 { }
9624 },
9625 .chained = true,
9626 .chain_id = ALC668_FIXUP_HEADSET_MODE
9627 },
9628 [ALC668_FIXUP_HEADSET_MODE] = {
9629 .type = HDA_FIXUP_FUNC,
9630 .v.func = alc_fixup_headset_mode_alc668,
9631 },
8e54b4ac 9632 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8e383953 9633 .type = HDA_FIXUP_FUNC,
eb9ca3ab 9634 .v.func = alc_fixup_bass_chmap,
8e383953
TI
9635 .chained = true,
9636 .chain_id = ALC662_FIXUP_ASUS_MODE4
9637 },
61a75f13
DH
9638 [ALC662_FIXUP_BASS_16] = {
9639 .type = HDA_FIXUP_PINS,
9640 .v.pins = (const struct hda_pintbl[]) {
9641 {0x16, 0x80106111}, /* bass speaker */
9642 {}
9643 },
9644 .chained = true,
9645 .chain_id = ALC662_FIXUP_BASS_CHMAP,
9646 },
a30c9aaa
TI
9647 [ALC662_FIXUP_BASS_1A] = {
9648 .type = HDA_FIXUP_PINS,
9649 .v.pins = (const struct hda_pintbl[]) {
9650 {0x1a, 0x80106111}, /* bass speaker */
9651 {}
9652 },
8e54b4ac
DH
9653 .chained = true,
9654 .chain_id = ALC662_FIXUP_BASS_CHMAP,
a30c9aaa 9655 },
8e54b4ac 9656 [ALC662_FIXUP_BASS_CHMAP] = {
a30c9aaa 9657 .type = HDA_FIXUP_FUNC,
eb9ca3ab 9658 .v.func = alc_fixup_bass_chmap,
a30c9aaa 9659 },
9d4dc584
BM
9660 [ALC662_FIXUP_ASUS_Nx50] = {
9661 .type = HDA_FIXUP_FUNC,
9662 .v.func = alc_fixup_auto_mute_via_amp,
9663 .chained = true,
9664 .chain_id = ALC662_FIXUP_BASS_1A
9665 },
fc7438b1
MP
9666 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
9667 .type = HDA_FIXUP_FUNC,
9668 .v.func = alc_fixup_headset_mode_alc668,
9669 .chain_id = ALC662_FIXUP_BASS_CHMAP
9670 },
3231e205
YP
9671 [ALC668_FIXUP_ASUS_Nx51] = {
9672 .type = HDA_FIXUP_PINS,
9673 .v.pins = (const struct hda_pintbl[]) {
fc7438b1
MP
9674 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9675 { 0x1a, 0x90170151 }, /* bass speaker */
9676 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
3231e205
YP
9677 {}
9678 },
9679 .chained = true,
fc7438b1 9680 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 9681 },
5b7c5e1f 9682 [ALC668_FIXUP_MIC_COEF] = {
11ba6111
TI
9683 .type = HDA_FIXUP_VERBS,
9684 .v.verbs = (const struct hda_verb[]) {
9685 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
9686 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
9687 {}
9688 },
9689 },
5b7c5e1f
TI
9690 [ALC668_FIXUP_ASUS_G751] = {
9691 .type = HDA_FIXUP_PINS,
9692 .v.pins = (const struct hda_pintbl[]) {
9693 { 0x16, 0x0421101f }, /* HP */
9694 {}
9695 },
9696 .chained = true,
9697 .chain_id = ALC668_FIXUP_MIC_COEF
9698 },
78f4f7c2
KY
9699 [ALC891_FIXUP_HEADSET_MODE] = {
9700 .type = HDA_FIXUP_FUNC,
9701 .v.func = alc_fixup_headset_mode,
9702 },
9703 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
9704 .type = HDA_FIXUP_PINS,
9705 .v.pins = (const struct hda_pintbl[]) {
9706 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9707 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9708 { }
9709 },
9710 .chained = true,
9711 .chain_id = ALC891_FIXUP_HEADSET_MODE
9712 },
9b51fe3e
SB
9713 [ALC662_FIXUP_ACER_VERITON] = {
9714 .type = HDA_FIXUP_PINS,
9715 .v.pins = (const struct hda_pintbl[]) {
9716 { 0x15, 0x50170120 }, /* no internal speaker */
9717 { }
9718 }
9719 },
1a3f0991
TI
9720 [ALC892_FIXUP_ASROCK_MOBO] = {
9721 .type = HDA_FIXUP_PINS,
9722 .v.pins = (const struct hda_pintbl[]) {
9723 { 0x15, 0x40f000f0 }, /* disabled */
9724 { 0x16, 0x40f000f0 }, /* disabled */
1a3f0991
TI
9725 { }
9726 }
9727 },
c6790c8e
KY
9728 [ALC662_FIXUP_USI_FUNC] = {
9729 .type = HDA_FIXUP_FUNC,
9730 .v.func = alc662_fixup_usi_headset_mic,
9731 },
9732 [ALC662_FIXUP_USI_HEADSET_MODE] = {
9733 .type = HDA_FIXUP_PINS,
9734 .v.pins = (const struct hda_pintbl[]) {
9735 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
9736 { 0x18, 0x01a1903d },
9737 { }
9738 },
9739 .chained = true,
9740 .chain_id = ALC662_FIXUP_USI_FUNC
9741 },
ca169cc2
KY
9742 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
9743 .type = HDA_FIXUP_FUNC,
9744 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
9745 },
00066e97
SB
9746 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
9747 .type = HDA_FIXUP_FUNC,
9748 .v.func = alc662_fixup_aspire_ethos_hp,
9749 },
00066e97
SB
9750 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
9751 .type = HDA_FIXUP_PINS,
9752 .v.pins = (const struct hda_pintbl[]) {
9753 { 0x15, 0x92130110 }, /* front speakers */
9754 { 0x18, 0x99130111 }, /* center/subwoofer */
9755 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
9756 { }
9757 },
9758 .chained = true,
336820c4 9759 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
00066e97 9760 },
5af29028
KY
9761 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
9762 .type = HDA_FIXUP_FUNC,
9763 .v.func = alc671_fixup_hp_headset_mic2,
9764 },
d858c706
JHP
9765 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
9766 .type = HDA_FIXUP_PINS,
9767 .v.pins = (const struct hda_pintbl[]) {
9768 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9769 { }
9770 },
9771 .chained = true,
9772 .chain_id = ALC662_FIXUP_USI_FUNC
9773 },
a124458a
JHP
9774 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
9775 .type = HDA_FIXUP_PINS,
9776 .v.pins = (const struct hda_pintbl[]) {
9777 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
9778 { 0x1b, 0x0221144f },
9779 { }
9780 },
9781 .chained = true,
9782 .chain_id = ALC662_FIXUP_USI_FUNC
9783 },
6cb3b707
DH
9784};
9785
a9111321 9786static const struct snd_pci_quirk alc662_fixup_tbl[] = {
53c334ad 9787 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
d3d3835c 9788 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
02f6ff90 9789 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
a6c47a85 9790 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
94024cd1 9791 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
125821ae 9792 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
1801928e 9793 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
2df03514 9794 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
a124458a 9795 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
d858c706 9796 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
73bdd597
DH
9797 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
9798 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
c5d019c3 9799 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
033b0a7c 9800 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
467e1436 9801 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
09d2014f 9802 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
ad8ff99e 9803 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8dc9abb9
KY
9804 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
9805 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6a98e34b 9806 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
e59ea3ed 9807 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
148ebf54 9808 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
2da2dc9e 9809 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
83a9efb5 9810 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
db8948e6 9811 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
9d4dc584 9812 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11ba6111 9813 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
8e54b4ac 9814 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
61a75f13 9815 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
3231e205
YP
9816 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
9817 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
c7efff92 9818 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
61a75f13 9819 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8e54b4ac 9820 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
1565cc35 9821 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
53c334ad 9822 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
a0e90acc 9823 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
c6790c8e 9824 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
ca169cc2 9825 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
d4118588 9826 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6cb3b707 9827 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1a3f0991 9828 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
edfe3bfc 9829 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
9b51fe3e 9830 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
f1ec5be1 9831 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
d2ebd479 9832 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
00066e97 9833 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
53c334ad
TI
9834
9835#if 0
9836 /* Below is a quirk table taken from the old code.
9837 * Basically the device should work as is without the fixup table.
9838 * If BIOS doesn't give a proper info, enable the corresponding
9839 * fixup entry.
7d7eb9ea 9840 */
53c334ad
TI
9841 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
9842 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
9843 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
9844 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
9845 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9846 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9847 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9848 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
9849 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
9850 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9851 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
9852 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
9853 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
9854 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
9855 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
9856 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9857 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
9858 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
9859 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9860 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9861 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9862 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9863 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
9864 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
9865 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
9866 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9867 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
9868 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9869 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9870 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
9871 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9872 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9873 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
9874 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
9875 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
9876 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
9877 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
9878 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
9879 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
9880 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9881 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
9882 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
9883 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9884 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
9885 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
9886 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
9887 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
9888 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
9889 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9890 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
9891#endif
6cb3b707
DH
9892 {}
9893};
9894
1727a771 9895static const struct hda_model_fixup alc662_fixup_models[] = {
aa3841b5
TI
9896 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
9897 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
6be7948f 9898 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
aa3841b5 9899 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
53c334ad
TI
9900 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
9901 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
9902 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
9903 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
9904 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
9905 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
9906 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
9907 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
aa3841b5 9908 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
6e72aa5f 9909 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
aa3841b5 9910 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
e32aa85a 9911 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
aa3841b5
TI
9912 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
9913 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
9914 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
9915 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
9916 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
9917 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
9918 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
9919 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
40c51675 9920 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
aa3841b5
TI
9921 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
9922 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
9923 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
9924 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
9925 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
ba90d6a6 9926 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
00066e97 9927 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
6be7948f
TB
9928 {}
9929};
6cb3b707 9930
532895c5 9931static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
78f4f7c2
KY
9932 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9933 {0x17, 0x02211010},
9934 {0x18, 0x01a19030},
9935 {0x1a, 0x01813040},
9936 {0x21, 0x01014020}),
4b4e0e32
HW
9937 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9938 {0x16, 0x01813030},
9939 {0x17, 0x02211010},
9940 {0x18, 0x01a19040},
9941 {0x21, 0x01014020}),
1f8b46cd 9942 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 9943 {0x14, 0x01014010},
1f8b46cd 9944 {0x18, 0x01a19020},
1f8b46cd 9945 {0x1a, 0x0181302f},
11580297 9946 {0x1b, 0x0221401f}),
76c2132e
DH
9947 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9948 {0x12, 0x99a30130},
9949 {0x14, 0x90170110},
9950 {0x15, 0x0321101f},
11580297 9951 {0x16, 0x03011020}),
76c2132e
DH
9952 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9953 {0x12, 0x99a30140},
9954 {0x14, 0x90170110},
9955 {0x15, 0x0321101f},
11580297 9956 {0x16, 0x03011020}),
76c2132e
DH
9957 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9958 {0x12, 0x99a30150},
9959 {0x14, 0x90170110},
9960 {0x15, 0x0321101f},
11580297 9961 {0x16, 0x03011020}),
76c2132e 9962 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
76c2132e
DH
9963 {0x14, 0x90170110},
9964 {0x15, 0x0321101f},
11580297 9965 {0x16, 0x03011020}),
76c2132e
DH
9966 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
9967 {0x12, 0x90a60130},
9968 {0x14, 0x90170110},
11580297 9969 {0x15, 0x0321101f}),
5af29028
KY
9970 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
9971 {0x14, 0x01014010},
9972 {0x17, 0x90170150},
f2adbae0 9973 {0x19, 0x02a11060},
5af29028
KY
9974 {0x1b, 0x01813030},
9975 {0x21, 0x02211020}),
9976 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
9977 {0x14, 0x01014010},
9978 {0x18, 0x01a19040},
9979 {0x1b, 0x01813030},
9980 {0x21, 0x02211020}),
9981 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
9982 {0x14, 0x01014020},
9983 {0x17, 0x90170110},
9984 {0x18, 0x01a19050},
9985 {0x1b, 0x01813040},
9986 {0x21, 0x02211030}),
532895c5
HW
9987 {}
9988};
9989
1d045db9
TI
9990/*
9991 */
bc9f98a9
KY
9992static int patch_alc662(struct hda_codec *codec)
9993{
9994 struct alc_spec *spec;
3de95173 9995 int err;
bc9f98a9 9996
3de95173
TI
9997 err = alc_alloc_spec(codec, 0x0b);
9998 if (err < 0)
9999 return err;
bc9f98a9 10000
3de95173 10001 spec = codec->spec;
1f0f4b80 10002
225068ab
TI
10003 spec->shutup = alc_eapd_shutup;
10004
53c334ad
TI
10005 /* handle multiple HPs as is */
10006 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
10007
2c3bf9ab
TI
10008 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10009
7639a06c 10010 switch (codec->core.vendor_id) {
f3f9185f
KY
10011 case 0x10ec0668:
10012 spec->init_hook = alc668_restore_default_value;
10013 break;
f3f9185f 10014 }
8663ff75 10015
c9af753f
TI
10016 alc_pre_init(codec);
10017
1727a771 10018 snd_hda_pick_fixup(codec, alc662_fixup_models,
8e5a0509 10019 alc662_fixup_tbl, alc662_fixups);
0fc1e447 10020 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
1727a771 10021 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8e5a0509
TI
10022
10023 alc_auto_parse_customize_define(codec);
10024
7504b6cd
TI
10025 if (has_cdefine_beep(codec))
10026 spec->gen.beep_nid = 0x01;
10027
1bb7e43e 10028 if ((alc_get_coef0(codec) & (1 << 14)) &&
5100cd07 10029 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 10030 spec->cdefine.platform_type == 1) {
6134b1a2
WY
10031 err = alc_codec_rename(codec, "ALC272X");
10032 if (err < 0)
e16fb6d1 10033 goto error;
20ca0c35 10034 }
274693f3 10035
b9c5106c
TI
10036 /* automatic parse from the BIOS config */
10037 err = alc662_parse_auto_config(codec);
e16fb6d1
TI
10038 if (err < 0)
10039 goto error;
bc9f98a9 10040
7504b6cd 10041 if (!spec->gen.no_analog && spec->gen.beep_nid) {
7639a06c 10042 switch (codec->core.vendor_id) {
da00c244 10043 case 0x10ec0662:
fea80fae 10044 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
da00c244
KY
10045 break;
10046 case 0x10ec0272:
10047 case 0x10ec0663:
10048 case 0x10ec0665:
9ad54547 10049 case 0x10ec0668:
fea80fae 10050 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
da00c244
KY
10051 break;
10052 case 0x10ec0273:
fea80fae 10053 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
da00c244
KY
10054 break;
10055 }
fea80fae
TI
10056 if (err < 0)
10057 goto error;
cec27c89 10058 }
2134ea4f 10059
1727a771 10060 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10061
bc9f98a9 10062 return 0;
801f49d3 10063
e16fb6d1
TI
10064 error:
10065 alc_free(codec);
10066 return err;
b478b998
KY
10067}
10068
d1eb57f4
KY
10069/*
10070 * ALC680 support
10071 */
d1eb57f4 10072
d1eb57f4
KY
10073static int alc680_parse_auto_config(struct hda_codec *codec)
10074{
3e6179b8 10075 return alc_parse_auto_config(codec, NULL, NULL);
d1eb57f4
KY
10076}
10077
d1eb57f4 10078/*
d1eb57f4 10079 */
d1eb57f4
KY
10080static int patch_alc680(struct hda_codec *codec)
10081{
d1eb57f4
KY
10082 int err;
10083
1f0f4b80 10084 /* ALC680 has no aa-loopback mixer */
3de95173
TI
10085 err = alc_alloc_spec(codec, 0);
10086 if (err < 0)
10087 return err;
1f0f4b80 10088
1ebec5f2
TI
10089 /* automatic parse from the BIOS config */
10090 err = alc680_parse_auto_config(codec);
10091 if (err < 0) {
10092 alc_free(codec);
10093 return err;
d1eb57f4
KY
10094 }
10095
d1eb57f4
KY
10096 return 0;
10097}
10098
1da177e4
LT
10099/*
10100 * patch entries
10101 */
b9a94a9c 10102static const struct hda_device_id snd_hda_id_realtek[] = {
0a6f0600 10103 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
b9a94a9c 10104 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
2a36c16e 10105 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
4231430d 10106 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
b9a94a9c
TI
10107 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
10108 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
dcd4f0db 10109 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
b9a94a9c 10110 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
736f20a7 10111 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
7fbdcd83 10112 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
b9a94a9c
TI
10113 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
10114 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
f429e7e4 10115 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
b9a94a9c
TI
10116 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
10117 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
10118 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
10119 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
10120 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
10121 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
10122 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
dcd4f0db 10123 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
b9a94a9c
TI
10124 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
10125 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
10126 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
10127 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
10128 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
10129 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
0a6f0600 10130 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
b9a94a9c 10131 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
630e3612 10132 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
b9a94a9c 10133 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
0a6f0600 10134 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
b9a94a9c
TI
10135 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
10136 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
10137 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
dcd4f0db 10138 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
7d727869 10139 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
b9a94a9c 10140 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
28f1f9b2 10141 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
1078bef0 10142 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
f0778871 10143 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
b9a94a9c
TI
10144 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
10145 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
10146 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
10147 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
10148 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
10149 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
10150 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
10151 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
10152 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
10153 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
10154 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
10155 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
10156 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
10157 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
6fbae35a
KY
10158 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
10159 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
10160 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
83629532 10161 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
78f4f7c2 10162 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
b9a94a9c
TI
10163 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
10164 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
10165 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
10166 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
10167 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
10168 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
10169 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
10170 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
10171 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
10172 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
10173 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
10174 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
10175 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
6d9ffcff 10176 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
65553b12 10177 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
a535ad57 10178 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
1da177e4
LT
10179 {} /* terminator */
10180};
b9a94a9c 10181MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
1289e9e8
TI
10182
10183MODULE_LICENSE("GPL");
10184MODULE_DESCRIPTION("Realtek HD-audio codec");
10185
d8a766a1 10186static struct hda_codec_driver realtek_driver = {
b9a94a9c 10187 .id = snd_hda_id_realtek,
1289e9e8
TI
10188};
10189
d8a766a1 10190module_hda_codec_driver(realtek_driver);