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