]> git.ipfire.org Git - thirdparty/linux.git/blame - sound/pci/hda/patch_realtek.c
ALSA: hda/realtek: Add support for Legion 7 16ACHg6 laptop
[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"
d3dca026 28#include "hda_component.h"
1da177e4 29
cd63a5ff
TI
30/* keep halting ALC5505 DSP, for power saving */
31#define HALT_REALTEK_ALC5505
32
4a79ba34
TI
33/* extra amp-initialization sequence types */
34enum {
1c76aa5f 35 ALC_INIT_UNDEFINED,
4a79ba34
TI
36 ALC_INIT_NONE,
37 ALC_INIT_DEFAULT,
4a79ba34
TI
38};
39
73bdd597
DH
40enum {
41 ALC_HEADSET_MODE_UNKNOWN,
42 ALC_HEADSET_MODE_UNPLUGGED,
43 ALC_HEADSET_MODE_HEADSET,
44 ALC_HEADSET_MODE_MIC,
45 ALC_HEADSET_MODE_HEADPHONE,
46};
47
48enum {
49 ALC_HEADSET_TYPE_UNKNOWN,
50 ALC_HEADSET_TYPE_CTIA,
51 ALC_HEADSET_TYPE_OMTP,
52};
53
c7b60a89
HW
54enum {
55 ALC_KEY_MICMUTE_INDEX,
56};
57
da00c244
KY
58struct alc_customize_define {
59 unsigned int sku_cfg;
60 unsigned char port_connectivity;
61 unsigned char check_sum;
62 unsigned char customization;
63 unsigned char external_amp;
64 unsigned int enable_pcbeep:1;
65 unsigned int platform_type:1;
66 unsigned int swap:1;
67 unsigned int override:1;
90622917 68 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
da00c244
KY
69};
70
766538ac
TI
71struct alc_coef_led {
72 unsigned int idx;
73 unsigned int mask;
74 unsigned int on;
75 unsigned int off;
76};
77
1da177e4 78struct alc_spec {
08c189f2 79 struct hda_gen_spec gen; /* must be at head */
23d30f28 80
1da177e4 81 /* codec parameterization */
da00c244 82 struct alc_customize_define cdefine;
08c189f2 83 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
834be88d 84
5579cd6f
TI
85 /* GPIO bits */
86 unsigned int gpio_mask;
87 unsigned int gpio_dir;
88 unsigned int gpio_data;
215c850c 89 bool gpio_write_delay; /* add a delay before writing gpio_data */
5579cd6f 90
8d3d1ece 91 /* mute LED for HP laptops, see vref_mute_led_set() */
08fb0d0e 92 int mute_led_polarity;
dbd13179 93 int micmute_led_polarity;
08fb0d0e 94 hda_nid_t mute_led_nid;
9c5dc3bf 95 hda_nid_t cap_mute_led_nid;
08fb0d0e 96
0f32fd19
TI
97 unsigned int gpio_mute_led_mask;
98 unsigned int gpio_mic_led_mask;
766538ac
TI
99 struct alc_coef_led mute_led_coef;
100 struct alc_coef_led mic_led_coef;
9f5c6faf 101
73bdd597
DH
102 hda_nid_t headset_mic_pin;
103 hda_nid_t headphone_mic_pin;
104 int current_headset_mode;
105 int current_headset_type;
106
ae6b813a
TI
107 /* hooks */
108 void (*init_hook)(struct hda_codec *codec);
83012a7c 109#ifdef CONFIG_PM
c97259df 110 void (*power_hook)(struct hda_codec *codec);
f5de24b0 111#endif
1c716153 112 void (*shutup)(struct hda_codec *codec);
d922b51d 113
4a79ba34 114 int init_amp;
d433a678 115 int codec_variant; /* flag for other variants */
97a26570
KY
116 unsigned int has_alc5505_dsp:1;
117 unsigned int no_depop_delay:1;
693abe11 118 unsigned int done_hp_init:1;
c0ca5ece 119 unsigned int no_shutup_pins:1;
d3ba58bb 120 unsigned int ultra_low_power:1;
476c02e0 121 unsigned int has_hs_key:1;
92666d45 122 unsigned int no_internal_mic_pin:1;
e64f14f4 123
2c3bf9ab
TI
124 /* for PLL fix */
125 hda_nid_t pll_nid;
126 unsigned int pll_coef_idx, pll_coef_bit;
1bb7e43e 127 unsigned int coef0;
33f4acd3 128 struct input_dev *kb_dev;
c7b60a89 129 u8 alc_mute_keycode_map[1];
d3dca026
LT
130
131 /* component binding */
132 struct component_match *match;
133 struct hda_component comps[HDA_MAX_COMPONENTS];
df694daa
KY
134};
135
f2a227cd
TI
136/*
137 * COEF access helper functions
138 */
139
140static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
141 unsigned int coef_idx)
142{
143 unsigned int val;
144
145 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
146 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
147 return val;
148}
149
150#define alc_read_coef_idx(codec, coef_idx) \
151 alc_read_coefex_idx(codec, 0x20, coef_idx)
152
153static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
154 unsigned int coef_idx, unsigned int coef_val)
155{
156 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
157 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
158}
159
160#define alc_write_coef_idx(codec, coef_idx, coef_val) \
161 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
162
98b24883
TI
163static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
164 unsigned int coef_idx, unsigned int mask,
165 unsigned int bits_set)
166{
167 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
168
169 if (val != -1)
170 alc_write_coefex_idx(codec, nid, coef_idx,
171 (val & ~mask) | bits_set);
172}
173
174#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
175 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
176
f2a227cd
TI
177/* a special bypass for COEF 0; read the cached value at the second time */
178static unsigned int alc_get_coef0(struct hda_codec *codec)
179{
180 struct alc_spec *spec = codec->spec;
181
182 if (!spec->coef0)
183 spec->coef0 = alc_read_coef_idx(codec, 0);
184 return spec->coef0;
185}
186
54db6c39
TI
187/* coef writes/updates batch */
188struct coef_fw {
189 unsigned char nid;
190 unsigned char idx;
191 unsigned short mask;
192 unsigned short val;
193};
194
195#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
196 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
197#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
198#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
199#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
200
201static void alc_process_coef_fw(struct hda_codec *codec,
202 const struct coef_fw *fw)
203{
204 for (; fw->nid; fw++) {
205 if (fw->mask == (unsigned short)-1)
206 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
207 else
208 alc_update_coefex_idx(codec, fw->nid, fw->idx,
209 fw->mask, fw->val);
210 }
211}
212
df694daa 213/*
1d045db9 214 * GPIO setup tables, used in initialization
df694daa 215 */
5579cd6f 216
bc9f98a9 217/* Enable GPIO mask and set output */
5579cd6f
TI
218static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
219{
220 struct alc_spec *spec = codec->spec;
bc9f98a9 221
5579cd6f
TI
222 spec->gpio_mask |= mask;
223 spec->gpio_dir |= mask;
224 spec->gpio_data |= mask;
225}
bc9f98a9 226
5579cd6f
TI
227static void alc_write_gpio_data(struct hda_codec *codec)
228{
229 struct alc_spec *spec = codec->spec;
230
231 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
232 spec->gpio_data);
233}
234
aaf312de
TI
235static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
236 bool on)
237{
238 struct alc_spec *spec = codec->spec;
239 unsigned int oldval = spec->gpio_data;
240
241 if (on)
242 spec->gpio_data |= mask;
243 else
244 spec->gpio_data &= ~mask;
245 if (oldval != spec->gpio_data)
246 alc_write_gpio_data(codec);
247}
248
5579cd6f
TI
249static void alc_write_gpio(struct hda_codec *codec)
250{
251 struct alc_spec *spec = codec->spec;
252
253 if (!spec->gpio_mask)
254 return;
255
256 snd_hda_codec_write(codec, codec->core.afg, 0,
257 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
258 snd_hda_codec_write(codec, codec->core.afg, 0,
259 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
215c850c
TI
260 if (spec->gpio_write_delay)
261 msleep(1);
5579cd6f
TI
262 alc_write_gpio_data(codec);
263}
264
265static void alc_fixup_gpio(struct hda_codec *codec, int action,
266 unsigned int mask)
267{
268 if (action == HDA_FIXUP_ACT_PRE_PROBE)
269 alc_setup_gpio(codec, mask);
270}
271
272static void alc_fixup_gpio1(struct hda_codec *codec,
273 const struct hda_fixup *fix, int action)
274{
275 alc_fixup_gpio(codec, action, 0x01);
276}
277
278static void alc_fixup_gpio2(struct hda_codec *codec,
279 const struct hda_fixup *fix, int action)
280{
281 alc_fixup_gpio(codec, action, 0x02);
282}
283
284static void alc_fixup_gpio3(struct hda_codec *codec,
285 const struct hda_fixup *fix, int action)
286{
287 alc_fixup_gpio(codec, action, 0x03);
288}
bdd148a3 289
ae065f1c
TI
290static void alc_fixup_gpio4(struct hda_codec *codec,
291 const struct hda_fixup *fix, int action)
292{
293 alc_fixup_gpio(codec, action, 0x04);
294}
295
8a503555
TI
296static void alc_fixup_micmute_led(struct hda_codec *codec,
297 const struct hda_fixup *fix, int action)
298{
e65bf997 299 if (action == HDA_FIXUP_ACT_PRE_PROBE)
8a503555
TI
300 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
301}
302
2c3bf9ab
TI
303/*
304 * Fix hardware PLL issue
305 * On some codecs, the analog PLL gating control must be off while
306 * the default value is 1.
307 */
308static void alc_fix_pll(struct hda_codec *codec)
309{
310 struct alc_spec *spec = codec->spec;
2c3bf9ab 311
98b24883
TI
312 if (spec->pll_nid)
313 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
314 1 << spec->pll_coef_bit, 0);
2c3bf9ab
TI
315}
316
317static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
318 unsigned int coef_idx, unsigned int coef_bit)
319{
320 struct alc_spec *spec = codec->spec;
321 spec->pll_nid = nid;
322 spec->pll_coef_idx = coef_idx;
323 spec->pll_coef_bit = coef_bit;
324 alc_fix_pll(codec);
325}
326
cf5a2279 327/* update the master volume per volume-knob's unsol event */
1a4f69d5
TI
328static void alc_update_knob_master(struct hda_codec *codec,
329 struct hda_jack_callback *jack)
cf5a2279
TI
330{
331 unsigned int val;
332 struct snd_kcontrol *kctl;
333 struct snd_ctl_elem_value *uctl;
334
335 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
336 if (!kctl)
337 return;
338 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
339 if (!uctl)
340 return;
2ebab40e 341 val = snd_hda_codec_read(codec, jack->nid, 0,
cf5a2279
TI
342 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
343 val &= HDA_AMP_VOLMASK;
344 uctl->value.integer.value[0] = val;
345 uctl->value.integer.value[1] = val;
346 kctl->put(kctl, uctl);
347 kfree(uctl);
348}
349
29adc4b9 350static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
f21d78e2 351{
29adc4b9
DH
352 /* For some reason, the res given from ALC880 is broken.
353 Here we adjust it properly. */
354 snd_hda_jack_unsol_event(codec, res >> 2);
f21d78e2
TI
355}
356
394c97f8
KY
357/* Change EAPD to verb control */
358static void alc_fill_eapd_coef(struct hda_codec *codec)
359{
360 int coef;
361
362 coef = alc_get_coef0(codec);
363
7639a06c 364 switch (codec->core.vendor_id) {
394c97f8
KY
365 case 0x10ec0262:
366 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
367 break;
368 case 0x10ec0267:
369 case 0x10ec0268:
370 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
371 break;
372 case 0x10ec0269:
373 if ((coef & 0x00f0) == 0x0010)
374 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
375 if ((coef & 0x00f0) == 0x0020)
376 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
377 if ((coef & 0x00f0) == 0x0030)
378 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
379 break;
380 case 0x10ec0280:
381 case 0x10ec0284:
382 case 0x10ec0290:
383 case 0x10ec0292:
384 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
385 break;
4231430d 386 case 0x10ec0225:
44be77c5
TI
387 case 0x10ec0295:
388 case 0x10ec0299:
389 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
c0dbbdad 390 fallthrough;
44be77c5 391 case 0x10ec0215:
1948fc06 392 case 0x10ec0230:
394c97f8 393 case 0x10ec0233:
ea04a1db 394 case 0x10ec0235:
c4473744 395 case 0x10ec0236:
7fbdcd83 396 case 0x10ec0245:
394c97f8 397 case 0x10ec0255:
c4473744 398 case 0x10ec0256:
f429e7e4 399 case 0x10ec0257:
394c97f8
KY
400 case 0x10ec0282:
401 case 0x10ec0283:
402 case 0x10ec0286:
403 case 0x10ec0288:
0a6f0600 404 case 0x10ec0285:
506b62c3 405 case 0x10ec0298:
0a6f0600 406 case 0x10ec0289:
1078bef0 407 case 0x10ec0300:
394c97f8
KY
408 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
409 break;
3aabf94c
KY
410 case 0x10ec0275:
411 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
412 break;
8822702f
HW
413 case 0x10ec0287:
414 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
415 alc_write_coef_idx(codec, 0x8, 0x4ab7);
416 break;
394c97f8
KY
417 case 0x10ec0293:
418 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
419 break;
dcd4f0db
KY
420 case 0x10ec0234:
421 case 0x10ec0274:
422 case 0x10ec0294:
6fbae35a
KY
423 case 0x10ec0700:
424 case 0x10ec0701:
425 case 0x10ec0703:
83629532 426 case 0x10ec0711:
dcd4f0db
KY
427 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
428 break;
394c97f8
KY
429 case 0x10ec0662:
430 if ((coef & 0x00f0) == 0x0030)
431 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
432 break;
433 case 0x10ec0272:
434 case 0x10ec0273:
435 case 0x10ec0663:
436 case 0x10ec0665:
437 case 0x10ec0670:
438 case 0x10ec0671:
439 case 0x10ec0672:
440 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
441 break;
9194a1eb 442 case 0x10ec0222:
f0778871
KY
443 case 0x10ec0623:
444 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
445 break;
394c97f8
KY
446 case 0x10ec0668:
447 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
448 break;
449 case 0x10ec0867:
450 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
451 break;
452 case 0x10ec0888:
453 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
454 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
455 break;
456 case 0x10ec0892:
e5782a5d 457 case 0x10ec0897:
394c97f8
KY
458 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
459 break;
460 case 0x10ec0899:
461 case 0x10ec0900:
6d9ffcff 462 case 0x10ec0b00:
65553b12 463 case 0x10ec1168:
a535ad57 464 case 0x10ec1220:
394c97f8
KY
465 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
466 break;
467 }
468}
469
f9423e7a
KY
470/* additional initialization for ALC888 variants */
471static void alc888_coef_init(struct hda_codec *codec)
472{
1df8874b
KY
473 switch (alc_get_coef0(codec) & 0x00f0) {
474 /* alc888-VA */
475 case 0x00:
476 /* alc888-VB */
477 case 0x10:
478 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
479 break;
480 }
87a8c370
JK
481}
482
3fb4a508
TI
483/* turn on/off EAPD control (only if available) */
484static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
485{
486 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
487 return;
488 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
489 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
490 on ? 2 : 0);
491}
492
691f1fcc
TI
493/* turn on/off EAPD controls of the codec */
494static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
495{
496 /* We currently only handle front, HP */
caf3c043 497 static const hda_nid_t pins[] = {
af95b414 498 0x0f, 0x10, 0x14, 0x15, 0x17, 0
39fa84e9 499 };
caf3c043 500 const hda_nid_t *p;
39fa84e9
TI
501 for (p = pins; *p; p++)
502 set_eapd(codec, *p, on);
691f1fcc
TI
503}
504
dad3197d
KY
505static int find_ext_mic_pin(struct hda_codec *codec);
506
507static void alc_headset_mic_no_shutup(struct hda_codec *codec)
508{
509 const struct hda_pincfg *pin;
510 int mic_pin = find_ext_mic_pin(codec);
511 int i;
512
513 /* don't shut up pins when unloading the driver; otherwise it breaks
514 * the default pin setup at the next load of the driver
515 */
516 if (codec->bus->shutdown)
517 return;
518
519 snd_array_for_each(&codec->init_pins, i, pin) {
520 /* use read here for syncing after issuing each verb */
521 if (pin->nid != mic_pin)
522 snd_hda_codec_read(codec, pin->nid, 0,
523 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
524 }
525
526 codec->pins_shutup = 1;
527}
528
c0ca5ece
TI
529static void alc_shutup_pins(struct hda_codec *codec)
530{
531 struct alc_spec *spec = codec->spec;
532
dad3197d 533 switch (codec->core.vendor_id) {
5aec9891
KY
534 case 0x10ec0236:
535 case 0x10ec0256:
66c5d718 536 case 0x10ec0283:
dad3197d
KY
537 case 0x10ec0286:
538 case 0x10ec0288:
539 case 0x10ec0298:
540 alc_headset_mic_no_shutup(codec);
541 break;
542 default:
543 if (!spec->no_shutup_pins)
544 snd_hda_shutup_pins(codec);
545 break;
546 }
c0ca5ece
TI
547}
548
1c716153 549/* generic shutup callback;
4ce8e6a5 550 * just turning off EAPD and a little pause for avoiding pop-noise
1c716153
TI
551 */
552static void alc_eapd_shutup(struct hda_codec *codec)
553{
97a26570
KY
554 struct alc_spec *spec = codec->spec;
555
1c716153 556 alc_auto_setup_eapd(codec, false);
97a26570
KY
557 if (!spec->no_depop_delay)
558 msleep(200);
c0ca5ece 559 alc_shutup_pins(codec);
1c716153
TI
560}
561
1d045db9 562/* generic EAPD initialization */
4a79ba34 563static void alc_auto_init_amp(struct hda_codec *codec, int type)
bc9f98a9 564{
39fa84e9 565 alc_auto_setup_eapd(codec, true);
5579cd6f 566 alc_write_gpio(codec);
4a79ba34 567 switch (type) {
4a79ba34 568 case ALC_INIT_DEFAULT:
7639a06c 569 switch (codec->core.vendor_id) {
c9b58006 570 case 0x10ec0260:
98b24883 571 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
c9b58006 572 break;
c9b58006
KY
573 case 0x10ec0880:
574 case 0x10ec0882:
575 case 0x10ec0883:
576 case 0x10ec0885:
1df8874b 577 alc_update_coef_idx(codec, 7, 0, 0x2030);
c9b58006 578 break;
f9423e7a 579 case 0x10ec0888:
4a79ba34 580 alc888_coef_init(codec);
f9423e7a 581 break;
bc9f98a9 582 }
4a79ba34
TI
583 break;
584 }
585}
586
35a39f98
TI
587/* get a primary headphone pin if available */
588static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
589{
590 if (spec->gen.autocfg.hp_pins[0])
591 return spec->gen.autocfg.hp_pins[0];
592 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
593 return spec->gen.autocfg.line_out_pins[0];
594 return 0;
595}
08c189f2 596
1d045db9 597/*
08c189f2 598 * Realtek SSID verification
1d045db9 599 */
42cf0d01 600
08c189f2
TI
601/* Could be any non-zero and even value. When used as fixup, tells
602 * the driver to ignore any present sku defines.
603 */
604#define ALC_FIXUP_SKU_IGNORE (2)
1a1455de 605
08c189f2
TI
606static void alc_fixup_sku_ignore(struct hda_codec *codec,
607 const struct hda_fixup *fix, int action)
1a1455de 608{
1a1455de 609 struct alc_spec *spec = codec->spec;
08c189f2
TI
610 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
611 spec->cdefine.fixup = 1;
612 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
1a1455de 613 }
1a1455de
TI
614}
615
b5c6611f
ML
616static void alc_fixup_no_depop_delay(struct hda_codec *codec,
617 const struct hda_fixup *fix, int action)
618{
619 struct alc_spec *spec = codec->spec;
620
84d2dc3e 621 if (action == HDA_FIXUP_ACT_PROBE) {
b5c6611f 622 spec->no_depop_delay = 1;
84d2dc3e
ML
623 codec->depop_delay = 0;
624 }
b5c6611f
ML
625}
626
08c189f2 627static int alc_auto_parse_customize_define(struct hda_codec *codec)
4a79ba34 628{
08c189f2
TI
629 unsigned int ass, tmp, i;
630 unsigned nid = 0;
4a79ba34
TI
631 struct alc_spec *spec = codec->spec;
632
08c189f2 633 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
4a79ba34 634
08c189f2
TI
635 if (spec->cdefine.fixup) {
636 ass = spec->cdefine.sku_cfg;
637 if (ass == ALC_FIXUP_SKU_IGNORE)
638 return -1;
639 goto do_sku;
bb35febd
TI
640 }
641
5100cd07
TI
642 if (!codec->bus->pci)
643 return -1;
7639a06c 644 ass = codec->core.subsystem_id & 0xffff;
08c189f2
TI
645 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
646 goto do_sku;
4a79ba34 647
08c189f2 648 nid = 0x1d;
7639a06c 649 if (codec->core.vendor_id == 0x10ec0260)
08c189f2
TI
650 nid = 0x17;
651 ass = snd_hda_codec_get_pincfg(codec, nid);
42cf0d01 652
08c189f2 653 if (!(ass & 1)) {
4e76a883 654 codec_info(codec, "%s: SKU not ready 0x%08x\n",
7639a06c 655 codec->core.chip_name, ass);
08c189f2 656 return -1;
42cf0d01
DH
657 }
658
08c189f2
TI
659 /* check sum */
660 tmp = 0;
661 for (i = 1; i < 16; i++) {
662 if ((ass >> i) & 1)
663 tmp++;
ae8a60a5 664 }
08c189f2
TI
665 if (((ass >> 16) & 0xf) != tmp)
666 return -1;
ae8a60a5 667
da00c244
KY
668 spec->cdefine.port_connectivity = ass >> 30;
669 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
670 spec->cdefine.check_sum = (ass >> 16) & 0xf;
671 spec->cdefine.customization = ass >> 8;
672do_sku:
673 spec->cdefine.sku_cfg = ass;
674 spec->cdefine.external_amp = (ass & 0x38) >> 3;
675 spec->cdefine.platform_type = (ass & 0x4) >> 2;
676 spec->cdefine.swap = (ass & 0x2) >> 1;
677 spec->cdefine.override = ass & 0x1;
678
4e76a883 679 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
da00c244 680 nid, spec->cdefine.sku_cfg);
4e76a883 681 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
da00c244 682 spec->cdefine.port_connectivity);
4e76a883
TI
683 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
684 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
685 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
686 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
687 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
688 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
689 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
da00c244
KY
690
691 return 0;
692}
693
08c189f2
TI
694/* return the position of NID in the list, or -1 if not found */
695static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
696{
697 int i;
698 for (i = 0; i < nums; i++)
699 if (list[i] == nid)
700 return i;
701 return -1;
702}
1d045db9 703/* return true if the given NID is found in the list */
3af9ee6b
TI
704static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
705{
21268961 706 return find_idx_in_nid_list(nid, list, nums) >= 0;
3af9ee6b
TI
707}
708
4a79ba34
TI
709/* check subsystem ID and set up device-specific initialization;
710 * return 1 if initialized, 0 if invalid SSID
711 */
712/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
713 * 31 ~ 16 : Manufacture ID
714 * 15 ~ 8 : SKU ID
715 * 7 ~ 0 : Assembly ID
716 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
717 */
58c57cfa 718static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34
TI
719{
720 unsigned int ass, tmp, i;
721 unsigned nid;
722 struct alc_spec *spec = codec->spec;
723
90622917
DH
724 if (spec->cdefine.fixup) {
725 ass = spec->cdefine.sku_cfg;
726 if (ass == ALC_FIXUP_SKU_IGNORE)
727 return 0;
728 goto do_sku;
729 }
730
7639a06c 731 ass = codec->core.subsystem_id & 0xffff;
5100cd07
TI
732 if (codec->bus->pci &&
733 ass != codec->bus->pci->subsystem_device && (ass & 1))
4a79ba34
TI
734 goto do_sku;
735
736 /* invalid SSID, check the special NID pin defcfg instead */
737 /*
def319f9 738 * 31~30 : port connectivity
4a79ba34
TI
739 * 29~21 : reserve
740 * 20 : PCBEEP input
741 * 19~16 : Check sum (15:1)
742 * 15~1 : Custom
743 * 0 : override
744 */
745 nid = 0x1d;
7639a06c 746 if (codec->core.vendor_id == 0x10ec0260)
4a79ba34
TI
747 nid = 0x17;
748 ass = snd_hda_codec_get_pincfg(codec, nid);
4e76a883
TI
749 codec_dbg(codec,
750 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
cb6605c1 751 ass, nid);
6227cdce 752 if (!(ass & 1))
4a79ba34
TI
753 return 0;
754 if ((ass >> 30) != 1) /* no physical connection */
755 return 0;
756
757 /* check sum */
758 tmp = 0;
759 for (i = 1; i < 16; i++) {
760 if ((ass >> i) & 1)
761 tmp++;
762 }
763 if (((ass >> 16) & 0xf) != tmp)
764 return 0;
765do_sku:
4e76a883 766 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
7639a06c 767 ass & 0xffff, codec->core.vendor_id);
4a79ba34
TI
768 /*
769 * 0 : override
770 * 1 : Swap Jack
771 * 2 : 0 --> Desktop, 1 --> Laptop
772 * 3~5 : External Amplifier control
773 * 7~6 : Reserved
774 */
775 tmp = (ass & 0x38) >> 3; /* external Amp control */
1c76aa5f
TI
776 if (spec->init_amp == ALC_INIT_UNDEFINED) {
777 switch (tmp) {
778 case 1:
5579cd6f 779 alc_setup_gpio(codec, 0x01);
1c76aa5f
TI
780 break;
781 case 3:
5579cd6f 782 alc_setup_gpio(codec, 0x02);
1c76aa5f
TI
783 break;
784 case 7:
5579cd6f 785 alc_setup_gpio(codec, 0x03);
1c76aa5f
TI
786 break;
787 case 5:
788 default:
789 spec->init_amp = ALC_INIT_DEFAULT;
790 break;
791 }
bc9f98a9 792 }
ea1fb29a 793
8c427226 794 /* is laptop or Desktop and enable the function "Mute internal speaker
c9b58006
KY
795 * when the external headphone out jack is plugged"
796 */
8c427226 797 if (!(ass & 0x8000))
4a79ba34 798 return 1;
c9b58006
KY
799 /*
800 * 10~8 : Jack location
801 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
802 * 14~13: Resvered
803 * 15 : 1 --> enable the function "Mute internal speaker
804 * when the external headphone out jack is plugged"
805 */
35a39f98 806 if (!alc_get_hp_pin(spec)) {
01d4825d 807 hda_nid_t nid;
c9b58006 808 tmp = (ass >> 11) & 0x3; /* HP to chassis */
58c57cfa 809 nid = ports[tmp];
08c189f2
TI
810 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
811 spec->gen.autocfg.line_outs))
3af9ee6b 812 return 1;
08c189f2 813 spec->gen.autocfg.hp_pins[0] = nid;
c9b58006 814 }
4a79ba34
TI
815 return 1;
816}
ea1fb29a 817
3e6179b8
TI
818/* Check the validity of ALC subsystem-id
819 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
820static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34 821{
58c57cfa 822 if (!alc_subsystem_id(codec, ports)) {
4a79ba34 823 struct alc_spec *spec = codec->spec;
67791202
TI
824 if (spec->init_amp == ALC_INIT_UNDEFINED) {
825 codec_dbg(codec,
826 "realtek: Enable default setup for auto mode as fallback\n");
827 spec->init_amp = ALC_INIT_DEFAULT;
828 }
4a79ba34 829 }
21268961 830}
1a1455de 831
1d045db9 832/*
ef8ef5fb 833 */
f9e336f6 834
9d36a7dc
DH
835static void alc_fixup_inv_dmic(struct hda_codec *codec,
836 const struct hda_fixup *fix, int action)
125821ae
TI
837{
838 struct alc_spec *spec = codec->spec;
668d1e96 839
9d36a7dc 840 spec->gen.inv_dmic_split = 1;
6e72aa5f
TI
841}
842
e9edcee0 843
08c189f2 844static int alc_build_controls(struct hda_codec *codec)
1d045db9 845{
a5cb463a 846 int err;
e9427969 847
08c189f2
TI
848 err = snd_hda_gen_build_controls(codec);
849 if (err < 0)
850 return err;
1da177e4 851
1727a771 852 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
1c4a54b4 853 return 0;
a361d84b
KY
854}
855
a361d84b 856
df694daa 857/*
08c189f2 858 * Common callbacks
df694daa 859 */
a361d84b 860
c9af753f
TI
861static void alc_pre_init(struct hda_codec *codec)
862{
863 alc_fill_eapd_coef(codec);
864}
865
aeac1a0d
KY
866#define is_s3_resume(codec) \
867 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
c9af753f
TI
868#define is_s4_resume(codec) \
869 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
870
08c189f2 871static int alc_init(struct hda_codec *codec)
1d045db9
TI
872{
873 struct alc_spec *spec = codec->spec;
a361d84b 874
c9af753f
TI
875 /* hibernation resume needs the full chip initialization */
876 if (is_s4_resume(codec))
877 alc_pre_init(codec);
878
08c189f2
TI
879 if (spec->init_hook)
880 spec->init_hook(codec);
a361d84b 881
89781d08 882 spec->gen.skip_verbs = 1; /* applied in below */
607ca3bd 883 snd_hda_gen_init(codec);
08c189f2
TI
884 alc_fix_pll(codec);
885 alc_auto_init_amp(codec, spec->init_amp);
89781d08 886 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
3abf2f36 887
1727a771 888 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
a361d84b 889
1d045db9
TI
890 return 0;
891}
a361d84b 892
08c189f2 893static inline void alc_shutup(struct hda_codec *codec)
1d045db9
TI
894{
895 struct alc_spec *spec = codec->spec;
a361d84b 896
c7273bd6
TI
897 if (!snd_hda_get_bool_hint(codec, "shutup"))
898 return; /* disabled explicitly by hints */
899
08c189f2
TI
900 if (spec && spec->shutup)
901 spec->shutup(codec);
9bfb2844 902 else
c0ca5ece 903 alc_shutup_pins(codec);
1d045db9
TI
904}
905
8a02c0cc 906#define alc_free snd_hda_gen_free
2134ea4f 907
08c189f2
TI
908#ifdef CONFIG_PM
909static void alc_power_eapd(struct hda_codec *codec)
1d045db9 910{
08c189f2 911 alc_auto_setup_eapd(codec, false);
1d045db9 912}
2134ea4f 913
08c189f2 914static int alc_suspend(struct hda_codec *codec)
1d045db9
TI
915{
916 struct alc_spec *spec = codec->spec;
08c189f2
TI
917 alc_shutup(codec);
918 if (spec && spec->power_hook)
919 spec->power_hook(codec);
a361d84b
KY
920 return 0;
921}
08c189f2 922#endif
a361d84b 923
08c189f2
TI
924#ifdef CONFIG_PM
925static int alc_resume(struct hda_codec *codec)
1d045db9 926{
97a26570
KY
927 struct alc_spec *spec = codec->spec;
928
929 if (!spec->no_depop_delay)
930 msleep(150); /* to avoid pop noise */
08c189f2 931 codec->patch_ops.init(codec);
1a462be5 932 snd_hda_regmap_sync(codec);
08c189f2
TI
933 hda_call_check_power_status(codec, 0x01);
934 return 0;
1d045db9 935}
08c189f2 936#endif
f6a92248 937
1d045db9 938/*
1d045db9 939 */
08c189f2
TI
940static const struct hda_codec_ops alc_patch_ops = {
941 .build_controls = alc_build_controls,
942 .build_pcms = snd_hda_gen_build_pcms,
943 .init = alc_init,
944 .free = alc_free,
945 .unsol_event = snd_hda_jack_unsol_event,
946#ifdef CONFIG_PM
947 .resume = alc_resume,
08c189f2 948 .suspend = alc_suspend,
fce52a3b 949 .check_power_status = snd_hda_gen_check_power_status,
08c189f2 950#endif
08c189f2 951};
f6a92248 952
f53281e6 953
ded255be 954#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
e01bf509 955
e4770629 956/*
4b016931 957 * Rename codecs appropriately from COEF value or subvendor id
e4770629 958 */
08c189f2
TI
959struct alc_codec_rename_table {
960 unsigned int vendor_id;
961 unsigned short coef_mask;
962 unsigned short coef_bits;
963 const char *name;
964};
84898e87 965
4b016931
KY
966struct alc_codec_rename_pci_table {
967 unsigned int codec_vendor_id;
968 unsigned short pci_subvendor;
969 unsigned short pci_subdevice;
970 const char *name;
971};
972
6b0f95c4 973static const struct alc_codec_rename_table rename_tbl[] = {
e6e5f7ad 974 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
08c189f2
TI
975 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
976 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
977 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
978 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
979 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
980 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
981 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
982 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
e6e5f7ad 983 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
08c189f2
TI
984 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
985 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
986 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
987 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
988 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
989 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
990 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
991 { } /* terminator */
992};
84898e87 993
6b0f95c4 994static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
4b016931
KY
995 { 0x10ec0280, 0x1028, 0, "ALC3220" },
996 { 0x10ec0282, 0x1028, 0, "ALC3221" },
997 { 0x10ec0283, 0x1028, 0, "ALC3223" },
193177de 998 { 0x10ec0288, 0x1028, 0, "ALC3263" },
4b016931 999 { 0x10ec0292, 0x1028, 0, "ALC3226" },
193177de 1000 { 0x10ec0293, 0x1028, 0, "ALC3235" },
4b016931
KY
1001 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1002 { 0x10ec0668, 0x1028, 0, "ALC3661" },
e6e5f7ad
KY
1003 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1004 { 0x10ec0899, 0x1028, 0, "ALC3861" },
2c674fac 1005 { 0x10ec0298, 0x1028, 0, "ALC3266" },
736f20a7 1006 { 0x10ec0236, 0x1028, 0, "ALC3204" },
82324502 1007 { 0x10ec0256, 0x1028, 0, "ALC3246" },
4231430d 1008 { 0x10ec0225, 0x1028, 0, "ALC3253" },
7d727869 1009 { 0x10ec0295, 0x1028, 0, "ALC3254" },
28f1f9b2 1010 { 0x10ec0299, 0x1028, 0, "ALC3271" },
e6e5f7ad
KY
1011 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1012 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1013 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1014 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1015 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1016 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1017 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1018 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1019 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1020 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1021 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
4b016931
KY
1022 { } /* terminator */
1023};
1024
08c189f2 1025static int alc_codec_rename_from_preset(struct hda_codec *codec)
1d045db9 1026{
08c189f2 1027 const struct alc_codec_rename_table *p;
4b016931 1028 const struct alc_codec_rename_pci_table *q;
60db6b53 1029
08c189f2 1030 for (p = rename_tbl; p->vendor_id; p++) {
7639a06c 1031 if (p->vendor_id != codec->core.vendor_id)
08c189f2
TI
1032 continue;
1033 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1034 return alc_codec_rename(codec, p->name);
1d045db9 1035 }
4b016931 1036
5100cd07
TI
1037 if (!codec->bus->pci)
1038 return 0;
4b016931 1039 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
7639a06c 1040 if (q->codec_vendor_id != codec->core.vendor_id)
4b016931
KY
1041 continue;
1042 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1043 continue;
1044 if (!q->pci_subdevice ||
1045 q->pci_subdevice == codec->bus->pci->subsystem_device)
1046 return alc_codec_rename(codec, q->name);
1047 }
1048
08c189f2 1049 return 0;
1d045db9 1050}
f53281e6 1051
e4770629 1052
1d045db9
TI
1053/*
1054 * Digital-beep handlers
1055 */
1056#ifdef CONFIG_SND_HDA_INPUT_BEEP
fea80fae
TI
1057
1058/* additional beep mixers; private_value will be overwritten */
1059static const struct snd_kcontrol_new alc_beep_mixer[] = {
1060 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1061 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1062};
1063
1064/* set up and create beep controls */
1065static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1066 int idx, int dir)
1067{
1068 struct snd_kcontrol_new *knew;
1069 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1070 int i;
1071
1072 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1073 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1074 &alc_beep_mixer[i]);
1075 if (!knew)
1076 return -ENOMEM;
1077 knew->private_value = beep_amp;
1078 }
1079 return 0;
1080}
84898e87 1081
6317e5eb 1082static const struct snd_pci_quirk beep_allow_list[] = {
7110005e 1083 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
a4b7f21d 1084 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1d045db9 1085 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
8554ee40 1086 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1d045db9
TI
1087 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1088 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1089 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
78f8baf1 1090 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1d045db9 1091 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
6317e5eb 1092 /* denylist -- no beep available */
051c78af
TI
1093 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1094 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1d045db9 1095 {}
fe3eb0a7
KY
1096};
1097
1d045db9
TI
1098static inline int has_cdefine_beep(struct hda_codec *codec)
1099{
1100 struct alc_spec *spec = codec->spec;
1101 const struct snd_pci_quirk *q;
6317e5eb 1102 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1d045db9
TI
1103 if (q)
1104 return q->value;
1105 return spec->cdefine.enable_pcbeep;
1106}
1107#else
fea80fae 1108#define set_beep_amp(spec, nid, idx, dir) 0
1d045db9
TI
1109#define has_cdefine_beep(codec) 0
1110#endif
84898e87 1111
1d045db9
TI
1112/* parse the BIOS configuration and set up the alc_spec */
1113/* return 1 if successful, 0 if the proper config is not found,
1114 * or a negative error code
1115 */
3e6179b8
TI
1116static int alc_parse_auto_config(struct hda_codec *codec,
1117 const hda_nid_t *ignore_nids,
1118 const hda_nid_t *ssid_nids)
1d045db9
TI
1119{
1120 struct alc_spec *spec = codec->spec;
08c189f2 1121 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1d045db9 1122 int err;
26f5df26 1123
53c334ad
TI
1124 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1125 spec->parse_flags);
1d045db9
TI
1126 if (err < 0)
1127 return err;
3e6179b8
TI
1128
1129 if (ssid_nids)
1130 alc_ssid_check(codec, ssid_nids);
64154835 1131
08c189f2
TI
1132 err = snd_hda_gen_parse_auto_config(codec, cfg);
1133 if (err < 0)
1134 return err;
070cff4c 1135
1d045db9 1136 return 1;
60db6b53 1137}
f6a92248 1138
3de95173
TI
1139/* common preparation job for alc_spec */
1140static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1141{
1142 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1143 int err;
1144
1145 if (!spec)
1146 return -ENOMEM;
1147 codec->spec = spec;
08c189f2
TI
1148 snd_hda_gen_spec_init(&spec->gen);
1149 spec->gen.mixer_nid = mixer_nid;
1150 spec->gen.own_eapd_ctl = 1;
1098b7c2 1151 codec->single_adc_amp = 1;
08c189f2
TI
1152 /* FIXME: do we need this for all Realtek codec models? */
1153 codec->spdif_status_reset = 1;
a6e7d0a4 1154 codec->forced_resume = 1;
225068ab 1155 codec->patch_ops = alc_patch_ops;
3de95173
TI
1156
1157 err = alc_codec_rename_from_preset(codec);
1158 if (err < 0) {
1159 kfree(spec);
1160 return err;
1161 }
1162 return 0;
1163}
1164
3e6179b8
TI
1165static int alc880_parse_auto_config(struct hda_codec *codec)
1166{
1167 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
7d7eb9ea 1168 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3e6179b8
TI
1169 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1170}
1171
ee3b2969
TI
1172/*
1173 * ALC880 fix-ups
1174 */
1175enum {
411225a0 1176 ALC880_FIXUP_GPIO1,
ee3b2969
TI
1177 ALC880_FIXUP_GPIO2,
1178 ALC880_FIXUP_MEDION_RIM,
dc6af52d 1179 ALC880_FIXUP_LG,
db8a38e5 1180 ALC880_FIXUP_LG_LW25,
f02aab5d 1181 ALC880_FIXUP_W810,
27e917f8 1182 ALC880_FIXUP_EAPD_COEF,
b9368f5c 1183 ALC880_FIXUP_TCL_S700,
cf5a2279
TI
1184 ALC880_FIXUP_VOL_KNOB,
1185 ALC880_FIXUP_FUJITSU,
ba533818 1186 ALC880_FIXUP_F1734,
817de92f 1187 ALC880_FIXUP_UNIWILL,
967b88c4 1188 ALC880_FIXUP_UNIWILL_DIG,
96e225f6 1189 ALC880_FIXUP_Z71V,
487a588d 1190 ALC880_FIXUP_ASUS_W5A,
67b6ec31
TI
1191 ALC880_FIXUP_3ST_BASE,
1192 ALC880_FIXUP_3ST,
1193 ALC880_FIXUP_3ST_DIG,
1194 ALC880_FIXUP_5ST_BASE,
1195 ALC880_FIXUP_5ST,
1196 ALC880_FIXUP_5ST_DIG,
1197 ALC880_FIXUP_6ST_BASE,
1198 ALC880_FIXUP_6ST,
1199 ALC880_FIXUP_6ST_DIG,
5397145f 1200 ALC880_FIXUP_6ST_AUTOMUTE,
ee3b2969
TI
1201};
1202
cf5a2279
TI
1203/* enable the volume-knob widget support on NID 0x21 */
1204static void alc880_fixup_vol_knob(struct hda_codec *codec,
1727a771 1205 const struct hda_fixup *fix, int action)
cf5a2279 1206{
1727a771 1207 if (action == HDA_FIXUP_ACT_PROBE)
62f949bf
TI
1208 snd_hda_jack_detect_enable_callback(codec, 0x21,
1209 alc_update_knob_master);
cf5a2279
TI
1210}
1211
1727a771 1212static const struct hda_fixup alc880_fixups[] = {
411225a0 1213 [ALC880_FIXUP_GPIO1] = {
5579cd6f
TI
1214 .type = HDA_FIXUP_FUNC,
1215 .v.func = alc_fixup_gpio1,
411225a0 1216 },
ee3b2969 1217 [ALC880_FIXUP_GPIO2] = {
5579cd6f
TI
1218 .type = HDA_FIXUP_FUNC,
1219 .v.func = alc_fixup_gpio2,
ee3b2969
TI
1220 },
1221 [ALC880_FIXUP_MEDION_RIM] = {
1727a771 1222 .type = HDA_FIXUP_VERBS,
ee3b2969
TI
1223 .v.verbs = (const struct hda_verb[]) {
1224 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1225 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1226 { }
1227 },
1228 .chained = true,
1229 .chain_id = ALC880_FIXUP_GPIO2,
1230 },
dc6af52d 1231 [ALC880_FIXUP_LG] = {
1727a771
TI
1232 .type = HDA_FIXUP_PINS,
1233 .v.pins = (const struct hda_pintbl[]) {
dc6af52d
TI
1234 /* disable bogus unused pins */
1235 { 0x16, 0x411111f0 },
1236 { 0x18, 0x411111f0 },
1237 { 0x1a, 0x411111f0 },
1238 { }
1239 }
1240 },
db8a38e5
TI
1241 [ALC880_FIXUP_LG_LW25] = {
1242 .type = HDA_FIXUP_PINS,
1243 .v.pins = (const struct hda_pintbl[]) {
1244 { 0x1a, 0x0181344f }, /* line-in */
1245 { 0x1b, 0x0321403f }, /* headphone */
1246 { }
1247 }
1248 },
f02aab5d 1249 [ALC880_FIXUP_W810] = {
1727a771
TI
1250 .type = HDA_FIXUP_PINS,
1251 .v.pins = (const struct hda_pintbl[]) {
f02aab5d
TI
1252 /* disable bogus unused pins */
1253 { 0x17, 0x411111f0 },
1254 { }
1255 },
1256 .chained = true,
1257 .chain_id = ALC880_FIXUP_GPIO2,
1258 },
27e917f8 1259 [ALC880_FIXUP_EAPD_COEF] = {
1727a771 1260 .type = HDA_FIXUP_VERBS,
27e917f8
TI
1261 .v.verbs = (const struct hda_verb[]) {
1262 /* change to EAPD mode */
1263 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1264 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1265 {}
1266 },
1267 },
b9368f5c 1268 [ALC880_FIXUP_TCL_S700] = {
1727a771 1269 .type = HDA_FIXUP_VERBS,
b9368f5c
TI
1270 .v.verbs = (const struct hda_verb[]) {
1271 /* change to EAPD mode */
1272 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1273 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1274 {}
1275 },
1276 .chained = true,
1277 .chain_id = ALC880_FIXUP_GPIO2,
1278 },
cf5a2279 1279 [ALC880_FIXUP_VOL_KNOB] = {
1727a771 1280 .type = HDA_FIXUP_FUNC,
cf5a2279
TI
1281 .v.func = alc880_fixup_vol_knob,
1282 },
1283 [ALC880_FIXUP_FUJITSU] = {
1284 /* override all pins as BIOS on old Amilo is broken */
1727a771
TI
1285 .type = HDA_FIXUP_PINS,
1286 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1287 { 0x14, 0x0121401f }, /* HP */
cf5a2279
TI
1288 { 0x15, 0x99030120 }, /* speaker */
1289 { 0x16, 0x99030130 }, /* bass speaker */
1290 { 0x17, 0x411111f0 }, /* N/A */
1291 { 0x18, 0x411111f0 }, /* N/A */
1292 { 0x19, 0x01a19950 }, /* mic-in */
1293 { 0x1a, 0x411111f0 }, /* N/A */
1294 { 0x1b, 0x411111f0 }, /* N/A */
1295 { 0x1c, 0x411111f0 }, /* N/A */
1296 { 0x1d, 0x411111f0 }, /* N/A */
1297 { 0x1e, 0x01454140 }, /* SPDIF out */
1298 { }
1299 },
1300 .chained = true,
1301 .chain_id = ALC880_FIXUP_VOL_KNOB,
1302 },
ba533818
TI
1303 [ALC880_FIXUP_F1734] = {
1304 /* almost compatible with FUJITSU, but no bass and SPDIF */
1727a771
TI
1305 .type = HDA_FIXUP_PINS,
1306 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1307 { 0x14, 0x0121401f }, /* HP */
ba533818
TI
1308 { 0x15, 0x99030120 }, /* speaker */
1309 { 0x16, 0x411111f0 }, /* N/A */
1310 { 0x17, 0x411111f0 }, /* N/A */
1311 { 0x18, 0x411111f0 }, /* N/A */
1312 { 0x19, 0x01a19950 }, /* mic-in */
1313 { 0x1a, 0x411111f0 }, /* N/A */
1314 { 0x1b, 0x411111f0 }, /* N/A */
1315 { 0x1c, 0x411111f0 }, /* N/A */
1316 { 0x1d, 0x411111f0 }, /* N/A */
1317 { 0x1e, 0x411111f0 }, /* N/A */
1318 { }
1319 },
1320 .chained = true,
1321 .chain_id = ALC880_FIXUP_VOL_KNOB,
1322 },
817de92f
TI
1323 [ALC880_FIXUP_UNIWILL] = {
1324 /* need to fix HP and speaker pins to be parsed correctly */
1727a771
TI
1325 .type = HDA_FIXUP_PINS,
1326 .v.pins = (const struct hda_pintbl[]) {
817de92f
TI
1327 { 0x14, 0x0121411f }, /* HP */
1328 { 0x15, 0x99030120 }, /* speaker */
1329 { 0x16, 0x99030130 }, /* bass speaker */
1330 { }
1331 },
1332 },
967b88c4 1333 [ALC880_FIXUP_UNIWILL_DIG] = {
1727a771
TI
1334 .type = HDA_FIXUP_PINS,
1335 .v.pins = (const struct hda_pintbl[]) {
967b88c4
TI
1336 /* disable bogus unused pins */
1337 { 0x17, 0x411111f0 },
1338 { 0x19, 0x411111f0 },
1339 { 0x1b, 0x411111f0 },
1340 { 0x1f, 0x411111f0 },
1341 { }
1342 }
1343 },
96e225f6 1344 [ALC880_FIXUP_Z71V] = {
1727a771
TI
1345 .type = HDA_FIXUP_PINS,
1346 .v.pins = (const struct hda_pintbl[]) {
96e225f6
TI
1347 /* set up the whole pins as BIOS is utterly broken */
1348 { 0x14, 0x99030120 }, /* speaker */
1349 { 0x15, 0x0121411f }, /* HP */
1350 { 0x16, 0x411111f0 }, /* N/A */
1351 { 0x17, 0x411111f0 }, /* N/A */
1352 { 0x18, 0x01a19950 }, /* mic-in */
1353 { 0x19, 0x411111f0 }, /* N/A */
1354 { 0x1a, 0x01813031 }, /* line-in */
1355 { 0x1b, 0x411111f0 }, /* N/A */
1356 { 0x1c, 0x411111f0 }, /* N/A */
1357 { 0x1d, 0x411111f0 }, /* N/A */
1358 { 0x1e, 0x0144111e }, /* SPDIF */
1359 { }
1360 }
1361 },
487a588d
TI
1362 [ALC880_FIXUP_ASUS_W5A] = {
1363 .type = HDA_FIXUP_PINS,
1364 .v.pins = (const struct hda_pintbl[]) {
1365 /* set up the whole pins as BIOS is utterly broken */
1366 { 0x14, 0x0121411f }, /* HP */
1367 { 0x15, 0x411111f0 }, /* N/A */
1368 { 0x16, 0x411111f0 }, /* N/A */
1369 { 0x17, 0x411111f0 }, /* N/A */
1370 { 0x18, 0x90a60160 }, /* mic */
1371 { 0x19, 0x411111f0 }, /* N/A */
1372 { 0x1a, 0x411111f0 }, /* N/A */
1373 { 0x1b, 0x411111f0 }, /* N/A */
1374 { 0x1c, 0x411111f0 }, /* N/A */
1375 { 0x1d, 0x411111f0 }, /* N/A */
1376 { 0x1e, 0xb743111e }, /* SPDIF out */
1377 { }
1378 },
1379 .chained = true,
1380 .chain_id = ALC880_FIXUP_GPIO1,
1381 },
67b6ec31 1382 [ALC880_FIXUP_3ST_BASE] = {
1727a771
TI
1383 .type = HDA_FIXUP_PINS,
1384 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1385 { 0x14, 0x01014010 }, /* line-out */
1386 { 0x15, 0x411111f0 }, /* N/A */
1387 { 0x16, 0x411111f0 }, /* N/A */
1388 { 0x17, 0x411111f0 }, /* N/A */
1389 { 0x18, 0x01a19c30 }, /* mic-in */
1390 { 0x19, 0x0121411f }, /* HP */
1391 { 0x1a, 0x01813031 }, /* line-in */
1392 { 0x1b, 0x02a19c40 }, /* front-mic */
1393 { 0x1c, 0x411111f0 }, /* N/A */
1394 { 0x1d, 0x411111f0 }, /* N/A */
1395 /* 0x1e is filled in below */
1396 { 0x1f, 0x411111f0 }, /* N/A */
1397 { }
1398 }
1399 },
1400 [ALC880_FIXUP_3ST] = {
1727a771
TI
1401 .type = HDA_FIXUP_PINS,
1402 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1403 { 0x1e, 0x411111f0 }, /* N/A */
1404 { }
1405 },
1406 .chained = true,
1407 .chain_id = ALC880_FIXUP_3ST_BASE,
1408 },
1409 [ALC880_FIXUP_3ST_DIG] = {
1727a771
TI
1410 .type = HDA_FIXUP_PINS,
1411 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1412 { 0x1e, 0x0144111e }, /* SPDIF */
1413 { }
1414 },
1415 .chained = true,
1416 .chain_id = ALC880_FIXUP_3ST_BASE,
1417 },
1418 [ALC880_FIXUP_5ST_BASE] = {
1727a771
TI
1419 .type = HDA_FIXUP_PINS,
1420 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1421 { 0x14, 0x01014010 }, /* front */
1422 { 0x15, 0x411111f0 }, /* N/A */
1423 { 0x16, 0x01011411 }, /* CLFE */
1424 { 0x17, 0x01016412 }, /* surr */
1425 { 0x18, 0x01a19c30 }, /* mic-in */
1426 { 0x19, 0x0121411f }, /* HP */
1427 { 0x1a, 0x01813031 }, /* line-in */
1428 { 0x1b, 0x02a19c40 }, /* front-mic */
1429 { 0x1c, 0x411111f0 }, /* N/A */
1430 { 0x1d, 0x411111f0 }, /* N/A */
1431 /* 0x1e is filled in below */
1432 { 0x1f, 0x411111f0 }, /* N/A */
1433 { }
1434 }
1435 },
1436 [ALC880_FIXUP_5ST] = {
1727a771
TI
1437 .type = HDA_FIXUP_PINS,
1438 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1439 { 0x1e, 0x411111f0 }, /* N/A */
1440 { }
1441 },
1442 .chained = true,
1443 .chain_id = ALC880_FIXUP_5ST_BASE,
1444 },
1445 [ALC880_FIXUP_5ST_DIG] = {
1727a771
TI
1446 .type = HDA_FIXUP_PINS,
1447 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1448 { 0x1e, 0x0144111e }, /* SPDIF */
1449 { }
1450 },
1451 .chained = true,
1452 .chain_id = ALC880_FIXUP_5ST_BASE,
1453 },
1454 [ALC880_FIXUP_6ST_BASE] = {
1727a771
TI
1455 .type = HDA_FIXUP_PINS,
1456 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1457 { 0x14, 0x01014010 }, /* front */
1458 { 0x15, 0x01016412 }, /* surr */
1459 { 0x16, 0x01011411 }, /* CLFE */
1460 { 0x17, 0x01012414 }, /* side */
1461 { 0x18, 0x01a19c30 }, /* mic-in */
1462 { 0x19, 0x02a19c40 }, /* front-mic */
1463 { 0x1a, 0x01813031 }, /* line-in */
1464 { 0x1b, 0x0121411f }, /* HP */
1465 { 0x1c, 0x411111f0 }, /* N/A */
1466 { 0x1d, 0x411111f0 }, /* N/A */
1467 /* 0x1e is filled in below */
1468 { 0x1f, 0x411111f0 }, /* N/A */
1469 { }
1470 }
1471 },
1472 [ALC880_FIXUP_6ST] = {
1727a771
TI
1473 .type = HDA_FIXUP_PINS,
1474 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1475 { 0x1e, 0x411111f0 }, /* N/A */
1476 { }
1477 },
1478 .chained = true,
1479 .chain_id = ALC880_FIXUP_6ST_BASE,
1480 },
1481 [ALC880_FIXUP_6ST_DIG] = {
1727a771
TI
1482 .type = HDA_FIXUP_PINS,
1483 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1484 { 0x1e, 0x0144111e }, /* SPDIF */
1485 { }
1486 },
1487 .chained = true,
1488 .chain_id = ALC880_FIXUP_6ST_BASE,
1489 },
5397145f
TI
1490 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1491 .type = HDA_FIXUP_PINS,
1492 .v.pins = (const struct hda_pintbl[]) {
1493 { 0x1b, 0x0121401f }, /* HP with jack detect */
1494 { }
1495 },
1496 .chained_before = true,
1497 .chain_id = ALC880_FIXUP_6ST_BASE,
1498 },
ee3b2969
TI
1499};
1500
1501static const struct snd_pci_quirk alc880_fixup_tbl[] = {
f02aab5d 1502 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
487a588d 1503 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
96e225f6 1504 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
29e3fdcc 1505 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
6538de03 1506 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
29e3fdcc 1507 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
27e917f8 1508 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
967b88c4 1509 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
ba533818 1510 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
817de92f 1511 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
7833c7e8 1512 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
f02aab5d 1513 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
ee3b2969 1514 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
5397145f 1515 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
a161574e 1516 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
cf5a2279 1517 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
ba533818 1518 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
cf5a2279 1519 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
dc6af52d
TI
1520 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1521 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1522 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
db8a38e5 1523 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
b9368f5c 1524 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
67b6ec31
TI
1525
1526 /* Below is the copied entries from alc880_quirks.c.
1527 * It's not quite sure whether BIOS sets the correct pin-config table
1528 * on these machines, thus they are kept to be compatible with
1529 * the old static quirks. Once when it's confirmed to work without
1530 * these overrides, it'd be better to remove.
1531 */
1532 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1533 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1534 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1535 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1536 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1537 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1538 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1539 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1540 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1541 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1542 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1543 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1544 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1545 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1546 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1547 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1548 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1549 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1550 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1551 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1552 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1553 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1554 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1555 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1556 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1557 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1558 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1559 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1560 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1561 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1562 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1563 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1564 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1565 /* default Intel */
1566 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1567 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1568 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1569 {}
1570};
1571
1727a771 1572static const struct hda_model_fixup alc880_fixup_models[] = {
67b6ec31
TI
1573 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1574 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1575 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1576 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1577 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1578 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
5397145f 1579 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
ee3b2969
TI
1580 {}
1581};
1582
1583
1d045db9
TI
1584/*
1585 * OK, here we have finally the patch for ALC880
1586 */
1d045db9 1587static int patch_alc880(struct hda_codec *codec)
60db6b53 1588{
1d045db9 1589 struct alc_spec *spec;
1d045db9 1590 int err;
f6a92248 1591
3de95173
TI
1592 err = alc_alloc_spec(codec, 0x0b);
1593 if (err < 0)
1594 return err;
64154835 1595
3de95173 1596 spec = codec->spec;
08c189f2 1597 spec->gen.need_dac_fix = 1;
7504b6cd 1598 spec->gen.beep_nid = 0x01;
f53281e6 1599
225068ab
TI
1600 codec->patch_ops.unsol_event = alc880_unsol_event;
1601
c9af753f
TI
1602 alc_pre_init(codec);
1603
1727a771 1604 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
67b6ec31 1605 alc880_fixups);
1727a771 1606 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ee3b2969 1607
67b6ec31
TI
1608 /* automatic parse from the BIOS config */
1609 err = alc880_parse_auto_config(codec);
1610 if (err < 0)
1611 goto error;
fe3eb0a7 1612
fea80fae
TI
1613 if (!spec->gen.no_analog) {
1614 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1615 if (err < 0)
1616 goto error;
1617 }
f53281e6 1618
1727a771 1619 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1620
1d045db9 1621 return 0;
e16fb6d1
TI
1622
1623 error:
1624 alc_free(codec);
1625 return err;
226b1ec8
KY
1626}
1627
1d045db9 1628
60db6b53 1629/*
1d045db9 1630 * ALC260 support
60db6b53 1631 */
1d045db9 1632static int alc260_parse_auto_config(struct hda_codec *codec)
f6a92248 1633{
1d045db9 1634 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
3e6179b8
TI
1635 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1636 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
f6a92248
KY
1637}
1638
1d045db9
TI
1639/*
1640 * Pin config fixes
1641 */
1642enum {
ca8f0424
TI
1643 ALC260_FIXUP_HP_DC5750,
1644 ALC260_FIXUP_HP_PIN_0F,
1645 ALC260_FIXUP_COEF,
15317ab2 1646 ALC260_FIXUP_GPIO1,
20f7d928
TI
1647 ALC260_FIXUP_GPIO1_TOGGLE,
1648 ALC260_FIXUP_REPLACER,
0a1c4fa2 1649 ALC260_FIXUP_HP_B1900,
118cb4a4 1650 ALC260_FIXUP_KN1,
39aedee7 1651 ALC260_FIXUP_FSC_S7020,
5ebd3bbd 1652 ALC260_FIXUP_FSC_S7020_JWSE,
d08c5ef2 1653 ALC260_FIXUP_VAIO_PINS,
1d045db9
TI
1654};
1655
20f7d928
TI
1656static void alc260_gpio1_automute(struct hda_codec *codec)
1657{
1658 struct alc_spec *spec = codec->spec;
aaf312de
TI
1659
1660 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
20f7d928
TI
1661}
1662
1663static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1727a771 1664 const struct hda_fixup *fix, int action)
20f7d928
TI
1665{
1666 struct alc_spec *spec = codec->spec;
1727a771 1667 if (action == HDA_FIXUP_ACT_PROBE) {
20f7d928
TI
1668 /* although the machine has only one output pin, we need to
1669 * toggle GPIO1 according to the jack state
1670 */
08c189f2
TI
1671 spec->gen.automute_hook = alc260_gpio1_automute;
1672 spec->gen.detect_hp = 1;
1673 spec->gen.automute_speaker = 1;
1674 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
62f949bf 1675 snd_hda_jack_detect_enable_callback(codec, 0x0f,
08c189f2 1676 snd_hda_gen_hp_automute);
5579cd6f 1677 alc_setup_gpio(codec, 0x01);
20f7d928
TI
1678 }
1679}
1680
118cb4a4 1681static void alc260_fixup_kn1(struct hda_codec *codec,
1727a771 1682 const struct hda_fixup *fix, int action)
118cb4a4
TI
1683{
1684 struct alc_spec *spec = codec->spec;
1727a771 1685 static const struct hda_pintbl pincfgs[] = {
118cb4a4
TI
1686 { 0x0f, 0x02214000 }, /* HP/speaker */
1687 { 0x12, 0x90a60160 }, /* int mic */
1688 { 0x13, 0x02a19000 }, /* ext mic */
1689 { 0x18, 0x01446000 }, /* SPDIF out */
1690 /* disable bogus I/O pins */
1691 { 0x10, 0x411111f0 },
1692 { 0x11, 0x411111f0 },
1693 { 0x14, 0x411111f0 },
1694 { 0x15, 0x411111f0 },
1695 { 0x16, 0x411111f0 },
1696 { 0x17, 0x411111f0 },
1697 { 0x19, 0x411111f0 },
1698 { }
1699 };
1700
1701 switch (action) {
1727a771
TI
1702 case HDA_FIXUP_ACT_PRE_PROBE:
1703 snd_hda_apply_pincfgs(codec, pincfgs);
118cb4a4
TI
1704 spec->init_amp = ALC_INIT_NONE;
1705 break;
1706 }
1707}
1708
39aedee7
TI
1709static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1710 const struct hda_fixup *fix, int action)
1711{
1712 struct alc_spec *spec = codec->spec;
1c76aa5f 1713 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5ebd3bbd
TI
1714 spec->init_amp = ALC_INIT_NONE;
1715}
39aedee7 1716
5ebd3bbd
TI
1717static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1718 const struct hda_fixup *fix, int action)
1719{
1720 struct alc_spec *spec = codec->spec;
1721 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
f811c3cf 1722 spec->gen.add_jack_modes = 1;
5ebd3bbd 1723 spec->gen.hp_mic = 1;
e6e0ee50 1724 }
39aedee7
TI
1725}
1726
1727a771 1727static const struct hda_fixup alc260_fixups[] = {
ca8f0424 1728 [ALC260_FIXUP_HP_DC5750] = {
1727a771
TI
1729 .type = HDA_FIXUP_PINS,
1730 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
1731 { 0x11, 0x90130110 }, /* speaker */
1732 { }
1733 }
1734 },
ca8f0424 1735 [ALC260_FIXUP_HP_PIN_0F] = {
1727a771
TI
1736 .type = HDA_FIXUP_PINS,
1737 .v.pins = (const struct hda_pintbl[]) {
ca8f0424
TI
1738 { 0x0f, 0x01214000 }, /* HP */
1739 { }
1740 }
1741 },
1742 [ALC260_FIXUP_COEF] = {
1727a771 1743 .type = HDA_FIXUP_VERBS,
ca8f0424 1744 .v.verbs = (const struct hda_verb[]) {
e30cf2d2
RM
1745 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1746 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
ca8f0424
TI
1747 { }
1748 },
ca8f0424 1749 },
15317ab2 1750 [ALC260_FIXUP_GPIO1] = {
5579cd6f
TI
1751 .type = HDA_FIXUP_FUNC,
1752 .v.func = alc_fixup_gpio1,
15317ab2 1753 },
20f7d928 1754 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1727a771 1755 .type = HDA_FIXUP_FUNC,
20f7d928
TI
1756 .v.func = alc260_fixup_gpio1_toggle,
1757 .chained = true,
1758 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1759 },
1760 [ALC260_FIXUP_REPLACER] = {
1727a771 1761 .type = HDA_FIXUP_VERBS,
20f7d928 1762 .v.verbs = (const struct hda_verb[]) {
192a98e2
TI
1763 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1764 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
20f7d928
TI
1765 { }
1766 },
1767 .chained = true,
1768 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1769 },
0a1c4fa2 1770 [ALC260_FIXUP_HP_B1900] = {
1727a771 1771 .type = HDA_FIXUP_FUNC,
0a1c4fa2
TI
1772 .v.func = alc260_fixup_gpio1_toggle,
1773 .chained = true,
1774 .chain_id = ALC260_FIXUP_COEF,
118cb4a4
TI
1775 },
1776 [ALC260_FIXUP_KN1] = {
1727a771 1777 .type = HDA_FIXUP_FUNC,
118cb4a4
TI
1778 .v.func = alc260_fixup_kn1,
1779 },
39aedee7
TI
1780 [ALC260_FIXUP_FSC_S7020] = {
1781 .type = HDA_FIXUP_FUNC,
1782 .v.func = alc260_fixup_fsc_s7020,
1783 },
5ebd3bbd
TI
1784 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1785 .type = HDA_FIXUP_FUNC,
1786 .v.func = alc260_fixup_fsc_s7020_jwse,
1787 .chained = true,
1788 .chain_id = ALC260_FIXUP_FSC_S7020,
1789 },
d08c5ef2
TI
1790 [ALC260_FIXUP_VAIO_PINS] = {
1791 .type = HDA_FIXUP_PINS,
1792 .v.pins = (const struct hda_pintbl[]) {
1793 /* Pin configs are missing completely on some VAIOs */
1794 { 0x0f, 0x01211020 },
1795 { 0x10, 0x0001003f },
1796 { 0x11, 0x411111f0 },
1797 { 0x12, 0x01a15930 },
1798 { 0x13, 0x411111f0 },
1799 { 0x14, 0x411111f0 },
1800 { 0x15, 0x411111f0 },
1801 { 0x16, 0x411111f0 },
1802 { 0x17, 0x411111f0 },
1803 { 0x18, 0x411111f0 },
1804 { 0x19, 0x411111f0 },
1805 { }
1806 }
1807 },
1d045db9
TI
1808};
1809
1810static const struct snd_pci_quirk alc260_fixup_tbl[] = {
15317ab2 1811 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
ca8f0424 1812 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
15317ab2 1813 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
ca8f0424 1814 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
0a1c4fa2 1815 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
d08c5ef2 1816 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
0f5a5b85 1817 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
39aedee7 1818 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
b1f58085 1819 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
118cb4a4 1820 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
20f7d928 1821 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
ca8f0424 1822 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1d045db9
TI
1823 {}
1824};
1825
5ebd3bbd
TI
1826static const struct hda_model_fixup alc260_fixup_models[] = {
1827 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1828 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1829 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1830 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1831 {}
1832};
1833
1d045db9
TI
1834/*
1835 */
1d045db9 1836static int patch_alc260(struct hda_codec *codec)
977ddd6b 1837{
1d045db9 1838 struct alc_spec *spec;
c3c2c9e7 1839 int err;
1d045db9 1840
3de95173
TI
1841 err = alc_alloc_spec(codec, 0x07);
1842 if (err < 0)
1843 return err;
1d045db9 1844
3de95173 1845 spec = codec->spec;
ea46c3c8
TI
1846 /* as quite a few machines require HP amp for speaker outputs,
1847 * it's easier to enable it unconditionally; even if it's unneeded,
1848 * it's almost harmless.
1849 */
1850 spec->gen.prefer_hp_amp = 1;
7504b6cd 1851 spec->gen.beep_nid = 0x01;
1d045db9 1852
225068ab
TI
1853 spec->shutup = alc_eapd_shutup;
1854
c9af753f
TI
1855 alc_pre_init(codec);
1856
5ebd3bbd
TI
1857 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1858 alc260_fixups);
1727a771 1859 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
977ddd6b 1860
c3c2c9e7
TI
1861 /* automatic parse from the BIOS config */
1862 err = alc260_parse_auto_config(codec);
1863 if (err < 0)
1864 goto error;
977ddd6b 1865
fea80fae
TI
1866 if (!spec->gen.no_analog) {
1867 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1868 if (err < 0)
1869 goto error;
1870 }
977ddd6b 1871
1727a771 1872 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1873
1d045db9 1874 return 0;
e16fb6d1
TI
1875
1876 error:
1877 alc_free(codec);
1878 return err;
6981d184
TI
1879}
1880
1d045db9
TI
1881
1882/*
1883 * ALC882/883/885/888/889 support
1884 *
1885 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1886 * configuration. Each pin widget can choose any input DACs and a mixer.
1887 * Each ADC is connected from a mixer of all inputs. This makes possible
1888 * 6-channel independent captures.
1889 *
1890 * In addition, an independent DAC for the multi-playback (not used in this
1891 * driver yet).
1892 */
1d045db9
TI
1893
1894/*
1895 * Pin config fixes
1896 */
ff818c24 1897enum {
5c0ebfbe
TI
1898 ALC882_FIXUP_ABIT_AW9D_MAX,
1899 ALC882_FIXUP_LENOVO_Y530,
1900 ALC882_FIXUP_PB_M5210,
1901 ALC882_FIXUP_ACER_ASPIRE_7736,
1902 ALC882_FIXUP_ASUS_W90V,
8f239214 1903 ALC889_FIXUP_CD,
b2c53e20 1904 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
5c0ebfbe 1905 ALC889_FIXUP_VAIO_TT,
0e7cc2e7 1906 ALC888_FIXUP_EEE1601,
4841b8e6 1907 ALC886_FIXUP_EAPD,
177943a3 1908 ALC882_FIXUP_EAPD,
7a6069bf 1909 ALC883_FIXUP_EAPD,
8812c4f9 1910 ALC883_FIXUP_ACER_EAPD,
1a97b7f2
TI
1911 ALC882_FIXUP_GPIO1,
1912 ALC882_FIXUP_GPIO2,
eb844d51 1913 ALC882_FIXUP_GPIO3,
68ef0561
TI
1914 ALC889_FIXUP_COEF,
1915 ALC882_FIXUP_ASUS_W2JC,
c3e837bb
TI
1916 ALC882_FIXUP_ACER_ASPIRE_4930G,
1917 ALC882_FIXUP_ACER_ASPIRE_8930G,
1918 ALC882_FIXUP_ASPIRE_8930G_VERBS,
5671087f 1919 ALC885_FIXUP_MACPRO_GPIO,
02a237b2 1920 ALC889_FIXUP_DAC_ROUTE,
1a97b7f2
TI
1921 ALC889_FIXUP_MBP_VREF,
1922 ALC889_FIXUP_IMAC91_VREF,
e7729a41 1923 ALC889_FIXUP_MBA11_VREF,
0756f09c 1924 ALC889_FIXUP_MBA21_VREF,
c20f31ec 1925 ALC889_FIXUP_MP11_VREF,
9f660a1c 1926 ALC889_FIXUP_MP41_VREF,
6e72aa5f 1927 ALC882_FIXUP_INV_DMIC,
e427c237 1928 ALC882_FIXUP_NO_PRIMARY_HP,
1f0bbf03 1929 ALC887_FIXUP_ASUS_BASS,
eb9ca3ab 1930 ALC887_FIXUP_BASS_CHMAP,
7beb3a6e 1931 ALC1220_FIXUP_GB_DUAL_CODECS,
c1933008 1932 ALC1220_FIXUP_GB_X570,
0202f5cd 1933 ALC1220_FIXUP_CLEVO_P950,
80690a27
RS
1934 ALC1220_FIXUP_CLEVO_PB51ED,
1935 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
ca184355
JHP
1936 ALC887_FIXUP_ASUS_AUDIO,
1937 ALC887_FIXUP_ASUS_HMIC,
ff818c24
TI
1938};
1939
68ef0561 1940static void alc889_fixup_coef(struct hda_codec *codec,
1727a771 1941 const struct hda_fixup *fix, int action)
68ef0561 1942{
1727a771 1943 if (action != HDA_FIXUP_ACT_INIT)
68ef0561 1944 return;
1df8874b 1945 alc_update_coef_idx(codec, 7, 0, 0x2030);
68ef0561
TI
1946}
1947
5671087f
TI
1948/* set up GPIO at initialization */
1949static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1727a771 1950 const struct hda_fixup *fix, int action)
5671087f 1951{
215c850c
TI
1952 struct alc_spec *spec = codec->spec;
1953
1954 spec->gpio_write_delay = true;
1955 alc_fixup_gpio3(codec, fix, action);
5671087f
TI
1956}
1957
02a237b2
TI
1958/* Fix the connection of some pins for ALC889:
1959 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1960 * work correctly (bko#42740)
1961 */
1962static void alc889_fixup_dac_route(struct hda_codec *codec,
1727a771 1963 const struct hda_fixup *fix, int action)
02a237b2 1964{
1727a771 1965 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
ef8d60fb 1966 /* fake the connections during parsing the tree */
caf3c043
MM
1967 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1968 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1969 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1970 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1971 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1972 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
1727a771 1973 } else if (action == HDA_FIXUP_ACT_PROBE) {
ef8d60fb 1974 /* restore the connections */
caf3c043
MM
1975 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1976 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1977 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1978 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1979 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
02a237b2
TI
1980 }
1981}
1982
1a97b7f2
TI
1983/* Set VREF on HP pin */
1984static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1727a771 1985 const struct hda_fixup *fix, int action)
1a97b7f2 1986{
caf3c043 1987 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
1a97b7f2 1988 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
1989 int i;
1990
1727a771 1991 if (action != HDA_FIXUP_ACT_INIT)
1a97b7f2
TI
1992 return;
1993 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1994 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1995 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1996 continue;
d3f02d60 1997 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 1998 val |= AC_PINCTL_VREF_80;
cdd03ced 1999 snd_hda_set_pin_ctl(codec, nids[i], val);
08c189f2 2000 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2001 break;
2002 }
2003}
2004
0756f09c
TI
2005static void alc889_fixup_mac_pins(struct hda_codec *codec,
2006 const hda_nid_t *nids, int num_nids)
1a97b7f2
TI
2007{
2008 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
2009 int i;
2010
0756f09c 2011 for (i = 0; i < num_nids; i++) {
1a97b7f2 2012 unsigned int val;
d3f02d60 2013 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 2014 val |= AC_PINCTL_VREF_50;
cdd03ced 2015 snd_hda_set_pin_ctl(codec, nids[i], val);
1a97b7f2 2016 }
08c189f2 2017 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2018}
2019
0756f09c
TI
2020/* Set VREF on speaker pins on imac91 */
2021static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2022 const struct hda_fixup *fix, int action)
2023{
caf3c043 2024 static const hda_nid_t nids[] = { 0x18, 0x1a };
0756f09c
TI
2025
2026 if (action == HDA_FIXUP_ACT_INIT)
2027 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2028}
2029
e7729a41
AV
2030/* Set VREF on speaker pins on mba11 */
2031static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2032 const struct hda_fixup *fix, int action)
2033{
caf3c043 2034 static const hda_nid_t nids[] = { 0x18 };
e7729a41
AV
2035
2036 if (action == HDA_FIXUP_ACT_INIT)
2037 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2038}
2039
0756f09c
TI
2040/* Set VREF on speaker pins on mba21 */
2041static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2042 const struct hda_fixup *fix, int action)
2043{
caf3c043 2044 static const hda_nid_t nids[] = { 0x18, 0x19 };
0756f09c
TI
2045
2046 if (action == HDA_FIXUP_ACT_INIT)
2047 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2048}
2049
e427c237 2050/* Don't take HP output as primary
d9111496
FLVC
2051 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2052 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
e427c237
TI
2053 */
2054static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1727a771 2055 const struct hda_fixup *fix, int action)
e427c237
TI
2056{
2057 struct alc_spec *spec = codec->spec;
da96fb5b 2058 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
08c189f2 2059 spec->gen.no_primary_hp = 1;
da96fb5b
TI
2060 spec->gen.no_multi_io = 1;
2061 }
e427c237
TI
2062}
2063
eb9ca3ab
TI
2064static void alc_fixup_bass_chmap(struct hda_codec *codec,
2065 const struct hda_fixup *fix, int action);
2066
7beb3a6e
TI
2067/* For dual-codec configuration, we need to disable some features to avoid
2068 * conflicts of kctls and PCM streams
2069 */
2070static void alc_fixup_dual_codecs(struct hda_codec *codec,
2071 const struct hda_fixup *fix, int action)
2072{
2073 struct alc_spec *spec = codec->spec;
2074
2075 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2076 return;
2077 /* disable vmaster */
2078 spec->gen.suppress_vmaster = 1;
2079 /* auto-mute and auto-mic switch don't work with multiple codecs */
2080 spec->gen.suppress_auto_mute = 1;
2081 spec->gen.suppress_auto_mic = 1;
2082 /* disable aamix as well */
2083 spec->gen.mixer_nid = 0;
2084 /* add location prefix to avoid conflicts */
2085 codec->force_pin_prefix = 1;
2086}
2087
2088static void rename_ctl(struct hda_codec *codec, const char *oldname,
2089 const char *newname)
2090{
2091 struct snd_kcontrol *kctl;
2092
2093 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2094 if (kctl)
2095 strcpy(kctl->id.name, newname);
2096}
2097
2098static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2099 const struct hda_fixup *fix,
2100 int action)
2101{
2102 alc_fixup_dual_codecs(codec, fix, action);
2103 switch (action) {
2104 case HDA_FIXUP_ACT_PRE_PROBE:
2105 /* override card longname to provide a unique UCM profile */
2106 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2107 break;
2108 case HDA_FIXUP_ACT_BUILD:
2109 /* rename Capture controls depending on the codec */
2110 rename_ctl(codec, "Capture Volume",
2111 codec->addr == 0 ?
2112 "Rear-Panel Capture Volume" :
2113 "Front-Panel Capture Volume");
2114 rename_ctl(codec, "Capture Switch",
2115 codec->addr == 0 ?
2116 "Rear-Panel Capture Switch" :
2117 "Front-Panel Capture Switch");
2118 break;
2119 }
2120}
2121
c1933008
CL
2122static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2123 const struct hda_fixup *fix,
2124 int action)
2125{
2126 static const hda_nid_t conn1[] = { 0x0c };
2127 static const struct coef_fw gb_x570_coefs[] = {
2128 WRITE_COEF(0x1a, 0x01c1),
2129 WRITE_COEF(0x1b, 0x0202),
2130 WRITE_COEF(0x43, 0x3005),
2131 {}
2132 };
2133
2134 switch (action) {
2135 case HDA_FIXUP_ACT_PRE_PROBE:
2136 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2137 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2138 break;
2139 case HDA_FIXUP_ACT_INIT:
2140 alc_process_coef_fw(codec, gb_x570_coefs);
2141 break;
2142 }
2143}
2144
0202f5cd
P
2145static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2146 const struct hda_fixup *fix,
2147 int action)
2148{
caf3c043 2149 static const hda_nid_t conn1[] = { 0x0c };
0202f5cd
P
2150
2151 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2152 return;
2153
2154 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2155 /* We therefore want to make sure 0x14 (front headphone) and
2156 * 0x1b (speakers) use the stereo DAC 0x02
2157 */
caf3c043
MM
2158 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2159 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
0202f5cd
P
2160}
2161
7f665b1c
JS
2162static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2163 const struct hda_fixup *fix, int action);
2164
80690a27 2165static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
7f665b1c
JS
2166 const struct hda_fixup *fix,
2167 int action)
2168{
2169 alc1220_fixup_clevo_p950(codec, fix, action);
2170 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2171}
2172
ca184355
JHP
2173static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2174 struct hda_jack_callback *jack)
2175{
2176 struct alc_spec *spec = codec->spec;
2177 unsigned int vref;
2178
2179 snd_hda_gen_hp_automute(codec, jack);
2180
2181 if (spec->gen.hp_jack_present)
2182 vref = AC_PINCTL_VREF_80;
2183 else
2184 vref = AC_PINCTL_VREF_HIZ;
2185 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2186}
2187
2188static void alc887_fixup_asus_jack(struct hda_codec *codec,
2189 const struct hda_fixup *fix, int action)
2190{
2191 struct alc_spec *spec = codec->spec;
2192 if (action != HDA_FIXUP_ACT_PROBE)
2193 return;
2194 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2195 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2196}
2197
1727a771 2198static const struct hda_fixup alc882_fixups[] = {
5c0ebfbe 2199 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1727a771
TI
2200 .type = HDA_FIXUP_PINS,
2201 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2202 { 0x15, 0x01080104 }, /* side */
2203 { 0x16, 0x01011012 }, /* rear */
2204 { 0x17, 0x01016011 }, /* clfe */
2785591a 2205 { }
145a902b
DH
2206 }
2207 },
5c0ebfbe 2208 [ALC882_FIXUP_LENOVO_Y530] = {
1727a771
TI
2209 .type = HDA_FIXUP_PINS,
2210 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2211 { 0x15, 0x99130112 }, /* rear int speakers */
2212 { 0x16, 0x99130111 }, /* subwoofer */
ac612407
DH
2213 { }
2214 }
2215 },
5c0ebfbe 2216 [ALC882_FIXUP_PB_M5210] = {
fd108215
TI
2217 .type = HDA_FIXUP_PINCTLS,
2218 .v.pins = (const struct hda_pintbl[]) {
2219 { 0x19, PIN_VREF50 },
357f915e
KY
2220 {}
2221 }
2222 },
5c0ebfbe 2223 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
1727a771 2224 .type = HDA_FIXUP_FUNC,
23d30f28 2225 .v.func = alc_fixup_sku_ignore,
6981d184 2226 },
5c0ebfbe 2227 [ALC882_FIXUP_ASUS_W90V] = {
1727a771
TI
2228 .type = HDA_FIXUP_PINS,
2229 .v.pins = (const struct hda_pintbl[]) {
5cdf745e
TI
2230 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2231 { }
2232 }
2233 },
8f239214 2234 [ALC889_FIXUP_CD] = {
1727a771
TI
2235 .type = HDA_FIXUP_PINS,
2236 .v.pins = (const struct hda_pintbl[]) {
8f239214
MB
2237 { 0x1c, 0x993301f0 }, /* CD */
2238 { }
2239 }
2240 },
b2c53e20
DH
2241 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2242 .type = HDA_FIXUP_PINS,
2243 .v.pins = (const struct hda_pintbl[]) {
2244 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2245 { }
2246 },
2247 .chained = true,
2248 .chain_id = ALC889_FIXUP_CD,
2249 },
5c0ebfbe 2250 [ALC889_FIXUP_VAIO_TT] = {
1727a771
TI
2251 .type = HDA_FIXUP_PINS,
2252 .v.pins = (const struct hda_pintbl[]) {
5c0ebfbe
TI
2253 { 0x17, 0x90170111 }, /* hidden surround speaker */
2254 { }
2255 }
2256 },
0e7cc2e7 2257 [ALC888_FIXUP_EEE1601] = {
1727a771 2258 .type = HDA_FIXUP_VERBS,
0e7cc2e7
TI
2259 .v.verbs = (const struct hda_verb[]) {
2260 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2261 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2262 { }
2263 }
177943a3 2264 },
4841b8e6
PH
2265 [ALC886_FIXUP_EAPD] = {
2266 .type = HDA_FIXUP_VERBS,
2267 .v.verbs = (const struct hda_verb[]) {
2268 /* change to EAPD mode */
2269 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2270 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2271 { }
2272 }
2273 },
177943a3 2274 [ALC882_FIXUP_EAPD] = {
1727a771 2275 .type = HDA_FIXUP_VERBS,
177943a3
TI
2276 .v.verbs = (const struct hda_verb[]) {
2277 /* change to EAPD mode */
2278 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2279 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2280 { }
2281 }
2282 },
7a6069bf 2283 [ALC883_FIXUP_EAPD] = {
1727a771 2284 .type = HDA_FIXUP_VERBS,
7a6069bf
TI
2285 .v.verbs = (const struct hda_verb[]) {
2286 /* change to EAPD mode */
2287 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2288 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2289 { }
2290 }
2291 },
8812c4f9 2292 [ALC883_FIXUP_ACER_EAPD] = {
1727a771 2293 .type = HDA_FIXUP_VERBS,
8812c4f9
TI
2294 .v.verbs = (const struct hda_verb[]) {
2295 /* eanable EAPD on Acer laptops */
2296 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2297 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2298 { }
2299 }
2300 },
1a97b7f2 2301 [ALC882_FIXUP_GPIO1] = {
5579cd6f
TI
2302 .type = HDA_FIXUP_FUNC,
2303 .v.func = alc_fixup_gpio1,
1a97b7f2
TI
2304 },
2305 [ALC882_FIXUP_GPIO2] = {
5579cd6f
TI
2306 .type = HDA_FIXUP_FUNC,
2307 .v.func = alc_fixup_gpio2,
1a97b7f2 2308 },
eb844d51 2309 [ALC882_FIXUP_GPIO3] = {
5579cd6f
TI
2310 .type = HDA_FIXUP_FUNC,
2311 .v.func = alc_fixup_gpio3,
eb844d51 2312 },
68ef0561 2313 [ALC882_FIXUP_ASUS_W2JC] = {
5579cd6f
TI
2314 .type = HDA_FIXUP_FUNC,
2315 .v.func = alc_fixup_gpio1,
68ef0561
TI
2316 .chained = true,
2317 .chain_id = ALC882_FIXUP_EAPD,
2318 },
2319 [ALC889_FIXUP_COEF] = {
1727a771 2320 .type = HDA_FIXUP_FUNC,
68ef0561
TI
2321 .v.func = alc889_fixup_coef,
2322 },
c3e837bb 2323 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
1727a771
TI
2324 .type = HDA_FIXUP_PINS,
2325 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2326 { 0x16, 0x99130111 }, /* CLFE speaker */
2327 { 0x17, 0x99130112 }, /* surround speaker */
2328 { }
038d4fef
TI
2329 },
2330 .chained = true,
2331 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb
TI
2332 },
2333 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
1727a771
TI
2334 .type = HDA_FIXUP_PINS,
2335 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2336 { 0x16, 0x99130111 }, /* CLFE speaker */
2337 { 0x1b, 0x99130112 }, /* surround speaker */
2338 { }
2339 },
2340 .chained = true,
2341 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2342 },
2343 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2344 /* additional init verbs for Acer Aspire 8930G */
1727a771 2345 .type = HDA_FIXUP_VERBS,
c3e837bb
TI
2346 .v.verbs = (const struct hda_verb[]) {
2347 /* Enable all DACs */
2348 /* DAC DISABLE/MUTE 1? */
2349 /* setting bits 1-5 disables DAC nids 0x02-0x06
2350 * apparently. Init=0x38 */
2351 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2352 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2353 /* DAC DISABLE/MUTE 2? */
2354 /* some bit here disables the other DACs.
2355 * Init=0x4900 */
2356 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2357 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2358 /* DMIC fix
2359 * This laptop has a stereo digital microphone.
2360 * The mics are only 1cm apart which makes the stereo
2361 * useless. However, either the mic or the ALC889
2362 * makes the signal become a difference/sum signal
2363 * instead of standard stereo, which is annoying.
2364 * So instead we flip this bit which makes the
2365 * codec replicate the sum signal to both channels,
2366 * turning it into a normal mono mic.
2367 */
2368 /* DMIC_CONTROL? Init value = 0x0001 */
2369 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2370 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2371 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2372 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2373 { }
038d4fef
TI
2374 },
2375 .chained = true,
2376 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb 2377 },
5671087f 2378 [ALC885_FIXUP_MACPRO_GPIO] = {
1727a771 2379 .type = HDA_FIXUP_FUNC,
5671087f
TI
2380 .v.func = alc885_fixup_macpro_gpio,
2381 },
02a237b2 2382 [ALC889_FIXUP_DAC_ROUTE] = {
1727a771 2383 .type = HDA_FIXUP_FUNC,
02a237b2
TI
2384 .v.func = alc889_fixup_dac_route,
2385 },
1a97b7f2 2386 [ALC889_FIXUP_MBP_VREF] = {
1727a771 2387 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2388 .v.func = alc889_fixup_mbp_vref,
2389 .chained = true,
2390 .chain_id = ALC882_FIXUP_GPIO1,
2391 },
2392 [ALC889_FIXUP_IMAC91_VREF] = {
1727a771 2393 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2394 .v.func = alc889_fixup_imac91_vref,
2395 .chained = true,
2396 .chain_id = ALC882_FIXUP_GPIO1,
2397 },
e7729a41
AV
2398 [ALC889_FIXUP_MBA11_VREF] = {
2399 .type = HDA_FIXUP_FUNC,
2400 .v.func = alc889_fixup_mba11_vref,
2401 .chained = true,
2402 .chain_id = ALC889_FIXUP_MBP_VREF,
2403 },
0756f09c
TI
2404 [ALC889_FIXUP_MBA21_VREF] = {
2405 .type = HDA_FIXUP_FUNC,
2406 .v.func = alc889_fixup_mba21_vref,
2407 .chained = true,
2408 .chain_id = ALC889_FIXUP_MBP_VREF,
2409 },
c20f31ec
TI
2410 [ALC889_FIXUP_MP11_VREF] = {
2411 .type = HDA_FIXUP_FUNC,
2412 .v.func = alc889_fixup_mba11_vref,
2413 .chained = true,
2414 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2415 },
9f660a1c
MK
2416 [ALC889_FIXUP_MP41_VREF] = {
2417 .type = HDA_FIXUP_FUNC,
2418 .v.func = alc889_fixup_mbp_vref,
2419 .chained = true,
2420 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2421 },
6e72aa5f 2422 [ALC882_FIXUP_INV_DMIC] = {
1727a771 2423 .type = HDA_FIXUP_FUNC,
9d36a7dc 2424 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2425 },
e427c237 2426 [ALC882_FIXUP_NO_PRIMARY_HP] = {
1727a771 2427 .type = HDA_FIXUP_FUNC,
e427c237
TI
2428 .v.func = alc882_fixup_no_primary_hp,
2429 },
1f0bbf03
TI
2430 [ALC887_FIXUP_ASUS_BASS] = {
2431 .type = HDA_FIXUP_PINS,
2432 .v.pins = (const struct hda_pintbl[]) {
2433 {0x16, 0x99130130}, /* bass speaker */
2434 {}
2435 },
eb9ca3ab
TI
2436 .chained = true,
2437 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2438 },
2439 [ALC887_FIXUP_BASS_CHMAP] = {
2440 .type = HDA_FIXUP_FUNC,
2441 .v.func = alc_fixup_bass_chmap,
1f0bbf03 2442 },
7beb3a6e
TI
2443 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2444 .type = HDA_FIXUP_FUNC,
2445 .v.func = alc1220_fixup_gb_dual_codecs,
2446 },
c1933008
CL
2447 [ALC1220_FIXUP_GB_X570] = {
2448 .type = HDA_FIXUP_FUNC,
2449 .v.func = alc1220_fixup_gb_x570,
2450 },
0202f5cd
P
2451 [ALC1220_FIXUP_CLEVO_P950] = {
2452 .type = HDA_FIXUP_FUNC,
2453 .v.func = alc1220_fixup_clevo_p950,
2454 },
80690a27 2455 [ALC1220_FIXUP_CLEVO_PB51ED] = {
7f665b1c 2456 .type = HDA_FIXUP_FUNC,
80690a27 2457 .v.func = alc1220_fixup_clevo_pb51ed,
7f665b1c 2458 },
80690a27 2459 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
7f665b1c
JS
2460 .type = HDA_FIXUP_PINS,
2461 .v.pins = (const struct hda_pintbl[]) {
2462 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2463 {}
2464 },
2465 .chained = true,
80690a27 2466 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
7f665b1c 2467 },
ca184355
JHP
2468 [ALC887_FIXUP_ASUS_AUDIO] = {
2469 .type = HDA_FIXUP_PINS,
2470 .v.pins = (const struct hda_pintbl[]) {
2471 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2472 { 0x19, 0x22219420 },
2473 {}
2474 },
2475 },
2476 [ALC887_FIXUP_ASUS_HMIC] = {
2477 .type = HDA_FIXUP_FUNC,
2478 .v.func = alc887_fixup_asus_jack,
2479 .chained = true,
2480 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2481 },
ff818c24
TI
2482};
2483
1d045db9 2484static const struct snd_pci_quirk alc882_fixup_tbl[] = {
8812c4f9
TI
2485 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2486 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
b5d724b1 2487 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
8812c4f9
TI
2488 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2489 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2490 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2491 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
c3e837bb
TI
2492 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2493 ALC882_FIXUP_ACER_ASPIRE_4930G),
2494 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2495 ALC882_FIXUP_ACER_ASPIRE_4930G),
2496 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2497 ALC882_FIXUP_ACER_ASPIRE_8930G),
2498 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2499 ALC882_FIXUP_ACER_ASPIRE_8930G),
b265047a
TI
2500 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2501 ALC882_FIXUP_ACER_ASPIRE_4930G),
2502 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
c3e837bb
TI
2503 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2504 ALC882_FIXUP_ACER_ASPIRE_4930G),
2505 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2506 ALC882_FIXUP_ACER_ASPIRE_4930G),
f5c53d89
TI
2507 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2508 ALC882_FIXUP_ACER_ASPIRE_4930G),
02a237b2 2509 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
fe97da1f 2510 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
ac9b1cdd 2511 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
177943a3 2512 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
5c0ebfbe 2513 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
68ef0561 2514 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
ca184355 2515 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
0e7cc2e7 2516 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
1f0bbf03 2517 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
85bcf96c 2518 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
b7529c18
TI
2519 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2520 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
ac9b1cdd 2521 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
e427c237 2522 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
3f3c3714 2523 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
5671087f
TI
2524
2525 /* All Apple entries are in codec SSIDs */
1a97b7f2
TI
2526 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2527 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2528 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
c20f31ec 2529 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
5671087f
TI
2530 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2531 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2532 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2533 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
5671087f 2534 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
e7729a41 2535 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
0756f09c 2536 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
1a97b7f2
TI
2537 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2538 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
5671087f 2539 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2540 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2541 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2542 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
9f660a1c 2543 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
05193639 2544 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
1a97b7f2
TI
2545 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2546 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
649ccd08 2547 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
5671087f 2548
7a6069bf 2549 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
4841b8e6 2550 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
b2c53e20 2551 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
7beb3a6e 2552 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
c1933008 2553 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
d9e8fe0c 2554 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
a0b03952 2555 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
a655e2b1 2556 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
09926202 2557 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
1d3aa4a5 2558 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
7dafba37 2559 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
cc5049ae 2560 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
d2c3b14e 2561 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
26af1772 2562 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
63691587 2563 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
d2c3b14e 2564 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
5c0ebfbe 2565 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
13e1a4cd
TI
2566 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2567 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2568 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2569 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2570 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
aef454b4 2571 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
13e1a4cd
TI
2572 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2573 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2574 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
dbfe8350 2575 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
13e1a4cd 2576 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
1f8d398e 2577 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
cc03069a 2578 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
0202f5cd 2579 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
b5acfe15 2580 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
13e1a4cd 2581 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
f3d737b6 2582 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2f0d520a 2583 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
b5acfe15
PH
2584 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2585 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2586 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2587 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
503d90b3
RS
2588 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2589 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
b5acfe15 2590 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
7a6069bf
TI
2591 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2592 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
ac9b1cdd 2593 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
68ef0561 2594 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
ff818c24
TI
2595 {}
2596};
2597
1727a771 2598static const struct hda_model_fixup alc882_fixup_models[] = {
772c2917
TI
2599 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2600 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2601 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2602 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2603 {.id = ALC889_FIXUP_CD, .name = "cd"},
2604 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2605 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2606 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2607 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2608 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2609 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2610 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2611 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2612 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2613 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
912093bc
TI
2614 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2615 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2616 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
772c2917
TI
2617 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2618 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2619 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2620 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2621 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2622 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2623 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2624 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
6e72aa5f 2625 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
e427c237 2626 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
772c2917 2627 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
ba90d6a6 2628 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
772c2917 2629 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
912093bc
TI
2630 {}
2631};
2632
119b75c1
HW
2633static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2634 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2635 {0x14, 0x01014010},
2636 {0x15, 0x01011012},
2637 {0x16, 0x01016011},
2638 {0x18, 0x01a19040},
2639 {0x19, 0x02a19050},
2640 {0x1a, 0x0181304f},
2641 {0x1b, 0x0221401f},
2642 {0x1e, 0x01456130}),
2643 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2644 {0x14, 0x01015010},
2645 {0x15, 0x01011012},
2646 {0x16, 0x01011011},
2647 {0x18, 0x01a11040},
2648 {0x19, 0x02a19050},
2649 {0x1a, 0x0181104f},
2650 {0x1b, 0x0221401f},
2651 {0x1e, 0x01451130}),
2652 {}
2653};
2654
f6a92248 2655/*
1d045db9 2656 * BIOS auto configuration
f6a92248 2657 */
1d045db9
TI
2658/* almost identical with ALC880 parser... */
2659static int alc882_parse_auto_config(struct hda_codec *codec)
2660{
1d045db9 2661 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2662 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2663 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
1d045db9 2664}
b896b4eb 2665
1d045db9
TI
2666/*
2667 */
1d045db9 2668static int patch_alc882(struct hda_codec *codec)
f6a92248
KY
2669{
2670 struct alc_spec *spec;
1a97b7f2 2671 int err;
f6a92248 2672
3de95173
TI
2673 err = alc_alloc_spec(codec, 0x0b);
2674 if (err < 0)
2675 return err;
f6a92248 2676
3de95173 2677 spec = codec->spec;
1f0f4b80 2678
7639a06c 2679 switch (codec->core.vendor_id) {
1d045db9
TI
2680 case 0x10ec0882:
2681 case 0x10ec0885:
acf08081 2682 case 0x10ec0900:
6d9ffcff 2683 case 0x10ec0b00:
a535ad57 2684 case 0x10ec1220:
1d045db9
TI
2685 break;
2686 default:
2687 /* ALC883 and variants */
2688 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2689 break;
c793bec5 2690 }
977ddd6b 2691
c9af753f
TI
2692 alc_pre_init(codec);
2693
1727a771 2694 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
912093bc 2695 alc882_fixups);
119b75c1 2696 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
1727a771 2697 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ff818c24 2698
1d045db9
TI
2699 alc_auto_parse_customize_define(codec);
2700
7504b6cd
TI
2701 if (has_cdefine_beep(codec))
2702 spec->gen.beep_nid = 0x01;
2703
1a97b7f2
TI
2704 /* automatic parse from the BIOS config */
2705 err = alc882_parse_auto_config(codec);
2706 if (err < 0)
2707 goto error;
f6a92248 2708
fea80fae
TI
2709 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2710 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2711 if (err < 0)
2712 goto error;
2713 }
f6a92248 2714
1727a771 2715 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2716
f6a92248 2717 return 0;
e16fb6d1
TI
2718
2719 error:
2720 alc_free(codec);
2721 return err;
f6a92248
KY
2722}
2723
df694daa 2724
df694daa 2725/*
1d045db9 2726 * ALC262 support
df694daa 2727 */
1d045db9 2728static int alc262_parse_auto_config(struct hda_codec *codec)
df694daa 2729{
1d045db9 2730 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2731 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2732 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
df694daa
KY
2733}
2734
df694daa 2735/*
1d045db9 2736 * Pin config fixes
df694daa 2737 */
cfc9b06f 2738enum {
ea4e7af1 2739 ALC262_FIXUP_FSC_H270,
7513e6da 2740 ALC262_FIXUP_FSC_S7110,
ea4e7af1
TI
2741 ALC262_FIXUP_HP_Z200,
2742 ALC262_FIXUP_TYAN,
c470150c 2743 ALC262_FIXUP_LENOVO_3000,
b42590b8
TI
2744 ALC262_FIXUP_BENQ,
2745 ALC262_FIXUP_BENQ_T31,
6e72aa5f 2746 ALC262_FIXUP_INV_DMIC,
b5c6611f 2747 ALC262_FIXUP_INTEL_BAYLEYBAY,
cfc9b06f
TI
2748};
2749
1727a771 2750static const struct hda_fixup alc262_fixups[] = {
ea4e7af1 2751 [ALC262_FIXUP_FSC_H270] = {
1727a771
TI
2752 .type = HDA_FIXUP_PINS,
2753 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2754 { 0x14, 0x99130110 }, /* speaker */
2755 { 0x15, 0x0221142f }, /* front HP */
2756 { 0x1b, 0x0121141f }, /* rear HP */
2757 { }
2758 }
2759 },
7513e6da
TI
2760 [ALC262_FIXUP_FSC_S7110] = {
2761 .type = HDA_FIXUP_PINS,
2762 .v.pins = (const struct hda_pintbl[]) {
2763 { 0x15, 0x90170110 }, /* speaker */
2764 { }
2765 },
2766 .chained = true,
2767 .chain_id = ALC262_FIXUP_BENQ,
2768 },
ea4e7af1 2769 [ALC262_FIXUP_HP_Z200] = {
1727a771
TI
2770 .type = HDA_FIXUP_PINS,
2771 .v.pins = (const struct hda_pintbl[]) {
1d045db9 2772 { 0x16, 0x99130120 }, /* internal speaker */
73413b12
TI
2773 { }
2774 }
cfc9b06f 2775 },
ea4e7af1 2776 [ALC262_FIXUP_TYAN] = {
1727a771
TI
2777 .type = HDA_FIXUP_PINS,
2778 .v.pins = (const struct hda_pintbl[]) {
ea4e7af1
TI
2779 { 0x14, 0x1993e1f0 }, /* int AUX */
2780 { }
2781 }
2782 },
c470150c 2783 [ALC262_FIXUP_LENOVO_3000] = {
fd108215
TI
2784 .type = HDA_FIXUP_PINCTLS,
2785 .v.pins = (const struct hda_pintbl[]) {
2786 { 0x19, PIN_VREF50 },
b42590b8
TI
2787 {}
2788 },
2789 .chained = true,
2790 .chain_id = ALC262_FIXUP_BENQ,
2791 },
2792 [ALC262_FIXUP_BENQ] = {
1727a771 2793 .type = HDA_FIXUP_VERBS,
b42590b8 2794 .v.verbs = (const struct hda_verb[]) {
c470150c
TI
2795 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2796 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2797 {}
2798 }
2799 },
b42590b8 2800 [ALC262_FIXUP_BENQ_T31] = {
1727a771 2801 .type = HDA_FIXUP_VERBS,
b42590b8
TI
2802 .v.verbs = (const struct hda_verb[]) {
2803 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2804 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2805 {}
2806 }
2807 },
6e72aa5f 2808 [ALC262_FIXUP_INV_DMIC] = {
1727a771 2809 .type = HDA_FIXUP_FUNC,
9d36a7dc 2810 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2811 },
b5c6611f
ML
2812 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2813 .type = HDA_FIXUP_FUNC,
2814 .v.func = alc_fixup_no_depop_delay,
2815 },
cfc9b06f
TI
2816};
2817
1d045db9 2818static const struct snd_pci_quirk alc262_fixup_tbl[] = {
ea4e7af1 2819 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
7513e6da 2820 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
3dcd3be3 2821 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
ea4e7af1 2822 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
275ec0cb 2823 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
ea4e7af1 2824 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
c470150c 2825 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
b42590b8
TI
2826 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2827 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
b5c6611f 2828 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
cfc9b06f
TI
2829 {}
2830};
df694daa 2831
1727a771 2832static const struct hda_model_fixup alc262_fixup_models[] = {
6e72aa5f 2833 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
e43c44d6
TI
2834 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2835 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2836 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2837 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2838 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2839 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2840 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2841 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
6e72aa5f
TI
2842 {}
2843};
1d045db9 2844
1d045db9
TI
2845/*
2846 */
1d045db9 2847static int patch_alc262(struct hda_codec *codec)
df694daa
KY
2848{
2849 struct alc_spec *spec;
df694daa
KY
2850 int err;
2851
3de95173
TI
2852 err = alc_alloc_spec(codec, 0x0b);
2853 if (err < 0)
2854 return err;
df694daa 2855
3de95173 2856 spec = codec->spec;
08c189f2 2857 spec->gen.shared_mic_vref_pin = 0x18;
1d045db9 2858
225068ab
TI
2859 spec->shutup = alc_eapd_shutup;
2860
1d045db9
TI
2861#if 0
2862 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2863 * under-run
2864 */
98b24883 2865 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
1d045db9 2866#endif
1d045db9
TI
2867 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2868
c9af753f
TI
2869 alc_pre_init(codec);
2870
1727a771 2871 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
6e72aa5f 2872 alc262_fixups);
1727a771 2873 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9c7f852e 2874
af741c15
TI
2875 alc_auto_parse_customize_define(codec);
2876
7504b6cd
TI
2877 if (has_cdefine_beep(codec))
2878 spec->gen.beep_nid = 0x01;
2879
42399f7a
TI
2880 /* automatic parse from the BIOS config */
2881 err = alc262_parse_auto_config(codec);
2882 if (err < 0)
2883 goto error;
df694daa 2884
fea80fae
TI
2885 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2886 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2887 if (err < 0)
2888 goto error;
2889 }
2134ea4f 2890
1727a771 2891 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2892
1da177e4 2893 return 0;
e16fb6d1
TI
2894
2895 error:
2896 alc_free(codec);
2897 return err;
1da177e4
LT
2898}
2899
f32610ed 2900/*
1d045db9 2901 * ALC268
f32610ed 2902 */
1d045db9 2903/* bind Beep switches of both NID 0x0f and 0x10 */
a717777d
TI
2904static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2905 struct snd_ctl_elem_value *ucontrol)
2906{
2907 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2908 unsigned long pval;
2909 int err;
2910
2911 mutex_lock(&codec->control_mutex);
2912 pval = kcontrol->private_value;
2913 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2914 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2915 if (err >= 0) {
2916 kcontrol->private_value = (pval & ~0xff) | 0x10;
2917 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2918 }
2919 kcontrol->private_value = pval;
2920 mutex_unlock(&codec->control_mutex);
2921 return err;
2922}
f32610ed 2923
1d045db9
TI
2924static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2925 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
a717777d
TI
2926 {
2927 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2928 .name = "Beep Playback Switch",
2929 .subdevice = HDA_SUBDEV_AMP_FLAG,
2930 .info = snd_hda_mixer_amp_switch_info,
2931 .get = snd_hda_mixer_amp_switch_get,
2932 .put = alc268_beep_switch_put,
2933 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2934 },
f32610ed
JS
2935};
2936
1d045db9
TI
2937/* set PCBEEP vol = 0, mute connections */
2938static const struct hda_verb alc268_beep_init_verbs[] = {
2939 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2940 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2941 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2942 { }
f32610ed
JS
2943};
2944
6e72aa5f
TI
2945enum {
2946 ALC268_FIXUP_INV_DMIC,
cb766404 2947 ALC268_FIXUP_HP_EAPD,
24eff328 2948 ALC268_FIXUP_SPDIF,
6e72aa5f
TI
2949};
2950
1727a771 2951static const struct hda_fixup alc268_fixups[] = {
6e72aa5f 2952 [ALC268_FIXUP_INV_DMIC] = {
1727a771 2953 .type = HDA_FIXUP_FUNC,
9d36a7dc 2954 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2955 },
cb766404 2956 [ALC268_FIXUP_HP_EAPD] = {
1727a771 2957 .type = HDA_FIXUP_VERBS,
cb766404
TI
2958 .v.verbs = (const struct hda_verb[]) {
2959 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2960 {}
2961 }
2962 },
24eff328
TI
2963 [ALC268_FIXUP_SPDIF] = {
2964 .type = HDA_FIXUP_PINS,
2965 .v.pins = (const struct hda_pintbl[]) {
2966 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2967 {}
2968 }
2969 },
6e72aa5f
TI
2970};
2971
1727a771 2972static const struct hda_model_fixup alc268_fixup_models[] = {
6e72aa5f 2973 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
cb766404 2974 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
03bf11c9 2975 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
cb766404
TI
2976 {}
2977};
2978
2979static const struct snd_pci_quirk alc268_fixup_tbl[] = {
24eff328 2980 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
fcd8f3b1 2981 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
cb766404
TI
2982 /* below is codec SSID since multiple Toshiba laptops have the
2983 * same PCI SSID 1179:ff00
2984 */
2985 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
6e72aa5f
TI
2986 {}
2987};
2988
f32610ed
JS
2989/*
2990 * BIOS auto configuration
2991 */
1d045db9 2992static int alc268_parse_auto_config(struct hda_codec *codec)
f32610ed 2993{
3e6179b8 2994 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7504b6cd 2995 return alc_parse_auto_config(codec, NULL, alc268_ssids);
f32610ed
JS
2996}
2997
1d045db9
TI
2998/*
2999 */
1d045db9 3000static int patch_alc268(struct hda_codec *codec)
f32610ed
JS
3001{
3002 struct alc_spec *spec;
a5cb463a 3003 int i, err;
f32610ed 3004
1d045db9 3005 /* ALC268 has no aa-loopback mixer */
3de95173
TI
3006 err = alc_alloc_spec(codec, 0);
3007 if (err < 0)
3008 return err;
3009
3010 spec = codec->spec;
2722b535
TI
3011 if (has_cdefine_beep(codec))
3012 spec->gen.beep_nid = 0x01;
1f0f4b80 3013
225068ab
TI
3014 spec->shutup = alc_eapd_shutup;
3015
c9af753f
TI
3016 alc_pre_init(codec);
3017
1727a771
TI
3018 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3019 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6e72aa5f 3020
6ebb8053
TI
3021 /* automatic parse from the BIOS config */
3022 err = alc268_parse_auto_config(codec);
e16fb6d1
TI
3023 if (err < 0)
3024 goto error;
f32610ed 3025
7504b6cd
TI
3026 if (err > 0 && !spec->gen.no_analog &&
3027 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
a5cb463a
TI
3028 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3029 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3030 &alc268_beep_mixer[i])) {
3031 err = -ENOMEM;
3032 goto error;
3033 }
3034 }
7504b6cd 3035 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
1d045db9
TI
3036 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3037 /* override the amp caps for beep generator */
3038 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3039 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3040 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3041 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3042 (0 << AC_AMPCAP_MUTE_SHIFT));
2f893286
KY
3043 }
3044
1727a771 3045 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6e72aa5f 3046
f32610ed 3047 return 0;
e16fb6d1
TI
3048
3049 error:
3050 alc_free(codec);
3051 return err;
f32610ed
JS
3052}
3053
bc9f98a9 3054/*
1d045db9 3055 * ALC269
bc9f98a9 3056 */
08c189f2 3057
1d045db9 3058static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
1d045db9 3059 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9
KY
3060};
3061
1d045db9 3062static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
1d045db9 3063 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9 3064};
291702f0 3065
1d045db9
TI
3066/* different alc269-variants */
3067enum {
3068 ALC269_TYPE_ALC269VA,
3069 ALC269_TYPE_ALC269VB,
3070 ALC269_TYPE_ALC269VC,
adcc70b2 3071 ALC269_TYPE_ALC269VD,
065380f0
KY
3072 ALC269_TYPE_ALC280,
3073 ALC269_TYPE_ALC282,
2af02be7 3074 ALC269_TYPE_ALC283,
065380f0 3075 ALC269_TYPE_ALC284,
4731d5de 3076 ALC269_TYPE_ALC293,
7fc7d047 3077 ALC269_TYPE_ALC286,
506b62c3 3078 ALC269_TYPE_ALC298,
1d04c9de 3079 ALC269_TYPE_ALC255,
4344aec8 3080 ALC269_TYPE_ALC256,
f429e7e4 3081 ALC269_TYPE_ALC257,
0a6f0600 3082 ALC269_TYPE_ALC215,
4231430d 3083 ALC269_TYPE_ALC225,
99cee034 3084 ALC269_TYPE_ALC287,
dcd4f0db 3085 ALC269_TYPE_ALC294,
1078bef0 3086 ALC269_TYPE_ALC300,
f0778871 3087 ALC269_TYPE_ALC623,
6fbae35a 3088 ALC269_TYPE_ALC700,
bc9f98a9
KY
3089};
3090
3091/*
1d045db9 3092 * BIOS auto configuration
bc9f98a9 3093 */
1d045db9
TI
3094static int alc269_parse_auto_config(struct hda_codec *codec)
3095{
1d045db9 3096 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3e6179b8
TI
3097 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3098 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3099 struct alc_spec *spec = codec->spec;
adcc70b2
KY
3100 const hda_nid_t *ssids;
3101
3102 switch (spec->codec_variant) {
3103 case ALC269_TYPE_ALC269VA:
3104 case ALC269_TYPE_ALC269VC:
065380f0
KY
3105 case ALC269_TYPE_ALC280:
3106 case ALC269_TYPE_ALC284:
4731d5de 3107 case ALC269_TYPE_ALC293:
adcc70b2
KY
3108 ssids = alc269va_ssids;
3109 break;
3110 case ALC269_TYPE_ALC269VB:
3111 case ALC269_TYPE_ALC269VD:
065380f0 3112 case ALC269_TYPE_ALC282:
2af02be7 3113 case ALC269_TYPE_ALC283:
7fc7d047 3114 case ALC269_TYPE_ALC286:
506b62c3 3115 case ALC269_TYPE_ALC298:
1d04c9de 3116 case ALC269_TYPE_ALC255:
4344aec8 3117 case ALC269_TYPE_ALC256:
f429e7e4 3118 case ALC269_TYPE_ALC257:
0a6f0600 3119 case ALC269_TYPE_ALC215:
4231430d 3120 case ALC269_TYPE_ALC225:
99cee034 3121 case ALC269_TYPE_ALC287:
dcd4f0db 3122 case ALC269_TYPE_ALC294:
1078bef0 3123 case ALC269_TYPE_ALC300:
f0778871 3124 case ALC269_TYPE_ALC623:
6fbae35a 3125 case ALC269_TYPE_ALC700:
adcc70b2
KY
3126 ssids = alc269_ssids;
3127 break;
3128 default:
3129 ssids = alc269_ssids;
3130 break;
3131 }
bc9f98a9 3132
3e6179b8 3133 return alc_parse_auto_config(codec, alc269_ignore, ssids);
1d045db9 3134}
bc9f98a9 3135
476c02e0
HW
3136static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3137 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3138 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3139 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3140 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3141 {}
3142};
3143
3144static void alc_headset_btn_callback(struct hda_codec *codec,
3145 struct hda_jack_callback *jack)
3146{
3147 int report = 0;
3148
3149 if (jack->unsol_res & (7 << 13))
3150 report |= SND_JACK_BTN_0;
3151
3152 if (jack->unsol_res & (1 << 16 | 3 << 8))
3153 report |= SND_JACK_BTN_1;
3154
3155 /* Volume up key */
3156 if (jack->unsol_res & (7 << 23))
3157 report |= SND_JACK_BTN_2;
3158
3159 /* Volume down key */
3160 if (jack->unsol_res & (7 << 10))
3161 report |= SND_JACK_BTN_3;
3162
04f7791b 3163 snd_hda_jack_set_button_state(codec, jack->nid, report);
476c02e0
HW
3164}
3165
3166static void alc_disable_headset_jack_key(struct hda_codec *codec)
3167{
3168 struct alc_spec *spec = codec->spec;
3169
3170 if (!spec->has_hs_key)
3171 return;
3172
3173 switch (codec->core.vendor_id) {
3174 case 0x10ec0215:
3175 case 0x10ec0225:
3176 case 0x10ec0285:
c72b9bfe 3177 case 0x10ec0287:
476c02e0
HW
3178 case 0x10ec0295:
3179 case 0x10ec0289:
3180 case 0x10ec0299:
3181 alc_write_coef_idx(codec, 0x48, 0x0);
3182 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3183 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3184 break;
1948fc06 3185 case 0x10ec0230:
476c02e0
HW
3186 case 0x10ec0236:
3187 case 0x10ec0256:
3188 alc_write_coef_idx(codec, 0x48, 0x0);
3189 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3190 break;
3191 }
3192}
3193
3194static void alc_enable_headset_jack_key(struct hda_codec *codec)
3195{
3196 struct alc_spec *spec = codec->spec;
3197
3198 if (!spec->has_hs_key)
3199 return;
3200
3201 switch (codec->core.vendor_id) {
3202 case 0x10ec0215:
3203 case 0x10ec0225:
3204 case 0x10ec0285:
c72b9bfe 3205 case 0x10ec0287:
476c02e0
HW
3206 case 0x10ec0295:
3207 case 0x10ec0289:
3208 case 0x10ec0299:
3209 alc_write_coef_idx(codec, 0x48, 0xd011);
3210 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3211 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3212 break;
1948fc06 3213 case 0x10ec0230:
476c02e0
HW
3214 case 0x10ec0236:
3215 case 0x10ec0256:
3216 alc_write_coef_idx(codec, 0x48, 0xd011);
3217 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3218 break;
3219 }
3220}
3221
3222static void alc_fixup_headset_jack(struct hda_codec *codec,
3223 const struct hda_fixup *fix, int action)
3224{
3225 struct alc_spec *spec = codec->spec;
04f7791b 3226 hda_nid_t hp_pin;
476c02e0
HW
3227
3228 switch (action) {
3229 case HDA_FIXUP_ACT_PRE_PROBE:
3230 spec->has_hs_key = 1;
3231 snd_hda_jack_detect_enable_callback(codec, 0x55,
3232 alc_headset_btn_callback);
476c02e0 3233 break;
04f7791b
HW
3234 case HDA_FIXUP_ACT_BUILD:
3235 hp_pin = alc_get_hp_pin(spec);
3236 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3237 alc_headset_btn_keymap,
3238 hp_pin))
3239 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3240 false, SND_JACK_HEADSET,
3241 alc_headset_btn_keymap);
3242
476c02e0
HW
3243 alc_enable_headset_jack_key(codec);
3244 break;
3245 }
3246}
3247
1387e2d1 3248static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
1d045db9 3249{
98b24883 3250 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
1d045db9 3251}
291702f0 3252
1d045db9
TI
3253static void alc269_shutup(struct hda_codec *codec)
3254{
adcc70b2
KY
3255 struct alc_spec *spec = codec->spec;
3256
1387e2d1
KY
3257 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3258 alc269vb_toggle_power_output(codec, 0);
3259 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3260 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3261 msleep(150);
3262 }
c0ca5ece 3263 alc_shutup_pins(codec);
1d045db9 3264}
291702f0 3265
6b0f95c4 3266static const struct coef_fw alc282_coefs[] = {
54db6c39 3267 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
32fa7e49 3268 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3269 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3270 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3271 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3272 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3273 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3274 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3275 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3276 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3277 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3278 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3279 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3280 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3281 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3282 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3283 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3284 WRITE_COEF(0x63, 0x2902), /* PLL */
3285 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3286 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3287 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3288 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3289 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3290 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3291 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3292 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3293 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3294 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3295 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3296 {}
3297};
3298
cb149cb3
KY
3299static void alc282_restore_default_value(struct hda_codec *codec)
3300{
54db6c39 3301 alc_process_coef_fw(codec, alc282_coefs);
cb149cb3
KY
3302}
3303
7b5c7a02
KY
3304static void alc282_init(struct hda_codec *codec)
3305{
3306 struct alc_spec *spec = codec->spec;
35a39f98 3307 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3308 bool hp_pin_sense;
3309 int coef78;
3310
cb149cb3
KY
3311 alc282_restore_default_value(codec);
3312
7b5c7a02
KY
3313 if (!hp_pin)
3314 return;
3315 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3316 coef78 = alc_read_coef_idx(codec, 0x78);
3317
3318 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3319 /* Headphone capless set to high power mode */
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
3331 snd_hda_codec_write(codec, hp_pin, 0,
3332 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3333
3334 if (hp_pin_sense)
3335 msleep(100);
3336
3337 /* Headphone capless set to normal mode */
3338 alc_write_coef_idx(codec, 0x78, coef78);
3339}
3340
3341static void alc282_shutup(struct hda_codec *codec)
3342{
3343 struct alc_spec *spec = codec->spec;
35a39f98 3344 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3345 bool hp_pin_sense;
3346 int coef78;
3347
3348 if (!hp_pin) {
3349 alc269_shutup(codec);
3350 return;
3351 }
3352
3353 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3354 coef78 = alc_read_coef_idx(codec, 0x78);
3355 alc_write_coef_idx(codec, 0x78, 0x9004);
3356
3357 if (hp_pin_sense)
3358 msleep(2);
3359
3360 snd_hda_codec_write(codec, hp_pin, 0,
3361 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3362
3363 if (hp_pin_sense)
3364 msleep(85);
3365
c0ca5ece
TI
3366 if (!spec->no_shutup_pins)
3367 snd_hda_codec_write(codec, hp_pin, 0,
3368 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
7b5c7a02
KY
3369
3370 if (hp_pin_sense)
3371 msleep(100);
3372
3373 alc_auto_setup_eapd(codec, false);
c0ca5ece 3374 alc_shutup_pins(codec);
7b5c7a02
KY
3375 alc_write_coef_idx(codec, 0x78, coef78);
3376}
3377
6b0f95c4 3378static const struct coef_fw alc283_coefs[] = {
54db6c39 3379 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
56779864 3380 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3381 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3382 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3383 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3384 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3385 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3386 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3387 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3388 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3389 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3390 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3391 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3392 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3393 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3394 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3395 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3396 WRITE_COEF(0x2e, 0x2902), /* PLL */
3397 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3398 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3399 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3400 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3401 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3402 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3403 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3404 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3405 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3406 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3407 WRITE_COEF(0x49, 0x0), /* test mode */
3408 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3409 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3410 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
56779864 3411 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
54db6c39
TI
3412 {}
3413};
3414
6bd55b04
KY
3415static void alc283_restore_default_value(struct hda_codec *codec)
3416{
54db6c39 3417 alc_process_coef_fw(codec, alc283_coefs);
6bd55b04
KY
3418}
3419
2af02be7
KY
3420static void alc283_init(struct hda_codec *codec)
3421{
3422 struct alc_spec *spec = codec->spec;
35a39f98 3423 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3424 bool hp_pin_sense;
2af02be7 3425
6bd55b04
KY
3426 alc283_restore_default_value(codec);
3427
2af02be7
KY
3428 if (!hp_pin)
3429 return;
a59d7199
KY
3430
3431 msleep(30);
2af02be7
KY
3432 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3433
3434 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3435 /* Headphone capless set to high power mode */
3436 alc_write_coef_idx(codec, 0x43, 0x9004);
3437
3438 snd_hda_codec_write(codec, hp_pin, 0,
3439 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3440
3441 if (hp_pin_sense)
3442 msleep(85);
3443
3444 snd_hda_codec_write(codec, hp_pin, 0,
3445 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3446
3447 if (hp_pin_sense)
3448 msleep(85);
3449 /* Index 0x46 Combo jack auto switch control 2 */
3450 /* 3k pull low control for Headset jack. */
98b24883 3451 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2af02be7
KY
3452 /* Headphone capless set to normal mode */
3453 alc_write_coef_idx(codec, 0x43, 0x9614);
3454}
3455
3456static void alc283_shutup(struct hda_codec *codec)
3457{
3458 struct alc_spec *spec = codec->spec;
35a39f98 3459 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3460 bool hp_pin_sense;
2af02be7
KY
3461
3462 if (!hp_pin) {
3463 alc269_shutup(codec);
3464 return;
3465 }
3466
3467 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3468
3469 alc_write_coef_idx(codec, 0x43, 0x9004);
3470
b450b17c
HP
3471 /*depop hp during suspend*/
3472 alc_write_coef_idx(codec, 0x06, 0x2100);
3473
2af02be7
KY
3474 snd_hda_codec_write(codec, hp_pin, 0,
3475 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3476
3477 if (hp_pin_sense)
88011c09 3478 msleep(100);
2af02be7 3479
c0ca5ece
TI
3480 if (!spec->no_shutup_pins)
3481 snd_hda_codec_write(codec, hp_pin, 0,
3482 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2af02be7 3483
98b24883 3484 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2af02be7
KY
3485
3486 if (hp_pin_sense)
88011c09 3487 msleep(100);
0435b3ff 3488 alc_auto_setup_eapd(codec, false);
c0ca5ece 3489 alc_shutup_pins(codec);
2af02be7
KY
3490 alc_write_coef_idx(codec, 0x43, 0x9614);
3491}
3492
4a219ef8
KY
3493static void alc256_init(struct hda_codec *codec)
3494{
3495 struct alc_spec *spec = codec->spec;
35a39f98 3496 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3497 bool hp_pin_sense;
3498
3499 if (!hp_pin)
6447c962 3500 hp_pin = 0x21;
4a219ef8
KY
3501
3502 msleep(30);
3503
3504 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3505
3506 if (hp_pin_sense)
3507 msleep(2);
3508
3509 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
6447c962
KY
3510 if (spec->ultra_low_power) {
3511 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3512 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3513 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3514 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3515 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3516 msleep(30);
3517 }
4a219ef8
KY
3518
3519 snd_hda_codec_write(codec, hp_pin, 0,
3520 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3521
6447c962 3522 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3523 msleep(85);
3524
3525 snd_hda_codec_write(codec, hp_pin, 0,
3526 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3527
6447c962 3528 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3529 msleep(100);
3530
3531 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3532 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
88d42b2b
KY
3533 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3534 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
c4473744
TH
3535 /*
3536 * Expose headphone mic (or possibly Line In on some machines) instead
3537 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3538 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3539 * this register.
3540 */
3541 alc_write_coef_idx(codec, 0x36, 0x5757);
4a219ef8
KY
3542}
3543
3544static void alc256_shutup(struct hda_codec *codec)
3545{
3546 struct alc_spec *spec = codec->spec;
35a39f98 3547 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3548 bool hp_pin_sense;
3549
6447c962
KY
3550 if (!hp_pin)
3551 hp_pin = 0x21;
4a219ef8
KY
3552
3553 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3554
3555 if (hp_pin_sense)
3556 msleep(2);
3557
3558 snd_hda_codec_write(codec, hp_pin, 0,
3559 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3560
6447c962 3561 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3562 msleep(85);
3563
1c9609e3
TI
3564 /* 3k pull low control for Headset jack. */
3565 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3f742490
HW
3566 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3567 * when booting with headset plugged. So skip setting it for the codec alc257
3568 */
5aec9891
KY
3569 if (spec->codec_variant != ALC269_TYPE_ALC257 &&
3570 spec->codec_variant != ALC269_TYPE_ALC256)
3f742490 3571 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
1c9609e3 3572
c0ca5ece
TI
3573 if (!spec->no_shutup_pins)
3574 snd_hda_codec_write(codec, hp_pin, 0,
3575 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4a219ef8 3576
6447c962 3577 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3578 msleep(100);
3579
3580 alc_auto_setup_eapd(codec, false);
c0ca5ece 3581 alc_shutup_pins(codec);
6447c962
KY
3582 if (spec->ultra_low_power) {
3583 msleep(50);
3584 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3585 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3586 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3587 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3588 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3589 msleep(30);
3590 }
4a219ef8
KY
3591}
3592
3c24e483
KY
3593static void alc285_hp_init(struct hda_codec *codec)
3594{
3595 struct alc_spec *spec = codec->spec;
3596 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3597 int i, val;
3598 int coef38, coef0d, coef36;
3599
3600 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3601 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3602 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3603 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3604 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3605 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3606
3607 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3608
3609 if (hp_pin)
3610 snd_hda_codec_write(codec, hp_pin, 0,
3611 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3612
3613 msleep(130);
3614 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3615 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3616
3617 if (hp_pin)
3618 snd_hda_codec_write(codec, hp_pin, 0,
3619 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3620 msleep(10);
3621 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3622 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3623 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3624 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3625
3626 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3627 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3628 for (i = 0; i < 20 && val & 0x8000; i++) {
3629 msleep(50);
3630 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3631 } /* Wait for depop procedure finish */
3632
3633 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3634 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3635 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3636 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3637
3638 msleep(50);
3639 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3640}
3641
da911b1f
KY
3642static void alc225_init(struct hda_codec *codec)
3643{
3644 struct alc_spec *spec = codec->spec;
35a39f98 3645 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3646 bool hp1_pin_sense, hp2_pin_sense;
3647
3c24e483
KY
3648 if (spec->codec_variant != ALC269_TYPE_ALC287)
3649 /* required only at boot or S3 and S4 resume time */
3650 if (!spec->done_hp_init ||
3651 is_s3_resume(codec) ||
3652 is_s4_resume(codec)) {
3653 alc285_hp_init(codec);
3654 spec->done_hp_init = true;
3655 }
3656
da911b1f 3657 if (!hp_pin)
d3ba58bb 3658 hp_pin = 0x21;
da911b1f
KY
3659 msleep(30);
3660
3661 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3662 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3663
3664 if (hp1_pin_sense || hp2_pin_sense)
3665 msleep(2);
3666
3667 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
d3ba58bb
KY
3668 if (spec->ultra_low_power) {
3669 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3670 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3671 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3672 msleep(30);
3673 }
da911b1f 3674
d3ba58bb 3675 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3676 snd_hda_codec_write(codec, hp_pin, 0,
3677 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3678 if (hp2_pin_sense)
3679 snd_hda_codec_write(codec, 0x16, 0,
3680 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3681
d3ba58bb 3682 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3683 msleep(85);
3684
d3ba58bb 3685 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3686 snd_hda_codec_write(codec, hp_pin, 0,
3687 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3688 if (hp2_pin_sense)
3689 snd_hda_codec_write(codec, 0x16, 0,
3690 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3691
d3ba58bb 3692 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3693 msleep(100);
3694
3695 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3696 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3697}
3698
3699static void alc225_shutup(struct hda_codec *codec)
3700{
3701 struct alc_spec *spec = codec->spec;
35a39f98 3702 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3703 bool hp1_pin_sense, hp2_pin_sense;
3704
d3ba58bb
KY
3705 if (!hp_pin)
3706 hp_pin = 0x21;
476c02e0
HW
3707
3708 alc_disable_headset_jack_key(codec);
da911b1f
KY
3709 /* 3k pull low control for Headset jack. */
3710 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3711
3712 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3713 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3714
3715 if (hp1_pin_sense || hp2_pin_sense)
3716 msleep(2);
3717
d3ba58bb 3718 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3719 snd_hda_codec_write(codec, hp_pin, 0,
3720 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3721 if (hp2_pin_sense)
3722 snd_hda_codec_write(codec, 0x16, 0,
3723 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3724
d3ba58bb 3725 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3726 msleep(85);
3727
d3ba58bb 3728 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3729 snd_hda_codec_write(codec, hp_pin, 0,
3730 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3731 if (hp2_pin_sense)
3732 snd_hda_codec_write(codec, 0x16, 0,
3733 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3734
d3ba58bb 3735 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3736 msleep(100);
3737
3738 alc_auto_setup_eapd(codec, false);
c0ca5ece 3739 alc_shutup_pins(codec);
d3ba58bb
KY
3740 if (spec->ultra_low_power) {
3741 msleep(50);
3742 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3743 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3744 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3745 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3746 msleep(30);
3747 }
476c02e0
HW
3748
3749 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3750 alc_enable_headset_jack_key(codec);
da911b1f
KY
3751}
3752
c2d6af53
KY
3753static void alc_default_init(struct hda_codec *codec)
3754{
3755 struct alc_spec *spec = codec->spec;
35a39f98 3756 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3757 bool hp_pin_sense;
3758
3759 if (!hp_pin)
3760 return;
3761
3762 msleep(30);
3763
3764 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3765
3766 if (hp_pin_sense)
3767 msleep(2);
3768
3769 snd_hda_codec_write(codec, hp_pin, 0,
3770 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3771
3772 if (hp_pin_sense)
3773 msleep(85);
3774
3775 snd_hda_codec_write(codec, hp_pin, 0,
3776 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3777
3778 if (hp_pin_sense)
3779 msleep(100);
3780}
3781
3782static void alc_default_shutup(struct hda_codec *codec)
3783{
3784 struct alc_spec *spec = codec->spec;
35a39f98 3785 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3786 bool hp_pin_sense;
3787
3788 if (!hp_pin) {
3789 alc269_shutup(codec);
3790 return;
3791 }
3792
3793 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3794
3795 if (hp_pin_sense)
3796 msleep(2);
3797
3798 snd_hda_codec_write(codec, hp_pin, 0,
3799 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3800
3801 if (hp_pin_sense)
3802 msleep(85);
3803
c0ca5ece
TI
3804 if (!spec->no_shutup_pins)
3805 snd_hda_codec_write(codec, hp_pin, 0,
3806 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
c2d6af53
KY
3807
3808 if (hp_pin_sense)
3809 msleep(100);
3810
3811 alc_auto_setup_eapd(codec, false);
c0ca5ece 3812 alc_shutup_pins(codec);
c2d6af53
KY
3813}
3814
693abe11
KY
3815static void alc294_hp_init(struct hda_codec *codec)
3816{
3817 struct alc_spec *spec = codec->spec;
35a39f98 3818 hda_nid_t hp_pin = alc_get_hp_pin(spec);
693abe11
KY
3819 int i, val;
3820
3821 if (!hp_pin)
3822 return;
3823
3824 snd_hda_codec_write(codec, hp_pin, 0,
3825 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3826
3827 msleep(100);
3828
c0ca5ece
TI
3829 if (!spec->no_shutup_pins)
3830 snd_hda_codec_write(codec, hp_pin, 0,
3831 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
693abe11
KY
3832
3833 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3834 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3835
3836 /* Wait for depop procedure finish */
3837 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3838 for (i = 0; i < 20 && val & 0x0080; i++) {
3839 msleep(50);
3840 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3841 }
3842 /* Set HP depop to auto mode */
3843 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3844 msleep(50);
3845}
3846
3847static void alc294_init(struct hda_codec *codec)
3848{
3849 struct alc_spec *spec = codec->spec;
3850
f6ef4e0e
TI
3851 /* required only at boot or S4 resume time */
3852 if (!spec->done_hp_init ||
3853 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
693abe11
KY
3854 alc294_hp_init(codec);
3855 spec->done_hp_init = true;
3856 }
3857 alc_default_init(codec);
3858}
3859
ad60d502
KY
3860static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3861 unsigned int val)
3862{
3863 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3864 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3865 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3866}
3867
3868static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3869{
3870 unsigned int val;
3871
3872 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3873 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3874 & 0xffff;
3875 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3876 << 16;
3877 return val;
3878}
3879
3880static void alc5505_dsp_halt(struct hda_codec *codec)
3881{
3882 unsigned int val;
3883
3884 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3885 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3886 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3887 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3888 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3889 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3890 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3891 val = alc5505_coef_get(codec, 0x6220);
3892 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3893}
3894
3895static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3896{
3897 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3898 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3899 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3900 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3901 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3902 alc5505_coef_set(codec, 0x880c, 0x00000004);
3903}
3904
3905static void alc5505_dsp_init(struct hda_codec *codec)
3906{
3907 unsigned int val;
3908
3909 alc5505_dsp_halt(codec);
3910 alc5505_dsp_back_from_halt(codec);
3911 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3912 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3913 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3914 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3915 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3916 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3917 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3918 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3919 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3920 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3921 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3922 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3923 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3924
3925 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3926 if (val <= 3)
3927 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3928 else
3929 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3930
3931 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3932 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3933 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3934 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3935 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3936 alc5505_coef_set(codec, 0x880c, 0x00000003);
3937 alc5505_coef_set(codec, 0x880c, 0x00000010);
cd63a5ff
TI
3938
3939#ifdef HALT_REALTEK_ALC5505
3940 alc5505_dsp_halt(codec);
3941#endif
ad60d502
KY
3942}
3943
cd63a5ff 3944#ifdef HALT_REALTEK_ALC5505
8a71821f
PLB
3945#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3946#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
cd63a5ff
TI
3947#else
3948#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3949#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3950#endif
3951
2a43952a 3952#ifdef CONFIG_PM
ad60d502
KY
3953static int alc269_suspend(struct hda_codec *codec)
3954{
3955 struct alc_spec *spec = codec->spec;
3956
3957 if (spec->has_alc5505_dsp)
cd63a5ff 3958 alc5505_dsp_suspend(codec);
ad60d502
KY
3959 return alc_suspend(codec);
3960}
3961
1d045db9
TI
3962static int alc269_resume(struct hda_codec *codec)
3963{
adcc70b2
KY
3964 struct alc_spec *spec = codec->spec;
3965
1387e2d1
KY
3966 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3967 alc269vb_toggle_power_output(codec, 0);
3968 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3969 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3970 msleep(150);
3971 }
8c427226 3972
1d045db9 3973 codec->patch_ops.init(codec);
f1d4e28b 3974
1387e2d1
KY
3975 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3976 alc269vb_toggle_power_output(codec, 1);
3977 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3978 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9
TI
3979 msleep(200);
3980 }
f1d4e28b 3981
1a462be5 3982 snd_hda_regmap_sync(codec);
1d045db9 3983 hda_call_check_power_status(codec, 0x01);
f475371a
HW
3984
3985 /* on some machine, the BIOS will clear the codec gpio data when enter
3986 * suspend, and won't restore the data after resume, so we restore it
3987 * in the driver.
3988 */
d261eec8
TI
3989 if (spec->gpio_data)
3990 alc_write_gpio_data(codec);
f475371a 3991
ad60d502 3992 if (spec->has_alc5505_dsp)
cd63a5ff 3993 alc5505_dsp_resume(codec);
c5177c86 3994
1d045db9
TI
3995 return 0;
3996}
2a43952a 3997#endif /* CONFIG_PM */
f1d4e28b 3998
108cc108 3999static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
1727a771 4000 const struct hda_fixup *fix, int action)
108cc108
DH
4001{
4002 struct alc_spec *spec = codec->spec;
4003
1727a771 4004 if (action == HDA_FIXUP_ACT_PRE_PROBE)
108cc108
DH
4005 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4006}
4007
fdcc968a
JMG
4008static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4009 const struct hda_fixup *fix,
4010 int action)
4011{
4012 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4013 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4014
4015 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4016 snd_hda_codec_set_pincfg(codec, 0x19,
4017 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4018 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4019}
4020
1d045db9 4021static void alc269_fixup_hweq(struct hda_codec *codec,
1727a771 4022 const struct hda_fixup *fix, int action)
1d045db9 4023{
98b24883
TI
4024 if (action == HDA_FIXUP_ACT_INIT)
4025 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
1d045db9 4026}
f1d4e28b 4027
7c478f03
DH
4028static void alc269_fixup_headset_mic(struct hda_codec *codec,
4029 const struct hda_fixup *fix, int action)
4030{
4031 struct alc_spec *spec = codec->spec;
4032
4033 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4034 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4035}
4036
1d045db9 4037static void alc271_fixup_dmic(struct hda_codec *codec,
1727a771 4038 const struct hda_fixup *fix, int action)
1d045db9
TI
4039{
4040 static const struct hda_verb verbs[] = {
4041 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4042 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4043 {}
4044 };
4045 unsigned int cfg;
f1d4e28b 4046
7639a06c
TI
4047 if (strcmp(codec->core.chip_name, "ALC271X") &&
4048 strcmp(codec->core.chip_name, "ALC269VB"))
1d045db9
TI
4049 return;
4050 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4051 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4052 snd_hda_sequence_write(codec, verbs);
4053}
f1d4e28b 4054
c8426b27
TI
4055/* Fix the speaker amp after resume, etc */
4056static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4057 const struct hda_fixup *fix,
4058 int action)
4059{
4060 if (action == HDA_FIXUP_ACT_INIT)
4061 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4062}
4063
017f2a10 4064static void alc269_fixup_pcm_44k(struct hda_codec *codec,
1727a771 4065 const struct hda_fixup *fix, int action)
017f2a10
TI
4066{
4067 struct alc_spec *spec = codec->spec;
4068
1727a771 4069 if (action != HDA_FIXUP_ACT_PROBE)
017f2a10
TI
4070 return;
4071
4072 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4073 * fix the sample rate of analog I/O to 44.1kHz
4074 */
08c189f2
TI
4075 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4076 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
017f2a10
TI
4077}
4078
adabb3ec 4079static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
1727a771 4080 const struct hda_fixup *fix, int action)
adabb3ec 4081{
adabb3ec
TI
4082 /* The digital-mic unit sends PDM (differential signal) instead of
4083 * the standard PCM, thus you can't record a valid mono stream as is.
4084 * Below is a workaround specific to ALC269 to control the dmic
4085 * signal source as mono.
4086 */
98b24883
TI
4087 if (action == HDA_FIXUP_ACT_INIT)
4088 alc_update_coef_idx(codec, 0x07, 0, 0x80);
adabb3ec
TI
4089}
4090
24519911
TI
4091static void alc269_quanta_automute(struct hda_codec *codec)
4092{
08c189f2 4093 snd_hda_gen_update_outputs(codec);
24519911 4094
1687ccc8
TI
4095 alc_write_coef_idx(codec, 0x0c, 0x680);
4096 alc_write_coef_idx(codec, 0x0c, 0x480);
24519911
TI
4097}
4098
4099static void alc269_fixup_quanta_mute(struct hda_codec *codec,
1727a771 4100 const struct hda_fixup *fix, int action)
24519911
TI
4101{
4102 struct alc_spec *spec = codec->spec;
1727a771 4103 if (action != HDA_FIXUP_ACT_PROBE)
24519911 4104 return;
08c189f2 4105 spec->gen.automute_hook = alc269_quanta_automute;
24519911
TI
4106}
4107
d240d1dc 4108static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 4109 struct hda_jack_callback *jack)
d240d1dc
DH
4110{
4111 struct alc_spec *spec = codec->spec;
4112 int vref;
4113 msleep(200);
4114 snd_hda_gen_hp_automute(codec, jack);
4115
4116 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4117 msleep(100);
4118 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4119 vref);
4120 msleep(500);
4121 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4122 vref);
4123}
4124
a2ef03fe
TE
4125/*
4126 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4127 */
4128struct hda_alc298_mbxinit {
4129 unsigned char value_0x23;
4130 unsigned char value_0x25;
4131};
4132
4133static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4134 const struct hda_alc298_mbxinit *initval,
4135 bool first)
4136{
4137 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4138 alc_write_coef_idx(codec, 0x26, 0xb000);
4139
4140 if (first)
4141 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4142
4143 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4144 alc_write_coef_idx(codec, 0x26, 0xf000);
4145 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4146
4147 if (initval->value_0x23 != 0x1e)
4148 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4149
4150 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4151 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4152}
4153
4154static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4155 const struct hda_fixup *fix,
4156 int action)
4157{
4158 /* Initialization magic */
4159 static const struct hda_alc298_mbxinit dac_init[] = {
4160 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4161 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4162 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4163 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4164 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4165 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4166 {0x2f, 0x00},
4167 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4168 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4169 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4170 {}
4171 };
4172 const struct hda_alc298_mbxinit *seq;
4173
4174 if (action != HDA_FIXUP_ACT_INIT)
4175 return;
4176
4177 /* Start */
4178 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4179 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4180 alc_write_coef_idx(codec, 0x26, 0xf000);
4181 alc_write_coef_idx(codec, 0x22, 0x31);
4182 alc_write_coef_idx(codec, 0x23, 0x0b);
4183 alc_write_coef_idx(codec, 0x25, 0x00);
4184 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4185 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4186
4187 for (seq = dac_init; seq->value_0x23; seq++)
4188 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4189}
4190
d240d1dc
DH
4191static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4192 const struct hda_fixup *fix, int action)
4193{
4194 struct alc_spec *spec = codec->spec;
4195 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4196 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4197 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4198 }
4199}
4200
766538ac
TI
4201static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4202 bool polarity, bool on)
4203{
4204 unsigned int pinval;
4205
4206 if (!pin)
4207 return;
4208 if (polarity)
4209 on = !on;
4210 pinval = snd_hda_codec_get_pin_target(codec, pin);
4211 pinval &= ~AC_PINCTL_VREFEN;
4212 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4213 /* temporarily power up/down for setting VREF */
4214 snd_hda_power_up_pm(codec);
4215 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4216 snd_hda_power_down_pm(codec);
4217}
d240d1dc 4218
08fb0d0e 4219/* update mute-LED according to the speaker mute state via mic VREF pin */
8d3d1ece
TI
4220static int vref_mute_led_set(struct led_classdev *led_cdev,
4221 enum led_brightness brightness)
6d3cd5d4 4222{
8d3d1ece 4223 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
08fb0d0e 4224 struct alc_spec *spec = codec->spec;
08fb0d0e 4225
766538ac
TI
4226 alc_update_vref_led(codec, spec->mute_led_nid,
4227 spec->mute_led_polarity, brightness);
8d3d1ece 4228 return 0;
6d3cd5d4
DH
4229}
4230
d5b6b65e
DH
4231/* Make sure the led works even in runtime suspend */
4232static unsigned int led_power_filter(struct hda_codec *codec,
4233 hda_nid_t nid,
4234 unsigned int power_state)
4235{
4236 struct alc_spec *spec = codec->spec;
4237
50dd9050
HW
4238 if (power_state != AC_PWRST_D3 || nid == 0 ||
4239 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
d5b6b65e
DH
4240 return power_state;
4241
4242 /* Set pin ctl again, it might have just been set to 0 */
4243 snd_hda_set_pin_ctl(codec, nid,
4244 snd_hda_codec_get_pin_target(codec, nid));
4245
cffd3966 4246 return snd_hda_gen_path_power_filter(codec, nid, power_state);
d5b6b65e
DH
4247}
4248
08fb0d0e
TI
4249static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4250 const struct hda_fixup *fix, int action)
6d3cd5d4
DH
4251{
4252 struct alc_spec *spec = codec->spec;
08fb0d0e
TI
4253 const struct dmi_device *dev = NULL;
4254
4255 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4256 return;
4257
4258 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4259 int pol, pin;
4260 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4261 continue;
4262 if (pin < 0x0a || pin >= 0x10)
4263 break;
4264 spec->mute_led_polarity = pol;
4265 spec->mute_led_nid = pin - 0x0a + 0x18;
8d3d1ece 4266 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4267 codec->power_filter = led_power_filter;
4e76a883
TI
4268 codec_dbg(codec,
4269 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
08fb0d0e 4270 spec->mute_led_polarity);
6d3cd5d4
DH
4271 break;
4272 }
4273}
4274
85c467dc
TI
4275static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4276 const struct hda_fixup *fix,
4277 int action, hda_nid_t pin)
d06ac143
DH
4278{
4279 struct alc_spec *spec = codec->spec;
85c467dc 4280
d06ac143
DH
4281 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4282 spec->mute_led_polarity = 0;
85c467dc 4283 spec->mute_led_nid = pin;
8d3d1ece 4284 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4285 codec->power_filter = led_power_filter;
d06ac143
DH
4286 }
4287}
4288
85c467dc
TI
4289static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4290 const struct hda_fixup *fix, int action)
4291{
4292 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4293}
4294
08fb0d0e
TI
4295static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4296 const struct hda_fixup *fix, int action)
420b0feb 4297{
85c467dc 4298 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
420b0feb
TI
4299}
4300
7f783bd5
TB
4301static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4302 const struct hda_fixup *fix, int action)
4303{
85c467dc 4304 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
7f783bd5
TB
4305}
4306
0f32fd19
TI
4307/* update LED status via GPIO */
4308static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
dbd13179 4309 int polarity, bool enabled)
9f5c6faf 4310{
dbd13179 4311 if (polarity)
0f32fd19 4312 enabled = !enabled;
d261eec8 4313 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
9f5c6faf
TI
4314}
4315
0f32fd19 4316/* turn on/off mute LED via GPIO per vmaster hook */
8d3d1ece
TI
4317static int gpio_mute_led_set(struct led_classdev *led_cdev,
4318 enum led_brightness brightness)
9f5c6faf 4319{
8d3d1ece 4320 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9f5c6faf 4321 struct alc_spec *spec = codec->spec;
9f5c6faf 4322
dbd13179 4323 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
8d3d1ece
TI
4324 spec->mute_led_polarity, !brightness);
4325 return 0;
0f32fd19 4326}
9f5c6faf 4327
0f32fd19 4328/* turn on/off mic-mute LED via GPIO per capture hook */
87dc3648
KHF
4329static int micmute_led_set(struct led_classdev *led_cdev,
4330 enum led_brightness brightness)
4331{
4332 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4333 struct alc_spec *spec = codec->spec;
4334
4335 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
40469064 4336 spec->micmute_led_polarity, !brightness);
87dc3648
KHF
4337 return 0;
4338}
4339
01e4a275
TI
4340/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4341static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4342 int action,
4343 unsigned int mute_mask,
4344 unsigned int micmute_mask)
9f5c6faf
TI
4345{
4346 struct alc_spec *spec = codec->spec;
9f5c6faf 4347
01e4a275
TI
4348 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4349
4350 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4351 return;
4352 if (mute_mask) {
4353 spec->gpio_mute_led_mask = mute_mask;
8d3d1ece 4354 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
01e4a275
TI
4355 }
4356 if (micmute_mask) {
4357 spec->gpio_mic_led_mask = micmute_mask;
7cdf8c49 4358 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
9f5c6faf
TI
4359 }
4360}
4361
e7d66cf7
JS
4362static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4363 const struct hda_fixup *fix, int action)
4364{
4365 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4366}
4367
01e4a275 4368static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
eaa8e5ef
KY
4369 const struct hda_fixup *fix, int action)
4370{
01e4a275
TI
4371 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4372}
eaa8e5ef 4373
f5a88b0a
KHF
4374static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4375 const struct hda_fixup *fix, int action)
4376{
3e0650ab 4377 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
f5a88b0a
KHF
4378}
4379
01e4a275
TI
4380static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4381 const struct hda_fixup *fix, int action)
4382{
4383 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
9f5c6faf
TI
4384}
4385
a0ccbc53
KY
4386static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4387 const struct hda_fixup *fix, int action)
4388{
4389 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4390}
4391
5fc462c3
JC
4392static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4393 const struct hda_fixup *fix, int action)
4394{
4395 struct alc_spec *spec = codec->spec;
4396
4397 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4398 spec->micmute_led_polarity = 1;
4399 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4400}
4401
8a503555
TI
4402/* turn on/off mic-mute LED per capture hook via VREF change */
4403static int vref_micmute_led_set(struct led_classdev *led_cdev,
4404 enum led_brightness brightness)
9c5dc3bf 4405{
8a503555 4406 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9c5dc3bf 4407 struct alc_spec *spec = codec->spec;
9c5dc3bf 4408
766538ac
TI
4409 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4410 spec->micmute_led_polarity, brightness);
8a503555 4411 return 0;
9c5dc3bf
KY
4412}
4413
4414static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4415 const struct hda_fixup *fix, int action)
4416{
4417 struct alc_spec *spec = codec->spec;
9c5dc3bf 4418
01e4a275 4419 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
9c5dc3bf 4420 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
4421 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4422 * enable headphone amp
4423 */
4424 spec->gpio_mask |= 0x10;
4425 spec->gpio_dir |= 0x10;
9c5dc3bf 4426 spec->cap_mute_led_nid = 0x18;
8a503555 4427 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
50dd9050 4428 codec->power_filter = led_power_filter;
9c5dc3bf
KY
4429 }
4430}
4431
7a5255f1
DH
4432static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4433 const struct hda_fixup *fix, int action)
4434{
7a5255f1 4435 struct alc_spec *spec = codec->spec;
7a5255f1 4436
01e4a275 4437 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
7a5255f1 4438 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7a5255f1 4439 spec->cap_mute_led_nid = 0x18;
8a503555 4440 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
7a5255f1
DH
4441 codec->power_filter = led_power_filter;
4442 }
4443}
4444
c3bb2b52
TI
4445/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4446 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4447 */
4448static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4449 const struct hda_fixup *fix, int action)
4450{
4451 struct alc_spec *spec = codec->spec;
4452
4453 switch (action) {
4454 case HDA_FIXUP_ACT_PRE_PROBE:
4455 spec->gpio_mask |= 0x01;
4456 spec->gpio_dir |= 0x01;
4457 break;
4458 case HDA_FIXUP_ACT_INIT:
4459 /* need to toggle GPIO to enable the amp */
4460 alc_update_gpio_data(codec, 0x01, true);
4461 msleep(100);
4462 alc_update_gpio_data(codec, 0x01, false);
4463 break;
4464 }
4465}
4466
622464c8
TI
4467/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4468static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4469 struct hda_codec *codec,
4470 struct snd_pcm_substream *substream,
4471 int action)
4472{
4473 switch (action) {
4474 case HDA_GEN_PCM_ACT_PREPARE:
4475 alc_update_gpio_data(codec, 0x04, true);
4476 break;
4477 case HDA_GEN_PCM_ACT_CLEANUP:
4478 alc_update_gpio_data(codec, 0x04, false);
4479 break;
4480 }
4481}
4482
4483static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4484 const struct hda_fixup *fix,
4485 int action)
4486{
4487 struct alc_spec *spec = codec->spec;
4488
4489 if (action == HDA_FIXUP_ACT_PROBE) {
4490 spec->gpio_mask |= 0x04;
4491 spec->gpio_dir |= 0x04;
4492 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4493 }
4494}
4495
766538ac
TI
4496static void alc_update_coef_led(struct hda_codec *codec,
4497 struct alc_coef_led *led,
4498 bool polarity, bool on)
4499{
4500 if (polarity)
4501 on = !on;
4502 /* temporarily power up/down for setting COEF bit */
4503 alc_update_coef_idx(codec, led->idx, led->mask,
4504 on ? led->on : led->off);
4505}
4506
431e76c3 4507/* update mute-LED according to the speaker mute state via COEF bit */
8d3d1ece
TI
4508static int coef_mute_led_set(struct led_classdev *led_cdev,
4509 enum led_brightness brightness)
431e76c3 4510{
8d3d1ece 4511 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4512 struct alc_spec *spec = codec->spec;
4513
766538ac
TI
4514 alc_update_coef_led(codec, &spec->mute_led_coef,
4515 spec->mute_led_polarity, brightness);
8d3d1ece 4516 return 0;
431e76c3
KY
4517}
4518
4519static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4520 const struct hda_fixup *fix,
4521 int action)
4522{
4523 struct alc_spec *spec = codec->spec;
4524
4525 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4526 spec->mute_led_polarity = 0;
766538ac
TI
4527 spec->mute_led_coef.idx = 0x0b;
4528 spec->mute_led_coef.mask = 1 << 3;
4529 spec->mute_led_coef.on = 1 << 3;
4530 spec->mute_led_coef.off = 0;
8d3d1ece 4531 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
431e76c3
KY
4532 }
4533}
4534
24164f43
KY
4535static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4536 const struct hda_fixup *fix,
4537 int action)
4538{
4539 struct alc_spec *spec = codec->spec;
4540
4541 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4542 spec->mute_led_polarity = 0;
766538ac
TI
4543 spec->mute_led_coef.idx = 0x34;
4544 spec->mute_led_coef.mask = 1 << 5;
4545 spec->mute_led_coef.on = 0;
4546 spec->mute_led_coef.off = 1 << 5;
8d3d1ece 4547 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
24164f43
KY
4548 }
4549}
4550
431e76c3 4551/* turn on/off mic-mute LED per capture hook by coef bit */
8a503555
TI
4552static int coef_micmute_led_set(struct led_classdev *led_cdev,
4553 enum led_brightness brightness)
431e76c3 4554{
8a503555 4555 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4556 struct alc_spec *spec = codec->spec;
4557
766538ac
TI
4558 alc_update_coef_led(codec, &spec->mic_led_coef,
4559 spec->micmute_led_polarity, brightness);
8a503555 4560 return 0;
431e76c3
KY
4561}
4562
4563static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4564 const struct hda_fixup *fix, int action)
4565{
4566 struct alc_spec *spec = codec->spec;
4567
4568 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4569 spec->mic_led_coef.idx = 0x19;
4570 spec->mic_led_coef.mask = 1 << 13;
4571 spec->mic_led_coef.on = 1 << 13;
4572 spec->mic_led_coef.off = 0;
8a503555 4573 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
431e76c3
KY
4574 }
4575}
4576
24164f43
KY
4577static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4578 const struct hda_fixup *fix, int action)
4579{
4580 struct alc_spec *spec = codec->spec;
4581
4582 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4583 spec->mic_led_coef.idx = 0x35;
4584 spec->mic_led_coef.mask = 3 << 2;
4585 spec->mic_led_coef.on = 2 << 2;
4586 spec->mic_led_coef.off = 1 << 2;
8a503555 4587 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
24164f43
KY
4588 }
4589}
4590
431e76c3
KY
4591static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4592 const struct hda_fixup *fix, int action)
4593{
4594 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4595 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4596}
4597
24164f43
KY
4598static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4599 const struct hda_fixup *fix, int action)
4600{
4601 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4602 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4603}
4604
75b62ab6
JW
4605static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4606 const struct hda_fixup *fix, int action)
4607{
4608 struct alc_spec *spec = codec->spec;
4609
4610 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4611 spec->cap_mute_led_nid = 0x1a;
4612 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4613 codec->power_filter = led_power_filter;
4614 }
4615}
4616
4617static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4618 const struct hda_fixup *fix, int action)
4619{
4620 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4621 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4622}
4623
6a30abaa 4624#if IS_REACHABLE(CONFIG_INPUT)
33f4acd3
DH
4625static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4626 struct hda_jack_callback *event)
4627{
4628 struct alc_spec *spec = codec->spec;
4629
4630 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4631 send both key on and key off event for every interrupt. */
c7b60a89 4632 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
33f4acd3 4633 input_sync(spec->kb_dev);
c7b60a89 4634 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
33f4acd3
DH
4635 input_sync(spec->kb_dev);
4636}
33f4acd3 4637
3694cb29
K
4638static int alc_register_micmute_input_device(struct hda_codec *codec)
4639{
4640 struct alc_spec *spec = codec->spec;
c7b60a89 4641 int i;
3694cb29
K
4642
4643 spec->kb_dev = input_allocate_device();
4644 if (!spec->kb_dev) {
4645 codec_err(codec, "Out of memory (input_allocate_device)\n");
4646 return -ENOMEM;
4647 }
c7b60a89
HW
4648
4649 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4650
3694cb29
K
4651 spec->kb_dev->name = "Microphone Mute Button";
4652 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
c7b60a89
HW
4653 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4654 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4655 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4656 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4657 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3694cb29
K
4658
4659 if (input_register_device(spec->kb_dev)) {
4660 codec_err(codec, "input_register_device failed\n");
4661 input_free_device(spec->kb_dev);
4662 spec->kb_dev = NULL;
4663 return -ENOMEM;
4664 }
4665
4666 return 0;
4667}
4668
01e4a275
TI
4669/* GPIO1 = set according to SKU external amp
4670 * GPIO2 = mic mute hotkey
4671 * GPIO3 = mute LED
4672 * GPIO4 = mic mute LED
4673 */
33f4acd3
DH
4674static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4675 const struct hda_fixup *fix, int action)
4676{
33f4acd3
DH
4677 struct alc_spec *spec = codec->spec;
4678
01e4a275 4679 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
33f4acd3 4680 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4681 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29 4682 if (alc_register_micmute_input_device(codec) != 0)
33f4acd3 4683 return;
33f4acd3 4684
01e4a275
TI
4685 spec->gpio_mask |= 0x06;
4686 spec->gpio_dir |= 0x02;
4687 spec->gpio_data |= 0x02;
7639a06c 4688 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
33f4acd3 4689 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
7639a06c 4690 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
33f4acd3 4691 gpio2_mic_hotkey_event);
33f4acd3
DH
4692 return;
4693 }
4694
4695 if (!spec->kb_dev)
4696 return;
4697
4698 switch (action) {
33f4acd3
DH
4699 case HDA_FIXUP_ACT_FREE:
4700 input_unregister_device(spec->kb_dev);
33f4acd3
DH
4701 spec->kb_dev = NULL;
4702 }
33f4acd3
DH
4703}
4704
01e4a275
TI
4705/* Line2 = mic mute hotkey
4706 * GPIO2 = mic mute LED
4707 */
3694cb29
K
4708static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4709 const struct hda_fixup *fix, int action)
4710{
3694cb29
K
4711 struct alc_spec *spec = codec->spec;
4712
01e4a275 4713 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
3694cb29 4714 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4715 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29
K
4716 if (alc_register_micmute_input_device(codec) != 0)
4717 return;
4718
3694cb29
K
4719 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4720 gpio2_mic_hotkey_event);
3694cb29
K
4721 return;
4722 }
4723
4724 if (!spec->kb_dev)
4725 return;
4726
4727 switch (action) {
3694cb29
K
4728 case HDA_FIXUP_ACT_FREE:
4729 input_unregister_device(spec->kb_dev);
4730 spec->kb_dev = NULL;
4731 }
4732}
c469652b
TI
4733#else /* INPUT */
4734#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4735#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4736#endif /* INPUT */
3694cb29 4737
9c5dc3bf
KY
4738static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4739 const struct hda_fixup *fix, int action)
4740{
4741 struct alc_spec *spec = codec->spec;
4742
1bce62a6 4743 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
9c5dc3bf 4744 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9c5dc3bf 4745 spec->cap_mute_led_nid = 0x18;
8a503555 4746 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
9c5dc3bf
KY
4747 }
4748}
4749
6b0f95c4 4750static const struct coef_fw alc225_pre_hsmode[] = {
5a36767a
KY
4751 UPDATE_COEF(0x4a, 1<<8, 0),
4752 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4753 UPDATE_COEF(0x63, 3<<14, 3<<14),
4754 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4755 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4756 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4757 UPDATE_COEF(0x4a, 3<<10, 0),
4758 {}
4759};
4760
73bdd597
DH
4761static void alc_headset_mode_unplugged(struct hda_codec *codec)
4762{
92666d45 4763 struct alc_spec *spec = codec->spec;
6b0f95c4 4764 static const struct coef_fw coef0255[] = {
717f43d8 4765 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
54db6c39
TI
4766 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4767 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4768 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4769 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4770 {}
4771 };
6b0f95c4 4772 static const struct coef_fw coef0256[] = {
e69e7e03 4773 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
717f43d8
KY
4774 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4775 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4776 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4777 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
e69e7e03
KY
4778 {}
4779 };
6b0f95c4 4780 static const struct coef_fw coef0233[] = {
54db6c39
TI
4781 WRITE_COEF(0x1b, 0x0c0b),
4782 WRITE_COEF(0x45, 0xc429),
4783 UPDATE_COEF(0x35, 0x4000, 0),
4784 WRITE_COEF(0x06, 0x2104),
4785 WRITE_COEF(0x1a, 0x0001),
4786 WRITE_COEF(0x26, 0x0004),
4787 WRITE_COEF(0x32, 0x42a3),
4788 {}
4789 };
6b0f95c4 4790 static const struct coef_fw coef0288[] = {
f3b70332
KY
4791 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4792 UPDATE_COEF(0x50, 0x2000, 0x2000),
4793 UPDATE_COEF(0x56, 0x0006, 0x0006),
4794 UPDATE_COEF(0x66, 0x0008, 0),
4795 UPDATE_COEF(0x67, 0x2000, 0),
4796 {}
4797 };
6b0f95c4 4798 static const struct coef_fw coef0298[] = {
89542936
KY
4799 UPDATE_COEF(0x19, 0x1300, 0x0300),
4800 {}
4801 };
6b0f95c4 4802 static const struct coef_fw coef0292[] = {
54db6c39
TI
4803 WRITE_COEF(0x76, 0x000e),
4804 WRITE_COEF(0x6c, 0x2400),
4805 WRITE_COEF(0x18, 0x7308),
4806 WRITE_COEF(0x6b, 0xc429),
4807 {}
4808 };
6b0f95c4 4809 static const struct coef_fw coef0293[] = {
54db6c39
TI
4810 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4811 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4812 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4813 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4814 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4815 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4816 {}
4817 };
6b0f95c4 4818 static const struct coef_fw coef0668[] = {
54db6c39
TI
4819 WRITE_COEF(0x15, 0x0d40),
4820 WRITE_COEF(0xb7, 0x802b),
4821 {}
4822 };
6b0f95c4 4823 static const struct coef_fw coef0225[] = {
5a36767a 4824 UPDATE_COEF(0x63, 3<<14, 0),
4cc9b9d6
KY
4825 {}
4826 };
6b0f95c4 4827 static const struct coef_fw coef0274[] = {
71683c32
KY
4828 UPDATE_COEF(0x4a, 0x0100, 0),
4829 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4830 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4831 UPDATE_COEF(0x4a, 0x0010, 0),
4832 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4833 WRITE_COEF(0x45, 0x5289),
4834 UPDATE_COEF(0x4a, 0x0c00, 0),
4835 {}
4836 };
54db6c39 4837
92666d45
KY
4838 if (spec->no_internal_mic_pin) {
4839 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4840 return;
4841 }
4842
7639a06c 4843 switch (codec->core.vendor_id) {
9a22a8f5 4844 case 0x10ec0255:
e69e7e03
KY
4845 alc_process_coef_fw(codec, coef0255);
4846 break;
1948fc06 4847 case 0x10ec0230:
736f20a7 4848 case 0x10ec0236:
7081adf3 4849 case 0x10ec0256:
e69e7e03 4850 alc_process_coef_fw(codec, coef0256);
9a22a8f5 4851 break;
71683c32
KY
4852 case 0x10ec0234:
4853 case 0x10ec0274:
4854 case 0x10ec0294:
4855 alc_process_coef_fw(codec, coef0274);
4856 break;
13fd08a3 4857 case 0x10ec0233:
73bdd597 4858 case 0x10ec0283:
54db6c39 4859 alc_process_coef_fw(codec, coef0233);
73bdd597 4860 break;
f3b70332
KY
4861 case 0x10ec0286:
4862 case 0x10ec0288:
89542936
KY
4863 alc_process_coef_fw(codec, coef0288);
4864 break;
1a5bc8d9 4865 case 0x10ec0298:
89542936 4866 alc_process_coef_fw(codec, coef0298);
f3b70332
KY
4867 alc_process_coef_fw(codec, coef0288);
4868 break;
73bdd597 4869 case 0x10ec0292:
54db6c39 4870 alc_process_coef_fw(codec, coef0292);
73bdd597 4871 break;
a22aa26f 4872 case 0x10ec0293:
54db6c39 4873 alc_process_coef_fw(codec, coef0293);
a22aa26f 4874 break;
73bdd597 4875 case 0x10ec0668:
54db6c39 4876 alc_process_coef_fw(codec, coef0668);
73bdd597 4877 break;
c2b691ee 4878 case 0x10ec0215:
4cc9b9d6 4879 case 0x10ec0225:
c2b691ee 4880 case 0x10ec0285:
7d727869 4881 case 0x10ec0295:
c2b691ee 4882 case 0x10ec0289:
28f1f9b2 4883 case 0x10ec0299:
4d4b0c52 4884 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4885 alc_process_coef_fw(codec, coef0225);
4886 break;
78f4f7c2
KY
4887 case 0x10ec0867:
4888 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4889 break;
73bdd597 4890 }
4e76a883 4891 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
73bdd597
DH
4892}
4893
4894
4895static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4896 hda_nid_t mic_pin)
4897{
6b0f95c4 4898 static const struct coef_fw coef0255[] = {
54db6c39
TI
4899 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4900 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4901 {}
4902 };
6b0f95c4 4903 static const struct coef_fw coef0256[] = {
717f43d8
KY
4904 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4905 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4906 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4907 {}
4908 };
6b0f95c4 4909 static const struct coef_fw coef0233[] = {
54db6c39
TI
4910 UPDATE_COEF(0x35, 0, 1<<14),
4911 WRITE_COEF(0x06, 0x2100),
4912 WRITE_COEF(0x1a, 0x0021),
4913 WRITE_COEF(0x26, 0x008c),
4914 {}
4915 };
6b0f95c4 4916 static const struct coef_fw coef0288[] = {
89542936 4917 UPDATE_COEF(0x4f, 0x00c0, 0),
f3b70332
KY
4918 UPDATE_COEF(0x50, 0x2000, 0),
4919 UPDATE_COEF(0x56, 0x0006, 0),
4920 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4921 UPDATE_COEF(0x66, 0x0008, 0x0008),
4922 UPDATE_COEF(0x67, 0x2000, 0x2000),
4923 {}
4924 };
6b0f95c4 4925 static const struct coef_fw coef0292[] = {
54db6c39
TI
4926 WRITE_COEF(0x19, 0xa208),
4927 WRITE_COEF(0x2e, 0xacf0),
4928 {}
4929 };
6b0f95c4 4930 static const struct coef_fw coef0293[] = {
54db6c39
TI
4931 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4932 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4933 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4934 {}
4935 };
6b0f95c4 4936 static const struct coef_fw coef0688[] = {
54db6c39
TI
4937 WRITE_COEF(0xb7, 0x802b),
4938 WRITE_COEF(0xb5, 0x1040),
4939 UPDATE_COEF(0xc3, 0, 1<<12),
4940 {}
4941 };
6b0f95c4 4942 static const struct coef_fw coef0225[] = {
4cc9b9d6
KY
4943 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4944 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4945 UPDATE_COEF(0x63, 3<<14, 0),
4946 {}
4947 };
6b0f95c4 4948 static const struct coef_fw coef0274[] = {
71683c32
KY
4949 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4950 UPDATE_COEF(0x4a, 0x0010, 0),
4951 UPDATE_COEF(0x6b, 0xf000, 0),
4952 {}
4953 };
54db6c39 4954
7639a06c 4955 switch (codec->core.vendor_id) {
9a22a8f5
KY
4956 case 0x10ec0255:
4957 alc_write_coef_idx(codec, 0x45, 0xc489);
4958 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4959 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
4960 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4961 break;
1948fc06 4962 case 0x10ec0230:
717f43d8
KY
4963 case 0x10ec0236:
4964 case 0x10ec0256:
4965 alc_write_coef_idx(codec, 0x45, 0xc489);
4966 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4967 alc_process_coef_fw(codec, coef0256);
4968 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4969 break;
71683c32
KY
4970 case 0x10ec0234:
4971 case 0x10ec0274:
4972 case 0x10ec0294:
4973 alc_write_coef_idx(codec, 0x45, 0x4689);
4974 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4975 alc_process_coef_fw(codec, coef0274);
4976 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4977 break;
13fd08a3 4978 case 0x10ec0233:
73bdd597
DH
4979 case 0x10ec0283:
4980 alc_write_coef_idx(codec, 0x45, 0xc429);
4981 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4982 alc_process_coef_fw(codec, coef0233);
73bdd597
DH
4983 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4984 break;
f3b70332
KY
4985 case 0x10ec0286:
4986 case 0x10ec0288:
1a5bc8d9 4987 case 0x10ec0298:
f3b70332
KY
4988 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4989 alc_process_coef_fw(codec, coef0288);
4990 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4991 break;
73bdd597
DH
4992 case 0x10ec0292:
4993 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4994 alc_process_coef_fw(codec, coef0292);
73bdd597 4995 break;
a22aa26f
KY
4996 case 0x10ec0293:
4997 /* Set to TRS mode */
4998 alc_write_coef_idx(codec, 0x45, 0xc429);
4999 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5000 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5001 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5002 break;
78f4f7c2
KY
5003 case 0x10ec0867:
5004 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
c0dbbdad 5005 fallthrough;
9eb5d0e6 5006 case 0x10ec0221:
1f8b46cd
DH
5007 case 0x10ec0662:
5008 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5009 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5010 break;
73bdd597
DH
5011 case 0x10ec0668:
5012 alc_write_coef_idx(codec, 0x11, 0x0001);
5013 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5014 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5015 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5016 break;
c2b691ee 5017 case 0x10ec0215:
4cc9b9d6 5018 case 0x10ec0225:
c2b691ee 5019 case 0x10ec0285:
7d727869 5020 case 0x10ec0295:
c2b691ee 5021 case 0x10ec0289:
28f1f9b2 5022 case 0x10ec0299:
5a36767a 5023 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
5024 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5025 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5026 alc_process_coef_fw(codec, coef0225);
5027 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5028 break;
73bdd597 5029 }
4e76a883 5030 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
73bdd597
DH
5031}
5032
5033static void alc_headset_mode_default(struct hda_codec *codec)
5034{
6b0f95c4 5035 static const struct coef_fw coef0225[] = {
5a36767a
KY
5036 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5037 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5038 UPDATE_COEF(0x49, 3<<8, 0<<8),
5039 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5040 UPDATE_COEF(0x63, 3<<14, 0),
5041 UPDATE_COEF(0x67, 0xf000, 0x3000),
2ae95577
DH
5042 {}
5043 };
6b0f95c4 5044 static const struct coef_fw coef0255[] = {
54db6c39
TI
5045 WRITE_COEF(0x45, 0xc089),
5046 WRITE_COEF(0x45, 0xc489),
5047 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5048 WRITE_COEF(0x49, 0x0049),
5049 {}
5050 };
6b0f95c4 5051 static const struct coef_fw coef0256[] = {
717f43d8
KY
5052 WRITE_COEF(0x45, 0xc489),
5053 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5054 WRITE_COEF(0x49, 0x0049),
5055 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5056 WRITE_COEF(0x06, 0x6100),
5057 {}
5058 };
6b0f95c4 5059 static const struct coef_fw coef0233[] = {
54db6c39
TI
5060 WRITE_COEF(0x06, 0x2100),
5061 WRITE_COEF(0x32, 0x4ea3),
5062 {}
5063 };
6b0f95c4 5064 static const struct coef_fw coef0288[] = {
f3b70332
KY
5065 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5066 UPDATE_COEF(0x50, 0x2000, 0x2000),
5067 UPDATE_COEF(0x56, 0x0006, 0x0006),
5068 UPDATE_COEF(0x66, 0x0008, 0),
5069 UPDATE_COEF(0x67, 0x2000, 0),
5070 {}
5071 };
6b0f95c4 5072 static const struct coef_fw coef0292[] = {
54db6c39
TI
5073 WRITE_COEF(0x76, 0x000e),
5074 WRITE_COEF(0x6c, 0x2400),
5075 WRITE_COEF(0x6b, 0xc429),
5076 WRITE_COEF(0x18, 0x7308),
5077 {}
5078 };
6b0f95c4 5079 static const struct coef_fw coef0293[] = {
54db6c39
TI
5080 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5081 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5082 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5083 {}
5084 };
6b0f95c4 5085 static const struct coef_fw coef0688[] = {
54db6c39
TI
5086 WRITE_COEF(0x11, 0x0041),
5087 WRITE_COEF(0x15, 0x0d40),
5088 WRITE_COEF(0xb7, 0x802b),
5089 {}
5090 };
6b0f95c4 5091 static const struct coef_fw coef0274[] = {
71683c32
KY
5092 WRITE_COEF(0x45, 0x4289),
5093 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5094 UPDATE_COEF(0x6b, 0x0f00, 0),
5095 UPDATE_COEF(0x49, 0x0300, 0x0300),
5096 {}
5097 };
54db6c39 5098
7639a06c 5099 switch (codec->core.vendor_id) {
c2b691ee 5100 case 0x10ec0215:
2ae95577 5101 case 0x10ec0225:
c2b691ee 5102 case 0x10ec0285:
7d727869 5103 case 0x10ec0295:
c2b691ee 5104 case 0x10ec0289:
28f1f9b2 5105 case 0x10ec0299:
5a36767a 5106 alc_process_coef_fw(codec, alc225_pre_hsmode);
2ae95577
DH
5107 alc_process_coef_fw(codec, coef0225);
5108 break;
9a22a8f5 5109 case 0x10ec0255:
54db6c39 5110 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5111 break;
1948fc06 5112 case 0x10ec0230:
717f43d8
KY
5113 case 0x10ec0236:
5114 case 0x10ec0256:
5115 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5116 alc_write_coef_idx(codec, 0x45, 0xc089);
5117 msleep(50);
5118 alc_process_coef_fw(codec, coef0256);
5119 break;
71683c32
KY
5120 case 0x10ec0234:
5121 case 0x10ec0274:
5122 case 0x10ec0294:
5123 alc_process_coef_fw(codec, coef0274);
5124 break;
13fd08a3 5125 case 0x10ec0233:
73bdd597 5126 case 0x10ec0283:
54db6c39 5127 alc_process_coef_fw(codec, coef0233);
73bdd597 5128 break;
f3b70332
KY
5129 case 0x10ec0286:
5130 case 0x10ec0288:
1a5bc8d9 5131 case 0x10ec0298:
f3b70332
KY
5132 alc_process_coef_fw(codec, coef0288);
5133 break;
73bdd597 5134 case 0x10ec0292:
54db6c39 5135 alc_process_coef_fw(codec, coef0292);
73bdd597 5136 break;
a22aa26f 5137 case 0x10ec0293:
54db6c39 5138 alc_process_coef_fw(codec, coef0293);
a22aa26f 5139 break;
73bdd597 5140 case 0x10ec0668:
54db6c39 5141 alc_process_coef_fw(codec, coef0688);
73bdd597 5142 break;
78f4f7c2
KY
5143 case 0x10ec0867:
5144 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5145 break;
73bdd597 5146 }
4e76a883 5147 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
73bdd597
DH
5148}
5149
5150/* Iphone type */
5151static void alc_headset_mode_ctia(struct hda_codec *codec)
5152{
89542936
KY
5153 int val;
5154
6b0f95c4 5155 static const struct coef_fw coef0255[] = {
54db6c39
TI
5156 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5157 WRITE_COEF(0x1b, 0x0c2b),
5158 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5159 {}
5160 };
6b0f95c4 5161 static const struct coef_fw coef0256[] = {
e69e7e03 5162 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
717f43d8 5163 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5164 {}
5165 };
6b0f95c4 5166 static const struct coef_fw coef0233[] = {
54db6c39
TI
5167 WRITE_COEF(0x45, 0xd429),
5168 WRITE_COEF(0x1b, 0x0c2b),
5169 WRITE_COEF(0x32, 0x4ea3),
5170 {}
5171 };
6b0f95c4 5172 static const struct coef_fw coef0288[] = {
f3b70332
KY
5173 UPDATE_COEF(0x50, 0x2000, 0x2000),
5174 UPDATE_COEF(0x56, 0x0006, 0x0006),
5175 UPDATE_COEF(0x66, 0x0008, 0),
5176 UPDATE_COEF(0x67, 0x2000, 0),
5177 {}
5178 };
6b0f95c4 5179 static const struct coef_fw coef0292[] = {
54db6c39
TI
5180 WRITE_COEF(0x6b, 0xd429),
5181 WRITE_COEF(0x76, 0x0008),
5182 WRITE_COEF(0x18, 0x7388),
5183 {}
5184 };
6b0f95c4 5185 static const struct coef_fw coef0293[] = {
54db6c39
TI
5186 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5187 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5188 {}
5189 };
6b0f95c4 5190 static const struct coef_fw coef0688[] = {
54db6c39
TI
5191 WRITE_COEF(0x11, 0x0001),
5192 WRITE_COEF(0x15, 0x0d60),
5193 WRITE_COEF(0xc3, 0x0000),
5194 {}
5195 };
6b0f95c4 5196 static const struct coef_fw coef0225_1[] = {
4cc9b9d6 5197 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5a36767a
KY
5198 UPDATE_COEF(0x63, 3<<14, 2<<14),
5199 {}
5200 };
6b0f95c4 5201 static const struct coef_fw coef0225_2[] = {
5a36767a
KY
5202 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5203 UPDATE_COEF(0x63, 3<<14, 1<<14),
4cc9b9d6
KY
5204 {}
5205 };
54db6c39 5206
7639a06c 5207 switch (codec->core.vendor_id) {
9a22a8f5 5208 case 0x10ec0255:
54db6c39 5209 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5210 break;
1948fc06 5211 case 0x10ec0230:
736f20a7 5212 case 0x10ec0236:
e69e7e03
KY
5213 case 0x10ec0256:
5214 alc_process_coef_fw(codec, coef0256);
5215 break;
71683c32
KY
5216 case 0x10ec0234:
5217 case 0x10ec0274:
5218 case 0x10ec0294:
5219 alc_write_coef_idx(codec, 0x45, 0xd689);
5220 break;
13fd08a3 5221 case 0x10ec0233:
73bdd597 5222 case 0x10ec0283:
54db6c39 5223 alc_process_coef_fw(codec, coef0233);
73bdd597 5224 break;
1a5bc8d9 5225 case 0x10ec0298:
89542936
KY
5226 val = alc_read_coef_idx(codec, 0x50);
5227 if (val & (1 << 12)) {
5228 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5229 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5230 msleep(300);
5231 } else {
5232 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5233 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5234 msleep(300);
5235 }
5236 break;
f3b70332
KY
5237 case 0x10ec0286:
5238 case 0x10ec0288:
5239 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5240 msleep(300);
5241 alc_process_coef_fw(codec, coef0288);
5242 break;
73bdd597 5243 case 0x10ec0292:
54db6c39 5244 alc_process_coef_fw(codec, coef0292);
73bdd597 5245 break;
a22aa26f 5246 case 0x10ec0293:
54db6c39 5247 alc_process_coef_fw(codec, coef0293);
a22aa26f 5248 break;
73bdd597 5249 case 0x10ec0668:
54db6c39 5250 alc_process_coef_fw(codec, coef0688);
73bdd597 5251 break;
c2b691ee 5252 case 0x10ec0215:
4cc9b9d6 5253 case 0x10ec0225:
c2b691ee 5254 case 0x10ec0285:
7d727869 5255 case 0x10ec0295:
c2b691ee 5256 case 0x10ec0289:
28f1f9b2 5257 case 0x10ec0299:
5a36767a
KY
5258 val = alc_read_coef_idx(codec, 0x45);
5259 if (val & (1 << 9))
5260 alc_process_coef_fw(codec, coef0225_2);
5261 else
5262 alc_process_coef_fw(codec, coef0225_1);
4cc9b9d6 5263 break;
78f4f7c2
KY
5264 case 0x10ec0867:
5265 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5266 break;
73bdd597 5267 }
4e76a883 5268 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
73bdd597
DH
5269}
5270
5271/* Nokia type */
5272static void alc_headset_mode_omtp(struct hda_codec *codec)
5273{
6b0f95c4 5274 static const struct coef_fw coef0255[] = {
54db6c39
TI
5275 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5276 WRITE_COEF(0x1b, 0x0c2b),
5277 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5278 {}
5279 };
6b0f95c4 5280 static const struct coef_fw coef0256[] = {
e69e7e03 5281 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
717f43d8 5282 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5283 {}
5284 };
6b0f95c4 5285 static const struct coef_fw coef0233[] = {
54db6c39
TI
5286 WRITE_COEF(0x45, 0xe429),
5287 WRITE_COEF(0x1b, 0x0c2b),
5288 WRITE_COEF(0x32, 0x4ea3),
5289 {}
5290 };
6b0f95c4 5291 static const struct coef_fw coef0288[] = {
f3b70332
KY
5292 UPDATE_COEF(0x50, 0x2000, 0x2000),
5293 UPDATE_COEF(0x56, 0x0006, 0x0006),
5294 UPDATE_COEF(0x66, 0x0008, 0),
5295 UPDATE_COEF(0x67, 0x2000, 0),
5296 {}
5297 };
6b0f95c4 5298 static const struct coef_fw coef0292[] = {
54db6c39
TI
5299 WRITE_COEF(0x6b, 0xe429),
5300 WRITE_COEF(0x76, 0x0008),
5301 WRITE_COEF(0x18, 0x7388),
5302 {}
5303 };
6b0f95c4 5304 static const struct coef_fw coef0293[] = {
54db6c39
TI
5305 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5306 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5307 {}
5308 };
6b0f95c4 5309 static const struct coef_fw coef0688[] = {
54db6c39
TI
5310 WRITE_COEF(0x11, 0x0001),
5311 WRITE_COEF(0x15, 0x0d50),
5312 WRITE_COEF(0xc3, 0x0000),
5313 {}
5314 };
6b0f95c4 5315 static const struct coef_fw coef0225[] = {
4cc9b9d6 5316 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5a36767a 5317 UPDATE_COEF(0x63, 3<<14, 2<<14),
4cc9b9d6
KY
5318 {}
5319 };
54db6c39 5320
7639a06c 5321 switch (codec->core.vendor_id) {
9a22a8f5 5322 case 0x10ec0255:
54db6c39 5323 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5324 break;
1948fc06 5325 case 0x10ec0230:
736f20a7 5326 case 0x10ec0236:
e69e7e03
KY
5327 case 0x10ec0256:
5328 alc_process_coef_fw(codec, coef0256);
5329 break;
71683c32
KY
5330 case 0x10ec0234:
5331 case 0x10ec0274:
5332 case 0x10ec0294:
5333 alc_write_coef_idx(codec, 0x45, 0xe689);
5334 break;
13fd08a3 5335 case 0x10ec0233:
73bdd597 5336 case 0x10ec0283:
54db6c39 5337 alc_process_coef_fw(codec, coef0233);
73bdd597 5338 break;
1a5bc8d9
KY
5339 case 0x10ec0298:
5340 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
89542936
KY
5341 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5342 msleep(300);
5343 break;
f3b70332
KY
5344 case 0x10ec0286:
5345 case 0x10ec0288:
5346 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5347 msleep(300);
5348 alc_process_coef_fw(codec, coef0288);
5349 break;
73bdd597 5350 case 0x10ec0292:
54db6c39 5351 alc_process_coef_fw(codec, coef0292);
73bdd597 5352 break;
a22aa26f 5353 case 0x10ec0293:
54db6c39 5354 alc_process_coef_fw(codec, coef0293);
a22aa26f 5355 break;
73bdd597 5356 case 0x10ec0668:
54db6c39 5357 alc_process_coef_fw(codec, coef0688);
73bdd597 5358 break;
c2b691ee 5359 case 0x10ec0215:
4cc9b9d6 5360 case 0x10ec0225:
c2b691ee 5361 case 0x10ec0285:
7d727869 5362 case 0x10ec0295:
c2b691ee 5363 case 0x10ec0289:
28f1f9b2 5364 case 0x10ec0299:
4cc9b9d6
KY
5365 alc_process_coef_fw(codec, coef0225);
5366 break;
73bdd597 5367 }
4e76a883 5368 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
73bdd597
DH
5369}
5370
5371static void alc_determine_headset_type(struct hda_codec *codec)
5372{
5373 int val;
5374 bool is_ctia = false;
5375 struct alc_spec *spec = codec->spec;
6b0f95c4 5376 static const struct coef_fw coef0255[] = {
54db6c39
TI
5377 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5378 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5379 conteol) */
5380 {}
5381 };
6b0f95c4 5382 static const struct coef_fw coef0288[] = {
f3b70332
KY
5383 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5384 {}
5385 };
6b0f95c4 5386 static const struct coef_fw coef0298[] = {
89542936
KY
5387 UPDATE_COEF(0x50, 0x2000, 0x2000),
5388 UPDATE_COEF(0x56, 0x0006, 0x0006),
5389 UPDATE_COEF(0x66, 0x0008, 0),
5390 UPDATE_COEF(0x67, 0x2000, 0),
5391 UPDATE_COEF(0x19, 0x1300, 0x1300),
5392 {}
5393 };
6b0f95c4 5394 static const struct coef_fw coef0293[] = {
54db6c39
TI
5395 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5396 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5397 {}
5398 };
6b0f95c4 5399 static const struct coef_fw coef0688[] = {
54db6c39
TI
5400 WRITE_COEF(0x11, 0x0001),
5401 WRITE_COEF(0xb7, 0x802b),
5402 WRITE_COEF(0x15, 0x0d60),
5403 WRITE_COEF(0xc3, 0x0c00),
5404 {}
5405 };
6b0f95c4 5406 static const struct coef_fw coef0274[] = {
71683c32
KY
5407 UPDATE_COEF(0x4a, 0x0010, 0),
5408 UPDATE_COEF(0x4a, 0x8000, 0),
5409 WRITE_COEF(0x45, 0xd289),
5410 UPDATE_COEF(0x49, 0x0300, 0x0300),
5411 {}
5412 };
73bdd597 5413
92666d45
KY
5414 if (spec->no_internal_mic_pin) {
5415 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5416 return;
5417 }
5418
7639a06c 5419 switch (codec->core.vendor_id) {
9a22a8f5 5420 case 0x10ec0255:
717f43d8
KY
5421 alc_process_coef_fw(codec, coef0255);
5422 msleep(300);
5423 val = alc_read_coef_idx(codec, 0x46);
5424 is_ctia = (val & 0x0070) == 0x0070;
5425 break;
1948fc06 5426 case 0x10ec0230:
717f43d8 5427 case 0x10ec0236:
7081adf3 5428 case 0x10ec0256:
717f43d8
KY
5429 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5430 alc_write_coef_idx(codec, 0x06, 0x6104);
5431 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5432
5433 snd_hda_codec_write(codec, 0x21, 0,
5434 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5435 msleep(80);
5436 snd_hda_codec_write(codec, 0x21, 0,
5437 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5438
54db6c39 5439 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
5440 msleep(300);
5441 val = alc_read_coef_idx(codec, 0x46);
5442 is_ctia = (val & 0x0070) == 0x0070;
717f43d8
KY
5443
5444 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5445 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5446
5447 snd_hda_codec_write(codec, 0x21, 0,
5448 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5449 msleep(80);
5450 snd_hda_codec_write(codec, 0x21, 0,
5451 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
9a22a8f5 5452 break;
71683c32
KY
5453 case 0x10ec0234:
5454 case 0x10ec0274:
5455 case 0x10ec0294:
5456 alc_process_coef_fw(codec, coef0274);
febf2256 5457 msleep(850);
71683c32
KY
5458 val = alc_read_coef_idx(codec, 0x46);
5459 is_ctia = (val & 0x00f0) == 0x00f0;
5460 break;
13fd08a3 5461 case 0x10ec0233:
73bdd597
DH
5462 case 0x10ec0283:
5463 alc_write_coef_idx(codec, 0x45, 0xd029);
5464 msleep(300);
5465 val = alc_read_coef_idx(codec, 0x46);
5466 is_ctia = (val & 0x0070) == 0x0070;
5467 break;
1a5bc8d9 5468 case 0x10ec0298:
89542936
KY
5469 snd_hda_codec_write(codec, 0x21, 0,
5470 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5471 msleep(100);
5472 snd_hda_codec_write(codec, 0x21, 0,
5473 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5474 msleep(200);
5475
5476 val = alc_read_coef_idx(codec, 0x50);
5477 if (val & (1 << 12)) {
5478 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5479 alc_process_coef_fw(codec, coef0288);
5480 msleep(350);
5481 val = alc_read_coef_idx(codec, 0x50);
5482 is_ctia = (val & 0x0070) == 0x0070;
5483 } else {
5484 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5485 alc_process_coef_fw(codec, coef0288);
5486 msleep(350);
5487 val = alc_read_coef_idx(codec, 0x50);
5488 is_ctia = (val & 0x0070) == 0x0070;
5489 }
5490 alc_process_coef_fw(codec, coef0298);
5491 snd_hda_codec_write(codec, 0x21, 0,
5492 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5493 msleep(75);
5494 snd_hda_codec_write(codec, 0x21, 0,
5495 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5496 break;
f3b70332
KY
5497 case 0x10ec0286:
5498 case 0x10ec0288:
5499 alc_process_coef_fw(codec, coef0288);
5500 msleep(350);
5501 val = alc_read_coef_idx(codec, 0x50);
5502 is_ctia = (val & 0x0070) == 0x0070;
5503 break;
73bdd597
DH
5504 case 0x10ec0292:
5505 alc_write_coef_idx(codec, 0x6b, 0xd429);
5506 msleep(300);
5507 val = alc_read_coef_idx(codec, 0x6c);
5508 is_ctia = (val & 0x001c) == 0x001c;
5509 break;
a22aa26f 5510 case 0x10ec0293:
54db6c39 5511 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5512 msleep(300);
5513 val = alc_read_coef_idx(codec, 0x46);
5514 is_ctia = (val & 0x0070) == 0x0070;
5515 break;
73bdd597 5516 case 0x10ec0668:
54db6c39 5517 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5518 msleep(300);
5519 val = alc_read_coef_idx(codec, 0xbe);
5520 is_ctia = (val & 0x1c02) == 0x1c02;
5521 break;
c2b691ee 5522 case 0x10ec0215:
4cc9b9d6 5523 case 0x10ec0225:
c2b691ee 5524 case 0x10ec0285:
7d727869 5525 case 0x10ec0295:
c2b691ee 5526 case 0x10ec0289:
28f1f9b2 5527 case 0x10ec0299:
da911b1f
KY
5528 snd_hda_codec_write(codec, 0x21, 0,
5529 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5530 msleep(80);
5531 snd_hda_codec_write(codec, 0x21, 0,
5532 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5533
5a36767a
KY
5534 alc_process_coef_fw(codec, alc225_pre_hsmode);
5535 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5536 val = alc_read_coef_idx(codec, 0x45);
5537 if (val & (1 << 9)) {
5538 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5539 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5540 msleep(800);
5541 val = alc_read_coef_idx(codec, 0x46);
5542 is_ctia = (val & 0x00f0) == 0x00f0;
5543 } else {
5544 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5545 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5546 msleep(800);
5547 val = alc_read_coef_idx(codec, 0x46);
5548 is_ctia = (val & 0x00f0) == 0x00f0;
5549 }
5550 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5551 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5552 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
da911b1f
KY
5553
5554 snd_hda_codec_write(codec, 0x21, 0,
5555 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5556 msleep(80);
5557 snd_hda_codec_write(codec, 0x21, 0,
5558 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4cc9b9d6 5559 break;
78f4f7c2
KY
5560 case 0x10ec0867:
5561 is_ctia = true;
5562 break;
73bdd597
DH
5563 }
5564
4e76a883 5565 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
73bdd597
DH
5566 is_ctia ? "yes" : "no");
5567 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5568}
5569
5570static void alc_update_headset_mode(struct hda_codec *codec)
5571{
5572 struct alc_spec *spec = codec->spec;
5573
5574 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
35a39f98 5575 hda_nid_t hp_pin = alc_get_hp_pin(spec);
73bdd597
DH
5576
5577 int new_headset_mode;
5578
5579 if (!snd_hda_jack_detect(codec, hp_pin))
5580 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5581 else if (mux_pin == spec->headset_mic_pin)
5582 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5583 else if (mux_pin == spec->headphone_mic_pin)
5584 new_headset_mode = ALC_HEADSET_MODE_MIC;
5585 else
5586 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5587
5959a6bc
DH
5588 if (new_headset_mode == spec->current_headset_mode) {
5589 snd_hda_gen_update_outputs(codec);
73bdd597 5590 return;
5959a6bc 5591 }
73bdd597
DH
5592
5593 switch (new_headset_mode) {
5594 case ALC_HEADSET_MODE_UNPLUGGED:
5595 alc_headset_mode_unplugged(codec);
aeac1a0d
KY
5596 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5597 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
73bdd597
DH
5598 spec->gen.hp_jack_present = false;
5599 break;
5600 case ALC_HEADSET_MODE_HEADSET:
5601 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5602 alc_determine_headset_type(codec);
5603 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5604 alc_headset_mode_ctia(codec);
5605 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5606 alc_headset_mode_omtp(codec);
5607 spec->gen.hp_jack_present = true;
5608 break;
5609 case ALC_HEADSET_MODE_MIC:
5610 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5611 spec->gen.hp_jack_present = false;
5612 break;
5613 case ALC_HEADSET_MODE_HEADPHONE:
5614 alc_headset_mode_default(codec);
5615 spec->gen.hp_jack_present = true;
5616 break;
5617 }
5618 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5619 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5620 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
1f8b46cd 5621 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
73bdd597
DH
5622 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5623 PIN_VREFHIZ);
5624 }
5625 spec->current_headset_mode = new_headset_mode;
5626
5627 snd_hda_gen_update_outputs(codec);
5628}
5629
5630static void alc_update_headset_mode_hook(struct hda_codec *codec,
7fe30711
TI
5631 struct snd_kcontrol *kcontrol,
5632 struct snd_ctl_elem_value *ucontrol)
73bdd597
DH
5633{
5634 alc_update_headset_mode(codec);
5635}
5636
1a4f69d5
TI
5637static void alc_update_headset_jack_cb(struct hda_codec *codec,
5638 struct hda_jack_callback *jack)
73bdd597 5639{
73bdd597 5640 snd_hda_gen_hp_automute(codec, jack);
e54f30be 5641 alc_update_headset_mode(codec);
73bdd597
DH
5642}
5643
5644static void alc_probe_headset_mode(struct hda_codec *codec)
5645{
5646 int i;
5647 struct alc_spec *spec = codec->spec;
5648 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5649
5650 /* Find mic pins */
5651 for (i = 0; i < cfg->num_inputs; i++) {
5652 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5653 spec->headset_mic_pin = cfg->inputs[i].pin;
5654 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5655 spec->headphone_mic_pin = cfg->inputs[i].pin;
5656 }
5657
0bed2aa3 5658 WARN_ON(spec->gen.cap_sync_hook);
73bdd597
DH
5659 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5660 spec->gen.automute_hook = alc_update_headset_mode;
5661 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5662}
5663
5664static void alc_fixup_headset_mode(struct hda_codec *codec,
5665 const struct hda_fixup *fix, int action)
5666{
5667 struct alc_spec *spec = codec->spec;
5668
5669 switch (action) {
5670 case HDA_FIXUP_ACT_PRE_PROBE:
5671 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5672 break;
5673 case HDA_FIXUP_ACT_PROBE:
5674 alc_probe_headset_mode(codec);
5675 break;
5676 case HDA_FIXUP_ACT_INIT:
aeac1a0d
KY
5677 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5678 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5679 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5680 }
73bdd597
DH
5681 alc_update_headset_mode(codec);
5682 break;
5683 }
5684}
5685
5686static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5687 const struct hda_fixup *fix, int action)
5688{
5689 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5690 struct alc_spec *spec = codec->spec;
5691 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5692 }
5693 else
5694 alc_fixup_headset_mode(codec, fix, action);
5695}
5696
31278997
KY
5697static void alc255_set_default_jack_type(struct hda_codec *codec)
5698{
5699 /* Set to iphone type */
6b0f95c4 5700 static const struct coef_fw alc255fw[] = {
54db6c39
TI
5701 WRITE_COEF(0x1b, 0x880b),
5702 WRITE_COEF(0x45, 0xd089),
5703 WRITE_COEF(0x1b, 0x080b),
5704 WRITE_COEF(0x46, 0x0004),
5705 WRITE_COEF(0x1b, 0x0c0b),
5706 {}
5707 };
6b0f95c4 5708 static const struct coef_fw alc256fw[] = {
e69e7e03
KY
5709 WRITE_COEF(0x1b, 0x884b),
5710 WRITE_COEF(0x45, 0xd089),
5711 WRITE_COEF(0x1b, 0x084b),
5712 WRITE_COEF(0x46, 0x0004),
5713 WRITE_COEF(0x1b, 0x0c4b),
5714 {}
5715 };
5716 switch (codec->core.vendor_id) {
5717 case 0x10ec0255:
5718 alc_process_coef_fw(codec, alc255fw);
5719 break;
1948fc06 5720 case 0x10ec0230:
736f20a7 5721 case 0x10ec0236:
e69e7e03
KY
5722 case 0x10ec0256:
5723 alc_process_coef_fw(codec, alc256fw);
5724 break;
5725 }
31278997
KY
5726 msleep(30);
5727}
5728
9a22a8f5
KY
5729static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5730 const struct hda_fixup *fix, int action)
5731{
5732 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
31278997 5733 alc255_set_default_jack_type(codec);
9a22a8f5
KY
5734 }
5735 alc_fixup_headset_mode(codec, fix, action);
5736}
5737
31278997
KY
5738static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5739 const struct hda_fixup *fix, int action)
5740{
5741 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5742 struct alc_spec *spec = codec->spec;
5743 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5744 alc255_set_default_jack_type(codec);
5745 }
5746 else
5747 alc_fixup_headset_mode(codec, fix, action);
5748}
5749
e1e62b98
KY
5750static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5751 struct hda_jack_callback *jack)
5752{
5753 struct alc_spec *spec = codec->spec;
e1e62b98
KY
5754
5755 alc_update_headset_jack_cb(codec, jack);
5756 /* Headset Mic enable or disable, only for Dell Dino */
d44a6864 5757 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
e1e62b98
KY
5758}
5759
5760static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5761 const struct hda_fixup *fix, int action)
5762{
5763 alc_fixup_headset_mode(codec, fix, action);
5764 if (action == HDA_FIXUP_ACT_PROBE) {
5765 struct alc_spec *spec = codec->spec;
d44a6864
TI
5766 /* toggled via hp_automute_hook */
5767 spec->gpio_mask |= 0x40;
5768 spec->gpio_dir |= 0x40;
e1e62b98
KY
5769 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5770 }
5771}
5772
493a52a9
HW
5773static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5774 const struct hda_fixup *fix, int action)
5775{
5776 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5777 struct alc_spec *spec = codec->spec;
5778 spec->gen.auto_mute_via_amp = 1;
5779 }
5780}
5781
9b745ab8
TI
5782static void alc_fixup_no_shutup(struct hda_codec *codec,
5783 const struct hda_fixup *fix, int action)
5784{
efe55732 5785 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9b745ab8 5786 struct alc_spec *spec = codec->spec;
c0ca5ece 5787 spec->no_shutup_pins = 1;
9b745ab8
TI
5788 }
5789}
5790
5e6db669
GM
5791static void alc_fixup_disable_aamix(struct hda_codec *codec,
5792 const struct hda_fixup *fix, int action)
5793{
5794 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5795 struct alc_spec *spec = codec->spec;
5796 /* Disable AA-loopback as it causes white noise */
5797 spec->gen.mixer_nid = 0;
5798 }
5799}
5800
7f57d803
TI
5801/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5802static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5803 const struct hda_fixup *fix, int action)
5804{
5805 static const struct hda_pintbl pincfgs[] = {
5806 { 0x16, 0x21211010 }, /* dock headphone */
5807 { 0x19, 0x21a11010 }, /* dock mic */
5808 { }
5809 };
5810 struct alc_spec *spec = codec->spec;
5811
5812 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5813 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5814 codec->power_save_node = 0; /* avoid click noises */
5815 snd_hda_apply_pincfgs(codec, pincfgs);
5816 }
5817}
5818
61fcf8ec
KY
5819static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5820 const struct hda_fixup *fix, int action)
5821{
5822 static const struct hda_pintbl pincfgs[] = {
5823 { 0x17, 0x21211010 }, /* dock headphone */
5824 { 0x19, 0x21a11010 }, /* dock mic */
5825 { }
5826 };
5827 struct alc_spec *spec = codec->spec;
5828
5829 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5830 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
71db96dd
TI
5831 snd_hda_apply_pincfgs(codec, pincfgs);
5832 } else if (action == HDA_FIXUP_ACT_INIT) {
61fcf8ec
KY
5833 /* Enable DOCK device */
5834 snd_hda_codec_write(codec, 0x17, 0,
5835 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5836 /* Enable DOCK device */
5837 snd_hda_codec_write(codec, 0x19, 0,
5838 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
61fcf8ec
KY
5839 }
5840}
5841
399c01aa
TI
5842static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5843 const struct hda_fixup *fix, int action)
5844{
5845 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5846 * the speaker output becomes too low by some reason on Thinkpads with
5847 * ALC298 codec
5848 */
5849 static const hda_nid_t preferred_pairs[] = {
5850 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5851 0
5852 };
5853 struct alc_spec *spec = codec->spec;
5854
5855 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5856 spec->gen.preferred_dacs = preferred_pairs;
5857}
5858
8eedd3a7
TI
5859static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5860 const struct hda_fixup *fix, int action)
5861{
5862 static const hda_nid_t preferred_pairs[] = {
5863 0x17, 0x02, 0x21, 0x03, 0
5864 };
5865 struct alc_spec *spec = codec->spec;
5866
5867 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5868 spec->gen.preferred_dacs = preferred_pairs;
5869}
5870
9476d369 5871static void alc_shutup_dell_xps13(struct hda_codec *codec)
033b0a7c
GM
5872{
5873 struct alc_spec *spec = codec->spec;
35a39f98 5874 int hp_pin = alc_get_hp_pin(spec);
033b0a7c 5875
9476d369
GM
5876 /* Prevent pop noises when headphones are plugged in */
5877 snd_hda_codec_write(codec, hp_pin, 0,
5878 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5879 msleep(20);
033b0a7c
GM
5880}
5881
5882static void alc_fixup_dell_xps13(struct hda_codec *codec,
5883 const struct hda_fixup *fix, int action)
5884{
3e1b0c4a
TI
5885 struct alc_spec *spec = codec->spec;
5886 struct hda_input_mux *imux = &spec->gen.input_mux;
5887 int i;
f38663ab 5888
3e1b0c4a
TI
5889 switch (action) {
5890 case HDA_FIXUP_ACT_PRE_PROBE:
5891 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5892 * it causes a click noise at start up
5893 */
5894 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
efe55732 5895 spec->shutup = alc_shutup_dell_xps13;
3e1b0c4a
TI
5896 break;
5897 case HDA_FIXUP_ACT_PROBE:
f38663ab
GM
5898 /* Make the internal mic the default input source. */
5899 for (i = 0; i < imux->num_items; i++) {
5900 if (spec->gen.imux_pins[i] == 0x12) {
5901 spec->gen.cur_mux[0] = i;
5902 break;
5903 }
5904 }
3e1b0c4a 5905 break;
033b0a7c
GM
5906 }
5907}
5908
1f8b46cd
DH
5909static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5910 const struct hda_fixup *fix, int action)
5911{
5912 struct alc_spec *spec = codec->spec;
5913
5914 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5915 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5916 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
b40eda64
DH
5917
5918 /* Disable boost for mic-in permanently. (This code is only called
5919 from quirks that guarantee that the headphone is at NID 0x1b.) */
5920 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5921 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
1f8b46cd
DH
5922 } else
5923 alc_fixup_headset_mode(codec, fix, action);
5924}
5925
73bdd597
DH
5926static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5927 const struct hda_fixup *fix, int action)
5928{
5929 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
73bdd597 5930 alc_write_coef_idx(codec, 0xc4, 0x8000);
98b24883 5931 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
73bdd597
DH
5932 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5933 }
5934 alc_fixup_headset_mode(codec, fix, action);
5935}
5936
bde7bc60
CCC
5937/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5938static int find_ext_mic_pin(struct hda_codec *codec)
5939{
5940 struct alc_spec *spec = codec->spec;
5941 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5942 hda_nid_t nid;
5943 unsigned int defcfg;
5944 int i;
5945
5946 for (i = 0; i < cfg->num_inputs; i++) {
5947 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5948 continue;
5949 nid = cfg->inputs[i].pin;
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 return nid;
5954 }
5955
5956 return 0;
5957}
5958
08a978db 5959static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
1727a771 5960 const struct hda_fixup *fix,
08a978db
DR
5961 int action)
5962{
5963 struct alc_spec *spec = codec->spec;
5964
0db75790 5965 if (action == HDA_FIXUP_ACT_PROBE) {
bde7bc60 5966 int mic_pin = find_ext_mic_pin(codec);
35a39f98 5967 int hp_pin = alc_get_hp_pin(spec);
bde7bc60
CCC
5968
5969 if (snd_BUG_ON(!mic_pin || !hp_pin))
0db75790 5970 return;
bde7bc60 5971 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
0db75790 5972 }
08a978db 5973}
693b613d 5974
3e0d611b
DH
5975static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5976 const struct hda_fixup *fix,
5977 int action)
5978{
5979 struct alc_spec *spec = codec->spec;
5980 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5981 int i;
5982
5983 /* The mic boosts on level 2 and 3 are too noisy
5984 on the internal mic input.
5985 Therefore limit the boost to 0 or 1. */
5986
5987 if (action != HDA_FIXUP_ACT_PROBE)
5988 return;
5989
5990 for (i = 0; i < cfg->num_inputs; i++) {
5991 hda_nid_t nid = cfg->inputs[i].pin;
5992 unsigned int defcfg;
5993 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5994 continue;
5995 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5996 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5997 continue;
5998
5999 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6000 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6001 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6002 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6003 (0 << AC_AMPCAP_MUTE_SHIFT));
6004 }
6005}
6006
cd217a63 6007static void alc283_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 6008 struct hda_jack_callback *jack)
cd217a63
KY
6009{
6010 struct alc_spec *spec = codec->spec;
6011 int vref;
6012
6013 msleep(200);
6014 snd_hda_gen_hp_automute(codec, jack);
6015
6016 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6017
6018 msleep(600);
6019 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6020 vref);
6021}
6022
cd217a63
KY
6023static void alc283_fixup_chromebook(struct hda_codec *codec,
6024 const struct hda_fixup *fix, int action)
6025{
6026 struct alc_spec *spec = codec->spec;
cd217a63
KY
6027
6028 switch (action) {
6029 case HDA_FIXUP_ACT_PRE_PROBE:
0202e99c 6030 snd_hda_override_wcaps(codec, 0x03, 0);
d2e92709
TI
6031 /* Disable AA-loopback as it causes white noise */
6032 spec->gen.mixer_nid = 0;
38070219 6033 break;
0202e99c 6034 case HDA_FIXUP_ACT_INIT:
de9481cb
KY
6035 /* MIC2-VREF control */
6036 /* Set to manual mode */
98b24883 6037 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
0202e99c 6038 /* Enable Line1 input control by verb */
98b24883 6039 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
0202e99c
KY
6040 break;
6041 }
6042}
6043
6044static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6045 const struct hda_fixup *fix, int action)
6046{
6047 struct alc_spec *spec = codec->spec;
0202e99c
KY
6048
6049 switch (action) {
6050 case HDA_FIXUP_ACT_PRE_PROBE:
cd217a63 6051 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
38070219
KY
6052 break;
6053 case HDA_FIXUP_ACT_INIT:
cd217a63
KY
6054 /* MIC2-VREF control */
6055 /* Set to manual mode */
98b24883 6056 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
cd217a63
KY
6057 break;
6058 }
6059}
6060
7bba2157
TI
6061/* mute tablet speaker pin (0x14) via dock plugging in addition */
6062static void asus_tx300_automute(struct hda_codec *codec)
6063{
6064 struct alc_spec *spec = codec->spec;
6065 snd_hda_gen_update_outputs(codec);
6066 if (snd_hda_jack_detect(codec, 0x1b))
6067 spec->gen.mute_bits |= (1ULL << 0x14);
6068}
6069
6070static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6071 const struct hda_fixup *fix, int action)
6072{
6073 struct alc_spec *spec = codec->spec;
7bba2157
TI
6074 static const struct hda_pintbl dock_pins[] = {
6075 { 0x1b, 0x21114000 }, /* dock speaker pin */
6076 {}
6077 };
7bba2157
TI
6078
6079 switch (action) {
6080 case HDA_FIXUP_ACT_PRE_PROBE:
1c76aa5f 6081 spec->init_amp = ALC_INIT_DEFAULT;
ae065f1c
TI
6082 /* TX300 needs to set up GPIO2 for the speaker amp */
6083 alc_setup_gpio(codec, 0x04);
7bba2157
TI
6084 snd_hda_apply_pincfgs(codec, dock_pins);
6085 spec->gen.auto_mute_via_amp = 1;
6086 spec->gen.automute_hook = asus_tx300_automute;
6087 snd_hda_jack_detect_enable_callback(codec, 0x1b,
7bba2157
TI
6088 snd_hda_gen_hp_automute);
6089 break;
5579cd6f
TI
6090 case HDA_FIXUP_ACT_PROBE:
6091 spec->init_amp = ALC_INIT_DEFAULT;
6092 break;
7bba2157
TI
6093 case HDA_FIXUP_ACT_BUILD:
6094 /* this is a bit tricky; give more sane names for the main
6095 * (tablet) speaker and the dock speaker, respectively
6096 */
56798e6b
TI
6097 rename_ctl(codec, "Speaker Playback Switch",
6098 "Dock Speaker Playback Switch");
6099 rename_ctl(codec, "Bass Speaker Playback Switch",
6100 "Speaker Playback Switch");
7bba2157
TI
6101 break;
6102 }
6103}
6104
338cae56
DH
6105static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6106 const struct hda_fixup *fix, int action)
6107{
0f4881dc
DH
6108 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6109 /* DAC node 0x03 is giving mono output. We therefore want to
6110 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6111 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
caf3c043
MM
6112 static const hda_nid_t conn1[] = { 0x0c };
6113 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6114 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
0f4881dc 6115 }
338cae56
DH
6116}
6117
dd9aa335
HW
6118static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6119 const struct hda_fixup *fix, int action)
6120{
6121 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6122 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6123 we can't adjust the speaker's volume since this node does not has
6124 Amp-out capability. we change the speaker's route to:
6125 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6126 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6127 speaker's volume now. */
6128
caf3c043
MM
6129 static const hda_nid_t conn1[] = { 0x0c };
6130 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
dd9aa335
HW
6131 }
6132}
6133
e312a869
TI
6134/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6135static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6136 const struct hda_fixup *fix, int action)
6137{
6138 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
6139 static const hda_nid_t conn[] = { 0x02, 0x03 };
6140 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
e312a869
TI
6141 }
6142}
6143
d2cd795c
JK
6144/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6145static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6146 const struct hda_fixup *fix, int action)
6147{
6148 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
6149 static const hda_nid_t conn[] = { 0x02 };
6150 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
d2cd795c
JK
6151 }
6152}
6153
98973f2f
KP
6154/* Hook to update amp GPIO4 for automute */
6155static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6156 struct hda_jack_callback *jack)
6157{
6158 struct alc_spec *spec = codec->spec;
6159
6160 snd_hda_gen_hp_automute(codec, jack);
6161 /* mute_led_polarity is set to 0, so we pass inverted value here */
dbd13179
KHF
6162 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6163 !spec->gen.hp_jack_present);
98973f2f
KP
6164}
6165
6166/* Manage GPIOs for HP EliteBook Folio 9480m.
6167 *
6168 * GPIO4 is the headphone amplifier power control
6169 * GPIO3 is the audio output mute indicator LED
6170 */
6171
6172static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6173 const struct hda_fixup *fix,
6174 int action)
6175{
6176 struct alc_spec *spec = codec->spec;
98973f2f 6177
01e4a275 6178 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
98973f2f 6179 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
6180 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6181 spec->gpio_mask |= 0x10;
6182 spec->gpio_dir |= 0x10;
98973f2f 6183 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
98973f2f
KP
6184 }
6185}
6186
ae065f1c
TI
6187static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6188 const struct hda_fixup *fix,
6189 int action)
6190{
6191 struct alc_spec *spec = codec->spec;
6192
6193 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6194 spec->gpio_mask |= 0x04;
6195 spec->gpio_dir |= 0x04;
6196 /* set data bit low */
6197 }
6198}
6199
6a6660d0
TI
6200/* Quirk for Thinkpad X1 7th and 8th Gen
6201 * The following fixed routing needed
6202 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6203 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6204 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6205 */
6206static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6207 const struct hda_fixup *fix, int action)
6208{
6209 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6210 static const hda_nid_t preferred_pairs[] = {
6211 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6212 };
6213 struct alc_spec *spec = codec->spec;
6214
6215 switch (action) {
6216 case HDA_FIXUP_ACT_PRE_PROBE:
6217 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6218 spec->gen.preferred_dacs = preferred_pairs;
6219 break;
6220 case HDA_FIXUP_ACT_BUILD:
6221 /* The generic parser creates somewhat unintuitive volume ctls
6222 * with the fixed routing above, and the shared DAC2 may be
6223 * confusing for PA.
6224 * Rename those to unique names so that PA doesn't touch them
6225 * and use only Master volume.
6226 */
6227 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6228 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6229 break;
6230 }
6231}
6232
ca169cc2
KY
6233static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6234 const struct hda_fixup *fix,
6235 int action)
6236{
6237 alc_fixup_dual_codecs(codec, fix, action);
6238 switch (action) {
6239 case HDA_FIXUP_ACT_PRE_PROBE:
6240 /* override card longname to provide a unique UCM profile */
6241 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6242 break;
6243 case HDA_FIXUP_ACT_BUILD:
6244 /* rename Capture controls depending on the codec */
6245 rename_ctl(codec, "Capture Volume",
6246 codec->addr == 0 ?
6247 "Rear-Panel Capture Volume" :
6248 "Front-Panel Capture Volume");
6249 rename_ctl(codec, "Capture Switch",
6250 codec->addr == 0 ?
6251 "Rear-Panel Capture Switch" :
6252 "Front-Panel Capture Switch");
6253 break;
6254 }
6255}
6256
52e4e368
KHF
6257static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6258 const struct hda_fixup *fix, int action)
6259{
6260 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6261 return;
6262
6263 codec->power_save_node = 1;
6264}
6265
92266651
KY
6266/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6267static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6268 const struct hda_fixup *fix, int action)
6269{
6270 struct alc_spec *spec = codec->spec;
caf3c043 6271 static const hda_nid_t preferred_pairs[] = {
92266651
KY
6272 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6273 0
6274 };
6275
6276 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6277 return;
6278
6279 spec->gen.preferred_dacs = preferred_pairs;
0700d3d1
KY
6280 spec->gen.auto_mute_via_amp = 1;
6281 codec->power_save_node = 0;
92266651
KY
6282}
6283
c84bfedc
TI
6284/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6285static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6286 const struct hda_fixup *fix, int action)
6287{
6288 static const hda_nid_t preferred_pairs[] = {
6289 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6290 };
6291 struct alc_spec *spec = codec->spec;
6292
6293 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6294 spec->gen.preferred_dacs = preferred_pairs;
6295 spec->gen.obey_preferred_dacs = 1;
6296 }
6297}
6298
c4cfcf6f
HW
6299/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6300static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6301 const struct hda_fixup *fix, int action)
6302{
6303 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6304 return;
6305
6306 snd_hda_override_wcaps(codec, 0x03, 0);
6307}
6308
8a8de09c
KY
6309static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6310{
6311 switch (codec->core.vendor_id) {
6312 case 0x10ec0274:
6313 case 0x10ec0294:
6314 case 0x10ec0225:
6315 case 0x10ec0295:
6316 case 0x10ec0299:
6317 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6318 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6319 break;
1948fc06 6320 case 0x10ec0230:
8a8de09c
KY
6321 case 0x10ec0235:
6322 case 0x10ec0236:
6323 case 0x10ec0255:
6324 case 0x10ec0256:
6325 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6326 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6327 break;
6328 }
6329}
6330
8983eb60
KY
6331static void alc295_fixup_chromebook(struct hda_codec *codec,
6332 const struct hda_fixup *fix, int action)
6333{
d3ba58bb
KY
6334 struct alc_spec *spec = codec->spec;
6335
8983eb60 6336 switch (action) {
d3ba58bb
KY
6337 case HDA_FIXUP_ACT_PRE_PROBE:
6338 spec->ultra_low_power = true;
6339 break;
8983eb60 6340 case HDA_FIXUP_ACT_INIT:
8a8de09c 6341 alc_combo_jack_hp_jd_restart(codec);
8983eb60
KY
6342 break;
6343 }
6344}
6345
d1dd4211
KY
6346static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6347 const struct hda_fixup *fix, int action)
6348{
6349 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6350 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6351}
6352
c3cdf189
LJ
6353
6354static void alc294_gx502_toggle_output(struct hda_codec *codec,
6355 struct hda_jack_callback *cb)
6356{
6357 /* The Windows driver sets the codec up in a very different way where
6358 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6359 */
6360 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6361 alc_write_coef_idx(codec, 0x10, 0x8a20);
6362 else
6363 alc_write_coef_idx(codec, 0x10, 0x0a20);
6364}
6365
6366static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6367 const struct hda_fixup *fix, int action)
6368{
6369 /* Pin 0x21: headphones/headset mic */
6370 if (!is_jack_detectable(codec, 0x21))
6371 return;
6372
6373 switch (action) {
6374 case HDA_FIXUP_ACT_PRE_PROBE:
6375 snd_hda_jack_detect_enable_callback(codec, 0x21,
6376 alc294_gx502_toggle_output);
6377 break;
6378 case HDA_FIXUP_ACT_INIT:
6379 /* Make sure to start in a correct state, i.e. if
6380 * headphones have been plugged in before powering up the system
6381 */
6382 alc294_gx502_toggle_output(codec, NULL);
6383 break;
6384 }
6385}
6386
c1b55029
DC
6387static void alc294_gu502_toggle_output(struct hda_codec *codec,
6388 struct hda_jack_callback *cb)
6389{
6390 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6391 * responsible from changes between speakers and headphones
6392 */
6393 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6394 alc_write_coef_idx(codec, 0x10, 0x8420);
6395 else
6396 alc_write_coef_idx(codec, 0x10, 0x0a20);
6397}
6398
6399static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6400 const struct hda_fixup *fix, int action)
6401{
6402 if (!is_jack_detectable(codec, 0x21))
6403 return;
6404
6405 switch (action) {
6406 case HDA_FIXUP_ACT_PRE_PROBE:
6407 snd_hda_jack_detect_enable_callback(codec, 0x21,
6408 alc294_gu502_toggle_output);
6409 break;
6410 case HDA_FIXUP_ACT_INIT:
6411 alc294_gu502_toggle_output(codec, NULL);
6412 break;
6413 }
6414}
6415
56496253
KY
6416static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6417 const struct hda_fixup *fix, int action)
6418{
6419 if (action != HDA_FIXUP_ACT_INIT)
6420 return;
6421
6422 msleep(100);
6423 alc_write_coef_idx(codec, 0x65, 0x0);
6424}
6425
8a8de09c
KY
6426static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6427 const struct hda_fixup *fix, int action)
6428{
6429 switch (action) {
6430 case HDA_FIXUP_ACT_INIT:
6431 alc_combo_jack_hp_jd_restart(codec);
6432 break;
6433 }
6434}
6435
92666d45
KY
6436static void alc_fixup_no_int_mic(struct hda_codec *codec,
6437 const struct hda_fixup *fix, int action)
6438{
6439 struct alc_spec *spec = codec->spec;
6440
6441 switch (action) {
6442 case HDA_FIXUP_ACT_PRE_PROBE:
6443 /* Mic RING SLEEVE swap for combo jack */
6444 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6445 spec->no_internal_mic_pin = true;
6446 break;
6447 case HDA_FIXUP_ACT_INIT:
6448 alc_combo_jack_hp_jd_restart(codec);
6449 break;
6450 }
6451}
6452
d94befbb
DB
6453/* GPIO1 = amplifier on/off
6454 * GPIO3 = mic mute LED
6455 */
6456static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6457 const struct hda_fixup *fix, int action)
6458{
6459 static const hda_nid_t conn[] = { 0x02 };
6460
6461 struct alc_spec *spec = codec->spec;
6462 static const struct hda_pintbl pincfgs[] = {
6463 { 0x14, 0x90170110 }, /* front/high speakers */
6464 { 0x17, 0x90170130 }, /* back/bass speakers */
6465 { }
6466 };
6467
6468 //enable micmute led
6469 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6470
6471 switch (action) {
6472 case HDA_FIXUP_ACT_PRE_PROBE:
6473 spec->micmute_led_polarity = 1;
6474 /* needed for amp of back speakers */
6475 spec->gpio_mask |= 0x01;
6476 spec->gpio_dir |= 0x01;
6477 snd_hda_apply_pincfgs(codec, pincfgs);
6478 /* share DAC to have unified volume control */
6479 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6480 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6481 break;
6482 case HDA_FIXUP_ACT_INIT:
6483 /* need to toggle GPIO to enable the amp of back speakers */
6484 alc_update_gpio_data(codec, 0x01, true);
6485 msleep(100);
6486 alc_update_gpio_data(codec, 0x01, false);
6487 break;
6488 }
6489}
6490
434591b2
ED
6491static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6492 const struct hda_fixup *fix, int action)
6493{
6494 static const hda_nid_t conn[] = { 0x02 };
6495 static const struct hda_pintbl pincfgs[] = {
6496 { 0x14, 0x90170110 }, /* rear speaker */
6497 { }
6498 };
6499
6500 switch (action) {
6501 case HDA_FIXUP_ACT_PRE_PROBE:
6502 snd_hda_apply_pincfgs(codec, pincfgs);
6503 /* force front speaker to DAC1 */
6504 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6505 break;
6506 }
6507}
6508
b317b032
TI
6509/* for hda_fixup_thinkpad_acpi() */
6510#include "thinkpad_helper.c"
b67ae3f1 6511
d5a6cabf
TI
6512static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6513 const struct hda_fixup *fix, int action)
6514{
6515 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6516 hda_fixup_thinkpad_acpi(codec, fix, action);
6517}
6518
ad7cc2d4
CB
6519/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6520static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6521 const struct hda_fixup *fix,
6522 int action)
6523{
6524 struct alc_spec *spec = codec->spec;
6525
6526 switch (action) {
6527 case HDA_FIXUP_ACT_PRE_PROBE:
6528 spec->gen.suppress_auto_mute = 1;
6529 break;
6530 }
6531}
6532
d3dca026
LT
6533static int comp_match_dev_name(struct device *dev, void *data)
6534{
6535 return strcmp(dev_name(dev), data) == 0;
6536}
6537
6538static int find_comp_by_dev_name(struct alc_spec *spec, const char *name)
6539{
6540 int i;
6541
6542 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6543 if (strcmp(spec->comps[i].name, name) == 0)
6544 return i;
6545 }
6546
6547 return -ENODEV;
6548}
6549
6550static int comp_bind(struct device *dev)
6551{
6552 struct hda_codec *cdc = dev_to_hda_codec(dev);
6553 struct alc_spec *spec = cdc->spec;
6554
6555 return component_bind_all(dev, spec->comps);
6556}
6557
6558static void comp_unbind(struct device *dev)
6559{
6560 struct hda_codec *cdc = dev_to_hda_codec(dev);
6561 struct alc_spec *spec = cdc->spec;
6562
6563 component_unbind_all(dev, spec->comps);
6564}
6565
6566static const struct component_master_ops comp_master_ops = {
6567 .bind = comp_bind,
6568 .unbind = comp_unbind,
6569};
6570
6571static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6572 struct snd_pcm_substream *sub, int action)
6573{
6574 struct alc_spec *spec = cdc->spec;
6575 int i;
6576
6577 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6578 if (spec->comps[i].dev)
6579 spec->comps[i].playback_hook(spec->comps[i].dev, action);
6580 }
6581}
6582
6583static void alc287_legion_16achg6_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6584 struct snd_pcm_substream *sub, int action)
6585{
6586 struct alc_spec *spec = cdc->spec;
6587 unsigned int rx_slot;
6588 int i;
6589
6590 switch (action) {
6591 case HDA_GEN_PCM_ACT_PREPARE:
6592 rx_slot = 0;
6593 i = find_comp_by_dev_name(spec, "i2c-CLSA0100:00-cs35l41-hda.0");
6594 if (i >= 0)
6595 spec->comps[i].set_channel_map(spec->comps[i].dev, 0, NULL, 1, &rx_slot);
6596
6597 rx_slot = 1;
6598 i = find_comp_by_dev_name(spec, "i2c-CLSA0100:00-cs35l41-hda.1");
6599 if (i >= 0)
6600 spec->comps[i].set_channel_map(spec->comps[i].dev, 0, NULL, 1, &rx_slot);
6601 break;
6602 }
6603
6604 comp_generic_playback_hook(hinfo, cdc, sub, action);
6605}
6606
6607static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6608 int action)
6609{
6610 struct device *dev = hda_codec_dev(cdc);
6611 struct alc_spec *spec = cdc->spec;
6612 int ret;
6613
6614 switch (action) {
6615 case HDA_FIXUP_ACT_PRE_PROBE:
6616 component_match_add(dev, &spec->match, comp_match_dev_name,
6617 "i2c-CLSA0100:00-cs35l41-hda.0");
6618 component_match_add(dev, &spec->match, comp_match_dev_name,
6619 "i2c-CLSA0100:00-cs35l41-hda.1");
6620 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6621 if (ret)
6622 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6623 else
6624 spec->gen.pcm_playback_hook = alc287_legion_16achg6_playback_hook;
6625 break;
6626 }
6627}
6628
bbf8ff6b
TB
6629/* for alc295_fixup_hp_top_speakers */
6630#include "hp_x360_helper.c"
6631
26928ca1
TI
6632/* for alc285_fixup_ideapad_s740_coef() */
6633#include "ideapad_s740_helper.c"
6634
619764cc
WS
6635static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6636 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6637 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6638 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6639 {}
6640};
6641
6642static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6643 const struct hda_fixup *fix,
6644 int action)
dd6dd6e3
WS
6645{
6646 /*
619764cc
WS
6647 * A certain other OS sets these coeffs to different values. On at least
6648 * one TongFang barebone these settings might survive even a cold
6649 * reboot. So to restore a clean slate the values are explicitly reset
6650 * to default here. Without this, the external microphone is always in a
6651 * plugged-in state, while the internal microphone is always in an
6652 * unplugged state, breaking the ability to use the internal microphone.
6653 */
6654 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
dd6dd6e3
WS
6655}
6656
174a7fb3
WS
6657static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6658 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6659 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6660 WRITE_COEF(0x49, 0x0149),
6661 {}
6662};
6663
6664static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6665 const struct hda_fixup *fix,
6666 int action)
6667{
6668 /*
6669 * The audio jack input and output is not detected on the ASRock NUC Box
6670 * 1100 series when cold booting without this fix. Warm rebooting from a
6671 * certain other OS makes the audio functional, as COEF settings are
6672 * preserved in this case. This fix sets these altered COEF values as
6673 * the default.
6674 */
6675 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6676}
6677
edca7cc4
WS
6678static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6679 const struct hda_fixup *fix,
6680 int action)
6681{
6682 /*
6683 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6684 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6685 * needs an additional quirk for sound working after suspend and resume.
6686 */
6687 if (codec->core.vendor_id == 0x10ec0256) {
6688 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6689 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6690 } else {
6691 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6692 }
6693}
6694
1d045db9 6695enum {
f73bbf63 6696 ALC269_FIXUP_GPIO2,
1d045db9
TI
6697 ALC269_FIXUP_SONY_VAIO,
6698 ALC275_FIXUP_SONY_VAIO_GPIO2,
6699 ALC269_FIXUP_DELL_M101Z,
6700 ALC269_FIXUP_SKU_IGNORE,
6701 ALC269_FIXUP_ASUS_G73JW,
6702 ALC269_FIXUP_LENOVO_EAPD,
6703 ALC275_FIXUP_SONY_HWEQ,
e9bd7d5c 6704 ALC275_FIXUP_SONY_DISABLE_AAMIX,
1d045db9 6705 ALC271_FIXUP_DMIC,
017f2a10 6706 ALC269_FIXUP_PCM_44K,
adabb3ec 6707 ALC269_FIXUP_STEREO_DMIC,
7c478f03 6708 ALC269_FIXUP_HEADSET_MIC,
24519911
TI
6709 ALC269_FIXUP_QUANTA_MUTE,
6710 ALC269_FIXUP_LIFEBOOK,
2041d564 6711 ALC269_FIXUP_LIFEBOOK_EXTMIC,
cc7016ab 6712 ALC269_FIXUP_LIFEBOOK_HP_PIN,
4df3fd17 6713 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
fdcc968a 6714 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
a4297b5d
TI
6715 ALC269_FIXUP_AMIC,
6716 ALC269_FIXUP_DMIC,
6717 ALC269VB_FIXUP_AMIC,
6718 ALC269VB_FIXUP_DMIC,
08fb0d0e 6719 ALC269_FIXUP_HP_MUTE_LED,
d06ac143 6720 ALC269_FIXUP_HP_MUTE_LED_MIC1,
08fb0d0e 6721 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7f783bd5 6722 ALC269_FIXUP_HP_MUTE_LED_MIC3,
9f5c6faf 6723 ALC269_FIXUP_HP_GPIO_LED,
9c5dc3bf
KY
6724 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6725 ALC269_FIXUP_HP_LINE1_MIC1_LED,
693b613d 6726 ALC269_FIXUP_INV_DMIC,
108cc108 6727 ALC269_FIXUP_LENOVO_DOCK,
b590b38c 6728 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
9b745ab8 6729 ALC269_FIXUP_NO_SHUTUP,
88cfcf86 6730 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
108cc108 6731 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
73bdd597
DH
6732 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6733 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
338cae56 6734 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
fcc6c877 6735 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
73bdd597
DH
6736 ALC269_FIXUP_HEADSET_MODE,
6737 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7819717b 6738 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
d240d1dc
DH
6739 ALC269_FIXUP_ASUS_X101_FUNC,
6740 ALC269_FIXUP_ASUS_X101_VERB,
6741 ALC269_FIXUP_ASUS_X101,
08a978db
DR
6742 ALC271_FIXUP_AMIC_MIC2,
6743 ALC271_FIXUP_HP_GATE_MIC_JACK,
b1e8972e 6744 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
42397004 6745 ALC269_FIXUP_ACER_AC700,
3e0d611b 6746 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
2cede303 6747 ALC269VB_FIXUP_ASUS_ZENBOOK,
23870831 6748 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
8e35cd4a 6749 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
02b504d9 6750 ALC269VB_FIXUP_ORDISSIMO_EVE2,
cd217a63 6751 ALC283_FIXUP_CHROME_BOOK,
0202e99c 6752 ALC283_FIXUP_SENSE_COMBO_JACK,
7bba2157 6753 ALC282_FIXUP_ASUS_TX300,
1bb3e062 6754 ALC283_FIXUP_INT_MIC,
338cae56 6755 ALC290_FIXUP_MONO_SPEAKERS,
0f4881dc
DH
6756 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6757 ALC290_FIXUP_SUBWOOFER,
6758 ALC290_FIXUP_SUBWOOFER_HSJACK,
b67ae3f1 6759 ALC269_FIXUP_THINKPAD_ACPI,
56f27013 6760 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5824ce8d 6761 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
615966ad 6762 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9a22a8f5 6763 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
31278997 6764 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9a22a8f5 6765 ALC255_FIXUP_HEADSET_MODE,
31278997 6766 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
a22aa26f 6767 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
1c37c223 6768 ALC292_FIXUP_TPT440_DOCK,
9a811230 6769 ALC292_FIXUP_TPT440,
abaa2274 6770 ALC283_FIXUP_HEADSET_MIC,
b3802783 6771 ALC255_FIXUP_MIC_MUTE_LED,
1a22e775 6772 ALC282_FIXUP_ASPIRE_V5_PINS,
c8426b27 6773 ALC269VB_FIXUP_ASPIRE_E1_COEF,
7a5255f1 6774 ALC280_FIXUP_HP_GPIO4,
eaa8e5ef 6775 ALC286_FIXUP_HP_GPIO_LED,
33f4acd3 6776 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
b4b33f9d 6777 ALC280_FIXUP_HP_DOCK_PINS,
04d5466a 6778 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
98973f2f 6779 ALC280_FIXUP_HP_9480M,
c3bb2b52 6780 ALC245_FIXUP_HP_X360_AMP,
d94befbb 6781 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
e1e62b98
KY
6782 ALC288_FIXUP_DELL_HEADSET_MODE,
6783 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
831bfdf9
HW
6784 ALC288_FIXUP_DELL_XPS_13,
6785 ALC288_FIXUP_DISABLE_AAMIX,
5fab5829 6786 ALC292_FIXUP_DELL_E7X_AAMIX,
8b99aba7
TI
6787 ALC292_FIXUP_DELL_E7X,
6788 ALC292_FIXUP_DISABLE_AAMIX,
c04017ea 6789 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
54324221 6790 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
977e6276 6791 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
2f726aec 6792 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6ed1131f 6793 ALC275_FIXUP_DELL_XPS,
23adc192 6794 ALC293_FIXUP_LENOVO_SPK_NOISE,
3694cb29 6795 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
3b43b71f 6796 ALC255_FIXUP_DELL_SPK_NOISE,
d1dd4211 6797 ALC225_FIXUP_DISABLE_MIC_VREF,
2ae95577 6798 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
e312a869 6799 ALC295_FIXUP_DISABLE_DAC3,
d2cd795c 6800 ALC285_FIXUP_SPEAKER2_TO_DAC1,
f883982d 6801 ALC280_FIXUP_HP_HEADSET_MIC,
e549d190 6802 ALC221_FIXUP_HP_FRONT_MIC,
c636b95e 6803 ALC292_FIXUP_TPT460,
dd9aa335 6804 ALC298_FIXUP_SPK_VOLUME,
f86de9b1 6805 ALC298_FIXUP_LENOVO_SPK_VOLUME,
fd06c77e 6806 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
823ff161 6807 ALC269_FIXUP_ATIV_BOOK_8,
9eb5d0e6 6808 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
c1732ede
CC
6809 ALC256_FIXUP_ASUS_HEADSET_MODE,
6810 ALC256_FIXUP_ASUS_MIC,
eeed4cd1 6811 ALC256_FIXUP_ASUS_AIO_GPIO2,
216d7aeb
CC
6812 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6813 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
ca169cc2 6814 ALC233_FIXUP_LENOVO_MULTI_CODECS,
ea5c7eba 6815 ALC233_FIXUP_ACER_HEADSET_MIC,
f33f79f3 6816 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5f364135 6817 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
52e4e368 6818 ALC225_FIXUP_S3_POP_NOISE,
b84e8436 6819 ALC700_FIXUP_INTEL_REFERENCE,
92266651
KY
6820 ALC274_FIXUP_DELL_BIND_DACS,
6821 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
399c01aa 6822 ALC298_FIXUP_TPT470_DOCK_FIX,
61fcf8ec 6823 ALC298_FIXUP_TPT470_DOCK,
ae104a21 6824 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
f0ba9d69 6825 ALC255_FIXUP_DELL_HEADSET_MIC,
0fbf21c3 6826 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
a2ef03fe 6827 ALC298_FIXUP_HUAWEI_MBX_STEREO,
bbf8ff6b 6828 ALC295_FIXUP_HP_X360,
8a328ac1 6829 ALC221_FIXUP_HP_HEADSET_MIC,
c4cfcf6f 6830 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
e8ed64b0 6831 ALC295_FIXUP_HP_AUTO_MUTE,
33aaebd4 6832 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
d8ae458e 6833 ALC294_FIXUP_ASUS_MIC,
4e051106
JHP
6834 ALC294_FIXUP_ASUS_HEADSET_MIC,
6835 ALC294_FIXUP_ASUS_SPK,
89e3a568 6836 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
c8c6ee61 6837 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
cbc05fd6 6838 ALC255_FIXUP_ACER_HEADSET_MIC,
10f5b1b8 6839 ALC295_FIXUP_CHROME_BOOK,
8983eb60 6840 ALC225_FIXUP_HEADSET_JACK,
136824ef
KY
6841 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6842 ALC225_FIXUP_WYSE_AUTO_MUTE,
6843 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
667a8f73 6844 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
8c8967a7 6845 ALC256_FIXUP_ASUS_HEADSET_MIC,
e1037354 6846 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
e2a829b3 6847 ALC299_FIXUP_PREDATOR_SPK,
bd9c10bc 6848 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
e79c2269
KY
6849 ALC289_FIXUP_DELL_SPK2,
6850 ALC289_FIXUP_DUAL_SPK,
48e01504
CC
6851 ALC294_FIXUP_SPK2_TO_DAC1,
6852 ALC294_FIXUP_ASUS_DUAL_SPK,
6a6660d0 6853 ALC285_FIXUP_THINKPAD_X1_GEN7,
76f7dec0 6854 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8b33a134 6855 ALC294_FIXUP_ASUS_HPE,
1b94e59d 6856 ALC294_FIXUP_ASUS_COEF_1B,
c3cdf189
LJ
6857 ALC294_FIXUP_ASUS_GX502_HP,
6858 ALC294_FIXUP_ASUS_GX502_PINS,
6859 ALC294_FIXUP_ASUS_GX502_VERBS,
c1b55029
DC
6860 ALC294_FIXUP_ASUS_GU502_HP,
6861 ALC294_FIXUP_ASUS_GU502_PINS,
6862 ALC294_FIXUP_ASUS_GU502_VERBS,
f5a88b0a 6863 ALC285_FIXUP_HP_GPIO_LED,
431e76c3 6864 ALC285_FIXUP_HP_MUTE_LED,
e7d66cf7 6865 ALC236_FIXUP_HP_GPIO_LED,
24164f43 6866 ALC236_FIXUP_HP_MUTE_LED,
75b62ab6 6867 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
14425f1f 6868 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
9e43342b 6869 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8eae7e9b 6870 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6e15d126 6871 ALC269VC_FIXUP_ACER_HEADSET_MIC,
781c90c0 6872 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
293a92c1 6873 ALC289_FIXUP_ASUS_GA401,
4b43d05a 6874 ALC289_FIXUP_ASUS_GA502,
f50a121d 6875 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
56496253 6876 ALC285_FIXUP_HP_GPIO_AMP_INIT,
f1ec5be1
HC
6877 ALC269_FIXUP_CZC_B20,
6878 ALC269_FIXUP_CZC_TMI,
6879 ALC269_FIXUP_CZC_L101,
6880 ALC269_FIXUP_LEMOTE_A1802,
6881 ALC269_FIXUP_LEMOTE_A190X,
e2d2fded 6882 ALC256_FIXUP_INTEL_NUC8_RUGGED,
d1ee66c5
PC
6883 ALC233_FIXUP_INTEL_NUC8_DMIC,
6884 ALC233_FIXUP_INTEL_NUC8_BOOST,
73e7161e 6885 ALC256_FIXUP_INTEL_NUC10,
fc19d559 6886 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
13468bfa 6887 ALC274_FIXUP_HP_MIC,
8a8de09c 6888 ALC274_FIXUP_HP_HEADSET_MIC,
622464c8 6889 ALC274_FIXUP_HP_ENVY_GPIO,
ef9ce66f 6890 ALC256_FIXUP_ASUS_HPE,
446b8185 6891 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
a0ccbc53 6892 ALC287_FIXUP_HP_GPIO_LED,
9e885770 6893 ALC256_FIXUP_HP_HEADSET_MIC,
5fc462c3 6894 ALC245_FIXUP_HP_GPIO_LED,
92666d45 6895 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
34cdf405 6896 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
495dc763 6897 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
d0e18561 6898 ALC256_FIXUP_ACER_HEADSET_MIC,
26928ca1 6899 ALC285_FIXUP_IDEAPAD_S740_COEF,
bd15b155 6900 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
8eedd3a7 6901 ALC295_FIXUP_ASUS_DACS,
5d84b531 6902 ALC295_FIXUP_HP_OMEN,
f2be77fe 6903 ALC285_FIXUP_HP_SPECTRE_X360,
9ebaef05 6904 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
29c8f40b 6905 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
57c9e21a 6906 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
8903376d 6907 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
ad7cc2d4
CB
6908 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6909 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6910 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
dd6dd6e3 6911 ALC287_FIXUP_13S_GEN2_SPEAKERS,
619764cc 6912 ALC256_FIXUP_SET_COEF_DEFAULTS,
1278cc5a 6913 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
174a7fb3 6914 ALC233_FIXUP_NO_AUDIO_JACK,
edca7cc4 6915 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
8f4c9042
BF
6916 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
6917 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
d3dca026 6918 ALC287_FIXUP_LEGION_16ACHG6,
f1d4e28b
KY
6919};
6920
1727a771 6921static const struct hda_fixup alc269_fixups[] = {
f73bbf63
KHF
6922 [ALC269_FIXUP_GPIO2] = {
6923 .type = HDA_FIXUP_FUNC,
6924 .v.func = alc_fixup_gpio2,
6925 },
1d045db9 6926 [ALC269_FIXUP_SONY_VAIO] = {
fd108215
TI
6927 .type = HDA_FIXUP_PINCTLS,
6928 .v.pins = (const struct hda_pintbl[]) {
6929 {0x19, PIN_VREFGRD},
1d045db9
TI
6930 {}
6931 }
f1d4e28b 6932 },
1d045db9 6933 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
ae065f1c
TI
6934 .type = HDA_FIXUP_FUNC,
6935 .v.func = alc275_fixup_gpio4_off,
1d045db9
TI
6936 .chained = true,
6937 .chain_id = ALC269_FIXUP_SONY_VAIO
6938 },
6939 [ALC269_FIXUP_DELL_M101Z] = {
1727a771 6940 .type = HDA_FIXUP_VERBS,
1d045db9
TI
6941 .v.verbs = (const struct hda_verb[]) {
6942 /* Enables internal speaker */
6943 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6944 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6945 {}
6946 }
6947 },
6948 [ALC269_FIXUP_SKU_IGNORE] = {
1727a771 6949 .type = HDA_FIXUP_FUNC,
23d30f28 6950 .v.func = alc_fixup_sku_ignore,
1d045db9
TI
6951 },
6952 [ALC269_FIXUP_ASUS_G73JW] = {
1727a771
TI
6953 .type = HDA_FIXUP_PINS,
6954 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
6955 { 0x17, 0x99130111 }, /* subwoofer */
6956 { }
6957 }
6958 },
6959 [ALC269_FIXUP_LENOVO_EAPD] = {
1727a771 6960 .type = HDA_FIXUP_VERBS,
1d045db9
TI
6961 .v.verbs = (const struct hda_verb[]) {
6962 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6963 {}
6964 }
6965 },
6966 [ALC275_FIXUP_SONY_HWEQ] = {
1727a771 6967 .type = HDA_FIXUP_FUNC,
1d045db9
TI
6968 .v.func = alc269_fixup_hweq,
6969 .chained = true,
6970 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6971 },
e9bd7d5c
TI
6972 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6973 .type = HDA_FIXUP_FUNC,
6974 .v.func = alc_fixup_disable_aamix,
6975 .chained = true,
6976 .chain_id = ALC269_FIXUP_SONY_VAIO
6977 },
1d045db9 6978 [ALC271_FIXUP_DMIC] = {
1727a771 6979 .type = HDA_FIXUP_FUNC,
1d045db9 6980 .v.func = alc271_fixup_dmic,
f1d4e28b 6981 },
017f2a10 6982 [ALC269_FIXUP_PCM_44K] = {
1727a771 6983 .type = HDA_FIXUP_FUNC,
017f2a10 6984 .v.func = alc269_fixup_pcm_44k,
012e7eb1
DH
6985 .chained = true,
6986 .chain_id = ALC269_FIXUP_QUANTA_MUTE
017f2a10 6987 },
adabb3ec 6988 [ALC269_FIXUP_STEREO_DMIC] = {
1727a771 6989 .type = HDA_FIXUP_FUNC,
adabb3ec
TI
6990 .v.func = alc269_fixup_stereo_dmic,
6991 },
7c478f03
DH
6992 [ALC269_FIXUP_HEADSET_MIC] = {
6993 .type = HDA_FIXUP_FUNC,
6994 .v.func = alc269_fixup_headset_mic,
6995 },
24519911 6996 [ALC269_FIXUP_QUANTA_MUTE] = {
1727a771 6997 .type = HDA_FIXUP_FUNC,
24519911
TI
6998 .v.func = alc269_fixup_quanta_mute,
6999 },
7000 [ALC269_FIXUP_LIFEBOOK] = {
1727a771
TI
7001 .type = HDA_FIXUP_PINS,
7002 .v.pins = (const struct hda_pintbl[]) {
24519911
TI
7003 { 0x1a, 0x2101103f }, /* dock line-out */
7004 { 0x1b, 0x23a11040 }, /* dock mic-in */
7005 { }
7006 },
7007 .chained = true,
7008 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7009 },
2041d564
DH
7010 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7011 .type = HDA_FIXUP_PINS,
7012 .v.pins = (const struct hda_pintbl[]) {
7013 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7014 { }
7015 },
7016 },
cc7016ab
TI
7017 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7018 .type = HDA_FIXUP_PINS,
7019 .v.pins = (const struct hda_pintbl[]) {
7020 { 0x21, 0x0221102f }, /* HP out */
7021 { }
7022 },
7023 },
4df3fd17
TI
7024 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7025 .type = HDA_FIXUP_FUNC,
7026 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7027 },
fdcc968a
JMG
7028 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7029 .type = HDA_FIXUP_FUNC,
7030 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7031 },
a4297b5d 7032 [ALC269_FIXUP_AMIC] = {
1727a771
TI
7033 .type = HDA_FIXUP_PINS,
7034 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7035 { 0x14, 0x99130110 }, /* speaker */
7036 { 0x15, 0x0121401f }, /* HP out */
7037 { 0x18, 0x01a19c20 }, /* mic */
7038 { 0x19, 0x99a3092f }, /* int-mic */
7039 { }
7040 },
7041 },
7042 [ALC269_FIXUP_DMIC] = {
1727a771
TI
7043 .type = HDA_FIXUP_PINS,
7044 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7045 { 0x12, 0x99a3092f }, /* int-mic */
7046 { 0x14, 0x99130110 }, /* speaker */
7047 { 0x15, 0x0121401f }, /* HP out */
7048 { 0x18, 0x01a19c20 }, /* mic */
7049 { }
7050 },
7051 },
7052 [ALC269VB_FIXUP_AMIC] = {
1727a771
TI
7053 .type = HDA_FIXUP_PINS,
7054 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7055 { 0x14, 0x99130110 }, /* speaker */
7056 { 0x18, 0x01a19c20 }, /* mic */
7057 { 0x19, 0x99a3092f }, /* int-mic */
7058 { 0x21, 0x0121401f }, /* HP out */
7059 { }
7060 },
7061 },
2267ea97 7062 [ALC269VB_FIXUP_DMIC] = {
1727a771
TI
7063 .type = HDA_FIXUP_PINS,
7064 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7065 { 0x12, 0x99a3092f }, /* int-mic */
7066 { 0x14, 0x99130110 }, /* speaker */
7067 { 0x18, 0x01a19c20 }, /* mic */
7068 { 0x21, 0x0121401f }, /* HP out */
7069 { }
7070 },
7071 },
08fb0d0e 7072 [ALC269_FIXUP_HP_MUTE_LED] = {
1727a771 7073 .type = HDA_FIXUP_FUNC,
08fb0d0e 7074 .v.func = alc269_fixup_hp_mute_led,
6d3cd5d4 7075 },
d06ac143
DH
7076 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7077 .type = HDA_FIXUP_FUNC,
7078 .v.func = alc269_fixup_hp_mute_led_mic1,
7079 },
08fb0d0e 7080 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
1727a771 7081 .type = HDA_FIXUP_FUNC,
08fb0d0e 7082 .v.func = alc269_fixup_hp_mute_led_mic2,
420b0feb 7083 },
7f783bd5
TB
7084 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7085 .type = HDA_FIXUP_FUNC,
7086 .v.func = alc269_fixup_hp_mute_led_mic3,
e8ed64b0
GKK
7087 .chained = true,
7088 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7f783bd5 7089 },
9f5c6faf
TI
7090 [ALC269_FIXUP_HP_GPIO_LED] = {
7091 .type = HDA_FIXUP_FUNC,
7092 .v.func = alc269_fixup_hp_gpio_led,
7093 },
9c5dc3bf
KY
7094 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7095 .type = HDA_FIXUP_FUNC,
7096 .v.func = alc269_fixup_hp_gpio_mic1_led,
7097 },
7098 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7099 .type = HDA_FIXUP_FUNC,
7100 .v.func = alc269_fixup_hp_line1_mic1_led,
7101 },
693b613d 7102 [ALC269_FIXUP_INV_DMIC] = {
1727a771 7103 .type = HDA_FIXUP_FUNC,
9d36a7dc 7104 .v.func = alc_fixup_inv_dmic,
693b613d 7105 },
9b745ab8
TI
7106 [ALC269_FIXUP_NO_SHUTUP] = {
7107 .type = HDA_FIXUP_FUNC,
7108 .v.func = alc_fixup_no_shutup,
7109 },
108cc108 7110 [ALC269_FIXUP_LENOVO_DOCK] = {
1727a771
TI
7111 .type = HDA_FIXUP_PINS,
7112 .v.pins = (const struct hda_pintbl[]) {
108cc108
DH
7113 { 0x19, 0x23a11040 }, /* dock mic */
7114 { 0x1b, 0x2121103f }, /* dock headphone */
7115 { }
7116 },
7117 .chained = true,
7118 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7119 },
b590b38c
TI
7120 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7121 .type = HDA_FIXUP_FUNC,
7122 .v.func = alc269_fixup_limit_int_mic_boost,
7123 .chained = true,
7124 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7125 },
108cc108 7126 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
1727a771 7127 .type = HDA_FIXUP_FUNC,
108cc108 7128 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
52129000
DH
7129 .chained = true,
7130 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
108cc108 7131 },
73bdd597
DH
7132 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7133 .type = HDA_FIXUP_PINS,
7134 .v.pins = (const struct hda_pintbl[]) {
7135 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7136 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7137 { }
7138 },
7139 .chained = true,
7140 .chain_id = ALC269_FIXUP_HEADSET_MODE
7141 },
7142 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7143 .type = HDA_FIXUP_PINS,
7144 .v.pins = (const struct hda_pintbl[]) {
7145 { 0x16, 0x21014020 }, /* dock line out */
7146 { 0x19, 0x21a19030 }, /* dock mic */
7147 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7148 { }
7149 },
7150 .chained = true,
7151 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7152 },
338cae56
DH
7153 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7154 .type = HDA_FIXUP_PINS,
7155 .v.pins = (const struct hda_pintbl[]) {
7156 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7157 { }
7158 },
7159 .chained = true,
7160 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7161 },
fcc6c877
KY
7162 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7163 .type = HDA_FIXUP_PINS,
7164 .v.pins = (const struct hda_pintbl[]) {
7165 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7166 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7167 { }
7168 },
7169 .chained = true,
7170 .chain_id = ALC269_FIXUP_HEADSET_MODE
7171 },
73bdd597
DH
7172 [ALC269_FIXUP_HEADSET_MODE] = {
7173 .type = HDA_FIXUP_FUNC,
7174 .v.func = alc_fixup_headset_mode,
6676f308 7175 .chained = true,
b3802783 7176 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
73bdd597
DH
7177 },
7178 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7179 .type = HDA_FIXUP_FUNC,
7180 .v.func = alc_fixup_headset_mode_no_hp_mic,
7181 },
7819717b
TI
7182 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7183 .type = HDA_FIXUP_PINS,
7184 .v.pins = (const struct hda_pintbl[]) {
7185 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7186 { }
7187 },
7188 .chained = true,
7189 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7190 },
88cfcf86
DH
7191 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7192 .type = HDA_FIXUP_PINS,
7193 .v.pins = (const struct hda_pintbl[]) {
7194 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7195 { }
7196 },
fbc78ad6
DH
7197 .chained = true,
7198 .chain_id = ALC269_FIXUP_HEADSET_MIC
88cfcf86 7199 },
0fbf21c3 7200 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8ac51bbc
AB
7201 .type = HDA_FIXUP_PINS,
7202 .v.pins = (const struct hda_pintbl[]) {
7203 {0x12, 0x90a60130},
7204 {0x13, 0x40000000},
7205 {0x14, 0x90170110},
7206 {0x18, 0x411111f0},
7207 {0x19, 0x04a11040},
7208 {0x1a, 0x411111f0},
7209 {0x1b, 0x90170112},
7210 {0x1d, 0x40759a05},
7211 {0x1e, 0x411111f0},
7212 {0x21, 0x04211020},
7213 { }
7214 },
e2744fd7
AB
7215 .chained = true,
7216 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8ac51bbc 7217 },
a2ef03fe
TE
7218 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7219 .type = HDA_FIXUP_FUNC,
7220 .v.func = alc298_fixup_huawei_mbx_stereo,
7221 .chained = true,
7222 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7223 },
d240d1dc
DH
7224 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7225 .type = HDA_FIXUP_FUNC,
7226 .v.func = alc269_fixup_x101_headset_mic,
7227 },
7228 [ALC269_FIXUP_ASUS_X101_VERB] = {
7229 .type = HDA_FIXUP_VERBS,
7230 .v.verbs = (const struct hda_verb[]) {
7231 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7232 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7233 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7234 { }
7235 },
7236 .chained = true,
7237 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7238 },
7239 [ALC269_FIXUP_ASUS_X101] = {
7240 .type = HDA_FIXUP_PINS,
7241 .v.pins = (const struct hda_pintbl[]) {
7242 { 0x18, 0x04a1182c }, /* Headset mic */
7243 { }
7244 },
7245 .chained = true,
7246 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7247 },
08a978db 7248 [ALC271_FIXUP_AMIC_MIC2] = {
1727a771
TI
7249 .type = HDA_FIXUP_PINS,
7250 .v.pins = (const struct hda_pintbl[]) {
08a978db
DR
7251 { 0x14, 0x99130110 }, /* speaker */
7252 { 0x19, 0x01a19c20 }, /* mic */
7253 { 0x1b, 0x99a7012f }, /* int-mic */
7254 { 0x21, 0x0121401f }, /* HP out */
7255 { }
7256 },
7257 },
7258 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
1727a771 7259 .type = HDA_FIXUP_FUNC,
08a978db
DR
7260 .v.func = alc271_hp_gate_mic_jack,
7261 .chained = true,
7262 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7263 },
b1e8972e
OR
7264 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7265 .type = HDA_FIXUP_FUNC,
7266 .v.func = alc269_fixup_limit_int_mic_boost,
7267 .chained = true,
7268 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7269 },
42397004
DR
7270 [ALC269_FIXUP_ACER_AC700] = {
7271 .type = HDA_FIXUP_PINS,
7272 .v.pins = (const struct hda_pintbl[]) {
7273 { 0x12, 0x99a3092f }, /* int-mic */
7274 { 0x14, 0x99130110 }, /* speaker */
7275 { 0x18, 0x03a11c20 }, /* mic */
7276 { 0x1e, 0x0346101e }, /* SPDIF1 */
7277 { 0x21, 0x0321101f }, /* HP out */
7278 { }
7279 },
7280 .chained = true,
7281 .chain_id = ALC271_FIXUP_DMIC,
7282 },
3e0d611b
DH
7283 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7284 .type = HDA_FIXUP_FUNC,
7285 .v.func = alc269_fixup_limit_int_mic_boost,
2793769f
DH
7286 .chained = true,
7287 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
3e0d611b 7288 },
2cede303
OR
7289 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7290 .type = HDA_FIXUP_FUNC,
7291 .v.func = alc269_fixup_limit_int_mic_boost,
7292 .chained = true,
7293 .chain_id = ALC269VB_FIXUP_DMIC,
7294 },
23870831
TI
7295 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7296 .type = HDA_FIXUP_VERBS,
7297 .v.verbs = (const struct hda_verb[]) {
7298 /* class-D output amp +5dB */
7299 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7300 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7301 {}
7302 },
7303 .chained = true,
7304 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7305 },
8e35cd4a
DH
7306 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7307 .type = HDA_FIXUP_FUNC,
7308 .v.func = alc269_fixup_limit_int_mic_boost,
7309 .chained = true,
7310 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7311 },
02b504d9
AA
7312 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7313 .type = HDA_FIXUP_PINS,
7314 .v.pins = (const struct hda_pintbl[]) {
7315 { 0x12, 0x99a3092f }, /* int-mic */
7316 { 0x18, 0x03a11d20 }, /* mic */
7317 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7318 { }
7319 },
7320 },
cd217a63
KY
7321 [ALC283_FIXUP_CHROME_BOOK] = {
7322 .type = HDA_FIXUP_FUNC,
7323 .v.func = alc283_fixup_chromebook,
7324 },
0202e99c
KY
7325 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7326 .type = HDA_FIXUP_FUNC,
7327 .v.func = alc283_fixup_sense_combo_jack,
7328 .chained = true,
7329 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7330 },
7bba2157
TI
7331 [ALC282_FIXUP_ASUS_TX300] = {
7332 .type = HDA_FIXUP_FUNC,
7333 .v.func = alc282_fixup_asus_tx300,
7334 },
1bb3e062
KY
7335 [ALC283_FIXUP_INT_MIC] = {
7336 .type = HDA_FIXUP_VERBS,
7337 .v.verbs = (const struct hda_verb[]) {
7338 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7339 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7340 { }
7341 },
7342 .chained = true,
7343 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7344 },
0f4881dc
DH
7345 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7346 .type = HDA_FIXUP_PINS,
7347 .v.pins = (const struct hda_pintbl[]) {
7348 { 0x17, 0x90170112 }, /* subwoofer */
7349 { }
7350 },
7351 .chained = true,
7352 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7353 },
7354 [ALC290_FIXUP_SUBWOOFER] = {
7355 .type = HDA_FIXUP_PINS,
7356 .v.pins = (const struct hda_pintbl[]) {
7357 { 0x17, 0x90170112 }, /* subwoofer */
7358 { }
7359 },
7360 .chained = true,
7361 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7362 },
338cae56
DH
7363 [ALC290_FIXUP_MONO_SPEAKERS] = {
7364 .type = HDA_FIXUP_FUNC,
7365 .v.func = alc290_fixup_mono_speakers,
0f4881dc
DH
7366 },
7367 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7368 .type = HDA_FIXUP_FUNC,
7369 .v.func = alc290_fixup_mono_speakers,
338cae56
DH
7370 .chained = true,
7371 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7372 },
b67ae3f1
DH
7373 [ALC269_FIXUP_THINKPAD_ACPI] = {
7374 .type = HDA_FIXUP_FUNC,
d5a6cabf 7375 .v.func = alc_fixup_thinkpad_acpi,
09da111a
TI
7376 .chained = true,
7377 .chain_id = ALC269_FIXUP_SKU_IGNORE,
b67ae3f1 7378 },
56f27013
DH
7379 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7380 .type = HDA_FIXUP_FUNC,
7381 .v.func = alc_fixup_inv_dmic,
7382 .chained = true,
7383 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7384 },
5824ce8d 7385 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
17d30460
HW
7386 .type = HDA_FIXUP_PINS,
7387 .v.pins = (const struct hda_pintbl[]) {
7388 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7389 { }
5824ce8d
CC
7390 },
7391 .chained = true,
17d30460 7392 .chain_id = ALC255_FIXUP_HEADSET_MODE
5824ce8d 7393 },
615966ad
CC
7394 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7395 .type = HDA_FIXUP_PINS,
7396 .v.pins = (const struct hda_pintbl[]) {
7397 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7398 { }
7399 },
7400 .chained = true,
7401 .chain_id = ALC255_FIXUP_HEADSET_MODE
7402 },
9a22a8f5
KY
7403 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7404 .type = HDA_FIXUP_PINS,
7405 .v.pins = (const struct hda_pintbl[]) {
7406 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7407 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7408 { }
7409 },
7410 .chained = true,
7411 .chain_id = ALC255_FIXUP_HEADSET_MODE
7412 },
31278997
KY
7413 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7414 .type = HDA_FIXUP_PINS,
7415 .v.pins = (const struct hda_pintbl[]) {
7416 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7417 { }
7418 },
7419 .chained = true,
7420 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7421 },
9a22a8f5
KY
7422 [ALC255_FIXUP_HEADSET_MODE] = {
7423 .type = HDA_FIXUP_FUNC,
7424 .v.func = alc_fixup_headset_mode_alc255,
4a83d42a 7425 .chained = true,
b3802783 7426 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
9a22a8f5 7427 },
31278997
KY
7428 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7429 .type = HDA_FIXUP_FUNC,
7430 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7431 },
a22aa26f
KY
7432 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7433 .type = HDA_FIXUP_PINS,
7434 .v.pins = (const struct hda_pintbl[]) {
7435 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7436 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7437 { }
7438 },
7439 .chained = true,
7440 .chain_id = ALC269_FIXUP_HEADSET_MODE
7441 },
1c37c223 7442 [ALC292_FIXUP_TPT440_DOCK] = {
ec56af67 7443 .type = HDA_FIXUP_FUNC,
7f57d803 7444 .v.func = alc_fixup_tpt440_dock,
1c37c223
TI
7445 .chained = true,
7446 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7447 },
9a811230
TI
7448 [ALC292_FIXUP_TPT440] = {
7449 .type = HDA_FIXUP_FUNC,
157f0b7f 7450 .v.func = alc_fixup_disable_aamix,
9a811230
TI
7451 .chained = true,
7452 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7453 },
abaa2274 7454 [ALC283_FIXUP_HEADSET_MIC] = {
9dc12862
DD
7455 .type = HDA_FIXUP_PINS,
7456 .v.pins = (const struct hda_pintbl[]) {
7457 { 0x19, 0x04a110f0 },
7458 { },
7459 },
7460 },
b3802783 7461 [ALC255_FIXUP_MIC_MUTE_LED] = {
00ef9940 7462 .type = HDA_FIXUP_FUNC,
8a503555 7463 .v.func = alc_fixup_micmute_led,
00ef9940 7464 },
1a22e775
TI
7465 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7466 .type = HDA_FIXUP_PINS,
7467 .v.pins = (const struct hda_pintbl[]) {
7468 { 0x12, 0x90a60130 },
7469 { 0x14, 0x90170110 },
7470 { 0x17, 0x40000008 },
7471 { 0x18, 0x411111f0 },
0420694d 7472 { 0x19, 0x01a1913c },
1a22e775
TI
7473 { 0x1a, 0x411111f0 },
7474 { 0x1b, 0x411111f0 },
7475 { 0x1d, 0x40f89b2d },
7476 { 0x1e, 0x411111f0 },
7477 { 0x21, 0x0321101f },
7478 { },
7479 },
7480 },
c8426b27
TI
7481 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7482 .type = HDA_FIXUP_FUNC,
7483 .v.func = alc269vb_fixup_aspire_e1_coef,
7484 },
7a5255f1
DH
7485 [ALC280_FIXUP_HP_GPIO4] = {
7486 .type = HDA_FIXUP_FUNC,
7487 .v.func = alc280_fixup_hp_gpio4,
7488 },
eaa8e5ef
KY
7489 [ALC286_FIXUP_HP_GPIO_LED] = {
7490 .type = HDA_FIXUP_FUNC,
7491 .v.func = alc286_fixup_hp_gpio_led,
7492 },
33f4acd3
DH
7493 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7494 .type = HDA_FIXUP_FUNC,
7495 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7496 },
b4b33f9d
TC
7497 [ALC280_FIXUP_HP_DOCK_PINS] = {
7498 .type = HDA_FIXUP_PINS,
7499 .v.pins = (const struct hda_pintbl[]) {
7500 { 0x1b, 0x21011020 }, /* line-out */
7501 { 0x1a, 0x01a1903c }, /* headset mic */
7502 { 0x18, 0x2181103f }, /* line-in */
7503 { },
7504 },
7505 .chained = true,
7506 .chain_id = ALC280_FIXUP_HP_GPIO4
7507 },
04d5466a
JK
7508 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7509 .type = HDA_FIXUP_PINS,
7510 .v.pins = (const struct hda_pintbl[]) {
7511 { 0x1b, 0x21011020 }, /* line-out */
7512 { 0x18, 0x2181103f }, /* line-in */
7513 { },
7514 },
7515 .chained = true,
7516 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7517 },
98973f2f
KP
7518 [ALC280_FIXUP_HP_9480M] = {
7519 .type = HDA_FIXUP_FUNC,
7520 .v.func = alc280_fixup_hp_9480m,
7521 },
c3bb2b52
TI
7522 [ALC245_FIXUP_HP_X360_AMP] = {
7523 .type = HDA_FIXUP_FUNC,
7524 .v.func = alc245_fixup_hp_x360_amp,
5fc462c3
JC
7525 .chained = true,
7526 .chain_id = ALC245_FIXUP_HP_GPIO_LED
c3bb2b52 7527 },
e1e62b98
KY
7528 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7529 .type = HDA_FIXUP_FUNC,
7530 .v.func = alc_fixup_headset_mode_dell_alc288,
7531 .chained = true,
b3802783 7532 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
e1e62b98
KY
7533 },
7534 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7535 .type = HDA_FIXUP_PINS,
7536 .v.pins = (const struct hda_pintbl[]) {
7537 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7538 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7539 { }
7540 },
7541 .chained = true,
7542 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7543 },
831bfdf9
HW
7544 [ALC288_FIXUP_DISABLE_AAMIX] = {
7545 .type = HDA_FIXUP_FUNC,
7546 .v.func = alc_fixup_disable_aamix,
7547 .chained = true,
d44a6864 7548 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
831bfdf9
HW
7549 },
7550 [ALC288_FIXUP_DELL_XPS_13] = {
7551 .type = HDA_FIXUP_FUNC,
7552 .v.func = alc_fixup_dell_xps13,
7553 .chained = true,
7554 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7555 },
8b99aba7
TI
7556 [ALC292_FIXUP_DISABLE_AAMIX] = {
7557 .type = HDA_FIXUP_FUNC,
7558 .v.func = alc_fixup_disable_aamix,
831bfdf9
HW
7559 .chained = true,
7560 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8b99aba7 7561 },
c04017ea
DH
7562 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7563 .type = HDA_FIXUP_FUNC,
7564 .v.func = alc_fixup_disable_aamix,
7565 .chained = true,
7566 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7567 },
5fab5829 7568 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8b99aba7
TI
7569 .type = HDA_FIXUP_FUNC,
7570 .v.func = alc_fixup_dell_xps13,
7571 .chained = true,
7572 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7573 },
5fab5829
TI
7574 [ALC292_FIXUP_DELL_E7X] = {
7575 .type = HDA_FIXUP_FUNC,
8a503555 7576 .v.func = alc_fixup_micmute_led,
5fab5829
TI
7577 /* micmute fixup must be applied at last */
7578 .chained_before = true,
7579 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7580 },
54324221
JM
7581 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7582 .type = HDA_FIXUP_PINS,
7583 .v.pins = (const struct hda_pintbl[]) {
7584 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7585 { }
7586 },
7587 .chained_before = true,
7588 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7589 },
977e6276
KY
7590 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7591 .type = HDA_FIXUP_PINS,
7592 .v.pins = (const struct hda_pintbl[]) {
7593 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7594 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7595 { }
7596 },
7597 .chained = true,
7598 .chain_id = ALC269_FIXUP_HEADSET_MODE
7599 },
2f726aec
HW
7600 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7601 .type = HDA_FIXUP_PINS,
7602 .v.pins = (const struct hda_pintbl[]) {
7603 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7604 { }
7605 },
7606 .chained = true,
7607 .chain_id = ALC269_FIXUP_HEADSET_MODE
7608 },
6ed1131f
KY
7609 [ALC275_FIXUP_DELL_XPS] = {
7610 .type = HDA_FIXUP_VERBS,
7611 .v.verbs = (const struct hda_verb[]) {
7612 /* Enables internal speaker */
7613 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7614 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7615 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7616 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7617 {}
7618 }
7619 },
23adc192
HW
7620 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7621 .type = HDA_FIXUP_FUNC,
7622 .v.func = alc_fixup_disable_aamix,
7623 .chained = true,
7624 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7625 },
3694cb29
K
7626 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7627 .type = HDA_FIXUP_FUNC,
7628 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7629 },
d1ee66c5
PC
7630 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7631 .type = HDA_FIXUP_FUNC,
7632 .v.func = alc_fixup_inv_dmic,
7633 .chained = true,
7634 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7635 },
7636 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7637 .type = HDA_FIXUP_FUNC,
7638 .v.func = alc269_fixup_limit_int_mic_boost
7639 },
3b43b71f
KHF
7640 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7641 .type = HDA_FIXUP_FUNC,
7642 .v.func = alc_fixup_disable_aamix,
7643 .chained = true,
7644 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7645 },
d1dd4211
KY
7646 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7647 .type = HDA_FIXUP_FUNC,
7648 .v.func = alc_fixup_disable_mic_vref,
7649 .chained = true,
7650 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7651 },
2ae95577
DH
7652 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7653 .type = HDA_FIXUP_VERBS,
7654 .v.verbs = (const struct hda_verb[]) {
7655 /* Disable pass-through path for FRONT 14h */
7656 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7657 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7658 {}
7659 },
7660 .chained = true,
d1dd4211 7661 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
2ae95577 7662 },
f883982d
TI
7663 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7664 .type = HDA_FIXUP_FUNC,
7665 .v.func = alc_fixup_disable_aamix,
7666 .chained = true,
7667 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7668 },
e549d190
HW
7669 [ALC221_FIXUP_HP_FRONT_MIC] = {
7670 .type = HDA_FIXUP_PINS,
7671 .v.pins = (const struct hda_pintbl[]) {
7672 { 0x19, 0x02a19020 }, /* Front Mic */
7673 { }
7674 },
7675 },
c636b95e
SE
7676 [ALC292_FIXUP_TPT460] = {
7677 .type = HDA_FIXUP_FUNC,
7678 .v.func = alc_fixup_tpt440_dock,
7679 .chained = true,
7680 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7681 },
dd9aa335
HW
7682 [ALC298_FIXUP_SPK_VOLUME] = {
7683 .type = HDA_FIXUP_FUNC,
7684 .v.func = alc298_fixup_speaker_volume,
59ec4b57 7685 .chained = true,
2f726aec 7686 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
dd9aa335 7687 },
f86de9b1
KY
7688 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7689 .type = HDA_FIXUP_FUNC,
7690 .v.func = alc298_fixup_speaker_volume,
7691 },
e312a869
TI
7692 [ALC295_FIXUP_DISABLE_DAC3] = {
7693 .type = HDA_FIXUP_FUNC,
7694 .v.func = alc295_fixup_disable_dac3,
7695 },
d2cd795c
JK
7696 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7697 .type = HDA_FIXUP_FUNC,
7698 .v.func = alc285_fixup_speaker2_to_dac1,
c37c0ab0
HW
7699 .chained = true,
7700 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
d2cd795c 7701 },
fd06c77e
KHF
7702 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7703 .type = HDA_FIXUP_PINS,
7704 .v.pins = (const struct hda_pintbl[]) {
7705 { 0x1b, 0x90170151 },
7706 { }
7707 },
7708 .chained = true,
7709 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7710 },
823ff161
GM
7711 [ALC269_FIXUP_ATIV_BOOK_8] = {
7712 .type = HDA_FIXUP_FUNC,
7713 .v.func = alc_fixup_auto_mute_via_amp,
7714 .chained = true,
7715 .chain_id = ALC269_FIXUP_NO_SHUTUP
7716 },
9eb5d0e6
KY
7717 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7718 .type = HDA_FIXUP_PINS,
7719 .v.pins = (const struct hda_pintbl[]) {
7720 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7721 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7722 { }
7723 },
7724 .chained = true,
7725 .chain_id = ALC269_FIXUP_HEADSET_MODE
7726 },
c1732ede
CC
7727 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7728 .type = HDA_FIXUP_FUNC,
7729 .v.func = alc_fixup_headset_mode,
7730 },
7731 [ALC256_FIXUP_ASUS_MIC] = {
7732 .type = HDA_FIXUP_PINS,
7733 .v.pins = (const struct hda_pintbl[]) {
7734 { 0x13, 0x90a60160 }, /* use as internal mic */
7735 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7736 { }
7737 },
7738 .chained = true,
7739 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7740 },
eeed4cd1 7741 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
ae065f1c
TI
7742 .type = HDA_FIXUP_FUNC,
7743 /* Set up GPIO2 for the speaker amp */
7744 .v.func = alc_fixup_gpio4,
eeed4cd1 7745 },
216d7aeb
CC
7746 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7747 .type = HDA_FIXUP_PINS,
7748 .v.pins = (const struct hda_pintbl[]) {
7749 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7750 { }
7751 },
7752 .chained = true,
7753 .chain_id = ALC269_FIXUP_HEADSET_MIC
7754 },
7755 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7756 .type = HDA_FIXUP_VERBS,
7757 .v.verbs = (const struct hda_verb[]) {
7758 /* Enables internal speaker */
7759 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7760 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7761 {}
7762 },
7763 .chained = true,
7764 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7765 },
ca169cc2
KY
7766 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7767 .type = HDA_FIXUP_FUNC,
7768 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
f73bbf63
KHF
7769 .chained = true,
7770 .chain_id = ALC269_FIXUP_GPIO2
ca169cc2 7771 },
ea5c7eba
JHP
7772 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7773 .type = HDA_FIXUP_VERBS,
7774 .v.verbs = (const struct hda_verb[]) {
7775 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7776 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7777 { }
7778 },
7779 .chained = true,
7780 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7781 },
f33f79f3
HW
7782 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7783 .type = HDA_FIXUP_PINS,
7784 .v.pins = (const struct hda_pintbl[]) {
7785 /* Change the mic location from front to right, otherwise there are
7786 two front mics with the same name, pulseaudio can't handle them.
7787 This is just a temporary workaround, after applying this fixup,
7788 there will be one "Front Mic" and one "Mic" in this machine.
7789 */
7790 { 0x1a, 0x04a19040 },
7791 { }
7792 },
7793 },
5f364135
KY
7794 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7795 .type = HDA_FIXUP_PINS,
7796 .v.pins = (const struct hda_pintbl[]) {
7797 { 0x16, 0x0101102f }, /* Rear Headset HP */
7798 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7799 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7800 { 0x1b, 0x02011020 },
7801 { }
7802 },
7803 .chained = true,
52e4e368
KHF
7804 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7805 },
7806 [ALC225_FIXUP_S3_POP_NOISE] = {
7807 .type = HDA_FIXUP_FUNC,
7808 .v.func = alc225_fixup_s3_pop_noise,
7809 .chained = true,
5f364135
KY
7810 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7811 },
b84e8436
PH
7812 [ALC700_FIXUP_INTEL_REFERENCE] = {
7813 .type = HDA_FIXUP_VERBS,
7814 .v.verbs = (const struct hda_verb[]) {
7815 /* Enables internal speaker */
7816 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7817 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7818 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7819 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7820 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7821 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7822 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7823 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7824 {}
7825 }
7826 },
92266651
KY
7827 [ALC274_FIXUP_DELL_BIND_DACS] = {
7828 .type = HDA_FIXUP_FUNC,
7829 .v.func = alc274_fixup_bind_dacs,
7830 .chained = true,
7831 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7832 },
7833 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7834 .type = HDA_FIXUP_PINS,
7835 .v.pins = (const struct hda_pintbl[]) {
7836 { 0x1b, 0x0401102f },
7837 { }
7838 },
7839 .chained = true,
7840 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7841 },
399c01aa 7842 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
61fcf8ec
KY
7843 .type = HDA_FIXUP_FUNC,
7844 .v.func = alc_fixup_tpt470_dock,
7845 .chained = true,
7846 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7847 },
399c01aa
TI
7848 [ALC298_FIXUP_TPT470_DOCK] = {
7849 .type = HDA_FIXUP_FUNC,
7850 .v.func = alc_fixup_tpt470_dacs,
7851 .chained = true,
7852 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7853 },
ae104a21
KY
7854 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7855 .type = HDA_FIXUP_PINS,
7856 .v.pins = (const struct hda_pintbl[]) {
7857 { 0x14, 0x0201101f },
7858 { }
7859 },
7860 .chained = true,
7861 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7862 },
f0ba9d69
KY
7863 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7864 .type = HDA_FIXUP_PINS,
7865 .v.pins = (const struct hda_pintbl[]) {
7866 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7867 { }
7868 },
3ce0d5aa
HW
7869 .chained = true,
7870 .chain_id = ALC269_FIXUP_HEADSET_MIC
f0ba9d69 7871 },
bbf8ff6b
TB
7872 [ALC295_FIXUP_HP_X360] = {
7873 .type = HDA_FIXUP_FUNC,
7874 .v.func = alc295_fixup_hp_top_speakers,
7875 .chained = true,
7876 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8a328ac1
KY
7877 },
7878 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7879 .type = HDA_FIXUP_PINS,
7880 .v.pins = (const struct hda_pintbl[]) {
7881 { 0x19, 0x0181313f},
7882 { }
7883 },
7884 .chained = true,
7885 .chain_id = ALC269_FIXUP_HEADSET_MIC
7886 },
c4cfcf6f
HW
7887 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7888 .type = HDA_FIXUP_FUNC,
7889 .v.func = alc285_fixup_invalidate_dacs,
6ba189c5
HW
7890 .chained = true,
7891 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
c4cfcf6f 7892 },
e8ed64b0
GKK
7893 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7894 .type = HDA_FIXUP_FUNC,
7895 .v.func = alc_fixup_auto_mute_via_amp,
7896 },
33aaebd4
CC
7897 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7898 .type = HDA_FIXUP_PINS,
7899 .v.pins = (const struct hda_pintbl[]) {
7900 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7901 { }
7902 },
7903 .chained = true,
7904 .chain_id = ALC269_FIXUP_HEADSET_MIC
7905 },
d8ae458e
CC
7906 [ALC294_FIXUP_ASUS_MIC] = {
7907 .type = HDA_FIXUP_PINS,
7908 .v.pins = (const struct hda_pintbl[]) {
7909 { 0x13, 0x90a60160 }, /* use as internal mic */
7910 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7911 { }
7912 },
7913 .chained = true,
ef9ddb9d 7914 .chain_id = ALC269_FIXUP_HEADSET_MIC
d8ae458e 7915 },
4e051106
JHP
7916 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7917 .type = HDA_FIXUP_PINS,
7918 .v.pins = (const struct hda_pintbl[]) {
82b01149 7919 { 0x19, 0x01a1103c }, /* use as headset mic */
4e051106
JHP
7920 { }
7921 },
7922 .chained = true,
ef9ddb9d 7923 .chain_id = ALC269_FIXUP_HEADSET_MIC
4e051106
JHP
7924 },
7925 [ALC294_FIXUP_ASUS_SPK] = {
7926 .type = HDA_FIXUP_VERBS,
7927 .v.verbs = (const struct hda_verb[]) {
7928 /* Set EAPD high */
7929 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7930 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
473fbe13
KY
7931 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7932 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
4e051106
JHP
7933 { }
7934 },
7935 .chained = true,
7936 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7937 },
c8a9afa6 7938 [ALC295_FIXUP_CHROME_BOOK] = {
e854747d 7939 .type = HDA_FIXUP_FUNC,
c8a9afa6 7940 .v.func = alc295_fixup_chromebook,
8983eb60
KY
7941 .chained = true,
7942 .chain_id = ALC225_FIXUP_HEADSET_JACK
7943 },
7944 [ALC225_FIXUP_HEADSET_JACK] = {
7945 .type = HDA_FIXUP_FUNC,
7946 .v.func = alc_fixup_headset_jack,
e854747d 7947 },
89e3a568
JS
7948 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7949 .type = HDA_FIXUP_PINS,
7950 .v.pins = (const struct hda_pintbl[]) {
7951 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7952 { }
7953 },
7954 .chained = true,
7955 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7956 },
c8c6ee61
HW
7957 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7958 .type = HDA_FIXUP_VERBS,
7959 .v.verbs = (const struct hda_verb[]) {
7960 /* Disable PCBEEP-IN passthrough */
7961 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7962 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7963 { }
7964 },
7965 .chained = true,
7966 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7967 },
cbc05fd6
JHP
7968 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7969 .type = HDA_FIXUP_PINS,
7970 .v.pins = (const struct hda_pintbl[]) {
7971 { 0x19, 0x03a11130 },
7972 { 0x1a, 0x90a60140 }, /* use as internal mic */
7973 { }
7974 },
7975 .chained = true,
7976 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7977 },
136824ef
KY
7978 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7979 .type = HDA_FIXUP_PINS,
7980 .v.pins = (const struct hda_pintbl[]) {
7981 { 0x16, 0x01011020 }, /* Rear Line out */
7982 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7983 { }
7984 },
7985 .chained = true,
7986 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7987 },
7988 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7989 .type = HDA_FIXUP_FUNC,
7990 .v.func = alc_fixup_auto_mute_via_amp,
7991 .chained = true,
7992 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7993 },
7994 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7995 .type = HDA_FIXUP_FUNC,
7996 .v.func = alc_fixup_disable_mic_vref,
7997 .chained = true,
7998 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7999 },
667a8f73
JHP
8000 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8001 .type = HDA_FIXUP_VERBS,
8002 .v.verbs = (const struct hda_verb[]) {
8003 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8004 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8005 { }
8006 },
8007 .chained = true,
8008 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8009 },
8c8967a7
DD
8010 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8011 .type = HDA_FIXUP_PINS,
8012 .v.pins = (const struct hda_pintbl[]) {
8013 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8014 { }
8015 },
8016 .chained = true,
8017 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8018 },
e1037354
JHP
8019 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8020 .type = HDA_FIXUP_PINS,
8021 .v.pins = (const struct hda_pintbl[]) {
8022 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8023 { }
8024 },
8025 .chained = true,
8026 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8027 },
e2a829b3
BR
8028 [ALC299_FIXUP_PREDATOR_SPK] = {
8029 .type = HDA_FIXUP_PINS,
8030 .v.pins = (const struct hda_pintbl[]) {
8031 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8032 { }
8033 }
8034 },
bd9c10bc 8035 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
60083f9e
JHP
8036 .type = HDA_FIXUP_PINS,
8037 .v.pins = (const struct hda_pintbl[]) {
bd9c10bc
JMG
8038 { 0x19, 0x04a11040 },
8039 { 0x21, 0x04211020 },
60083f9e
JHP
8040 { }
8041 },
8042 .chained = true,
bd9c10bc 8043 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
60083f9e 8044 },
e79c2269 8045 [ALC289_FIXUP_DELL_SPK2] = {
bd9c10bc
JMG
8046 .type = HDA_FIXUP_PINS,
8047 .v.pins = (const struct hda_pintbl[]) {
e79c2269 8048 { 0x17, 0x90170130 }, /* bass spk */
bd9c10bc
JMG
8049 { }
8050 },
8051 .chained = true,
e79c2269 8052 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
bd9c10bc 8053 },
e79c2269
KY
8054 [ALC289_FIXUP_DUAL_SPK] = {
8055 .type = HDA_FIXUP_FUNC,
8056 .v.func = alc285_fixup_speaker2_to_dac1,
8057 .chained = true,
8058 .chain_id = ALC289_FIXUP_DELL_SPK2
8059 },
48e01504
CC
8060 [ALC294_FIXUP_SPK2_TO_DAC1] = {
8061 .type = HDA_FIXUP_FUNC,
8062 .v.func = alc285_fixup_speaker2_to_dac1,
8063 .chained = true,
8064 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8065 },
8066 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
436e2550
JHP
8067 .type = HDA_FIXUP_FUNC,
8068 /* The GPIO must be pulled to initialize the AMP */
8069 .v.func = alc_fixup_gpio4,
8070 .chained = true,
48e01504 8071 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
436e2550 8072 },
6a6660d0
TI
8073 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8074 .type = HDA_FIXUP_FUNC,
8075 .v.func = alc285_fixup_thinkpad_x1_gen7,
8076 .chained = true,
8077 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8078 },
76f7dec0
KY
8079 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8080 .type = HDA_FIXUP_FUNC,
8081 .v.func = alc_fixup_headset_jack,
8082 .chained = true,
6a6660d0 8083 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
76f7dec0 8084 },
8b33a134
JHP
8085 [ALC294_FIXUP_ASUS_HPE] = {
8086 .type = HDA_FIXUP_VERBS,
8087 .v.verbs = (const struct hda_verb[]) {
8088 /* Set EAPD high */
8089 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8090 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8091 { }
8092 },
8093 .chained = true,
8094 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8095 },
c3cdf189
LJ
8096 [ALC294_FIXUP_ASUS_GX502_PINS] = {
8097 .type = HDA_FIXUP_PINS,
8098 .v.pins = (const struct hda_pintbl[]) {
8099 { 0x19, 0x03a11050 }, /* front HP mic */
8100 { 0x1a, 0x01a11830 }, /* rear external mic */
8101 { 0x21, 0x03211020 }, /* front HP out */
8102 { }
8103 },
8104 .chained = true,
8105 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8106 },
8107 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8108 .type = HDA_FIXUP_VERBS,
8109 .v.verbs = (const struct hda_verb[]) {
8110 /* set 0x15 to HP-OUT ctrl */
8111 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8112 /* unmute the 0x15 amp */
8113 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8114 { }
8115 },
8116 .chained = true,
8117 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8118 },
8119 [ALC294_FIXUP_ASUS_GX502_HP] = {
8120 .type = HDA_FIXUP_FUNC,
8121 .v.func = alc294_fixup_gx502_hp,
8122 },
c1b55029
DC
8123 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8124 .type = HDA_FIXUP_PINS,
8125 .v.pins = (const struct hda_pintbl[]) {
8126 { 0x19, 0x01a11050 }, /* rear HP mic */
8127 { 0x1a, 0x01a11830 }, /* rear external mic */
8128 { 0x21, 0x012110f0 }, /* rear HP out */
8129 { }
8130 },
8131 .chained = true,
8132 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8133 },
8134 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8135 .type = HDA_FIXUP_VERBS,
8136 .v.verbs = (const struct hda_verb[]) {
8137 /* set 0x15 to HP-OUT ctrl */
8138 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8139 /* unmute the 0x15 amp */
8140 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8141 /* set 0x1b to HP-OUT */
8142 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8143 { }
8144 },
8145 .chained = true,
8146 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8147 },
8148 [ALC294_FIXUP_ASUS_GU502_HP] = {
8149 .type = HDA_FIXUP_FUNC,
8150 .v.func = alc294_fixup_gu502_hp,
8151 },
1b94e59d
TI
8152 [ALC294_FIXUP_ASUS_COEF_1B] = {
8153 .type = HDA_FIXUP_VERBS,
8154 .v.verbs = (const struct hda_verb[]) {
8155 /* Set bit 10 to correct noisy output after reboot from
8156 * Windows 10 (due to pop noise reduction?)
8157 */
8158 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8159 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8160 { }
8161 },
f8fbcdfb
TI
8162 .chained = true,
8163 .chain_id = ALC289_FIXUP_ASUS_GA401,
1b94e59d 8164 },
f5a88b0a
KHF
8165 [ALC285_FIXUP_HP_GPIO_LED] = {
8166 .type = HDA_FIXUP_FUNC,
8167 .v.func = alc285_fixup_hp_gpio_led,
8168 },
431e76c3
KY
8169 [ALC285_FIXUP_HP_MUTE_LED] = {
8170 .type = HDA_FIXUP_FUNC,
8171 .v.func = alc285_fixup_hp_mute_led,
8172 },
e7d66cf7
JS
8173 [ALC236_FIXUP_HP_GPIO_LED] = {
8174 .type = HDA_FIXUP_FUNC,
8175 .v.func = alc236_fixup_hp_gpio_led,
8176 },
24164f43
KY
8177 [ALC236_FIXUP_HP_MUTE_LED] = {
8178 .type = HDA_FIXUP_FUNC,
8179 .v.func = alc236_fixup_hp_mute_led,
8180 },
75b62ab6
JW
8181 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8182 .type = HDA_FIXUP_FUNC,
8183 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8184 },
14425f1f
MP
8185 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8186 .type = HDA_FIXUP_VERBS,
8187 .v.verbs = (const struct hda_verb[]) {
8188 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8189 { }
8190 },
8191 },
9e43342b
CC
8192 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8193 .type = HDA_FIXUP_PINS,
8194 .v.pins = (const struct hda_pintbl[]) {
8195 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8196 { }
8197 },
8198 .chained = true,
8199 .chain_id = ALC269_FIXUP_HEADSET_MODE
8200 },
8eae7e9b
JHP
8201 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8202 .type = HDA_FIXUP_PINS,
8203 .v.pins = (const struct hda_pintbl[]) {
8204 { 0x14, 0x90100120 }, /* use as internal speaker */
8205 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8206 { 0x1a, 0x01011020 }, /* use as line out */
8207 { },
8208 },
8209 .chained = true,
8210 .chain_id = ALC269_FIXUP_HEADSET_MIC
8211 },
6e15d126
JHP
8212 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8213 .type = HDA_FIXUP_PINS,
8214 .v.pins = (const struct hda_pintbl[]) {
8215 { 0x18, 0x02a11030 }, /* use as headset mic */
8216 { }
8217 },
8218 .chained = true,
8219 .chain_id = ALC269_FIXUP_HEADSET_MIC
8220 },
781c90c0
JHP
8221 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8222 .type = HDA_FIXUP_PINS,
8223 .v.pins = (const struct hda_pintbl[]) {
8224 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8225 { }
8226 },
8227 .chained = true,
8228 .chain_id = ALC269_FIXUP_HEADSET_MIC
8229 },
293a92c1 8230 [ALC289_FIXUP_ASUS_GA401] = {
c84bfedc
TI
8231 .type = HDA_FIXUP_FUNC,
8232 .v.func = alc289_fixup_asus_ga401,
8233 .chained = true,
8234 .chain_id = ALC289_FIXUP_ASUS_GA502,
ff53664d 8235 },
4b43d05a
AS
8236 [ALC289_FIXUP_ASUS_GA502] = {
8237 .type = HDA_FIXUP_PINS,
8238 .v.pins = (const struct hda_pintbl[]) {
8239 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8240 { }
8241 },
8242 },
f50a121d
JHP
8243 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8244 .type = HDA_FIXUP_PINS,
8245 .v.pins = (const struct hda_pintbl[]) {
8246 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8247 { }
8248 },
8249 .chained = true,
8250 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8251 },
56496253
KY
8252 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8253 .type = HDA_FIXUP_FUNC,
8254 .v.func = alc285_fixup_hp_gpio_amp_init,
8255 .chained = true,
8256 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8257 },
f1ec5be1
HC
8258 [ALC269_FIXUP_CZC_B20] = {
8259 .type = HDA_FIXUP_PINS,
8260 .v.pins = (const struct hda_pintbl[]) {
8261 { 0x12, 0x411111f0 },
8262 { 0x14, 0x90170110 }, /* speaker */
8263 { 0x15, 0x032f1020 }, /* HP out */
8264 { 0x17, 0x411111f0 },
8265 { 0x18, 0x03ab1040 }, /* mic */
8266 { 0x19, 0xb7a7013f },
8267 { 0x1a, 0x0181305f },
8268 { 0x1b, 0x411111f0 },
8269 { 0x1d, 0x411111f0 },
8270 { 0x1e, 0x411111f0 },
8271 { }
8272 },
8273 .chain_id = ALC269_FIXUP_DMIC,
8274 },
8275 [ALC269_FIXUP_CZC_TMI] = {
8276 .type = HDA_FIXUP_PINS,
8277 .v.pins = (const struct hda_pintbl[]) {
8278 { 0x12, 0x4000c000 },
8279 { 0x14, 0x90170110 }, /* speaker */
8280 { 0x15, 0x0421401f }, /* HP out */
8281 { 0x17, 0x411111f0 },
8282 { 0x18, 0x04a19020 }, /* mic */
8283 { 0x19, 0x411111f0 },
8284 { 0x1a, 0x411111f0 },
8285 { 0x1b, 0x411111f0 },
8286 { 0x1d, 0x40448505 },
8287 { 0x1e, 0x411111f0 },
8288 { 0x20, 0x8000ffff },
8289 { }
8290 },
8291 .chain_id = ALC269_FIXUP_DMIC,
8292 },
8293 [ALC269_FIXUP_CZC_L101] = {
8294 .type = HDA_FIXUP_PINS,
8295 .v.pins = (const struct hda_pintbl[]) {
8296 { 0x12, 0x40000000 },
8297 { 0x14, 0x01014010 }, /* speaker */
8298 { 0x15, 0x411111f0 }, /* HP out */
8299 { 0x16, 0x411111f0 },
8300 { 0x18, 0x01a19020 }, /* mic */
8301 { 0x19, 0x02a19021 },
8302 { 0x1a, 0x0181302f },
8303 { 0x1b, 0x0221401f },
8304 { 0x1c, 0x411111f0 },
8305 { 0x1d, 0x4044c601 },
8306 { 0x1e, 0x411111f0 },
8307 { }
8308 },
8309 .chain_id = ALC269_FIXUP_DMIC,
8310 },
8311 [ALC269_FIXUP_LEMOTE_A1802] = {
8312 .type = HDA_FIXUP_PINS,
8313 .v.pins = (const struct hda_pintbl[]) {
8314 { 0x12, 0x40000000 },
8315 { 0x14, 0x90170110 }, /* speaker */
8316 { 0x17, 0x411111f0 },
8317 { 0x18, 0x03a19040 }, /* mic1 */
8318 { 0x19, 0x90a70130 }, /* mic2 */
8319 { 0x1a, 0x411111f0 },
8320 { 0x1b, 0x411111f0 },
8321 { 0x1d, 0x40489d2d },
8322 { 0x1e, 0x411111f0 },
8323 { 0x20, 0x0003ffff },
8324 { 0x21, 0x03214020 },
8325 { }
8326 },
8327 .chain_id = ALC269_FIXUP_DMIC,
8328 },
8329 [ALC269_FIXUP_LEMOTE_A190X] = {
8330 .type = HDA_FIXUP_PINS,
8331 .v.pins = (const struct hda_pintbl[]) {
8332 { 0x14, 0x99130110 }, /* speaker */
8333 { 0x15, 0x0121401f }, /* HP out */
8334 { 0x18, 0x01a19c20 }, /* rear mic */
8335 { 0x19, 0x99a3092f }, /* front mic */
8336 { 0x1b, 0x0201401f }, /* front lineout */
8337 { }
8338 },
8339 .chain_id = ALC269_FIXUP_DMIC,
8340 },
e2d2fded
KHF
8341 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8342 .type = HDA_FIXUP_PINS,
8343 .v.pins = (const struct hda_pintbl[]) {
8344 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8345 { }
8346 },
8347 .chained = true,
8348 .chain_id = ALC269_FIXUP_HEADSET_MODE
8349 },
73e7161e
WS
8350 [ALC256_FIXUP_INTEL_NUC10] = {
8351 .type = HDA_FIXUP_PINS,
8352 .v.pins = (const struct hda_pintbl[]) {
8353 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8354 { }
8355 },
8356 .chained = true,
8357 .chain_id = ALC269_FIXUP_HEADSET_MODE
8358 },
fc19d559
HW
8359 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8360 .type = HDA_FIXUP_VERBS,
8361 .v.verbs = (const struct hda_verb[]) {
8362 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8363 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8364 { }
8365 },
8366 .chained = true,
c84bfedc 8367 .chain_id = ALC289_FIXUP_ASUS_GA502
fc19d559 8368 },
13468bfa
HW
8369 [ALC274_FIXUP_HP_MIC] = {
8370 .type = HDA_FIXUP_VERBS,
8371 .v.verbs = (const struct hda_verb[]) {
8372 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8373 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8374 { }
8375 },
8376 },
8a8de09c
KY
8377 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8378 .type = HDA_FIXUP_FUNC,
8379 .v.func = alc274_fixup_hp_headset_mic,
8380 .chained = true,
8381 .chain_id = ALC274_FIXUP_HP_MIC
8382 },
622464c8
TI
8383 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8384 .type = HDA_FIXUP_FUNC,
8385 .v.func = alc274_fixup_hp_envy_gpio,
8386 },
ef9ce66f
KY
8387 [ALC256_FIXUP_ASUS_HPE] = {
8388 .type = HDA_FIXUP_VERBS,
8389 .v.verbs = (const struct hda_verb[]) {
8390 /* Set EAPD high */
8391 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8392 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8393 { }
8394 },
8395 .chained = true,
8396 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8397 },
446b8185
KY
8398 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8399 .type = HDA_FIXUP_FUNC,
8400 .v.func = alc_fixup_headset_jack,
8401 .chained = true,
8402 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8403 },
a0ccbc53
KY
8404 [ALC287_FIXUP_HP_GPIO_LED] = {
8405 .type = HDA_FIXUP_FUNC,
8406 .v.func = alc287_fixup_hp_gpio_led,
8407 },
9e885770
KY
8408 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8409 .type = HDA_FIXUP_FUNC,
8410 .v.func = alc274_fixup_hp_headset_mic,
8411 },
92666d45
KY
8412 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8413 .type = HDA_FIXUP_FUNC,
8414 .v.func = alc_fixup_no_int_mic,
8415 .chained = true,
8416 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8417 },
34cdf405
CC
8418 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8419 .type = HDA_FIXUP_PINS,
8420 .v.pins = (const struct hda_pintbl[]) {
8421 { 0x1b, 0x411111f0 },
8422 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8423 { },
8424 },
8425 .chained = true,
8426 .chain_id = ALC269_FIXUP_HEADSET_MODE
8427 },
495dc763
CC
8428 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8429 .type = HDA_FIXUP_FUNC,
8430 .v.func = alc269_fixup_limit_int_mic_boost,
8431 .chained = true,
8432 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8433 },
d0e18561
CC
8434 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8435 .type = HDA_FIXUP_PINS,
8436 .v.pins = (const struct hda_pintbl[]) {
8437 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8438 { 0x1a, 0x90a1092f }, /* use as internal mic */
8439 { }
8440 },
8441 .chained = true,
8442 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8443 },
26928ca1
TI
8444 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8445 .type = HDA_FIXUP_FUNC,
8446 .v.func = alc285_fixup_ideapad_s740_coef,
8447 .chained = true,
8448 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8449 },
bd15b155
KHF
8450 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8451 .type = HDA_FIXUP_FUNC,
8452 .v.func = alc269_fixup_limit_int_mic_boost,
8453 .chained = true,
8454 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8455 },
8eedd3a7
TI
8456 [ALC295_FIXUP_ASUS_DACS] = {
8457 .type = HDA_FIXUP_FUNC,
8458 .v.func = alc295_fixup_asus_dacs,
8459 },
5d84b531
TI
8460 [ALC295_FIXUP_HP_OMEN] = {
8461 .type = HDA_FIXUP_PINS,
8462 .v.pins = (const struct hda_pintbl[]) {
8463 { 0x12, 0xb7a60130 },
8464 { 0x13, 0x40000000 },
8465 { 0x14, 0x411111f0 },
8466 { 0x16, 0x411111f0 },
8467 { 0x17, 0x90170110 },
8468 { 0x18, 0x411111f0 },
8469 { 0x19, 0x02a11030 },
8470 { 0x1a, 0x411111f0 },
8471 { 0x1b, 0x04a19030 },
8472 { 0x1d, 0x40600001 },
8473 { 0x1e, 0x411111f0 },
8474 { 0x21, 0x03211020 },
8475 {}
8476 },
8477 .chained = true,
8478 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8479 },
f2be77fe 8480 [ALC285_FIXUP_HP_SPECTRE_X360] = {
434591b2
ED
8481 .type = HDA_FIXUP_FUNC,
8482 .v.func = alc285_fixup_hp_spectre_x360,
f2be77fe 8483 },
d94befbb
DB
8484 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8485 .type = HDA_FIXUP_FUNC,
8486 .v.func = alc285_fixup_hp_spectre_x360_eb1
8487 },
9ebaef05
HW
8488 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8489 .type = HDA_FIXUP_FUNC,
8490 .v.func = alc285_fixup_ideapad_s740_coef,
8491 .chained = true,
8492 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8493 },
29c8f40b
PU
8494 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8495 .type = HDA_FIXUP_FUNC,
8496 .v.func = alc_fixup_no_shutup,
8497 .chained = true,
8498 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8499 },
57c9e21a
HW
8500 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8501 .type = HDA_FIXUP_PINS,
8502 .v.pins = (const struct hda_pintbl[]) {
8503 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8504 { }
8505 },
8506 .chained = true,
8507 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8508 },
8903376d
KHF
8509 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8510 .type = HDA_FIXUP_FUNC,
8511 .v.func = alc269_fixup_limit_int_mic_boost,
8512 .chained = true,
8513 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8514 },
8f4c9042
BF
8515 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8516 .type = HDA_FIXUP_FUNC,
8517 .v.func = alc285_fixup_ideapad_s740_coef,
8518 .chained = true,
8519 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8520 },
8521 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8522 .type = HDA_FIXUP_FUNC,
8523 .v.func = alc287_fixup_legion_15imhg05_speakers,
8524 .chained = true,
8525 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8526 },
ad7cc2d4
CB
8527 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8528 .type = HDA_FIXUP_VERBS,
8529 //.v.verbs = legion_15imhg05_coefs,
8530 .v.verbs = (const struct hda_verb[]) {
8531 // set left speaker Legion 7i.
8532 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8533 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8534
8535 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8536 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8537 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8538 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8539 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8540
8541 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8542 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8543 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8544 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8545 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8546
8547 // set right speaker Legion 7i.
8548 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8549 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8550
8551 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8552 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8553 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8554 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8555 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8556
8557 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8558 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8559 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8560 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8561 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8562 {}
8563 },
8564 .chained = true,
8565 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8566 },
8567 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8568 .type = HDA_FIXUP_FUNC,
8569 .v.func = alc287_fixup_legion_15imhg05_speakers,
8570 .chained = true,
8571 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8572 },
8573 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8574 .type = HDA_FIXUP_VERBS,
8575 .v.verbs = (const struct hda_verb[]) {
8576 // set left speaker Yoga 7i.
8577 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8578 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8579
8580 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8581 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8582 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8583 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8584 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8585
8586 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8587 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8588 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8589 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8590 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8591
8592 // set right speaker Yoga 7i.
8593 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8594 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8595
8596 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8597 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8598 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8599 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8600 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8601
8602 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8603 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8604 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8605 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8606 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8607 {}
8608 },
8609 .chained = true,
8610 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8611 },
8612 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8613 .type = HDA_FIXUP_VERBS,
8614 .v.verbs = (const struct hda_verb[]) {
8615 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8616 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
023a062f 8617 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
ad7cc2d4
CB
8618 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8619 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8620 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8621 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8622 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8623 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8624 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8625 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8626 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8627 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8628 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8629 {}
8630 },
8631 .chained = true,
8632 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8633 },
619764cc 8634 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
dd6dd6e3 8635 .type = HDA_FIXUP_FUNC,
619764cc 8636 .v.func = alc256_fixup_set_coef_defaults,
dd6dd6e3 8637 },
5fc462c3
JC
8638 [ALC245_FIXUP_HP_GPIO_LED] = {
8639 .type = HDA_FIXUP_FUNC,
8640 .v.func = alc245_fixup_hp_gpio_led,
8641 },
1278cc5a
JS
8642 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8643 .type = HDA_FIXUP_PINS,
8644 .v.pins = (const struct hda_pintbl[]) {
8645 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8646 { }
8647 },
8648 .chained = true,
8649 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8650 },
174a7fb3
WS
8651 [ALC233_FIXUP_NO_AUDIO_JACK] = {
8652 .type = HDA_FIXUP_FUNC,
8653 .v.func = alc233_fixup_no_audio_jack,
8654 },
edca7cc4
WS
8655 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
8656 .type = HDA_FIXUP_FUNC,
8657 .v.func = alc256_fixup_mic_no_presence_and_resume,
8658 .chained = true,
8659 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8660 },
d3dca026
LT
8661 [ALC287_FIXUP_LEGION_16ACHG6] = {
8662 .type = HDA_FIXUP_FUNC,
8663 .v.func = alc287_fixup_legion_16achg6_speakers,
8664 },
f1d4e28b
KY
8665};
8666
1d045db9 8667static const struct snd_pci_quirk alc269_fixup_tbl[] = {
a6b92b66 8668 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
693b613d
DH
8669 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8670 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
aaedfb47 8671 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
7819717b 8672 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
aaedfb47
DH
8673 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8674 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
02322ac9 8675 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
b1e8972e 8676 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
1a22e775 8677 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
433f894e 8678 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
c8426b27 8679 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
13be30f1 8680 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
705b65f1 8681 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6e15d126 8682 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
b9c2fa52 8683 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
495dc763 8684 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
c7531e31
CC
8685 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8686 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
13be30f1
CC
8687 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8688 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
e2a829b3 8689 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
8eae7e9b 8690 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
781c90c0 8691 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
d0e18561 8692 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
667a8f73
JHP
8693 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8694 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8695 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
d0e18561 8696 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
35171fbf 8697 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
2733cceb 8698 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
ea5c7eba 8699 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
cbc05fd6 8700 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
2a5bb694 8701 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
0d4867a1 8702 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
f50a121d 8703 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
57c9e21a 8704 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
aaedfb47 8705 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6ed1131f 8706 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
86f799b8 8707 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
cf52103a 8708 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8b99aba7
TI
8709 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8710 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
0f4881dc 8711 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
73bdd597
DH
8712 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8713 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8714 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
0f4881dc
DH
8715 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8716 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
98070576 8717 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
4275554d 8718 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
0f4881dc 8719 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
a22aa26f
KY
8720 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8721 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
831bfdf9 8722 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
afecb146 8723 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
3a05d12f 8724 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8b72415d 8725 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
b734304f
KY
8726 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8727 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
c04017ea
DH
8728 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8729 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8730 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8731 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8732 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
fd06c77e 8733 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
3b43b71f 8734 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
c0ca5ece 8735 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
709ae62e 8736 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
dd9aa335 8737 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
493de342 8738 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
aa143ad3 8739 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
5f364135 8740 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
40e2c4e5
KY
8741 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8742 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
f0ba9d69
KY
8743 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8744 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
ae104a21 8745 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
136824ef 8746 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
da484d00 8747 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
c2a7c55a 8748 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
e79c2269 8749 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
aa143ad3 8750 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
78def224
KY
8751 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8752 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
92666d45
KY
8753 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8754 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
c1e89523 8755 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
da946920 8756 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
eb676622 8757 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
2b987fe8
CC
8758 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8759 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
a22aa26f
KY
8760 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8761 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
08fb0d0e 8762 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9f5c6faf 8763 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8e35cd4a 8764 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
7976eb49 8765 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 8766 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 8767 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8768 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8769 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8770 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8771 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf
KY
8772 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8773 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8774 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8775 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf 8776 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf
KY
8777 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8778 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8779 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8780 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8781 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 8782 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
04d5466a 8783 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
45461e3b 8784 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
c60666bd 8785 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
8786 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8787 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8788 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8789 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8790 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8791 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8792 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8793 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9c5dc3bf 8794 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
45461e3b 8795 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9c5dc3bf 8796 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
45461e3b 8797 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9c5dc3bf 8798 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 8799 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8800 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8801 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8802 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8803 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8804 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8805 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8806 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8807 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8808 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
8809 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8810 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8811 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8812 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8813 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8814 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8a02b164
KY
8815 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8816 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8817 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8818 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
167897f4
JK
8819 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8820 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
1c9d9dfd
KY
8821 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8822 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
563785ed 8823 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
e549d190 8824 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
bbf8ff6b 8825 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
aeedad25 8826 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
167897f4
JK
8827 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8828 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
56e40eb6 8829 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
901be145 8830 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
190d0381 8831 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
5d84b531 8832 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
d33cd42d 8833 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
f2be77fe 8834 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
d296a74b 8835 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
0ac05b25 8836 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
b2c22910 8837 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
622464c8 8838 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
15d295b5 8839 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
61d3e874 8840 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
a598098c 8841 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
c058493d 8842 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
b2c22910 8843 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
75b62ab6 8844 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
05ec7161 8845 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
56496253 8846 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
08befca4 8847 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
431e76c3 8848 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
24164f43 8849 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
91bc1568
JS
8850 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8851 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8852 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8853 ALC285_FIXUP_HP_GPIO_AMP_INIT),
375f8426 8854 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
48422958 8855 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
e7d66cf7 8856 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
2b70b264 8857 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
fb3acdb2 8858 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
417eadfd 8859 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
a0ccbc53
KY
8860 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8861 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
93ab3eaf 8862 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
c3bb2b52 8863 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
d07149ab 8864 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
dfc2e8ae 8865 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
d94befbb
DB
8866 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8867 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
53b861be 8868 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
c3d2c882 8869 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
dfb06401 8870 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
ca688339 8871 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8903376d
KHF
8872 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8873 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
50dbfae9 8874 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
e650c1a9 8875 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
bbe183e0 8876 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
600dd2a7 8877 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
0e68c4b1 8878 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
bd15b155 8879 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
42334fbc 8880 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
08977fe8 8881 SND_PCI_QUIRK(0x103c, 0x89c3, "HP", ALC285_FIXUP_HP_GPIO_LED),
f7ac570d 8882 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
c1732ede 8883 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
7bba2157 8884 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
3e0d611b 8885 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9cf6533e 8886 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
c1732ede 8887 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
4eab0ea1 8888 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3e0d611b 8889 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4eab0ea1 8890 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3cd0ed63 8891 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
5cfca596 8892 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1
TI
8893 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8894 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
c1732ede 8895 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
3cd0ed63 8896 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
c1732ede 8897 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
2cede303 8898 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
23870831 8899 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
3e0d611b 8900 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
8eedd3a7 8901 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
48e01504 8902 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
739d0959 8903 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
3cd0ed63 8904 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
8c8967a7 8905 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
4963d66b 8906 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
158ae2f5 8907 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
4fad4fb9 8908 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
5de3b943 8909 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
8b33a134 8910 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
7900e817 8911 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
017f2a10 8912 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
28e8af8a 8913 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
1b94e59d 8914 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
693b613d 8915 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
615966ad 8916 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1 8917 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
c1732ede 8918 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
ef9ce66f 8919 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
4b43d05a 8920 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
c1b55029 8921 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
76fae618 8922 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
293a92c1 8923 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
eeed4cd1 8924 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
adabb3ec
TI
8925 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8926 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8927 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8928 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
d240d1dc 8929 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
1d045db9
TI
8930 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8931 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8932 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
e9bd7d5c 8933 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
cab561f8
TI
8934 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8935 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
24519911 8936 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4df3fd17 8937 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
cc7016ab 8938 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
fdcc968a 8939 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
c656f747 8940 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
2041d564 8941 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
b84e8436 8942 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
c656f747 8943 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
6fa38ef1 8944 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
ce2e79b2
PH
8945 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8946 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
0fca97a2 8947 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
a33cc48d 8948 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
14425f1f
MP
8949 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8950 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
f70fff83 8951 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8bcea6cb 8952 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
823ff161 8953 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
568e4e82 8954 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
c656f747 8955 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
abaa2274
AA
8956 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8957 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8cd65271 8958 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
6ca653e3 8959 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
b5acfe15 8960 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b 8961 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8962 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8963 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8964 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8965 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8966 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8967 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8968 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8969 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8970 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8971 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1278cc5a
JS
8972 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8973 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8974 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8975 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8976 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8977 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8978 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1278cc5a
JS
8979 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8980 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 8981 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2 8982 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 8983 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
8984 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8985 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8986 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8987 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8988 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8989 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8990 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
8991 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8992 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8993 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8994 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8995 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8996 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8997 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8998 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8999 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b
WS
9000 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9001 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9002 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9003 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9004 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
b5acfe15
PH
9005 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9006 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
edca7cc4 9007 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
b5acfe15
PH
9008 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9009 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9010 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9011 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2 9012 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9013 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9014 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b
WS
9015 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9016 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
9017 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9018 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9019 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9020 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9021 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9022 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
ca169cc2 9023 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
29c8f40b 9024 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
1d045db9
TI
9025 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
9026 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
9027 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
9028 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
9029 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
f552ff54 9030 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
b590b38c 9031 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
c8415a48 9032 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
4407be6b 9033 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
108cc108 9034 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
aaedfb47 9035 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9a811230 9036 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
1c37c223 9037 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
a12137e7 9038 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
59a51a6b 9039 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
6d16941a 9040 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7c21539c 9041 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
a4a9e082 9042 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
b6903c0e 9043 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
d05ea7da 9044 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
c0278669 9045 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
61fcf8ec
KY
9046 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9047 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
dab38e43 9048 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
c636b95e 9049 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
9050 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
9051 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9052 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
e4c07b3b 9053 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
9054 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9055 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9056 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
85981dfd 9057 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9774dc21 9058 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
ca707b3f 9059 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
446b8185
KY
9060 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9061 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
3694cb29 9062 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6ef2f68f 9063 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
f33f79f3 9064 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
bef33e19 9065 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
e41fc8c5 9066 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
65811834 9067 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8da5bbfc 9068 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
2a36c16e 9069 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8a6c55d0
AM
9070 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9071 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
e4efa826 9072 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
2aac550d 9073 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
f86de9b1 9074 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
2aac550d 9075 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
8f4c9042 9076 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
2aac550d 9077 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
9ebaef05 9078 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
d3dca026 9079 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
2aac550d 9080 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
ad7cc2d4
CB
9081 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9082 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
56f27013 9083 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
fedb2245 9084 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
56df90b6 9085 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
f552ff54 9086 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
a4a9e082 9087 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
1bb3e062 9088 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
c497d9f9 9089 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
cd5302c0 9090 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
f2aa1110 9091 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
80b311d3 9092 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
09ea9976 9093 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
037e1197 9094 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
23adc192 9095 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
0f087ee3 9096 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9cd25743 9097 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
0f087ee3 9098 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
61fcf8ec
KY
9099 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9100 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9101 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
cd5302c0 9102 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
61fcf8ec
KY
9103 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9104 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
1d045db9 9105 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
174a7fb3 9106 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
0fbf21c3 9107 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
f1ec5be1
HC
9108 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
9109 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
9110 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
02b504d9 9111 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
c656f747
TI
9112 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
9113 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
619764cc 9114 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
fc19d559 9115 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
b95bc12e 9116 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
695d1ec3 9117 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
e1c86210 9118 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
d1ee66c5 9119 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
e2d2fded 9120 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
73e7161e 9121 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
a4297b5d 9122
a7f3eedc 9123#if 0
a4297b5d
TI
9124 /* Below is a quirk table taken from the old code.
9125 * Basically the device should work as is without the fixup table.
9126 * If BIOS doesn't give a proper info, enable the corresponding
9127 * fixup entry.
7d7eb9ea 9128 */
a4297b5d
TI
9129 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
9130 ALC269_FIXUP_AMIC),
9131 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
a4297b5d
TI
9132 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
9133 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
9134 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
9135 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
9136 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
9137 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
9138 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
9139 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
9140 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
9141 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
9142 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
9143 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
9144 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
9145 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
9146 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
9147 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
9148 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
9149 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
9150 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
9151 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
9152 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
9153 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
9154 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
9155 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
9156 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
9157 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
9158 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
9159 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
9160 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
9161 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
9162 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
9163 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
9164 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
9165 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
9166 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
9167 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
9168 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
9169 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
9170#endif
9171 {}
9172};
9173
214eef76
DH
9174static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9175 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9176 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9177 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9178 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
0fbf21c3 9179 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
214eef76
DH
9180 {}
9181};
9182
1727a771 9183static const struct hda_model_fixup alc269_fixup_models[] = {
a4297b5d
TI
9184 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9185 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
6e72aa5f
TI
9186 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9187 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9188 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7c478f03 9189 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
b016951e
TI
9190 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9191 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
108cc108 9192 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
b590b38c 9193 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9f5c6faf 9194 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
04d5466a 9195 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
e32aa85a
DH
9196 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9197 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
a26d96c7
TI
9198 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9199 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
be8ef16a 9200 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
0202e99c 9201 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
1c37c223 9202 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9a811230 9203 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
c636b95e 9204 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
399c01aa 9205 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
a26d96c7 9206 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
ba90d6a6 9207 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
28d1d6d2 9208 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
a26d96c7
TI
9209 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9210 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9211 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9212 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9213 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9214 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9215 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9216 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9217 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9218 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9219 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9220 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9221 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9222 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9223 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9224 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9225 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9226 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9227 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9228 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9229 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9230 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9231 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9232 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9233 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9234 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9235 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9236 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9237 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9238 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9239 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9240 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9241 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9242 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9243 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9244 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9245 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9246 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9247 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9248 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
b3802783 9249 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
a26d96c7 9250 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
c8426b27 9251 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
a26d96c7
TI
9252 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9253 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9254 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9255 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9256 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9257 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9258 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9259 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9260 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9261 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9262 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9263 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9264 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9265 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
a26d96c7
TI
9266 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9267 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9268 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
82aa0d7e 9269 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
a26d96c7 9270 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
d2cd795c 9271 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
a26d96c7
TI
9272 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9273 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9274 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9275 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9276 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9277 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9278 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9279 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9280 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9281 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9282 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9283 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9284 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9285 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9286 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9287 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9288 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
8983eb60
KY
9289 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9290 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
e2a829b3 9291 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
a2ef03fe 9292 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
bd9c10bc 9293 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
23dc9586 9294 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
fc19d559 9295 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
13468bfa 9296 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
c3bb2b52 9297 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
5d84b531 9298 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
f2be77fe 9299 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
d94befbb 9300 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
9ebaef05 9301 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
29c8f40b 9302 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
57c9e21a 9303 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
aa723946 9304 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
1d045db9 9305 {}
6dda9f4a 9306};
cfc5a845 9307#define ALC225_STANDARD_PINS \
cfc5a845 9308 {0x21, 0x04211020}
6dda9f4a 9309
e8191a8e
HW
9310#define ALC256_STANDARD_PINS \
9311 {0x12, 0x90a60140}, \
9312 {0x14, 0x90170110}, \
e8191a8e
HW
9313 {0x21, 0x02211020}
9314
fea185e2 9315#define ALC282_STANDARD_PINS \
11580297 9316 {0x14, 0x90170110}
e1e62b98 9317
fea185e2 9318#define ALC290_STANDARD_PINS \
11580297 9319 {0x12, 0x99a30130}
fea185e2
DH
9320
9321#define ALC292_STANDARD_PINS \
9322 {0x14, 0x90170110}, \
11580297 9323 {0x15, 0x0221401f}
977e6276 9324
3f640970
HW
9325#define ALC295_STANDARD_PINS \
9326 {0x12, 0xb7a60130}, \
9327 {0x14, 0x90170110}, \
3f640970
HW
9328 {0x21, 0x04211020}
9329
703867e2
WS
9330#define ALC298_STANDARD_PINS \
9331 {0x12, 0x90a60130}, \
9332 {0x21, 0x03211020}
9333
e1918938 9334static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
8a328ac1
KY
9335 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9336 {0x14, 0x01014020},
9337 {0x17, 0x90170110},
9338 {0x18, 0x02a11030},
9339 {0x19, 0x0181303F},
9340 {0x21, 0x0221102f}),
5824ce8d
CC
9341 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9342 {0x12, 0x90a601c0},
9343 {0x14, 0x90171120},
9344 {0x21, 0x02211030}),
615966ad
CC
9345 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9346 {0x14, 0x90170110},
9347 {0x1b, 0x90a70130},
9348 {0x21, 0x03211020}),
9349 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9350 {0x1a, 0x90a70130},
9351 {0x1b, 0x90170110},
9352 {0x21, 0x03211020}),
2ae95577 9353 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 9354 ALC225_STANDARD_PINS,
8a132099 9355 {0x12, 0xb7a60130},
cfc5a845 9356 {0x14, 0x901701a0}),
2ae95577 9357 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 9358 ALC225_STANDARD_PINS,
8a132099 9359 {0x12, 0xb7a60130},
cfc5a845 9360 {0x14, 0x901701b0}),
8a132099
HW
9361 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9362 ALC225_STANDARD_PINS,
9363 {0x12, 0xb7a60150},
9364 {0x14, 0x901701a0}),
9365 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9366 ALC225_STANDARD_PINS,
9367 {0x12, 0xb7a60150},
9368 {0x14, 0x901701b0}),
9369 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9370 ALC225_STANDARD_PINS,
9371 {0x12, 0xb7a60130},
9372 {0x1b, 0x90170110}),
0ce48e17
KHF
9373 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9374 {0x1b, 0x01111010},
9375 {0x1e, 0x01451130},
9376 {0x21, 0x02211020}),
986376b6
HW
9377 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9378 {0x12, 0x90a60140},
9379 {0x14, 0x90170110},
9380 {0x19, 0x02a11030},
9381 {0x21, 0x02211020}),
e41fc8c5
HW
9382 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9383 {0x14, 0x90170110},
9384 {0x19, 0x02a11030},
9385 {0x1a, 0x02a11040},
9386 {0x1b, 0x01014020},
9387 {0x21, 0x0221101f}),
d06fb562
HW
9388 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9389 {0x14, 0x90170110},
9390 {0x19, 0x02a11030},
9391 {0x1a, 0x02a11040},
9392 {0x1b, 0x01011020},
9393 {0x21, 0x0221101f}),
c6b17f10
HW
9394 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9395 {0x14, 0x90170110},
9396 {0x19, 0x02a11020},
9397 {0x1a, 0x02a11030},
9398 {0x21, 0x0221101f}),
92666d45
KY
9399 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9400 {0x21, 0x02211010}),
9e885770
KY
9401 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9402 {0x14, 0x90170110},
9403 {0x19, 0x02a11020},
9404 {0x21, 0x02211030}),
c77900e6 9405 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
c77900e6 9406 {0x14, 0x90170110},
c77900e6 9407 {0x21, 0x02211020}),
86c72d1c
HW
9408 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9409 {0x14, 0x90170130},
9410 {0x21, 0x02211040}),
76c2132e
DH
9411 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9412 {0x12, 0x90a60140},
9413 {0x14, 0x90170110},
76c2132e
DH
9414 {0x21, 0x02211020}),
9415 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9416 {0x12, 0x90a60160},
9417 {0x14, 0x90170120},
76c2132e 9418 {0x21, 0x02211030}),
392c9da2
HW
9419 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9420 {0x14, 0x90170110},
9421 {0x1b, 0x02011020},
9422 {0x21, 0x0221101f}),
6aecd871
HW
9423 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9424 {0x14, 0x90170110},
9425 {0x1b, 0x01011020},
9426 {0x21, 0x0221101f}),
cba59972 9427 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
cba59972 9428 {0x14, 0x90170130},
cba59972 9429 {0x1b, 0x01014020},
cba59972 9430 {0x21, 0x0221103f}),
6aecd871
HW
9431 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9432 {0x14, 0x90170130},
9433 {0x1b, 0x01011020},
9434 {0x21, 0x0221103f}),
59ec4b57
HW
9435 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9436 {0x14, 0x90170130},
9437 {0x1b, 0x02011020},
9438 {0x21, 0x0221103f}),
e9c28e16 9439 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 9440 {0x14, 0x90170150},
e9c28e16 9441 {0x1b, 0x02011020},
e9c28e16
WS
9442 {0x21, 0x0221105f}),
9443 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 9444 {0x14, 0x90170110},
e9c28e16 9445 {0x1b, 0x01014020},
e9c28e16 9446 {0x21, 0x0221101f}),
76c2132e
DH
9447 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9448 {0x12, 0x90a60160},
9449 {0x14, 0x90170120},
9450 {0x17, 0x90170140},
76c2132e
DH
9451 {0x21, 0x0321102f}),
9452 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9453 {0x12, 0x90a60160},
9454 {0x14, 0x90170130},
76c2132e
DH
9455 {0x21, 0x02211040}),
9456 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9457 {0x12, 0x90a60160},
9458 {0x14, 0x90170140},
76c2132e
DH
9459 {0x21, 0x02211050}),
9460 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9461 {0x12, 0x90a60170},
9462 {0x14, 0x90170120},
76c2132e
DH
9463 {0x21, 0x02211030}),
9464 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9465 {0x12, 0x90a60170},
9466 {0x14, 0x90170130},
76c2132e 9467 {0x21, 0x02211040}),
0a1f90a9
HW
9468 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9469 {0x12, 0x90a60170},
9470 {0x14, 0x90171130},
9471 {0x21, 0x02211040}),
70658b99 9472 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
70658b99
HW
9473 {0x12, 0x90a60170},
9474 {0x14, 0x90170140},
70658b99 9475 {0x21, 0x02211050}),
9b5a4e39 9476 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9b5a4e39
DH
9477 {0x12, 0x90a60180},
9478 {0x14, 0x90170130},
9b5a4e39 9479 {0x21, 0x02211040}),
f90d83b3
AK
9480 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9481 {0x12, 0x90a60180},
9482 {0x14, 0x90170120},
9483 {0x21, 0x02211030}),
989dbe4a
HW
9484 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9485 {0x1b, 0x01011020},
9486 {0x21, 0x02211010}),
c1732ede
CC
9487 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9488 {0x14, 0x90170110},
9489 {0x1b, 0x90a70130},
9490 {0x21, 0x04211020}),
9491 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9492 {0x14, 0x90170110},
9493 {0x1b, 0x90a70130},
9494 {0x21, 0x03211020}),
a806ef1c
CC
9495 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9496 {0x12, 0x90a60130},
9497 {0x14, 0x90170110},
9498 {0x21, 0x03211020}),
6ac371aa
JHP
9499 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9500 {0x12, 0x90a60130},
9501 {0x14, 0x90170110},
9502 {0x21, 0x04211020}),
e1037354
JHP
9503 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9504 {0x1a, 0x90a70130},
9505 {0x1b, 0x90170110},
9506 {0x21, 0x03211020}),
9e885770
KY
9507 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9508 {0x14, 0x90170110},
9509 {0x19, 0x02a11020},
9510 {0x21, 0x0221101f}),
8a8de09c
KY
9511 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9512 {0x17, 0x90170110},
9513 {0x19, 0x03a11030},
9514 {0x21, 0x03211020}),
cf51eb9d
DH
9515 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9516 {0x12, 0x90a60130},
cf51eb9d
DH
9517 {0x14, 0x90170110},
9518 {0x15, 0x0421101f},
11580297 9519 {0x1a, 0x04a11020}),
0279661b
HW
9520 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9521 {0x12, 0x90a60140},
0279661b
HW
9522 {0x14, 0x90170110},
9523 {0x15, 0x0421101f},
0279661b 9524 {0x18, 0x02811030},
0279661b 9525 {0x1a, 0x04a1103f},
11580297 9526 {0x1b, 0x02011020}),
42304474 9527 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9528 ALC282_STANDARD_PINS,
42304474 9529 {0x12, 0x99a30130},
42304474 9530 {0x19, 0x03a11020},
42304474 9531 {0x21, 0x0321101f}),
2c609999 9532 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9533 ALC282_STANDARD_PINS,
2c609999 9534 {0x12, 0x99a30130},
2c609999 9535 {0x19, 0x03a11020},
2c609999
HW
9536 {0x21, 0x03211040}),
9537 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9538 ALC282_STANDARD_PINS,
2c609999 9539 {0x12, 0x99a30130},
2c609999 9540 {0x19, 0x03a11030},
2c609999
HW
9541 {0x21, 0x03211020}),
9542 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9543 ALC282_STANDARD_PINS,
2c609999 9544 {0x12, 0x99a30130},
2c609999 9545 {0x19, 0x04a11020},
2c609999 9546 {0x21, 0x0421101f}),
200afc09 9547 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
aec856d0 9548 ALC282_STANDARD_PINS,
200afc09 9549 {0x12, 0x90a60140},
200afc09 9550 {0x19, 0x04a11030},
200afc09 9551 {0x21, 0x04211020}),
34cdf405
CC
9552 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9553 ALC282_STANDARD_PINS,
9554 {0x12, 0x90a609c0},
9555 {0x18, 0x03a11830},
9556 {0x19, 0x04a19831},
9557 {0x1a, 0x0481303f},
9558 {0x1b, 0x04211020},
9559 {0x21, 0x0321101f}),
9560 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9561 ALC282_STANDARD_PINS,
9562 {0x12, 0x90a60940},
9563 {0x18, 0x03a11830},
9564 {0x19, 0x04a19831},
9565 {0x1a, 0x0481303f},
9566 {0x1b, 0x04211020},
9567 {0x21, 0x0321101f}),
76c2132e 9568 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9569 ALC282_STANDARD_PINS,
76c2132e 9570 {0x12, 0x90a60130},
76c2132e
DH
9571 {0x21, 0x0321101f}),
9572 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9573 {0x12, 0x90a60160},
9574 {0x14, 0x90170120},
76c2132e 9575 {0x21, 0x02211030}),
bc262179 9576 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9577 ALC282_STANDARD_PINS,
bc262179 9578 {0x12, 0x90a60130},
bc262179 9579 {0x19, 0x03a11020},
bc262179 9580 {0x21, 0x0321101f}),
c8c6ee61 9581 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
266fd994
SL
9582 {0x12, 0x90a60130},
9583 {0x14, 0x90170110},
9584 {0x19, 0x04a11040},
9585 {0x21, 0x04211020}),
9586 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9587 {0x14, 0x90170110},
9588 {0x19, 0x04a11040},
9589 {0x1d, 0x40600001},
9590 {0x21, 0x04211020}),
9591 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
c4cfcf6f
HW
9592 {0x14, 0x90170110},
9593 {0x19, 0x04a11040},
9594 {0x21, 0x04211020}),
c72b9bfe
HW
9595 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9596 {0x14, 0x90170110},
9597 {0x17, 0x90170111},
9598 {0x19, 0x03a11030},
9599 {0x21, 0x03211020}),
33aaebd4
CC
9600 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9601 {0x12, 0x90a60130},
9602 {0x17, 0x90170110},
9603 {0x21, 0x02211020}),
d44a6864 9604 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
e1e62b98 9605 {0x12, 0x90a60120},
e1e62b98 9606 {0x14, 0x90170110},
e1e62b98 9607 {0x21, 0x0321101f}),
e4442bcf 9608 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9609 ALC290_STANDARD_PINS,
e4442bcf 9610 {0x15, 0x04211040},
e4442bcf 9611 {0x18, 0x90170112},
11580297 9612 {0x1a, 0x04a11020}),
e4442bcf 9613 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9614 ALC290_STANDARD_PINS,
e4442bcf 9615 {0x15, 0x04211040},
e4442bcf 9616 {0x18, 0x90170110},
11580297 9617 {0x1a, 0x04a11020}),
e4442bcf 9618 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9619 ALC290_STANDARD_PINS,
e4442bcf 9620 {0x15, 0x0421101f},
11580297 9621 {0x1a, 0x04a11020}),
e4442bcf 9622 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9623 ALC290_STANDARD_PINS,
e4442bcf 9624 {0x15, 0x04211020},
11580297 9625 {0x1a, 0x04a11040}),
e4442bcf 9626 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9627 ALC290_STANDARD_PINS,
e4442bcf
HW
9628 {0x14, 0x90170110},
9629 {0x15, 0x04211020},
11580297 9630 {0x1a, 0x04a11040}),
e4442bcf 9631 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9632 ALC290_STANDARD_PINS,
e4442bcf
HW
9633 {0x14, 0x90170110},
9634 {0x15, 0x04211020},
11580297 9635 {0x1a, 0x04a11020}),
e4442bcf 9636 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9637 ALC290_STANDARD_PINS,
e4442bcf
HW
9638 {0x14, 0x90170110},
9639 {0x15, 0x0421101f},
11580297 9640 {0x1a, 0x04a11020}),
e8818fa8 9641 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 9642 ALC292_STANDARD_PINS,
e8818fa8 9643 {0x12, 0x90a60140},
e8818fa8 9644 {0x16, 0x01014020},
11580297 9645 {0x19, 0x01a19030}),
e8818fa8 9646 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 9647 ALC292_STANDARD_PINS,
e8818fa8 9648 {0x12, 0x90a60140},
e8818fa8
HW
9649 {0x16, 0x01014020},
9650 {0x18, 0x02a19031},
11580297 9651 {0x19, 0x01a1903e}),
76c2132e 9652 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
aec856d0 9653 ALC292_STANDARD_PINS,
11580297 9654 {0x12, 0x90a60140}),
76c2132e 9655 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9656 ALC292_STANDARD_PINS,
76c2132e 9657 {0x13, 0x90a60140},
76c2132e 9658 {0x16, 0x21014020},
11580297 9659 {0x19, 0x21a19030}),
e03fdbde 9660 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9661 ALC292_STANDARD_PINS,
11580297 9662 {0x13, 0x90a60140}),
eeacd80f
JHP
9663 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9664 {0x17, 0x90170110},
9665 {0x21, 0x04211020}),
d8ae458e
CC
9666 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9667 {0x14, 0x90170110},
9668 {0x1b, 0x90a70130},
9669 {0x21, 0x04211020}),
8bb37a2a
JHP
9670 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9671 {0x12, 0x90a60130},
9672 {0x17, 0x90170110},
9673 {0x21, 0x03211020}),
0bea4cc8
JHP
9674 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9675 {0x12, 0x90a60130},
9676 {0x17, 0x90170110},
9677 {0x21, 0x04211020}),
3887c26c
TI
9678 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9679 {0x12, 0x90a60130},
9680 {0x17, 0x90170110},
9681 {0x21, 0x03211020}),
9e43342b 9682 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
ad97d667
JHP
9683 {0x12, 0x90a60120},
9684 {0x17, 0x90170110},
9685 {0x21, 0x04211030}),
9686 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9e43342b
CC
9687 {0x12, 0x90a60130},
9688 {0x17, 0x90170110},
9689 {0x21, 0x03211020}),
9690 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9691 {0x12, 0x90a60130},
9692 {0x17, 0x90170110},
9693 {0x21, 0x03211020}),
fbc57129 9694 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
0a29c57b
KY
9695 {0x14, 0x90170110},
9696 {0x21, 0x04211020}),
fbc57129
KY
9697 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9698 {0x14, 0x90170110},
9699 {0x21, 0x04211030}),
3f640970 9700 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
f771d5bb
HW
9701 ALC295_STANDARD_PINS,
9702 {0x17, 0x21014020},
9703 {0x18, 0x21a19030}),
9704 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9705 ALC295_STANDARD_PINS,
9706 {0x17, 0x21014040},
9707 {0x18, 0x21a19050}),
3f307834
HW
9708 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9709 ALC295_STANDARD_PINS),
9f502ff5
TI
9710 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9711 ALC298_STANDARD_PINS,
9712 {0x17, 0x90170110}),
977e6276 9713 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
703867e2
WS
9714 ALC298_STANDARD_PINS,
9715 {0x17, 0x90170140}),
9716 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9717 ALC298_STANDARD_PINS,
9f502ff5 9718 {0x17, 0x90170150}),
9f1bc2c4
KHF
9719 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9720 {0x12, 0xb7a60140},
9721 {0x13, 0xb7a60150},
9722 {0x17, 0x90170110},
9723 {0x1a, 0x03011020},
9724 {0x21, 0x03211030}),
54324221
JM
9725 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9726 {0x12, 0xb7a60140},
9727 {0x17, 0x90170110},
9728 {0x1a, 0x03a11030},
9729 {0x21, 0x03211020}),
fcc6c877
KY
9730 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9731 ALC225_STANDARD_PINS,
9732 {0x12, 0xb7a60130},
fcc6c877 9733 {0x17, 0x90170110}),
573fcbfd
HW
9734 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9735 {0x14, 0x01014010},
9736 {0x17, 0x90170120},
9737 {0x18, 0x02a11030},
9738 {0x19, 0x02a1103f},
9739 {0x21, 0x0221101f}),
e1918938
HW
9740 {}
9741};
6dda9f4a 9742
7c0a6939
HW
9743/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9744 * more machines, don't need to match all valid pins, just need to match
9745 * all the pins defined in the tbl. Just because of this reason, it is possible
9746 * that a single machine matches multiple tbls, so there is one limitation:
9747 * at most one tbl is allowed to define for the same vendor and same codec
9748 */
9749static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9750 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9751 {0x19, 0x40000000},
9752 {0x1b, 0x40000000}),
aed8c7f4
HW
9753 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9754 {0x19, 0x40000000},
9755 {0x1a, 0x40000000}),
d64ebdbf
HW
9756 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9757 {0x19, 0x40000000},
9758 {0x1a, 0x40000000}),
5815bdfd
HW
9759 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9760 {0x19, 0x40000000},
9761 {0x1a, 0x40000000}),
7c0a6939
HW
9762 {}
9763};
9764
546bb678 9765static void alc269_fill_coef(struct hda_codec *codec)
1d045db9 9766{
526af6eb 9767 struct alc_spec *spec = codec->spec;
1d045db9 9768 int val;
ebb83eeb 9769
526af6eb 9770 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
546bb678 9771 return;
526af6eb 9772
1bb7e43e 9773 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
1d045db9
TI
9774 alc_write_coef_idx(codec, 0xf, 0x960b);
9775 alc_write_coef_idx(codec, 0xe, 0x8817);
9776 }
ebb83eeb 9777
1bb7e43e 9778 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
1d045db9
TI
9779 alc_write_coef_idx(codec, 0xf, 0x960b);
9780 alc_write_coef_idx(codec, 0xe, 0x8814);
9781 }
ebb83eeb 9782
1bb7e43e 9783 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9 9784 /* Power up output pin */
98b24883 9785 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
1d045db9 9786 }
ebb83eeb 9787
1bb7e43e 9788 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9 9789 val = alc_read_coef_idx(codec, 0xd);
f3ee07d8 9790 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
1d045db9
TI
9791 /* Capless ramp up clock control */
9792 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9793 }
9794 val = alc_read_coef_idx(codec, 0x17);
f3ee07d8 9795 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
1d045db9
TI
9796 /* Class D power on reset */
9797 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9798 }
9799 }
ebb83eeb 9800
98b24883
TI
9801 /* HP */
9802 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
1d045db9 9803}
a7f2371f 9804
1d045db9
TI
9805/*
9806 */
1d045db9
TI
9807static int patch_alc269(struct hda_codec *codec)
9808{
9809 struct alc_spec *spec;
3de95173 9810 int err;
f1d4e28b 9811
3de95173 9812 err = alc_alloc_spec(codec, 0x0b);
e16fb6d1 9813 if (err < 0)
3de95173
TI
9814 return err;
9815
9816 spec = codec->spec;
08c189f2 9817 spec->gen.shared_mic_vref_pin = 0x18;
317d9313 9818 codec->power_save_node = 0;
e16fb6d1 9819
225068ab
TI
9820#ifdef CONFIG_PM
9821 codec->patch_ops.suspend = alc269_suspend;
9822 codec->patch_ops.resume = alc269_resume;
9823#endif
c2d6af53
KY
9824 spec->shutup = alc_default_shutup;
9825 spec->init_hook = alc_default_init;
225068ab 9826
7639a06c 9827 switch (codec->core.vendor_id) {
065380f0 9828 case 0x10ec0269:
1d045db9 9829 spec->codec_variant = ALC269_TYPE_ALC269VA;
1bb7e43e
TI
9830 switch (alc_get_coef0(codec) & 0x00f0) {
9831 case 0x0010:
5100cd07
TI
9832 if (codec->bus->pci &&
9833 codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 9834 spec->cdefine.platform_type == 1)
20ca0c35 9835 err = alc_codec_rename(codec, "ALC271X");
1d045db9 9836 spec->codec_variant = ALC269_TYPE_ALC269VB;
1bb7e43e
TI
9837 break;
9838 case 0x0020:
5100cd07
TI
9839 if (codec->bus->pci &&
9840 codec->bus->pci->subsystem_vendor == 0x17aa &&
e16fb6d1 9841 codec->bus->pci->subsystem_device == 0x21f3)
20ca0c35 9842 err = alc_codec_rename(codec, "ALC3202");
1d045db9 9843 spec->codec_variant = ALC269_TYPE_ALC269VC;
1bb7e43e 9844 break;
adcc70b2
KY
9845 case 0x0030:
9846 spec->codec_variant = ALC269_TYPE_ALC269VD;
9847 break;
1bb7e43e 9848 default:
1d045db9 9849 alc_fix_pll_init(codec, 0x20, 0x04, 15);
1bb7e43e 9850 }
e16fb6d1
TI
9851 if (err < 0)
9852 goto error;
c2d6af53 9853 spec->shutup = alc269_shutup;
546bb678 9854 spec->init_hook = alc269_fill_coef;
1d045db9 9855 alc269_fill_coef(codec);
065380f0
KY
9856 break;
9857
9858 case 0x10ec0280:
9859 case 0x10ec0290:
9860 spec->codec_variant = ALC269_TYPE_ALC280;
9861 break;
9862 case 0x10ec0282:
065380f0 9863 spec->codec_variant = ALC269_TYPE_ALC282;
7b5c7a02
KY
9864 spec->shutup = alc282_shutup;
9865 spec->init_hook = alc282_init;
065380f0 9866 break;
2af02be7
KY
9867 case 0x10ec0233:
9868 case 0x10ec0283:
9869 spec->codec_variant = ALC269_TYPE_ALC283;
9870 spec->shutup = alc283_shutup;
9871 spec->init_hook = alc283_init;
9872 break;
065380f0
KY
9873 case 0x10ec0284:
9874 case 0x10ec0292:
9875 spec->codec_variant = ALC269_TYPE_ALC284;
9876 break;
161ebf29 9877 case 0x10ec0293:
4731d5de 9878 spec->codec_variant = ALC269_TYPE_ALC293;
161ebf29 9879 break;
7fc7d047 9880 case 0x10ec0286:
7c665932 9881 case 0x10ec0288:
7fc7d047
KY
9882 spec->codec_variant = ALC269_TYPE_ALC286;
9883 break;
506b62c3
KY
9884 case 0x10ec0298:
9885 spec->codec_variant = ALC269_TYPE_ALC298;
9886 break;
ea04a1db 9887 case 0x10ec0235:
1d04c9de
KY
9888 case 0x10ec0255:
9889 spec->codec_variant = ALC269_TYPE_ALC255;
ab3b8e51
KY
9890 spec->shutup = alc256_shutup;
9891 spec->init_hook = alc256_init;
1d04c9de 9892 break;
1948fc06 9893 case 0x10ec0230:
736f20a7 9894 case 0x10ec0236:
4344aec8
KY
9895 case 0x10ec0256:
9896 spec->codec_variant = ALC269_TYPE_ALC256;
4a219ef8
KY
9897 spec->shutup = alc256_shutup;
9898 spec->init_hook = alc256_init;
7d1b6e29 9899 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
4344aec8 9900 break;
f429e7e4
KY
9901 case 0x10ec0257:
9902 spec->codec_variant = ALC269_TYPE_ALC257;
88d42b2b
KY
9903 spec->shutup = alc256_shutup;
9904 spec->init_hook = alc256_init;
f429e7e4
KY
9905 spec->gen.mixer_nid = 0;
9906 break;
0a6f0600 9907 case 0x10ec0215:
7fbdcd83 9908 case 0x10ec0245:
0a6f0600
KY
9909 case 0x10ec0285:
9910 case 0x10ec0289:
9911 spec->codec_variant = ALC269_TYPE_ALC215;
1b6832be
KY
9912 spec->shutup = alc225_shutup;
9913 spec->init_hook = alc225_init;
0a6f0600
KY
9914 spec->gen.mixer_nid = 0;
9915 break;
4231430d 9916 case 0x10ec0225:
7d727869 9917 case 0x10ec0295:
28f1f9b2 9918 case 0x10ec0299:
4231430d 9919 spec->codec_variant = ALC269_TYPE_ALC225;
da911b1f
KY
9920 spec->shutup = alc225_shutup;
9921 spec->init_hook = alc225_init;
c1350bff 9922 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
4231430d 9923 break;
99cee034
KY
9924 case 0x10ec0287:
9925 spec->codec_variant = ALC269_TYPE_ALC287;
9926 spec->shutup = alc225_shutup;
9927 spec->init_hook = alc225_init;
9928 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
9929 break;
dcd4f0db
KY
9930 case 0x10ec0234:
9931 case 0x10ec0274:
9932 case 0x10ec0294:
9933 spec->codec_variant = ALC269_TYPE_ALC294;
532a7784 9934 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
71683c32 9935 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
693abe11 9936 spec->init_hook = alc294_init;
dcd4f0db 9937 break;
1078bef0
KY
9938 case 0x10ec0300:
9939 spec->codec_variant = ALC269_TYPE_ALC300;
9940 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
dcd4f0db 9941 break;
f0778871
KY
9942 case 0x10ec0623:
9943 spec->codec_variant = ALC269_TYPE_ALC623;
9944 break;
6fbae35a
KY
9945 case 0x10ec0700:
9946 case 0x10ec0701:
9947 case 0x10ec0703:
83629532 9948 case 0x10ec0711:
6fbae35a
KY
9949 spec->codec_variant = ALC269_TYPE_ALC700;
9950 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
2d7fe618 9951 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
693abe11 9952 spec->init_hook = alc294_init;
6fbae35a
KY
9953 break;
9954
1d045db9 9955 }
6dda9f4a 9956
ad60d502 9957 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
97a26570 9958 spec->has_alc5505_dsp = 1;
ad60d502
KY
9959 spec->init_hook = alc5505_dsp_init;
9960 }
9961
c9af753f
TI
9962 alc_pre_init(codec);
9963
efe55732
TI
9964 snd_hda_pick_fixup(codec, alc269_fixup_models,
9965 alc269_fixup_tbl, alc269_fixups);
13d9c6b9
TI
9966 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
9967 * the quirk breaks the latter (bko#214101).
9968 * Clear the wrong entry.
9969 */
9970 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
9971 codec->core.vendor_id == 0x10ec0294) {
9972 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
9973 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
9974 }
9975
0fc1e447 9976 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
7c0a6939 9977 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
efe55732
TI
9978 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
9979 alc269_fixups);
9980 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9981
9982 alc_auto_parse_customize_define(codec);
9983
9984 if (has_cdefine_beep(codec))
9985 spec->gen.beep_nid = 0x01;
9986
a4297b5d
TI
9987 /* automatic parse from the BIOS config */
9988 err = alc269_parse_auto_config(codec);
e16fb6d1
TI
9989 if (err < 0)
9990 goto error;
6dda9f4a 9991
fea80fae
TI
9992 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
9993 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
9994 if (err < 0)
9995 goto error;
9996 }
f1d4e28b 9997
1727a771 9998 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 9999
1d045db9 10000 return 0;
e16fb6d1
TI
10001
10002 error:
10003 alc_free(codec);
10004 return err;
1d045db9 10005}
f1d4e28b 10006
1d045db9
TI
10007/*
10008 * ALC861
10009 */
622e84cd 10010
1d045db9 10011static int alc861_parse_auto_config(struct hda_codec *codec)
6dda9f4a 10012{
1d045db9 10013 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10014 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
10015 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
604401a9
TI
10016}
10017
1d045db9
TI
10018/* Pin config fixes */
10019enum {
e652f4c8
TI
10020 ALC861_FIXUP_FSC_AMILO_PI1505,
10021 ALC861_FIXUP_AMP_VREF_0F,
10022 ALC861_FIXUP_NO_JACK_DETECT,
10023 ALC861_FIXUP_ASUS_A6RP,
6ddf0fd1 10024 ALC660_FIXUP_ASUS_W7J,
1d045db9 10025};
7085ec12 10026
31150f23
TI
10027/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
10028static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
1727a771 10029 const struct hda_fixup *fix, int action)
31150f23
TI
10030{
10031 struct alc_spec *spec = codec->spec;
10032 unsigned int val;
10033
1727a771 10034 if (action != HDA_FIXUP_ACT_INIT)
31150f23 10035 return;
d3f02d60 10036 val = snd_hda_codec_get_pin_target(codec, 0x0f);
31150f23
TI
10037 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
10038 val |= AC_PINCTL_IN_EN;
10039 val |= AC_PINCTL_VREF_50;
cdd03ced 10040 snd_hda_set_pin_ctl(codec, 0x0f, val);
08c189f2 10041 spec->gen.keep_vref_in_automute = 1;
31150f23
TI
10042}
10043
e652f4c8
TI
10044/* suppress the jack-detection */
10045static void alc_fixup_no_jack_detect(struct hda_codec *codec,
1727a771 10046 const struct hda_fixup *fix, int action)
e652f4c8 10047{
1727a771 10048 if (action == HDA_FIXUP_ACT_PRE_PROBE)
e652f4c8 10049 codec->no_jack_detect = 1;
7d7eb9ea 10050}
e652f4c8 10051
1727a771 10052static const struct hda_fixup alc861_fixups[] = {
e652f4c8 10053 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
1727a771
TI
10054 .type = HDA_FIXUP_PINS,
10055 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
10056 { 0x0b, 0x0221101f }, /* HP */
10057 { 0x0f, 0x90170310 }, /* speaker */
10058 { }
10059 }
10060 },
e652f4c8 10061 [ALC861_FIXUP_AMP_VREF_0F] = {
1727a771 10062 .type = HDA_FIXUP_FUNC,
31150f23 10063 .v.func = alc861_fixup_asus_amp_vref_0f,
3b25eb69 10064 },
e652f4c8 10065 [ALC861_FIXUP_NO_JACK_DETECT] = {
1727a771 10066 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
10067 .v.func = alc_fixup_no_jack_detect,
10068 },
10069 [ALC861_FIXUP_ASUS_A6RP] = {
1727a771 10070 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
10071 .v.func = alc861_fixup_asus_amp_vref_0f,
10072 .chained = true,
10073 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
6ddf0fd1
TI
10074 },
10075 [ALC660_FIXUP_ASUS_W7J] = {
10076 .type = HDA_FIXUP_VERBS,
10077 .v.verbs = (const struct hda_verb[]) {
10078 /* ASUS W7J needs a magic pin setup on unused NID 0x10
10079 * for enabling outputs
10080 */
10081 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10082 { }
10083 },
e652f4c8 10084 }
1d045db9 10085};
7085ec12 10086
1d045db9 10087static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6ddf0fd1 10088 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
e7ca237b 10089 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
e652f4c8
TI
10090 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
10091 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
10092 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
defce244 10093 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
e652f4c8 10094 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
1d045db9
TI
10095 {}
10096};
3af9ee6b 10097
1d045db9
TI
10098/*
10099 */
1d045db9 10100static int patch_alc861(struct hda_codec *codec)
7085ec12 10101{
1d045db9 10102 struct alc_spec *spec;
1d045db9 10103 int err;
7085ec12 10104
3de95173
TI
10105 err = alc_alloc_spec(codec, 0x15);
10106 if (err < 0)
10107 return err;
1d045db9 10108
3de95173 10109 spec = codec->spec;
2722b535
TI
10110 if (has_cdefine_beep(codec))
10111 spec->gen.beep_nid = 0x23;
1d045db9 10112
225068ab
TI
10113#ifdef CONFIG_PM
10114 spec->power_hook = alc_power_eapd;
10115#endif
10116
c9af753f
TI
10117 alc_pre_init(codec);
10118
1727a771
TI
10119 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10120 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3af9ee6b 10121
cb4e4824
TI
10122 /* automatic parse from the BIOS config */
10123 err = alc861_parse_auto_config(codec);
e16fb6d1
TI
10124 if (err < 0)
10125 goto error;
3af9ee6b 10126
fea80fae
TI
10127 if (!spec->gen.no_analog) {
10128 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
10129 if (err < 0)
10130 goto error;
10131 }
7085ec12 10132
1727a771 10133 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10134
1d045db9 10135 return 0;
e16fb6d1
TI
10136
10137 error:
10138 alc_free(codec);
10139 return err;
7085ec12
TI
10140}
10141
1d045db9
TI
10142/*
10143 * ALC861-VD support
10144 *
10145 * Based on ALC882
10146 *
10147 * In addition, an independent DAC
10148 */
1d045db9 10149static int alc861vd_parse_auto_config(struct hda_codec *codec)
bc9f98a9 10150{
1d045db9 10151 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10152 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10153 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
ce764ab2
TI
10154}
10155
1d045db9 10156enum {
8fdcb6fe
TI
10157 ALC660VD_FIX_ASUS_GPIO1,
10158 ALC861VD_FIX_DALLAS,
1d045db9 10159};
ce764ab2 10160
8fdcb6fe
TI
10161/* exclude VREF80 */
10162static void alc861vd_fixup_dallas(struct hda_codec *codec,
1727a771 10163 const struct hda_fixup *fix, int action)
8fdcb6fe 10164{
1727a771 10165 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
b78562b1
TI
10166 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10167 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
8fdcb6fe
TI
10168 }
10169}
10170
df73d83f
TI
10171/* reset GPIO1 */
10172static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10173 const struct hda_fixup *fix, int action)
10174{
10175 struct alc_spec *spec = codec->spec;
10176
10177 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10178 spec->gpio_mask |= 0x02;
10179 alc_fixup_gpio(codec, action, 0x01);
10180}
10181
1727a771 10182static const struct hda_fixup alc861vd_fixups[] = {
1d045db9 10183 [ALC660VD_FIX_ASUS_GPIO1] = {
df73d83f
TI
10184 .type = HDA_FIXUP_FUNC,
10185 .v.func = alc660vd_fixup_asus_gpio1,
1d045db9 10186 },
8fdcb6fe 10187 [ALC861VD_FIX_DALLAS] = {
1727a771 10188 .type = HDA_FIXUP_FUNC,
8fdcb6fe
TI
10189 .v.func = alc861vd_fixup_dallas,
10190 },
1d045db9 10191};
ce764ab2 10192
1d045db9 10193static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
8fdcb6fe 10194 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
1d045db9 10195 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
8fdcb6fe 10196 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
1d045db9
TI
10197 {}
10198};
ce764ab2 10199
1d045db9
TI
10200/*
10201 */
1d045db9 10202static int patch_alc861vd(struct hda_codec *codec)
ce764ab2 10203{
1d045db9 10204 struct alc_spec *spec;
cb4e4824 10205 int err;
ce764ab2 10206
3de95173
TI
10207 err = alc_alloc_spec(codec, 0x0b);
10208 if (err < 0)
10209 return err;
1d045db9 10210
3de95173 10211 spec = codec->spec;
2722b535
TI
10212 if (has_cdefine_beep(codec))
10213 spec->gen.beep_nid = 0x23;
1d045db9 10214
225068ab
TI
10215 spec->shutup = alc_eapd_shutup;
10216
c9af753f
TI
10217 alc_pre_init(codec);
10218
1727a771
TI
10219 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10220 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1d045db9 10221
cb4e4824
TI
10222 /* automatic parse from the BIOS config */
10223 err = alc861vd_parse_auto_config(codec);
e16fb6d1
TI
10224 if (err < 0)
10225 goto error;
ce764ab2 10226
fea80fae
TI
10227 if (!spec->gen.no_analog) {
10228 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10229 if (err < 0)
10230 goto error;
10231 }
1d045db9 10232
1727a771 10233 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10234
ce764ab2 10235 return 0;
e16fb6d1
TI
10236
10237 error:
10238 alc_free(codec);
10239 return err;
ce764ab2
TI
10240}
10241
1d045db9
TI
10242/*
10243 * ALC662 support
10244 *
10245 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10246 * configuration. Each pin widget can choose any input DACs and a mixer.
10247 * Each ADC is connected from a mixer of all inputs. This makes possible
10248 * 6-channel independent captures.
10249 *
10250 * In addition, an independent DAC for the multi-playback (not used in this
10251 * driver yet).
10252 */
1d045db9
TI
10253
10254/*
10255 * BIOS auto configuration
10256 */
10257
bc9f98a9
KY
10258static int alc662_parse_auto_config(struct hda_codec *codec)
10259{
4c6d72d1 10260 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10261 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10262 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10263 const hda_nid_t *ssids;
ee979a14 10264
7639a06c
TI
10265 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10266 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10267 codec->core.vendor_id == 0x10ec0671)
3e6179b8 10268 ssids = alc663_ssids;
6227cdce 10269 else
3e6179b8
TI
10270 ssids = alc662_ssids;
10271 return alc_parse_auto_config(codec, alc662_ignore, ssids);
bc9f98a9
KY
10272}
10273
6be7948f 10274static void alc272_fixup_mario(struct hda_codec *codec,
1727a771 10275 const struct hda_fixup *fix, int action)
6fc398cb 10276{
9bb1f06f 10277 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6fc398cb 10278 return;
6be7948f
TB
10279 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10280 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10281 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10282 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10283 (0 << AC_AMPCAP_MUTE_SHIFT)))
4e76a883 10284 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
6be7948f
TB
10285}
10286
8e383953
TI
10287static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10288 { .channels = 2,
10289 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10290 { .channels = 4,
10291 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10292 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10293 { }
10294};
10295
10296/* override the 2.1 chmap */
eb9ca3ab 10297static void alc_fixup_bass_chmap(struct hda_codec *codec,
8e383953
TI
10298 const struct hda_fixup *fix, int action)
10299{
10300 if (action == HDA_FIXUP_ACT_BUILD) {
10301 struct alc_spec *spec = codec->spec;
bbbc7e85 10302 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8e383953
TI
10303 }
10304}
10305
bf68665d
TI
10306/* avoid D3 for keeping GPIO up */
10307static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10308 hda_nid_t nid,
10309 unsigned int power_state)
10310{
10311 struct alc_spec *spec = codec->spec;
d261eec8 10312 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
bf68665d
TI
10313 return AC_PWRST_D0;
10314 return power_state;
10315}
10316
3e887f37
TI
10317static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10318 const struct hda_fixup *fix, int action)
10319{
10320 struct alc_spec *spec = codec->spec;
3e887f37 10321
01e4a275 10322 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
3e887f37 10323 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19 10324 spec->mute_led_polarity = 1;
bf68665d 10325 codec->power_filter = gpio_led_power_filter;
3e887f37
TI
10326 }
10327}
10328
c6790c8e
KY
10329static void alc662_usi_automute_hook(struct hda_codec *codec,
10330 struct hda_jack_callback *jack)
10331{
10332 struct alc_spec *spec = codec->spec;
10333 int vref;
10334 msleep(200);
10335 snd_hda_gen_hp_automute(codec, jack);
10336
10337 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10338 msleep(100);
10339 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10340 vref);
10341}
10342
10343static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10344 const struct hda_fixup *fix, int action)
10345{
10346 struct alc_spec *spec = codec->spec;
10347 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10348 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10349 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10350 }
10351}
10352
00066e97
SB
10353static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10354 struct hda_jack_callback *cb)
10355{
10356 /* surround speakers at 0x1b already get muted automatically when
10357 * headphones are plugged in, but we have to mute/unmute the remaining
10358 * channels manually:
10359 * 0x15 - front left/front right
10360 * 0x18 - front center/ LFE
10361 */
10362 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10363 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10364 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10365 } else {
10366 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10367 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10368 }
10369}
10370
10371static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10372 const struct hda_fixup *fix, int action)
10373{
10374 /* Pin 0x1b: shared headphones jack and surround speakers */
10375 if (!is_jack_detectable(codec, 0x1b))
10376 return;
10377
10378 switch (action) {
10379 case HDA_FIXUP_ACT_PRE_PROBE:
10380 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10381 alc662_aspire_ethos_mute_speakers);
336820c4
TI
10382 /* subwoofer needs an extra GPIO setting to become audible */
10383 alc_setup_gpio(codec, 0x02);
00066e97
SB
10384 break;
10385 case HDA_FIXUP_ACT_INIT:
10386 /* Make sure to start in a correct state, i.e. if
10387 * headphones have been plugged in before powering up the system
10388 */
10389 alc662_aspire_ethos_mute_speakers(codec, NULL);
10390 break;
10391 }
10392}
10393
5af29028
KY
10394static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10395 const struct hda_fixup *fix, int action)
10396{
10397 struct alc_spec *spec = codec->spec;
10398
10399 static const struct hda_pintbl pincfgs[] = {
10400 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10401 { 0x1b, 0x0181304f },
10402 { }
10403 };
10404
10405 switch (action) {
10406 case HDA_FIXUP_ACT_PRE_PROBE:
10407 spec->gen.mixer_nid = 0;
10408 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10409 snd_hda_apply_pincfgs(codec, pincfgs);
10410 break;
10411 case HDA_FIXUP_ACT_INIT:
10412 alc_write_coef_idx(codec, 0x19, 0xa054);
10413 break;
10414 }
10415}
10416
d7f32791
KY
10417static void alc897_hp_automute_hook(struct hda_codec *codec,
10418 struct hda_jack_callback *jack)
10419{
10420 struct alc_spec *spec = codec->spec;
10421 int vref;
10422
10423 snd_hda_gen_hp_automute(codec, jack);
10424 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10425 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10426 vref);
10427}
10428
10429static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10430 const struct hda_fixup *fix, int action)
10431{
10432 struct alc_spec *spec = codec->spec;
10433 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10434 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10435 }
10436}
10437
6b0f95c4 10438static const struct coef_fw alc668_coefs[] = {
f3f9185f
KY
10439 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10440 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10441 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10442 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10443 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10444 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10445 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10446 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10447 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10448 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10449 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10450 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10451 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10452 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10453 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10454 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10455 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10456 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10457 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10458 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10459 {}
10460};
10461
10462static void alc668_restore_default_value(struct hda_codec *codec)
10463{
10464 alc_process_coef_fw(codec, alc668_coefs);
10465}
10466
6cb3b707 10467enum {
2df03514 10468 ALC662_FIXUP_ASPIRE,
3e887f37 10469 ALC662_FIXUP_LED_GPIO1,
6cb3b707 10470 ALC662_FIXUP_IDEAPAD,
6be7948f 10471 ALC272_FIXUP_MARIO,
f1ec5be1 10472 ALC662_FIXUP_CZC_ET26,
d2ebd479 10473 ALC662_FIXUP_CZC_P10T,
94024cd1 10474 ALC662_FIXUP_SKU_IGNORE,
e59ea3ed 10475 ALC662_FIXUP_HP_RP5800,
53c334ad
TI
10476 ALC662_FIXUP_ASUS_MODE1,
10477 ALC662_FIXUP_ASUS_MODE2,
10478 ALC662_FIXUP_ASUS_MODE3,
10479 ALC662_FIXUP_ASUS_MODE4,
10480 ALC662_FIXUP_ASUS_MODE5,
10481 ALC662_FIXUP_ASUS_MODE6,
10482 ALC662_FIXUP_ASUS_MODE7,
10483 ALC662_FIXUP_ASUS_MODE8,
1565cc35 10484 ALC662_FIXUP_NO_JACK_DETECT,
edfe3bfc 10485 ALC662_FIXUP_ZOTAC_Z68,
125821ae 10486 ALC662_FIXUP_INV_DMIC,
1f8b46cd 10487 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
73bdd597 10488 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 10489 ALC662_FIXUP_HEADSET_MODE,
73bdd597 10490 ALC668_FIXUP_HEADSET_MODE,
8e54b4ac 10491 ALC662_FIXUP_BASS_MODE4_CHMAP,
61a75f13 10492 ALC662_FIXUP_BASS_16,
a30c9aaa 10493 ALC662_FIXUP_BASS_1A,
8e54b4ac 10494 ALC662_FIXUP_BASS_CHMAP,
493a52a9 10495 ALC668_FIXUP_AUTO_MUTE,
5e6db669 10496 ALC668_FIXUP_DELL_DISABLE_AAMIX,
033b0a7c 10497 ALC668_FIXUP_DELL_XPS13,
9d4dc584 10498 ALC662_FIXUP_ASUS_Nx50,
fc7438b1 10499 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 10500 ALC668_FIXUP_ASUS_Nx51,
5b7c5e1f 10501 ALC668_FIXUP_MIC_COEF,
11ba6111 10502 ALC668_FIXUP_ASUS_G751,
78f4f7c2
KY
10503 ALC891_FIXUP_HEADSET_MODE,
10504 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9b51fe3e 10505 ALC662_FIXUP_ACER_VERITON,
1a3f0991 10506 ALC892_FIXUP_ASROCK_MOBO,
c6790c8e
KY
10507 ALC662_FIXUP_USI_FUNC,
10508 ALC662_FIXUP_USI_HEADSET_MODE,
ca169cc2 10509 ALC662_FIXUP_LENOVO_MULTI_CODECS,
00066e97 10510 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
00066e97 10511 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
5af29028 10512 ALC671_FIXUP_HP_HEADSET_MIC2,
d858c706 10513 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
a124458a 10514 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
a3fd1a98
HW
10515 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10516 ALC668_FIXUP_HEADSET_MIC,
10517 ALC668_FIXUP_MIC_DET_COEF,
d7f32791
KY
10518 ALC897_FIXUP_LENOVO_HEADSET_MIC,
10519 ALC897_FIXUP_HEADSET_MIC_PIN,
6cb3b707
DH
10520};
10521
1727a771 10522static const struct hda_fixup alc662_fixups[] = {
2df03514 10523 [ALC662_FIXUP_ASPIRE] = {
1727a771
TI
10524 .type = HDA_FIXUP_PINS,
10525 .v.pins = (const struct hda_pintbl[]) {
2df03514
DC
10526 { 0x15, 0x99130112 }, /* subwoofer */
10527 { }
10528 }
10529 },
3e887f37
TI
10530 [ALC662_FIXUP_LED_GPIO1] = {
10531 .type = HDA_FIXUP_FUNC,
10532 .v.func = alc662_fixup_led_gpio1,
10533 },
6cb3b707 10534 [ALC662_FIXUP_IDEAPAD] = {
1727a771
TI
10535 .type = HDA_FIXUP_PINS,
10536 .v.pins = (const struct hda_pintbl[]) {
6cb3b707
DH
10537 { 0x17, 0x99130112 }, /* subwoofer */
10538 { }
3e887f37
TI
10539 },
10540 .chained = true,
10541 .chain_id = ALC662_FIXUP_LED_GPIO1,
6cb3b707 10542 },
6be7948f 10543 [ALC272_FIXUP_MARIO] = {
1727a771 10544 .type = HDA_FIXUP_FUNC,
b5bfbc67 10545 .v.func = alc272_fixup_mario,
d2ebd479 10546 },
f1ec5be1
HC
10547 [ALC662_FIXUP_CZC_ET26] = {
10548 .type = HDA_FIXUP_PINS,
10549 .v.pins = (const struct hda_pintbl[]) {
10550 {0x12, 0x403cc000},
10551 {0x14, 0x90170110}, /* speaker */
10552 {0x15, 0x411111f0},
10553 {0x16, 0x411111f0},
10554 {0x18, 0x01a19030}, /* mic */
10555 {0x19, 0x90a7013f}, /* int-mic */
10556 {0x1a, 0x01014020},
10557 {0x1b, 0x0121401f},
10558 {0x1c, 0x411111f0},
10559 {0x1d, 0x411111f0},
10560 {0x1e, 0x40478e35},
10561 {}
10562 },
10563 .chained = true,
10564 .chain_id = ALC662_FIXUP_SKU_IGNORE
10565 },
d2ebd479 10566 [ALC662_FIXUP_CZC_P10T] = {
1727a771 10567 .type = HDA_FIXUP_VERBS,
d2ebd479
AA
10568 .v.verbs = (const struct hda_verb[]) {
10569 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10570 {}
10571 }
10572 },
94024cd1 10573 [ALC662_FIXUP_SKU_IGNORE] = {
1727a771 10574 .type = HDA_FIXUP_FUNC,
23d30f28 10575 .v.func = alc_fixup_sku_ignore,
c6b35874 10576 },
e59ea3ed 10577 [ALC662_FIXUP_HP_RP5800] = {
1727a771
TI
10578 .type = HDA_FIXUP_PINS,
10579 .v.pins = (const struct hda_pintbl[]) {
e59ea3ed
TI
10580 { 0x14, 0x0221201f }, /* HP out */
10581 { }
10582 },
10583 .chained = true,
10584 .chain_id = ALC662_FIXUP_SKU_IGNORE
10585 },
53c334ad 10586 [ALC662_FIXUP_ASUS_MODE1] = {
1727a771
TI
10587 .type = HDA_FIXUP_PINS,
10588 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10589 { 0x14, 0x99130110 }, /* speaker */
10590 { 0x18, 0x01a19c20 }, /* mic */
10591 { 0x19, 0x99a3092f }, /* int-mic */
10592 { 0x21, 0x0121401f }, /* HP out */
10593 { }
10594 },
10595 .chained = true,
10596 .chain_id = ALC662_FIXUP_SKU_IGNORE
10597 },
10598 [ALC662_FIXUP_ASUS_MODE2] = {
1727a771
TI
10599 .type = HDA_FIXUP_PINS,
10600 .v.pins = (const struct hda_pintbl[]) {
2996bdba
TI
10601 { 0x14, 0x99130110 }, /* speaker */
10602 { 0x18, 0x01a19820 }, /* mic */
10603 { 0x19, 0x99a3092f }, /* int-mic */
10604 { 0x1b, 0x0121401f }, /* HP out */
10605 { }
10606 },
53c334ad
TI
10607 .chained = true,
10608 .chain_id = ALC662_FIXUP_SKU_IGNORE
10609 },
10610 [ALC662_FIXUP_ASUS_MODE3] = {
1727a771
TI
10611 .type = HDA_FIXUP_PINS,
10612 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10613 { 0x14, 0x99130110 }, /* speaker */
10614 { 0x15, 0x0121441f }, /* HP */
10615 { 0x18, 0x01a19840 }, /* mic */
10616 { 0x19, 0x99a3094f }, /* int-mic */
10617 { 0x21, 0x01211420 }, /* HP2 */
10618 { }
10619 },
10620 .chained = true,
10621 .chain_id = ALC662_FIXUP_SKU_IGNORE
10622 },
10623 [ALC662_FIXUP_ASUS_MODE4] = {
1727a771
TI
10624 .type = HDA_FIXUP_PINS,
10625 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10626 { 0x14, 0x99130110 }, /* speaker */
10627 { 0x16, 0x99130111 }, /* speaker */
10628 { 0x18, 0x01a19840 }, /* mic */
10629 { 0x19, 0x99a3094f }, /* int-mic */
10630 { 0x21, 0x0121441f }, /* HP */
10631 { }
10632 },
10633 .chained = true,
10634 .chain_id = ALC662_FIXUP_SKU_IGNORE
10635 },
10636 [ALC662_FIXUP_ASUS_MODE5] = {
1727a771
TI
10637 .type = HDA_FIXUP_PINS,
10638 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10639 { 0x14, 0x99130110 }, /* speaker */
10640 { 0x15, 0x0121441f }, /* HP */
10641 { 0x16, 0x99130111 }, /* speaker */
10642 { 0x18, 0x01a19840 }, /* mic */
10643 { 0x19, 0x99a3094f }, /* int-mic */
10644 { }
10645 },
10646 .chained = true,
10647 .chain_id = ALC662_FIXUP_SKU_IGNORE
10648 },
10649 [ALC662_FIXUP_ASUS_MODE6] = {
1727a771
TI
10650 .type = HDA_FIXUP_PINS,
10651 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10652 { 0x14, 0x99130110 }, /* speaker */
10653 { 0x15, 0x01211420 }, /* HP2 */
10654 { 0x18, 0x01a19840 }, /* mic */
10655 { 0x19, 0x99a3094f }, /* int-mic */
10656 { 0x1b, 0x0121441f }, /* HP */
10657 { }
10658 },
10659 .chained = true,
10660 .chain_id = ALC662_FIXUP_SKU_IGNORE
10661 },
10662 [ALC662_FIXUP_ASUS_MODE7] = {
1727a771
TI
10663 .type = HDA_FIXUP_PINS,
10664 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10665 { 0x14, 0x99130110 }, /* speaker */
10666 { 0x17, 0x99130111 }, /* speaker */
10667 { 0x18, 0x01a19840 }, /* mic */
10668 { 0x19, 0x99a3094f }, /* int-mic */
10669 { 0x1b, 0x01214020 }, /* HP */
10670 { 0x21, 0x0121401f }, /* HP */
10671 { }
10672 },
10673 .chained = true,
10674 .chain_id = ALC662_FIXUP_SKU_IGNORE
10675 },
10676 [ALC662_FIXUP_ASUS_MODE8] = {
1727a771
TI
10677 .type = HDA_FIXUP_PINS,
10678 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10679 { 0x14, 0x99130110 }, /* speaker */
10680 { 0x12, 0x99a30970 }, /* int-mic */
10681 { 0x15, 0x01214020 }, /* HP */
10682 { 0x17, 0x99130111 }, /* speaker */
10683 { 0x18, 0x01a19840 }, /* mic */
10684 { 0x21, 0x0121401f }, /* HP */
10685 { }
10686 },
10687 .chained = true,
10688 .chain_id = ALC662_FIXUP_SKU_IGNORE
2996bdba 10689 },
1565cc35 10690 [ALC662_FIXUP_NO_JACK_DETECT] = {
1727a771 10691 .type = HDA_FIXUP_FUNC,
1565cc35
TI
10692 .v.func = alc_fixup_no_jack_detect,
10693 },
edfe3bfc 10694 [ALC662_FIXUP_ZOTAC_Z68] = {
1727a771
TI
10695 .type = HDA_FIXUP_PINS,
10696 .v.pins = (const struct hda_pintbl[]) {
edfe3bfc
DH
10697 { 0x1b, 0x02214020 }, /* Front HP */
10698 { }
10699 }
10700 },
125821ae 10701 [ALC662_FIXUP_INV_DMIC] = {
1727a771 10702 .type = HDA_FIXUP_FUNC,
9d36a7dc 10703 .v.func = alc_fixup_inv_dmic,
125821ae 10704 },
033b0a7c
GM
10705 [ALC668_FIXUP_DELL_XPS13] = {
10706 .type = HDA_FIXUP_FUNC,
10707 .v.func = alc_fixup_dell_xps13,
10708 .chained = true,
10709 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10710 },
5e6db669
GM
10711 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10712 .type = HDA_FIXUP_FUNC,
10713 .v.func = alc_fixup_disable_aamix,
10714 .chained = true,
10715 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10716 },
493a52a9
HW
10717 [ALC668_FIXUP_AUTO_MUTE] = {
10718 .type = HDA_FIXUP_FUNC,
10719 .v.func = alc_fixup_auto_mute_via_amp,
10720 .chained = true,
10721 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10722 },
1f8b46cd
DH
10723 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10724 .type = HDA_FIXUP_PINS,
10725 .v.pins = (const struct hda_pintbl[]) {
10726 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10727 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10728 { }
10729 },
10730 .chained = true,
10731 .chain_id = ALC662_FIXUP_HEADSET_MODE
10732 },
10733 [ALC662_FIXUP_HEADSET_MODE] = {
10734 .type = HDA_FIXUP_FUNC,
10735 .v.func = alc_fixup_headset_mode_alc662,
10736 },
73bdd597
DH
10737 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10738 .type = HDA_FIXUP_PINS,
10739 .v.pins = (const struct hda_pintbl[]) {
10740 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10741 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10742 { }
10743 },
10744 .chained = true,
10745 .chain_id = ALC668_FIXUP_HEADSET_MODE
10746 },
10747 [ALC668_FIXUP_HEADSET_MODE] = {
10748 .type = HDA_FIXUP_FUNC,
10749 .v.func = alc_fixup_headset_mode_alc668,
10750 },
8e54b4ac 10751 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8e383953 10752 .type = HDA_FIXUP_FUNC,
eb9ca3ab 10753 .v.func = alc_fixup_bass_chmap,
8e383953
TI
10754 .chained = true,
10755 .chain_id = ALC662_FIXUP_ASUS_MODE4
10756 },
61a75f13
DH
10757 [ALC662_FIXUP_BASS_16] = {
10758 .type = HDA_FIXUP_PINS,
10759 .v.pins = (const struct hda_pintbl[]) {
10760 {0x16, 0x80106111}, /* bass speaker */
10761 {}
10762 },
10763 .chained = true,
10764 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10765 },
a30c9aaa
TI
10766 [ALC662_FIXUP_BASS_1A] = {
10767 .type = HDA_FIXUP_PINS,
10768 .v.pins = (const struct hda_pintbl[]) {
10769 {0x1a, 0x80106111}, /* bass speaker */
10770 {}
10771 },
8e54b4ac
DH
10772 .chained = true,
10773 .chain_id = ALC662_FIXUP_BASS_CHMAP,
a30c9aaa 10774 },
8e54b4ac 10775 [ALC662_FIXUP_BASS_CHMAP] = {
a30c9aaa 10776 .type = HDA_FIXUP_FUNC,
eb9ca3ab 10777 .v.func = alc_fixup_bass_chmap,
a30c9aaa 10778 },
9d4dc584
BM
10779 [ALC662_FIXUP_ASUS_Nx50] = {
10780 .type = HDA_FIXUP_FUNC,
10781 .v.func = alc_fixup_auto_mute_via_amp,
10782 .chained = true,
10783 .chain_id = ALC662_FIXUP_BASS_1A
10784 },
fc7438b1
MP
10785 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10786 .type = HDA_FIXUP_FUNC,
10787 .v.func = alc_fixup_headset_mode_alc668,
10788 .chain_id = ALC662_FIXUP_BASS_CHMAP
10789 },
3231e205
YP
10790 [ALC668_FIXUP_ASUS_Nx51] = {
10791 .type = HDA_FIXUP_PINS,
10792 .v.pins = (const struct hda_pintbl[]) {
fc7438b1
MP
10793 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10794 { 0x1a, 0x90170151 }, /* bass speaker */
10795 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
3231e205
YP
10796 {}
10797 },
10798 .chained = true,
fc7438b1 10799 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 10800 },
5b7c5e1f 10801 [ALC668_FIXUP_MIC_COEF] = {
11ba6111
TI
10802 .type = HDA_FIXUP_VERBS,
10803 .v.verbs = (const struct hda_verb[]) {
10804 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10805 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10806 {}
10807 },
10808 },
5b7c5e1f
TI
10809 [ALC668_FIXUP_ASUS_G751] = {
10810 .type = HDA_FIXUP_PINS,
10811 .v.pins = (const struct hda_pintbl[]) {
10812 { 0x16, 0x0421101f }, /* HP */
10813 {}
10814 },
10815 .chained = true,
10816 .chain_id = ALC668_FIXUP_MIC_COEF
10817 },
78f4f7c2
KY
10818 [ALC891_FIXUP_HEADSET_MODE] = {
10819 .type = HDA_FIXUP_FUNC,
10820 .v.func = alc_fixup_headset_mode,
10821 },
10822 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10823 .type = HDA_FIXUP_PINS,
10824 .v.pins = (const struct hda_pintbl[]) {
10825 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10826 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10827 { }
10828 },
10829 .chained = true,
10830 .chain_id = ALC891_FIXUP_HEADSET_MODE
10831 },
9b51fe3e
SB
10832 [ALC662_FIXUP_ACER_VERITON] = {
10833 .type = HDA_FIXUP_PINS,
10834 .v.pins = (const struct hda_pintbl[]) {
10835 { 0x15, 0x50170120 }, /* no internal speaker */
10836 { }
10837 }
10838 },
1a3f0991
TI
10839 [ALC892_FIXUP_ASROCK_MOBO] = {
10840 .type = HDA_FIXUP_PINS,
10841 .v.pins = (const struct hda_pintbl[]) {
10842 { 0x15, 0x40f000f0 }, /* disabled */
10843 { 0x16, 0x40f000f0 }, /* disabled */
1a3f0991
TI
10844 { }
10845 }
10846 },
c6790c8e
KY
10847 [ALC662_FIXUP_USI_FUNC] = {
10848 .type = HDA_FIXUP_FUNC,
10849 .v.func = alc662_fixup_usi_headset_mic,
10850 },
10851 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10852 .type = HDA_FIXUP_PINS,
10853 .v.pins = (const struct hda_pintbl[]) {
10854 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10855 { 0x18, 0x01a1903d },
10856 { }
10857 },
10858 .chained = true,
10859 .chain_id = ALC662_FIXUP_USI_FUNC
10860 },
ca169cc2
KY
10861 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10862 .type = HDA_FIXUP_FUNC,
10863 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10864 },
00066e97
SB
10865 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10866 .type = HDA_FIXUP_FUNC,
10867 .v.func = alc662_fixup_aspire_ethos_hp,
10868 },
00066e97
SB
10869 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10870 .type = HDA_FIXUP_PINS,
10871 .v.pins = (const struct hda_pintbl[]) {
10872 { 0x15, 0x92130110 }, /* front speakers */
10873 { 0x18, 0x99130111 }, /* center/subwoofer */
10874 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10875 { }
10876 },
10877 .chained = true,
336820c4 10878 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
00066e97 10879 },
5af29028
KY
10880 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10881 .type = HDA_FIXUP_FUNC,
10882 .v.func = alc671_fixup_hp_headset_mic2,
10883 },
d858c706
JHP
10884 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10885 .type = HDA_FIXUP_PINS,
10886 .v.pins = (const struct hda_pintbl[]) {
10887 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10888 { }
10889 },
10890 .chained = true,
10891 .chain_id = ALC662_FIXUP_USI_FUNC
10892 },
a124458a
JHP
10893 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10894 .type = HDA_FIXUP_PINS,
10895 .v.pins = (const struct hda_pintbl[]) {
10896 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10897 { 0x1b, 0x0221144f },
10898 { }
10899 },
10900 .chained = true,
10901 .chain_id = ALC662_FIXUP_USI_FUNC
10902 },
a3fd1a98
HW
10903 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
10904 .type = HDA_FIXUP_PINS,
10905 .v.pins = (const struct hda_pintbl[]) {
10906 { 0x1b, 0x04a1112c },
10907 { }
10908 },
10909 .chained = true,
10910 .chain_id = ALC668_FIXUP_HEADSET_MIC
10911 },
10912 [ALC668_FIXUP_HEADSET_MIC] = {
10913 .type = HDA_FIXUP_FUNC,
10914 .v.func = alc269_fixup_headset_mic,
10915 .chained = true,
10916 .chain_id = ALC668_FIXUP_MIC_DET_COEF
10917 },
10918 [ALC668_FIXUP_MIC_DET_COEF] = {
10919 .type = HDA_FIXUP_VERBS,
10920 .v.verbs = (const struct hda_verb[]) {
10921 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
10922 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
10923 {}
10924 },
10925 },
d7f32791
KY
10926 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
10927 .type = HDA_FIXUP_FUNC,
10928 .v.func = alc897_fixup_lenovo_headset_mic,
10929 },
10930 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
10931 .type = HDA_FIXUP_PINS,
10932 .v.pins = (const struct hda_pintbl[]) {
10933 { 0x1a, 0x03a11050 },
10934 { }
10935 },
10936 .chained = true,
10937 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
10938 },
6cb3b707
DH
10939};
10940
a9111321 10941static const struct snd_pci_quirk alc662_fixup_tbl[] = {
53c334ad 10942 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
d3d3835c 10943 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
02f6ff90 10944 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
a6c47a85 10945 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
94024cd1 10946 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
125821ae 10947 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
1801928e 10948 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
2df03514 10949 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
9edeb110 10950 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
a124458a 10951 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
d858c706 10952 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
73bdd597
DH
10953 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10954 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
c5d019c3 10955 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
033b0a7c 10956 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
467e1436 10957 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
09d2014f 10958 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
ad8ff99e 10959 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8dc9abb9
KY
10960 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10961 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6a98e34b 10962 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
e59ea3ed 10963 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
148ebf54 10964 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
2da2dc9e 10965 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
83a9efb5 10966 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
9d4dc584 10967 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11ba6111 10968 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
9edeb110 10969 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
8e54b4ac 10970 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
61a75f13 10971 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
3231e205
YP
10972 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
10973 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
a3fd1a98 10974 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
c7efff92 10975 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
61a75f13 10976 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8e54b4ac 10977 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
1565cc35 10978 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
53c334ad 10979 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
a0e90acc 10980 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
c6790c8e 10981 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
ca169cc2 10982 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
d7f32791
KY
10983 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
10984 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
10985 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
10986 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
d4118588 10987 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6cb3b707 10988 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1a3f0991 10989 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
edfe3bfc 10990 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
9b51fe3e 10991 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
f1ec5be1 10992 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
d2ebd479 10993 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
53c334ad
TI
10994
10995#if 0
10996 /* Below is a quirk table taken from the old code.
10997 * Basically the device should work as is without the fixup table.
10998 * If BIOS doesn't give a proper info, enable the corresponding
10999 * fixup entry.
7d7eb9ea 11000 */
53c334ad
TI
11001 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
11002 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
11003 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
11004 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
11005 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11006 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11007 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11008 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
11009 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
11010 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11011 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
11012 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
11013 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
11014 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
11015 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
11016 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11017 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
11018 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
11019 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11020 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11021 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11022 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11023 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
11024 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
11025 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
11026 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11027 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
11028 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11029 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11030 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
11031 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11032 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11033 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
11034 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
11035 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
11036 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
11037 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
11038 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
11039 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
11040 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11041 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
11042 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
11043 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11044 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
11045 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
11046 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
11047 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
11048 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
11049 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11050 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
11051#endif
6cb3b707
DH
11052 {}
11053};
11054
1727a771 11055static const struct hda_model_fixup alc662_fixup_models[] = {
aa3841b5
TI
11056 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
11057 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
6be7948f 11058 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
aa3841b5 11059 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
53c334ad
TI
11060 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
11061 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
11062 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
11063 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
11064 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
11065 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
11066 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
11067 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
aa3841b5 11068 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
6e72aa5f 11069 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
aa3841b5 11070 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
e32aa85a 11071 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
aa3841b5
TI
11072 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
11073 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
11074 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
11075 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
11076 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
11077 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
11078 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
11079 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
40c51675 11080 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
aa3841b5
TI
11081 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
11082 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
11083 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
11084 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
11085 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
ba90d6a6 11086 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
00066e97 11087 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
6be7948f
TB
11088 {}
11089};
6cb3b707 11090
532895c5 11091static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
78f4f7c2
KY
11092 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11093 {0x17, 0x02211010},
11094 {0x18, 0x01a19030},
11095 {0x1a, 0x01813040},
11096 {0x21, 0x01014020}),
4b4e0e32
HW
11097 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11098 {0x16, 0x01813030},
11099 {0x17, 0x02211010},
11100 {0x18, 0x01a19040},
11101 {0x21, 0x01014020}),
1f8b46cd 11102 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 11103 {0x14, 0x01014010},
1f8b46cd 11104 {0x18, 0x01a19020},
1f8b46cd 11105 {0x1a, 0x0181302f},
11580297 11106 {0x1b, 0x0221401f}),
76c2132e
DH
11107 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11108 {0x12, 0x99a30130},
11109 {0x14, 0x90170110},
11110 {0x15, 0x0321101f},
11580297 11111 {0x16, 0x03011020}),
76c2132e
DH
11112 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11113 {0x12, 0x99a30140},
11114 {0x14, 0x90170110},
11115 {0x15, 0x0321101f},
11580297 11116 {0x16, 0x03011020}),
76c2132e
DH
11117 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11118 {0x12, 0x99a30150},
11119 {0x14, 0x90170110},
11120 {0x15, 0x0321101f},
11580297 11121 {0x16, 0x03011020}),
76c2132e 11122 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
76c2132e
DH
11123 {0x14, 0x90170110},
11124 {0x15, 0x0321101f},
11580297 11125 {0x16, 0x03011020}),
76c2132e
DH
11126 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
11127 {0x12, 0x90a60130},
11128 {0x14, 0x90170110},
11580297 11129 {0x15, 0x0321101f}),
5af29028
KY
11130 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11131 {0x14, 0x01014010},
11132 {0x17, 0x90170150},
f2adbae0 11133 {0x19, 0x02a11060},
5af29028
KY
11134 {0x1b, 0x01813030},
11135 {0x21, 0x02211020}),
11136 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11137 {0x14, 0x01014010},
11138 {0x18, 0x01a19040},
11139 {0x1b, 0x01813030},
11140 {0x21, 0x02211020}),
11141 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11142 {0x14, 0x01014020},
11143 {0x17, 0x90170110},
11144 {0x18, 0x01a19050},
11145 {0x1b, 0x01813040},
11146 {0x21, 0x02211030}),
532895c5
HW
11147 {}
11148};
11149
1d045db9
TI
11150/*
11151 */
bc9f98a9
KY
11152static int patch_alc662(struct hda_codec *codec)
11153{
11154 struct alc_spec *spec;
3de95173 11155 int err;
bc9f98a9 11156
3de95173
TI
11157 err = alc_alloc_spec(codec, 0x0b);
11158 if (err < 0)
11159 return err;
bc9f98a9 11160
3de95173 11161 spec = codec->spec;
1f0f4b80 11162
225068ab
TI
11163 spec->shutup = alc_eapd_shutup;
11164
53c334ad
TI
11165 /* handle multiple HPs as is */
11166 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
11167
2c3bf9ab
TI
11168 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11169
7639a06c 11170 switch (codec->core.vendor_id) {
f3f9185f
KY
11171 case 0x10ec0668:
11172 spec->init_hook = alc668_restore_default_value;
11173 break;
f3f9185f 11174 }
8663ff75 11175
c9af753f
TI
11176 alc_pre_init(codec);
11177
1727a771 11178 snd_hda_pick_fixup(codec, alc662_fixup_models,
8e5a0509 11179 alc662_fixup_tbl, alc662_fixups);
0fc1e447 11180 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
1727a771 11181 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8e5a0509
TI
11182
11183 alc_auto_parse_customize_define(codec);
11184
7504b6cd
TI
11185 if (has_cdefine_beep(codec))
11186 spec->gen.beep_nid = 0x01;
11187
1bb7e43e 11188 if ((alc_get_coef0(codec) & (1 << 14)) &&
5100cd07 11189 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 11190 spec->cdefine.platform_type == 1) {
6134b1a2
WY
11191 err = alc_codec_rename(codec, "ALC272X");
11192 if (err < 0)
e16fb6d1 11193 goto error;
20ca0c35 11194 }
274693f3 11195
b9c5106c
TI
11196 /* automatic parse from the BIOS config */
11197 err = alc662_parse_auto_config(codec);
e16fb6d1
TI
11198 if (err < 0)
11199 goto error;
bc9f98a9 11200
7504b6cd 11201 if (!spec->gen.no_analog && spec->gen.beep_nid) {
7639a06c 11202 switch (codec->core.vendor_id) {
da00c244 11203 case 0x10ec0662:
fea80fae 11204 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
da00c244
KY
11205 break;
11206 case 0x10ec0272:
11207 case 0x10ec0663:
11208 case 0x10ec0665:
9ad54547 11209 case 0x10ec0668:
fea80fae 11210 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
da00c244
KY
11211 break;
11212 case 0x10ec0273:
fea80fae 11213 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
da00c244
KY
11214 break;
11215 }
fea80fae
TI
11216 if (err < 0)
11217 goto error;
cec27c89 11218 }
2134ea4f 11219
1727a771 11220 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 11221
bc9f98a9 11222 return 0;
801f49d3 11223
e16fb6d1
TI
11224 error:
11225 alc_free(codec);
11226 return err;
b478b998
KY
11227}
11228
d1eb57f4
KY
11229/*
11230 * ALC680 support
11231 */
d1eb57f4 11232
d1eb57f4
KY
11233static int alc680_parse_auto_config(struct hda_codec *codec)
11234{
3e6179b8 11235 return alc_parse_auto_config(codec, NULL, NULL);
d1eb57f4
KY
11236}
11237
d1eb57f4 11238/*
d1eb57f4 11239 */
d1eb57f4
KY
11240static int patch_alc680(struct hda_codec *codec)
11241{
d1eb57f4
KY
11242 int err;
11243
1f0f4b80 11244 /* ALC680 has no aa-loopback mixer */
3de95173
TI
11245 err = alc_alloc_spec(codec, 0);
11246 if (err < 0)
11247 return err;
1f0f4b80 11248
1ebec5f2
TI
11249 /* automatic parse from the BIOS config */
11250 err = alc680_parse_auto_config(codec);
11251 if (err < 0) {
11252 alc_free(codec);
11253 return err;
d1eb57f4
KY
11254 }
11255
d1eb57f4
KY
11256 return 0;
11257}
11258
1da177e4
LT
11259/*
11260 * patch entries
11261 */
b9a94a9c 11262static const struct hda_device_id snd_hda_id_realtek[] = {
0a6f0600 11263 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
b9a94a9c 11264 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
2a36c16e 11265 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
4231430d 11266 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
1948fc06 11267 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
b9a94a9c
TI
11268 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11269 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
dcd4f0db 11270 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
b9a94a9c 11271 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
736f20a7 11272 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
7fbdcd83 11273 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
b9a94a9c
TI
11274 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11275 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
f429e7e4 11276 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
b9a94a9c
TI
11277 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11278 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11279 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11280 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11281 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11282 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11283 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
dcd4f0db 11284 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
b9a94a9c
TI
11285 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11286 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11287 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11288 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11289 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11290 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
0a6f0600 11291 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
b9a94a9c 11292 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
630e3612 11293 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
b9a94a9c 11294 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
0a6f0600 11295 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
b9a94a9c
TI
11296 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11297 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11298 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
dcd4f0db 11299 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
7d727869 11300 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
b9a94a9c 11301 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
28f1f9b2 11302 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
1078bef0 11303 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
f0778871 11304 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
b9a94a9c
TI
11305 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11306 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11307 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11308 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11309 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11310 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11311 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11312 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11313 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11314 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11315 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11316 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11317 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11318 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
6fbae35a
KY
11319 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11320 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11321 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
83629532 11322 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
78f4f7c2 11323 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
b9a94a9c
TI
11324 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11325 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11326 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11327 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11328 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11329 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11330 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11331 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11332 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11333 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11334 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
e5782a5d 11335 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
b9a94a9c
TI
11336 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11337 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
6d9ffcff 11338 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
65553b12 11339 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
a535ad57 11340 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
1da177e4
LT
11341 {} /* terminator */
11342};
b9a94a9c 11343MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
1289e9e8
TI
11344
11345MODULE_LICENSE("GPL");
11346MODULE_DESCRIPTION("Realtek HD-audio codec");
11347
d8a766a1 11348static struct hda_codec_driver realtek_driver = {
b9a94a9c 11349 .id = snd_hda_id_realtek,
1289e9e8
TI
11350};
11351
d8a766a1 11352module_hda_codec_driver(realtek_driver);